@@ -28,7 +28,9 @@ discard block |
||
| 28 | 28 | 'type7' => $_lang["lock_element_type_7"], |
| 29 | 29 | 'type8' => $_lang["lock_element_type_8"] |
| 30 | 30 | ); |
| 31 | -foreach($unlockTranslations as $key => $value) $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
| 31 | +foreach($unlockTranslations as $key => $value) { |
|
| 32 | + $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
| 33 | +} |
|
| 32 | 34 | |
| 33 | 35 | // Prepare lang-strings for mgrResAction() |
| 34 | 36 | $mraTranslations = array( |
@@ -44,7 +46,9 @@ discard block |
||
| 44 | 46 | 'confirm_delete_plugin' => $_lang["confirm_delete_plugin"], |
| 45 | 47 | 'confirm_delete_module' => $_lang["confirm_delete_module"], |
| 46 | 48 | ); |
| 47 | -foreach($mraTranslations as $key => $value) $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
| 49 | +foreach($mraTranslations as $key => $value) { |
|
| 50 | + $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
| 51 | +} |
|
| 48 | 52 | ?> |
| 49 | 53 | <script>var trans = <?php echo json_encode($unlockTranslations); ?>;</script> |
| 50 | 54 | <script>var mraTrans = <?php echo json_encode($mraTranslations); ?>;</script> |
@@ -127,7 +127,9 @@ |
||
| 127 | 127 | <?php |
| 128 | 128 | // invoke OnUserSettingsRender event |
| 129 | 129 | $evtOut = $modx->invokeEvent('OnUserSettingsRender');
|
| 130 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 130 | + if(is_array($evtOut)) { |
|
| 131 | + echo implode("",$evtOut); |
|
| 132 | + } |
|
| 131 | 133 | ?> |
| 132 | 134 | </td> |
| 133 | 135 | </tr> |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | <td> |
| 24 | 24 | <select name="which_browser" size="1" class="inputBox" onchange="documentDirty=true;"> |
| 25 | 25 | <?php |
| 26 | - foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
|
|
| 26 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
| 27 | 27 | $dir = str_replace('\\', '/', $dir);
|
| 28 | 28 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
| 29 | 29 | $selected = $browser_name == $which_browser ? ' selected="selected"' : ''; |
@@ -235,7 +235,9 @@ discard block |
||
| 235 | 235 | <?php |
| 236 | 236 | // invoke OnMiscSettingsRender event |
| 237 | 237 | $evtOut = $modx->invokeEvent('OnMiscSettingsRender');
|
| 238 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 238 | + if(is_array($evtOut)) { |
|
| 239 | + echo implode("",$evtOut); |
|
| 240 | + } |
|
| 239 | 241 | ?> |
| 240 | 242 | </td> |
| 241 | 243 | </tr> |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | <select name="manager_theme" size="1" class="inputBox" onChange="documentDirty=true; document.forms['settings'].theme_refresher.value = Date.parse(new Date());"> |
| 50 | 50 | <?php |
| 51 | 51 | $dir = dir("media/style/");
|
| 52 | - while ($file = $dir->read()) {
|
|
| 53 | - if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
|
|
| 54 | - if ($file === 'common') {
|
|
| 52 | + while ($file = $dir->read()) { |
|
| 53 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
| 54 | + if ($file === 'common') { |
|
| 55 | 55 | continue; |
| 56 | 56 | } |
| 57 | 57 | $themename = $file; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n"; |
| 210 | 210 | $option = explode(',', $_lang['settings_group_tv_options']);
|
| 211 | 211 | $output = array(); |
| 212 | - foreach ($option as $k => $v) {
|
|
| 212 | + foreach ($option as $k => $v) { |
|
| 213 | 213 | $selected = ($k == $group_tvs) ? 'selected' : ''; |
| 214 | 214 | $s = array('[+value+]', '[+selected+]', '[+title+]');
|
| 215 | 215 | $r = array($k, $selected, $v); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n"; |
| 283 | 283 | $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon');
|
| 284 | 284 | $output = array(); |
| 285 | - foreach ($option as $v) {
|
|
| 285 | + foreach ($option as $v) { |
|
| 286 | 286 | $selected = ($v == $resource_tree_node_name) ? 'selected' : ''; |
| 287 | 287 | $s = array('[+value+]', '[+selected+]');
|
| 288 | 288 | $r = array($v, $selected); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | <?php |
| 364 | 364 | $datetime_format_list = array('dd-mm-YYYY', 'mm/dd/YYYY', 'YYYY/mm/dd');
|
| 365 | 365 | $str = ''; |
| 366 | - foreach ($datetime_format_list as $value) {
|
|
| 366 | + foreach ($datetime_format_list as $value) { |
|
| 367 | 367 | $selectedtext = ($datetime_format == $value) ? ' selected' : ''; |
| 368 | 368 | $str .= '<option value="' . $value . '"' . $selectedtext . '>'; |
| 369 | 369 | $str .= $value . '</option>' . PHP_EOL; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | <?php |
| 446 | 446 | // invoke OnRichTextEditorRegister event |
| 447 | 447 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister');
|
| 448 | - if (!is_array($evtOut)) {
|
|
| 448 | + if (!is_array($evtOut)) { |
|
| 449 | 449 | $evtOut = array(); |
| 450 | 450 | $use_editor = 0; |
| 451 | 451 | } |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | <?php |
| 478 | 478 | // invoke OnRichTextEditorRegister event |
| 479 | 479 | echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n"; |
| 480 | - if (is_array($evtOut)) {
|
|
| 481 | - foreach ($evtOut as $editor) {
|
|
| 480 | + if (is_array($evtOut)) { |
|
| 481 | + foreach ($evtOut as $editor) { |
|
| 482 | 482 | echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
| 483 | 483 | } |
| 484 | 484 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | <?php |
| 535 | 535 | // invoke OnInterfaceSettingsRender event |
| 536 | 536 | $evtOut = $modx->invokeEvent('OnInterfaceSettingsRender');
|
| 537 | - if (is_array($evtOut)) {
|
|
| 537 | + if (is_array($evtOut)) { |
|
| 538 | 538 | echo implode("", $evtOut);
|
| 539 | 539 | } |
| 540 | 540 | ?> |
@@ -82,23 +82,23 @@ discard block |
||
| 82 | 82 | <?php |
| 83 | 83 | |
| 84 | 84 | $currentCategory = ''; |
| 85 | - while ($row = $modx->db->getRow($rs)) {
|
|
| 85 | + while ($row = $modx->db->getRow($rs)) { |
|
| 86 | 86 | $thisCategory = $row['category']; |
| 87 | - if($thisCategory == null) {
|
|
| 87 | + if($thisCategory == null) { |
|
| 88 | 88 | $thisCategory = $_lang['no_category']; |
| 89 | 89 | } |
| 90 | - if($thisCategory != $currentCategory) {
|
|
| 91 | - if($closeOptGroup) {
|
|
| 90 | + if($thisCategory != $currentCategory) { |
|
| 91 | + if($closeOptGroup) { |
|
| 92 | 92 | echo "\t\t\t\t\t</optgroup>\n"; |
| 93 | 93 | } |
| 94 | 94 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
| 95 | 95 | $closeOptGroup = true; |
| 96 | - } else {
|
|
| 96 | + } else { |
|
| 97 | 97 | $closeOptGroup = false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $selectedtext = $row['id'] == $default_template ? ' selected="selected"' : ''; |
| 101 | - if ($selectedtext) {
|
|
| 101 | + if ($selectedtext) { |
|
| 102 | 102 | $oldTmpId = $row['id']; |
| 103 | 103 | $oldTmpName = $row['templatename']; |
| 104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
| 107 | 107 | $currentCategory = $thisCategory; |
| 108 | 108 | } |
| 109 | - if($thisCategory != '') {
|
|
| 109 | + if($thisCategory != '') { |
|
| 110 | 110 | echo "\t\t\t\t\t</optgroup>\n"; |
| 111 | 111 | } |
| 112 | 112 | ?> |
@@ -138,11 +138,12 @@ discard block |
||
| 138 | 138 | $modx->db->select('id', '[+prefix+]site_plugins',
|
| 139 | 139 | "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
| 140 | 140 | ); |
| 141 | - if($count) {
|
|
| 141 | + if($count) { |
|
| 142 | 142 | $disabledFilters = 1; |
| 143 | 143 | echo '<b>'.$_lang['enable_filter_phx_warning'].'</b><br/>'; |
| 144 | - } |
|
| 145 | - else $disabledFilters = false; |
|
| 144 | + } else { |
|
| 145 | + $disabledFilters = false; |
|
| 146 | + } |
|
| 146 | 147 | ?> |
| 147 | 148 | <?php echo wrap_label($_lang['yes'],form_radio('enable_filter', 1, '', $disabledFilters));?><br />
|
| 148 | 149 | <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters));?>
|
@@ -204,7 +205,7 @@ discard block |
||
| 204 | 205 | <select name="lst_custom_contenttype" style="width:200px;height:100px;" size="5"> |
| 205 | 206 | <?php |
| 206 | 207 | $ct = explode(",",$custom_contenttype);
|
| 207 | - for($i=0;$i<count($ct);$i++) {
|
|
| 208 | + for($i=0;$i<count($ct);$i++) { |
|
| 208 | 209 | echo "<option value=\"".$ct[$i]."\">".$ct[$i]."</option>"; |
| 209 | 210 | } |
| 210 | 211 | ?> |
@@ -259,7 +260,7 @@ discard block |
||
| 259 | 260 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
| 260 | 261 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
| 261 | 262 | <?php |
| 262 | - for($i=-24; $i<25; $i++) {
|
|
| 263 | + for($i=-24; $i<25; $i++) { |
|
| 263 | 264 | $seconds = $i*60*60; |
| 264 | 265 | $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
| 265 | 266 | ?> |
@@ -296,7 +297,9 @@ discard block |
||
| 296 | 297 | <?php |
| 297 | 298 | // invoke OnSiteSettingsRender event |
| 298 | 299 | $evtOut = $modx->invokeEvent('OnSiteSettingsRender');
|
| 299 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 300 | + if(is_array($evtOut)) { |
|
| 301 | + echo implode("",$evtOut); |
|
| 302 | + } |
|
| 300 | 303 | ?> |
| 301 | 304 | </td> |
| 302 | 305 | </tr> |
@@ -15,8 +15,14 @@ |
||
| 15 | 15 | <td > |
| 16 | 16 | <select name="smtp_secure" size="1" class="inputBox"> |
| 17 | 17 | <option value="none" ><?php echo $_lang['no'] ?></option> |
| 18 | - <option value="ssl" <?php if($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
| 19 | - <option value="tls" <?php if($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
| 18 | + <option value="ssl" <?php if($smtp_secure == 'ssl') { |
|
| 19 | + echo "selected='selected'"; |
|
| 20 | +} |
|
| 21 | +?> >SSL</option> |
|
| 22 | + <option value="tls" <?php if($smtp_secure == 'tls') { |
|
| 23 | + echo "selected='selected'"; |
|
| 24 | +} |
|
| 25 | +?> >TLS</option> |
|
| 20 | 26 | </select> |
| 21 | 27 | <br /> |
| 22 | 28 | </td> |
@@ -159,7 +159,9 @@ |
||
| 159 | 159 | <?php |
| 160 | 160 | // invoke OnFriendlyURLSettingsRender event |
| 161 | 161 | $evtOut = $modx->invokeEvent('OnFriendlyURLSettingsRender');
|
| 162 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 162 | + if(is_array($evtOut)) { |
|
| 163 | + echo implode("",$evtOut); |
|
| 164 | + } |
|
| 163 | 165 | ?> |
| 164 | 166 | </td> |
| 165 | 167 | </tr> |
@@ -29,10 +29,12 @@ |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 32 | + <?php if($num_rows_pub) { |
|
| 33 | + printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | 34 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 35 | <?php |
| 35 | 36 | $modx->clearCache('full', true); |
| 37 | +} |
|
| 36 | 38 | // invoke OnSiteRefresh event |
| 37 | 39 | $modx->invokeEvent("OnSiteRefresh"); |
| 38 | 40 | ?> |
@@ -66,111 +66,111 @@ |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | switch ($_POST['mode']) { |
| 69 | - case '23': // Save new snippet |
|
| 70 | - |
|
| 71 | - // invoke OnBeforeSnipFormSave event |
|
| 72 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
| 73 | - "mode" => "new", |
|
| 74 | - "id" => $id |
|
| 75 | - )); |
|
| 76 | - |
|
| 77 | - // disallow duplicate names for new snippets |
|
| 78 | - $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
| 79 | - $count = $modx->db->getValue($rs); |
|
| 80 | - if ($count > 0) { |
|
| 81 | - $modx->manager->saveFormValues(23); |
|
| 82 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - //do stuff to save the new doc |
|
| 86 | - $newid = $modx->db->insert(array( |
|
| 87 | - 'name' => $name, |
|
| 88 | - 'description' => $description, |
|
| 89 | - 'snippet' => $snippet, |
|
| 90 | - 'moduleguid' => $moduleguid, |
|
| 91 | - 'locked' => $locked, |
|
| 92 | - 'properties' => $properties, |
|
| 93 | - 'category' => $categoryid, |
|
| 94 | - 'disabled' => $disabled, |
|
| 95 | - 'createdon' => $currentdate, |
|
| 96 | - 'editedon' => $currentdate |
|
| 97 | - ), $modx->getFullTableName('site_snippets')); |
|
| 98 | - |
|
| 99 | - // invoke OnSnipFormSave event |
|
| 100 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
| 101 | - "mode" => "new", |
|
| 102 | - "id" => $newid |
|
| 103 | - )); |
|
| 104 | - |
|
| 105 | - // Set the item name for logger |
|
| 106 | - $_SESSION['itemname'] = $name; |
|
| 107 | - |
|
| 108 | - // empty cache |
|
| 109 | - $modx->clearCache('full'); |
|
| 110 | - |
|
| 111 | - // finished emptying cache - redirect |
|
| 112 | - if ($_POST['stay'] != '') { |
|
| 113 | - $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
| 114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 115 | - header($header); |
|
| 116 | - } else { |
|
| 117 | - $header = "Location: index.php?a=76&r=2"; |
|
| 118 | - header($header); |
|
| 119 | - } |
|
| 120 | - break; |
|
| 121 | - case '22': // Save existing snippet |
|
| 122 | - // invoke OnBeforeSnipFormSave event |
|
| 123 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
| 124 | - "mode" => "upd", |
|
| 125 | - "id" => $id |
|
| 126 | - )); |
|
| 127 | - |
|
| 128 | - // disallow duplicate names for snippets |
|
| 129 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
| 130 | - if ($modx->db->getValue($rs) > 0) { |
|
| 131 | - $modx->manager->saveFormValues(22); |
|
| 132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - //do stuff to save the edited doc |
|
| 136 | - $modx->db->update(array( |
|
| 137 | - 'name' => $name, |
|
| 138 | - 'description' => $description, |
|
| 139 | - 'snippet' => $snippet, |
|
| 140 | - 'moduleguid' => $moduleguid, |
|
| 141 | - 'locked' => $locked, |
|
| 142 | - 'properties' => $properties, |
|
| 143 | - 'category' => $categoryid, |
|
| 144 | - 'disabled' => $disabled, |
|
| 145 | - 'editedon' => $currentdate |
|
| 146 | - ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
| 147 | - |
|
| 148 | - // invoke OnSnipFormSave event |
|
| 149 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
| 150 | - "mode" => "upd", |
|
| 151 | - "id" => $id |
|
| 152 | - )); |
|
| 153 | - |
|
| 154 | - // Set the item name for logger |
|
| 155 | - $_SESSION['itemname'] = $name; |
|
| 156 | - |
|
| 157 | - // empty cache |
|
| 158 | - $modx->clearCache('full'); |
|
| 159 | - |
|
| 160 | - if ($_POST['runsnippet']) { |
|
| 161 | - run_snippet($snippet); |
|
| 162 | - } |
|
| 163 | - // finished emptying cache - redirect |
|
| 164 | - if ($_POST['stay'] != '') { |
|
| 165 | - $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
| 166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 167 | - header($header); |
|
| 168 | - } else { |
|
| 169 | - $modx->unlockElement(4, $id); |
|
| 170 | - $header = "Location: index.php?a=76&r=2"; |
|
| 171 | - header($header); |
|
| 172 | - } |
|
| 173 | - break; |
|
| 174 | - default: |
|
| 175 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 69 | + case '23': // Save new snippet |
|
| 70 | + |
|
| 71 | + // invoke OnBeforeSnipFormSave event |
|
| 72 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
| 73 | + "mode" => "new", |
|
| 74 | + "id" => $id |
|
| 75 | + )); |
|
| 76 | + |
|
| 77 | + // disallow duplicate names for new snippets |
|
| 78 | + $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
| 79 | + $count = $modx->db->getValue($rs); |
|
| 80 | + if ($count > 0) { |
|
| 81 | + $modx->manager->saveFormValues(23); |
|
| 82 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + //do stuff to save the new doc |
|
| 86 | + $newid = $modx->db->insert(array( |
|
| 87 | + 'name' => $name, |
|
| 88 | + 'description' => $description, |
|
| 89 | + 'snippet' => $snippet, |
|
| 90 | + 'moduleguid' => $moduleguid, |
|
| 91 | + 'locked' => $locked, |
|
| 92 | + 'properties' => $properties, |
|
| 93 | + 'category' => $categoryid, |
|
| 94 | + 'disabled' => $disabled, |
|
| 95 | + 'createdon' => $currentdate, |
|
| 96 | + 'editedon' => $currentdate |
|
| 97 | + ), $modx->getFullTableName('site_snippets')); |
|
| 98 | + |
|
| 99 | + // invoke OnSnipFormSave event |
|
| 100 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
| 101 | + "mode" => "new", |
|
| 102 | + "id" => $newid |
|
| 103 | + )); |
|
| 104 | + |
|
| 105 | + // Set the item name for logger |
|
| 106 | + $_SESSION['itemname'] = $name; |
|
| 107 | + |
|
| 108 | + // empty cache |
|
| 109 | + $modx->clearCache('full'); |
|
| 110 | + |
|
| 111 | + // finished emptying cache - redirect |
|
| 112 | + if ($_POST['stay'] != '') { |
|
| 113 | + $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
| 114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 115 | + header($header); |
|
| 116 | + } else { |
|
| 117 | + $header = "Location: index.php?a=76&r=2"; |
|
| 118 | + header($header); |
|
| 119 | + } |
|
| 120 | + break; |
|
| 121 | + case '22': // Save existing snippet |
|
| 122 | + // invoke OnBeforeSnipFormSave event |
|
| 123 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
| 124 | + "mode" => "upd", |
|
| 125 | + "id" => $id |
|
| 126 | + )); |
|
| 127 | + |
|
| 128 | + // disallow duplicate names for snippets |
|
| 129 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
| 130 | + if ($modx->db->getValue($rs) > 0) { |
|
| 131 | + $modx->manager->saveFormValues(22); |
|
| 132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + //do stuff to save the edited doc |
|
| 136 | + $modx->db->update(array( |
|
| 137 | + 'name' => $name, |
|
| 138 | + 'description' => $description, |
|
| 139 | + 'snippet' => $snippet, |
|
| 140 | + 'moduleguid' => $moduleguid, |
|
| 141 | + 'locked' => $locked, |
|
| 142 | + 'properties' => $properties, |
|
| 143 | + 'category' => $categoryid, |
|
| 144 | + 'disabled' => $disabled, |
|
| 145 | + 'editedon' => $currentdate |
|
| 146 | + ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
| 147 | + |
|
| 148 | + // invoke OnSnipFormSave event |
|
| 149 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
| 150 | + "mode" => "upd", |
|
| 151 | + "id" => $id |
|
| 152 | + )); |
|
| 153 | + |
|
| 154 | + // Set the item name for logger |
|
| 155 | + $_SESSION['itemname'] = $name; |
|
| 156 | + |
|
| 157 | + // empty cache |
|
| 158 | + $modx->clearCache('full'); |
|
| 159 | + |
|
| 160 | + if ($_POST['runsnippet']) { |
|
| 161 | + run_snippet($snippet); |
|
| 162 | + } |
|
| 163 | + // finished emptying cache - redirect |
|
| 164 | + if ($_POST['stay'] != '') { |
|
| 165 | + $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
| 166 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 167 | + header($header); |
|
| 168 | + } else { |
|
| 169 | + $modx->unlockElement(4, $id); |
|
| 170 | + $header = "Location: index.php?a=76&r=2"; |
|
| 171 | + header($header); |
|
| 172 | + } |
|
| 173 | + break; |
|
| 174 | + default: |
|
| 175 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 176 | 176 | } |