diff --git a/conlite/classes/class.inuse.php b/conlite/classes/class.inuse.php index 13cdf76..c610667 100644 --- a/conlite/classes/class.inuse.php +++ b/conlite/classes/class.inuse.php @@ -65,6 +65,10 @@ class InUseCollection extends ItemCollection $objectid = Contenido_Security::escapeDB($objectid, null); $session = Contenido_Security::escapeDB($session, null); $user = Contenido_Security::escapeDB($user, null); + + if(empty($type)) { + $type = "unknown"; + } $this->select("type = '".$type."' AND objectid = '".$objectid."'"); diff --git a/conlite/main.php b/conlite/main.php index 5dcd6a6..5e665c0 100644 --- a/conlite/main.php +++ b/conlite/main.php @@ -1,4 +1,5 @@ 'Contenido_Session', - 'auth' => 'Contenido_Challenge_Crypt_Auth', - 'perm' => 'Contenido_Perm')); + 'auth' => 'Contenido_Challenge_Crypt_Auth', + 'perm' => 'Contenido_Perm')); -i18nInit($cfg["path"]["contenido"].$cfg["path"]["locale"], $belang); +i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang); /** * Bugfix @@ -59,20 +59,19 @@ i18nInit($cfg["path"]["contenido"].$cfg["path"]["locale"], $belang); //includePluginConf(); require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php'; -cInclude ("includes", 'cfg_language_de.inc.php'); +cInclude("includes", 'cfg_language_de.inc.php'); -if ($cfg["use_pseudocron"] == true) -{ +if ($cfg["use_pseudocron"] == true) { /* Include cronjob-Emulator, but only for frame 1 */ - if($frame == 4) { + if ($frame == 4) { $sess->freeze(); $oldpwd = getcwd(); - chdir($cfg["path"]["contenido"].$cfg["path"]["cronjobs"]); + chdir($cfg["path"]["contenido"] . $cfg["path"]["cronjobs"]); cInclude("includes", "pseudo-cron.inc.php"); chdir($oldpwd); - if($bJobRunned == true) { + if ($bJobRunned == true) { // Some cronjobs might overwrite important system variables. // We are thaw'ing the session again to re-register these variables. $sess->thaw(); @@ -82,18 +81,16 @@ if ($cfg["use_pseudocron"] == true) /* Remove all own marks, only for frame 1 and 4 if $_REQUEST['appendparameters'] == 'filebrowser' - filebrowser is used in tiny in this case also do not remove session marks*/ -if (($frame == 1 || $frame == 4) && isset($_REQUEST['appendparameters']) && $_REQUEST['appendparameters'] != 'filebrowser') -{ - $col = new InUseCollection; - $col->removeSessionMarks($sess->id); + filebrowser is used in tiny in this case also do not remove session marks */ +if (($frame == 1 || $frame == 4) && isset($_REQUEST['appendparameters']) && $_REQUEST['appendparameters'] != 'filebrowser') { + $col = new InUseCollection; + $col->removeSessionMarks($sess->id); } /* If the override flag is set, override a specific InUseItem */ -if (isset($overrideid) && isset($overridetype)) -{ - $col = new InUseCollection; - $col->removeItemMarks($overridetype, $overrideid); +if (isset($overrideid) && isset($overridetype)) { + $col = new InUseCollection; + $col->removeItemMarks($overridetype, $overrideid); } # Create Contenido classes @@ -111,53 +108,47 @@ $currentuser->loadUserByUserID($auth->auth["uid"]); # change Client -if (isset($changeclient) && is_numeric($changeclient) ) { +if (isset($changeclient) && is_numeric($changeclient)) { $client = $changeclient; unset($lang); } # Sprache wechseln -if (isset($changelang) && is_numeric($changelang) ) { - unset($area_rights); - unset($item_rights); +if (isset($changelang) && is_numeric($changelang)) { + unset($area_rights); + unset($item_rights); $lang = $changelang; } -if (!is_numeric($client) || - (!$perm->have_perm_client("client[".$client."]") && - !$perm->have_perm_client("admin[".$client."]"))) -{ - // use first client which is accessible +if (!is_numeric($client) || (!$perm->have_perm_client("client[" . $client . "]") && !$perm->have_perm_client("admin[" . $client . "]"))) { + // use first client which is accessible $sess->register("client"); - $sql = "SELECT idclient FROM ".$cfg["tab"]["clients"]." ORDER BY idclient ASC"; + $sql = "SELECT idclient FROM " . $cfg["tab"]["clients"] . " ORDER BY idclient ASC"; $db->query($sql); - while ($db->next_record()) - { - $mclient = $db->f("idclient"); + while ($db->next_record()) { + $mclient = $db->f("idclient"); - if ($perm->have_perm_client("client[".$mclient."]") || - $perm->have_perm_client("admin[".$mclient."]") ) - { - unset($lang); - $client = $mclient; - break; - } + if ($perm->have_perm_client("client[" . $mclient . "]") || $perm->have_perm_client("admin[" . $mclient . "]")) { + unset($lang); + $client = $mclient; + break; + } } } else { - $sess->register("client"); + $sess->register("client"); } if (!is_numeric($lang) || $lang == "") { $sess->register("lang"); # search for the first language of this client - $sql = "SELECT * FROM ".$cfg["tab"]["lang"]." AS A, ".$cfg["tab"]["clients_lang"]." AS B WHERE A.idlang=B.idlang AND idclient='".Contenido_Security::toInteger($client)."' ORDER BY A.idlang ASC"; + $sql = "SELECT * FROM " . $cfg["tab"]["lang"] . " AS A, " . $cfg["tab"]["clients_lang"] . " AS B WHERE A.idlang=B.idlang AND idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY A.idlang ASC"; $db->query($sql); $db->next_record(); $lang = $db->f("idlang"); } else { - $sess->register("lang"); + $sess->register("lang"); } // send right encoding http header @@ -166,11 +157,10 @@ sendEncodingHeader($db, $cfg, $lang); $perm->load_permissions(); # Create Contenido classes -$xml = new XML_doc; -$tpl = new Template; -$backend = new Contenido_Backend; +$xml = new XML_doc; +$tpl = new Template; +$backend = new Contenido_Backend; //$backend->debug=true; - # Register session variables $sess->register("sess_area"); @@ -184,7 +174,7 @@ $sess->register("cfgClient"); $sess->register("errsite_idcat"); $sess->register("errsite_idart"); -if(!isset($cfgClient) || !isset($cfgClient["set"]) || $cfgClient["set"] != "set") { +if (!isset($cfgClient) || !isset($cfgClient["set"]) || $cfgClient["set"] != "set") { rereadClients(); } @@ -192,9 +182,8 @@ if(!isset($cfgClient) || !isset($cfgClient["set"]) || $cfgClient["set"] != "set" # Load all actions from the DB # and check if permission is # granted. -if ($cfg["debug"]["rendering"] == true) -{ - $oldmemusage = memory_get_usage(); +if ($cfg["debug"]["rendering"] == true) { + $oldmemusage = memory_get_usage(); } # Select frameset $backend->setFrame($frame); @@ -209,20 +198,17 @@ $cfg["debug"]["backend_exectime"]["start"] = getmicrotime(); # one file is required. if (is_array($backend->getFile('inc'))) { foreach ($backend->getFile('inc') as $filename) { - include_once($cfg['path']['contenido'].$filename); - + include_once($cfg['path']['contenido'] . $filename); } } # If $action is set -> User klicked some button/link # get the appopriate code for this action and evaluate it. -if (isset($action) && $action != "") -{ - if (!isset($idart)) - { - $idart = 0; - } +if (isset($action) && $action != "") { + if (!isset($idart)) { + $idart = 0; + } $backend->log($idcat, $idart, $client, $lang, $action); } @@ -231,15 +217,14 @@ if (isset($action) && $action != "") if (isset($action)) { if ($backend->getCode($action) != '') { if ($backend->debug == 1) { - echo '
Executing:'."\n";
-            echo $backend->getCode($action)."\n";
+            echo '
Executing:' . "\n";
+            echo $backend->getCode($action) . "\n";
             echo '
'; } eval($backend->getCode($action)); - } else { if ($backend->debug == 1) { - echo '
Executing:'."\n";
+            echo '
Executing:' . "\n";
             echo "no code available in action\n";
             echo '
'; } @@ -248,46 +233,36 @@ if (isset($action)) { # Include the 'main' file for the selected area. # Usually there is only one main file -if (is_array($backend->getFile('main'))) -{ - foreach ($backend->getFile('main') as $id => $filename) - { - include_once($cfg['path']['contenido'].$filename); - } - -} -elseif( $frame == 3 ) -{ - include_once($cfg['path']['contenido'].$cfg['path']['includes'] ."include.default_subnav.php" ); -} -else -{ - include_once($cfg['path']['contenido'].$cfg['path']['includes'] ."include.blank.php"); +if (is_array($backend->getFile('main'))) { + foreach ($backend->getFile('main') as $id => $filename) { + include_once($cfg['path']['contenido'] . $filename); + } +} elseif ($frame == 3) { + include_once($cfg['path']['contenido'] . $cfg['path']['includes'] . "include.default_subnav.php" ); +} else { + include_once($cfg['path']['contenido'] . $cfg['path']['includes'] . "include.blank.php"); } $cfg["debug"]["backend_exectime"]["end"] = getmicrotime(); -if ($cfg["debug"]["rendering"] == true) -{ - echo "Building this page (excluding contenido includes) took: " . ($cfg["debug"]["backend_exectime"]["end"] - $cfg["debug"]["backend_exectime"]["start"])." seconds
"; - echo "Building the complete page took: " . ($cfg["debug"]["backend_exectime"]["end"] - $cfg["debug"]["backend_exectime"]["fullstart"])." seconds
"; +if ($cfg["debug"]["rendering"] == true) { + echo "Building this page (excluding contenido includes) took: " . ($cfg["debug"]["backend_exectime"]["end"] - $cfg["debug"]["backend_exectime"]["start"]) . " seconds
"; + echo "Building the complete page took: " . ($cfg["debug"]["backend_exectime"]["end"] - $cfg["debug"]["backend_exectime"]["fullstart"]) . " seconds
"; - echo "Include memory usage: ".human_readable_size(memory_get_usage()-$oldmemusage)."
"; - echo "Complete memory usage: ".human_readable_size(memory_get_usage())."
"; + echo "Include memory usage: " . human_readable_size(memory_get_usage() - $oldmemusage) . "
"; + echo "Complete memory usage: " . human_readable_size(memory_get_usage()) . "
"; } /** * Start User Tracking (who is online) * - **/ + * */ $oActiveUser = new ActiveUsers($db, $cfg, $auth); $oActiveUser->startUsersTracking(); /** * * End of the User Tracking */ - $db->disconnect(); page_close(); - ?> \ No newline at end of file diff --git a/setup/data/tables.txt b/setup/data/tables.txt index cb2f1e1..fe40fe9 100644 --- a/setup/data/tables.txt +++ b/setup/data/tables.txt @@ -226,10 +226,10 @@ "groups";"perms";"mediumtext";"YES";"";"";"";"" "groups";"description";"varchar(255)";"YES";"";"";"";"" "inuse";"idinuse";"int(10)";"NO";"PRI";"0";"";"1" -"inuse";"type";"varchar(32)";"NO";"";"";"";"" -"inuse";"objectid";"varchar(32)";"NO";"";"";"";"" -"inuse";"session";"varchar(32)";"NO";"";"";"";"" -"inuse";"userid";"varchar(32)";"NO";"";"";"";"" +"inuse";"type";"varchar(32)";"YES";"";"";"";"" +"inuse";"objectid";"varchar(32)";"YES";"";"";"";"" +"inuse";"session";"varchar(32)";"YES";"";"";"";"" +"inuse";"userid";"varchar(32)";"YES";"";"";"";"" "keywords";"idkeyword";"int(10)";"NO";"PRI";"0";"";"1" "keywords";"keyword";"varchar(50)";"NO";"MUL";"";"";"" "keywords";"exp";"text";"NO";"";"";"";"" diff --git a/setup/dbupdate.php b/setup/dbupdate.php index 7d93e85..ab89369 100644 --- a/setup/dbupdate.php +++ b/setup/dbupdate.php @@ -52,11 +52,7 @@ if (checkMySQLDatabaseCreation($db, $_SESSION['dbname'])) { $db = getSetupMySQLDBConnection(); } -$currentstep = $_GET['step']; - -if ($currentstep == 0) { - $currentstep = 1; -} +$currentstep = (empty($_GET['step']))?1:filter_input(INPUT_GET, "step", FILTER_SANITIZE_NUMBER_INT); // Count DB Chunks $file = fopen('data/tables.txt', 'r'); diff --git a/setup/lib/defines.php b/setup/lib/defines.php index 79020a0..bf230ce 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -56,6 +56,6 @@ define('C_SETUP_STEPFILE', 'images/steps/s%d.png'); define('C_SETUP_STEPFILE_ACTIVE', 'images/steps/s%da.png'); define('C_SETUP_STEPWIDTH', 28); define('C_SETUP_STEPHEIGHT', 28); -define('C_SETUP_MIN_PHP_VERSION', '5.3'); -define('C_SETUP_VERSION', '2.0.1'); +define('C_SETUP_MIN_PHP_VERSION', '5.6'); +define('C_SETUP_VERSION', '2.1.0'); ?> \ No newline at end of file diff --git a/setup/lib/functions.mysql.php b/setup/lib/functions.mysql.php index 746d178..83ccdba 100644 --- a/setup/lib/functions.mysql.php +++ b/setup/lib/functions.mysql.php @@ -62,7 +62,7 @@ function doMySQLConnect($host, $username, $password) { //$sFile = '../data/logs/setup_queries.txt'; //file_put_contents($sFile, $db->getServerInfo(), FILE_APPEND); //chmod($sFile, 0666); - if ($db->connect() == 0) { + if (empty($db->connect())) { return array($db, false); } else { return array($db, true); diff --git a/setup/lib/startup.php b/setup/lib/startup.php index 3aed609..fe7cec9 100644 --- a/setup/lib/startup.php +++ b/setup/lib/startup.php @@ -28,7 +28,7 @@ if (!defined('CON_FRAMEWORK')) { define('CON_BE_PATH', '../conlite/'); // uncomment this lines during development if needed -error_reporting(E_ALL ^E_NOTICE); +error_reporting(E_ALL ^ E_NOTICE); ini_set("display_errors", true); ini_set("log_errors", true); ini_set("error_log", "../data/logs/setup_errorlog.txt"); @@ -36,15 +36,14 @@ ini_set("error_log", "../data/logs/setup_errorlog.txt"); header('Content-Type: text/html; charset=UTF-8'); // Check version in the 'first' line, as class.security.php uses -// PHP5 object syntax not compatible with PHP < 5.2 -if (version_compare(PHP_VERSION, '5.3.0', '<')) { - die("You need PHP >= 5.3.0 for ConLite. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); +if (version_compare(PHP_VERSION, '5.6.0', '<')) { + die("You need PHP >= 5.6.0 for ConLite. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); } // Check version -//PHP >= 5.0.0 and < 6.0.0 -if (version_compare(PHP_VERSION, '7.2.0', '>=')) { - die("You need PHP >= 5.3.0 < 7.2.0 for ConLite. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); +//PHP >= 5.6.0 and < 7.3.0 +if (version_compare(PHP_VERSION, '7.3.0', '>=')) { + die("You need PHP >= 5.6.0 < 7.3.0 for ConLite. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); } @@ -98,6 +97,11 @@ $cfg['path']['frontend'] = CON_FRONTEND_PATH; $cfg['path']['conlite'] = $cfg['path']['frontend'] . '/conlite/'; $cfg['path']['conlite_config'] = CON_FRONTEND_PATH . '/data/config/' . CL_ENVIRONMENT . '/'; +// (bool) Flag to use native i18n. +// Note: Enabling this could create unwanted side effects, because of +// native gettext() behavior. +$cfg['native_i18n'] = false; + session_start(); // includes