2010-12-02 23:34:41 +00:00
|
|
|
<?php
|
2021-11-26 15:58:35 +00:00
|
|
|
|
2022-11-16 16:20:43 +00:00
|
|
|
use Illuminate\Support\Facades\Crypt;
|
|
|
|
|
|
2022-01-26 14:18:22 -04:00
|
|
|
/*----------------------------------********---------------------------------*/
|
2015-04-09 16:25:47 -04:00
|
|
|
//Browser Compatibility
|
|
|
|
|
$browserSupported = G::checkBrowserCompatibility();
|
2017-12-04 13:25:35 +00:00
|
|
|
if ($browserSupported==false) {
|
|
|
|
|
if (!isset($_SESSION['G_MESSAGE']) || $_SESSION['G_MESSAGE'] == "") {
|
|
|
|
|
G::SendTemporalMessage('ID_CURRENT_BROWSER_NOT_SUPPORTED', 'warning');
|
|
|
|
|
}
|
2014-10-20 17:41:47 -04:00
|
|
|
}
|
2014-12-04 10:23:06 -04:00
|
|
|
/*----------------------------------********---------------------------------*/
|
2012-07-10 19:01:57 -04:00
|
|
|
if (isset ($_POST['form']['USER_ENV'])) {
|
2022-11-16 16:20:43 +00:00
|
|
|
$data = Crypt::encryptString(serialize($_POST));
|
2014-02-18 23:20:10 -04:00
|
|
|
$url = sprintf('/sys%s/%s/%s/login/sysLoginVerify?d=%s', $_POST['form']['USER_ENV'], SYS_LANG, SYS_SKIN, $data);
|
|
|
|
|
G::header("location: $url");
|
|
|
|
|
die();
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2013-08-08 15:36:21 -04:00
|
|
|
//Save session variables
|
|
|
|
|
$arraySession = array();
|
|
|
|
|
|
2019-05-21 10:26:41 -04:00
|
|
|
if (!empty($_SESSION['G_MESSAGE'])) {
|
2013-08-08 15:36:21 -04:00
|
|
|
$arraySession["G_MESSAGE"] = $_SESSION["G_MESSAGE"];
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-21 10:26:41 -04:00
|
|
|
if (!empty($_SESSION['G_MESSAGE_TYPE'])) {
|
2013-08-08 15:36:21 -04:00
|
|
|
$arraySession["G_MESSAGE_TYPE"] = $_SESSION["G_MESSAGE_TYPE"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Initialize session
|
2013-10-01 09:15:28 -04:00
|
|
|
@session_destroy();
|
2012-10-01 13:44:27 -04:00
|
|
|
session_start();
|
|
|
|
|
session_regenerate_id();
|
|
|
|
|
|
2021-11-26 15:58:35 +00:00
|
|
|
//Set options for PHP session cookie
|
|
|
|
|
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'httponly' => true]);
|
|
|
|
|
setcookie(session_name(), session_id(), $cookieOptions);
|
|
|
|
|
|
2013-08-08 15:36:21 -04:00
|
|
|
//Restore session variables
|
|
|
|
|
$_SESSION = array_merge($_SESSION, $arraySession);
|
|
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
//Required classes for dbArray work
|
2017-12-04 13:25:35 +00:00
|
|
|
Propel::init(PATH_CORE . "config/databases.php");
|
|
|
|
|
Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
function getLangFiles()
|
|
|
|
|
{
|
|
|
|
|
$dir = PATH_LANGUAGECONT;
|
2017-12-04 13:25:35 +00:00
|
|
|
$filesArray = array();
|
|
|
|
|
if (file_exists($dir)) {
|
|
|
|
|
if ($handle = opendir($dir)) {
|
|
|
|
|
while (false !== ($file = readdir($handle))) {
|
|
|
|
|
$fileParts = explode(".", $file);
|
2012-07-10 19:01:57 -04:00
|
|
|
if ($fileParts [0] == "translation") {
|
|
|
|
|
$filesArray [$fileParts [1]] = $file;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-04 13:25:35 +00:00
|
|
|
closedir($handle);
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-07-10 19:01:57 -04:00
|
|
|
return $filesArray;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
function getWorkspacesAvailable()
|
|
|
|
|
{
|
2017-12-04 13:25:35 +00:00
|
|
|
$oServerConf = ServerConf::getSingleton();
|
2012-07-10 19:01:57 -04:00
|
|
|
$dir = PATH_DB;
|
2017-12-04 13:25:35 +00:00
|
|
|
$filesArray = array();
|
|
|
|
|
if (file_exists($dir)) {
|
|
|
|
|
if ($handle = opendir($dir)) {
|
|
|
|
|
while (false !== ($file = readdir($handle))) {
|
2012-07-10 19:01:57 -04:00
|
|
|
if (($file != ".") && ($file != "..")) {
|
2017-12-04 13:25:35 +00:00
|
|
|
if (file_exists(PATH_DB . $file . '/db.php')) {
|
|
|
|
|
if (! $oServerConf->isWSDisabled($file)) {
|
2012-07-10 19:01:57 -04:00
|
|
|
$filesArray [] = $file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-04 13:25:35 +00:00
|
|
|
closedir($handle);
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2017-12-04 13:25:35 +00:00
|
|
|
sort($filesArray, SORT_STRING);
|
2012-07-10 19:01:57 -04:00
|
|
|
return $filesArray;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-11-12 14:44:44 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$availableWorkspace = getWorkspacesAvailable();
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2010-12-23 22:30:39 +00:00
|
|
|
//Translations
|
2012-11-12 14:44:44 -04:00
|
|
|
//$Translations = G::getModel("Translation"); <-- ugly way to get a class
|
|
|
|
|
require_once "classes/model/Translation.php";
|
|
|
|
|
$Translations = new Translation();
|
2010-12-23 22:30:39 +00:00
|
|
|
$translationsTable = $Translations->getTranslationEnvironments();
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$availableLangArray = array();
|
|
|
|
|
$availableLangArray [] = array('LANG_ID' => 'char', 'LANG_NAME' => 'char');
|
2012-07-10 19:01:57 -04:00
|
|
|
|
|
|
|
|
foreach ($translationsTable as $locale) {
|
|
|
|
|
$aFields['LANG_ID'] = $locale['LOCALE'];
|
|
|
|
|
if ($locale['COUNTRY'] != '.') {
|
|
|
|
|
$aFields['LANG_NAME'] = $locale['LANGUAGE'] . ' (' . (ucwords(strtolower($locale['COUNTRY']))) . ')';
|
|
|
|
|
} else {
|
|
|
|
|
$aFields['LANG_NAME'] = $locale['LANGUAGE'];
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-07-10 19:01:57 -04:00
|
|
|
$availableLangArray [] = $aFields;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$availableWorkspaceArray = array();
|
|
|
|
|
$availableWorkspaceArray [] = array('ENV_ID' => 'char', 'ENV_NAME' => 'char');
|
2012-07-10 19:01:57 -04:00
|
|
|
foreach ($availableWorkspace as $envKey => $envName) {
|
2017-12-04 13:25:35 +00:00
|
|
|
$aFields = array('ENV_ID' => $envName, 'ENV_NAME' => $envName);
|
2012-07-10 19:01:57 -04:00
|
|
|
$availableWorkspaceArray [] = $aFields;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
global $_DBArray;
|
|
|
|
|
|
|
|
|
|
$_DBArray ['langOptions'] = $availableLangArray;
|
|
|
|
|
$_DBArray ['availableWorkspace'] = $availableWorkspaceArray;
|
|
|
|
|
|
|
|
|
|
$_SESSION ['_DBArray'] = $_DBArray;
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$aField ['LOGIN_VERIFY_MSG'] = G::loadTranslation('LOGIN_VERIFY_MSG');
|
2012-07-10 17:55:22 -04:00
|
|
|
$aField['USER_LANG'] = SYS_LANG;
|
2012-11-12 14:44:44 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$G_PUBLISH = new Publisher();
|
2014-06-25 08:50:01 -04:00
|
|
|
if (!defined('WS_IN_LOGIN')) {
|
|
|
|
|
define('WS_IN_LOGIN', 'serverconf');
|
2014-06-23 15:12:57 -04:00
|
|
|
}
|
|
|
|
|
$fileLogin = 'login/sysLogin';
|
2015-09-25 19:55:26 -04:00
|
|
|
$version = explode('.', trim(file_get_contents(PATH_GULLIVER . 'VERSION')));
|
|
|
|
|
$version = isset($version[0]) ? intval($version[0]) : 0;
|
2014-06-25 08:50:01 -04:00
|
|
|
switch (WS_IN_LOGIN) {
|
2014-06-23 15:12:57 -04:00
|
|
|
case 'serverconf':
|
|
|
|
|
//Get Server Configuration
|
2017-12-04 13:25:35 +00:00
|
|
|
$oServerConf = ServerConf::getSingleton();
|
|
|
|
|
if ($oServerConf->getProperty('LOGIN_NO_WS')) {
|
2015-09-25 19:55:26 -04:00
|
|
|
$fileLogin = $version >= 3 ? 'login/sysLoginNoWSpm3' : 'login/sysLoginNoWS';
|
2014-06-23 15:12:57 -04:00
|
|
|
} else {
|
|
|
|
|
$fileLogin = 'login/sysLogin';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'no':
|
2015-09-25 19:55:26 -04:00
|
|
|
$fileLogin = $version >= 3 ? 'login/sysLoginNoWSpm3' : 'login/sysLoginNoWS';
|
2014-06-23 15:12:57 -04:00
|
|
|
break;
|
|
|
|
|
case 'yes':
|
|
|
|
|
$fileLogin = 'login/sysLogin';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$fileLogin = 'login/sysLogin';
|
|
|
|
|
break;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2021-11-26 15:58:35 +00:00
|
|
|
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => SYS_CURRENT_URI]);
|
|
|
|
|
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), $cookieOptions);
|
|
|
|
|
|
|
|
|
|
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
|
|
|
|
|
setcookie('PM-TabPrimary', uniqid(), $cookieOptions);
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$oHeadPublisher = headPublisher::getSingleton();
|
2016-03-08 18:37:38 -04:00
|
|
|
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
|
|
|
|
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
|
|
|
|
|
$oHeadPublisher->addScriptFile('/jscore/src/Register.js');
|
2015-11-30 16:43:13 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$G_PUBLISH->AddContent('xmlform', 'xmlform', $fileLogin, '', $aField, 'sysLogin');
|
|
|
|
|
G::RenderPage("publish");
|