@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 86 | 86 | $create = true; |
| 87 | 87 | } else { |
| 88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 88 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 89 | 89 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
| 90 | 90 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 91 | 91 | } |
@@ -280,23 +280,23 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | // Reset database for installation of demo-site |
| 282 | 282 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
| 283 | - echo "<p>" . $_lang['resetting_database']; |
|
| 284 | - $sqlParser->process($moduleSQLResetFile); |
|
| 285 | - // display database results |
|
| 286 | - if ($sqlParser->installFailed == true) { |
|
| 287 | - $errors += 1; |
|
| 288 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 289 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 290 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 291 | - for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
|
| 292 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 293 | - } |
|
| 294 | - echo "</p>"; |
|
| 295 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 296 | - return; |
|
| 297 | - } else { |
|
| 298 | - echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
|
| 299 | - } |
|
| 283 | + echo "<p>" . $_lang['resetting_database']; |
|
| 284 | + $sqlParser->process($moduleSQLResetFile); |
|
| 285 | + // display database results |
|
| 286 | + if ($sqlParser->installFailed == true) { |
|
| 287 | + $errors += 1; |
|
| 288 | + echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 289 | + echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 290 | + echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 291 | + for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
|
| 292 | + echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 293 | + } |
|
| 294 | + echo "</p>"; |
|
| 295 | + echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 296 | + return; |
|
| 297 | + } else { |
|
| 298 | + echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
|
| 299 | + } |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Install Templates |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $tRow = mysqli_fetch_assoc($ts); |
| 419 | 419 | $templateId = $tRow['id']; |
| 420 | 420 | mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
| 421 | - } |
|
| 421 | + } |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | } |
@@ -687,51 +687,51 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | // Install Dependencies |
| 689 | 689 | foreach ($moduleDependencies as $dependency) { |
| 690 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 691 | - if (!$ds) { |
|
| 692 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 693 | - return; |
|
| 694 | - } else { |
|
| 695 | - $row = mysqli_fetch_assoc($ds); |
|
| 696 | - $moduleId = $row["id"]; |
|
| 697 | - $moduleGuid = $row["guid"]; |
|
| 698 | - } |
|
| 699 | - // get extra id |
|
| 700 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 701 | - if (!$ds) { |
|
| 702 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 703 | - return; |
|
| 704 | - } else { |
|
| 705 | - $row = mysqli_fetch_assoc($ds); |
|
| 706 | - $extraId = $row["id"]; |
|
| 707 | - } |
|
| 708 | - // setup extra as module dependency |
|
| 709 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
| 710 | - if (!$ds) { |
|
| 711 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 712 | - return; |
|
| 713 | - } else { |
|
| 714 | - if (mysqli_num_rows($ds) === 0) { |
|
| 715 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 716 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 717 | - } else { |
|
| 718 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
| 719 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 720 | - } |
|
| 721 | - if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
|
| 722 | - // set extra guid for plugins and snippets |
|
| 723 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 724 | - if (!$ds) { |
|
| 725 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 726 | - return; |
|
| 727 | - } else { |
|
| 728 | - if (mysqli_num_rows($ds) != 0) { |
|
| 729 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 730 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 731 | - } |
|
| 732 | - } |
|
| 733 | - } |
|
| 734 | - } |
|
| 690 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 691 | + if (!$ds) { |
|
| 692 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 693 | + return; |
|
| 694 | + } else { |
|
| 695 | + $row = mysqli_fetch_assoc($ds); |
|
| 696 | + $moduleId = $row["id"]; |
|
| 697 | + $moduleGuid = $row["guid"]; |
|
| 698 | + } |
|
| 699 | + // get extra id |
|
| 700 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 701 | + if (!$ds) { |
|
| 702 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 703 | + return; |
|
| 704 | + } else { |
|
| 705 | + $row = mysqli_fetch_assoc($ds); |
|
| 706 | + $extraId = $row["id"]; |
|
| 707 | + } |
|
| 708 | + // setup extra as module dependency |
|
| 709 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
| 710 | + if (!$ds) { |
|
| 711 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 712 | + return; |
|
| 713 | + } else { |
|
| 714 | + if (mysqli_num_rows($ds) === 0) { |
|
| 715 | + mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 716 | + echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 717 | + } else { |
|
| 718 | + mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
| 719 | + echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 720 | + } |
|
| 721 | + if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
|
| 722 | + // set extra guid for plugins and snippets |
|
| 723 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 724 | + if (!$ds) { |
|
| 725 | + echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 726 | + return; |
|
| 727 | + } else { |
|
| 728 | + if (mysqli_num_rows($ds) != 0) { |
|
| 729 | + mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 730 | + echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | // call back function |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
| 3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
| 4 | -}else{ |
|
| 4 | +} else { |
|
| 5 | 5 | define('MGR_DIR', 'manager'); |
| 6 | 6 | } |
| 7 | 7 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | echo "<p>{$_lang['setup_database']}</p>\n"; |
| 30 | 30 | |
| 31 | -$installMode= intval($_POST['installmode']); |
|
| 31 | +$installMode = intval($_POST['installmode']); |
|
| 32 | 32 | $installData = $_POST['installdata'] == "1" ? 1 : 0; |
| 33 | 33 | |
| 34 | 34 | //if ($installMode == 1) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
| 43 | 43 | $database_connection_charset = $_POST['database_connection_charset']; |
| 44 | 44 | $database_connection_method = $_POST['database_connection_method']; |
| 45 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
| 45 | +$dbase = "`".$_POST['database_name']."`"; |
|
| 46 | 46 | $table_prefix = $_POST['tableprefix']; |
| 47 | 47 | $adminname = $_POST['cmsadmin']; |
| 48 | 48 | $adminemail = $_POST['cmsadminemail']; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // set session name variable |
| 55 | 55 | if (!isset ($site_sessionname)) { |
| 56 | - $site_sessionname = 'SN' . uniqid(''); |
|
| 56 | + $site_sessionname = 'SN'.uniqid(''); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // get base path and url |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | array_pop($a); |
| 68 | 68 | $pth = implode("install", $a); |
| 69 | 69 | unset ($a); |
| 70 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
| 71 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
| 70 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
| 71 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
| 72 | 72 | |
| 73 | 73 | // connect to the database |
| 74 | -echo "<p>". $_lang['setup_database_create_connection']; |
|
| 74 | +echo "<p>".$_lang['setup_database_create_connection']; |
|
| 75 | 75 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
| 76 | 76 | echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>"; |
| 77 | 77 | return; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // select database |
| 83 | -echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
| 83 | +echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
| 84 | 84 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
| 85 | 85 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 86 | 86 | $create = true; |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // try to create the database |
| 94 | 94 | if ($create) { |
| 95 | - echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
| 95 | + echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
| 96 | 96 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
| 97 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
| 97 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
| 98 | 98 | echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>"; |
| 99 | 99 | $errors += 1; |
| 100 | 100 | ?> |
@@ -113,33 +113,33 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | // check table prefix |
| 115 | 115 | if ($installMode == 0) { |
| 116 | - echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
| 117 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
| 118 | - echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>"; |
|
| 116 | + echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: "; |
|
| 117 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
| 118 | + echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>"; |
|
| 119 | 119 | $errors += 1; |
| 120 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>"; |
|
| 120 | + echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>"; |
|
| 121 | 121 | return; |
| 122 | 122 | } else { |
| 123 | 123 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -if(!function_exists('parseProperties')) { |
|
| 127 | +if (!function_exists('parseProperties')) { |
|
| 128 | 128 | // parses a resource property string and returns the result as an array |
| 129 | 129 | // duplicate of method in documentParser class |
| 130 | - function parseProperties($propertyString) { |
|
| 131 | - $parameter= array (); |
|
| 130 | + function parseProperties($propertyString){ |
|
| 131 | + $parameter = array(); |
|
| 132 | 132 | if (!empty ($propertyString)) { |
| 133 | - $tmpParams= explode("&", $propertyString); |
|
| 134 | - for ($x= 0; $x < count($tmpParams); $x++) { |
|
| 133 | + $tmpParams = explode("&", $propertyString); |
|
| 134 | + for ($x = 0; $x < count($tmpParams); $x++) { |
|
| 135 | 135 | if (strpos($tmpParams[$x], '=', 0)) { |
| 136 | - $pTmp= explode("=", $tmpParams[$x]); |
|
| 137 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
| 136 | + $pTmp = explode("=", $tmpParams[$x]); |
|
| 137 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
| 138 | 138 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
| 139 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
| 139 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
| 140 | 140 | else |
| 141 | 141 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
| 142 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 142 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -150,20 +150,20 @@ discard block |
||
| 150 | 150 | // check status of Inherit Parent Template plugin |
| 151 | 151 | $auto_template_logic = 'parent'; |
| 152 | 152 | if ($installMode != 0) { |
| 153 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
| 153 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
| 154 | 154 | $row = mysqli_fetch_row($rs); |
| 155 | - if(!$row) { |
|
| 155 | + if (!$row) { |
|
| 156 | 156 | // not installed |
| 157 | 157 | $auto_template_logic = 'system'; |
| 158 | 158 | } else { |
| 159 | - if($row[1] == 1) { |
|
| 159 | + if ($row[1] == 1) { |
|
| 160 | 160 | // installed but disabled |
| 161 | 161 | $auto_template_logic = 'system'; |
| 162 | 162 | } else { |
| 163 | 163 | // installed, enabled .. see how it's configured |
| 164 | 164 | $properties = parseProperties($row[0]); |
| 165 | - if(isset($properties['inheritTemplate'])) { |
|
| 166 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
| 165 | + if (isset($properties['inheritTemplate'])) { |
|
| 166 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
| 167 | 167 | $auto_template_logic = 'sibling'; |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -187,20 +187,20 @@ discard block |
||
| 187 | 187 | $sqlParser->connect(); |
| 188 | 188 | |
| 189 | 189 | // install/update database |
| 190 | -echo "<p>" . $_lang['setup_database_creating_tables']; |
|
| 190 | +echo "<p>".$_lang['setup_database_creating_tables']; |
|
| 191 | 191 | if ($moduleSQLBaseFile) { |
| 192 | 192 | $sqlParser->process($moduleSQLBaseFile); |
| 193 | 193 | // display database results |
| 194 | 194 | if ($sqlParser->installFailed == true) { |
| 195 | 195 | $errors += 1; |
| 196 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 197 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 198 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 196 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 197 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 198 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 199 | 199 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 200 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 200 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 201 | 201 | } |
| 202 | 202 | echo "</p>"; |
| 203 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 203 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 204 | 204 | return; |
| 205 | 205 | } else { |
| 206 | 206 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | // custom or not |
| 211 | 211 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
| 212 | 212 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
| 213 | -}else{ |
|
| 213 | +} else { |
|
| 214 | 214 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // write the config.inc.php file if new installation |
| 218 | -echo "<p>" . $_lang['writing_config_file']; |
|
| 218 | +echo "<p>".$_lang['writing_config_file']; |
|
| 219 | 219 | |
| 220 | 220 | $confph = array(); |
| 221 | 221 | $confph['database_server'] = $database_server; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $chmodSuccess = @chmod($filename, 0404); |
| 248 | 248 | |
| 249 | 249 | if ($configFileFailed == true) { |
| 250 | - echo '<span class="notok">' . $_lang['failed'] . "</span></p>"; |
|
| 250 | + echo '<span class="notok">'.$_lang['failed']."</span></p>"; |
|
| 251 | 251 | $errors += 1; |
| 252 | 252 | ?> |
| 253 | 253 | <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p> |
@@ -264,35 +264,35 @@ discard block |
||
| 264 | 264 | // generate new site_id and set manager theme to default |
| 265 | 265 | if ($installMode == 0) { |
| 266 | 266 | $siteid = uniqid(''); |
| 267 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
| 267 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
| 268 | 268 | } else { |
| 269 | 269 | // update site_id if missing |
| 270 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
| 270 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
| 271 | 271 | if ($ds) { |
| 272 | 272 | $r = mysqli_fetch_assoc($ds); |
| 273 | 273 | $siteid = $r['setting_value']; |
| 274 | 274 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
| 275 | 275 | $siteid = uniqid(''); |
| 276 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
| 276 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Reset database for installation of demo-site |
| 282 | 282 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
| 283 | - echo "<p>" . $_lang['resetting_database']; |
|
| 283 | + echo "<p>".$_lang['resetting_database']; |
|
| 284 | 284 | $sqlParser->process($moduleSQLResetFile); |
| 285 | 285 | // display database results |
| 286 | 286 | if ($sqlParser->installFailed == true) { |
| 287 | 287 | $errors += 1; |
| 288 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 289 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 290 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 288 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 289 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 290 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 291 | 291 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 292 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 292 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 293 | 293 | } |
| 294 | 294 | echo "</p>"; |
| 295 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 295 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 296 | 296 | return; |
| 297 | 297 | } else { |
| 298 | 298 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | // Install Templates |
| 303 | 303 | if (isset ($_POST['template']) || $installData) { |
| 304 | - echo "<h3>" . $_lang['templates'] . ":</h3> "; |
|
| 304 | + echo "<h3>".$_lang['templates'].":</h3> "; |
|
| 305 | 305 | $selTemplates = $_POST['template']; |
| 306 | 306 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
| 307 | 307 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
| 308 | - if($installSample || in_array($k, $selTemplates)) { |
|
| 308 | + if ($installSample || in_array($k, $selTemplates)) { |
|
| 309 | 309 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
| 310 | 310 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
| 311 | 311 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $filecontent = $moduleTemplate[3]; |
| 314 | 314 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
| 315 | 315 | if (!file_exists($filecontent)) { |
| 316 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 316 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 317 | 317 | } else { |
| 318 | 318 | // Create the category if it does not already exist |
| 319 | 319 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -323,31 +323,31 @@ discard block |
||
| 323 | 323 | $template = mysqli_real_escape_string($conn, $template); |
| 324 | 324 | |
| 325 | 325 | // See if the template already exists |
| 326 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
| 326 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
| 327 | 327 | |
| 328 | 328 | if (mysqli_num_rows($rs)) { |
| 329 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
| 329 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
| 330 | 330 | $errors += 1; |
| 331 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 331 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 332 | 332 | return; |
| 333 | 333 | } |
| 334 | - if(!is_null($save_sql_id_as)) { |
|
| 334 | + if (!is_null($save_sql_id_as)) { |
|
| 335 | 335 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
| 336 | - if(!$sql_id) { |
|
| 337 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
| 336 | + if (!$sql_id) { |
|
| 337 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
| 338 | 338 | $sql_id = $idQuery['id']; |
| 339 | 339 | } |
| 340 | 340 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
| 341 | 341 | } |
| 342 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 342 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 343 | 343 | } else { |
| 344 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
| 344 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
| 345 | 345 | $errors += 1; |
| 346 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 346 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 347 | 347 | return; |
| 348 | 348 | } |
| 349 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 350 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 349 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 350 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | } |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | // Install Template Variables |
| 358 | 358 | if (isset ($_POST['tv']) || $installData) { |
| 359 | - echo "<h3>" . $_lang['tvs'] . ":</h3> "; |
|
| 359 | + echo "<h3>".$_lang['tvs'].":</h3> "; |
|
| 360 | 360 | $selTVs = $_POST['tv']; |
| 361 | 361 | foreach ($moduleTVs as $k=>$moduleTV) { |
| 362 | 362 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
| 363 | - if($installSample || in_array($k, $selTVs)) { |
|
| 363 | + if ($installSample || in_array($k, $selTVs)) { |
|
| 364 | 364 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
| 365 | 365 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
| 366 | 366 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -378,25 +378,25 @@ discard block |
||
| 378 | 378 | // Create the category if it does not already exist |
| 379 | 379 | $category = getCreateDbCategory($category, $sqlParser); |
| 380 | 380 | |
| 381 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
| 381 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
| 382 | 382 | if (mysqli_num_rows($rs)) { |
| 383 | 383 | $insert = true; |
| 384 | - while($row = mysqli_fetch_assoc($rs)) { |
|
| 385 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
| 386 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 384 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
| 385 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
| 386 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 387 | 387 | return; |
| 388 | 388 | } |
| 389 | 389 | $insert = false; |
| 390 | 390 | } |
| 391 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 391 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 392 | 392 | } else { |
| 393 | 393 | //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
| 394 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
| 394 | + $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
| 395 | 395 | if (!mysqli_query($sqlParser->conn, $q)) { |
| 396 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 396 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 397 | 397 | return; |
| 398 | 398 | } |
| 399 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 399 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // add template assignments |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | if (count($assignments) > 0) { |
| 406 | 406 | |
| 407 | 407 | // remove existing tv -> template assignments |
| 408 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 408 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 409 | 409 | $row = mysqli_fetch_assoc($ds); |
| 410 | 410 | $id = $row["id"]; |
| 411 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
| 411 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
| 412 | 412 | |
| 413 | 413 | // add tv -> template assignments |
| 414 | 414 | foreach ($assignments as $assignment) { |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | if ($ds && $ts) { |
| 418 | 418 | $tRow = mysqli_fetch_assoc($ts); |
| 419 | 419 | $templateId = $tRow['id']; |
| 420 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 420 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | } |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | // Install Chunks |
| 429 | 429 | if (isset ($_POST['chunk']) || $installData) { |
| 430 | - echo "<h3>" . $_lang['chunks'] . ":</h3> "; |
|
| 430 | + echo "<h3>".$_lang['chunks'].":</h3> "; |
|
| 431 | 431 | $selChunks = $_POST['chunk']; |
| 432 | 432 | foreach ($moduleChunks as $k=>$moduleChunk) { |
| 433 | 433 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
| 434 | 434 | $count_new_name = 0; |
| 435 | - if($installSample || in_array($k, $selChunks)) { |
|
| 435 | + if ($installSample || in_array($k, $selChunks)) { |
|
| 436 | 436 | |
| 437 | 437 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
| 438 | 438 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $filecontent = $moduleChunk[2]; |
| 442 | 442 | |
| 443 | 443 | if (!file_exists($filecontent)) |
| 444 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 444 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 445 | 445 | else { |
| 446 | 446 | |
| 447 | 447 | // Create the category if it does not already exist |
@@ -449,31 +449,31 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
| 451 | 451 | $chunk = mysqli_real_escape_string($conn, $chunk); |
| 452 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
| 452 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
| 453 | 453 | $count_original_name = mysqli_num_rows($rs); |
| 454 | - if($overwrite == 'false') { |
|
| 455 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
| 456 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
| 454 | + if ($overwrite == 'false') { |
|
| 455 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
| 456 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
| 457 | 457 | $count_new_name = mysqli_num_rows($rs); |
| 458 | 458 | } |
| 459 | 459 | $update = $count_original_name > 0 && $overwrite == 'true'; |
| 460 | 460 | if ($update) { |
| 461 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 461 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 462 | 462 | $errors += 1; |
| 463 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 463 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 464 | 464 | return; |
| 465 | 465 | } |
| 466 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 467 | - } elseif($count_new_name == 0) { |
|
| 468 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
| 466 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 467 | + } elseif ($count_new_name == 0) { |
|
| 468 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
| 469 | 469 | $name = $newname; |
| 470 | 470 | } |
| 471 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
| 471 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
| 472 | 472 | $errors += 1; |
| 473 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 473 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 474 | 474 | return; |
| 475 | 475 | } |
| 476 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 476 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | } |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | // Install Modules |
| 484 | 484 | if (isset ($_POST['module']) || $installData) { |
| 485 | - echo "<h3>" . $_lang['modules'] . ":</h3> "; |
|
| 485 | + echo "<h3>".$_lang['modules'].":</h3> "; |
|
| 486 | 486 | $selModules = $_POST['module']; |
| 487 | 487 | foreach ($moduleModules as $k=>$moduleModule) { |
| 488 | 488 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
| 489 | - if($installSample || in_array($k, $selModules)) { |
|
| 489 | + if ($installSample || in_array($k, $selModules)) { |
|
| 490 | 490 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
| 491 | 491 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
| 492 | 492 | $filecontent = $moduleModule[2]; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 496 | 496 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 497 | 497 | if (!file_exists($filecontent)) |
| 498 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 498 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 499 | 499 | else { |
| 500 | 500 | |
| 501 | 501 | // Create the category if it does not already exist |
@@ -504,22 +504,22 @@ discard block |
||
| 504 | 504 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
| 505 | 505 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
| 506 | 506 | $module = mysqli_real_escape_string($conn, $module); |
| 507 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
| 507 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
| 508 | 508 | if (mysqli_num_rows($rs)) { |
| 509 | 509 | $row = mysqli_fetch_assoc($rs); |
| 510 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 511 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 512 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 510 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 511 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 512 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 513 | 513 | return; |
| 514 | 514 | } |
| 515 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 515 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 516 | 516 | } else { |
| 517 | 517 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 518 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
| 519 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 518 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
| 519 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 520 | 520 | return; |
| 521 | 521 | } |
| 522 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 522 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | } |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | // Install Plugins |
| 530 | 530 | if (isset ($_POST['plugin']) || $installData) { |
| 531 | - echo "<h3>" . $_lang['plugins'] . ":</h3> "; |
|
| 531 | + echo "<h3>".$_lang['plugins'].":</h3> "; |
|
| 532 | 532 | $selPlugs = $_POST['plugin']; |
| 533 | 533 | foreach ($modulePlugins as $k=>$modulePlugin) { |
| 534 | 534 | $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
| 535 | - if($installSample || in_array($k, $selPlugs)) { |
|
| 535 | + if ($installSample || in_array($k, $selPlugs)) { |
|
| 536 | 536 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
| 537 | 537 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
| 538 | 538 | $filecontent = $modulePlugin[2]; |
@@ -542,17 +542,17 @@ discard block |
||
| 542 | 542 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
| 543 | 543 | $leg_names = ''; |
| 544 | 544 | $disabled = $modulePlugin[9]; |
| 545 | - if(array_key_exists(7, $modulePlugin)) { |
|
| 545 | + if (array_key_exists(7, $modulePlugin)) { |
|
| 546 | 546 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 547 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
| 547 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
| 548 | 548 | } |
| 549 | 549 | if (!file_exists($filecontent)) |
| 550 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 550 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 551 | 551 | else { |
| 552 | 552 | |
| 553 | 553 | // disable legacy versions based on legacy_names provided |
| 554 | - if(!empty($leg_names)) { |
|
| 555 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 554 | + if (!empty($leg_names)) { |
|
| 555 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 556 | 556 | $rs = mysqli_query($sqlParser->conn, $update_query); |
| 557 | 557 | } |
| 558 | 558 | |
@@ -562,50 +562,50 @@ discard block |
||
| 562 | 562 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
| 563 | 563 | $plugin = removeDocblock($plugin, 'plugin'); |
| 564 | 564 | $plugin = mysqli_real_escape_string($conn, $plugin); |
| 565 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
| 565 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
| 566 | 566 | if (mysqli_num_rows($rs)) { |
| 567 | 567 | $insert = true; |
| 568 | - while($row = mysqli_fetch_assoc($rs)) { |
|
| 569 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 570 | - if($row['description'] == $desc){ |
|
| 571 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 572 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 568 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
| 569 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 570 | + if ($row['description'] == $desc) { |
|
| 571 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 572 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 573 | 573 | return; |
| 574 | 574 | } |
| 575 | 575 | $insert = false; |
| 576 | 576 | } else { |
| 577 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 577 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 578 | 578 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
| 579 | 579 | return; |
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | - if($insert === true) { |
|
| 584 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 585 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
| 583 | + if ($insert === true) { |
|
| 584 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 585 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
| 586 | 586 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
| 587 | 587 | return; |
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 590 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 591 | 591 | } else { |
| 592 | 592 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 593 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
| 594 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 593 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
| 594 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 595 | 595 | return; |
| 596 | 596 | } |
| 597 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 597 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 598 | 598 | } |
| 599 | 599 | // add system events |
| 600 | 600 | if (count($events) > 0) { |
| 601 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
| 601 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
| 602 | 602 | if ($ds) { |
| 603 | 603 | $row = mysqli_fetch_assoc($ds); |
| 604 | 604 | $id = $row["id"]; |
| 605 | 605 | // remove existing events |
| 606 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
| 606 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
| 607 | 607 | // add new events |
| 608 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')"); |
|
| 608 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')"); |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | } |
@@ -615,18 +615,18 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | // Install Snippets |
| 617 | 617 | if (isset ($_POST['snippet']) || $installData) { |
| 618 | - echo "<h3>" . $_lang['snippets'] . ":</h3> "; |
|
| 618 | + echo "<h3>".$_lang['snippets'].":</h3> "; |
|
| 619 | 619 | $selSnips = $_POST['snippet']; |
| 620 | 620 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
| 621 | 621 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
| 622 | - if($installSample || in_array($k, $selSnips)) { |
|
| 622 | + if ($installSample || in_array($k, $selSnips)) { |
|
| 623 | 623 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
| 624 | 624 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
| 625 | 625 | $filecontent = $moduleSnippet[2]; |
| 626 | 626 | $properties = $moduleSnippet[3]; |
| 627 | 627 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 628 | 628 | if (!file_exists($filecontent)) |
| 629 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 629 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 630 | 630 | else { |
| 631 | 631 | |
| 632 | 632 | // Create the category if it does not already exist |
@@ -635,22 +635,22 @@ discard block |
||
| 635 | 635 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
| 636 | 636 | $snippet = removeDocblock($snippet, 'snippet'); |
| 637 | 637 | $snippet = mysqli_real_escape_string($conn, $snippet); |
| 638 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
| 638 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
| 639 | 639 | if (mysqli_num_rows($rs)) { |
| 640 | 640 | $row = mysqli_fetch_assoc($rs); |
| 641 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 642 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 643 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 641 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 642 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 643 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 644 | 644 | return; |
| 645 | 645 | } |
| 646 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 646 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 647 | 647 | } else { |
| 648 | 648 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 649 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
| 650 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 649 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
| 650 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 651 | 651 | return; |
| 652 | 652 | } |
| 653 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 653 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | } |
@@ -659,24 +659,24 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | // Install demo-site |
| 661 | 661 | if ($installData && $moduleSQLDataFile) { |
| 662 | - echo "<p>" . $_lang['installing_demo_site']; |
|
| 662 | + echo "<p>".$_lang['installing_demo_site']; |
|
| 663 | 663 | $sqlParser->process($moduleSQLDataFile); |
| 664 | 664 | // display database results |
| 665 | 665 | if ($sqlParser->installFailed == true) { |
| 666 | 666 | $errors += 1; |
| 667 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 668 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 669 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 667 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 668 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 669 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 670 | 670 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 671 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 671 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 672 | 672 | } |
| 673 | 673 | echo "</p>"; |
| 674 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 674 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 675 | 675 | return; |
| 676 | 676 | } else { |
| 677 | 677 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
| 678 | 678 | $rs = mysqli_query($sqlParser->conn, $sql); |
| 679 | - if(mysqli_num_rows($rs)) { |
|
| 679 | + if (mysqli_num_rows($rs)) { |
|
| 680 | 680 | $row = mysqli_fetch_assoc($rs); |
| 681 | 681 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
| 682 | 682 | mysqli_query($sqlParser->conn, $sql); |
@@ -687,9 +687,9 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | // Install Dependencies |
| 689 | 689 | foreach ($moduleDependencies as $dependency) { |
| 690 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 690 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
| 691 | 691 | if (!$ds) { |
| 692 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 692 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 693 | 693 | return; |
| 694 | 694 | } else { |
| 695 | 695 | $row = mysqli_fetch_assoc($ds); |
@@ -697,37 +697,37 @@ discard block |
||
| 697 | 697 | $moduleGuid = $row["guid"]; |
| 698 | 698 | } |
| 699 | 699 | // get extra id |
| 700 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 700 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
| 701 | 701 | if (!$ds) { |
| 702 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 702 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 703 | 703 | return; |
| 704 | 704 | } else { |
| 705 | 705 | $row = mysqli_fetch_assoc($ds); |
| 706 | 706 | $extraId = $row["id"]; |
| 707 | 707 | } |
| 708 | 708 | // setup extra as module dependency |
| 709 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
| 709 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'); |
|
| 710 | 710 | if (!$ds) { |
| 711 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 711 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 712 | 712 | return; |
| 713 | 713 | } else { |
| 714 | 714 | if (mysqli_num_rows($ds) === 0) { |
| 715 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 716 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 715 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
| 716 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>'; |
|
| 717 | 717 | } else { |
| 718 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
| 719 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 718 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']); |
|
| 719 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>'; |
|
| 720 | 720 | } |
| 721 | 721 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
| 722 | 722 | // set extra guid for plugins and snippets |
| 723 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 723 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
| 724 | 724 | if (!$ds) { |
| 725 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 725 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 726 | 726 | return; |
| 727 | 727 | } else { |
| 728 | 728 | if (mysqli_num_rows($ds) != 0) { |
| 729 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 730 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 729 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
| 730 | + echo '<p> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | } |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | // call back function |
| 738 | 738 | if ($callBackFnc != "") |
| 739 | - $callBackFnc ($sqlParser); |
|
| 739 | + $callBackFnc($sqlParser); |
|
| 740 | 740 | |
| 741 | 741 | // Setup the MODX API -- needed for the cache processor |
| 742 | 742 | define('MODX_API_MODE', true); |
@@ -771,20 +771,20 @@ discard block |
||
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // setup completed! |
| 774 | -echo "<p><b>" . $_lang['installation_successful'] . "</b></p>"; |
|
| 775 | -echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
|
| 774 | +echo "<p><b>".$_lang['installation_successful']."</b></p>"; |
|
| 775 | +echo "<p>".$_lang['to_log_into_content_manager']."</p>"; |
|
| 776 | 776 | if ($installMode == 0) { |
| 777 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>"; |
|
| 777 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>"; |
|
| 778 | 778 | } else { |
| 779 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>"; |
|
| 779 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>"; |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | // Property Update function |
| 783 | -function propUpdate($new,$old){ |
|
| 783 | +function propUpdate($new, $old){ |
|
| 784 | 784 | $newArr = parseProperties($new); |
| 785 | 785 | $oldArr = parseProperties($old); |
| 786 | - foreach ($oldArr as $k => $v){ |
|
| 787 | - if (isset($v['0']['options'])){ |
|
| 786 | + foreach ($oldArr as $k => $v) { |
|
| 787 | + if (isset($v['0']['options'])) { |
|
| 788 | 788 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
| 789 | 789 | } |
| 790 | 790 | } |
@@ -794,22 +794,22 @@ discard block |
||
| 794 | 794 | return $return; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | -function parseProperties($propertyString, $json=false) { |
|
| 798 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
| 799 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
| 797 | +function parseProperties($propertyString, $json = false){ |
|
| 798 | + $propertyString = str_replace('{}', '', $propertyString); |
|
| 799 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
| 800 | 800 | |
| 801 | - if(empty($propertyString)) return array(); |
|
| 802 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
| 801 | + if (empty($propertyString)) return array(); |
|
| 802 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
| 803 | 803 | |
| 804 | 804 | $jsonFormat = isJson($propertyString, true); |
| 805 | 805 | $property = array(); |
| 806 | 806 | // old format |
| 807 | - if ( $jsonFormat === false) { |
|
| 808 | - $props= explode('&', $propertyString); |
|
| 807 | + if ($jsonFormat === false) { |
|
| 808 | + $props = explode('&', $propertyString); |
|
| 809 | 809 | $arr = array(); |
| 810 | 810 | $key = array(); |
| 811 | 811 | foreach ($props as $prop) { |
| 812 | - if ($prop != ''){ |
|
| 812 | + if ($prop != '') { |
|
| 813 | 813 | $arr = explode(';', $prop); |
| 814 | 814 | $key = explode('=', $arr['0']); |
| 815 | 815 | $property[$key['0']]['0']['label'] = trim($key['1']); |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | |
| 834 | 834 | } |
| 835 | 835 | // new json-format |
| 836 | - } else if(!empty($jsonFormat)){ |
|
| 836 | + } else if (!empty($jsonFormat)) { |
|
| 837 | 837 | $property = $jsonFormat; |
| 838 | 838 | } |
| 839 | 839 | if ($json) { |
@@ -843,25 +843,25 @@ discard block |
||
| 843 | 843 | return $property; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | -function isJson($string, $returnData=false) { |
|
| 846 | +function isJson($string, $returnData = false){ |
|
| 847 | 847 | $data = json_decode($string, true); |
| 848 | 848 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | -function getCreateDbCategory($category, $sqlParser) { |
|
| 851 | +function getCreateDbCategory($category, $sqlParser){ |
|
| 852 | 852 | $dbase = $sqlParser->dbname; |
| 853 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
| 853 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
| 854 | 854 | $table_prefix = $sqlParser->prefix; |
| 855 | 855 | $category_id = 0; |
| 856 | - if(!empty($category)) { |
|
| 856 | + if (!empty($category)) { |
|
| 857 | 857 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
| 858 | 858 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
| 859 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 859 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 860 | 860 | $category_id = $row['id']; |
| 861 | 861 | } else { |
| 862 | 862 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
| 863 | 863 | $rs = mysqli_query($sqlParser->conn, $q); |
| 864 | - if($rs) { |
|
| 864 | + if ($rs) { |
|
| 865 | 865 | $category_id = mysqli_insert_id($sqlParser->conn); |
| 866 | 866 | } |
| 867 | 867 | } |
@@ -870,12 +870,12 @@ discard block |
||
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // Remove installer Docblock only from components using plugin FileSource / fileBinding |
| 873 | -function removeDocblock($code, $type) { |
|
| 873 | +function removeDocblock($code, $type){ |
|
| 874 | 874 | |
| 875 | 875 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
| 876 | 876 | |
| 877 | 877 | // Procedure taken from plugin.filesource.php |
| 878 | - switch($type) { |
|
| 878 | + switch ($type) { |
|
| 879 | 879 | case 'snippet': |
| 880 | 880 | $elm_name = 'snippets'; |
| 881 | 881 | $include = 'return require'; |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | default: |
| 892 | 892 | return $cleaned; |
| 893 | 893 | }; |
| 894 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
| 894 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
| 895 | 895 | return $cleaned; |
| 896 | 896 | |
| 897 | 897 | // fileBinding not found - return code incl docblock |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
| 3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
| 4 | -}else{ |
|
| 4 | +} else { |
|
| 5 | 5 | define('MGR_DIR', 'manager'); |
| 6 | 6 | } |
| 7 | 7 | |
@@ -58,13 +58,15 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // get base path and url |
| 60 | 60 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
| 61 | -if (count($a) > 1) |
|
| 61 | +if (count($a) > 1) { |
|
| 62 | 62 | array_pop($a); |
| 63 | +} |
|
| 63 | 64 | $url = implode("install", $a); |
| 64 | 65 | reset($a); |
| 65 | 66 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
| 66 | -if (count($a) > 1) |
|
| 67 | +if (count($a) > 1) { |
|
| 67 | 68 | array_pop($a); |
| 69 | +} |
|
| 68 | 70 | $pth = implode("install", $a); |
| 69 | 71 | unset ($a); |
| 70 | 72 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 86 | 88 | $create = true; |
| 87 | 89 | } else { |
| 88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 90 | + if (function_exists('mysqli_set_charset')) { |
|
| 91 | + mysqli_set_charset($conn, $database_charset); |
|
| 92 | + } |
|
| 89 | 93 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
| 90 | 94 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 91 | 95 | } |
@@ -127,7 +131,8 @@ discard block |
||
| 127 | 131 | if(!function_exists('parseProperties')) { |
| 128 | 132 | // parses a resource property string and returns the result as an array |
| 129 | 133 | // duplicate of method in documentParser class |
| 130 | - function parseProperties($propertyString) { |
|
| 134 | + function parseProperties($propertyString) |
|
| 135 | + { |
|
| 131 | 136 | $parameter= array (); |
| 132 | 137 | if (!empty ($propertyString)) { |
| 133 | 138 | $tmpParams= explode("&", $propertyString); |
@@ -135,11 +140,14 @@ discard block |
||
| 135 | 140 | if (strpos($tmpParams[$x], '=', 0)) { |
| 136 | 141 | $pTmp= explode("=", $tmpParams[$x]); |
| 137 | 142 | $pvTmp= explode(";", trim($pTmp[1])); |
| 138 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
| 139 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
| 143 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
| 144 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
| 145 | + } |
|
| 146 | + //list default |
|
| 140 | 147 | else |
| 141 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
| 142 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 148 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
| 149 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
| 150 | + } |
|
| 143 | 151 | } |
| 144 | 152 | } |
| 145 | 153 | } |
@@ -210,7 +218,7 @@ discard block |
||
| 210 | 218 | // custom or not |
| 211 | 219 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
| 212 | 220 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
| 213 | -}else{ |
|
| 221 | +} else { |
|
| 214 | 222 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 215 | 223 | } |
| 216 | 224 | |
@@ -346,7 +354,9 @@ discard block |
||
| 346 | 354 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 347 | 355 | return; |
| 348 | 356 | } |
| 349 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 357 | + if(!is_null($save_sql_id_as)) { |
|
| 358 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 359 | + } |
|
| 350 | 360 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 351 | 361 | } |
| 352 | 362 | } |
@@ -440,9 +450,9 @@ discard block |
||
| 440 | 450 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
| 441 | 451 | $filecontent = $moduleChunk[2]; |
| 442 | 452 | |
| 443 | - if (!file_exists($filecontent)) |
|
| 444 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 445 | - else { |
|
| 453 | + if (!file_exists($filecontent)) { |
|
| 454 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 455 | + } else { |
|
| 446 | 456 | |
| 447 | 457 | // Create the category if it does not already exist |
| 448 | 458 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -494,9 +504,9 @@ discard block |
||
| 494 | 504 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
| 495 | 505 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 496 | 506 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 497 | - if (!file_exists($filecontent)) |
|
| 498 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 499 | - else { |
|
| 507 | + if (!file_exists($filecontent)) { |
|
| 508 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 509 | + } else { |
|
| 500 | 510 | |
| 501 | 511 | // Create the category if it does not already exist |
| 502 | 512 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -546,9 +556,9 @@ discard block |
||
| 546 | 556 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 547 | 557 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
| 548 | 558 | } |
| 549 | - if (!file_exists($filecontent)) |
|
| 550 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 551 | - else { |
|
| 559 | + if (!file_exists($filecontent)) { |
|
| 560 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 561 | + } else { |
|
| 552 | 562 | |
| 553 | 563 | // disable legacy versions based on legacy_names provided |
| 554 | 564 | if(!empty($leg_names)) { |
@@ -567,7 +577,7 @@ discard block |
||
| 567 | 577 | $insert = true; |
| 568 | 578 | while($row = mysqli_fetch_assoc($rs)) { |
| 569 | 579 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 570 | - if($row['description'] == $desc){ |
|
| 580 | + if($row['description'] == $desc) { |
|
| 571 | 581 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
| 572 | 582 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 573 | 583 | return; |
@@ -625,9 +635,9 @@ discard block |
||
| 625 | 635 | $filecontent = $moduleSnippet[2]; |
| 626 | 636 | $properties = $moduleSnippet[3]; |
| 627 | 637 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 628 | - if (!file_exists($filecontent)) |
|
| 629 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 630 | - else { |
|
| 638 | + if (!file_exists($filecontent)) { |
|
| 639 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 640 | + } else { |
|
| 631 | 641 | |
| 632 | 642 | // Create the category if it does not already exist |
| 633 | 643 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -735,13 +745,16 @@ discard block |
||
| 735 | 745 | } |
| 736 | 746 | |
| 737 | 747 | // call back function |
| 738 | -if ($callBackFnc != "") |
|
| 748 | +if ($callBackFnc != "") { |
|
| 739 | 749 | $callBackFnc ($sqlParser); |
| 750 | +} |
|
| 740 | 751 | |
| 741 | 752 | // Setup the MODX API -- needed for the cache processor |
| 742 | 753 | define('MODX_API_MODE', true); |
| 743 | 754 | define('MODX_BASE_PATH', $base_path); |
| 744 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 755 | +if (!defined('MODX_MANAGER_PATH')) { |
|
| 756 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 757 | +} |
|
| 745 | 758 | $database_type = 'mysqli'; |
| 746 | 759 | // initiate a new document parser |
| 747 | 760 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -780,11 +793,12 @@ discard block |
||
| 780 | 793 | } |
| 781 | 794 | |
| 782 | 795 | // Property Update function |
| 783 | -function propUpdate($new,$old){ |
|
| 796 | +function propUpdate($new,$old) |
|
| 797 | +{ |
|
| 784 | 798 | $newArr = parseProperties($new); |
| 785 | 799 | $oldArr = parseProperties($old); |
| 786 | - foreach ($oldArr as $k => $v){ |
|
| 787 | - if (isset($v['0']['options'])){ |
|
| 800 | + foreach ($oldArr as $k => $v) { |
|
| 801 | + if (isset($v['0']['options'])) { |
|
| 788 | 802 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
| 789 | 803 | } |
| 790 | 804 | } |
@@ -794,12 +808,17 @@ discard block |
||
| 794 | 808 | return $return; |
| 795 | 809 | } |
| 796 | 810 | |
| 797 | -function parseProperties($propertyString, $json=false) { |
|
| 811 | +function parseProperties($propertyString, $json=false) |
|
| 812 | +{ |
|
| 798 | 813 | $propertyString = str_replace('{}', '', $propertyString ); |
| 799 | 814 | $propertyString = str_replace('} {', ',', $propertyString ); |
| 800 | 815 | |
| 801 | - if(empty($propertyString)) return array(); |
|
| 802 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
| 816 | + if(empty($propertyString)) { |
|
| 817 | + return array(); |
|
| 818 | + } |
|
| 819 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
| 820 | + return array(); |
|
| 821 | + } |
|
| 803 | 822 | |
| 804 | 823 | $jsonFormat = isJson($propertyString, true); |
| 805 | 824 | $property = array(); |
@@ -809,7 +828,7 @@ discard block |
||
| 809 | 828 | $arr = array(); |
| 810 | 829 | $key = array(); |
| 811 | 830 | foreach ($props as $prop) { |
| 812 | - if ($prop != ''){ |
|
| 831 | + if ($prop != '') { |
|
| 813 | 832 | $arr = explode(';', $prop); |
| 814 | 833 | $key = explode('=', $arr['0']); |
| 815 | 834 | $property[$key['0']]['0']['label'] = trim($key['1']); |
@@ -833,7 +852,7 @@ discard block |
||
| 833 | 852 | |
| 834 | 853 | } |
| 835 | 854 | // new json-format |
| 836 | - } else if(!empty($jsonFormat)){ |
|
| 855 | + } else if(!empty($jsonFormat)) { |
|
| 837 | 856 | $property = $jsonFormat; |
| 838 | 857 | } |
| 839 | 858 | if ($json) { |
@@ -843,12 +862,14 @@ discard block |
||
| 843 | 862 | return $property; |
| 844 | 863 | } |
| 845 | 864 | |
| 846 | -function isJson($string, $returnData=false) { |
|
| 865 | +function isJson($string, $returnData=false) |
|
| 866 | +{ |
|
| 847 | 867 | $data = json_decode($string, true); |
| 848 | 868 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
| 849 | 869 | } |
| 850 | 870 | |
| 851 | -function getCreateDbCategory($category, $sqlParser) { |
|
| 871 | +function getCreateDbCategory($category, $sqlParser) |
|
| 872 | +{ |
|
| 852 | 873 | $dbase = $sqlParser->dbname; |
| 853 | 874 | $dbase = '`' . trim($dbase,'`') . '`'; |
| 854 | 875 | $table_prefix = $sqlParser->prefix; |
@@ -870,7 +891,8 @@ discard block |
||
| 870 | 891 | } |
| 871 | 892 | |
| 872 | 893 | // Remove installer Docblock only from components using plugin FileSource / fileBinding |
| 873 | -function removeDocblock($code, $type) { |
|
| 894 | +function removeDocblock($code, $type) |
|
| 895 | +{ |
|
| 874 | 896 | |
| 875 | 897 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
| 876 | 898 | |
@@ -891,8 +913,9 @@ discard block |
||
| 891 | 913 | default: |
| 892 | 914 | return $cleaned; |
| 893 | 915 | }; |
| 894 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
| 895 | - return $cleaned; |
|
| 916 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
| 917 | + return $cleaned; |
|
| 918 | + } |
|
| 896 | 919 | |
| 897 | 920 | // fileBinding not found - return code incl docblock |
| 898 | 921 | return $code; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // write $somecontent to our opened file. |
| 241 | -if (@ fwrite($handle, $configString) === FALSE) { |
|
| 241 | +if (@ fwrite($handle, $configString) === false) { |
|
| 242 | 242 | $configFileFailed = true; |
| 243 | 243 | } |
| 244 | 244 | @ fclose($handle); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
| 327 | 327 | |
| 328 | 328 | if (mysqli_num_rows($rs)) { |
| 329 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
| 329 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
| 330 | 330 | $errors += 1; |
| 331 | 331 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 332 | 332 | return; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | if (mysqli_num_rows($rs)) { |
| 383 | 383 | $insert = true; |
| 384 | 384 | while($row = mysqli_fetch_assoc($rs)) { |
| 385 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
| 385 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
| 386 | 386 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 387 | 387 | return; |
| 388 | 388 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | $update = $count_original_name > 0 && $overwrite == 'true'; |
| 460 | 460 | if ($update) { |
| 461 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 461 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 462 | 462 | $errors += 1; |
| 463 | 463 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 464 | 464 | return; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | if (mysqli_num_rows($rs)) { |
| 509 | 509 | $row = mysqli_fetch_assoc($rs); |
| 510 | 510 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 511 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 511 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 512 | 512 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 513 | 513 | return; |
| 514 | 514 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | // disable legacy versions based on legacy_names provided |
| 554 | 554 | if(!empty($leg_names)) { |
| 555 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 555 | + $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 556 | 556 | $rs = mysqli_query($sqlParser->conn, $update_query); |
| 557 | 557 | } |
| 558 | 558 | |
@@ -568,13 +568,13 @@ discard block |
||
| 568 | 568 | while($row = mysqli_fetch_assoc($rs)) { |
| 569 | 569 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 570 | 570 | if($row['description'] == $desc){ |
| 571 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 571 | + if (! mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 572 | 572 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 573 | 573 | return; |
| 574 | 574 | } |
| 575 | 575 | $insert = false; |
| 576 | 576 | } else { |
| 577 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 577 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 578 | 578 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
| 579 | 579 | return; |
| 580 | 580 | } |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | if (mysqli_num_rows($rs)) { |
| 640 | 640 | $row = mysqli_fetch_assoc($rs); |
| 641 | 641 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 642 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 642 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 643 | 643 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 644 | 644 | return; |
| 645 | 645 | } |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != 'true') {
|
| 3 | - die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 3 | + die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
| 9 | - // seems to be a new install - send the user to the configuration page |
|
| 10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 9 | + // seems to be a new install - send the user to the configuration page |
|
| 10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | 19 | if($modx->hasPermission('messages')) {
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | - |
|
| 24 | - $msg = array(); |
|
| 25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | - $ph['MessageInfo'] = join("\n", $msg);
|
|
| 20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
| 22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
| 23 | + |
|
| 24 | + $msg = array(); |
|
| 25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
| 30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
|
| 31 | + $ph['MessageInfo'] = join("\n", $msg);
|
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
| 36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
| 37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
| 38 | 38 | } |
| 39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
| 40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
| 41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
| 42 | 42 | } |
| 43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
| 44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
| 45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
| 46 | 46 | } |
| 47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
| 48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
| 49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
| 50 | 50 | } |
| 51 | 51 | if($modx->hasPermission('bk_manager')) {
|
| 52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
| 53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
| 54 | 54 | } |
| 55 | 55 | if($modx->hasPermission('help')) {
|
| 56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
| 57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | - $ph['config_check_results'] = $config_check_results; |
|
| 64 | - $ph['config_display'] = 'block'; |
|
| 65 | - } else {
|
|
| 66 | - $ph['config_display'] = 'none'; |
|
| 67 | - } |
|
| 61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | + $ph['config_check_results'] = $config_check_results; |
|
| 64 | + $ph['config_display'] = 'block'; |
|
| 65 | + } else {
|
|
| 66 | + $ph['config_display'] = 'none'; |
|
| 67 | + } |
|
| 68 | 68 | } else {
|
| 69 | - $ph['config_display'] = 'none'; |
|
| 69 | + $ph['config_display'] = 'none'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | 73 | if(isset($_SESSION['show_logout_reminder'])) {
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | - case 'logout_reminder': |
|
| 76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | - break; |
|
| 79 | - } |
|
| 80 | - $ph['show_logout_reminder'] = 'block'; |
|
| 81 | - unset($_SESSION['show_logout_reminder']); |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | + case 'logout_reminder': |
|
| 76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
| 77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
|
| 78 | + break; |
|
| 79 | + } |
|
| 80 | + $ph['show_logout_reminder'] = 'block'; |
|
| 81 | + unset($_SESSION['show_logout_reminder']); |
|
| 82 | 82 | } else {
|
| 83 | - $ph['show_logout_reminder'] = 'none'; |
|
| 83 | + $ph['show_logout_reminder'] = 'none'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | - 'username' => $modx->getLoginUserName(), |
|
| 132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 131 | + 'username' => $modx->getLoginUserName(), |
|
| 132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
| 133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
| 134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
| 135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
| 136 | 136 | )); |
| 137 | 137 | |
| 138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | 143 | if($modx->db->getRecordCount($rs) < 1) {
|
| 144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
| 144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | - $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | - $html = ' |
|
| 146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
| 148 | + $ph['now'] = strftime('%H:%M:%S', $now);
|
|
| 149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
| 150 | + $html = ' |
|
| 151 | 151 | <div class="card-body"> |
| 152 | 152 | [%onlineusers_message%] |
| 153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
| 165 | 165 | </thead> |
| 166 | 166 | <tbody>'; |
| 167 | 167 | |
| 168 | - $userList = array(); |
|
| 169 | - $userCount = array(); |
|
| 170 | - // Create userlist with session-count first before output |
|
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | - |
|
| 174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | - $userList[] = array( |
|
| 179 | - $idle, |
|
| 180 | - '', |
|
| 181 | - $activeusers['username'], |
|
| 182 | - $webicon, |
|
| 183 | - abs($activeusers['internalKey']), |
|
| 184 | - $ip, |
|
| 185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | - $currentaction |
|
| 187 | - ); |
|
| 188 | - } |
|
| 189 | - foreach($userList as $params) {
|
|
| 190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - $html .= ' |
|
| 168 | + $userList = array(); |
|
| 169 | + $userCount = array(); |
|
| 170 | + // Create userlist with session-count first before output |
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
| 173 | + |
|
| 174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
| 175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
| 176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
| 177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
| 178 | + $userList[] = array( |
|
| 179 | + $idle, |
|
| 180 | + '', |
|
| 181 | + $activeusers['username'], |
|
| 182 | + $webicon, |
|
| 183 | + abs($activeusers['internalKey']), |
|
| 184 | + $ip, |
|
| 185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
|
| 186 | + $currentaction |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | + foreach($userList as $params) {
|
|
| 190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
| 191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + $html .= ' |
|
| 195 | 195 | </tbody> |
| 196 | 196 | </table> |
| 197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | 234 | if(is_array($evtOut)) {
|
| 235 | - $output = implode('', $evtOut);
|
|
| 236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
| 235 | + $output = implode('', $evtOut);
|
|
| 236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $widgets['welcome'] = array( |
| 240 | - 'menuindex' => '10', |
|
| 241 | - 'id' => 'welcome', |
|
| 242 | - 'cols' => 'col-sm-6', |
|
| 243 | - 'icon' => 'fa-home', |
|
| 244 | - 'title' => '[%welcome_title%]', |
|
| 245 | - 'body' => ' |
|
| 240 | + 'menuindex' => '10', |
|
| 241 | + 'id' => 'welcome', |
|
| 242 | + 'cols' => 'col-sm-6', |
|
| 243 | + 'icon' => 'fa-home', |
|
| 244 | + 'title' => '[%welcome_title%]', |
|
| 245 | + 'body' => ' |
|
| 246 | 246 | <div class="wm_buttons card-body"> |
| 247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
| 248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
| 320 | 320 | </table> |
| 321 | 321 | </div> |
| 322 | 322 | ', |
| 323 | - 'hide'=>'0' |
|
| 323 | + 'hide'=>'0' |
|
| 324 | 324 | ); |
| 325 | 325 | $widgets['onlineinfo'] = array( |
| 326 | - 'menuindex' => '20', |
|
| 327 | - 'id' => 'onlineinfo', |
|
| 328 | - 'cols' => 'col-sm-6', |
|
| 329 | - 'icon' => 'fa-user', |
|
| 330 | - 'title' => '[%onlineusers_title%]', |
|
| 331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | - 'hide'=>'0' |
|
| 326 | + 'menuindex' => '20', |
|
| 327 | + 'id' => 'onlineinfo', |
|
| 328 | + 'cols' => 'col-sm-6', |
|
| 329 | + 'icon' => 'fa-user', |
|
| 330 | + 'title' => '[%onlineusers_title%]', |
|
| 331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
| 332 | + 'hide'=>'0' |
|
| 333 | 333 | ); |
| 334 | 334 | $widgets['recentinfo'] = array( |
| 335 | - 'menuindex' => '30', |
|
| 336 | - 'id' => 'modxrecent_widget', |
|
| 337 | - 'cols' => 'col-sm-12', |
|
| 338 | - 'icon' => 'fa-pencil-square-o', |
|
| 339 | - 'title' => '[%activity_title%]', |
|
| 340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | - 'hide'=>'0' |
|
| 335 | + 'menuindex' => '30', |
|
| 336 | + 'id' => 'modxrecent_widget', |
|
| 337 | + 'cols' => 'col-sm-12', |
|
| 338 | + 'icon' => 'fa-pencil-square-o', |
|
| 339 | + 'title' => '[%activity_title%]', |
|
| 340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
| 341 | + 'hide'=>'0' |
|
| 342 | 342 | ); |
| 343 | 343 | if ($modx->config['rss_url_news']) {
|
| 344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | 368 | if(is_array($sitewidgets)) {
|
| 369 | - $newwidgets = array(); |
|
| 369 | + $newwidgets = array(); |
|
| 370 | 370 | foreach($sitewidgets as $widget){
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | usort($widgets, function ($a, $b) {
|
| 377 | - return $a['menuindex'] - $b['menuindex']; |
|
| 377 | + return $a['menuindex'] - $b['menuindex']; |
|
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | 382 | foreach($widgets as $widget) {
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 384 | - $output .= $modx->parseText($tpl, $widget); |
|
| 385 | - } |
|
| 383 | + if ($widget['hide'] != '1'){
|
|
| 384 | + $output .= $modx->parseText($tpl, $widget); |
|
| 385 | + } |
|
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | 398 | if(substr($target, 0, 1) === '@') {
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | - } else {
|
|
| 404 | - $content = ''; |
|
| 405 | - } |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
| 403 | + } else {
|
|
| 404 | + $content = ''; |
|
| 405 | + } |
|
| 406 | 406 | } else {
|
| 407 | - $chunk = $modx->getChunk($target); |
|
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 409 | - $content = $chunk; |
|
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | - {
|
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | - } |
|
| 407 | + $chunk = $modx->getChunk($target); |
|
| 408 | + if($chunk !== false && !empty($chunk)) {
|
|
| 409 | + $content = $chunk; |
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | + {
|
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | + } else {
|
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 419 | + } |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | 426 | if(strpos($content, '[+') !== false) {
|
| 427 | - $modx->toPlaceholders($ph); |
|
| 428 | - $content = $modx->mergePlaceholderContent($content); |
|
| 427 | + $modx->toPlaceholders($ph); |
|
| 428 | + $content = $modx->mergePlaceholderContent($content); |
|
| 429 | 429 | } |
| 430 | 430 | $content = $modx->parseDocumentSource($content); |
| 431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | 435 | if($js = $modx->getRegisteredClientScripts()) {
|
| 436 | - $content .= $js; |
|
| 436 | + $content .= $js; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | 445 | function getTplWidget() { // recent document info
|
| 446 | - return ' |
|
| 446 | + return ' |
|
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
| 449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | function getRecentInfo() { // recent document info
|
| 457 | - global $modx; |
|
| 457 | + global $modx; |
|
| 458 | 458 | |
| 459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
|
| 460 | 460 | |
| 461 | - $html = ' |
|
| 461 | + $html = ' |
|
| 462 | 462 | <div class="table-responsive"> |
| 463 | 463 | <table class="table data"> |
| 464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
| 476 | 476 | </table> |
| 477 | 477 | </div> |
| 478 | 478 | '; |
| 479 | - return $html; |
|
| 479 | + return $html; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | function getRecentInfoList() {
|
| 483 | - global $modx; |
|
| 484 | - |
|
| 485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | - |
|
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - $tpl = getRecentInfoRowTpl(); |
|
| 492 | - |
|
| 493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | - |
|
| 496 | - $output = array(); |
|
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | - $docid = $ph['id']; |
|
| 499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | - $ph['username'] = $_['username']; |
|
| 501 | - |
|
| 502 | - if($ph['deleted'] == 1) {
|
|
| 503 | - $ph['status'] = 'deleted text-danger'; |
|
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | - } else {
|
|
| 507 | - $ph['status'] = 'published'; |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | - } else {
|
|
| 513 | - $ph['edit_btn'] = ''; |
|
| 514 | - } |
|
| 515 | - |
|
| 516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | - $ph['preview_btn'] = str_replace(array( |
|
| 518 | - '[+id+]', |
|
| 519 | - '[+preview_disabled+]' |
|
| 520 | - ), array( |
|
| 521 | - $docid, |
|
| 522 | - $preview_disabled |
|
| 523 | - ), $btntpl['preview_btn']); |
|
| 524 | - |
|
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | - } else {
|
|
| 529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | - } |
|
| 531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | - } else {
|
|
| 533 | - $ph['delete_btn'] = ''; |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | - } else {
|
|
| 543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | - } |
|
| 545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | - |
|
| 547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | - |
|
| 549 | - if($ph['longtitle'] == '') {
|
|
| 550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | - } |
|
| 552 | - if($ph['description'] == '') {
|
|
| 553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | - } |
|
| 555 | - if($ph['introtext'] == '') {
|
|
| 556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | - } |
|
| 558 | - if($ph['alias'] == '') {
|
|
| 559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | - } |
|
| 561 | - |
|
| 562 | - $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | - } |
|
| 564 | - return join("\n", $output);
|
|
| 483 | + global $modx; |
|
| 484 | + |
|
| 485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
|
| 486 | + |
|
| 487 | + if($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + $tpl = getRecentInfoRowTpl(); |
|
| 492 | + |
|
| 493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
| 494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
| 495 | + |
|
| 496 | + $output = array(); |
|
| 497 | + while($ph = $modx->db->getRow($rs)) {
|
|
| 498 | + $docid = $ph['id']; |
|
| 499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
| 500 | + $ph['username'] = $_['username']; |
|
| 501 | + |
|
| 502 | + if($ph['deleted'] == 1) {
|
|
| 503 | + $ph['status'] = 'deleted text-danger'; |
|
| 504 | + } elseif($ph['published'] == 0) {
|
|
| 505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
| 506 | + } else {
|
|
| 507 | + $ph['status'] = 'published'; |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + if($modx->hasPermission('edit_document')) {
|
|
| 511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
|
| 512 | + } else {
|
|
| 513 | + $ph['edit_btn'] = ''; |
|
| 514 | + } |
|
| 515 | + |
|
| 516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
| 517 | + $ph['preview_btn'] = str_replace(array( |
|
| 518 | + '[+id+]', |
|
| 519 | + '[+preview_disabled+]' |
|
| 520 | + ), array( |
|
| 521 | + $docid, |
|
| 522 | + $preview_disabled |
|
| 523 | + ), $btntpl['preview_btn']); |
|
| 524 | + |
|
| 525 | + if($modx->hasPermission('delete_document')) {
|
|
| 526 | + if($ph['deleted'] == 0) {
|
|
| 527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
| 528 | + } else {
|
|
| 529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
| 530 | + } |
|
| 531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
|
| 532 | + } else {
|
|
| 533 | + $ph['delete_btn'] = ''; |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
| 542 | + } else {
|
|
| 543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
| 544 | + } |
|
| 545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
|
| 546 | + |
|
| 547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
|
| 548 | + |
|
| 549 | + if($ph['longtitle'] == '') {
|
|
| 550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
| 551 | + } |
|
| 552 | + if($ph['description'] == '') {
|
|
| 553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
| 554 | + } |
|
| 555 | + if($ph['introtext'] == '') {
|
|
| 556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
| 557 | + } |
|
| 558 | + if($ph['alias'] == '') {
|
|
| 559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
| 560 | + } |
|
| 561 | + |
|
| 562 | + $output[] = $modx->parseText($tpl, $ph); |
|
| 563 | + } |
|
| 564 | + return join("\n", $output);
|
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | function getRecentInfoRowTpl() {
|
| 568 | - $tpl = ' |
|
| 568 | + $tpl = ' |
|
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
| 571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | </div> |
| 590 | 590 | </td> |
| 591 | 591 | </tr>'; |
| 592 | - return $tpl; |
|
| 592 | + return $tpl; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | 596 | function wrapIcon($i, $action) {
|
| 597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | function getStartUpScript() {
|
| 601 | - $script = ' |
|
| 601 | + $script = ' |
|
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
| 604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
| 622 | 622 | })(jQuery); |
| 623 | 623 | </script> |
| 624 | 624 | '; |
| 625 | - return $script; |
|
| 625 | + return $script; |
|
| 626 | 626 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != 'true') {
|
|
| 2 | +if (IN_MANAGER_MODE != 'true') {
|
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 19 | +if ($modx->hasPermission('messages')) {
|
|
| 20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
| 23 | 23 | |
| 24 | 24 | $msg = array(); |
| 25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
| 27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
| 29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
| 30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
| 31 | 31 | $ph['MessageInfo'] = join("\n", $msg);
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if ($modx->hasPermission('help')) {
|
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
| 62 | + if ($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | 65 | } else {
|
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if (isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | + switch ($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | </tr> |
| 126 | 126 | </table>'; |
| 127 | 127 | |
| 128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
| 128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
| 149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while ($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach ($userList as $params) {
|
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $ph['OnlineInfo'] = $html; |
| 201 | 201 | |
| 202 | 202 | // include rss feeds for important forum topics |
| 203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
| 203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
| 204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
| 205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
| 206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if (is_array($evtOut)) {
|
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if (is_array($sitewidgets)) {
|
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach ($sitewidgets as $widget) {
|
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function($a, $b){
|
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach ($widgets as $widget) {
|
|
| 383 | + if ($widget['hide'] != '1') {
|
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if (substr($target, 0, 1) === '@') {
|
|
| 399 | + if (substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif (substr($target, 0, 5) === '@FILE') {
|
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | 403 | } else {
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | 406 | } else {
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if ($chunk !== false && !empty($chunk)) {
|
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 410 | + } elseif (is_file(MODX_BASE_PATH.$target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
| 412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
| 414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | 415 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
| 417 | 417 | } else {
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 426 | +if (strpos($content, '[+') !== false) {
|
|
| 427 | 427 | $modx->toPlaceholders($ph); |
| 428 | 428 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 435 | +if ($js = $modx->getRegisteredClientScripts()) {
|
|
| 436 | 436 | $content .= $js; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 445 | +function getTplWidget(){ // recent document info
|
|
| 446 | 446 | return ' |
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | '; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 456 | +function getRecentInfo(){ // recent document info
|
|
| 457 | 457 | global $modx; |
| 458 | 458 | |
| 459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | return $html; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | -function getRecentInfoList() {
|
|
| 482 | +function getRecentInfoList(){
|
|
| 483 | 483 | global $modx; |
| 484 | 484 | |
| 485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 486 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 487 | + if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
| 494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 495 | |
| 496 | 496 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 497 | + while ($ph = $modx->db->getRow($rs)) {
|
|
| 498 | 498 | $docid = $ph['id']; |
| 499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 500 | $ph['username'] = $_['username']; |
| 501 | 501 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 502 | + if ($ph['deleted'] == 1) {
|
|
| 503 | 503 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 504 | + } elseif ($ph['published'] == 0) {
|
|
| 505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | 506 | } else {
|
| 507 | 507 | $ph['status'] = 'published'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 510 | + if ($modx->hasPermission('edit_document')) {
|
|
| 511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | 512 | } else {
|
| 513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | $preview_disabled |
| 523 | 523 | ), $btntpl['preview_btn']); |
| 524 | 524 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 525 | + if ($modx->hasPermission('delete_document')) {
|
|
| 526 | + if ($ph['deleted'] == 0) {
|
|
| 527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | 528 | } else {
|
| 529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | $ph['delete_btn'] = ''; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | 542 | } else {
|
| 543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 548 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 549 | + if ($ph['longtitle'] == '') {
|
|
| 550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 551 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 552 | + if ($ph['description'] == '') {
|
|
| 553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 554 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 555 | + if ($ph['introtext'] == '') {
|
|
| 556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 557 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 558 | + if ($ph['alias'] == '') {
|
|
| 559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | return join("\n", $output);
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 567 | +function getRecentInfoRowTpl(){
|
|
| 568 | 568 | $tpl = ' |
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 596 | +function wrapIcon($i, $action){
|
|
| 597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | -function getStartUpScript() {
|
|
| 600 | +function getStartUpScript(){
|
|
| 601 | 601 | $script = ' |
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != 'true') {
|
|
| 2 | +if(IN_MANAGER_MODE != 'true') { |
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if($modx->hasPermission('bk_manager')) { |
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if($modx->hasPermission('help')) { |
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | - } else {
|
|
| 65 | + } else { |
|
| 66 | 66 | $ph['config_display'] = 'none'; |
| 67 | 67 | } |
| 68 | -} else {
|
|
| 68 | +} else { |
|
| 69 | 69 | $ph['config_display'] = 'none'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $ph['show_logout_reminder'] = 'block'; |
| 81 | 81 | unset($_SESSION['show_logout_reminder']); |
| 82 | -} else {
|
|
| 82 | +} else { |
|
| 83 | 83 | $ph['show_logout_reminder'] = 'none'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | -} else {
|
|
| 145 | +} else { |
|
| 146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach($userList as $params) { |
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
| 192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if(is_array($evtOut)) { |
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 341 | 341 | 'hide'=>'0' |
| 342 | 342 | ); |
| 343 | -if ($modx->config['rss_url_news']) {
|
|
| 343 | +if ($modx->config['rss_url_news']) { |
|
| 344 | 344 | $widgets['news'] = array( |
| 345 | 345 | 'menuindex' => '40', |
| 346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'hide'=>'0' |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | -if ($modx->config['rss_url_security']) {
|
|
| 354 | +if ($modx->config['rss_url_security']) { |
|
| 355 | 355 | $widgets['security'] = array( |
| 356 | 356 | 'menuindex' => '50', |
| 357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if(is_array($sitewidgets)) { |
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach($sitewidgets as $widget) { |
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function ($a, $b){ |
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach($widgets as $widget) { |
|
| 383 | + if ($widget['hide'] != '1') { |
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if(substr($target, 0, 1) === '@') { |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | - } else {
|
|
| 403 | + } else { |
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | -} else {
|
|
| 406 | +} else { |
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if($chunk !== false && !empty($chunk)) { |
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 415 | + // ClipperCMS compatible |
|
| 415 | 416 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 418 | + } |
|
| 419 | + } else { |
|
| 418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 419 | 421 | } |
| 420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
| 423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 426 | $content = $modx->mergeSettingsContent($content); |
| 425 | 427 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 428 | +if(strpos($content, '[+') !== false) { |
|
| 427 | 429 | $modx->toPlaceholders($ph); |
| 428 | 430 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
| 432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 436 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 436 | 438 | $content .= $js; |
| 437 | 439 | } |
| 438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
| 442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 446 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 447 | +function getTplWidget() |
|
| 448 | +{ |
|
| 449 | +// recent document info |
|
| 446 | 450 | return ' |
| 447 | 451 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | '; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 460 | +function getRecentInfo() |
|
| 461 | +{ |
|
| 462 | +// recent document info |
|
| 457 | 463 | global $modx; |
| 458 | 464 | |
| 459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +485,13 @@ discard block |
||
| 479 | 485 | return $html; |
| 480 | 486 | } |
| 481 | 487 | |
| 482 | -function getRecentInfoList() {
|
|
| 488 | +function getRecentInfoList() |
|
| 489 | +{ |
|
| 483 | 490 | global $modx; |
| 484 | 491 | |
| 485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 493 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
| 488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 496 | } |
| 490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
| 494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 502 | |
| 496 | 503 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 504 | + while($ph = $modx->db->getRow($rs)) { |
|
| 498 | 505 | $docid = $ph['id']; |
| 499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 507 | $ph['username'] = $_['username']; |
| 501 | 508 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 509 | + if($ph['deleted'] == 1) { |
|
| 503 | 510 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 511 | + } elseif($ph['published'] == 0) { |
|
| 505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | - } else {
|
|
| 513 | + } else { |
|
| 507 | 514 | $ph['status'] = 'published'; |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 517 | + if($modx->hasPermission('edit_document')) { |
|
| 511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | - } else {
|
|
| 519 | + } else { |
|
| 513 | 520 | $ph['edit_btn'] = ''; |
| 514 | 521 | } |
| 515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
| 522 | 529 | $preview_disabled |
| 523 | 530 | ), $btntpl['preview_btn']); |
| 524 | 531 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 532 | + if($modx->hasPermission('delete_document')) { |
|
| 533 | + if($ph['deleted'] == 0) { |
|
| 527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | - } else {
|
|
| 535 | + } else { |
|
| 529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
| 530 | 537 | } |
| 531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
| 532 | - } else {
|
|
| 539 | + } else { |
|
| 533 | 540 | $ph['delete_btn'] = ''; |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
| 537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
| 539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
| 541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | - } else {
|
|
| 549 | + } else { |
|
| 543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 544 | 551 | } |
| 545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
| 546 | 553 | |
| 547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 555 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 556 | + if($ph['longtitle'] == '') { |
|
| 550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 558 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 559 | + if($ph['description'] == '') { |
|
| 553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 561 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 562 | + if($ph['introtext'] == '') { |
|
| 556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 564 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 565 | + if($ph['alias'] == '') { |
|
| 559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 567 | } |
| 561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
| 564 | 571 | return join("\n", $output);
|
| 565 | 572 | } |
| 566 | 573 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 574 | +function getRecentInfoRowTpl() |
|
| 575 | +{ |
|
| 568 | 576 | $tpl = ' |
| 569 | 577 | <tr> |
| 570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
| 593 | 601 | } |
| 594 | 602 | |
| 595 | 603 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 604 | +function wrapIcon($i, $action) |
|
| 605 | +{ |
|
| 597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 607 | } |
| 599 | 608 | |
| 600 | -function getStartUpScript() {
|
|
| 609 | +function getStartUpScript() |
|
| 610 | +{ |
|
| 601 | 611 | $script = ' |
| 602 | 612 | <script type="text/javascript"> |
| 603 | 613 | function hideConfigCheckWarning(key) {
|
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
@@ -12,30 +12,30 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->manager->action) { |
| 15 | - case 27: |
|
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | - } |
|
| 19 | - break; |
|
| 20 | - case 85: |
|
| 21 | - case 72: |
|
| 22 | - case 4: |
|
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | - // check user has permissions for parent |
|
| 27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | - $udperms = new udperms(); |
|
| 29 | - $udperms->user = $modx->getLoginUserID(); |
|
| 30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | - if(!$udperms->checkPermissions()) { |
|
| 33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - break; |
|
| 37 | - default: |
|
| 38 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + case 27: |
|
| 16 | + if(!$modx->hasPermission('edit_document')) { |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | + } |
|
| 19 | + break; |
|
| 20 | + case 85: |
|
| 21 | + case 72: |
|
| 22 | + case 4: |
|
| 23 | + if(!$modx->hasPermission('new_document')) { |
|
| 24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | + // check user has permissions for parent |
|
| 27 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | + $udperms = new udperms(); |
|
| 29 | + $udperms->user = $modx->getLoginUserID(); |
|
| 30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | + if(!$udperms->checkPermissions()) { |
|
| 33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + break; |
|
| 37 | + default: |
|
| 38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -54,22 +54,22 @@ discard block |
||
| 54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 55 | 55 | |
| 56 | 56 | if($modx->manager->action == 27) { |
| 57 | - //editing an existing document |
|
| 58 | - // check permissions on the document |
|
| 59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | - $udperms = new udperms(); |
|
| 61 | - $udperms->user = $modx->getLoginUserID(); |
|
| 62 | - $udperms->document = $id; |
|
| 63 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | - |
|
| 65 | - if(!$udperms->checkPermissions()) { |
|
| 66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | - } |
|
| 57 | + //editing an existing document |
|
| 58 | + // check permissions on the document |
|
| 59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | + $udperms = new udperms(); |
|
| 61 | + $udperms->user = $modx->getLoginUserID(); |
|
| 62 | + $udperms->document = $id; |
|
| 63 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | + |
|
| 65 | + if(!$udperms->checkPermissions()) { |
|
| 66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // check to see if resource isn't locked |
| 71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 73 | 73 | } |
| 74 | 74 | // end check for lock |
| 75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // get document groups for current user |
| 80 | 80 | if($_SESSION['mgrDocgroups']) { |
| 81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if(!empty ($id)) { |
| 85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | - if($docgrp) { |
|
| 87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | - } |
|
| 89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | - $content = array(); |
|
| 91 | - $content = $modx->db->getRow($rs); |
|
| 92 | - $modx->documentObject = &$content; |
|
| 93 | - if(!$content) { |
|
| 94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | - } |
|
| 96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | + if($docgrp) { |
|
| 87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | + } |
|
| 89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | + $content = array(); |
|
| 91 | + $content = $modx->db->getRow($rs); |
|
| 92 | + $modx->documentObject = &$content; |
|
| 93 | + if(!$content) { |
|
| 94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | + } |
|
| 96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 97 | 97 | } else { |
| 98 | - $content = array(); |
|
| 98 | + $content = array(); |
|
| 99 | 99 | |
| 100 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | - } else { |
|
| 103 | - $content['template'] = getDefaultTemplate(); |
|
| 104 | - } |
|
| 100 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | + } else { |
|
| 103 | + $content['template'] = getDefaultTemplate(); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // restore saved form |
| 110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
| 111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
| 112 | - $formRestored = true; |
|
| 112 | + $formRestored = true; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // retain form values if template was changed |
| 116 | 116 | // edited to convert pub_date and unpub_date |
| 117 | 117 | // sottwell 02-09-2006 |
| 118 | 118 | if($formRestored == true) { |
| 119 | - $content = array_merge($content, $_POST); |
|
| 120 | - $content['content'] = $_POST['ta']; |
|
| 121 | - if(empty ($content['pub_date'])) { |
|
| 122 | - unset ($content['pub_date']); |
|
| 123 | - } else { |
|
| 124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | - } |
|
| 126 | - if(empty ($content['unpub_date'])) { |
|
| 127 | - unset ($content['unpub_date']); |
|
| 128 | - } else { |
|
| 129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | - } |
|
| 119 | + $content = array_merge($content, $_POST); |
|
| 120 | + $content['content'] = $_POST['ta']; |
|
| 121 | + if(empty ($content['pub_date'])) { |
|
| 122 | + unset ($content['pub_date']); |
|
| 123 | + } else { |
|
| 124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | + } |
|
| 126 | + if(empty ($content['unpub_date'])) { |
|
| 127 | + unset ($content['unpub_date']); |
|
| 128 | + } else { |
|
| 129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // increase menu index if this is a new document |
| 134 | 134 | if(!isset ($_REQUEST['id'])) { |
| 135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | - $modx->config['auto_menuindex'] = 1; |
|
| 137 | - } |
|
| 138 | - if($modx->config['auto_menuindex']) { |
|
| 139 | - $pid = intval($_REQUEST['pid']); |
|
| 140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | - } else { |
|
| 143 | - $content['menuindex'] = 0; |
|
| 144 | - } |
|
| 135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | + $modx->config['auto_menuindex'] = 1; |
|
| 137 | + } |
|
| 138 | + if($modx->config['auto_menuindex']) { |
|
| 139 | + $pid = intval($_REQUEST['pid']); |
|
| 140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | + } else { |
|
| 143 | + $content['menuindex'] = 0; |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if(isset ($_POST['which_editor'])) { |
| 148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 547 | 547 | <?php |
| 548 | - // invoke OnDocFormPrerender event |
|
| 549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | - 'id' => $id, |
|
| 551 | - 'template' => $content['template'] |
|
| 552 | - )); |
|
| 553 | - |
|
| 554 | - if(is_array($evtOut)) { |
|
| 555 | - echo implode('', $evtOut); |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - /*************************/ |
|
| 559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | - /*************************/ |
|
| 563 | - |
|
| 564 | - ?> |
|
| 548 | + // invoke OnDocFormPrerender event |
|
| 549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | + 'id' => $id, |
|
| 551 | + 'template' => $content['template'] |
|
| 552 | + )); |
|
| 553 | + |
|
| 554 | + if(is_array($evtOut)) { |
|
| 555 | + echo implode('', $evtOut); |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + /*************************/ |
|
| 559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | + /*************************/ |
|
| 563 | + |
|
| 564 | + ?> |
|
| 565 | 565 | <input type="hidden" name="a" value="5" /> |
| 566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | <h1> |
| 578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | - } else { |
|
| 581 | - if ($modx->manager->action == '4') { |
|
| 579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | + } else { |
|
| 581 | + if ($modx->manager->action == '4') { |
|
| 582 | 582 | echo $_lang['add_resource']; |
| 583 | 583 | } else if ($modx->manager->action == '72') { |
| 584 | 584 | echo $_lang['add_weblink']; |
| 585 | 585 | } else { |
| 586 | 586 | echo $_lang['create_resource_title']; |
| 587 | 587 | } |
| 588 | - } ?> |
|
| 588 | + } ?> |
|
| 589 | 589 | </h1> |
| 590 | 590 | |
| 591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | - // breadcrumbs |
|
| 595 | - if($modx->config['use_breadcrumbs']) { |
|
| 596 | - $temp = array(); |
|
| 597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | - |
|
| 599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | - $bID = (int) $_REQUEST['id']; |
|
| 601 | - $temp = $modx->getParentIds($bID); |
|
| 602 | - } else if(isset($_REQUEST['pid'])) { |
|
| 603 | - $bID = (int) $_REQUEST['pid']; |
|
| 604 | - $temp = $modx->getParentIds($bID); |
|
| 605 | - array_unshift($temp, $bID); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - if($temp) { |
|
| 609 | - $parents = implode(',', $temp); |
|
| 610 | - |
|
| 611 | - if(!empty($parents)) { |
|
| 612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | - while($row = $modx->db->getRow($rs)) { |
|
| 615 | - $out .= '<li class="breadcrumbs__li"> |
|
| 594 | + // breadcrumbs |
|
| 595 | + if($modx->config['use_breadcrumbs']) { |
|
| 596 | + $temp = array(); |
|
| 597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | + |
|
| 599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | + $bID = (int) $_REQUEST['id']; |
|
| 601 | + $temp = $modx->getParentIds($bID); |
|
| 602 | + } else if(isset($_REQUEST['pid'])) { |
|
| 603 | + $bID = (int) $_REQUEST['pid']; |
|
| 604 | + $temp = $modx->getParentIds($bID); |
|
| 605 | + array_unshift($temp, $bID); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + if($temp) { |
|
| 609 | + $parents = implode(',', $temp); |
|
| 610 | + |
|
| 611 | + if(!empty($parents)) { |
|
| 612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | + while($row = $modx->db->getRow($rs)) { |
|
| 615 | + $out .= '<li class="breadcrumbs__li"> |
|
| 616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 617 | 617 | <span class="breadcrumbs__sep">></span> |
| 618 | 618 | </li>'; |
| 619 | - } |
|
| 620 | - } |
|
| 621 | - } |
|
| 619 | + } |
|
| 620 | + } |
|
| 621 | + } |
|
| 622 | 622 | |
| 623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | - } |
|
| 626 | - ?> |
|
| 623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | + } |
|
| 626 | + ?> |
|
| 627 | 627 | |
| 628 | 628 | <!-- start main wrapper --> |
| 629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | <!-- General --> |
| 637 | 637 | <?php |
| 638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | - 'id' => $id |
|
| 640 | - )); |
|
| 641 | - if(is_array($evtOut)) { |
|
| 642 | - echo implode('', $evtOut); |
|
| 643 | - } else { |
|
| 644 | - ?> |
|
| 638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | + 'id' => $id |
|
| 640 | + )); |
|
| 641 | + if(is_array($evtOut)) { |
|
| 642 | + echo implode('', $evtOut); |
|
| 643 | + } else { |
|
| 644 | + ?> |
|
| 645 | 645 | <div class="tab-page" id="tabGeneral"> |
| 646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
| 726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 727 | 727 | <option value="0">(blank)</option> |
| 728 | 728 | <?php |
| 729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | - $currentCategory = ''; |
|
| 733 | - while($row = $modx->db->getRow($rs)) { |
|
| 734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | - continue; |
|
| 736 | - }; |
|
| 737 | - // Skip if not selectable but show if selected! |
|
| 738 | - $thisCategory = $row['category']; |
|
| 739 | - if($thisCategory == null) { |
|
| 740 | - $thisCategory = $_lang["no_category"]; |
|
| 741 | - } |
|
| 742 | - if($thisCategory != $currentCategory) { |
|
| 743 | - if($closeOptGroup) { |
|
| 744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | - } |
|
| 746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | - $closeOptGroup = true; |
|
| 748 | - } |
|
| 729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | + $currentCategory = ''; |
|
| 733 | + while($row = $modx->db->getRow($rs)) { |
|
| 734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | + continue; |
|
| 736 | + }; |
|
| 737 | + // Skip if not selectable but show if selected! |
|
| 738 | + $thisCategory = $row['category']; |
|
| 739 | + if($thisCategory == null) { |
|
| 740 | + $thisCategory = $_lang["no_category"]; |
|
| 741 | + } |
|
| 742 | + if($thisCategory != $currentCategory) { |
|
| 743 | + if($closeOptGroup) { |
|
| 744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | + } |
|
| 746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | + $closeOptGroup = true; |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 751 | 751 | |
| 752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | - $currentCategory = $thisCategory; |
|
| 754 | - } |
|
| 755 | - if($thisCategory != '') { |
|
| 756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | - } |
|
| 758 | - ?> |
|
| 752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | + $currentCategory = $thisCategory; |
|
| 754 | + } |
|
| 755 | + if($thisCategory != '') { |
|
| 756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | + } |
|
| 758 | + ?> |
|
| 759 | 759 | </select> |
| 760 | 760 | </td> |
| 761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
| 795 | 795 | </td> |
| 796 | 796 | <td valign="top"> |
| 797 | 797 | <?php |
| 798 | - $parentlookup = false; |
|
| 799 | - if(isset ($_REQUEST['id'])) { |
|
| 800 | - if($content['parent'] == 0) { |
|
| 801 | - $parentname = $site_name; |
|
| 802 | - } else { |
|
| 803 | - $parentlookup = $content['parent']; |
|
| 804 | - } |
|
| 805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | - if($_REQUEST['pid'] == 0) { |
|
| 807 | - $parentname = $site_name; |
|
| 808 | - } else { |
|
| 809 | - $parentlookup = $_REQUEST['pid']; |
|
| 810 | - } |
|
| 811 | - } elseif(isset($_POST['parent'])) { |
|
| 812 | - if($_POST['parent'] == 0) { |
|
| 813 | - $parentname = $site_name; |
|
| 814 | - } else { |
|
| 815 | - $parentlookup = $_POST['parent']; |
|
| 816 | - } |
|
| 817 | - } else { |
|
| 818 | - $parentname = $site_name; |
|
| 819 | - $content['parent'] = 0; |
|
| 820 | - } |
|
| 821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | - $parentname = $modx->db->getValue($rs); |
|
| 824 | - if(!$parentname) { |
|
| 825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | - } |
|
| 827 | - } |
|
| 828 | - ?> |
|
| 798 | + $parentlookup = false; |
|
| 799 | + if(isset ($_REQUEST['id'])) { |
|
| 800 | + if($content['parent'] == 0) { |
|
| 801 | + $parentname = $site_name; |
|
| 802 | + } else { |
|
| 803 | + $parentlookup = $content['parent']; |
|
| 804 | + } |
|
| 805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | + if($_REQUEST['pid'] == 0) { |
|
| 807 | + $parentname = $site_name; |
|
| 808 | + } else { |
|
| 809 | + $parentlookup = $_REQUEST['pid']; |
|
| 810 | + } |
|
| 811 | + } elseif(isset($_POST['parent'])) { |
|
| 812 | + if($_POST['parent'] == 0) { |
|
| 813 | + $parentname = $site_name; |
|
| 814 | + } else { |
|
| 815 | + $parentlookup = $_POST['parent']; |
|
| 816 | + } |
|
| 817 | + } else { |
|
| 818 | + $parentname = $site_name; |
|
| 819 | + $content['parent'] = 0; |
|
| 820 | + } |
|
| 821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | + $parentname = $modx->db->getValue($rs); |
|
| 824 | + if(!$parentname) { |
|
| 825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | + } |
|
| 827 | + } |
|
| 828 | + ?> |
|
| 829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
| 831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | </tr> |
| 834 | 834 | <tr></tr> |
| 835 | 835 | <?php |
| 836 | - /* |
|
| 836 | + /* |
|
| 837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
| 838 | 838 | ?> |
| 839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | </tr> |
| 862 | 862 | <?php |
| 863 | 863 | }*/ |
| 864 | - ?> |
|
| 864 | + ?> |
|
| 865 | 865 | |
| 866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
| 867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
| 874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
| 876 | 876 | <?php |
| 877 | - // invoke OnRichTextEditorRegister event |
|
| 878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | - if(is_array($evtOut)) { |
|
| 880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | - $editor = $evtOut[$i]; |
|
| 882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | - } |
|
| 884 | - } |
|
| 885 | - ?> |
|
| 877 | + // invoke OnRichTextEditorRegister event |
|
| 878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | + if(is_array($evtOut)) { |
|
| 880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | + $editor = $evtOut[$i]; |
|
| 882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | + } |
|
| 884 | + } |
|
| 885 | + ?> |
|
| 886 | 886 | </select> |
| 887 | 887 | </label> |
| 888 | 888 | </div> |
| 889 | 889 | <div id="content_body"> |
| 890 | 890 | <?php |
| 891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | - $htmlContent = $content['content']; |
|
| 893 | - ?> |
|
| 891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | + $htmlContent = $content['content']; |
|
| 893 | + ?> |
|
| 894 | 894 | <div class="section-editor clearfix"> |
| 895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
| 896 | 896 | </div> |
| 897 | 897 | <?php |
| 898 | - // Richtext-[*content*] |
|
| 899 | - $richtexteditorIds = array(); |
|
| 900 | - $richtexteditorOptions = array(); |
|
| 901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | - } else { |
|
| 904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | - } |
|
| 906 | - ?> |
|
| 898 | + // Richtext-[*content*] |
|
| 899 | + $richtexteditorIds = array(); |
|
| 900 | + $richtexteditorOptions = array(); |
|
| 901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | + } else { |
|
| 904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | + } |
|
| 906 | + ?> |
|
| 907 | 907 | </div> |
| 908 | 908 | </td> |
| 909 | 909 | </tr> |
@@ -1193,8 +1193,8 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | <?php |
| 1195 | 1195 | |
| 1196 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1197 | - ?> |
|
| 1196 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1197 | + ?> |
|
| 1198 | 1198 | <tr> |
| 1199 | 1199 | <td> |
| 1200 | 1200 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1216,15 +1216,15 @@ discard block |
||
| 1216 | 1216 | <td> |
| 1217 | 1217 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1218 | 1218 | <?php |
| 1219 | - if(!$content['contentType']) { |
|
| 1220 | - $content['contentType'] = 'text/html'; |
|
| 1221 | - } |
|
| 1222 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1223 | - $ct = explode(",", $custom_contenttype); |
|
| 1224 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1225 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1226 | - } |
|
| 1227 | - ?> |
|
| 1219 | + if(!$content['contentType']) { |
|
| 1220 | + $content['contentType'] = 'text/html'; |
|
| 1221 | + } |
|
| 1222 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1223 | + $ct = explode(",", $custom_contenttype); |
|
| 1224 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1225 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1226 | + } |
|
| 1227 | + ?> |
|
| 1228 | 1228 | </select> |
| 1229 | 1229 | </td> |
| 1230 | 1230 | </tr> |
@@ -1247,23 +1247,23 @@ discard block |
||
| 1247 | 1247 | </td> |
| 1248 | 1248 | </tr> |
| 1249 | 1249 | <?php |
| 1250 | - } else { |
|
| 1251 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1252 | - // non-admin managers creating or editing a document resource |
|
| 1253 | - ?> |
|
| 1250 | + } else { |
|
| 1251 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1252 | + // non-admin managers creating or editing a document resource |
|
| 1253 | + ?> |
|
| 1254 | 1254 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1255 | 1255 | <input type="hidden" name="type" value="document" /> |
| 1256 | 1256 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1257 | 1257 | <?php |
| 1258 | - } else { |
|
| 1259 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1260 | - ?> |
|
| 1258 | + } else { |
|
| 1259 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1260 | + ?> |
|
| 1261 | 1261 | <input type="hidden" name="type" value="reference" /> |
| 1262 | 1262 | <input type="hidden" name="contentType" value="text/html" /> |
| 1263 | 1263 | <?php |
| 1264 | - } |
|
| 1265 | - }//if mgrRole |
|
| 1266 | - ?> |
|
| 1264 | + } |
|
| 1265 | + }//if mgrRole |
|
| 1266 | + ?> |
|
| 1267 | 1267 | |
| 1268 | 1268 | <tr> |
| 1269 | 1269 | <td> |
@@ -1346,112 +1346,112 @@ discard block |
||
| 1346 | 1346 | ?> |
| 1347 | 1347 | |
| 1348 | 1348 | <?php |
| 1349 | - /******************************* |
|
| 1349 | + /******************************* |
|
| 1350 | 1350 | * Document Access Permissions */ |
| 1351 | - if($use_udperms == 1) { |
|
| 1352 | - $groupsarray = array(); |
|
| 1353 | - $sql = ''; |
|
| 1354 | - |
|
| 1355 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1356 | - if($documentId > 0) { |
|
| 1357 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1358 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1359 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1360 | - |
|
| 1361 | - // Load up the current permissions and names |
|
| 1362 | - $vs = array( |
|
| 1363 | - $tbl_document_group_names, |
|
| 1364 | - $tbl_document_groups, |
|
| 1365 | - $documentId |
|
| 1366 | - ); |
|
| 1367 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1368 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1369 | - } else { |
|
| 1370 | - // Just load up the names, we're starting clean |
|
| 1371 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1372 | - } |
|
| 1373 | - |
|
| 1374 | - // retain selected doc groups between post |
|
| 1375 | - if(isset($_POST['docgroups'])) { |
|
| 1376 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1377 | - } |
|
| 1351 | + if($use_udperms == 1) { |
|
| 1352 | + $groupsarray = array(); |
|
| 1353 | + $sql = ''; |
|
| 1354 | + |
|
| 1355 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1356 | + if($documentId > 0) { |
|
| 1357 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1358 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1359 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1360 | + |
|
| 1361 | + // Load up the current permissions and names |
|
| 1362 | + $vs = array( |
|
| 1363 | + $tbl_document_group_names, |
|
| 1364 | + $tbl_document_groups, |
|
| 1365 | + $documentId |
|
| 1366 | + ); |
|
| 1367 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1368 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1369 | + } else { |
|
| 1370 | + // Just load up the names, we're starting clean |
|
| 1371 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1372 | + } |
|
| 1373 | + |
|
| 1374 | + // retain selected doc groups between post |
|
| 1375 | + if(isset($_POST['docgroups'])) { |
|
| 1376 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1377 | + } |
|
| 1378 | + |
|
| 1379 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1380 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1381 | + |
|
| 1382 | + // Setup Basic attributes for each Input box |
|
| 1383 | + $inputAttributes = array( |
|
| 1384 | + 'type' => 'checkbox', |
|
| 1385 | + 'class' => 'checkbox', |
|
| 1386 | + 'name' => 'docgroups[]', |
|
| 1387 | + 'onclick' => 'makePublic(false);', |
|
| 1388 | + ); |
|
| 1389 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1390 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1391 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1392 | + |
|
| 1393 | + // Loop through the permissions list |
|
| 1394 | + while($row = $modx->db->getRow($rs)) { |
|
| 1395 | + |
|
| 1396 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1397 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1398 | + $inputId = 'group-' . $row['id']; |
|
| 1399 | + |
|
| 1400 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1401 | + if($checked) { |
|
| 1402 | + $notPublic = true; |
|
| 1403 | + } // Mark as private access (either web or manager) |
|
| 1404 | + |
|
| 1405 | + // Skip the access permission if the user doesn't have access... |
|
| 1406 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1407 | + continue; |
|
| 1408 | + } |
|
| 1378 | 1409 | |
| 1379 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1380 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1381 | - |
|
| 1382 | - // Setup Basic attributes for each Input box |
|
| 1383 | - $inputAttributes = array( |
|
| 1384 | - 'type' => 'checkbox', |
|
| 1385 | - 'class' => 'checkbox', |
|
| 1386 | - 'name' => 'docgroups[]', |
|
| 1387 | - 'onclick' => 'makePublic(false);', |
|
| 1388 | - ); |
|
| 1389 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1390 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1391 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1392 | - |
|
| 1393 | - // Loop through the permissions list |
|
| 1394 | - while($row = $modx->db->getRow($rs)) { |
|
| 1395 | - |
|
| 1396 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1397 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1398 | - $inputId = 'group-' . $row['id']; |
|
| 1399 | - |
|
| 1400 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1401 | - if($checked) { |
|
| 1402 | - $notPublic = true; |
|
| 1403 | - } // Mark as private access (either web or manager) |
|
| 1404 | - |
|
| 1405 | - // Skip the access permission if the user doesn't have access... |
|
| 1406 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1407 | - continue; |
|
| 1408 | - } |
|
| 1409 | - |
|
| 1410 | - // Setup attributes for this Input box |
|
| 1411 | - $inputAttributes['id'] = $inputId; |
|
| 1412 | - $inputAttributes['value'] = $inputValue; |
|
| 1413 | - if($checked) { |
|
| 1414 | - $inputAttributes['checked'] = 'checked'; |
|
| 1415 | - } else { |
|
| 1416 | - unset($inputAttributes['checked']); |
|
| 1417 | - } |
|
| 1418 | - |
|
| 1419 | - // Create attribute string list |
|
| 1420 | - $inputString = array(); |
|
| 1421 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1422 | - |
|
| 1423 | - // Make the <input> HTML |
|
| 1424 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1425 | - |
|
| 1426 | - // does user have this permission? |
|
| 1427 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1428 | - $vs = array( |
|
| 1429 | - $row['id'], |
|
| 1430 | - $_SESSION['mgrInternalKey'] |
|
| 1431 | - ); |
|
| 1432 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1433 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1434 | - $count = $modx->db->getValue($rsp); |
|
| 1435 | - if($count > 0) { |
|
| 1436 | - ++$permissions_yes; |
|
| 1437 | - } else { |
|
| 1438 | - ++$permissions_no; |
|
| 1439 | - } |
|
| 1440 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1441 | - } |
|
| 1442 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1443 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1444 | - $permissions = array(); |
|
| 1445 | - } |
|
| 1410 | + // Setup attributes for this Input box |
|
| 1411 | + $inputAttributes['id'] = $inputId; |
|
| 1412 | + $inputAttributes['value'] = $inputValue; |
|
| 1413 | + if($checked) { |
|
| 1414 | + $inputAttributes['checked'] = 'checked'; |
|
| 1415 | + } else { |
|
| 1416 | + unset($inputAttributes['checked']); |
|
| 1417 | + } |
|
| 1446 | 1418 | |
| 1447 | - // See if the Access Permissions section is worth displaying... |
|
| 1448 | - if(!empty($permissions)) { |
|
| 1449 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1450 | - if($isManager && $isWeb) { |
|
| 1451 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1452 | - } |
|
| 1453 | - // Output the permissions list... |
|
| 1454 | - ?> |
|
| 1419 | + // Create attribute string list |
|
| 1420 | + $inputString = array(); |
|
| 1421 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1422 | + |
|
| 1423 | + // Make the <input> HTML |
|
| 1424 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1425 | + |
|
| 1426 | + // does user have this permission? |
|
| 1427 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1428 | + $vs = array( |
|
| 1429 | + $row['id'], |
|
| 1430 | + $_SESSION['mgrInternalKey'] |
|
| 1431 | + ); |
|
| 1432 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1433 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1434 | + $count = $modx->db->getValue($rsp); |
|
| 1435 | + if($count > 0) { |
|
| 1436 | + ++$permissions_yes; |
|
| 1437 | + } else { |
|
| 1438 | + ++$permissions_no; |
|
| 1439 | + } |
|
| 1440 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1441 | + } |
|
| 1442 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1443 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1444 | + $permissions = array(); |
|
| 1445 | + } |
|
| 1446 | + |
|
| 1447 | + // See if the Access Permissions section is worth displaying... |
|
| 1448 | + if(!empty($permissions)) { |
|
| 1449 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1450 | + if($isManager && $isWeb) { |
|
| 1451 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1452 | + } |
|
| 1453 | + // Output the permissions list... |
|
| 1454 | + ?> |
|
| 1455 | 1455 | <!-- Access Permissions --> |
| 1456 | 1456 | <div class="tab-page" id="tabAccess"> |
| 1457 | 1457 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1485,31 +1485,31 @@ discard block |
||
| 1485 | 1485 | </ul> |
| 1486 | 1486 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1487 | 1487 | <?php |
| 1488 | - } // !empty($permissions) |
|
| 1489 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1490 | - ?> |
|
| 1488 | + } // !empty($permissions) |
|
| 1489 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1490 | + ?> |
|
| 1491 | 1491 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1492 | 1492 | <?php |
| 1493 | 1493 | |
| 1494 | - } |
|
| 1495 | - } |
|
| 1496 | - /* End Document Access Permissions * |
|
| 1494 | + } |
|
| 1495 | + } |
|
| 1496 | + /* End Document Access Permissions * |
|
| 1497 | 1497 | ***********************************/ |
| 1498 | - ?> |
|
| 1498 | + ?> |
|
| 1499 | 1499 | |
| 1500 | 1500 | <input type="submit" name="save" style="display:none" /> |
| 1501 | 1501 | <?php |
| 1502 | 1502 | |
| 1503 | - // invoke OnDocFormRender event |
|
| 1504 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1505 | - 'id' => $id, |
|
| 1506 | - 'template' => $content['template'] |
|
| 1507 | - )); |
|
| 1503 | + // invoke OnDocFormRender event |
|
| 1504 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1505 | + 'id' => $id, |
|
| 1506 | + 'template' => $content['template'] |
|
| 1507 | + )); |
|
| 1508 | 1508 | |
| 1509 | - if(is_array($evtOut)) { |
|
| 1510 | - echo implode('', $evtOut); |
|
| 1511 | - } |
|
| 1512 | - ?> |
|
| 1509 | + if(is_array($evtOut)) { |
|
| 1510 | + echo implode('', $evtOut); |
|
| 1511 | + } |
|
| 1512 | + ?> |
|
| 1513 | 1513 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1514 | 1514 | </div><!--div class="sectionBody"--> |
| 1515 | 1515 | </fieldset> |
@@ -1520,62 +1520,62 @@ discard block |
||
| 1520 | 1520 | </script> |
| 1521 | 1521 | <?php |
| 1522 | 1522 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
| 1523 | - if(is_array($richtexteditorIds)) { |
|
| 1524 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1525 | - // invoke OnRichTextEditorInit event |
|
| 1526 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1527 | - 'editor' => $editor, |
|
| 1528 | - 'elements' => $elements, |
|
| 1529 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1530 | - )); |
|
| 1531 | - if(is_array($evtOut)) { |
|
| 1532 | - echo implode('', $evtOut); |
|
| 1533 | - } |
|
| 1534 | - } |
|
| 1535 | - } |
|
| 1523 | + if(is_array($richtexteditorIds)) { |
|
| 1524 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1525 | + // invoke OnRichTextEditorInit event |
|
| 1526 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1527 | + 'editor' => $editor, |
|
| 1528 | + 'elements' => $elements, |
|
| 1529 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1530 | + )); |
|
| 1531 | + if(is_array($evtOut)) { |
|
| 1532 | + echo implode('', $evtOut); |
|
| 1533 | + } |
|
| 1534 | + } |
|
| 1535 | + } |
|
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | 1538 | function getDefaultTemplate() { |
| 1539 | - global $modx; |
|
| 1540 | - |
|
| 1541 | - switch($modx->config['auto_template_logic']) { |
|
| 1542 | - case 'sibling': |
|
| 1543 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1544 | - $site_start = $modx->config['site_start']; |
|
| 1545 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1546 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1547 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1548 | - $default_template = $sibl[0]['template']; |
|
| 1549 | - } |
|
| 1550 | - } else { |
|
| 1551 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1552 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1553 | - $default_template = $sibl[0]['template']; |
|
| 1554 | - } else { |
|
| 1555 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1556 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1557 | - $default_template = $sibl[0]['template']; |
|
| 1558 | - } |
|
| 1559 | - } |
|
| 1560 | - } |
|
| 1561 | - if(isset($default_template)) { |
|
| 1562 | - break; |
|
| 1563 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1564 | - case 'parent': |
|
| 1565 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1566 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1567 | - if(isset($parent['template'])) { |
|
| 1568 | - $default_template = $parent['template']; |
|
| 1569 | - } |
|
| 1570 | - } |
|
| 1571 | - break; |
|
| 1572 | - case 'system': |
|
| 1573 | - default: // default_template is already set |
|
| 1574 | - $default_template = $modx->config['default_template']; |
|
| 1575 | - } |
|
| 1576 | - if(!isset($default_template)) { |
|
| 1577 | - $default_template = $modx->config['default_template']; |
|
| 1578 | - } // default_template is already set |
|
| 1579 | - |
|
| 1580 | - return $default_template; |
|
| 1539 | + global $modx; |
|
| 1540 | + |
|
| 1541 | + switch($modx->config['auto_template_logic']) { |
|
| 1542 | + case 'sibling': |
|
| 1543 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1544 | + $site_start = $modx->config['site_start']; |
|
| 1545 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1546 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1547 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1548 | + $default_template = $sibl[0]['template']; |
|
| 1549 | + } |
|
| 1550 | + } else { |
|
| 1551 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1552 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1553 | + $default_template = $sibl[0]['template']; |
|
| 1554 | + } else { |
|
| 1555 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1556 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1557 | + $default_template = $sibl[0]['template']; |
|
| 1558 | + } |
|
| 1559 | + } |
|
| 1560 | + } |
|
| 1561 | + if(isset($default_template)) { |
|
| 1562 | + break; |
|
| 1563 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1564 | + case 'parent': |
|
| 1565 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1566 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1567 | + if(isset($parent['template'])) { |
|
| 1568 | + $default_template = $parent['template']; |
|
| 1569 | + } |
|
| 1570 | + } |
|
| 1571 | + break; |
|
| 1572 | + case 'system': |
|
| 1573 | + default: // default_template is already set |
|
| 1574 | + $default_template = $modx->config['default_template']; |
|
| 1575 | + } |
|
| 1576 | + if(!isset($default_template)) { |
|
| 1577 | + $default_template = $modx->config['default_template']; |
|
| 1578 | + } // default_template is already set |
|
| 1579 | + |
|
| 1580 | + return $default_template; |
|
| 1581 | 1581 | } |
@@ -1,35 +1,35 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") { |
|
| 2 | +if (IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
| 7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 10 | -$add_path = $sd . $sb . $pg; |
|
| 7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 10 | +$add_path = $sd.$sb.$pg; |
|
| 11 | 11 | /*******************/ |
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | -switch($modx->manager->action) { |
|
| 14 | +switch ($modx->manager->action) { |
|
| 15 | 15 | case 27: |
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 16 | + if (!$modx->hasPermission('edit_document')) { |
|
| 17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 18 | 18 | } |
| 19 | 19 | break; |
| 20 | 20 | case 85: |
| 21 | 21 | case 72: |
| 22 | 22 | case 4: |
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 23 | + if (!$modx->hasPermission('new_document')) { |
|
| 24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | 26 | // check user has permissions for parent |
| 27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 28 | 28 | $udperms = new udperms(); |
| 29 | 29 | $udperms->user = $modx->getLoginUserID(); |
| 30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
| 31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
| 32 | - if(!$udperms->checkPermissions()) { |
|
| 32 | + if (!$udperms->checkPermissions()) { |
|
| 33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -53,22 +53,22 @@ discard block |
||
| 53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
| 54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 55 | 55 | |
| 56 | -if($modx->manager->action == 27) { |
|
| 56 | +if ($modx->manager->action == 27) { |
|
| 57 | 57 | //editing an existing document |
| 58 | 58 | // check permissions on the document |
| 59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 60 | 60 | $udperms = new udperms(); |
| 61 | 61 | $udperms->user = $modx->getLoginUserID(); |
| 62 | 62 | $udperms->document = $id; |
| 63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
| 64 | 64 | |
| 65 | - if(!$udperms->checkPermissions()) { |
|
| 65 | + if (!$udperms->checkPermissions()) { |
|
| 66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // check to see if resource isn't locked |
| 71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
| 73 | 73 | } |
| 74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
| 77 | 77 | $modx->lockElement(7, $id); |
| 78 | 78 | |
| 79 | 79 | // get document groups for current user |
| 80 | -if($_SESSION['mgrDocgroups']) { |
|
| 80 | +if ($_SESSION['mgrDocgroups']) { |
|
| 81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -if(!empty ($id)) { |
|
| 84 | +if (!empty ($id)) { |
|
| 85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
| 86 | - if($docgrp) { |
|
| 86 | + if ($docgrp) { |
|
| 87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
| 88 | 88 | } |
| 89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
| 90 | 90 | $content = array(); |
| 91 | 91 | $content = $modx->db->getRow($rs); |
| 92 | 92 | $modx->documentObject = &$content; |
| 93 | - if(!$content) { |
|
| 93 | + if (!$content) { |
|
| 94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 95 | 95 | } |
| 96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
| 97 | 97 | } else { |
| 98 | 98 | $content = array(); |
| 99 | 99 | |
| 100 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 100 | + if (isset($_REQUEST['newtemplate'])) { |
|
| 101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
| 102 | 102 | } else { |
| 103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // restore saved form |
| 110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
| 111 | -if(isset($_REQUEST['newtemplate'])) { |
|
| 111 | +if (isset($_REQUEST['newtemplate'])) { |
|
| 112 | 112 | $formRestored = true; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // retain form values if template was changed |
| 116 | 116 | // edited to convert pub_date and unpub_date |
| 117 | 117 | // sottwell 02-09-2006 |
| 118 | -if($formRestored == true) { |
|
| 118 | +if ($formRestored == true) { |
|
| 119 | 119 | $content = array_merge($content, $_POST); |
| 120 | 120 | $content['content'] = $_POST['ta']; |
| 121 | - if(empty ($content['pub_date'])) { |
|
| 121 | + if (empty ($content['pub_date'])) { |
|
| 122 | 122 | unset ($content['pub_date']); |
| 123 | 123 | } else { |
| 124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
| 125 | 125 | } |
| 126 | - if(empty ($content['unpub_date'])) { |
|
| 126 | + if (empty ($content['unpub_date'])) { |
|
| 127 | 127 | unset ($content['unpub_date']); |
| 128 | 128 | } else { |
| 129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // increase menu index if this is a new document |
| 134 | -if(!isset ($_REQUEST['id'])) { |
|
| 135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | +if (!isset ($_REQUEST['id'])) { |
|
| 135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | 136 | $modx->config['auto_menuindex'] = 1; |
| 137 | 137 | } |
| 138 | - if($modx->config['auto_menuindex']) { |
|
| 138 | + if ($modx->config['auto_menuindex']) { |
|
| 139 | 139 | $pid = intval($_REQUEST['pid']); |
| 140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
| 141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if(isset ($_POST['which_editor'])) { |
|
| 147 | +if (isset ($_POST['which_editor'])) { |
|
| 148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Add lock-element JS-Script |
| 152 | 152 | $lockElementId = $id; |
| 153 | 153 | $lockElementType = 7; |
| 154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 155 | 155 | ?> |
| 156 | 156 | <script type="text/javascript"> |
| 157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | }, |
| 182 | 182 | cancel: function() { |
| 183 | 183 | documentDirty = false; |
| 184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
| 184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
| 185 | 185 | }, |
| 186 | 186 | duplicate: function() { |
| 187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | }, |
| 191 | 191 | view: function() { |
| 192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
| 192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
| 193 | 193 | } |
| 194 | 194 | }; |
| 195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | 'template' => $content['template'] |
| 552 | 552 | )); |
| 553 | 553 | |
| 554 | - if(is_array($evtOut)) { |
|
| 554 | + if (is_array($evtOut)) { |
|
| 555 | 555 | echo implode('', $evtOut); |
| 556 | 556 | } |
| 557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | <fieldset id="create_edit"> |
| 576 | 576 | |
| 577 | 577 | <h1> |
| 578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
| 579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
| 579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
| 580 | 580 | } else { |
| 581 | 581 | if ($modx->manager->action == '4') { |
| 582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | 594 | // breadcrumbs |
| 595 | - if($modx->config['use_breadcrumbs']) { |
|
| 595 | + if ($modx->config['use_breadcrumbs']) { |
|
| 596 | 596 | $temp = array(); |
| 597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
| 598 | 598 | |
| 599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | 600 | $bID = (int) $_REQUEST['id']; |
| 601 | 601 | $temp = $modx->getParentIds($bID); |
| 602 | - } else if(isset($_REQUEST['pid'])) { |
|
| 602 | + } else if (isset($_REQUEST['pid'])) { |
|
| 603 | 603 | $bID = (int) $_REQUEST['pid']; |
| 604 | 604 | $temp = $modx->getParentIds($bID); |
| 605 | 605 | array_unshift($temp, $bID); |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - if($temp) { |
|
| 608 | + if ($temp) { |
|
| 609 | 609 | $parents = implode(',', $temp); |
| 610 | 610 | |
| 611 | - if(!empty($parents)) { |
|
| 611 | + if (!empty($parents)) { |
|
| 612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
| 613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
| 614 | - while($row = $modx->db->getRow($rs)) { |
|
| 614 | + while ($row = $modx->db->getRow($rs)) { |
|
| 615 | 615 | $out .= '<li class="breadcrumbs__li"> |
| 616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
| 616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
| 617 | 617 | <span class="breadcrumbs__sep">></span> |
| 618 | 618 | </li>'; |
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
| 624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
| 625 | 625 | } |
| 626 | 626 | ?> |
| 627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
| 639 | 639 | 'id' => $id |
| 640 | 640 | )); |
| 641 | - if(is_array($evtOut)) { |
|
| 641 | + if (is_array($evtOut)) { |
|
| 642 | 642 | echo implode('', $evtOut); |
| 643 | 643 | } else { |
| 644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | </td> |
| 695 | 695 | </tr> |
| 696 | 696 | |
| 697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 698 | 698 | |
| 699 | 699 | <tr> |
| 700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
| 730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
| 731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
| 732 | 732 | $currentCategory = ''; |
| 733 | - while($row = $modx->db->getRow($rs)) { |
|
| 734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | + while ($row = $modx->db->getRow($rs)) { |
|
| 734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | 735 | continue; |
| 736 | 736 | }; |
| 737 | 737 | // Skip if not selectable but show if selected! |
| 738 | 738 | $thisCategory = $row['category']; |
| 739 | - if($thisCategory == null) { |
|
| 739 | + if ($thisCategory == null) { |
|
| 740 | 740 | $thisCategory = $_lang["no_category"]; |
| 741 | 741 | } |
| 742 | - if($thisCategory != $currentCategory) { |
|
| 743 | - if($closeOptGroup) { |
|
| 742 | + if ($thisCategory != $currentCategory) { |
|
| 743 | + if ($closeOptGroup) { |
|
| 744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
| 745 | 745 | } |
| 746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
| 751 | 751 | |
| 752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
| 753 | 753 | $currentCategory = $thisCategory; |
| 754 | 754 | } |
| 755 | - if($thisCategory != '') { |
|
| 755 | + if ($thisCategory != '') { |
|
| 756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
| 757 | 757 | } |
| 758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
| 796 | 796 | <td valign="top"> |
| 797 | 797 | <?php |
| 798 | 798 | $parentlookup = false; |
| 799 | - if(isset ($_REQUEST['id'])) { |
|
| 800 | - if($content['parent'] == 0) { |
|
| 799 | + if (isset ($_REQUEST['id'])) { |
|
| 800 | + if ($content['parent'] == 0) { |
|
| 801 | 801 | $parentname = $site_name; |
| 802 | 802 | } else { |
| 803 | 803 | $parentlookup = $content['parent']; |
| 804 | 804 | } |
| 805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | - if($_REQUEST['pid'] == 0) { |
|
| 805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
| 806 | + if ($_REQUEST['pid'] == 0) { |
|
| 807 | 807 | $parentname = $site_name; |
| 808 | 808 | } else { |
| 809 | 809 | $parentlookup = $_REQUEST['pid']; |
| 810 | 810 | } |
| 811 | - } elseif(isset($_POST['parent'])) { |
|
| 812 | - if($_POST['parent'] == 0) { |
|
| 811 | + } elseif (isset($_POST['parent'])) { |
|
| 812 | + if ($_POST['parent'] == 0) { |
|
| 813 | 813 | $parentname = $site_name; |
| 814 | 814 | } else { |
| 815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
| 818 | 818 | $parentname = $site_name; |
| 819 | 819 | $content['parent'] = 0; |
| 820 | 820 | } |
| 821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
| 823 | 823 | $parentname = $modx->db->getValue($rs); |
| 824 | - if(!$parentname) { |
|
| 824 | + if (!$parentname) { |
|
| 825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
| 826 | 826 | } |
| 827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | }*/ |
| 864 | 864 | ?> |
| 865 | 865 | |
| 866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 867 | 867 | <tr> |
| 868 | 868 | <td colspan="2"> |
| 869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
| 876 | 876 | <?php |
| 877 | 877 | // invoke OnRichTextEditorRegister event |
| 878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
| 879 | - if(is_array($evtOut)) { |
|
| 880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | + if (is_array($evtOut)) { |
|
| 880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | 881 | $editor = $evtOut[$i]; |
| 882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
| 883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | </div> |
| 889 | 889 | <div id="content_body"> |
| 890 | 890 | <?php |
| 891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | 892 | $htmlContent = $content['content']; |
| 893 | 893 | ?> |
| 894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
| 902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
| 903 | 903 | } else { |
| 904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
| 905 | 905 | } |
| 906 | 906 | ?> |
| 907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
| 919 | 919 | $template = $default_template; |
| 920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
| 920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
| 921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
| 922 | 922 | $template = $_REQUEST['newtemplate']; |
| 923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
| 945 | 945 | ); |
| 946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
| 947 | 947 | if ($group_tvs) { |
| 948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 949 | 949 | $from .= ' |
| 950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
| 951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
| 950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
| 951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
| 952 | 952 | } |
| 953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
| 954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
| 957 | 957 | <!-- Template Variables -->' . "\n"; |
| 958 | 958 | if (!$group_tvs) { |
| 959 | 959 | $templateVariables .= ' |
| 960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 961 | 961 | <div class="sectionBody tmplvars"> |
| 962 | 962 | <table>'; |
| 963 | 963 | } else if ($group_tvs == 2) { |
| 964 | 964 | $templateVariables .= ' |
| 965 | 965 | <div class="tab-section"> |
| 966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
| 968 | 968 | <script type="text/javascript"> |
| 969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 970 | 970 | </script>'; |
| 971 | 971 | } else if ($group_tvs == 3) { |
| 972 | 972 | $templateVariables .= ' |
| 973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
| 974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
| 976 | 976 | } else if ($group_tvs == 4) { |
| 977 | 977 | $templateVariables .= ' |
| 978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
| 979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
| 981 | 981 | |
| 982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
| 983 | 983 | <script type="text/javascript"> |
| 984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 985 | 985 | </script>'; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
| 989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
| 990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
| 989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
| 990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
| 991 | 991 | $i = 0; |
| 992 | 992 | $tab = ''; |
| 993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
| 995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
| 996 | 996 | if ($i === 0) { |
| 997 | 997 | $templateVariables .= ' |
| 998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 999 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 1000 | 1000 | <div class="tab-body tmplvars"> |
| 1001 | 1001 | <table>' . "\n"; |
| 1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
| 1005 | 1005 | </div> |
| 1006 | 1006 | </div> |
| 1007 | 1007 | |
| 1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 1010 | 1010 | <div class="tab-body tmplvars"> |
| 1011 | 1011 | <table>'; |
| 1012 | 1012 | } |
| 1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
| 1014 | 1014 | if ($i === 0) { |
| 1015 | 1015 | $templateVariables .= ' |
| 1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1019 | 1019 | |
| 1020 | 1020 | <div class="tab-body tmplvars"> |
| 1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
| 1025 | 1025 | </div> |
| 1026 | 1026 | </div> |
| 1027 | 1027 | |
| 1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1031 | 1031 | |
| 1032 | 1032 | <div class="tab-body tmplvars"> |
| 1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
| 1035 | 1035 | } else if ($group_tvs == 5) { |
| 1036 | 1036 | if ($i === 0) { |
| 1037 | 1037 | $templateVariables .= ' |
| 1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1041 | 1041 | <table>'; |
| 1042 | 1042 | } else { |
| 1043 | 1043 | $templateVariables .= ' |
| 1044 | 1044 | </table> |
| 1045 | 1045 | </div> |
| 1046 | 1046 | |
| 1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1050 | 1050 | |
| 1051 | 1051 | <table>'; |
| 1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
| 1065 | 1065 | }; |
| 1066 | 1066 | // Add richtext editor to the list |
| 1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
| 1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
| 1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
| 1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | // splitter |
| 1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | // post back value |
| 1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
| 1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
| 1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
| 1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
| 1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
| 1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
| 1085 | 1085 | } else { |
| 1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
| 1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } else { |
| 1089 | 1089 | $tvPBV = $row['value']; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
| 1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
| 1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
| 1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
| 1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
| 1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
| 1095 | 1095 | |
| 1096 | 1096 | $templateVariables .= ' |
| 1097 | 1097 | <tr> |
| 1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
| 1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
| 1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
| 1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
| 1100 | 1100 | </tr>'; |
| 1101 | 1101 | |
| 1102 | 1102 | $tab = $row['category_id']; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | <?php |
| 1195 | 1195 | |
| 1196 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1196 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1197 | 1197 | ?> |
| 1198 | 1198 | <tr> |
| 1199 | 1199 | <td> |
@@ -1216,13 +1216,13 @@ discard block |
||
| 1216 | 1216 | <td> |
| 1217 | 1217 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1218 | 1218 | <?php |
| 1219 | - if(!$content['contentType']) { |
|
| 1219 | + if (!$content['contentType']) { |
|
| 1220 | 1220 | $content['contentType'] = 'text/html'; |
| 1221 | 1221 | } |
| 1222 | 1222 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
| 1223 | 1223 | $ct = explode(",", $custom_contenttype); |
| 1224 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1225 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1224 | + for ($i = 0; $i < count($ct); $i++) { |
|
| 1225 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
| 1226 | 1226 | } |
| 1227 | 1227 | ?> |
| 1228 | 1228 | </select> |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | </tr> |
| 1249 | 1249 | <?php |
| 1250 | 1250 | } else { |
| 1251 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1251 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1252 | 1252 | // non-admin managers creating or editing a document resource |
| 1253 | 1253 | ?> |
| 1254 | 1254 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1348,15 +1348,15 @@ discard block |
||
| 1348 | 1348 | <?php |
| 1349 | 1349 | /******************************* |
| 1350 | 1350 | * Document Access Permissions */ |
| 1351 | - if($use_udperms == 1) { |
|
| 1351 | + if ($use_udperms == 1) { |
|
| 1352 | 1352 | $groupsarray = array(); |
| 1353 | 1353 | $sql = ''; |
| 1354 | 1354 | |
| 1355 | 1355 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
| 1356 | - if($documentId > 0) { |
|
| 1356 | + if ($documentId > 0) { |
|
| 1357 | 1357 | // Load up, the permissions from the parent (if new document) or existing document |
| 1358 | 1358 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1359 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1359 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
| 1360 | 1360 | |
| 1361 | 1361 | // Load up the current permissions and names |
| 1362 | 1362 | $vs = array( |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | // retain selected doc groups between post |
| 1375 | - if(isset($_POST['docgroups'])) { |
|
| 1375 | + if (isset($_POST['docgroups'])) { |
|
| 1376 | 1376 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
| 1377 | 1377 | } |
| 1378 | 1378 | |
@@ -1391,26 +1391,26 @@ discard block |
||
| 1391 | 1391 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
| 1392 | 1392 | |
| 1393 | 1393 | // Loop through the permissions list |
| 1394 | - while($row = $modx->db->getRow($rs)) { |
|
| 1394 | + while ($row = $modx->db->getRow($rs)) { |
|
| 1395 | 1395 | |
| 1396 | 1396 | // Create an inputValue pair (group ID and group link (if it exists)) |
| 1397 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1398 | - $inputId = 'group-' . $row['id']; |
|
| 1397 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1398 | + $inputId = 'group-'.$row['id']; |
|
| 1399 | 1399 | |
| 1400 | 1400 | $checked = in_array($inputValue, $groupsarray); |
| 1401 | - if($checked) { |
|
| 1401 | + if ($checked) { |
|
| 1402 | 1402 | $notPublic = true; |
| 1403 | 1403 | } // Mark as private access (either web or manager) |
| 1404 | 1404 | |
| 1405 | 1405 | // Skip the access permission if the user doesn't have access... |
| 1406 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1406 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1407 | 1407 | continue; |
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | // Setup attributes for this Input box |
| 1411 | 1411 | $inputAttributes['id'] = $inputId; |
| 1412 | 1412 | $inputAttributes['value'] = $inputValue; |
| 1413 | - if($checked) { |
|
| 1413 | + if ($checked) { |
|
| 1414 | 1414 | $inputAttributes['checked'] = 'checked'; |
| 1415 | 1415 | } else { |
| 1416 | 1416 | unset($inputAttributes['checked']); |
@@ -1418,10 +1418,10 @@ discard block |
||
| 1418 | 1418 | |
| 1419 | 1419 | // Create attribute string list |
| 1420 | 1420 | $inputString = array(); |
| 1421 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1421 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
| 1422 | 1422 | |
| 1423 | 1423 | // Make the <input> HTML |
| 1424 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1424 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
| 1425 | 1425 | |
| 1426 | 1426 | // does user have this permission? |
| 1427 | 1427 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1432,23 +1432,23 @@ discard block |
||
| 1432 | 1432 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
| 1433 | 1433 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
| 1434 | 1434 | $count = $modx->db->getValue($rsp); |
| 1435 | - if($count > 0) { |
|
| 1435 | + if ($count > 0) { |
|
| 1436 | 1436 | ++$permissions_yes; |
| 1437 | 1437 | } else { |
| 1438 | 1438 | ++$permissions_no; |
| 1439 | 1439 | } |
| 1440 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1440 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
| 1441 | 1441 | } |
| 1442 | 1442 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
| 1443 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1443 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1444 | 1444 | $permissions = array(); |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | // See if the Access Permissions section is worth displaying... |
| 1448 | - if(!empty($permissions)) { |
|
| 1448 | + if (!empty($permissions)) { |
|
| 1449 | 1449 | // Add the "All Document Groups" item if we have rights in both contexts |
| 1450 | - if($isManager && $isWeb) { |
|
| 1451 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1450 | + if ($isManager && $isWeb) { |
|
| 1451 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
| 1452 | 1452 | } |
| 1453 | 1453 | // Output the permissions list... |
| 1454 | 1454 | ?> |
@@ -1481,12 +1481,12 @@ discard block |
||
| 1481 | 1481 | </script> |
| 1482 | 1482 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
| 1483 | 1483 | <ul> |
| 1484 | - <?= implode("\n", $permissions) . "\n" ?> |
|
| 1484 | + <?= implode("\n", $permissions)."\n" ?> |
|
| 1485 | 1485 | </ul> |
| 1486 | 1486 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1487 | 1487 | <?php |
| 1488 | 1488 | } // !empty($permissions) |
| 1489 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1489 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1490 | 1490 | ?> |
| 1491 | 1491 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1492 | 1492 | <?php |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | 'template' => $content['template'] |
| 1507 | 1507 | )); |
| 1508 | 1508 | |
| 1509 | - if(is_array($evtOut)) { |
|
| 1509 | + if (is_array($evtOut)) { |
|
| 1510 | 1510 | echo implode('', $evtOut); |
| 1511 | 1511 | } |
| 1512 | 1512 | ?> |
@@ -1519,52 +1519,52 @@ discard block |
||
| 1519 | 1519 | storeCurTemplate(); |
| 1520 | 1520 | </script> |
| 1521 | 1521 | <?php |
| 1522 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1523 | - if(is_array($richtexteditorIds)) { |
|
| 1524 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1522 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1523 | + if (is_array($richtexteditorIds)) { |
|
| 1524 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
| 1525 | 1525 | // invoke OnRichTextEditorInit event |
| 1526 | 1526 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
| 1527 | 1527 | 'editor' => $editor, |
| 1528 | 1528 | 'elements' => $elements, |
| 1529 | 1529 | 'options' => $richtexteditorOptions[$editor] |
| 1530 | 1530 | )); |
| 1531 | - if(is_array($evtOut)) { |
|
| 1531 | + if (is_array($evtOut)) { |
|
| 1532 | 1532 | echo implode('', $evtOut); |
| 1533 | 1533 | } |
| 1534 | 1534 | } |
| 1535 | 1535 | } |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | -function getDefaultTemplate() { |
|
| 1538 | +function getDefaultTemplate(){ |
|
| 1539 | 1539 | global $modx; |
| 1540 | 1540 | |
| 1541 | - switch($modx->config['auto_template_logic']) { |
|
| 1541 | + switch ($modx->config['auto_template_logic']) { |
|
| 1542 | 1542 | case 'sibling': |
| 1543 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1543 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1544 | 1544 | $site_start = $modx->config['site_start']; |
| 1545 | 1545 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
| 1546 | 1546 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
| 1547 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1547 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1548 | 1548 | $default_template = $sibl[0]['template']; |
| 1549 | 1549 | } |
| 1550 | 1550 | } else { |
| 1551 | 1551 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
| 1552 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1552 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1553 | 1553 | $default_template = $sibl[0]['template']; |
| 1554 | 1554 | } else { |
| 1555 | 1555 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
| 1556 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1556 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1557 | 1557 | $default_template = $sibl[0]['template']; |
| 1558 | 1558 | } |
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | - if(isset($default_template)) { |
|
| 1561 | + if (isset($default_template)) { |
|
| 1562 | 1562 | break; |
| 1563 | 1563 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
| 1564 | 1564 | case 'parent': |
| 1565 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1565 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1566 | 1566 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
| 1567 | - if(isset($parent['template'])) { |
|
| 1567 | + if (isset($parent['template'])) { |
|
| 1568 | 1568 | $default_template = $parent['template']; |
| 1569 | 1569 | } |
| 1570 | 1570 | } |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | default: // default_template is already set |
| 1574 | 1574 | $default_template = $modx->config['default_template']; |
| 1575 | 1575 | } |
| 1576 | - if(!isset($default_template)) { |
|
| 1576 | + if (!isset($default_template)) { |
|
| 1577 | 1577 | $default_template = $modx->config['default_template']; |
| 1578 | 1578 | } // default_template is already set |
| 1579 | 1579 | |
@@ -478,7 +478,8 @@ discard block |
||
| 478 | 478 | return s; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 482 | +// Web Link specific ?> |
|
| 482 | 483 | var lastImageCtrl; |
| 483 | 484 | var lastFileCtrl; |
| 484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
| 694 | 695 | </td> |
| 695 | 696 | </tr> |
| 696 | 697 | |
| 697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 699 | +// Web Link specific ?> |
|
| 698 | 700 | |
| 699 | 701 | <tr> |
| 700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1356,7 +1358,9 @@ discard block |
||
| 1356 | 1358 | if($documentId > 0) { |
| 1357 | 1359 | // Load up, the permissions from the parent (if new document) or existing document |
| 1358 | 1360 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1359 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1361 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
| 1362 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1363 | + } |
|
| 1360 | 1364 | |
| 1361 | 1365 | // Load up the current permissions and names |
| 1362 | 1366 | $vs = array( |
@@ -1418,7 +1422,9 @@ discard block |
||
| 1418 | 1422 | |
| 1419 | 1423 | // Create attribute string list |
| 1420 | 1424 | $inputString = array(); |
| 1421 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1425 | + foreach($inputAttributes as $k => $v) { |
|
| 1426 | + $inputString[] = $k . '="' . $v . '"'; |
|
| 1427 | + } |
|
| 1422 | 1428 | |
| 1423 | 1429 | // Make the <input> HTML |
| 1424 | 1430 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
| 1535 | 1541 | } |
| 1536 | 1542 | } |
| 1537 | 1543 | |
| 1538 | -function getDefaultTemplate() { |
|
| 1544 | +function getDefaultTemplate() |
|
| 1545 | +{ |
|
| 1539 | 1546 | global $modx; |
| 1540 | 1547 | |
| 1541 | 1548 | switch($modx->config['auto_template_logic']) { |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if(isset($_REQUEST['id'])) { |
| 7 | - $id = (int) $_REQUEST['id']; |
|
| 7 | + $id = (int) $_REQUEST['id']; |
|
| 8 | 8 | } else { |
| 9 | - $id = 0; |
|
| 9 | + $id = 0; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | if(isset($_GET['opened'])) { |
| 13 | - $_SESSION['openedArray'] = $_GET['opened']; |
|
| 13 | + $_SESSION['openedArray'] = $_GET['opened']; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | $url = $modx->config['site_url']; |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // Get access permissions |
| 25 | 25 | if($_SESSION['mgrDocgroups']) { |
| 26 | - $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
|
| 26 | + $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
|
| 27 | 27 | } |
| 28 | 28 | $access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
| 29 | 29 | |
| 30 | 30 | // |
| 31 | 31 | if($_SESSION['tree_show_only_folders']) { |
| 32 | - $parent = $id ? ($modx->db->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; |
|
| 33 | - $isfolder = $modx->db->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); |
|
| 34 | - if(!$isfolder && $parent != 0) { |
|
| 35 | - $id = $_REQUEST['id'] = $parent; |
|
| 36 | - } |
|
| 32 | + $parent = $id ? ($modx->db->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; |
|
| 33 | + $isfolder = $modx->db->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); |
|
| 34 | + if(!$isfolder && $parent != 0) { |
|
| 35 | + $id = $_REQUEST['id'] = $parent; |
|
| 36 | + } |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get the document content |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})"); |
| 42 | 42 | $content = $modx->db->getRow($rs); |
| 43 | 43 | if(!$content) { |
| 44 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 44 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -85,134 +85,134 @@ discard block |
||
| 85 | 85 | $filter_sort = ''; |
| 86 | 86 | $filter_dir = ''; |
| 87 | 87 | if($numRecords > 0) { |
| 88 | - $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //******** resource_opt_is_published - // |
|
| 89 | - '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********// |
|
| 90 | - '</select>'; |
|
| 91 | - $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>'; |
|
| 92 | - $resource = $modx->db->makeArray($rs); |
|
| 93 | - |
|
| 94 | - // CSS style for table |
|
| 95 | - // $tableClass = 'grid'; |
|
| 96 | - // $rowHeaderClass = 'gridHeader'; |
|
| 97 | - // $rowRegularClass = 'gridItem'; |
|
| 98 | - // $rowAlternateClass = 'gridAltItem'; |
|
| 99 | - $tableClass = 'table data nowrap'; |
|
| 100 | - $columnHeaderClass = array( |
|
| 101 | - 'text-center', |
|
| 102 | - 'text-left', |
|
| 103 | - 'text-center', |
|
| 104 | - 'text-center', |
|
| 105 | - 'text-center', |
|
| 106 | - 'text-center' |
|
| 107 | - ); |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - $modx->table->setTableClass($tableClass); |
|
| 111 | - $modx->table->setColumnHeaderClass($columnHeaderClass); |
|
| 112 | - // $modx->table->setRowHeaderClass($rowHeaderClass); |
|
| 113 | - // $modx->table->setRowRegularClass($rowRegularClass); |
|
| 114 | - // $modx->table->setRowAlternateClass($rowAlternateClass); |
|
| 115 | - |
|
| 116 | - // Table header |
|
| 117 | - $listTableHeader = array( |
|
| 118 | - 'docid' => $_lang['id'], |
|
| 119 | - 'title' => $_lang['resource_title'], |
|
| 120 | - 'createdon' => $_lang['createdon'], |
|
| 121 | - 'pub_date' => $_lang['page_data_publishdate'], |
|
| 122 | - 'status' => $_lang['page_data_status'], |
|
| 123 | - 'edit' => $_lang['mgrlog_action'], |
|
| 124 | - ); |
|
| 125 | - $tbWidth = array( |
|
| 126 | - '1%', |
|
| 127 | - '', |
|
| 128 | - '1%', |
|
| 129 | - '1%', |
|
| 130 | - '1%', |
|
| 131 | - '1%' |
|
| 132 | - ); |
|
| 133 | - $modx->table->setColumnWidths($tbWidth); |
|
| 134 | - |
|
| 135 | - $sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 136 | - $sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 137 | - $pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 138 | - $add_path = $sd . $sb . $pg; |
|
| 139 | - |
|
| 140 | - $icons = array( |
|
| 141 | - 'text/html' => $_style['tree_page_html'], |
|
| 142 | - 'text/plain' => $_style['tree_page'], |
|
| 143 | - 'text/xml' => $_style['tree_page_xml'], |
|
| 144 | - 'text/css' => $_style['tree_page_css'], |
|
| 145 | - 'text/javascript' => $_style['tree_page_js'], |
|
| 146 | - 'application/rss+xml' => $_style['tree_page_rss'], |
|
| 147 | - 'application/pdf' => $_style['tree_page_pdf'], |
|
| 148 | - 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
| 149 | - 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
| 150 | - 'image/gif' => $_style['tree_page_gif'], |
|
| 151 | - 'image/jpg' => $_style['tree_page_jpg'], |
|
| 152 | - 'image/png' => $_style['tree_page_png'] |
|
| 153 | - ); |
|
| 154 | - |
|
| 155 | - $listDocs = array(); |
|
| 156 | - foreach($resource as $k => $children) { |
|
| 157 | - |
|
| 158 | - switch($children['id']) { |
|
| 159 | - case $modx->config['site_start'] : |
|
| 160 | - $icon = $_style['tree_page_home']; |
|
| 161 | - break; |
|
| 162 | - case $modx->config['error_page'] : |
|
| 163 | - $icon = $_style['tree_page_404']; |
|
| 164 | - break; |
|
| 165 | - case $modx->config['site_unavailable_page'] : |
|
| 166 | - $icon = $_style['tree_page_hourglass']; |
|
| 167 | - break; |
|
| 168 | - case $modx->config['unauthorized_page'] : |
|
| 169 | - $icon = $_style['tree_page_info']; |
|
| 170 | - break; |
|
| 171 | - default: |
|
| 172 | - if($children['isfolder']) { |
|
| 173 | - $icon = $_style['tree_folder_new']; |
|
| 174 | - } else { |
|
| 175 | - if(isset($icons[$children['contentType']])) { |
|
| 176 | - $icon = $icons[$children['contentType']]; |
|
| 177 | - } else { |
|
| 178 | - $icon = $_style['tree_page']; |
|
| 179 | - } |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : ''); |
|
| 184 | - |
|
| 185 | - // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь |
|
| 186 | - // для сохранения сортировки |
|
| 187 | - $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); |
|
| 188 | - //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); |
|
| 189 | - //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); |
|
| 190 | - if($modx->hasPermission('edit_document')) { |
|
| 191 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>'; |
|
| 192 | - } else { |
|
| 193 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>'; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>'; |
|
| 197 | - |
|
| 198 | - $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>'; |
|
| 199 | - |
|
| 200 | - $listDocs[] = array( |
|
| 201 | - 'docid' => '<div class="text-right">' . $children['id'] . '</div>', |
|
| 202 | - 'title' => $title, |
|
| 203 | - 'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>', |
|
| 204 | - 'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>', |
|
| 205 | - 'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>', |
|
| 206 | - 'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i |
|
| 88 | + $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //******** resource_opt_is_published - // |
|
| 89 | + '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********// |
|
| 90 | + '</select>'; |
|
| 91 | + $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>'; |
|
| 92 | + $resource = $modx->db->makeArray($rs); |
|
| 93 | + |
|
| 94 | + // CSS style for table |
|
| 95 | + // $tableClass = 'grid'; |
|
| 96 | + // $rowHeaderClass = 'gridHeader'; |
|
| 97 | + // $rowRegularClass = 'gridItem'; |
|
| 98 | + // $rowAlternateClass = 'gridAltItem'; |
|
| 99 | + $tableClass = 'table data nowrap'; |
|
| 100 | + $columnHeaderClass = array( |
|
| 101 | + 'text-center', |
|
| 102 | + 'text-left', |
|
| 103 | + 'text-center', |
|
| 104 | + 'text-center', |
|
| 105 | + 'text-center', |
|
| 106 | + 'text-center' |
|
| 107 | + ); |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + $modx->table->setTableClass($tableClass); |
|
| 111 | + $modx->table->setColumnHeaderClass($columnHeaderClass); |
|
| 112 | + // $modx->table->setRowHeaderClass($rowHeaderClass); |
|
| 113 | + // $modx->table->setRowRegularClass($rowRegularClass); |
|
| 114 | + // $modx->table->setRowAlternateClass($rowAlternateClass); |
|
| 115 | + |
|
| 116 | + // Table header |
|
| 117 | + $listTableHeader = array( |
|
| 118 | + 'docid' => $_lang['id'], |
|
| 119 | + 'title' => $_lang['resource_title'], |
|
| 120 | + 'createdon' => $_lang['createdon'], |
|
| 121 | + 'pub_date' => $_lang['page_data_publishdate'], |
|
| 122 | + 'status' => $_lang['page_data_status'], |
|
| 123 | + 'edit' => $_lang['mgrlog_action'], |
|
| 124 | + ); |
|
| 125 | + $tbWidth = array( |
|
| 126 | + '1%', |
|
| 127 | + '', |
|
| 128 | + '1%', |
|
| 129 | + '1%', |
|
| 130 | + '1%', |
|
| 131 | + '1%' |
|
| 132 | + ); |
|
| 133 | + $modx->table->setColumnWidths($tbWidth); |
|
| 134 | + |
|
| 135 | + $sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 136 | + $sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 137 | + $pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 138 | + $add_path = $sd . $sb . $pg; |
|
| 139 | + |
|
| 140 | + $icons = array( |
|
| 141 | + 'text/html' => $_style['tree_page_html'], |
|
| 142 | + 'text/plain' => $_style['tree_page'], |
|
| 143 | + 'text/xml' => $_style['tree_page_xml'], |
|
| 144 | + 'text/css' => $_style['tree_page_css'], |
|
| 145 | + 'text/javascript' => $_style['tree_page_js'], |
|
| 146 | + 'application/rss+xml' => $_style['tree_page_rss'], |
|
| 147 | + 'application/pdf' => $_style['tree_page_pdf'], |
|
| 148 | + 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
| 149 | + 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
| 150 | + 'image/gif' => $_style['tree_page_gif'], |
|
| 151 | + 'image/jpg' => $_style['tree_page_jpg'], |
|
| 152 | + 'image/png' => $_style['tree_page_png'] |
|
| 153 | + ); |
|
| 154 | + |
|
| 155 | + $listDocs = array(); |
|
| 156 | + foreach($resource as $k => $children) { |
|
| 157 | + |
|
| 158 | + switch($children['id']) { |
|
| 159 | + case $modx->config['site_start'] : |
|
| 160 | + $icon = $_style['tree_page_home']; |
|
| 161 | + break; |
|
| 162 | + case $modx->config['error_page'] : |
|
| 163 | + $icon = $_style['tree_page_404']; |
|
| 164 | + break; |
|
| 165 | + case $modx->config['site_unavailable_page'] : |
|
| 166 | + $icon = $_style['tree_page_hourglass']; |
|
| 167 | + break; |
|
| 168 | + case $modx->config['unauthorized_page'] : |
|
| 169 | + $icon = $_style['tree_page_info']; |
|
| 170 | + break; |
|
| 171 | + default: |
|
| 172 | + if($children['isfolder']) { |
|
| 173 | + $icon = $_style['tree_folder_new']; |
|
| 174 | + } else { |
|
| 175 | + if(isset($icons[$children['contentType']])) { |
|
| 176 | + $icon = $icons[$children['contentType']]; |
|
| 177 | + } else { |
|
| 178 | + $icon = $_style['tree_page']; |
|
| 179 | + } |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : ''); |
|
| 184 | + |
|
| 185 | + // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь |
|
| 186 | + // для сохранения сортировки |
|
| 187 | + $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); |
|
| 188 | + //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); |
|
| 189 | + //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); |
|
| 190 | + if($modx->hasPermission('edit_document')) { |
|
| 191 | + $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>'; |
|
| 192 | + } else { |
|
| 193 | + $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>'; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>'; |
|
| 197 | + |
|
| 198 | + $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>'; |
|
| 199 | + |
|
| 200 | + $listDocs[] = array( |
|
| 201 | + 'docid' => '<div class="text-right">' . $children['id'] . '</div>', |
|
| 202 | + 'title' => $title, |
|
| 203 | + 'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>', |
|
| 204 | + 'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>', |
|
| 205 | + 'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>', |
|
| 206 | + 'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i |
|
| 207 | 207 | class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>' |
| 208 | - ); |
|
| 209 | - } |
|
| 208 | + ); |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - $modx->table->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort); |
|
| 212 | - $children_output = $modx->table->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); |
|
| 211 | + $modx->table->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort); |
|
| 212 | + $children_output = $modx->table->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); |
|
| 213 | 213 | } else { |
| 214 | - // No Child documents |
|
| 215 | - $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>'; |
|
| 214 | + // No Child documents |
|
| 215 | + $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>'; |
|
| 216 | 216 | } |
| 217 | 217 | ?> |
| 218 | 218 | <script type="text/javascript"> |
@@ -413,20 +413,20 @@ discard block |
||
| 413 | 413 | <h2 class="tab"><?= $_lang['page_data_source'] ?></h2> |
| 414 | 414 | <script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script> |
| 415 | 415 | <?php |
| 416 | - $buffer = ""; |
|
| 417 | - $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; |
|
| 418 | - $handle = @fopen($filename, "r"); |
|
| 419 | - if(!$handle) { |
|
| 420 | - $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>'; |
|
| 421 | - } else { |
|
| 422 | - while(!feof($handle)) { |
|
| 423 | - $buffer .= fgets($handle, 4096); |
|
| 424 | - } |
|
| 425 | - fclose($handle); |
|
| 426 | - $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->htmlspecialchars($buffer) . "</textarea></div>\n"; |
|
| 427 | - } |
|
| 428 | - echo $buffer; |
|
| 429 | - ?> |
|
| 416 | + $buffer = ""; |
|
| 417 | + $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; |
|
| 418 | + $handle = @fopen($filename, "r"); |
|
| 419 | + if(!$handle) { |
|
| 420 | + $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>'; |
|
| 421 | + } else { |
|
| 422 | + while(!feof($handle)) { |
|
| 423 | + $buffer .= fgets($handle, 4096); |
|
| 424 | + } |
|
| 425 | + fclose($handle); |
|
| 426 | + $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->htmlspecialchars($buffer) . "</textarea></div>\n"; |
|
| 427 | + } |
|
| 428 | + echo $buffer; |
|
| 429 | + ?> |
|
| 430 | 430 | </div><!-- end tab-page --> |
| 431 | 431 | <?php } ?> |
| 432 | 432 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | <?php |
| 436 | 436 | if(isset($_GET['tab']) && is_numeric($_GET['tab'])) { |
| 437 | - echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
| 437 | + echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
| 438 | 438 | } |
| 439 | 439 | ?> |
| 440 | 440 | |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") { |
|
| 2 | +if (IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if(isset($_REQUEST['id'])) { |
|
| 6 | +if (isset($_REQUEST['id'])) { |
|
| 7 | 7 | $id = (int) $_REQUEST['id']; |
| 8 | 8 | } else { |
| 9 | 9 | $id = 0; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -if(isset($_GET['opened'])) { |
|
| 12 | +if (isset($_GET['opened'])) { |
|
| 13 | 13 | $_SESSION['openedArray'] = $_GET['opened']; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -22,16 +22,16 @@ discard block |
||
| 22 | 22 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
| 23 | 23 | |
| 24 | 24 | // Get access permissions |
| 25 | -if($_SESSION['mgrDocgroups']) { |
|
| 25 | +if ($_SESSION['mgrDocgroups']) { |
|
| 26 | 26 | $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
| 27 | 27 | } |
| 28 | -$access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 28 | +$access = "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0".(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 29 | 29 | |
| 30 | 30 | // |
| 31 | -if($_SESSION['tree_show_only_folders']) { |
|
| 32 | - $parent = $id ? ($modx->db->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; |
|
| 33 | - $isfolder = $modx->db->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); |
|
| 34 | - if(!$isfolder && $parent != 0) { |
|
| 31 | +if ($_SESSION['tree_show_only_folders']) { |
|
| 32 | + $parent = $id ? ($modx->db->getValue("SELECT parent FROM ".$tbl_site_content." WHERE id=$id LIMIT 1")) : 0; |
|
| 33 | + $isfolder = $modx->db->getValue("SELECT isfolder FROM ".$tbl_site_content." WHERE id=$id LIMIT 1"); |
|
| 34 | + if (!$isfolder && $parent != 0) { |
|
| 35 | 35 | $id = $_REQUEST['id'] = $parent; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $rs = $modx->db->select('DISTINCT sc.*', "{$tbl_site_content} AS sc |
| 41 | 41 | LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})"); |
| 42 | 42 | $content = $modx->db->getRow($rs); |
| 43 | -if(!$content) { |
|
| 43 | +if (!$content) { |
|
| 44 | 44 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | ); |
| 85 | 85 | $filter_sort = ''; |
| 86 | 86 | $filter_dir = ''; |
| 87 | -if($numRecords > 0) { |
|
| 88 | - $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //******** resource_opt_is_published - // |
|
| 89 | - '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********// |
|
| 87 | +if ($numRecords > 0) { |
|
| 88 | + $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id='.$id.'&dir='.$dir.'&sort=\'+this.options[this.selectedIndex].value">'.'<option value="createdon"'.(($sort == 'createdon') ? ' selected' : '').'>'.$_lang['createdon'].'</option>'.'<option value="pub_date"'.(($sort == 'pub_date') ? ' selected' : '').'>'.$_lang["page_data_publishdate"].'</option>'.'<option value="pagetitle"'.(($sort == 'pagetitle') ? ' selected' : '').'>'.$_lang['pagetitle'].'</option>'.'<option value="menuindex"'.(($sort == 'menuindex') ? ' selected' : '').'>'.$_lang['resource_opt_menu_index'].'</option>'.//******** resource_opt_is_published - // |
|
| 89 | + '<option value="published"'.(($sort == 'published') ? ' selected' : '').'>'.$_lang['resource_opt_is_published'].'</option>'.//********// |
|
| 90 | 90 | '</select>'; |
| 91 | - $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>'; |
|
| 91 | + $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id='.$id.'&sort='.$sort.'&dir=\'+this.options[this.selectedIndex].value">'.'<option value="DESC"'.(($dir == 'DESC') ? ' selected' : '').'>'.$_lang['sort_desc'].'</option>'.'<option value="ASC"'.(($dir == 'ASC') ? ' selected' : '').'>'.$_lang['sort_asc'].'</option>'.'</select>'; |
|
| 92 | 92 | $resource = $modx->db->makeArray($rs); |
| 93 | 93 | |
| 94 | 94 | // CSS style for table |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | ); |
| 133 | 133 | $modx->table->setColumnWidths($tbWidth); |
| 134 | 134 | |
| 135 | - $sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 136 | - $sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 137 | - $pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 138 | - $add_path = $sd . $sb . $pg; |
|
| 135 | + $sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 136 | + $sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 137 | + $pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 138 | + $add_path = $sd.$sb.$pg; |
|
| 139 | 139 | |
| 140 | 140 | $icons = array( |
| 141 | 141 | 'text/html' => $_style['tree_page_html'], |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | $listDocs = array(); |
| 156 | - foreach($resource as $k => $children) { |
|
| 156 | + foreach ($resource as $k => $children) { |
|
| 157 | 157 | |
| 158 | - switch($children['id']) { |
|
| 158 | + switch ($children['id']) { |
|
| 159 | 159 | case $modx->config['site_start'] : |
| 160 | 160 | $icon = $_style['tree_page_home']; |
| 161 | 161 | break; |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | $icon = $_style['tree_page_info']; |
| 170 | 170 | break; |
| 171 | 171 | default: |
| 172 | - if($children['isfolder']) { |
|
| 172 | + if ($children['isfolder']) { |
|
| 173 | 173 | $icon = $_style['tree_folder_new']; |
| 174 | 174 | } else { |
| 175 | - if(isset($icons[$children['contentType']])) { |
|
| 175 | + if (isset($icons[$children['contentType']])) { |
|
| 176 | 176 | $icon = $icons[$children['contentType']]; |
| 177 | 177 | } else { |
| 178 | 178 | $icon = $_style['tree_page']; |
@@ -187,32 +187,32 @@ discard block |
||
| 187 | 187 | $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); |
| 188 | 188 | //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); |
| 189 | 189 | //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); |
| 190 | - if($modx->hasPermission('edit_document')) { |
|
| 191 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>'; |
|
| 190 | + if ($modx->hasPermission('edit_document')) { |
|
| 191 | + $title = '<span class="doc-item'.$private.'">'.$icon.'<a href="index.php?a=27&id='.$children['id'].$add_path.'">'.'<span class="'.$class.'">'.$children['pagetitle'].'</span></a></span>'; |
|
| 192 | 192 | } else { |
| 193 | - $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>'; |
|
| 193 | + $title = '<span class="doc-item'.$private.'">'.$icon.'<span class="'.$class.'">'.$children['pagetitle'].'</span></span>'; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>'; |
|
| 196 | + $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&id='.$children['id'].$add_path.'" title="'.$_lang["publish_resource"].'"><i class="'.$_style["icons_publish_document"].'"></i></a>' : '<a href="index.php?a=62&id='.$children['id'].$add_path.'" title="'.$_lang["unpublish_resource"].'"><i class="'.$_style["icons_unpublish_resource"].'" ></i></a>'; |
|
| 197 | 197 | |
| 198 | - $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>'; |
|
| 198 | + $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\''.$_lang["confirm_delete_resource"].'\')" href="index.php?a=6&id='.$children['id'].$add_path.'" title="'.$_lang['delete_resource'].'"><i class="'.$_style["icons_delete_resource"].'"></i></a>' : '<a onclick="return confirm(\''.$_lang["confirm_undelete"].'\')" href="index.php?a=63&id='.$children['id'].$add_path.'" title="'.$_lang['undelete_resource'].'"><i class="'.$_style["icons_undelete_resource"].'"></i></a>'; |
|
| 199 | 199 | |
| 200 | 200 | $listDocs[] = array( |
| 201 | - 'docid' => '<div class="text-right">' . $children['id'] . '</div>', |
|
| 201 | + 'docid' => '<div class="text-right">'.$children['id'].'</div>', |
|
| 202 | 202 | 'title' => $title, |
| 203 | - 'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>', |
|
| 204 | - 'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>', |
|
| 205 | - 'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>', |
|
| 206 | - 'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i |
|
| 207 | - class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>' |
|
| 203 | + 'createdon' => '<div class="text-right">'.($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')).'</div>', |
|
| 204 | + 'pub_date' => '<div class="text-right">'.($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '').'</div>', |
|
| 205 | + 'status' => '<div class="text-nowrap">'.($children['published'] == 0 ? '<span class="unpublishedDoc">'.$_lang['page_data_unpublished'].'</span>' : '<span class="publishedDoc">'.$_lang['page_data_published'].'</span>').'</div>', |
|
| 206 | + 'edit' => '<div class="actions text-center text-nowrap">'.($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id='.$children['id'].$add_path.'" title="'.$_lang['edit'].'"><i class="'.$_style["icons_edit_resource"].'"></i></a><a href="index.php?a=51&id='.$children['id'].$add_path.'" title="'.$_lang['move'].'"><i |
|
| 207 | + class="' . $_style["icons_move_document"].'"></i></a>'.$icon_pub_unpub : '').($modx->hasPermission('delete_document') ? $icon_del_undel : '').'</div>' |
|
| 208 | 208 | ); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - $modx->table->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort); |
|
| 212 | - $children_output = $modx->table->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); |
|
| 211 | + $modx->table->createPagingNavigation($numRecords, 'a=3&id='.$content['id'].'&dir='.$dir.'&sort='.$sort); |
|
| 212 | + $children_output = $modx->table->create($listDocs, $listTableHeader, 'index.php?a=3&id='.$content['id']); |
|
| 213 | 213 | } else { |
| 214 | 214 | // No Child documents |
| 215 | - $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>'; |
|
| 215 | + $children_output = '<div class="container"><p>'.$_lang['resources_in_container_no'].'</p></div>'; |
|
| 216 | 216 | } |
| 217 | 217 | ?> |
| 218 | 218 | <script type="text/javascript"> |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | }, |
| 239 | 239 | cancel: function() { |
| 240 | 240 | documentDirty = false; |
| 241 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
| 241 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
| 242 | 242 | }, |
| 243 | 243 | move: function() { |
| 244 | 244 | document.location.href = "index.php?id=<?= $_REQUEST['id'] ?>&a=51"; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | }, |
| 251 | 251 | view: function() { |
| 252 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
| 252 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
| 253 | 253 | } |
| 254 | 254 | }; |
| 255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
| 258 | 258 | |
| 259 | 259 | <h1> |
| 260 | - <i class="fa fa-info"></i><?= iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . ' <small>(' . $_REQUEST['id'] . ')</small>' ?> |
|
| 260 | + <i class="fa fa-info"></i><?= iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').' <small>('.$_REQUEST['id'].')</small>' ?> |
|
| 261 | 261 | </h1> |
| 262 | 262 | |
| 263 | 263 | <?= $_style['actionbuttons']['static']['document'] ?> |
@@ -284,16 +284,16 @@ discard block |
||
| 284 | 284 | <tr> |
| 285 | 285 | <td width="200" valign="top"><?= $_lang['long_title'] ?>:</td> |
| 286 | 286 | <td> |
| 287 | - <small><?= $content['longtitle'] != '' ? $content['longtitle'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></small> |
|
| 287 | + <small><?= $content['longtitle'] != '' ? $content['longtitle'] : "(<i>".$_lang['not_set']."</i>)" ?></small> |
|
| 288 | 288 | </td> |
| 289 | 289 | </tr> |
| 290 | 290 | <tr> |
| 291 | 291 | <td valign="top"><?= $_lang['resource_description'] ?>:</td> |
| 292 | - <td><?= $content['description'] != '' ? $content['description'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td> |
|
| 292 | + <td><?= $content['description'] != '' ? $content['description'] : "(<i>".$_lang['not_set']."</i>)" ?></td> |
|
| 293 | 293 | </tr> |
| 294 | 294 | <tr> |
| 295 | 295 | <td valign="top"><?= $_lang['resource_summary'] ?>:</td> |
| 296 | - <td><?= $content['introtext'] != '' ? $content['introtext'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td> |
|
| 296 | + <td><?= $content['introtext'] != '' ? $content['introtext'] : "(<i>".$_lang['not_set']."</i>)" ?></td> |
|
| 297 | 297 | </tr> |
| 298 | 298 | <tr> |
| 299 | 299 | <td valign="top"><?= $_lang['type'] ?>:</td> |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | </tr> |
| 302 | 302 | <tr> |
| 303 | 303 | <td valign="top"><?= $_lang['resource_alias'] ?>:</td> |
| 304 | - <td><?= $content['alias'] != '' ? $content['alias'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td> |
|
| 304 | + <td><?= $content['alias'] != '' ? $content['alias'] : "(<i>".$_lang['not_set']."</i>)" ?></td> |
|
| 305 | 305 | </tr> |
| 306 | 306 | <tr> |
| 307 | 307 | <td colspan="2"> </td> |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | <td><?= $modx->toDateFormat($content['createdon'] + $server_offset_time) ?> (<b><?= $createdbyname ?></b>) |
| 315 | 315 | </td> |
| 316 | 316 | </tr> |
| 317 | - <?php if($editedbyname != '') { ?> |
|
| 317 | + <?php if ($editedbyname != '') { ?> |
|
| 318 | 318 | <tr> |
| 319 | 319 | <td><?= $_lang['page_data_edited'] ?>:</td> |
| 320 | 320 | <td><?= $modx->toDateFormat($content['editedon'] + $server_offset_time) ?> (<b><?= $editedbyname ?></b>) |
@@ -329,15 +329,15 @@ discard block |
||
| 329 | 329 | </tr> |
| 330 | 330 | <tr> |
| 331 | 331 | <td><?= $_lang['page_data_status'] ?>:</td> |
| 332 | - <td><?= $content['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publisheddoc">' . $_lang['page_data_published'] . '</span>' ?></td> |
|
| 332 | + <td><?= $content['published'] == 0 ? '<span class="unpublishedDoc">'.$_lang['page_data_unpublished'].'</span>' : '<span class="publisheddoc">'.$_lang['page_data_published'].'</span>' ?></td> |
|
| 333 | 333 | </tr> |
| 334 | 334 | <tr> |
| 335 | 335 | <td><?= $_lang['page_data_publishdate'] ?>:</td> |
| 336 | - <td><?= $content['pub_date'] == 0 ? "(<i>" . $_lang['not_set'] . "</i>)" : $modx->toDateFormat($content['pub_date']) ?></td> |
|
| 336 | + <td><?= $content['pub_date'] == 0 ? "(<i>".$_lang['not_set']."</i>)" : $modx->toDateFormat($content['pub_date']) ?></td> |
|
| 337 | 337 | </tr> |
| 338 | 338 | <tr> |
| 339 | 339 | <td><?= $_lang['page_data_unpublishdate'] ?>:</td> |
| 340 | - <td><?= $content['unpub_date'] == 0 ? "(<i>" . $_lang['not_set'] . "</i>)" : $modx->toDateFormat($content['unpub_date']) ?></td> |
|
| 340 | + <td><?= $content['unpub_date'] == 0 ? "(<i>".$_lang['not_set']."</i>)" : $modx->toDateFormat($content['unpub_date']) ?></td> |
|
| 341 | 341 | </tr> |
| 342 | 342 | <tr> |
| 343 | 343 | <td><?= $_lang['page_data_cacheable'] ?>:</td> |
@@ -357,11 +357,11 @@ discard block |
||
| 357 | 357 | </tr> |
| 358 | 358 | <tr> |
| 359 | 359 | <td><?= $_lang['page_data_web_access'] ?>:</td> |
| 360 | - <td><?= $content['privateweb'] == 0 ? $_lang['public'] : '<b style="color: #821517">' . $_lang['private'] . '</b> ' . $_style["icons_secured"] ?></td> |
|
| 360 | + <td><?= $content['privateweb'] == 0 ? $_lang['public'] : '<b style="color: #821517">'.$_lang['private'].'</b> '.$_style["icons_secured"] ?></td> |
|
| 361 | 361 | </tr> |
| 362 | 362 | <tr> |
| 363 | 363 | <td><?= $_lang['page_data_mgr_access'] ?>:</td> |
| 364 | - <td><?= $content['privatemgr'] == 0 ? $_lang['public'] : '<b style="color: #821517">' . $_lang['private'] . '</b> ' . $_style["icons_secured"] ?></td> |
|
| 364 | + <td><?= $content['privatemgr'] == 0 ? $_lang['public'] : '<b style="color: #821517">'.$_lang['private'].'</b> '.$_style["icons_secured"] ?></td> |
|
| 365 | 365 | </tr> |
| 366 | 366 | <tr> |
| 367 | 367 | <td colspan="2"> </td> |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | <script type="text/javascript">docSettings.addTabPage(document.getElementById("tabChildren"));</script> |
| 392 | 392 | <div class="container container-body"> |
| 393 | 393 | <div class="form-group clearfix"> |
| 394 | - <?php if($numRecords > 0) : ?> |
|
| 394 | + <?php if ($numRecords > 0) : ?> |
|
| 395 | 395 | <div class="float-xs-left"> |
| 396 | - <span class="publishedDoc"><?= $numRecords . ' ' . $_lang['resources_in_container'] ?> (<strong><?= $content['pagetitle'] ?></strong>)</span> |
|
| 396 | + <span class="publishedDoc"><?= $numRecords.' '.$_lang['resources_in_container'] ?> (<strong><?= $content['pagetitle'] ?></strong>)</span> |
|
| 397 | 397 | </div> |
| 398 | 398 | <?php endif; ?> |
| 399 | 399 | <div class="float-xs-right"> |
| 400 | - <?= $filter_sort . ' ' . $filter_dir ?> |
|
| 400 | + <?= $filter_sort.' '.$filter_dir ?> |
|
| 401 | 401 | </div> |
| 402 | 402 | |
| 403 | 403 | </div> |
@@ -407,23 +407,23 @@ discard block |
||
| 407 | 407 | </div> |
| 408 | 408 | </div><!-- end tab-page --> |
| 409 | 409 | |
| 410 | - <?php if($modx->config['cache_type'] != 2) { ?> |
|
| 410 | + <?php if ($modx->config['cache_type'] != 2) { ?> |
|
| 411 | 411 | <!-- Page Source --> |
| 412 | 412 | <div class="tab-page" id="tabSource"> |
| 413 | 413 | <h2 class="tab"><?= $_lang['page_data_source'] ?></h2> |
| 414 | 414 | <script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script> |
| 415 | 415 | <?php |
| 416 | 416 | $buffer = ""; |
| 417 | - $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; |
|
| 417 | + $filename = $modx->config['base_path']."assets/cache/docid_".$id.".pageCache.php"; |
|
| 418 | 418 | $handle = @fopen($filename, "r"); |
| 419 | - if(!$handle) { |
|
| 420 | - $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>'; |
|
| 419 | + if (!$handle) { |
|
| 420 | + $buffer = '<div class="container container-body">'.$_lang['page_data_notcached'].'</div>'; |
|
| 421 | 421 | } else { |
| 422 | - while(!feof($handle)) { |
|
| 422 | + while (!feof($handle)) { |
|
| 423 | 423 | $buffer .= fgets($handle, 4096); |
| 424 | 424 | } |
| 425 | 425 | fclose($handle); |
| 426 | - $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->htmlspecialchars($buffer) . "</textarea></div>\n"; |
|
| 426 | + $buffer = '<div class="navbar navbar-editor">'.$_lang['page_data_cached'].'</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">'.$modx->htmlspecialchars($buffer)."</textarea></div>\n"; |
|
| 427 | 427 | } |
| 428 | 428 | echo $buffer; |
| 429 | 429 | ?> |
@@ -433,12 +433,12 @@ discard block |
||
| 433 | 433 | </div><!-- end documentPane --> |
| 434 | 434 | |
| 435 | 435 | <?php |
| 436 | -if(isset($_GET['tab']) && is_numeric($_GET['tab'])) { |
|
| 437 | - echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
| 436 | +if (isset($_GET['tab']) && is_numeric($_GET['tab'])) { |
|
| 437 | + echo '<script type="text/javascript"> docSettings.setSelectedIndex( '.$_GET['tab'].' );</script>'; |
|
| 438 | 438 | } |
| 439 | 439 | ?> |
| 440 | 440 | |
| 441 | -<?php if($show_preview == 1) { ?> |
|
| 441 | +<?php if ($show_preview == 1) { ?> |
|
| 442 | 442 | <div class="sectionHeader"><?= $_lang['preview'] ?></div> |
| 443 | 443 | <div class="sectionBody" id="lyr2"> |
| 444 | 444 | <iframe src="<?= MODX_SITE_URL ?>index.php?id=<?= $id ?>&z=manprev" frameborder="0" border="0" id="previewIframe"></iframe> |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 12: |
|
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 11: |
|
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 12: |
|
| 8 | + if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 11: |
|
| 13 | + if(!$modx->hasPermission('new_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -23,75 +23,75 @@ discard block |
||
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 25 | 25 | if($username = $modx->db->getValue($rs)) {
|
| 26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | 30 | if($modx->manager->action == '12') {
|
| 31 | - // get user attribute |
|
| 32 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
|
| 33 | - $userdata = $modx->db->getRow($rs); |
|
| 34 | - if(!$userdata) {
|
|
| 35 | - $modx->webAlertAndQuit("No user returned!");
|
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - |
|
| 39 | - // get user settings |
|
| 40 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
|
| 41 | - $usersettings = array(); |
|
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | - // manually extract so that user display settings are not overwritten |
|
| 44 | - foreach($usersettings as $k => $v) {
|
|
| 45 | - if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | - ${$k} = $v;
|
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - // get user name |
|
| 51 | - $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
|
| 52 | - $usernamedata = $modx->db->getRow($rs); |
|
| 53 | - if(!$usernamedata) {
|
|
| 54 | - $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 55 | - } |
|
| 56 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
| 31 | + // get user attribute |
|
| 32 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
|
| 33 | + $userdata = $modx->db->getRow($rs); |
|
| 34 | + if(!$userdata) {
|
|
| 35 | + $modx->webAlertAndQuit("No user returned!");
|
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + |
|
| 39 | + // get user settings |
|
| 40 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
|
| 41 | + $usersettings = array(); |
|
| 42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | + // manually extract so that user display settings are not overwritten |
|
| 44 | + foreach($usersettings as $k => $v) {
|
|
| 45 | + if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | + ${$k} = $v;
|
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + // get user name |
|
| 51 | + $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
|
| 52 | + $usernamedata = $modx->db->getRow($rs); |
|
| 53 | + if(!$usernamedata) {
|
|
| 54 | + $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 55 | + } |
|
| 56 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
| 57 | 57 | } else {
|
| 58 | - $userdata = array(); |
|
| 59 | - $usersettings = array(); |
|
| 60 | - $usernamedata = array(); |
|
| 61 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 58 | + $userdata = array(); |
|
| 59 | + $usersettings = array(); |
|
| 60 | + $usernamedata = array(); |
|
| 61 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 65 | 65 | foreach($userdata as $key => $val) {
|
| 66 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 66 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 67 | 67 | }; |
| 68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 69 | 69 | |
| 70 | 70 | // restore saved form |
| 71 | 71 | $formRestored = false; |
| 72 | 72 | if($modx->manager->hasFormValues()) {
|
| 73 | - $modx->manager->loadFormValues(); |
|
| 74 | - // restore post values |
|
| 75 | - $userdata = array_merge($userdata, $_POST); |
|
| 76 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 77 | - $usernamedata['username'] = $userdata['newusername']; |
|
| 78 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 79 | - $usersettings = array_merge($usersettings, $userdata); |
|
| 80 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 81 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 73 | + $modx->manager->loadFormValues(); |
|
| 74 | + // restore post values |
|
| 75 | + $userdata = array_merge($userdata, $_POST); |
|
| 76 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 77 | + $usernamedata['username'] = $userdata['newusername']; |
|
| 78 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 79 | + $usersettings = array_merge($usersettings, $userdata); |
|
| 80 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 81 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // include the country list language file |
| 85 | 85 | $_country_lang = array(); |
| 86 | 86 | include_once "lang/country/english_country.inc.php"; |
| 87 | 87 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
| 88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 88 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 89 | 89 | } |
| 90 | 90 | asort($_country_lang); |
| 91 | 91 | |
| 92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 93 | 93 | if($which_browser == 'default') {
|
| 94 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 94 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
| 95 | 95 | } |
| 96 | 96 | ?> |
| 97 | 97 | <script type="text/javascript"> |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | <form action="index.php?a=32" method="post" name="userform"> |
| 202 | 202 | <?php |
| 203 | 203 | |
| 204 | - // invoke OnUserFormPrerender event |
|
| 205 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
|
| 206 | - "id" => $user |
|
| 207 | - )); |
|
| 208 | - if(is_array($evtOut)) {
|
|
| 209 | - echo implode("", $evtOut);
|
|
| 210 | - } |
|
| 211 | - ?> |
|
| 204 | + // invoke OnUserFormPrerender event |
|
| 205 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
|
| 206 | + "id" => $user |
|
| 207 | + )); |
|
| 208 | + if(is_array($evtOut)) {
|
|
| 209 | + echo implode("", $evtOut);
|
|
| 210 | + } |
|
| 211 | + ?> |
|
| 212 | 212 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>"> |
| 213 | 213 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
| 214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -301,21 +301,21 @@ discard block |
||
| 301 | 301 | <td> </td> |
| 302 | 302 | <td><?php |
| 303 | 303 | |
| 304 | - $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
|
|
| 305 | - ?> |
|
| 304 | + $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
|
|
| 305 | + ?> |
|
| 306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 307 | 307 | <?php |
| 308 | - while($row = $modx->db->getRow($rs)) {
|
|
| 309 | - if($modx->manager->action == '11') {
|
|
| 310 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 311 | - } else {
|
|
| 312 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 313 | - } |
|
| 314 | - ?> |
|
| 308 | + while($row = $modx->db->getRow($rs)) {
|
|
| 309 | + if($modx->manager->action == '11') {
|
|
| 310 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
| 311 | + } else {
|
|
| 312 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
| 313 | + } |
|
| 314 | + ?> |
|
| 315 | 315 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
| 316 | 316 | <?php |
| 317 | - } |
|
| 318 | - ?> |
|
| 317 | + } |
|
| 318 | + ?> |
|
| 319 | 319 | </select></td> |
| 320 | 320 | </tr> |
| 321 | 321 | <tr> |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 362 | 362 | <?php |
| 363 | - foreach($_country_lang as $key => $country) {
|
|
| 364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 365 | - } |
|
| 366 | - ?> |
|
| 363 | + foreach($_country_lang as $key => $country) {
|
|
| 364 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 365 | + } |
|
| 366 | + ?> |
|
| 367 | 367 | </select></td> |
| 368 | 368 | </tr> |
| 369 | 369 | <tr> |
@@ -439,21 +439,21 @@ discard block |
||
| 439 | 439 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
| 440 | 440 | <option value=""></option> |
| 441 | 441 | <?php |
| 442 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 443 | - $dir = dir("includes/lang");
|
|
| 444 | - while($file = $dir->read()) {
|
|
| 445 | - if(strpos($file, ".inc.php") > 0) {
|
|
| 446 | - $endpos = strpos($file, "."); |
|
| 447 | - $languagename = substr($file, 0, $endpos); |
|
| 448 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 449 | - ?> |
|
| 442 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
| 443 | + $dir = dir("includes/lang");
|
|
| 444 | + while($file = $dir->read()) {
|
|
| 445 | + if(strpos($file, ".inc.php") > 0) {
|
|
| 446 | + $endpos = strpos($file, "."); |
|
| 447 | + $languagename = substr($file, 0, $endpos); |
|
| 448 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
| 449 | + ?> |
|
| 450 | 450 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
|
| 451 | 451 | <?php |
| 452 | 452 | |
| 453 | - } |
|
| 454 | - } |
|
| 455 | - $dir->close(); |
|
| 456 | - ?> |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + $dir->close(); |
|
| 456 | + ?> |
|
| 457 | 457 | </select></td> |
| 458 | 458 | </tr> |
| 459 | 459 | <tr> |
@@ -528,22 +528,22 @@ discard block |
||
| 528 | 528 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
| 529 | 529 | <option value=""></option> |
| 530 | 530 | <?php |
| 531 | - $dir = dir("media/style/");
|
|
| 532 | - while($file = $dir->read()) {
|
|
| 533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | - $themename = $file; |
|
| 535 | - if($themename === 'common') {
|
|
| 536 | - continue; |
|
| 537 | - } |
|
| 538 | - $attr = 'value="' . $themename . '" '; |
|
| 539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | - $attr .= 'selected="selected" '; |
|
| 541 | - } |
|
| 542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - $dir->close(); |
|
| 546 | - ?> |
|
| 531 | + $dir = dir("media/style/");
|
|
| 532 | + while($file = $dir->read()) {
|
|
| 533 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | + $themename = $file; |
|
| 535 | + if($themename === 'common') {
|
|
| 536 | + continue; |
|
| 537 | + } |
|
| 538 | + $attr = 'value="' . $themename . '" '; |
|
| 539 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | + $attr .= 'selected="selected" '; |
|
| 541 | + } |
|
| 542 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + $dir->close(); |
|
| 546 | + ?> |
|
| 547 | 547 | </select> |
| 548 | 548 | <input type="hidden" name="theme_refresher" value=""></td> |
| 549 | 549 | </tr> |
@@ -555,15 +555,15 @@ discard block |
||
| 555 | 555 | <th><?php echo $_lang["which_browser_title"] ?></th> |
| 556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
| 557 | 557 | <?php |
| 558 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | - $dir = str_replace('\\', '/', $dir);
|
|
| 562 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 563 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 565 | - } |
|
| 566 | - ?> |
|
| 558 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 559 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | + $dir = str_replace('\\', '/', $dir);
|
|
| 562 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
| 563 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
| 564 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 565 | + } |
|
| 566 | + ?> |
|
| 567 | 567 | </select></td> |
| 568 | 568 | </tr> |
| 569 | 569 | <tr> |
@@ -640,17 +640,17 @@ discard block |
||
| 640 | 640 | <option value=""></option> |
| 641 | 641 | <?php |
| 642 | 642 | |
| 643 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 644 | - // invoke OnRichTextEditorRegister event |
|
| 645 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
|
| 646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | - if(is_array($evtOut)) {
|
|
| 648 | - for($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | - $editor = $evtOut[$i]; |
|
| 650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 651 | - } |
|
| 652 | - } |
|
| 653 | - ?> |
|
| 643 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
| 644 | + // invoke OnRichTextEditorRegister event |
|
| 645 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
|
| 646 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | + if(is_array($evtOut)) {
|
|
| 648 | + for($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | + $editor = $evtOut[$i]; |
|
| 650 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 651 | + } |
|
| 652 | + } |
|
| 653 | + ?> |
|
| 654 | 654 | </select></td> |
| 655 | 655 | </tr> |
| 656 | 656 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -683,12 +683,12 @@ discard block |
||
| 683 | 683 | </tr> |
| 684 | 684 | </table> |
| 685 | 685 | <?php |
| 686 | - // invoke OnInterfaceSettingsRender event |
|
| 687 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
|
| 688 | - if(is_array($evtOut)) {
|
|
| 689 | - echo implode("", $evtOut);
|
|
| 690 | - } |
|
| 691 | - ?> |
|
| 686 | + // invoke OnInterfaceSettingsRender event |
|
| 687 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
|
| 688 | + if(is_array($evtOut)) {
|
|
| 689 | + echo implode("", $evtOut);
|
|
| 690 | + } |
|
| 691 | + ?> |
|
| 692 | 692 | </div> |
| 693 | 693 | |
| 694 | 694 | <!-- Photo --> |
@@ -737,39 +737,39 @@ discard block |
||
| 737 | 737 | </div> |
| 738 | 738 | <?php if($use_udperms == 1) {
|
| 739 | 739 | |
| 740 | - $groupsarray = array(); |
|
| 741 | - |
|
| 742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | - $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
|
| 744 | - $groupsarray = $modx->db->getColumn('user_group', $rs);
|
|
| 745 | - } |
|
| 746 | - // retain selected doc groups between post |
|
| 747 | - if(is_array($_POST['user_groups'])) {
|
|
| 748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | - } |
|
| 750 | - ?> |
|
| 740 | + $groupsarray = array(); |
|
| 741 | + |
|
| 742 | + if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | + $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
|
| 744 | + $groupsarray = $modx->db->getColumn('user_group', $rs);
|
|
| 745 | + } |
|
| 746 | + // retain selected doc groups between post |
|
| 747 | + if(is_array($_POST['user_groups'])) {
|
|
| 748 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | + } |
|
| 750 | + ?> |
|
| 751 | 751 | <div class="tab-page" id="tabAccess"> |
| 752 | 752 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
| 753 | 753 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
|
| 754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 755 | 755 | <?php |
| 756 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
|
| 757 | - while($row = $modx->db->getRow($rs)) {
|
|
| 758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 759 | - } |
|
| 760 | - } |
|
| 761 | - ?> |
|
| 756 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
|
| 757 | + while($row = $modx->db->getRow($rs)) {
|
|
| 758 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 759 | + } |
|
| 760 | + } |
|
| 761 | + ?> |
|
| 762 | 762 | </div> |
| 763 | 763 | </div> |
| 764 | 764 | </div> |
| 765 | 765 | <input type="submit" name="save" style="display:none"> |
| 766 | 766 | <?php |
| 767 | - // invoke OnUserFormRender event |
|
| 768 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
|
| 769 | - "id" => $user |
|
| 770 | - )); |
|
| 771 | - if(is_array($evtOut)) {
|
|
| 772 | - echo implode("", $evtOut);
|
|
| 773 | - } |
|
| 774 | - ?> |
|
| 767 | + // invoke OnUserFormRender event |
|
| 768 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
|
| 769 | + "id" => $user |
|
| 770 | + )); |
|
| 771 | + if(is_array($evtOut)) {
|
|
| 772 | + echo implode("", $evtOut);
|
|
| 773 | + } |
|
| 774 | + ?> |
|
| 775 | 775 | </form> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 12: |
|
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 11: |
|
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 12: |
|
| 8 | + if(!$modx->hasPermission('edit_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 11: |
|
| 13 | + if(!$modx->hasPermission('new_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") {
|
|
| 2 | +if (IN_MANAGER_MODE != "true") {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch($modx->manager->action) {
|
|
| 6 | +switch ($modx->manager->action) {
|
|
| 7 | 7 | case 12: |
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 8 | + if (!$modx->hasPermission('edit_user')) {
|
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 11: |
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 13 | + if (!$modx->hasPermission('new_user')) {
|
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| 22 | 22 | |
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
|
| 25 | -if($username = $modx->db->getValue($rs)) {
|
|
| 24 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
|
|
| 25 | +if ($username = $modx->db->getValue($rs)) {
|
|
| 26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | -if($modx->manager->action == '12') {
|
|
| 30 | +if ($modx->manager->action == '12') {
|
|
| 31 | 31 | // get user attribute |
| 32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
| 33 | 33 | $userdata = $modx->db->getRow($rs); |
| 34 | - if(!$userdata) {
|
|
| 34 | + if (!$userdata) {
|
|
| 35 | 35 | $modx->webAlertAndQuit("No user returned!");
|
| 36 | 36 | } |
| 37 | 37 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | // get user settings |
| 40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
| 41 | 41 | $usersettings = array(); |
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 42 | + while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | 43 | // manually extract so that user display settings are not overwritten |
| 44 | - foreach($usersettings as $k => $v) {
|
|
| 45 | - if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 44 | + foreach ($usersettings as $k => $v) {
|
|
| 45 | + if ($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | 46 | ${$k} = $v;
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // get user name |
| 51 | 51 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
| 52 | 52 | $usernamedata = $modx->db->getRow($rs); |
| 53 | - if(!$usernamedata) {
|
|
| 53 | + if (!$usernamedata) {
|
|
| 54 | 54 | $modx->webAlertAndQuit("No user returned while getting username!");
|
| 55 | 55 | } |
| 56 | 56 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 65 | -foreach($userdata as $key => $val) {
|
|
| 65 | +foreach ($userdata as $key => $val) {
|
|
| 66 | 66 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
| 67 | 67 | }; |
| 68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 69 | 69 | |
| 70 | 70 | // restore saved form |
| 71 | 71 | $formRestored = false; |
| 72 | -if($modx->manager->hasFormValues()) {
|
|
| 72 | +if ($modx->manager->hasFormValues()) {
|
|
| 73 | 73 | $modx->manager->loadFormValues(); |
| 74 | 74 | // restore post values |
| 75 | 75 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | // include the country list language file |
| 85 | 85 | $_country_lang = array(); |
| 86 | 86 | include_once "lang/country/english_country.inc.php"; |
| 87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
|
| 88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 87 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
|
|
| 88 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
| 89 | 89 | } |
| 90 | 90 | asort($_country_lang); |
| 91 | 91 | |
| 92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 93 | -if($which_browser == 'default') {
|
|
| 93 | +if ($which_browser == 'default') {
|
|
| 94 | 94 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
| 95 | 95 | } |
| 96 | 96 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | document.userform.save.click(); |
| 183 | 183 | }, |
| 184 | 184 | delete: function() {
|
| 185 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 185 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 186 | 186 | alert("<?php echo $_lang['alert_delete_self']; ?>");
|
| 187 | 187 | <?php } else { ?>
|
| 188 | 188 | if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
|
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
| 206 | 206 | "id" => $user |
| 207 | 207 | )); |
| 208 | - if(is_array($evtOut)) {
|
|
| 208 | + if (is_array($evtOut)) {
|
|
| 209 | 209 | echo implode("", $evtOut);
|
| 210 | 210 | } |
| 211 | 211 | ?> |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
| 215 | 215 | |
| 216 | 216 | <h1> |
| 217 | - <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
|
|
| 217 | + <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
|
|
| 218 | 218 | </h1> |
| 219 | 219 | |
| 220 | 220 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
| 233 | 233 | <tr> |
| 234 | 234 | <td colspan="3"><span id="blocked" class="warning"> |
| 235 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 235 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 236 | 236 | <?php echo $_lang['user_is_blocked']; ?> |
| 237 | 237 | <?php } ?> |
| 238 | 238 | </span> |
| 239 | 239 | <br /></td> |
| 240 | 240 | </tr> |
| 241 | - <?php if(!empty($userdata['id'])) { ?>
|
|
| 241 | + <?php if (!empty($userdata['id'])) { ?>
|
|
| 242 | 242 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
| 243 | 243 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
| 244 | 244 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
| 252 | 252 | </tr> |
| 253 | 253 | <tr> |
| 254 | - <th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
| 254 | + <th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
| 255 | 255 | <td> </td> |
| 256 | 256 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>> |
| 257 | 257 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | ?> |
| 306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 307 | 307 | <?php |
| 308 | - while($row = $modx->db->getRow($rs)) {
|
|
| 309 | - if($modx->manager->action == '11') {
|
|
| 308 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 309 | + if ($modx->manager->action == '11') {
|
|
| 310 | 310 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
| 311 | 311 | } else {
|
| 312 | 312 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 362 | 362 | <?php |
| 363 | - foreach($_country_lang as $key => $country) {
|
|
| 364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 363 | + foreach ($_country_lang as $key => $country) {
|
|
| 364 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
| 365 | 365 | } |
| 366 | 366 | ?> |
| 367 | 367 | </select></td> |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | <td> </td> |
| 388 | 388 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td> |
| 389 | 389 | </tr> |
| 390 | - <?php if($modx->manager->action == '12') { ?>
|
|
| 390 | + <?php if ($modx->manager->action == '12') { ?>
|
|
| 391 | 391 | <tr> |
| 392 | 392 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
| 393 | 393 | <td> </td> |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | </tr> |
| 425 | 425 | <?php } ?> |
| 426 | 426 | </table> |
| 427 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 427 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
|
|
| 428 | 428 | <p><?php echo $_lang['user_edit_self_msg']; ?></p> |
| 429 | 429 | <?php } ?> |
| 430 | 430 | </div> |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | <?php |
| 442 | 442 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
| 443 | 443 | $dir = dir("includes/lang");
|
| 444 | - while($file = $dir->read()) {
|
|
| 445 | - if(strpos($file, ".inc.php") > 0) {
|
|
| 444 | + while ($file = $dir->read()) {
|
|
| 445 | + if (strpos($file, ".inc.php") > 0) {
|
|
| 446 | 446 | $endpos = strpos($file, "."); |
| 447 | 447 | $languagename = substr($file, 0, $endpos); |
| 448 | 448 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,17 +529,17 @@ discard block |
||
| 529 | 529 | <option value=""></option> |
| 530 | 530 | <?php |
| 531 | 531 | $dir = dir("media/style/");
|
| 532 | - while($file = $dir->read()) {
|
|
| 533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 532 | + while ($file = $dir->read()) {
|
|
| 533 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | 534 | $themename = $file; |
| 535 | - if($themename === 'common') {
|
|
| 535 | + if ($themename === 'common') {
|
|
| 536 | 536 | continue; |
| 537 | 537 | } |
| 538 | - $attr = 'value="' . $themename . '" '; |
|
| 539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 538 | + $attr = 'value="'.$themename.'" '; |
|
| 539 | + if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 540 | 540 | $attr .= 'selected="selected" '; |
| 541 | 541 | } |
| 542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
|
| 542 | + echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
|
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | $dir->close(); |
@@ -556,12 +556,12 @@ discard block |
||
| 556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
| 557 | 557 | <?php |
| 558 | 558 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
| 559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
| 560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 559 | + echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n"; |
|
| 560 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 561 | 561 | $dir = str_replace('\\', '/', $dir);
|
| 562 | 562 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
| 563 | 563 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
| 564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
|
|
| 564 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
|
|
| 565 | 565 | } |
| 566 | 566 | ?> |
| 567 | 567 | </select></td> |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | </tr> |
| 589 | 589 | <tr> |
| 590 | 590 | <td> </td> |
| 591 | - <td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td> |
|
| 591 | + <td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td> |
|
| 592 | 592 | </tr> |
| 593 | 593 | <tr> |
| 594 | 594 | <th><?php echo $_lang["uploadable_media_title"] ?></th> |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | </tr> |
| 601 | 601 | <tr> |
| 602 | 602 | <td> </td> |
| 603 | - <td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td> |
|
| 603 | + <td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td> |
|
| 604 | 604 | </tr> |
| 605 | 605 | <tr> |
| 606 | 606 | <th><?php echo $_lang["uploadable_flash_title"] ?></th> |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | </tr> |
| 613 | 613 | <tr> |
| 614 | 614 | <td> </td> |
| 615 | - <td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td> |
|
| 615 | + <td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td> |
|
| 616 | 616 | </tr> |
| 617 | 617 | <tr> |
| 618 | 618 | <th><?php echo $_lang["uploadable_files_title"] ?></th> |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | </tr> |
| 625 | 625 | <tr> |
| 626 | 626 | <td> </td> |
| 627 | - <td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td> |
|
| 627 | + <td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td> |
|
| 628 | 628 | </tr> |
| 629 | 629 | <tr class='row2'> |
| 630 | 630 | <th><?php echo $_lang["upload_maxsize_title"] ?></th> |
@@ -643,11 +643,11 @@ discard block |
||
| 643 | 643 | $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
| 644 | 644 | // invoke OnRichTextEditorRegister event |
| 645 | 645 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
| 646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
| 647 | - if(is_array($evtOut)) {
|
|
| 648 | - for($i = 0; $i < count($evtOut); $i++) {
|
|
| 646 | + echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n"; |
|
| 647 | + if (is_array($evtOut)) {
|
|
| 648 | + for ($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | 649 | $editor = $evtOut[$i]; |
| 650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
| 650 | + echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n"; |
|
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | ?> |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | <?php |
| 686 | 686 | // invoke OnInterfaceSettingsRender event |
| 687 | 687 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
| 688 | - if(is_array($evtOut)) {
|
|
| 688 | + if (is_array($evtOut)) {
|
|
| 689 | 689 | echo implode("", $evtOut);
|
| 690 | 690 | } |
| 691 | 691 | ?> |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | function BrowseServer() {
|
| 713 | 713 | var w = screen.width * 0.7; |
| 714 | 714 | var h = screen.height * 0.7; |
| 715 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
|
|
| 715 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
|
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | function SetUrl(url, width, height, alt) {
|
@@ -735,17 +735,17 @@ discard block |
||
| 735 | 735 | </tr> |
| 736 | 736 | </table> |
| 737 | 737 | </div> |
| 738 | - <?php if($use_udperms == 1) {
|
|
| 738 | + <?php if ($use_udperms == 1) {
|
|
| 739 | 739 | |
| 740 | 740 | $groupsarray = array(); |
| 741 | 741 | |
| 742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 742 | + if ($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 743 | 743 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
| 744 | 744 | $groupsarray = $modx->db->getColumn('user_group', $rs);
|
| 745 | 745 | } |
| 746 | 746 | // retain selected doc groups between post |
| 747 | - if(is_array($_POST['user_groups'])) {
|
|
| 748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 747 | + if (is_array($_POST['user_groups'])) {
|
|
| 748 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 749 | 749 | } |
| 750 | 750 | ?> |
| 751 | 751 | <div class="tab-page" id="tabAccess"> |
@@ -754,8 +754,8 @@ discard block |
||
| 754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 755 | 755 | <?php |
| 756 | 756 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
| 757 | - while($row = $modx->db->getRow($rs)) {
|
|
| 758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
| 757 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 758 | + echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />"; |
|
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | ?> |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
| 769 | 769 | "id" => $user |
| 770 | 770 | )); |
| 771 | - if(is_array($evtOut)) {
|
|
| 771 | + if (is_array($evtOut)) {
|
|
| 772 | 772 | echo implode("", $evtOut);
|
| 773 | 773 | } |
| 774 | 774 | ?> |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") {
|
|
| 2 | +if(IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch($modx->manager->action) {
|
|
| 6 | +switch($modx->manager->action) { |
|
| 7 | 7 | case 12: |
| 8 | - if(!$modx->hasPermission('edit_user')) {
|
|
| 8 | + if(!$modx->hasPermission('edit_user')) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 11: |
| 13 | - if(!$modx->hasPermission('new_user')) {
|
|
| 13 | + if(!$modx->hasPermission('new_user')) { |
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -22,16 +22,16 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | // check to see the snippet editor isn't locked |
| 24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 25 | -if($username = $modx->db->getValue($rs)) {
|
|
| 25 | +if($username = $modx->db->getValue($rs)) { |
|
| 26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
| 27 | 27 | } |
| 28 | 28 | // end check for lock |
| 29 | 29 | |
| 30 | -if($modx->manager->action == '12') {
|
|
| 30 | +if($modx->manager->action == '12') { |
|
| 31 | 31 | // get user attribute |
| 32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
|
| 33 | 33 | $userdata = $modx->db->getRow($rs); |
| 34 | - if(!$userdata) {
|
|
| 34 | + if(!$userdata) { |
|
| 35 | 35 | $modx->webAlertAndQuit("No user returned!");
|
| 36 | 36 | } |
| 37 | 37 | |
@@ -39,10 +39,12 @@ discard block |
||
| 39 | 39 | // get user settings |
| 40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
|
| 41 | 41 | $usersettings = array(); |
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 42 | + while($row = $modx->db->getRow($rs)) { |
|
| 43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 44 | + } |
|
| 43 | 45 | // manually extract so that user display settings are not overwritten |
| 44 | - foreach($usersettings as $k => $v) {
|
|
| 45 | - if($k != 'manager_language' && $k != 'manager_theme') {
|
|
| 46 | + foreach($usersettings as $k => $v) { |
|
| 47 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
| 46 | 48 | ${$k} = $v;
|
| 47 | 49 | } |
| 48 | 50 | } |
@@ -50,11 +52,11 @@ discard block |
||
| 50 | 52 | // get user name |
| 51 | 53 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
|
| 52 | 54 | $usernamedata = $modx->db->getRow($rs); |
| 53 | - if(!$usernamedata) {
|
|
| 55 | + if(!$usernamedata) { |
|
| 54 | 56 | $modx->webAlertAndQuit("No user returned while getting username!");
|
| 55 | 57 | } |
| 56 | 58 | $_SESSION['itemname'] = $usernamedata['username']; |
| 57 | -} else {
|
|
| 59 | +} else { |
|
| 58 | 60 | $userdata = array(); |
| 59 | 61 | $usersettings = array(); |
| 60 | 62 | $usernamedata = array(); |
@@ -62,14 +64,14 @@ discard block |
||
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 65 | -foreach($userdata as $key => $val) {
|
|
| 67 | +foreach($userdata as $key => $val) { |
|
| 66 | 68 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
| 67 | 69 | }; |
| 68 | 70 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 69 | 71 | |
| 70 | 72 | // restore saved form |
| 71 | 73 | $formRestored = false; |
| 72 | -if($modx->manager->hasFormValues()) {
|
|
| 74 | +if($modx->manager->hasFormValues()) { |
|
| 73 | 75 | $modx->manager->loadFormValues(); |
| 74 | 76 | // restore post values |
| 75 | 77 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +86,13 @@ discard block |
||
| 84 | 86 | // include the country list language file |
| 85 | 87 | $_country_lang = array(); |
| 86 | 88 | include_once "lang/country/english_country.inc.php"; |
| 87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
|
| 89 | +if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
| 88 | 90 | include_once "lang/country/" . $manager_language . "_country.inc.php"; |
| 89 | 91 | } |
| 90 | 92 | asort($_country_lang); |
| 91 | 93 | |
| 92 | 94 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
| 93 | -if($which_browser == 'default') {
|
|
| 95 | +if($which_browser == 'default') { |
|
| 94 | 96 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
| 95 | 97 | } |
| 96 | 98 | ?> |
@@ -205,7 +207,7 @@ discard block |
||
| 205 | 207 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
|
| 206 | 208 | "id" => $user |
| 207 | 209 | )); |
| 208 | - if(is_array($evtOut)) {
|
|
| 210 | + if(is_array($evtOut)) { |
|
| 209 | 211 | echo implode("", $evtOut);
|
| 210 | 212 | } |
| 211 | 213 | ?> |
@@ -305,10 +307,10 @@ discard block |
||
| 305 | 307 | ?> |
| 306 | 308 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
| 307 | 309 | <?php |
| 308 | - while($row = $modx->db->getRow($rs)) {
|
|
| 309 | - if($modx->manager->action == '11') {
|
|
| 310 | + while($row = $modx->db->getRow($rs)) { |
|
| 311 | + if($modx->manager->action == '11') { |
|
| 310 | 312 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
| 311 | - } else {
|
|
| 313 | + } else { |
|
| 312 | 314 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
| 313 | 315 | } |
| 314 | 316 | ?> |
@@ -360,7 +362,7 @@ discard block |
||
| 360 | 362 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 361 | 363 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 362 | 364 | <?php |
| 363 | - foreach($_country_lang as $key => $country) {
|
|
| 365 | + foreach($_country_lang as $key => $country) { |
|
| 364 | 366 | echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
| 365 | 367 | } |
| 366 | 368 | ?> |
@@ -441,8 +443,8 @@ discard block |
||
| 441 | 443 | <?php |
| 442 | 444 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
| 443 | 445 | $dir = dir("includes/lang");
|
| 444 | - while($file = $dir->read()) {
|
|
| 445 | - if(strpos($file, ".inc.php") > 0) {
|
|
| 446 | + while($file = $dir->read()) { |
|
| 447 | + if(strpos($file, ".inc.php") > 0) { |
|
| 446 | 448 | $endpos = strpos($file, "."); |
| 447 | 449 | $languagename = substr($file, 0, $endpos); |
| 448 | 450 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,14 +531,14 @@ discard block |
||
| 529 | 531 | <option value=""></option> |
| 530 | 532 | <?php |
| 531 | 533 | $dir = dir("media/style/");
|
| 532 | - while($file = $dir->read()) {
|
|
| 533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 534 | + while($file = $dir->read()) { |
|
| 535 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
| 534 | 536 | $themename = $file; |
| 535 | - if($themename === 'common') {
|
|
| 537 | + if($themename === 'common') { |
|
| 536 | 538 | continue; |
| 537 | 539 | } |
| 538 | 540 | $attr = 'value="' . $themename . '" '; |
| 539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
|
|
| 541 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
| 540 | 542 | $attr .= 'selected="selected" '; |
| 541 | 543 | } |
| 542 | 544 | echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
|
@@ -557,7 +559,7 @@ discard block |
||
| 557 | 559 | <?php |
| 558 | 560 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
| 559 | 561 | echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
| 560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 562 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
| 561 | 563 | $dir = str_replace('\\', '/', $dir);
|
| 562 | 564 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
| 563 | 565 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
@@ -644,8 +646,8 @@ discard block |
||
| 644 | 646 | // invoke OnRichTextEditorRegister event |
| 645 | 647 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
|
| 646 | 648 | echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
| 647 | - if(is_array($evtOut)) {
|
|
| 648 | - for($i = 0; $i < count($evtOut); $i++) {
|
|
| 649 | + if(is_array($evtOut)) { |
|
| 650 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 649 | 651 | $editor = $evtOut[$i]; |
| 650 | 652 | echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
| 651 | 653 | } |
@@ -685,7 +687,7 @@ discard block |
||
| 685 | 687 | <?php |
| 686 | 688 | // invoke OnInterfaceSettingsRender event |
| 687 | 689 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
|
| 688 | - if(is_array($evtOut)) {
|
|
| 690 | + if(is_array($evtOut)) { |
|
| 689 | 691 | echo implode("", $evtOut);
|
| 690 | 692 | } |
| 691 | 693 | ?> |
@@ -735,17 +737,20 @@ discard block |
||
| 735 | 737 | </tr> |
| 736 | 738 | </table> |
| 737 | 739 | </div> |
| 738 | - <?php if($use_udperms == 1) {
|
|
| 740 | + <?php if($use_udperms == 1) { |
|
| 739 | 741 | |
| 740 | 742 | $groupsarray = array(); |
| 741 | 743 | |
| 742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited
|
|
| 744 | + if($modx->manager->action == '12') { |
|
| 745 | +// only do this bit if the user is being edited |
|
| 743 | 746 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
|
| 744 | 747 | $groupsarray = $modx->db->getColumn('user_group', $rs);
|
| 745 | 748 | } |
| 746 | 749 | // retain selected doc groups between post |
| 747 | - if(is_array($_POST['user_groups'])) {
|
|
| 748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 750 | + if(is_array($_POST['user_groups'])) { |
|
| 751 | + foreach($_POST['user_groups'] as $n => $v) { |
|
| 752 | + $groupsarray[] = $v; |
|
| 753 | + } |
|
| 749 | 754 | } |
| 750 | 755 | ?> |
| 751 | 756 | <div class="tab-page" id="tabAccess"> |
@@ -754,7 +759,7 @@ discard block |
||
| 754 | 759 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 755 | 760 | <?php |
| 756 | 761 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
|
| 757 | - while($row = $modx->db->getRow($rs)) {
|
|
| 762 | + while($row = $modx->db->getRow($rs)) { |
|
| 758 | 763 | echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
| 759 | 764 | } |
| 760 | 765 | } |
@@ -768,7 +773,7 @@ discard block |
||
| 768 | 773 | $evtOut = $modx->invokeEvent("OnUserFormRender", array(
|
| 769 | 774 | "id" => $user |
| 770 | 775 | )); |
| 771 | - if(is_array($evtOut)) {
|
|
| 776 | + if(is_array($evtOut)) { |
|
| 772 | 777 | echo implode("", $evtOut);
|
| 773 | 778 | } |
| 774 | 779 | ?> |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $updateMsg = ''; |
| 14 | 14 | |
| 15 | 15 | // check permissions on the document |
| 16 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 16 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 17 | 17 | $udperms = new udperms(); |
| 18 | 18 | $udperms->user = $modx->getLoginUserID(); |
| 19 | 19 | $udperms->document = $id; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | if (isset($_POST['listSubmitted'])) { |
| 27 | - $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>'; |
|
| 27 | + $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>'; |
|
| 28 | 28 | if (strlen($items) > 0) { |
| 29 | 29 | $items = explode(';', $items); |
| 30 | 30 | foreach ($items as $key => $value) { |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | $tblsc = $modx->getFullTableName('site_content'); |
| 45 | 45 | $tbldg = $modx->getFullTableName('document_groups'); |
| 46 | 46 | |
| 47 | - $rs = $modx->db->select('pagetitle', $tblsc, 'id=' . $id . ''); |
|
| 47 | + $rs = $modx->db->select('pagetitle', $tblsc, 'id='.$id.''); |
|
| 48 | 48 | $pagetitle = $modx->db->getValue($rs); |
| 49 | 49 | |
| 50 | 50 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
| 51 | 51 | $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
| 52 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
| 53 | - $access = " AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 52 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
| 53 | + $access = " AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 54 | 54 | |
| 55 | - $rs = $modx->db->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc . 'AS sc LEFT JOIN ' . $tbldg . ' dg ON dg.document=sc.id', 'sc.parent=' . $id . $access . ' GROUP BY sc.id', 'menuindex ASC'); |
|
| 55 | + $rs = $modx->db->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc.'AS sc LEFT JOIN '.$tbldg.' dg ON dg.document=sc.id', 'sc.parent='.$id.$access.' GROUP BY sc.id', 'menuindex ASC'); |
|
| 56 | 56 | |
| 57 | 57 | if ($modx->db->getRecordCount($rs)) { |
| 58 | 58 | $ressourcelist .= '<div class="clearfix"><ul id="sortlist" class="sortableList">'; |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | $classes .= ($row['hidemenu']) ? ' notInMenuNode ' : ' inMenuNode'; |
| 62 | 62 | $classes .= ($row['published']) ? ' publishedNode ' : ' unpublishedNode '; |
| 63 | 63 | $classes = ($row['deleted']) ? ' deletedNode ' : $classes; |
| 64 | - $icon = $row['isfolder'] ? '<i class="' . $_style['files_folder'] . '"></i> ' : ' <i class="' . $_style['files_page_html'] . '"></i> '; |
|
| 65 | - $ressourcelist .= '<li id="item_' . $row['id'] . '" class="' . $classes . '">' . $icon . $row['pagetitle'] . ' <small>(' . $row['id'] . ')</small></li>'; |
|
| 64 | + $icon = $row['isfolder'] ? '<i class="'.$_style['files_folder'].'"></i> ' : ' <i class="'.$_style['files_page_html'].'"></i> '; |
|
| 65 | + $ressourcelist .= '<li id="item_'.$row['id'].'" class="'.$classes.'">'.$icon.$row['pagetitle'].' <small>('.$row['id'].')</small></li>'; |
|
| 66 | 66 | } |
| 67 | 67 | $ressourcelist .= '</ul></div>'; |
| 68 | 68 | } else { |
| 69 | - $updateMsg = '<p class="text-danger">' . $_lang['sort_nochildren'] . '</p>'; |
|
| 69 | + $updateMsg = '<p class="text-danger">'.$_lang['sort_nochildren'].'</p>'; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | </script> |
| 150 | 150 | |
| 151 | 151 | <h1> |
| 152 | - <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle . '<small>(' . $id . ')</small>' : $_lang['sort_menuindex']) ?> |
|
| 152 | + <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle.'<small>('.$id.')</small>' : $_lang['sort_menuindex']) ?> |
|
| 153 | 153 | </h1> |
| 154 | 154 | |
| 155 | 155 | <?= $_style['actionbuttons']['dynamic']['save'] ?> |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if(IN_MANAGER_MODE != "true") {
|
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 88: |
|
| 8 | - if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 87: |
|
| 13 | - if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 88: |
|
| 8 | + if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 87: |
|
| 13 | + if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -24,64 +24,64 @@ discard block |
||
| 24 | 24 | // check to see the snippet editor isn't locked |
| 25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 26 | 26 | if($username = $modx->db->getValue($rs)) {
|
| 27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
| 31 | 31 | if($modx->manager->action == '88') {
|
| 32 | - // get user attributes |
|
| 33 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
|
| 34 | - $userdata = $modx->db->getRow($rs); |
|
| 35 | - if(!$userdata) {
|
|
| 36 | - $modx->webAlertAndQuit("No user returned!");
|
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - // get user settings |
|
| 40 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
|
| 41 | - $usersettings = array(); |
|
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 44 | - |
|
| 45 | - // get user name |
|
| 46 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
|
| 47 | - $usernamedata = $modx->db->getRow($rs); |
|
| 48 | - if(!$usernamedata) {
|
|
| 49 | - $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 50 | - } |
|
| 51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
| 32 | + // get user attributes |
|
| 33 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
|
| 34 | + $userdata = $modx->db->getRow($rs); |
|
| 35 | + if(!$userdata) {
|
|
| 36 | + $modx->webAlertAndQuit("No user returned!");
|
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + // get user settings |
|
| 40 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
|
| 41 | + $usersettings = array(); |
|
| 42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 44 | + |
|
| 45 | + // get user name |
|
| 46 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
|
| 47 | + $usernamedata = $modx->db->getRow($rs); |
|
| 48 | + if(!$usernamedata) {
|
|
| 49 | + $modx->webAlertAndQuit("No user returned while getting username!");
|
|
| 50 | + } |
|
| 51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
| 52 | 52 | } else {
|
| 53 | - $userdata = array(); |
|
| 54 | - $usersettings = array(); |
|
| 55 | - $usernamedata = array(); |
|
| 56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
| 53 | + $userdata = array(); |
|
| 54 | + $usersettings = array(); |
|
| 55 | + $usernamedata = array(); |
|
| 56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 60 | 60 | foreach($userdata as $key => $val) {
|
| 61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 62 | 62 | }; |
| 63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 64 | 64 | |
| 65 | 65 | // restore saved form |
| 66 | 66 | $formRestored = false; |
| 67 | 67 | if($modx->manager->hasFormValues()) {
|
| 68 | - $modx->manager->loadFormValues(); |
|
| 69 | - // restore post values |
|
| 70 | - $userdata = array_merge($userdata, $_POST); |
|
| 71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 72 | - $usernamedata['username'] = $userdata['newusername']; |
|
| 73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 74 | - $usersettings = array_merge($usersettings, $userdata); |
|
| 75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 76 | - extract($usersettings, EXTR_OVERWRITE); |
|
| 68 | + $modx->manager->loadFormValues(); |
|
| 69 | + // restore post values |
|
| 70 | + $userdata = array_merge($userdata, $_POST); |
|
| 71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
| 72 | + $usernamedata['username'] = $userdata['newusername']; |
|
| 73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
| 74 | + $usersettings = array_merge($usersettings, $userdata); |
|
| 75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
|
|
| 76 | + extract($usersettings, EXTR_OVERWRITE); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // include the country list language file |
| 80 | 80 | $_country_lang = array(); |
| 81 | 81 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
| 82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 82 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 83 | 83 | } else {
|
| 84 | - include_once "lang/country/english_country.inc.php"; |
|
| 84 | + include_once "lang/country/english_country.inc.php"; |
|
| 85 | 85 | } |
| 86 | 86 | asort($_country_lang); |
| 87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
| 191 | 191 | <?php |
| 192 | - // invoke OnWUsrFormPrerender event |
|
| 193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
|
| 194 | - if(is_array($evtOut)) {
|
|
| 195 | - echo implode("", $evtOut);
|
|
| 196 | - } |
|
| 197 | - ?> |
|
| 192 | + // invoke OnWUsrFormPrerender event |
|
| 193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
|
| 194 | + if(is_array($evtOut)) {
|
|
| 195 | + echo implode("", $evtOut);
|
|
| 196 | + } |
|
| 197 | + ?> |
|
| 198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" /> |
| 199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
| 200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 326 | 326 | <?php |
| 327 | - foreach($_country_lang as $key => $country) {
|
|
| 328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 329 | - } |
|
| 330 | - ?> |
|
| 327 | + foreach($_country_lang as $key => $country) {
|
|
| 328 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 329 | + } |
|
| 330 | + ?> |
|
| 331 | 331 | </select></td> |
| 332 | 332 | </tr> |
| 333 | 333 | <tr> |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
| 388 | 388 | </tr> |
| 389 | 389 | <?php |
| 390 | - } |
|
| 391 | - ?> |
|
| 390 | + } |
|
| 391 | + ?> |
|
| 392 | 392 | </table> |
| 393 | 393 | </div> |
| 394 | 394 | |
@@ -496,40 +496,40 @@ discard block |
||
| 496 | 496 | </table> |
| 497 | 497 | </div> |
| 498 | 498 | <?php |
| 499 | - if($use_udperms == 1) {
|
|
| 500 | - |
|
| 501 | - $groupsarray = array(); |
|
| 502 | - |
|
| 503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 504 | - $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
|
| 505 | - $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
|
| 506 | - } |
|
| 507 | - // retain selected user groups between post |
|
| 508 | - if(is_array($_POST['user_groups'])) {
|
|
| 509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 510 | - } |
|
| 511 | - ?> |
|
| 499 | + if($use_udperms == 1) {
|
|
| 500 | + |
|
| 501 | + $groupsarray = array(); |
|
| 502 | + |
|
| 503 | + if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 504 | + $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
|
| 505 | + $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
|
| 506 | + } |
|
| 507 | + // retain selected user groups between post |
|
| 508 | + if(is_array($_POST['user_groups'])) {
|
|
| 509 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 510 | + } |
|
| 511 | + ?> |
|
| 512 | 512 | <div class="tab-page" id="tabPermissions"> |
| 513 | 513 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
| 514 | 514 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script>
|
| 515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 516 | 516 | <?php |
| 517 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
|
| 518 | - while($row = $modx->db->getRow($rs)) {
|
|
| 519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
| 520 | - } |
|
| 521 | - } |
|
| 522 | - ?> |
|
| 517 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
|
| 518 | + while($row = $modx->db->getRow($rs)) {
|
|
| 519 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
| 520 | + } |
|
| 521 | + } |
|
| 522 | + ?> |
|
| 523 | 523 | </div> |
| 524 | 524 | <?php |
| 525 | - // invoke OnWUsrFormRender event |
|
| 526 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
|
| 527 | - "id" => $user |
|
| 528 | - )); |
|
| 529 | - if(is_array($evtOut)) {
|
|
| 530 | - echo implode("", $evtOut);
|
|
| 531 | - } |
|
| 532 | - ?> |
|
| 525 | + // invoke OnWUsrFormRender event |
|
| 526 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
|
| 527 | + "id" => $user |
|
| 528 | + )); |
|
| 529 | + if(is_array($evtOut)) {
|
|
| 530 | + echo implode("", $evtOut);
|
|
| 531 | + } |
|
| 532 | + ?> |
|
| 533 | 533 | </div> |
| 534 | 534 | </div> |
| 535 | 535 | <input type="submit" name="save" style="display:none"> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->manager->action) {
|
| 7 | - case 88: |
|
| 8 | - if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 87: |
|
| 13 | - if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 88: |
|
| 8 | + if(!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 87: |
|
| 13 | + if(!$modx->hasPermission('new_web_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") {
|
|
| 2 | +if (IN_MANAGER_MODE != "true") {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch($modx->manager->action) {
|
|
| 6 | +switch ($modx->manager->action) {
|
|
| 7 | 7 | case 88: |
| 8 | - if(!$modx->hasPermission('edit_web_user')) {
|
|
| 8 | + if (!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 87: |
| 13 | - if(!$modx->hasPermission('new_web_user')) {
|
|
| 13 | + if (!$modx->hasPermission('new_web_user')) {
|
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -22,30 +22,30 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | // check to see the snippet editor isn't locked |
| 25 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
|
| 26 | -if($username = $modx->db->getValue($rs)) {
|
|
| 25 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
|
|
| 26 | +if ($username = $modx->db->getValue($rs)) {
|
|
| 27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
| 31 | -if($modx->manager->action == '88') {
|
|
| 31 | +if ($modx->manager->action == '88') {
|
|
| 32 | 32 | // get user attributes |
| 33 | 33 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
| 34 | 34 | $userdata = $modx->db->getRow($rs); |
| 35 | - if(!$userdata) {
|
|
| 35 | + if (!$userdata) {
|
|
| 36 | 36 | $modx->webAlertAndQuit("No user returned!");
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // get user settings |
| 40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
| 41 | 41 | $usersettings = array(); |
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 42 | + while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 43 | 43 | extract($usersettings, EXTR_OVERWRITE); |
| 44 | 44 | |
| 45 | 45 | // get user name |
| 46 | 46 | $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
| 47 | 47 | $usernamedata = $modx->db->getRow($rs); |
| 48 | - if(!$usernamedata) {
|
|
| 48 | + if (!$usernamedata) {
|
|
| 49 | 49 | $modx->webAlertAndQuit("No user returned while getting username!");
|
| 50 | 50 | } |
| 51 | 51 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 60 | -foreach($userdata as $key => $val) {
|
|
| 60 | +foreach ($userdata as $key => $val) {
|
|
| 61 | 61 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
| 62 | 62 | }; |
| 63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 64 | 64 | |
| 65 | 65 | // restore saved form |
| 66 | 66 | $formRestored = false; |
| 67 | -if($modx->manager->hasFormValues()) {
|
|
| 67 | +if ($modx->manager->hasFormValues()) {
|
|
| 68 | 68 | $modx->manager->loadFormValues(); |
| 69 | 69 | // restore post values |
| 70 | 70 | $userdata = array_merge($userdata, $_POST); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // include the country list language file |
| 80 | 80 | $_country_lang = array(); |
| 81 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
|
| 82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
| 81 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
|
|
| 82 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
| 83 | 83 | } else {
|
| 84 | 84 | include_once "lang/country/english_country.inc.php"; |
| 85 | 85 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | <?php |
| 192 | 192 | // invoke OnWUsrFormPrerender event |
| 193 | 193 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
| 194 | - if(is_array($evtOut)) {
|
|
| 194 | + if (is_array($evtOut)) {
|
|
| 195 | 195 | echo implode("", $evtOut);
|
| 196 | 196 | } |
| 197 | 197 | ?> |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
| 201 | 201 | |
| 202 | 202 | <h1> |
| 203 | - <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['web_user_title']) ?>
|
|
| 203 | + <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['web_user_title']) ?>
|
|
| 204 | 204 | </h1> |
| 205 | 205 | |
| 206 | 206 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
| 219 | 219 | <tr> |
| 220 | 220 | <td colspan="3"><span id="blocked" class="warning"> |
| 221 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 221 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?>
|
|
| 222 | 222 | <b><?php echo $_lang['user_is_blocked']; ?></b> |
| 223 | 223 | <?php } ?> |
| 224 | 224 | </span> |
| 225 | 225 | <br /></td> |
| 226 | 226 | </tr> |
| 227 | - <?php if(!empty($userdata['id'])) { ?>
|
|
| 227 | + <?php if (!empty($userdata['id'])) { ?>
|
|
| 228 | 228 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '88' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
| 229 | 229 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
| 230 | 230 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars(isset($_POST['newusername']) ? $_POST['newusername'] : $usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
| 238 | 238 | </tr> |
| 239 | 239 | <tr> |
| 240 | - <th><?php echo $modx->manager->action == '87' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
| 240 | + <th><?php echo $modx->manager->action == '87' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
| 241 | 241 | <td> </td> |
| 242 | 242 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "87" ? " checked disabled" : ""; ?>> |
| 243 | 243 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "87" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -324,8 +324,8 @@ discard block |
||
| 324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 326 | 326 | <?php |
| 327 | - foreach($_country_lang as $key => $country) {
|
|
| 328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
| 327 | + foreach ($_country_lang as $key => $country) {
|
|
| 328 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
| 329 | 329 | } |
| 330 | 330 | ?> |
| 331 | 331 | </select></td> |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | <td> </td> |
| 352 | 352 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars(isset($_POST['comment']) ? $_POST['comment'] : $userdata['comment']); ?></textarea></td> |
| 353 | 353 | </tr> |
| 354 | - <?php if($modx->manager->action == '88') { ?>
|
|
| 354 | + <?php if ($modx->manager->action == '88') { ?>
|
|
| 355 | 355 | <tr> |
| 356 | 356 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
| 357 | 357 | <td> </td> |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | function BrowseServer() {
|
| 473 | 473 | var w = screen.width * 0.7; |
| 474 | 474 | var h = screen.height * 0.7; |
| 475 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL;?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
|
|
| 475 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
|
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | function SetUrl(url, width, height, alt) {
|
@@ -491,22 +491,22 @@ discard block |
||
| 491 | 491 | <td class='comment'><?php echo $_lang["user_photo_message"] ?></td> |
| 492 | 492 | </tr> |
| 493 | 493 | <tr> |
| 494 | - <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "") . $_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "") . $userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
| 494 | + <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "").$_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "").$userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
| 495 | 495 | </tr> |
| 496 | 496 | </table> |
| 497 | 497 | </div> |
| 498 | 498 | <?php |
| 499 | - if($use_udperms == 1) {
|
|
| 499 | + if ($use_udperms == 1) {
|
|
| 500 | 500 | |
| 501 | 501 | $groupsarray = array(); |
| 502 | 502 | |
| 503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 503 | + if ($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 504 | 504 | $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
| 505 | 505 | $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
| 506 | 506 | } |
| 507 | 507 | // retain selected user groups between post |
| 508 | - if(is_array($_POST['user_groups'])) {
|
|
| 509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 508 | + if (is_array($_POST['user_groups'])) {
|
|
| 509 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 510 | 510 | } |
| 511 | 511 | ?> |
| 512 | 512 | <div class="tab-page" id="tabPermissions"> |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 516 | 516 | <?php |
| 517 | 517 | $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
| 518 | - while($row = $modx->db->getRow($rs)) {
|
|
| 519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
| 518 | + while ($row = $modx->db->getRow($rs)) {
|
|
| 519 | + echo '<label><input type="checkbox" name="user_groups[]" value="'.$row['id'].'"'.(in_array($row['id'], $groupsarray) ? ' checked="checked"' : '').' />'.$row['name'].'</label><br />'; |
|
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | ?> |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
| 527 | 527 | "id" => $user |
| 528 | 528 | )); |
| 529 | - if(is_array($evtOut)) {
|
|
| 529 | + if (is_array($evtOut)) {
|
|
| 530 | 530 | echo implode("", $evtOut);
|
| 531 | 531 | } |
| 532 | 532 | ?> |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") {
|
|
| 2 | +if(IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -switch($modx->manager->action) {
|
|
| 6 | +switch($modx->manager->action) { |
|
| 7 | 7 | case 88: |
| 8 | - if(!$modx->hasPermission('edit_web_user')) {
|
|
| 8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | break; |
| 12 | 12 | case 87: |
| 13 | - if(!$modx->hasPermission('new_web_user')) {
|
|
| 13 | + if(!$modx->hasPermission('new_web_user')) { |
|
| 14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | 15 | } |
| 16 | 16 | break; |
@@ -23,33 +23,35 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // check to see the snippet editor isn't locked |
| 25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
|
| 26 | -if($username = $modx->db->getValue($rs)) {
|
|
| 26 | +if($username = $modx->db->getValue($rs)) { |
|
| 27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
| 31 | -if($modx->manager->action == '88') {
|
|
| 31 | +if($modx->manager->action == '88') { |
|
| 32 | 32 | // get user attributes |
| 33 | 33 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
|
| 34 | 34 | $userdata = $modx->db->getRow($rs); |
| 35 | - if(!$userdata) {
|
|
| 35 | + if(!$userdata) { |
|
| 36 | 36 | $modx->webAlertAndQuit("No user returned!");
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // get user settings |
| 40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
|
| 41 | 41 | $usersettings = array(); |
| 42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 42 | + while($row = $modx->db->getRow($rs)) { |
|
| 43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
| 44 | + } |
|
| 43 | 45 | extract($usersettings, EXTR_OVERWRITE); |
| 44 | 46 | |
| 45 | 47 | // get user name |
| 46 | 48 | $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
|
| 47 | 49 | $usernamedata = $modx->db->getRow($rs); |
| 48 | - if(!$usernamedata) {
|
|
| 50 | + if(!$usernamedata) { |
|
| 49 | 51 | $modx->webAlertAndQuit("No user returned while getting username!");
|
| 50 | 52 | } |
| 51 | 53 | $_SESSION['itemname'] = $usernamedata['username']; |
| 52 | -} else {
|
|
| 54 | +} else { |
|
| 53 | 55 | $userdata = array(); |
| 54 | 56 | $usersettings = array(); |
| 55 | 57 | $usernamedata = array(); |
@@ -57,14 +59,14 @@ discard block |
||
| 57 | 59 | } |
| 58 | 60 | |
| 59 | 61 | // avoid doubling htmlspecialchars (already encoded in DB) |
| 60 | -foreach($userdata as $key => $val) {
|
|
| 62 | +foreach($userdata as $key => $val) { |
|
| 61 | 63 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
| 62 | 64 | }; |
| 63 | 65 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
| 64 | 66 | |
| 65 | 67 | // restore saved form |
| 66 | 68 | $formRestored = false; |
| 67 | -if($modx->manager->hasFormValues()) {
|
|
| 69 | +if($modx->manager->hasFormValues()) { |
|
| 68 | 70 | $modx->manager->loadFormValues(); |
| 69 | 71 | // restore post values |
| 70 | 72 | $userdata = array_merge($userdata, $_POST); |
@@ -78,9 +80,9 @@ discard block |
||
| 78 | 80 | |
| 79 | 81 | // include the country list language file |
| 80 | 82 | $_country_lang = array(); |
| 81 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
|
|
| 83 | +if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
| 82 | 84 | include_once "lang/country/" . $manager_language . "_country.inc.php"; |
| 83 | -} else {
|
|
| 85 | +} else { |
|
| 84 | 86 | include_once "lang/country/english_country.inc.php"; |
| 85 | 87 | } |
| 86 | 88 | asort($_country_lang); |
@@ -191,7 +193,7 @@ discard block |
||
| 191 | 193 | <?php |
| 192 | 194 | // invoke OnWUsrFormPrerender event |
| 193 | 195 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
|
| 194 | - if(is_array($evtOut)) {
|
|
| 196 | + if(is_array($evtOut)) { |
|
| 195 | 197 | echo implode("", $evtOut);
|
| 196 | 198 | } |
| 197 | 199 | ?> |
@@ -324,7 +326,7 @@ discard block |
||
| 324 | 326 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
| 325 | 327 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
| 326 | 328 | <?php |
| 327 | - foreach($_country_lang as $key => $country) {
|
|
| 329 | + foreach($_country_lang as $key => $country) { |
|
| 328 | 330 | echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
| 329 | 331 | } |
| 330 | 332 | ?> |
@@ -496,17 +498,20 @@ discard block |
||
| 496 | 498 | </table> |
| 497 | 499 | </div> |
| 498 | 500 | <?php |
| 499 | - if($use_udperms == 1) {
|
|
| 501 | + if($use_udperms == 1) { |
|
| 500 | 502 | |
| 501 | 503 | $groupsarray = array(); |
| 502 | 504 | |
| 503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited
|
|
| 505 | + if($modx->manager->action == '88') { |
|
| 506 | +// only do this bit if the user is being edited |
|
| 504 | 507 | $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
|
| 505 | 508 | $groupsarray = $modx->db->getColumn('webgroup', $rs);
|
| 506 | 509 | } |
| 507 | 510 | // retain selected user groups between post |
| 508 | - if(is_array($_POST['user_groups'])) {
|
|
| 509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
| 511 | + if(is_array($_POST['user_groups'])) { |
|
| 512 | + foreach($_POST['user_groups'] as $n => $v) { |
|
| 513 | + $groupsarray[] = $v; |
|
| 514 | + } |
|
| 510 | 515 | } |
| 511 | 516 | ?> |
| 512 | 517 | <div class="tab-page" id="tabPermissions"> |
@@ -515,7 +520,7 @@ discard block |
||
| 515 | 520 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
| 516 | 521 | <?php |
| 517 | 522 | $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
|
| 518 | - while($row = $modx->db->getRow($rs)) {
|
|
| 523 | + while($row = $modx->db->getRow($rs)) { |
|
| 519 | 524 | echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
| 520 | 525 | } |
| 521 | 526 | } |
@@ -526,7 +531,7 @@ discard block |
||
| 526 | 531 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
|
| 527 | 532 | "id" => $user |
| 528 | 533 | )); |
| 529 | - if(is_array($evtOut)) {
|
|
| 534 | + if(is_array($evtOut)) { |
|
| 530 | 535 | echo implode("", $evtOut);
|
| 531 | 536 | } |
| 532 | 537 | ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $templatename = ''; |
| 20 | 20 | |
| 21 | 21 | if (isset($_POST['listSubmitted'])) { |
| 22 | - $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>'; |
|
| 22 | + $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>'; |
|
| 23 | 23 | foreach ($_POST as $listName => $listValue) { |
| 24 | 24 | if ($listName == 'listSubmitted' || $listName == 'reset') { |
| 25 | 25 | continue; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | while ($row = $modx->db->getRow($rs)) { |
| 48 | 48 | $templatename = $row['templatename']; |
| 49 | 49 | $caption = $row['caption'] != '' ? $row['caption'] : $row['name']; |
| 50 | - $sortableList .= '<li id="item_' . $row['id'] . '"><i class="fa fa-list-alt"></i> ' . $caption . ' <small class="protectedNode" style="float:right">[*' . $row['name'] . '*]</small></li>'; |
|
| 50 | + $sortableList .= '<li id="item_'.$row['id'].'"><i class="fa fa-list-alt"></i> '.$caption.' <small class="protectedNode" style="float:right">[*'.$row['name'].'*]</small></li>'; |
|
| 51 | 51 | } |
| 52 | 52 | $sortableList .= '</ul></div>'; |
| 53 | 53 | } else { |
| 54 | - $updateMsg = '<p class="text-danger">' . $_lang['tmplvars_novars'] . '</p>'; |
|
| 54 | + $updateMsg = '<p class="text-danger">'.$_lang['tmplvars_novars'].'</p>'; |
|
| 55 | 55 | } |
| 56 | 56 | ?> |
| 57 | 57 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | </script> |
| 129 | 129 | |
| 130 | 130 | <h1> |
| 131 | - <i class="fa fa-sort-numeric-asc"></i><?= ($templatename ? $templatename . '<small>(' . $id . ')</small>' : $_lang['template_tv_edit_title']) ?> |
|
| 131 | + <i class="fa fa-sort-numeric-asc"></i><?= ($templatename ? $templatename.'<small>('.$id.')</small>' : $_lang['template_tv_edit_title']) ?> |
|
| 132 | 132 | </h1> |
| 133 | 133 | |
| 134 | 134 | <?= $_style['actionbuttons']['dynamic']['save'] ?> |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | <div class="container container-body" id="lyr3"> |
| 17 | 17 | <b><?= $_lang['messages_read_message'] ?></b> |
| 18 | 18 | <?php |
| 19 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "id='" . (int)$_REQUEST['id'] . "'"); |
|
| 19 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "id='".(int) $_REQUEST['id']."'"); |
|
| 20 | 20 | $message = $modx->db->getRow($rs); |
| 21 | 21 | if (!$message) { |
| 22 | 22 | echo "Wrong number of messages returned!"; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | <p><b><?= $_lang['messages_inbox'] ?></b></p> |
| 88 | 88 | <?php |
| 89 | 89 | // Get number of rows |
| 90 | - $rs = $modx->db->select('count(id)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . ""); |
|
| 90 | + $rs = $modx->db->select('count(id)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID().""); |
|
| 91 | 91 | $num_rows = $modx->db->getValue($rs); |
| 92 | 92 | |
| 93 | 93 | // ============================================================== |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
| 101 | 101 | $int_cur_position = 0; |
| 102 | 102 | } else { |
| 103 | - $int_cur_position = (int)$_REQUEST['int_cur_position']; |
|
| 103 | + $int_cur_position = (int) $_REQUEST['int_cur_position']; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Number of result to display on the page, will be in the LIMIT of the sql query also |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | $array_row_paging = $p->getPagingRowArray(); |
| 118 | 118 | |
| 119 | 119 | // Display the result as you like... |
| 120 | - $pager .= $_lang['showing'] . " " . $array_paging['lower']; |
|
| 121 | - $pager .= " " . $_lang['to'] . " " . $array_paging['upper']; |
|
| 122 | - $pager .= " (" . $array_paging['total'] . " " . $_lang['total'] . ")"; |
|
| 123 | - $pager .= "<br />" . $array_paging['previous_link'] . "<<" . (isset($array_paging['previous_link']) ? "</a> " : " "); |
|
| 120 | + $pager .= $_lang['showing']." ".$array_paging['lower']; |
|
| 121 | + $pager .= " ".$_lang['to']." ".$array_paging['upper']; |
|
| 122 | + $pager .= " (".$array_paging['total']." ".$_lang['total'].")"; |
|
| 123 | + $pager .= "<br />".$array_paging['previous_link']."<<".(isset($array_paging['previous_link']) ? "</a> " : " "); |
|
| 124 | 124 | for ($i = 0; $i < sizeof($array_row_paging); $i++) { |
| 125 | - $pager .= $array_row_paging[$i] . " "; |
|
| 125 | + $pager .= $array_row_paging[$i]." "; |
|
| 126 | 126 | } |
| 127 | - $pager .= $array_paging['next_link'] . ">>" . (isset($array_paging['next_link']) ? "</a>" : ""); |
|
| 127 | + $pager .= $array_paging['next_link'].">>".(isset($array_paging['next_link']) ? "</a>" : ""); |
|
| 128 | 128 | |
| 129 | 129 | // The above exemple print somethings like: |
| 130 | 130 | // Results 1 to 20 of 597 <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>> |
| 131 | 131 | // Of course you can now play with array_row_paging in order to print |
| 132 | 132 | // only the results you would like... |
| 133 | 133 | |
| 134 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . "", 'postdate DESC', "{$int_cur_position}, {$int_num_result}"); |
|
| 134 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()."", 'postdate DESC', "{$int_cur_position}, {$int_num_result}"); |
|
| 135 | 135 | $limit = $modx->db->getRecordCount($rs); |
| 136 | 136 | if ($limit < 1) { |
| 137 | 137 | echo $_lang['messages_no_messages']; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | <p><b><?= $_lang['messages_compose'] ?></b></p> |
| 190 | 190 | <?php |
| 191 | 191 | if (($_REQUEST['m'] == 'rp' || $_REQUEST['m'] == 'f') && isset($_REQUEST['id'])) { |
| 192 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "id='" . $_REQUEST['id'] . "'"); |
|
| 192 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_messages'), "id='".$_REQUEST['id']."'"); |
|
| 193 | 193 | $message = $modx->db->getRow($rs); |
| 194 | 194 | if (!$message) { |
| 195 | 195 | echo "Wrong number of messages returned!"; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | $subjecttext = $_REQUEST['m'] == 'rp' ? "Re: " : "Fwd: "; |
| 210 | 210 | $subjecttext .= $message['subject']; |
| 211 | - $messagetext = "\n\n\n-----\n" . $_lang['messages_from'] . ": $sendername\n" . $_lang['messages_sent'] . ": " . $modx->toDateFormat($message['postdate'] + $server_offset_time) . "\n" . $_lang['messages_subject'] . ": " . $message['subject'] . "\n\n" . $message['message']; |
|
| 211 | + $messagetext = "\n\n\n-----\n".$_lang['messages_from'].": $sendername\n".$_lang['messages_sent'].": ".$modx->toDateFormat($message['postdate'] + $server_offset_time)."\n".$_lang['messages_subject'].": ".$message['subject']."\n\n".$message['message']; |
|
| 212 | 212 | if ($_REQUEST['m'] == 'rp') { |
| 213 | 213 | $recipientindex = $message['sender']; |
| 214 | 214 | } |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | <?php |
| 297 | 297 | // count messages again, as any action on the messages page may have altered the message count |
| 298 | -$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . " and messageread=0"); |
|
| 298 | +$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()." and messageread=0"); |
|
| 299 | 299 | $_SESSION['nrnewmessages'] = $modx->db->getValue($rs); |
| 300 | -$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . ""); |
|
| 300 | +$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID().""); |
|
| 301 | 301 | $_SESSION['nrtotalmessages'] = $modx->db->getValue($rs); |
| 302 | 302 | $messagesallowed = $modx->hasPermission('messages'); |
| 303 | 303 | ?> |