function im_customfield_def() { global $im_customfield_def; if ($im_customfield_def == null) { $files = GSDATAOTHERPATH . IM_CUSTOMFIELDS_FILE; if (file_exists($files)) { $data = getXML($files); $items = $data->item; if (count($items) > 0) { foreach ($items as $item) { $cf = array(); $cf['key'] = (string) $item->desc; $cf['label'] = (string) $item->label; $cf['type'] = (string) $item->type; $cf['value'] = (string) $item->value; if ($item->type == "dropdown") { $cf['options'] = array(); foreach ($item->option as $option) { $cf['options'][] = (string) $option; } } $im_customfield_def[] = $cf; } } } } return $im_customfield_def; }
function __construct($filename, $logdefaults = true) { // @todo check filename, must be .log if ($this->validFilename($filename)) { $this->_xmlfile = GSDATAOTHERPATH . 'logs/' . $filename; if (file_exists($this->_xmlfile)) { $xml = getXML($this->_xmlfile); if (!is_object($xml)) { $this->_xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>'); } else { $this->_xml = $xml; } } else { $this->_xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>'); } // create entry and add date $thislog = $this->_xml->addChild('entry'); $thislog->addChild('date', date('r')); $this->_entry = $thislog; if ($logdefaults == true) { $this->defaults(); } } else { return false; } }
function i18n_customfield_defs() { global $i18n_customfield_defs, $i18n_customfield_types; if ($i18n_customfield_defs === null) { $i18n_customfield_defs = array(); $i18n_customfield_types = array(); $file = GSDATAOTHERPATH . I18N_CUSTOMFIELDS_FILE; if (file_exists($file)) { $data = getXML($file); $items = $data->item; if (count($items) > 0) { foreach ($items as $item) { $cf = array(); $cf['key'] = (string) $item->desc; $cf['label'] = (string) $item->label; $cf['type'] = (string) $item->type; $cf['value'] = (string) $item->value; if ($item->type == "dropdown") { $cf['options'] = array(); foreach ($item->option as $option) { $cf['options'][] = (string) $option; } } $cf['index'] = (bool) $item->index; $i18n_customfield_defs[] = $cf; $i18n_customfield_types[$cf['key']] = $cf['type']; } } } } return $i18n_customfield_defs; }
function getData($searchString) { $newLink = getSubstring($searchString, "a-link-normal a-text-normal", "<a", "href=\"", "\""); $searchString = getXML($newLink); $imgLink = getSubstring($searchString, "imgBlkFront", "<img", "src=\"", "\"", "\""); $price = getSubstring($searchString, "offer-price", "<span", ">", "<", ">"); return array($imgLink, $price); }
function DM_nibbler_init() { global $nibblercode, $DM_nibbler_config_file, $thisfile_nibbler; $success = null; $error = null; if (isset($_POST['submit'])) { $nibblercode = isset($_POST['nibblercode']) ? $_POST['nibblercode'] : $nibblercode; if (!$error) { $xml = @new SimpleXMLElement('<item></item>'); $xml->addChild('nibblercode', $nibblercode); if (!$xml->asXML($DM_nibbler_config_file)) { $error = i18n_r($thisfile_nibbler . '/NIBBLER_ERROR'); } else { $x = getXML($DM_nibbler_config_file); $nibblercode = $x->nibblercode; $success = i18n_r($thisfile_nibbler . '/NIBBLER_SUCCESS'); } } } //Main Navigation For Admin Panel ?> <h3 class="floated"><?php echo i18n_r($thisfile_nibbler . '/NIBBLER_TITLE'); ?> </h3> <br/><br/> <?php if ($success) { echo '<p style="color:#669933;"><b>' . $success . '</b></p>'; } if ($error) { echo '<p style="color:#cc0000;"><b>' . $error . '</b></p>'; } ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <p><label for="nibblercode" ><?php echo i18n_r($thisfile_nibbler . '/NIBBLER_DESC'); ?> </label> <input id="nibblercode" name="nibblercode" class="text" value="<?php echo $nibblercode; ?> " /> </p> <p><input type="submit" id="submit" class="submit" value="<?php echo i18n_r($thisfile_nibbler . '/NIBBLER_SAVE'); ?> " name="submit" /></p> </form> <?php }
private static function loadSettings() { self::$settings = array(); if (file_exists(GSDATAOTHERPATH . I18N_SETTINGS_FILE)) { $data = getXML(GSDATAOTHERPATH . I18N_SETTINGS_FILE); foreach ($data->children() as $child) { self::$settings[$child->getName()] = (string) $child; } } }
/** * Innovation Settings * * This defines variables based on the theme plugin's settings * * @return bool */ function Innovation_Settings() { $file = GSDATAOTHERPATH . 'InnovationSettings.xml'; if (file_exists($file)) { $p = getXML($file); return $p; } else { return false; } }
/** * read_pluginsxml * * Read in the plugins.xml file and populate the $live_plugins array * * @since 2.04 * @uses $live_plugins * */ function read_pluginsxml() { global $live_plugins; $data = getXML(GSDATAOTHERPATH . "plugins.xml"); $componentsec = $data->item; $count = 0; if (count($componentsec) != 0) { foreach ($componentsec as $component) { $live_plugins[(string) $component->plugin] = (string) $component->enabled; } } }
public static function generateSitemapWithoutPing() { global $SITEURL; $filenames = getFiles(GSDATAPAGESPATH); if (count($filenames)) { foreach ($filenames as $file) { if (isFile($file, GSDATAPAGESPATH, 'xml')) { $data = getXML(GSDATAPAGESPATH . $file); if ($data->url != '404' && $data->private != 'Y') { $pagesArray[] = array('url' => (string) $data->url, 'parent' => (string) $data->parent, 'date' => (string) $data->pubDate, 'menuStatus' => (string) $data->menuStatus); } } } } $pagesSorted = subval_sort($pagesArray, 'menuStatus'); $languages = return_i18n_available_languages(); $deflang = return_i18n_default_language(); $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'); if (count($pagesSorted)) { foreach ($pagesSorted as $page) { // set <loc> if (count($languages) > 1) { $pos = strrpos($page['url'], '_'); if ($pos !== false) { $pageLoc = find_i18n_url(substr($page['url'], 0, $pos), $page['parent'], substr($page['url'], $pos + 1)); } else { $pageLoc = find_i18n_url($page['url'], $page['parent'], $deflang); } } else { $pageLoc = find_i18n_url($page['url'], $page['parent']); } // set <lastmod> $pageLastMod = makeIso8601TimeStamp(date("Y-m-d H:i:s", strtotime($page['date']))); // set <changefreq> $pageChangeFreq = 'weekly'; // set <priority> $pagePriority = $page['menuStatus'] == 'Y' ? '1.0' : '0.5'; //add to sitemap $url_item = $xml->addChild('url'); $url_item->addChild('loc', htmlspecialchars($pageLoc)); $url_item->addChild('lastmod', $pageLastMod); $url_item->addChild('changefreq', $pageChangeFreq); $url_item->addChild('priority', $pagePriority); } } //create xml file $file = GSROOTPATH . 'sitemap.xml'; XMLsave($xml, $file); }
function bm_get_url($query = false) { global $SITEURL, $PRETTYURLS, $BMPAGEURL, $BMPRETTYURLS; $data = getXML(GSDATAPAGESPATH . $BMPAGEURL . '.xml'); $url = find_url($BMPAGEURL, $data->parent); if ($query) { if ($PRETTYURLS == 1 && $BMPRETTYURLS == 'Y') { $url .= $query . '/'; } elseif ($BMPAGEURL == 'index') { $url = $SITEURL . "index.php?{$query}="; } else { $url = $SITEURL . "index.php?id={$BMPAGEURL}&{$query}="; } } return $url; }
function bm_edit_book($slug) { $file = BMBOOKPATH . "{$slug}.xml"; # get book data, if it exists $data = @getXML($file); $title = @stripslashes($data->title); $date = !empty($data) ? date('m/d/Y', strtotime($data->date)) : ''; $time = !empty($data) ? date('H:i', strtotime($data->date)) : ''; $tags = @str_replace(',', ', ', $data->tags); $private = @$data->private != '' ? 'checked' : ''; $content = @stripslashes($data->content); # show edit book form include BMTEMPLATEPATH . 'edit_book.php'; if (file_exists($file)) { $mtime = date(i18n_r('DATE_AND_TIME_FORMAT'), filemtime($file)); echo '<small>' . i18n_r('books_manager/LAST_SAVED') . ": {$mtime}</small>"; } include BMTEMPLATEPATH . 'ckeditor.php'; }
function ahf_show() { global $ahf_header; global $ahf_footer; global $ahf_file; global $i18n; // submitted form if (isset($_POST['submit'])) { $ahf_header = htmlentities($_POST['ahf_head'], ENT_QUOTES, 'UTF-8'); $ahf_footer = htmlentities($_POST['ahf_foot'], ENT_QUOTES, 'UTF-8'); $xml = @new SimpleXMLElement('<item></item>'); $xml->addChild('header', $ahf_header); $xml->addChild('footer', $ahf_footer); if (!$xml->asXML($ahf_file)) { $error = $i18n['CHMOD_ERROR']; } else { $x = getXML($ahf_file); $ahf_header = stripslashes(htmlspecialchars_decode($x->header, ENT_QUOTES)); $ahf_footer = stripslashes(htmlspecialchars_decode($x->footer, ENT_QUOTES)); } } ?> <h3>Admin Header Footer</h3> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <p><b>Code for Header</b>:<br /><textarea name="ahf_head" class="shorttext" ><?php echo @$ahf_header; ?> </textarea><br /> <span class="hint">"Header" should only include code to be shown within the <head> tag or PHP code</span></p> <p><b>Code for Footer</b>:<br /><textarea name="ahf_foot" class="shorttext" ><?php echo @$ahf_footer; ?> </textarea><br /> <span class="hint">"Footer" can echo any text or run any javascript or PHP code</span></p> <p><input type="submit" id="submit" class="submit" value="Save Header/Footer Code" name="submit" /></p> </form> <?php }
private function loadRates($lang) { $this->rates = array(); $data = array(); $filename = GSDATAPATH . RATES_DIR . RATES_FILENAME . '_' . $lang . '.xml'; if (!file_exists($filename)) { $filename = GSDATAPATH . RATES_DIR . RATES_FILENAME . '.xml'; } if (file_exists($filename)) { $data = getXML($filename); if ($data) { foreach ($data as $key => $value) { if ($key == "category") { $category = $this->extractCategory($value); $this->rates[] = $category; } } } } }
public static function getGallery($name) { $gallery = array('items' => array()); if (!file_exists(GSDATAPATH . 'i18n_gallery/' . $name . '.xml')) { return $gallery; } $data = getXML(GSDATAPATH . I18N_GALLERY_DIR . $name . '.xml'); if (!$data) { return $gallery; } $dofilter = basename($_SERVER['PHP_SELF']) == 'index.php'; foreach ($data as $key => $value) { if ($key != 'item' && $key != 'items') { $gallery[$key] = (string) $value; } else { $include = true; if ($dofilter) { global $filters; $filename = (string) $value->filename; $tags = preg_split('/\\s*,\\s*/', (string) $value->tags); foreach ($filters as $filter) { if ($filter['filter'] == 'image-veto') { if (call_user_func_array($filter['function'], array($name, $filename, $tags))) { $include = false; break; } } } } if ($include) { $item = array(); foreach ($value as $itemkey => $itemvalue) { $item[$itemkey] = (string) $itemvalue; } $gallery['items'][] = $item; } } } return $gallery; }
public function getCustomFields() { $cfData = getXML(BLOGCUSTOMFIELDS); $cf = array('options' => '', 'main' => ''); $count_options = 0; $count_main = 0; $count_opt = 0; foreach ($cfData->item as $custom_field) { if ($custom_field->area == 'options') { $cf['options'][$count_options]['key'] = (string) $custom_field->desc; $cf['options'][$count_options]['label'] = (string) $custom_field->label; $cf['options'][$count_options]['type'] = (string) $custom_field->type; $cf['options'][$count_options]['value'] = (string) $custom_field->value; if ($custom_field->type == "dropdown") { $count_opt = 0; $cf['options'][$count_options]['options'] = array(); foreach ($custom_field->option as $option) { $cf['options'][$count_options]['options'][] = (string) $option; $count_opt++; } } $count_options++; } elseif ($custom_field->area == 'main') { $cf['main'][$count_main]['key'] = (string) $custom_field->desc; $cf['main'][$count_main]['label'] = (string) $custom_field->label; $cf['main'][$count_main]['type'] = (string) $custom_field->type; $cf['main'][$count_main]['value'] = (string) $custom_field->value; if ($custom_field->type == "dropdown") { $count_opt = 0; $cf['main'][$count_main]['options'] = array(); foreach ($custom_field->option as $option) { $cf['main'][$count_main]['options'][] = (string) $option; $count_opt++; } } $count_main++; } } return $cf; }
/** * Innovation Settings * * This defines variables based on the theme plugin's settings * * @return bool */ function Innovation_Settings() { $file = GSDATAOTHERPATH . 'InnovationSettings.xml'; if (file_exists($file)) { $p = getXML($file); if ($p->facebook != '') { define('FACEBOOK', $p->facebook); } if ($p->twitter != '') { define('TWITTER', $p->twitter); } if ($p->linkedin != '') { define('LINKEDIN', $p->linkedin); } if ($p->webfont != '') { define('WEBFONT', $p->webfont); } return true; } else { return false; } }
function component_exists($id) { global $components; if (!$components) { if (file_exists(GSDATAOTHERPATH . 'components.xml')) { $data = getXML(GSDATAOTHERPATH . 'components.xml'); $components = $data->item; } else { $components = array(); } } $exists = FALSE; if (count($components) > 0) { foreach ($components as $component) { if ($id == $component->slug) { $exists = TRUE; break; } } } return $exists; }
function bm_get_cache_data() { $books = array(); $files = getFiles(BMBOOKPATH); # collect all book data foreach ($files as $file) { if (isFile($file, BMBOOKPATH, 'xml')) { $data = getXML(BMBOOKPATH . $file); $time = strtotime($data->date); while (array_key_exists($time, $books)) { $time++; } $books[$time]['slug'] = basename($file, '.xml'); $books[$time]['title'] = strval($data->title); $books[$time]['date'] = strval($data->date); $books[$time]['tags'] = strval($data->tags); $books[$time]['private'] = strval($data->private); } } krsort($books); return $books; }
function auto_import() { $Blog = new Blog(); if ($_GET['import'] == urldecode($Blog->getSettingsData("autoimporterpass")) && $Blog->getSettingsData("autoimporter") == 'Y') { ini_set("memory_limit", "350M"); define('MAGPIE_CACHE_DIR', GSCACHEPATH . 'magpierss/'); require_once BLOGPLUGINFOLDER . 'inc/magpierss/rss_fetch.inc'; $rss_feed_file = getXML(BLOGRSSFILE); foreach ($rss_feed_file->rssfeed as $the_fed) { $rss_uri = $the_fed->feed; $rss_category = $the_fed->category; $rss = fetch_rss($rss_uri); $items = array_slice($rss->items, 0); foreach ($items as $item) { $post_data['title'] = $item['title']; $post_data['slug'] = ''; $post_data['date'] = $item['pubdate']; $post_data['private'] = ''; $post_data['tags'] = ''; $post_data['category'] = $rss_category; if ($Blog->getSettingsData('rssinclude') == 'Y') { if (!empty($item['content']['encoded'])) { $post_data['content'] = htmlentities($item['content']['encoded'], ENT_QUOTES, 'iso-8859-1'); } else { $post_data['content'] = htmlentities($item['summary'], ENT_QUOTES, 'iso-8859-1') . '<p class="blog_auto_import_readmore"><a href="' . $item['link'] . '" target="_blank">' . i18n_r(BLOGFILE . '/READ_FULL_ARTICLE') . '</a></p>'; } } else { $post_data['content'] = htmlentities($item['summary'], ENT_QUOTES, 'iso-8859-1') . '<p class="blog_auto_import_readmore"><a href="' . $item['link'] . '" target="_blank">' . i18n_r(BLOGFILE . '/READ_FULL_ARTICLE') . '</a></p>'; } $post_data['excerpt'] = $Blog->create_excerpt($item['summary'], 0, $Blog->getSettingsData("excerptlength")); $post_data['thumbnail'] = auto_import_thumbnail($item); $post_data['current_slug'] = ''; $post_data['author'] = htmlentities('<a href="' . $rss_uri . '">RSS Feed</a>', ENT_QUOTES, 'iso-8859-1'); $Blog->savePost($post_data, true); echo '<p class="blog_rss_post_added">' . i18n_r(BLOGFILE . '/ADDED') . ': ' . $post_data['title'] . '</p>'; } } } }
function nm_edit_post($slug = '') { $newpost = $slug === ''; if ($newpost) { $title = ''; $date = ''; $time = ''; $tags = ''; $private = ''; $image = ''; $content = ''; } else { $file = NMPOSTPATH . $slug . '.xml'; if (dirname(realpath($file)) != realpath(NMPOSTPATH)) { die(''); } // path traversal # get post data, if it exists $data = @getXML($file); $title = @stripslashes($data->title); $date = isset($data->date) ? date('Y-m-d', strtotime($data->date)) : ''; $time = isset($data->date) ? date('H:i', strtotime($data->date)) : ''; $tags = isset($data->tags) ? str_replace(',', ', ', stripslashes($data->tags)) : ''; $private = @$data->private != '' ? 'checked' : ''; $image = @stripslashes($data->image); $content = @stripslashes($data->content); if (isset($data->author)) { $author = stripslashes($data->author); } } # show edit post form include NMTEMPLATEPATH . 'edit_post.php'; if (!$newpost) { $mtime = date(i18n_r('DATE_AND_TIME_FORMAT'), filemtime($file)); echo '<small>', i18n_r('news_manager/LAST_SAVED'), ': ', $mtime, '</small>'; } include NMTEMPLATEPATH . 'ckeditor.php'; }
function nm_get_cache_data() { $posts = array(); $files = getFiles(NMPOSTPATH); # collect all post data foreach ($files as $file) { if (isFile($file, NMPOSTPATH, 'xml')) { $data = getXML(NMPOSTPATH . $file); $time = strtotime($data->date); while (array_key_exists($time, $posts)) { $time++; } $posts[$time]['slug'] = basename($file, '.xml'); $posts[$time]['title'] = strval($data->title); $posts[$time]['date'] = strval($data->date); $posts[$time]['tags'] = strval($data->tags); $posts[$time]['private'] = strval($data->private); $posts[$time]['image'] = strval($data->image); $posts[$time]['author'] = strval($data->author); } } krsort($posts); return $posts; }
// throw errors if (!empty($permerror) && $showpermfail) { $error = $permerror; } // load user data if editing if (!empty($userid)) { $file = _id($userid) . '.xml'; // file traversal protection and checks if file exists at the same time if (!filepath_is_safe(GSUSERSPATH . $file, GSUSERSPATH)) { die(i18n_r('ER_REQ_PROC_FAIL')); } if ($editing && !file_exists(GSUSERSPATH . $file)) { $error = i18n_r('INVALID_USER'); } // else populate data for user $data = getXML(GSUSERSPATH . $file); $password = $data->PWD; // set password, since we dont need to resave it all the time } else { // empty user defaults $data = new stdClass(); $data->HTMLEDITOR = true; $data->LANG = $SITELANG; $data->EMAIL = ''; $data->TIMEZONE = $SITETIMEZONE; $data->NAME = ''; } # if the undo command was invoked if (isset($_GET['undo'])) { if ($_GET['userid'] !== $userid) { die(i18n_r('ER_REQ_PROC_FAIL'));
create_pagesxml('true'); header('Location: pages.php?upd=clone-success&id=' . $newurl); } else { $error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']); header('Location: pages.php?error=' . $error); } } else { $error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']); header('Location: pages.php?error=' . $error); } } getPagesXmlValues(); $count = 0; foreach ($pagesArray as $page) { if ($page['parent'] != '') { $parentdata = getXML(GSDATAPAGESPATH . $page['parent'] . '.xml'); $parentTitle = $parentdata->title; $sort = $parentTitle . ' ' . $page['title']; } else { $sort = $page['title']; } $page = array_merge($page, array('sort' => $sort)); $pagesArray_tmp[$count] = $page; $count++; } $pagesArray = $pagesArray_tmp; $pagesSorted = subval_sort($pagesArray, 'sort'); $table = get_pages_menu('', '', 0); get_template('header', cl($SITENAME) . ' » ' . i18n_r('PAGE_MANAGEMENT')); ?>
function toggleSafeMode($enable = true) { global $SAFEMODE, $dataw; $SAFEMODE = $enable; backup_datafile(GSDATAOTHERPATH . GSWEBSITEFILE); if (!$dataw) { if (file_exists(GSDATAOTHERPATH . GSWEBSITEFILE)) { $dataw = getXML(GSDATAOTHERPATH . GSWEBSITEFILE, false); } else { return false; } } $dataw->editAddChild('SAFEMODE', $enable ? 1 : 0); return XMLSave($dataw, GSDATAOTHERPATH . GSWEBSITEFILE); }
$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 { $response = $i18n['SITEMAP_ERRORPING']; header('location: theme.php?err=' . $response); exit; } } else { $response = $i18n['SITEMAP_ERROR']; header('location: theme.php?err=' . $response);
function show_blog_tag($tag) { $Blog = new Blog(); // Create a new instance of the Blog class $all_posts = $Blog->listPosts(true, true); // Get a list of all posts in the blog foreach ($all_posts as $file) { // For each blog post in the list... $data = getXML($file['filename']); // Get the XML data for the post if (!empty($data->tags)) { // If the post has been tagged... $tags = explode(',', $data->tags); // Convert the string of tags to array list if (in_array($tag, $tags)) { //If the requested tag is in the list of tags on the post show_blog_post($file['filename'], true); // Show the blog post } } } }
function i18n_navigation_structure_save(&$pages) { $stack = array(); for ($i = 0; isset($_POST['page_' . $i . '_url']); $i++) { $url = $_POST['page_' . $i . '_url']; if (isset($pages[$url])) { $level = (int) $_POST['page_' . $i . '_level']; if ($level > count($stack)) { $level = count($stack); } $parent = $level <= 0 ? '' : $stack[$level - 1]; $menuOrder = count($stack) <= $level ? 0 : $pages[$stack[$level]]['menuOrder'] + 1; $menu = htmlentities($_POST['page_' . $i . '_menu'], ENT_QUOTES, 'UTF-8'); $menuStatus = $_POST['page_' . $i . '_menuStatus']; $private = $_POST['page_' . $i . '_private']; if ($menu == $pages[$url]['title']) { $menu = ''; } if ($parent != $pages[$url]['parent'] || $menuOrder != $pages[$url]['menuOrder'] || $menu != $pages[$url]['menu'] || $menuStatus != $pages[$url]['menuStatus'] || $private != $pages[$url]['private']) { // update pages array $pages[$url]['parent'] = $parent; $pages[$url]['menuOrder'] = $menuOrder; $pages[$url]['menu'] = $menu; $pages[$url]['menuStatus'] = $menuStatus; $pages[$url]['private'] = $private; // backup page file if (!copy(GSDATAPAGESPATH . $url . '.xml', GSBACKUPSPATH . 'i18n_navigation/' . $url . '.xml')) { return false; } // update page file $data = getXML(GSDATAPAGESPATH . $url . '.xml'); $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>'); $xml->addChild('pubDate', (string) $data->pubDate); if (@$data->creDate) { $xml->addChild('creDate', (string) $data->creDate); } foreach ($data->children() as $child) { $name = $child->getName(); if ($name != 'parent' && $name != 'menuOrder' && $name != 'menu' && $name != 'menuStatus' && $name != 'private' && $name != 'pubDate' && $name != 'creDate') { $xml->addChild($name)->addCData((string) $child); } } $xml->addChild('parent')->addCData((string) $parent); $xml->addChild('menuOrder')->addCData((string) $menuOrder); $xml->addChild('menu')->addCData((string) $menu); $xml->addChild('menuStatus')->addCData((string) $menuStatus); $xml->addChild('private')->addCData((string) $private); XMLsave($xml, GSDATAPAGESPATH . $url . '.xml'); } // variants if (count($pages[$url]['variants']) > 0) { foreach ($pages[$url]['variants'] as $lang => &$variant) { if (isset($_POST['page_' . $i . '_menu' . $lang])) { $menu = htmlentities($_POST['page_' . $i . '_menu' . $lang], ENT_QUOTES, 'UTF-8'); if ($menu == $variant['title']) { $menu = ''; } if ($menu != $variant['menu'] || $private != $variant['private']) { $variant['menu'] = $menu; // backup variant file if (!copy(GSDATAPAGESPATH . $variant['url'] . '.xml', GSBACKUPSPATH . 'i18n_navigation/' . $variant['url'] . '.xml')) { return false; } // update variant file $data = getXML(GSDATAPAGESPATH . $variant['url'] . '.xml'); $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>'); $xml->addChild('pubDate', (string) $data->pubDate); if (@$data->creDate) { $xml->addChild('creDate', (string) $data->creDate); } foreach ($data->children() as $child) { $name = $child->getName(); if ($name != 'menu' && $name != 'menuStatus' && $name != 'private' && $name != 'pubDate' && $name != 'creDate') { $xml->addChild($name)->addCData((string) $child); } } $xml->addChild('menu')->addCData((string) $menu); $xml->addChild('menuStatus')->addCData((string) $menuStatus); $xml->addChild('private')->addCData((string) $private); XMLsave($xml, GSDATAPAGESPATH . $variant['url'] . '.xml'); } } } } while (count($stack) > $level) { array_pop($stack); } array_push($stack, $url); } } exec_action('menu-aftersave'); return true; }
} exec_action('component-save'); XMLsave($xml, $path . $file); header('Location: components.php?upd=comp-success'); } // if undo was invoked if (isset($_GET['undo'])) { $nonce = $_GET['nonce']; if (!check_nonce($nonce, "undo")) { die("CSRF detected!"); } undo($file, $path, $bakpath); 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++; }
<?php // GS defaults $sec_light = '#CF3805'; $sec_dark = '#9F2C04'; // admin.xml styles if (file_exists(GSTHEMESPATH . 'admin.xml')) { $css = getXML(GSTHEMESPATH . 'admin.xml'); $sec_light = trim((string) $css->secondary->lightest); $sec_dark = trim((string) $css->secondary->darkest); } // if Flat Blue Admin Theme is installed override both defaults & admin.xml styles if (!function_exists('flatBlue')) { function flatBlue() { global $live_plugins; if (array_key_exists('flat-blue.php', $live_plugins) && $live_plugins['flat-blue.php'] === 'true') { return true; } } } if (flatBlue()) { $sec_light = '#1E282C'; } // based on the $sec_light color, calculate the color to use for selected settings in the Edit mode grid if (!function_exists('convert')) { function convert($pair) { $hex_map = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); $first = array_search(substr($pair, 0, 1), $hex_map) + 8 >= count($hex_map) - 1 ? $hex_map[count($hex_map) - 1] : $hex_map[substr($pair, 0, 1) + 8]; $second = substr($pair, 1, 1);
$note = $xmls->addChild('SITEURL'); $note->addCData($SITEURL); $xmls->addChild('TEMPLATE', GSINSTALLTEMPLATE); $xmls->addChild('PRETTYURLS', ''); $xmls->addChild('PERMALINK', ''); $xmls->addChild('SITEUSR', $USR); $xmls->addChild('SITEABOUT', ''); if (!XMLsave($xmls, GSDATAOTHERPATH . $file)) { $kill = i18n_r('CHMOD_ERROR'); } # create default index.xml page $init = GSDATAPAGESPATH . 'index.xml'; $temp = GSADMININCPATH . 'tmp/tmp-index.xml'; if (!file_exists($init)) { copy_file($temp, $init); $xml = getXML($init); $xml->pubDate = date('r'); # update date XMLsave($xml, $init); } # create default 404.xml page $init = GSDATAOTHERPATH . '404.xml'; $temp = GSADMININCPATH . 'tmp/tmp-404.xml'; if (!file_exists($init)) { copy($temp, $init); } # create default 404.xml page $init = GSDATAOTHERPATH . '403.xml'; $temp = GSADMININCPATH . 'tmp/tmp-403.xml'; if (!file_exists($init)) { copy($temp, $init);