function processServerData($data, $return_array = true, $is_gzip = true)
 {
     if (empty($data)) {
         return false;
     }
     if ($return_array) {
         $xml = new XmlDoc();
         $xml->parseString($data);
         return $xml->getArray();
     }
     return true;
 }
예제 #2
0
 function buildNavigation($xml)
 {
     if ($this->getConfigVar('enabled', 'filemanager') != 'yes') {
         $xml = str_replace('<node link="/publish/filemanager/"  name="File Manager" />', NULL, file_get_contents($xml));
     }
     $this->_nav = array();
     $nav =& $this->_nav;
     $XML = new XmlDoc();
     if (@is_file($xml)) {
         $XML->parseFile($xml);
     } else {
         $XML->parseString($xml);
     }
     $nodes = $XML->getArray();
     $nav = array();
     foreach ($nodes["navigation"] as $n) {
         $content = $n["node"]["attributes"];
         $children = $n["node"][0]["children"];
         if (!empty($content)) {
             $nav[] = $content;
         }
         if (@is_array($children)) {
             foreach ($children as $n) {
                 if (!empty($n["node"]["attributes"])) {
                     $nav[count($nav) - 1]["children"][] = $n["node"]["attributes"];
                 }
             }
         }
     }
     $sections = $this->_db->fetch("SELECT * FROM `tbl_sections` ORDER BY `sortorder` DESC");
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $s) {
             if ($_REQUEST['_sid'] == $s['id'] && preg_match('/publish\\/section/i', $_REQUEST['page']) && !$this->authorIsSuper() && !@in_array($s['id'], $this->getAuthorAllowableSections())) {
                 $this->fatalError("Access Denied", "<p>Access denied. You are not authorised to access this page.</p>", true, true);
             }
             if ($this->authorIsSuper() || !$this->authorIsSuper() && @in_array($s['id'], $this->getAuthorAllowableSections())) {
                 array_unshift($nav[0]["children"], array("link" => "/publish/section/&amp;_sid=" . $s['id'], "name" => $s['name']));
             }
         }
     }
     $services = $this->_cfm->listAll();
     if (is_array($services) && !empty($services)) {
         foreach ($services as $owner => $list) {
             foreach ($list as $handle => $about) {
                 if (@in_array("{$owner}/{$handle}", $this->_config->_vars['campfire-menu'])) {
                     if (@is_file(CAMPFIRE . "/{$owner}/{$handle}/interface/content.index.php")) {
                         $nav[3]["children"][] = array("link" => "/campfire/service/{$owner}/{$handle}/", "name" => $about['name']);
                     } else {
                         $nav[3]["children"][] = array("link" => "/campfire/info/&amp;name={$owner}/{$handle}", "name" => $about['name']);
                     }
                 } elseif (!$this->authorIsSuper() && preg_match('/campfire\\/service\\/' . $owner . '\\/' . $handle . '/i', $_REQUEST['page']) && @(!in_array("{$owner}/{$handle}", $this->_config->_vars['campfire-menu']))) {
                     $this->fatalError("Access Denied", "<p>Access denied. You are not authorised to access this page.</p>", true, true);
                 }
             }
         }
     }
     if (count($nav[3]['children']) < 3 && !$this->authorIsSuper()) {
         unset($nav[3]);
     }
     return $this->_nav;
 }
예제 #3
0
 function __buildNavigation()
 {
     $nav = array();
     $xml = new XmlDoc();
     if (!$xml->parseFile(ASSETS . '/navigation.xml')) {
         $this->_Parent->customError(E_USER_ERROR, __('Failed to load Navigation'), __('There was a problem loading the Symphony navigation XML document.'));
     }
     $nodes = $xml->getArray();
     $sections_index = 0;
     $extension_index = 0;
     foreach ($nodes['navigation'] as $n) {
         $content = $n['group']['attributes'];
         $children = $n['group'][0]['children'];
         $index = $n['group']['attributes']['index'];
         if ($n['group']['attributes']['sections'] == 'true') {
             $sections_index = $index;
         }
         if (isset($nav[$index])) {
             do {
                 $index++;
             } while (isset($nav[$index]));
         }
         if (!empty($content)) {
             $nav[$index] = $content;
         }
         if (@is_array($children)) {
             foreach ($children as $n) {
                 if (!empty($n['item']['attributes'])) {
                     $nav[$index]['children'][] = $n['item']['attributes'];
                 }
             }
         }
     }
     $sections = $this->_Parent->Database->fetch("SELECT * FROM `tbl_sections` ORDER BY `sortorder` ASC");
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $s) {
             //$visible = ($this->_Parent->Author->isDeveloper() || (!$this->_Parent->Author->isDeveloper() && in_array($s['id'], $this->_Parent->Author->getAuthorAllowableSections())));
             $nav[$sections_index]['children'][] = array('link' => '/publish/' . $s['handle'] . '/', 'name' => $s['name'], 'type' => 'section', 'section' => array('id' => $s['id'], 'handle' => $s['handle']), 'visible' => $s['hidden'] == 'no' ? 'yes' : 'no');
         }
     }
     $extensions = $this->_Parent->ExtensionManager->listInstalledHandles();
     foreach ($extensions as $e) {
         $info = $this->_Parent->ExtensionManager->about($e);
         if (isset($info['navigation']) && is_array($info['navigation']) && !empty($info['navigation'])) {
             foreach ($info['navigation'] as $item) {
                 $type = isset($item['children']) ? Extension::NAV_GROUP : Extension::NAV_CHILD;
                 switch ($type) {
                     case Extension::NAV_GROUP:
                         $index = General::array_find_available_index($nav, $item['location']);
                         $nav[$index] = array('name' => $item['name'], 'index' => $index, 'children' => array(), 'limit' => !is_null($item['limit']) ? $item['limit'] : NULL);
                         foreach ($item['children'] as $child) {
                             if (!isset($child['relative']) || $child['relative'] == true) {
                                 $link = '/extension/' . $e . '/' . ltrim($child['link'], '/');
                             } else {
                                 $link = '/' . ltrim($child['link'], '/');
                             }
                             $nav[$index]['children'][] = array('link' => $link, 'name' => $child['name'], 'visible' => $child['visible'] == 'no' ? 'no' : 'yes', 'limit' => !is_null($child['limit']) ? $child['limit'] : NULL);
                         }
                         break;
                     case Extension::NAV_CHILD:
                         if (!isset($item['relative']) || $item['relative'] == true) {
                             $link = '/extension/' . $e . '/' . ltrim($item['link'], '/');
                         } else {
                             $link = '/' . ltrim($item['link'], '/');
                         }
                         $nav[$item['location']]['children'][] = array('link' => $link, 'name' => $item['name'], 'visible' => $item['visible'] == 'no' ? 'no' : 'yes', 'limit' => !is_null($item['limit']) ? $item['limit'] : NULL);
                         break;
                 }
             }
         }
     }
     ####
     # Delegate: ExtensionsAddToNavigation
     # Description: After building the Navigation properties array. This is specifically for extentions to add their groups to the navigation or items to groups,
     #			   already in the navigation. Note: THIS IS FOR ADDING ONLY! If you need to edit existing navigation elements, use the 'NavigationPreRender' delegate.
     # Global: Yes
     $this->_Parent->ExtensionManager->notifyMembers('ExtensionsAddToNavigation', '/administration/', array('navigation' => &$nav));
     $pageCallback = $this->_Parent->getPageCallback();
     $pageRoot = $pageCallback['pageroot'] . (isset($pageCallback['context'][0]) ? $pageCallback['context'][0] . '/' : '');
     $found = $this->__findActiveNavigationGroup($nav, $pageRoot);
     ## Normal searches failed. Use a regular expression using the page root. This is less efficent and should never really get invoked
     ## unless something weird is going on
     if (!$found) {
         $this->__findActiveNavigationGroup($nav, '/^' . str_replace('/', '\\/', $pageCallback['pageroot']) . '/i', true);
     }
     ksort($nav);
     $this->_navigation = $nav;
 }
<?php

if (!isset($_REQUEST['auth'])) {
    General::redirect(URL . '/symphony/');
}
$ch = new Gateway();
$ch->init();
$ch->setopt("URL", URL . '/symphony/ajax/');
$ch->setopt("POST", 1);
$ch->setopt("POSTFIELDS", array('action' => 'status', 'token' => $_REQUEST['auth'], 'mode' => 'full'));
$data = $ch->exec();
$parser = new XmlDoc();
$parser->parseString($data);
$doc = $parser->getArray();
unset($parser);
$obDate = $Admin->getDateObj();
$rss = new XMLElement('rss');
$rss->setAttribute('version', '2.0');
$channel = new XMLElement('channel');
$channel->addChild(new XMLElement('title', $Admin->getConfigVar('sitename', 'general')));
$channel->addChild(new XMLElement('link', URL));
$channel->addChild(new XMLElement('description', $Admin->getConfigVar('sitename', 'general') . ' Status Feed'));
$channel->addChild(new XMLElement('language', 'en-us'));
$channel->addChild(new XMLElement('generator', 'Symphony ' . $Admin->getConfigVar('build', 'symphony')));
function flattenFragment($f, $type)
{
    $f = $f[$type];
    $flattened = array();
    $flattened['attributes'] = $f['attributes'];
    $flattened['data'] = array();
    unset($f['attributes']);
예제 #5
0
 function loadConfiguration($file, &$obConf, $parser = NULL)
 {
     if (!@is_file($file) || !@is_readable($file)) {
         return false;
     }
     $this->_Config->flush();
     if (!$parser) {
         $parser = new XmlDoc();
     }
     $parser->parseFile($file);
     $tmpData = $parser->getArray();
     foreach ($tmpData['configuration'] as $item) {
         foreach ($item as $key => $val) {
             $obConf->set($key, $val['attributes']);
         }
     }
     unset($parser);
 }
 private function __findNavigationStrings($path, &$result)
 {
     $xml = new XmlDoc();
     if (!$xml->parseFile($path)) {
         return false;
     }
     $nodes = $xml->getArray();
     $index = 0;
     foreach ($nodes['navigation'] as $n) {
         $index++;
         if (!empty($n['group']['attributes']['name'])) {
             $result[$n['group']['attributes']['name']][$path][] = $index;
         }
         $children = $n['group'][0]['children'];
         if (is_array($children)) {
             foreach ($children as $n) {
                 $index++;
                 if (!empty($n['item']['attributes']['name']) && $n['item']['attributes']['visible'] !== 'no') {
                     $result[$n['item']['attributes']['name']][$path][] = $index;
                 }
             }
         }
     }
     return true;
 }