/** * check for csrfs * @param string $action action to pass to check_nonce * @param string $file file to pass to check_nonce * @param bool $die if false return instead of die * @return bool returns true if csrf check fails */ function check_for_csrf($action, $file = "", $die = true) { // check for csrf if (!getDef('GSNOCSRF', true)) { $nonce = $_REQUEST['nonce']; if (!check_nonce($nonce, $action, $file)) { exec_action('csrf'); // @hook csrf a csrf was detected if (requestIsAjax()) { $error = i18n_r("CSRF", "CRSF Detected!"); echo "<div>"; // jquery bug will not parse 1 html element so we wrap it include 'template/error_checking.php'; echo "</div>"; die; } if ($die) { die(i18n_r("CSRF", "CRSF Detected!")); } return true; } } }
<div class="main"> <?php if (function_exists($plugin_info[$plugin_id]['load_data'])) { call_user_func_array($plugin_info[$plugin_id]['load_data'], array()); } ?> </div> </div> <div id="sidebar" > <?php $res = @(include 'template/sidebar-' . $plugin_info[$plugin_id]['page_type'] . '.php'); if (!$res) { ?> <ul class="snav"> <?php exec_action($plugin_info[$plugin_id]['page_type'] . "-sidebar"); ?> </ul> <?php } // call sidebar extra hook for plugin page_type exec_action($plugin_info[$plugin_id]['page_type'] . "-sidebar-extra"); ?> </div> </div> <?php get_template('footer');
i18n('USERNAME'); ?> :</b><br /><input type="text" class="text" id="userid" name="userid" /></p> <p><b><?php i18n('PASSWORD'); ?> :</b><br /><input type="password" class="text" id="pwd" name="pwd" /></p> <p><input type="submit" name="submitted" class="submit" value="<?php i18n('LOGIN'); ?> " /></p> </form> <p class="cta" ><b>«</b> <a href="<?php echo $SITEURL; ?> "><?php i18n('BACK_TO_WEBSITE'); ?> </a> | <a href="resetpassword.php"><?php i18n('FORGOT_PWD'); ?> </a> »</p> <div class="reqs" ><?php exec_action('login-reqs'); ?> </div> </div> </div> </div> <?php get_template('footer');
</label></p> </div> <?php if ($editing) { exec_action('profile-extras-edit'); } // @hook profile-extras-edit extra profile settings when editing existing users if ($adding) { exec_action('profile-extras-add'); } // @hook profile-extras-add extra profile settings when adding new user if (!$editing && !$adding) { exec_action('settings-user-extras'); } // @hook settings-user-extras LEGACY extra user profile settings html, not enabled for edit and adds in 3.4 exec_action('profile-extras'); // @hook profile-extras extra profile settings ?> <p class="section" style="margin:0px 0 5px 10px;font-size:12px;color:#999;" ><?php $adding === true ? i18n('PROVIDE_PASSWORD') : i18n('ONLY_NEW_PASSWORD'); ?> :</p> <div class="leftsec"> <p><label for="sitepwd" ><?php $adding === true ? i18n('PASSWORD') : i18n('NEW_PASSWORD'); ?> :</label><input autocomplete="off" class="text" id="sitepwd" name="sitepwd" type="password" value="" /></p> </div> <div class="rightsec"> <p><label for="sitepwd_confirm" ><?php
echo find_accesskey(i18n_r('TAB_BACKUPS')); ?> " ><?php i18n('TAB_BACKUPS'); ?> </a></li> <li id="nav_plugins" ><a class="plugins" href="plugins.php" accesskey="<?php echo find_accesskey(i18n_r('PLUGINS_NAV')); ?> " ><?php i18n('PLUGINS_NAV'); ?> </a></li> <?php exec_action('nav-tab'); ?> <li id="nav_loaderimg" ><img class="toggle" id="loader" src="template/images/ajax.gif" alt="" /></li> <li class="rightnav" ><a class="settings first" href="settings.php" accesskey="<?php echo find_accesskey(i18n_r('TAB_SETTINGS')); ?> " ><?php i18n('TAB_SETTINGS'); ?> </a></li> <li class="rightnav" ><a class="support last" href="support.php" accesskey="<?php echo find_accesskey(i18n_r('TAB_SUPPORT')); ?> " ><?php i18n('TAB_SUPPORT');
if ($page['menuStatus'] == 'Y') { $pagePriority = '1.0'; } else { $pagePriority = '0.5'; } //add to sitemap $url_item = $xml->addChild('url'); $url_item->addChild('loc', $pageLoc); $url_item->addChild('lastmod', $pageLastMod); $url_item->addChild('changefreq', $pageChangeFreq); $url_item->addChild('priority', $pagePriority); exec_action('sitemap-additem'); } //create xml file $file = $relative . 'sitemap.xml'; exec_action('save-sitemap'); XMLsave($xml, $file); } } // Variables for website $spath = $relative . 'data/other/'; $sfile = "website.xml"; $data = getXML($spath . $sfile); $SITEURL = $data->SITEURL; if (!defined('GSDONOTPING')) { if (file_exists($relative . 'sitemap.xml')) { if (200 === ($status = pingGoogleSitemaps($SITEURL . 'sitemap.xml'))) { $response = $i18n['SITEMAP_CREATED']; header('location: theme.php?success=' . $response); exit; } else {
$fileOwnerName = isset($fileOwner['name']) ? $fileOwner['name'] : ''; } else { $fileOwnerName = getenv('USERNAME'); } echo '<td style="width:70px;text-align:right;"><span>' . $fileOwnerName . '/' . $filePerms . '</span></td>'; } echo '<td class="file_date right"><span class="' . (dateIsToday($upload['date']) ? 'datetoday' : '') . '">' . output_date($upload['date']) . '</span></td>'; // delete echo '<td class="delete">'; if ($allowdelete) { echo '<a class="delconfirm" title="' . i18n_r('DELETE_FILE') . ': ' . htmlspecialchars($upload['name']) . '" href="deletefile.php?file=' . rawurlencode($upload['name']) . '&path=' . $urlPath . '&nonce=' . get_nonce("delete", "deletefile.php") . '">×</a>'; } echo '</td></tr>'; } } exec_action('file-extras'); // @hook file-extras after file list table rows echo '</tbody></table>'; if ($counter > 0) { $sizedesc = '(' . fSize($totalsize) . ')'; } else { $sizedesc = ''; } $totalcount = (int) $counter + (int) $foldercount; echo '<p><em><b><span id="pg_counter">' . $totalcount . '</span></b> ' . i18n_r('TOTAL_FILES') . ' ' . $sizedesc . '</em></p>'; ?> </div> </div> </div> <?php if ($allowupload) {
public function clear() { if (is_file($this->_xmlfile)) { $res = unlink($this->_xmlfile); exec_action('logfile_delete'); return $res; } }
<?php if (!getDef('GSNOSITEMAP')) { ?> <li id="sb_sitemap" class="last_sb"><a href="sitemap.php" <?php check_menu('sitemap'); ?> accesskey="<?php echo find_accesskey(i18n_r('SIDE_VIEW_SITEMAP')); ?> " ><?php i18n('SIDE_VIEW_SITEMAP'); ?> </a></li> <?php } ?> <?php exec_action("theme-sidebar"); ?> </ul> <?php if (get_filename_id() === 'components' || get_filename_id() === 'theme-edit') { ?> <p id="js_submit_line" ></p> <?php } ?>
/** * Creates Sitemap * * Creates sitemap.xml in the site's root. * Pending: read the content path (xml's) */ function generate_sitemap() { // Variable settings global $SITEURL; $path = GSDATAPAGESPATH; $count = "0"; $filenames = getFiles($path); if (count($filenames) != 0) { foreach ($filenames as $file) { if (isFile($file, $path, 'xml')) { $data = getXML($path . $file); if ($data->url != '404') { $status = $data->menuStatus; $pagesArray[$count]['url'] = $data->url; $pagesArray[$count]['parent'] = $data->parent; $pagesArray[$count]['date'] = $data->pubDate; $pagesArray[$count]['private'] = $data->private; $pagesArray[$count]['menuStatus'] = $data->menuStatus; $count++; } } } } $pagesSorted = subval_sort($pagesArray, 'menuStatus'); if (count($pagesSorted) != 0) { $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>'); $xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance'); $xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9'); foreach ($pagesSorted as $page) { if ($page['private'] != 'Y') { // set <loc> $pageLoc = find_url($page['url'], $page['parent']); // set <lastmod> $tmpDate = date("Y-m-d H:i:s", strtotime($page['date'])); $pageLastMod = makeIso8601TimeStamp($tmpDate); // set <changefreq> $pageChangeFreq = 'weekly'; // set <priority> if ($page['menuStatus'] == 'Y') { $pagePriority = '1.0'; } else { $pagePriority = '0.5'; } //add to sitemap $url_item = $xml->addChild('url'); $url_item->addChild('loc', $pageLoc); $url_item->addChild('lastmod', $pageLastMod); $url_item->addChild('changefreq', $pageChangeFreq); $url_item->addChild('priority', $pagePriority); exec_action('sitemap-additem'); } } //create xml file $file = GSROOTPATH . 'sitemap.xml'; exec_action('save-sitemap'); XMLsave($xml, $file); } if (!defined('GSDONOTPING')) { if (file_exists(GSROOTPATH . 'sitemap.xml')) { if (200 === ($status = pingGoogleSitemaps($SITEURL . 'sitemap.xml'))) { #sitemap successfully created & pinged return true; } else { error_log(i18n_r('SITEMAP_ERRORPING')); return i18n_r('SITEMAP_ERRORPING'); } } else { error_log(i18n_r('SITEMAP_ERROR')); return i18n_r('SITEMAP_ERROR'); } } else { #sitemap successfully created - did not ping return true; } }
?" id="delback" accesskey="<?php echo find_accesskey(i18n_r('ASK_DELETE')); ?> " class="delconfirm noajax" ><?php i18n('ASK_DELETE'); ?> </a> <?php exec_action(get_filename_id() . '-edit-nav'); ?> </div> <?php exec_action(get_filename_id() . '-body'); ?> <table class="simple highlight" > <tr><td class="title" ><?php i18n('PAGE_TITLE'); ?> :</td><td><b><?php echo cl($title); ?> </b> <?php echo $private; ?> </td></tr> <tr><td class="title" ><?php i18n('BACKUP_OF');
$authenticated = false; # add login failure to failed logins log $logFailed = new GS_Logging_Class('failedlogins.log'); $logFailed->add('Username', $userid); $logFailed->add('Reason', 'Invalid Password'); } # end password match check } else { # user doesnt exist in this system $authenticated = false; # add login failure to failed logins log $logFailed = new GS_Logging_Class('failedlogins.log'); $logFailed->add('Username', $userid); $logFailed->add('Reason', 'Invalid User'); } # is this successful? if ($authenticated) { # YES - set the login cookie, then redirect user to secure panel create_cookie(); exec_action('successful-login-end'); redirect($cookie_redirect); } else { # NO - show error message $error = i18n_r('LOGIN_FAILED'); $logFailed->save(); } # end authenticated check } # end error check } # end submission check
foreach ($pluginfiles as $fi) { $pathExt = pathinfo($fi, PATHINFO_EXTENSION); $pathName = pathinfo($fi, PATHINFO_FILENAME); if ($pathExt == "php") { $table .= '<tr id="tr-' . $counter . '" >'; $table .= '<td width="25%" ><b>' . $plugin_info[$pathName]['name'] . '</b></td>'; $table .= '<td><span>' . $plugin_info[$pathName]['description'] . '<br />'; $table .= $i18n['PLUGIN_VER'] . ' ' . $plugin_info[$pathName]['version'] . ' | By <a href="' . $plugin_info[$pathName]['author_url'] . '" target="_blank">' . $plugin_info[$pathName]['author'] . '</a></span></td>'; $table .= "</tr>\n"; $counter++; } } ?> <?php exec_action('plugin-hook'); ?> <?php get_template('header', cl($SITENAME) . ' » ' . $i18n['PLUGINS_MANAGEMENT']); ?> <h1><a href="<?php echo $SITEURL; ?> " target="_blank" ><?php echo cl($SITENAME); ?> </a> <span>»</span> <?php echo $i18n['PLUGINS_MANAGEMENT']; ?>
function create_pagesxmlContent($flag) { global $pagesArray; if (isset($_GET['upd']) && $_GET['upd'] == "edit-success" || $flag == 'true') { $menu = ''; $filem = CATEGORIESPATH . "pages.xml"; $path = CONTENTPATH; $dir_handle = @opendir($path) or die("Unable to open {$path}"); $filenames = array(); while ($filename = readdir($dir_handle)) { $ext = substr($filename, strrpos($filename, '.') + 1); if ($ext == "xml") { $filenames[] = $filename; } } $count = 0; $xml = @new SimpleXMLExtended('<channel></channel>'); if (count($filenames) != 0) { foreach ($filenames as $file) { if ($file == "." || $file == ".." || is_dir(CONTENTPATH . $file) || $file == ".htaccess") { // not a page data file } else { $thisfile = file_get_contents($path . $file); $data = simplexml_load_string($thisfile); $count++; $id = $data->url; $pages = $xml->addChild('item'); $pages->addChild('url', $id); $pagesArray[(string) $id]['url'] = (string) $id; foreach ($data->children() as $item => $itemdata) { if ($item != "content") { $note = $pages->addChild($item); $note->addCData($itemdata); $pagesArray[(string) $id][$item] = (string) $itemdata; } } $note = $pages->addChild('slug'); $note->addCData($id); $pagesArray[(string) $id]['slug'] = (string) $data->slug; $pagesArray[(string) $id]['filename'] = $file; $note = $pages->addChild('filename'); $note->addCData($file); // Plugin Authors should add custome fields etc.. here exec_action('caching-save'); } // else } // end foreach } // endif if ($flag == true) { $xml->asXML($filem); } } }
public static function outputHeader($full = true, $omit = null) { global $metad, $metak, $title, $content, $url, $parent, $language; include GSADMININCPATH . 'configuration.php'; if ($metad != '') { $description = stripslashes(htmlspecialchars_decode($metad, ENT_QUOTES)); } else { if (function_exists('mb_substr')) { $description = trim(mb_substr(html_entity_decode(strip_tags(stripslashes(htmlspecialchars_decode($content, ENT_QUOTES))), ENT_QUOTES, 'UTF-8'), 0, 160)); } else { $description = trim(substr(html_entity_decode(strip_tags(stripslashes(htmlspecialchars_decode($content, ENT_QUOTES))), ENT_QUOTES, 'UTF-8'), 0, 160)); } $description = preg_replace('/\\(%.*?%\\)/', " ", $description); $description = preg_replace('/\\{%.*?%\\}/', " ", $description); $description = preg_replace('/\\n/', " ", $description); $description = preg_replace('/\\r/', " ", $description); $description = preg_replace('/\\t/', " ", $description); $description = preg_replace('/ +/', " ", $description); } $keywords = array(); $tags = preg_split("/\\s*,\\s*/", stripslashes(htmlspecialchars_decode($metak, ENT_QUOTES))); if (count($tags) > 0) { foreach ($tags as $tag) { if (substr(trim($tag), 0, 1) != '_') { $keywords[] = trim($tag); } } } if (!$omit || !in_array('description', $omit)) { echo '<meta name="description" content="' . htmlspecialchars(trim($description)) . '" />' . "\n"; } if (!$omit || !in_array('keywords', $omit)) { echo '<meta name="keywords" content="' . htmlspecialchars(implode(', ', $keywords)) . '" />' . "\n"; } if ($full) { if (!$omit || !in_array('generator', $omit)) { echo '<meta name="generator" content="' . $site_full_name . '" />' . "\n"; } if (!$omit || !in_array('canonical', $omit)) { echo '<link rel="canonical" href="' . find_i18n_url($url, $parent, $language) . '" />' . "\n"; } } if (function_exists('get_scripts_frontend')) { get_scripts_frontend(); } exec_action('theme-header'); }
function i18n_navigation_structure_undo() { $dir = GSBACKUPSPATH . 'i18n_navigation/'; $dir_handle = @opendir($dir); if (!$dir_handle) { return false; } while ($filename = readdir($dir_handle)) { if (!is_dir($dir . $filename)) { if (!copy($dir . $filename, GSDATAPAGESPATH . $filename)) { closedir($dir_handle); return false; } } } closedir($dir_handle); exec_action('menu-aftersave'); return true; }
<?php exec_action('welcome-doc-link'); ?> </ul> <h3><?php i18n('SUPPORT'); ?> </h3> <ul> <li><p><a href="log.php?log=failedlogins.log"><?php i18n('VIEW_FAILED_LOGIN'); ?> </a></p></li> <?php exec_action('support-extras'); ?> </ul> </div> </div> <div id="sidebar" > <?php include 'template/sidebar-support.php'; ?> </div> </div> <?php get_template('footer');
if (!defined('GSNOCSRF') || GSNOCSRF == FALSE) { $nonce = $_GET['nonce']; if (!check_nonce($nonce, "delete", "deletefile.php")) { die("CSRF detected!"); } } // are we deleting pages? if (isset($_GET['id'])) { $id = $_GET['id']; if ($id == 'index') { redirect('pages.php?upd=edit-error&type=' . urlencode(i18n_r('HOMEPAGE_DELETE_ERROR'))); } else { updateSlugs($id); $status = delete_file($id); generate_sitemap(); exec_action('page-delete'); redirect("pages.php?upd=edit-" . $status . "&id=" . $id . "&type=delete"); } } // are we deleting archives? if (isset($_GET['zip'])) { $zip = $_GET['zip']; $status = delete_zip($zip); redirect("archive.php?upd=del-" . $status . "&id=" . $zip); } // are we deleting uploads? if (isset($_GET['file'])) { $path = isset($_GET['path']) ? $_GET['path'] : ""; $file = $_GET['file']; $status = delete_upload($file, $path); redirect("upload.php?upd=del-" . $status . "&id=" . $file . "&path=" . $path);
?> </a></li><?php } ?> <li id="sb_menumanager" class="last_sb"><a href="menu-manager.php" accesskey="<?php echo find_accesskey(i18n_r('MENU_MANAGER')); ?> " <?php check_menu('menu-manager'); ?> ><?php i18n('MENU_MANAGER'); ?> </a></li> <?php exec_action("pages-sidebar"); // @hook pages-sidebar sidebar list html output ?> </ul> <p id="js_submit_line" ></p> <?php if (get_filename_id() === 'edit') { ?> <?php if (getDef('GSAUTOSAVE')) { ?> <p id="autosavestatus"><?php echo sprintf(i18n_r("AUTOSAVE_STATUS"), getDef('GSAUTOSAVE')); ?>
<p>© 2009-<?php echo date('Y'); ?> <a href="http://get-simple.info/" target="_blank" >GetSimple CMS</a> <?php echo '– ' . i18n_r('VERSION') . ' ' . $site_version_no; ?> </p> </div> <!-- end .footer-left --> <div class="gslogo" > <a href="http://get-simple.info/" target="_blank" ><img src="template/images/getsimple_logo.gif" alt="GetSimple Content Management System" /></a> </div> <div class="clear"></div> <?php get_scripts_backend(TRUE); exec_action('footer'); } ?> </div><!-- end #footer --> <?php if (!isAuthPage()) { if (isDebug()) { global $GS_debug; echo '<h2>' . i18n_r('DEBUG_CONSOLE') . '</h2><div id="gsdebug">'; echo '<pre>'; foreach ($GS_debug as $log) { if (is_array($log)) { print_r($log) . '<br/>'; } else { print $log . '<br/>';
// @hook header backend before html head closes ?> <noscript> <style> .tab{ display:block; clear:both;} .tab fieldset legend{ display: block; } #cm_themeselect, #cm_themeselect_label { display:none;} #theme_filemanager ul ul { display: block; } </style> </noscript> </head> <?php $headerclass = getDef('GSHEADERCLASS', true) ? getDef('GSHEADERCLASS') : ''; ?> <body <?php filename_id(); echo ' class="' . $bodyclass . '"'; ?> > <div class="header <?php echo $headerclass; ?> " id="header" > <div class="wrapper clearfix"> <?php exec_action('header-body'); // @hook header-body backend header body wrapper html
*/ ?> <ul class="snav"> <li><a href="settings.php" accesskey="<?php echo find_accesskey(i18n_r('SIDE_GEN_SETTINGS')); ?> " <?php check_menu('settings'); ?> ><?php i18n('SIDE_GEN_SETTINGS'); ?> </a></li> <li><a href="settings.php#profile" accesskey="<?php echo find_accesskey(i18n_r('SIDE_USER_PROFILE')); ?> " ><?php i18n('SIDE_USER_PROFILE'); ?> </a></li> <?php exec_action("settings-sidebar"); ?> </ul> <?php if (get_filename_id() === 'settings') { ?> <p id="js_submit_line" ></p> <?php }
/** * Redirect URL * * @since 3.0 * @author schlex * * @param string $url * @param bool ajax force redirects if ajax */ function redirect($url, $ajax = false) { global $i18n; $url = var_out($url, 'url'); // filter url here since it can come from alot of places, specifically redirectto user input // handle expired sessions for ajax requests if (requestIsAjax()) { if (!cookie_check()) { header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: FormBased'); // @note this is not a security function for ajax, just a session timeout handler die; } else { if ($ajax) { header('HTTP/1.1 302 Redirect'); echo $url; // header('Location: '.$url); // @note this is not a security function for ajax, just a session timeout handler die; } } } if (function_exists('exec_action')) { exec_action('redirect'); } // @hook redirect a redirect is occuring $debugredirect = getDef('GSDEBUGREDIRECTS', true); if (!headers_sent($filename, $linenum) && !$debugredirect) { header('Location: ' . $url); } else { // @todo not sure this ever gets used or headers_sent is reliable ( turn output buffering off to test ) echo "<html><head><title>" . i18n_r('REDIRECT') . "</title></head><body>"; if (!isDebug()) { echo '<script type="text/javascript">'; echo 'window.location.href="' . $url . '";'; echo '</script>'; echo '<noscript>'; echo '<meta http-equiv="refresh" content="0;url=' . $url . '" />'; echo '</noscript>'; } if (headers_sent()) { echo i18n_r('ERROR') . ": Headers already sent in " . $filename . " on line " . $linenum . "<br/><br/>\n\n"; } printf(i18n_r('REDIRECT_MSG'), $url); if (!isAuthPage()) { if (isDebug()) { debugLog(debug_backtrace()); outputDebugLog(); } } echo "</body></html>"; } exit; }
if (!is_file($log_file)) { $log_data = false; } if (empty($log_data) && !empty($log_name) && !filepath_is_safe($log_file, $log_path)) { die; } if (isset($_GET['action']) && $_GET['action'] == 'delete' && strlen($log_name) > 0) { // check for csrf if (!defined('GSNOCSRF') || GSNOCSRF == FALSE) { $nonce = $_GET['nonce']; if (!check_nonce($nonce, "delete")) { die("CSRF detected!"); } } unlink($log_file); exec_action('logfile_delete'); redirect('support.php?success=' . urlencode('Log ' . $log_name . i18n_r('MSG_HAS_BEEN_CLR'))); } if (!isset($log_data)) { $log_data = getXML($log_file); } get_template('header', cl($SITENAME) . ' » ' . i18n_r('SUPPORT') . ' » ' . i18n_r('LOGS')); ?> <?php include 'template/include-nav.php'; ?> <div class="bodycontent clearfix"> <div id="maincontent">
} $pagesArray = $pagesArray_tmp; $pagesSorted = subval_sort($pagesArray, 'sort'); $table = get_pages_menu('', '', 0); get_template('header', cl($SITENAME) . ' » ' . i18n_r('PAGE_MANAGEMENT')); ?> <?php include 'template/include-nav.php'; ?> <div class="bodycontent clearfix"> <div id="maincontent"> <?php exec_action('pages-main'); ?> <div class="main"> <h3 class="floated"><?php i18n('PAGE_MANAGEMENT'); ?> </h3> <div class="edit-nav clearfix" > <a href="#" id="filtertable" accesskey="<?php echo find_accesskey(i18n_r('FILTER')); ?> " ><?php i18n('FILTER'); ?> </a> <a href="#" id="show-characters" accesskey="<?php
$note = $xml->addChild('parent'); $note->addCData($parent); $note = $xml->addChild('content'); $note->addCData($content); $note = $xml->addChild('private'); $note->addCData($private); $note = $xml->addChild('author'); $note->addCData($author); exec_action('changedata-save'); if (isset($_POST['autosave']) && $_POST['autosave'] == 'true') { XMLsave($xml, GSAUTOSAVEPATH . $url); } else { XMLsave($xml, $file); } //ending actions exec_action('changedata-aftersave'); generate_sitemap(); // redirect user back to edit page if (isset($_POST['autosave']) && $_POST['autosave'] == 'true') { echo 'OK'; } else { if ($_POST['redirectto'] != '') { $redirect_url = $_POST['redirectto']; } else { $redirect_url = 'edit.php'; } if ($url == $_POST['existing-url']) { redirect($redirect_url . "?id=" . $url . "&upd=edit-success&type=edit"); } else { redirect($redirect_url . "?id=" . $url . "&old=" . $_POST['existing-url'] . "&upd=edit-success&type=edit"); }
echo $theme_options; ?> </select> <input class="submit" type="submit" name="submitted" value="<?php i18n('ACTIVATE_THEME'); ?> " /></p> </form> <?php if (file_exists(GSTHEMESPATH . $TEMPLATE . '/images/screenshot.png')) { echo '<p><img id="theme_preview" style="border:2px solid #333;" src="../' . $theme_path . $TEMPLATE . '/images/screenshot.png" alt="' . i18n_r('THEME_SCREENSHOT') . '" /></p>'; echo '<span id="theme_no_img" style="visibility:hidden"><p><em>' . i18n_r('NO_THEME_SCREENSHOT') . '</em></p></span>'; } else { echo '<p><img id="theme_preview" style="visiblity:hidden;border:2px solid #333;" src="../' . $theme_path . $TEMPLATE . '/images/screenshot.png" alt="' . i18n_r('THEME_SCREENSHOT') . '" /></p>'; echo '<span id="theme_no_img"><p><em>' . i18n_r('NO_THEME_SCREENSHOT') . '</em></p></span>'; } exec_action('theme-extras'); ?> </div> </div> <div id="sidebar" > <?php include 'template/sidebar-theme.php'; ?> </div> </div> <?php get_template('footer');
/** * Create the Cached Pages XML file * * Reads in each page of the site and creates a single XML file called * data/pages/pages.array * * @since 3.1 * */ function create_pagesxml($flag) { global $pagesArray; $success = ''; // debugLog("create_pagesxml: " . $flag); if (isset($_GET['upd']) && $_GET['upd'] == "edit-success" || $flag === true || $flag == 'true') { $pagesArray = array(); // debugLog("create_pagesxml proceeding"); $menu = ''; $filem = GSDATAOTHERPATH . "pages.xml"; $path = GSDATAPAGESPATH; $dir_handle = @opendir($path) or die("create_pagesxml: Unable to open {$path}"); $filenames = array(); while ($filename = readdir($dir_handle)) { $ext = substr($filename, strrpos($filename, '.') + 1); if ($ext == "xml") { $filenames[] = $filename; } } $count = 0; $xml = @new SimpleXMLExtended('<channel></channel>'); if (count($filenames) != 0) { foreach ($filenames as $file) { if ($file == "." || $file == ".." || is_dir(GSDATAPAGESPATH . $file) || $file == ".htaccess") { // not a page data file } else { $thisfile = file_get_contents($path . $file); $data = simplexml_load_string($thisfile); if (!$data) { // handle corrupt page xml debugLog("page {$file} is corrupt"); continue; } $count++; $id = $data->url; $pages = $xml->addChild('item'); // $pages->addChild('url', $id); // $pagesArray[(string)$id]['url']=(string)$id; foreach ($data->children() as $item => $itemdata) { if ($item != "content") { $note = $pages->addChild($item); $note->addCData($itemdata); $pagesArray[(string) $id][$item] = (string) $itemdata; } } $note = $pages->addChild('slug'); $note->addCData($id); $pagesArray[(string) $id]['slug'] = (string) $id; $pagesArray[(string) $id]['filename'] = $file; $note = $pages->addChild('filename'); $note->addCData($file); } // else } // end foreach } // endif if ($flag === true || $flag == 'true') { // Plugin Authors should add custom fields etc.. here $xml = exec_filter('pagecache', $xml); // sanity check in case the filter does not come back properly or returns null if ($xml) { $success = $xml->asXML($filem); } // debugLog("create_pagesxml saved: ". $success); exec_action('pagecache-aftersave'); return $success; } } }
/** * Save pagecache xml file * @param simpleXmlObj * @return sucess */ function save_pageCacheXml($xml) { $file = GSDATAOTHERPATH . "pages.xml"; // Plugin Authors should add custome fields etc.. here $xml = exec_filter('pagecache', $xml); if (!empty($xml)) { $success = $xml->asXML($file); } exec_action('pagecache-aftersave'); return; }
header('Location: components.php?upd=comp-restored'); } //create list of components for html $data = getXML($path . $file); $componentsec = $data->item; $count = 0; if (count($componentsec) != 0) { foreach ($componentsec as $component) { $table .= '<div class="compdiv" id="section-' . @$count . '"><table class="comptable" ><tr><td><b title="Double Click to Edit" class="editable">' . stripslashes(@$component->title) . '</b></td>'; $table .= '<td style="text-align:right;" ><code><?php get_component(<span class="compslugcode">\'' . @$component->slug . '\'</span>); ?></code></td><td class="delete" >'; $table .= '<a href="#" title="' . $i18n['DELETE_COMPONENT'] . ': ' . cl(@$component->title) . '?" id="del-' . $count . '" onClick="DeleteComp(\'' . $count . '\'); return false;" >X</a></td></tr></table>'; $table .= '<textarea name="val[]">' . stripslashes(@$component->value) . '</textarea>'; $table .= '<input type="hidden" class="compslug" name="slug[]" value="' . @$component->slug . '" />'; $table .= '<input type="hidden" class="comptitle" name="title[]" value="' . @stripslashes($component->title) . '" />'; $table .= '<input type="hidden" name="id[]" value="' . @$count . '" />'; exec_action('component-extras'); $table .= '</div>'; $count++; } } // Create list for easy access $listc = ''; if ($count > 3) { $item = 0; foreach ($componentsec as $component) { $listc .= '<a id="divlist-' . @$item . '" href="#section-' . @$item . '" class="component">' . @$component->title . '</a>'; $item++; } } ?>