Exemplo n.º 1
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('apply');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task perl syntax.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('executable', 'perl');
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('failonerror', $this->getFailOnError() ? 'true' : 'false');
     }
     $xml->startElement('arg');
     $xml->writeAttribute('value', '-c');
     $xml->endElement();
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
 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;
 }
Exemplo n.º 3
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Dir not set for mkdir task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('mkdir');
     $xml->writeAttribute('dir', $this->getDir());
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 4
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('delete');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task delete.', __METHOD__);
         return false;
     }
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('failonerror', $this->getFailOnError() ? 'true' : 'false');
     }
     if ($this->getIncludeEmptyDirs()) {
         $xml->writeAttribute('includeemptydirs', $this->getIncludeEmptyDirs() ? 'true' : 'false');
     }
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 5
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('chown');
     if (!$this->getFile() && !$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task chown.', __METHOD__);
         return false;
     }
     if (!$this->getUser()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No user set for task chown.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('user', $this->getUser());
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 6
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('replaceregexp');
     if (empty($this->_filesets) && empty($this->_file)) {
         SystemEvent::raise(SystemEvent::INFO, 'No files set for task replaceregexp.', __METHOD__);
         return false;
     }
     if (empty($this->_match)) {
         SystemEvent::raise(SystemEvent::INFO, 'Match attribute is mandatory for task replaceregexp.', __METHOD__);
         return false;
     }
     if (empty($this->_replace)) {
         SystemEvent::raise(SystemEvent::INFO, 'Replace attribute is mandatory for task replaceregexp.', __METHOD__);
         return false;
     }
     /*
         // TODO: Check Ant for existence of failonerror attribute
         if ($this->getFailOnError() !== null) {
           $xml->writeAttribute('failonerror', ($this->getFailOnError()?'true':'false'));
         }*/
     $xml->writeAttribute('match', $this->getMatch());
     $xml->writeAttribute('replace', $this->getReplace());
     if (!empty($this->_flags)) {
         $xml->writeAttribute('flags', $this->getFlags());
     }
     if (!empty($this->_file)) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 7
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('property');
     if (!$this->getName() || !$this->getValue()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Name and value not set for type property.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('name', $this->getName());
     $xml->writeAttribute('value', $this->getValue());
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 8
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getMessage()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Message not set for echo task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('echo');
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
         if ($this->getAppend() !== null) {
             $xml->writeAttribute('append', $this->getAppend() ? 'true' : 'false');
         }
     } else {
         $xml->text($this->getMessage());
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 9
0
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getText()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Empty properties text.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $properties = parse_ini_string($this->getText());
     foreach ($properties as $key => $value) {
         $xml->startElement('property');
         $xml->writeAttribute('name', $key);
         $xml->writeAttribute('value', $value);
         $xml->endElement();
     }
     return $xml->flush();
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
0
 public function toPhing()
 {
     if (!$this->isActive()) {
         return '';
     }
     $xml = new XmlDoc();
     $xml->startElement('phplint');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task php lint.', __METHOD__);
         return false;
     }
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('haltonfailure', $this->getFailOnError() ? 'true' : 'false');
     }
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 12
0
 public function toAnt()
 {
     $xml = new XmlDoc();
     $xml->startElement('fileset');
     if (!$this->getDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Root dir not set for type fileset.', __METHOD__);
         return false;
     }
     if ($this->getDir()) {
         $xml->writeAttribute('dir', $this->getDir());
     }
     if ($this->getDefaultExcludes() !== null) {
         $xml->writeAttribute('defaultexcludes', $this->getDefaultExcludes() ? 'yes' : 'no');
     }
     if ($this->getId()) {
         $xml->writeAttribute('id', $this->getId());
     }
     if ($this->getInclude()) {
         $includes = $this->getInclude();
         foreach ($includes as $include) {
             $xml->startElement('include');
             $xml->writeAttribute('name', $include);
             $xml->endElement();
         }
     }
     if ($this->getExclude()) {
         $excludes = $this->getExclude();
         foreach ($excludes as $exclude) {
             $xml->startElement('exclude');
             $xml->writeAttribute('name', $exclude);
             $xml->endElement();
         }
     }
     $xml->endElement();
     $ret = $xml->flush();
     $xml = null;
     unset($xml);
     return $ret;
 }
Exemplo n.º 13
0
 public function toPhing()
 {
     $xml = new XmlDoc();
     $xml->startElement('project');
     if (!$this->getTargets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No targets set for the project.', __METHOD__);
         return false;
     }
     if (!$this->getBaseDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No basedir set for the project.', __METHOD__);
         return false;
     }
     if ($this->getBaseDir() !== null) {
         $xml->writeAttribute('basedir', $this->getBaseDir());
     }
     if ($this->getDefaultTarget() !== null) {
         $xml->writeAttribute('default', $this->getDefaultTarget());
     }
     if ($this->getName() !== null) {
         $xml->writeAttribute('name', $this->getName());
     }
     if ($this->getProperties()) {
         $properties = $this->getProperties();
         foreach ($properties as $property) {
             $xml->writeRaw($property->toPhing());
         }
     }
     if ($this->getTargets()) {
         $targets = $this->getTargets();
         foreach ($targets as $target) {
             $xml->writeRaw($target->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 14
0
 public function toPhing()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('chmod');
     if (!$this->getFile() && !$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task chmod.', __METHOD__);
         return false;
     }
     $mode = $this->getMode();
     if (empty($mode) || !preg_match('/^\\d{3}$/', $mode)) {
         SystemEvent::raise(SystemEvent::ERROR, 'No mode set for task chmod.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('mode', $mode);
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 15
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']);
Exemplo n.º 17
0
 public function toPhing()
 {
     if (!$this->isActive()) {
         return '';
     }
     if (!$this->getExecutable()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Executable not set for exec task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('exec');
     if ($this->getOutputProperty()) {
         $xml->writeAttribute('outputProperty', $this->getOutputProperty());
     }
     if ($this->getBaseDir()) {
         $xml->writeAttribute('dir', $this->getBaseDir());
     }
     $args = '';
     if ($this->getArgs()) {
         $args = ' ' . implode(' ', $this->getArgs());
     }
     $xml->writeAttribute('command', $this->getExecutable() . $args);
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 18
0
 public function toPhing()
 {
     $xml = new XmlDoc();
     $xml->startElement('target');
     if (!$this->getName()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No name set for the target.', __METHOD__);
         return false;
     }
     if ($this->getName() !== null) {
         $xml->writeAttribute('name', $this->getName());
     }
     if ($this->getProperties()) {
         $properties = $this->getProperties();
         foreach ($properties as $property) {
             $xml->writeRaw($property->toPhing());
         }
     }
     if ($this->getDependencies()) {
         $dependencies = $this->getDependencies();
         $value = '';
         for ($i = 0; $i < count($dependencies); $i++) {
             if ($i > 0) {
                 $value .= ',';
             }
             $value .= $dependencies[$i];
         }
         $xml->writeAttribute('depends', $value);
     }
     if ($this->getTasks()) {
         $tasks = $this->getTasks();
         foreach ($tasks as $task) {
             $xml->writeRaw($task->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
Exemplo n.º 19
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;
 }