Пример #1
0
function bm_save_book()
{
    # create a backup if necessary
    if (isset($_POST['current-slug'])) {
        $file = $_POST['current-slug'] . '.xml';
        @rename(BMBOOKPATH . $file, BMBACKUPPATH . $file);
    }
    # empty titles are not allowed
    if (empty($_POST['book-title'])) {
        $_POST['book-title'] = '[No Title]';
    }
    # set initial slug and filename
    if (!empty($_POST['book-slug'])) {
        $slug = bm_create_slug($_POST['book-slug']);
    } else {
        $slug = bm_create_slug($_POST['book-title']);
    }
    $file = BMBOOKPATH . "{$slug}.xml";
    # do not overwrite other books
    if (file_exists($file)) {
        $count = 1;
        $file = BMBOOKPATH . "{$slug}-{$count}.xml";
        while (file_exists($file)) {
            $file = BMBOOKPATH . "{$slug}-" . ++$count . '.xml';
        }
        $slug = basename($file, '.xml');
    }
    # create undo target if there's a backup available
    if (isset($_POST['current-slug'])) {
        $backup = $slug . ':' . $_POST['current-slug'];
    }
    # collect $_POST data
    $title = safe_slash_html($_POST['book-title']);
    $timestamp = strtotime($_POST['book-date'] . ' ' . $_POST['book-time']);
    $date = $timestamp ? date('r', $timestamp) : date('r');
    $tags = str_replace(array(' ', ',,'), array('', ','), safe_slash_html($_POST['book-tags']));
    $private = isset($_POST['book-private']) ? 'Y' : '';
    $content = safe_slash_html($_POST['book-content']);
    # create xml object
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    $obj = $xml->addChild('title');
    $obj->addCData($title);
    $obj = $xml->addChild('date');
    $obj->addCData($date);
    $obj = $xml->addChild('tags');
    $obj->addCData($tags);
    $obj = $xml->addChild('private');
    $obj->addCData($private);
    $obj = $xml->addChild('content');
    $obj->addCData($content);
    # write data to file
    if (@XMLsave($xml, $file) && bm_update_cache()) {
        bm_display_message(i18n_r('books_manager/SUCCESS_SAVE'), false, @$backup);
    } else {
        bm_display_message(i18n_r('books_manager/SUCCESS_SAVE'), false, @$backup);
    }
}
Пример #2
0
 /**
  * build the xml structure where the content can be inserted
  *
  * @return void
  */
 private function _xmlbody()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     $root = $dom->createElement("tns:phpsysinfo");
     $root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
     $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/phpsysinfo3.xsd');
     $dom->appendChild($root);
     $this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
     $generation = $this->_xml->addChild('Generation');
     $generation->addAttribute('version', CommonFunctions::PSI_VERSION);
     $generation->addAttribute('timestamp', time());
     $options = $this->_xml->addChild('Options');
     $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? PSI_TEMP_FORMAT : 'c');
     $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? PSI_BYTE_FORMAT : 'auto_binary');
     $options->addAttribute('refresh', defined('PSI_REFRESH') ? PSI_REFRESH : 0);
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $plug = $this->_xml->addChild('UsedPlugins');
     if ($this->_complete_request && count($this->_plugins) > 0) {
         foreach ($this->_plugins as $plugin) {
             $plug->addChild('Plugin')->addAttribute('name', $plugin);
         }
     } elseif ($this->_plugin_request && count($this->_plugins) > 0) {
         $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
     }
 }
Пример #3
0
 /**
 * 增加节点值
 * @param array $data
 * @param SimpleXMLElement $xml
 * 
 * @return void
 */
 public static function node($data, SimpleXMLExtended &$xml)
 {
     foreach ($data as $k => $v) {
         if (is_array($v)) {
             is_numeric($k) && ($k = substr($xml->getName(), 0, -1));
             $subroot = $xml->addChild($k);
             self::node($v, $subroot);
         } else {
             if (is_numeric($v)) {
                 $xml->addChild($k, $v);
             } else {
                 $xml->addChild($k)->addCData($v);
             }
         }
     }
 }
Пример #4
0
 function saveTemplate($data)
 {
     My_Logger::log("in Ajax_TemplateEditorProcessor saveTemplate()");
     $expected = array('filename', 'type', 'time', 'concepts', 'instructions', 'problem');
     $filename = $this->get($data['filename']);
     if (empty($filename)) {
         throw new Exception('Missing Filename');
     }
     My_Logger::log("filename is " . $filename);
     foreach ($expected as $field) {
         $toCheck = $this->get($data[$field]);
         if (empty($toCheck)) {
             //if (empty($this->get($data[$field]))){
             throw new Exception('Missing field: ' . $field);
         }
     }
     //build xml
     $xml = new SimpleXMLExtended('<question/>');
     $xml->addAttribute('type', $this->get($data['type']));
     $xml->addChild('estimated_time', $this->get($data['time']));
     $concepts = $xml->addChild('concepts');
     $concepts->addChild('concept', $this->get($data['concepts']));
     $xml->addChild('difficulty', $this->get($data['difficulty']));
     $xml->addChild('instructions', $this->get($data['instructions']));
     //$xml->problem = null;
     //$xml->problem->addCData($this->get($data['problem']));
     $xml->addCData('problem', $this->get($data['problem']));
     $sc = $xml->addChild('substitutions');
     $subs = $this->get($data['s']);
     if ($subs) {
         foreach ($subs as $sd) {
             if (empty($sd['name']) || empty($sd['value'])) {
                 continue;
             }
             $s = $sc->addCData('substitution', $sd['value']);
             $s->addAttribute('val', $sd['name']);
         }
     }
     $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
     $path = $config->xml->import_path;
     $full_filename = $path . DIRECTORY_SEPARATOR . $filename;
     My_Logger::log("Saving to {$full_filename}");
     $xml->saveXML($full_filename);
     chmod($full_filename, 0666);
     return array('result' => 'success', 'msg' => "File '{$filename}' saved correctly");
 }
Пример #5
0
 /**
  * build the xml structure where the content can be inserted
  *
  * @return void
  */
 private function _xmlbody()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     $root = $dom->createElement("tns:phpsysinfo");
     $root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
     $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/ phpsysinfo3.xsd');
     $dom->appendChild($root);
     $this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
     $generation = $this->_xml->addChild('Generation');
     $generation->addAttribute('version', PSI_VERSION_STRING);
     $generation->addAttribute('timestamp', time());
     $options = $this->_xml->addChild('Options');
     $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
     $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
     if (defined('PSI_REFRESH')) {
         if (PSI_REFRESH === false) {
             $options->addAttribute('refresh', 0);
         } elseif (PSI_REFRESH === true) {
             $options->addAttribute('refresh', 1);
         } else {
             $options->addAttribute('refresh', PSI_REFRESH);
         }
     } else {
         $options->addAttribute('refresh', 60000);
     }
     if (defined('PSI_FS_USAGE_THRESHOLD')) {
         if (PSI_FS_USAGE_THRESHOLD === true) {
             $options->addAttribute('threshold', 1);
         } elseif (PSI_FS_USAGE_THRESHOLD !== false && PSI_FS_USAGE_THRESHOLD >= 1 && PSI_FS_USAGE_THRESHOLD <= 99) {
             $options->addAttribute('threshold', PSI_FS_USAGE_THRESHOLD);
         }
     } else {
         $options->addAttribute('threshold', 90);
     }
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $options->addAttribute('showCPUListExpanded', defined('PSI_SHOW_CPULIST_EXPANDED') ? PSI_SHOW_CPULIST_EXPANDED ? 'true' : 'false' : 'true');
     $options->addAttribute('showCPUInfoExpanded', defined('PSI_SHOW_CPUINFO_EXPANDED') ? PSI_SHOW_CPUINFO_EXPANDED ? 'true' : 'false' : 'false');
     if (count($this->_plugins) > 0) {
         if ($this->_plugin_request) {
             $plug = $this->_xml->addChild('UsedPlugins');
             $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
         } elseif ($this->_complete_request) {
             $plug = $this->_xml->addChild('UsedPlugins');
             foreach ($this->_plugins as $plugin) {
                 $plug->addChild('Plugin')->addAttribute('name', $plugin);
             }
         } else {
             $plug = $this->_xml->addChild('UnusedPlugins');
             foreach ($this->_plugins as $plugin) {
                 $plug->addChild('Plugin')->addAttribute('name', $plugin);
             }
         }
     }
 }
 /**
  * @return bool|mixed
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since 150213
  */
 protected function saveXML()
 {
     $dir = dirname($this->fileLocation);
     if (!file_exists($dir)) {
         mkdir($dir, 0755, true);
     }
     if ($this->simpleXML && !empty($this->fileLocation) && (is_writable($this->fileLocation) || is_writable($dir))) {
         $this->simpleXML->addChild($this->createdAtName, date('Y-m-d H:i'));
         return $this->simpleXML->asXML($this->fileLocation);
         // TODO Will this create the dir path?
     }
     return false;
 }
Пример #7
0
 /**
  * Function for converting to an XML document.
  * Pass in a multi dimensional array or object and this recrusively loops through and builds up an XML document.
  *
  * @param array $data
  * @param string $rootNodeName - what you want the root node to be - defaultsto data.
  * @param SimpleXMLElement $xml - should only be used recursively
  * @return string XML
  */
 public static function toXml($data, $rootNodeName = 'root', $xml = null, $encoding = 'utf-8', $cdata = false)
 {
     // turn off compatibility mode as simple xml throws a wobbly if you don't.
     if (ini_get('zend.ze1_compatibility_mode') == 1) {
         ini_set('zend.ze1_compatibility_mode', 0);
     }
     if ($xml == null) {
         $xml = new SimpleXMLExtended("<?xml version='1.0' encoding='" . $encoding . "'?><{$rootNodeName} />");
     }
     // loop through the data passed in.
     foreach ($data as $key => $value) {
         // no numeric keys in our xml please!
         if (is_numeric($key)) {
             // make string key...
             //return;
             $key = "row";
         }
         // if there is another array or object found recrusively call this function
         if (is_array($value) || is_object($value)) {
             $node = $xml->addChild($key);
             // recrusive call.
             self::toXml($value, $rootNodeName, $node, $encoding, $cdata);
         } else {
             // add single node.
             $value = is_bool($value) ? $value ? 'true' : 'false' : $value;
             $value = htmlspecialchars($value);
             if ($cdata === true) {
                 $node = $xml->addChild($key);
                 $node->addCData($value);
             } else {
                 $xml->addChild($key, $value);
             }
         }
     }
     // pass back as string. or simple xml object if you want!
     return $xml->asXML();
 }
Пример #8
0
 public function export_category()
 {
     $id = $this->session->userdata('admin_id');
     $cates = $this->catenews_model->list_all_byuser($id);
     $xml = new SimpleXMLExtended("<root></root>");
     foreach ($cates as $cate) {
         $xml_post = $xml->addChild('category');
         $xml_post->addChild('cat_id', $cate->id);
         $content = $xml_post->addChild('cat_name');
         $content->addCData($cate->catenewsname);
     }
     $dom = new DOMDocument("1.0");
     $dom->preserveWhiteSpace = false;
     $dom->formatOutput = true;
     $dom->loadXML($xml->asXML());
     $xml->asXML('export/' . $id . '/category.xml');
 }
Пример #9
0
function bm_cache_to_xml($books)
{
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
    foreach ($books as $book) {
        $item = $xml->addChild('item');
        $elem = $item->addChild('slug');
        $elem->addCData($book['slug']);
        $elem = $item->addChild('title');
        $elem->addCData($book['title']);
        $elem = $item->addChild('date');
        $elem->addCData($book['date']);
        $elem = $item->addChild('tags');
        $elem->addCData($book['tags']);
        $elem = $item->addChild('private');
        $elem->addCData($book['private']);
    }
    return @XMLsave($xml, BMBOOKCACHE);
}
Пример #10
0
function nm_cache_to_xml($posts)
{
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
    foreach ($posts as $post) {
        $item = $xml->addChild('item');
        $elem = $item->addChild('slug');
        $elem->addCData($post['slug']);
        $elem = $item->addChild('title');
        $elem->addCData($post['title']);
        $elem = $item->addChild('date');
        $elem->addCData($post['date']);
        $elem = $item->addChild('tags');
        $elem->addCData($post['tags']);
        $elem = $item->addChild('private');
        $elem->addCData($post['private']);
        $elem = $item->addChild('image');
        $elem->addCData($post['image']);
        if (!empty($post['author'])) {
            $elem = $item->addChild('author');
            $elem->addCData($post['author']);
        }
    }
    return @XMLsave($xml, NMPOSTCACHE);
}
 if (file_exists($file) && $url != $_POST['existing-url']) {
     $count = "1";
     $file = GSDATAPAGESPATH . $url . "-" . $count . ".xml";
     while (file_exists($file)) {
         $count++;
         $file = GSDATAPAGESPATH . $url . "-" . $count . ".xml";
     }
     $url = $url . '-' . $count;
 }
 // if we are editing an existing page, create a backup
 if (file_exists($file)) {
     $bakfile = GSBACKUPSPATH . "pages/" . $url . ".bak.xml";
     copy($file, $bakfile);
 }
 $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
 $xml->addChild('pubDate', date('r'));
 $note = $xml->addChild('title');
 $note->addCData($title);
 $note = $xml->addChild('url');
 $note->addCData($url);
 $note = $xml->addChild('meta');
 $note->addCData($metak);
 $note = $xml->addChild('metad');
 $note->addCData($metad);
 $note = $xml->addChild('menu');
 $note->addCData($menu);
 $note = $xml->addChild('menuOrder');
 $note->addCData($menuOrder);
 $note = $xml->addChild('menuStatus');
 $note->addCData($menuStatus);
 $note = $xml->addChild('template');
Пример #12
0
function nm_save_post()
{
    # create a backup if necessary
    if (isset($_POST['current-slug'])) {
        $file = $_POST['current-slug'] . '.xml';
        if (dirname(realpath(NMPOSTPATH . $file)) != realpath(NMPOSTPATH)) {
            die('');
        }
        // path traversal
        @nm_rename_file(NMPOSTPATH . $file, NMBACKUPPATH . $file);
    }
    # empty titles are not allowed
    if (empty($_POST['post-title']) || trim($_POST['post-title']) == '') {
        $_POST['post-title'] = '[No Title]';
    }
    # set initial slug and filename
    if (!empty($_POST['post-slug'])) {
        $slug = nm_create_slug($_POST['post-slug']);
    } else {
        $slug = nm_create_slug($_POST['post-title']);
        if ($slug == '') {
            $slug = 'post';
        }
    }
    $file = NMPOSTPATH . $slug . '.xml';
    # do not overwrite other posts
    if (file_exists($file)) {
        $count = 1;
        $file = NMPOSTPATH . $slug . '-' . $count . '.xml';
        while (file_exists($file)) {
            $file = NMPOSTPATH . $slug . '-' . ++$count . '.xml';
        }
        $slug = basename($file, '.xml');
    }
    # create undo target if there's a backup available
    if (isset($_POST['current-slug'])) {
        $backup = $slug . ':' . $_POST['current-slug'];
    }
    # collect $_POST data
    $title = safe_slash_html($_POST['post-title']);
    $timestamp = strtotime($_POST['post-date'] . ' ' . $_POST['post-time']);
    $date = $timestamp ? date('r', $timestamp) : date('r');
    $tags = nm_lowercase_tags(trim(preg_replace(array('/\\s+/', '/\\s*,\\s*/', '/,+/'), array(' ', ',', ','), safe_slash_html(trim($_POST['post-tags']))), ','));
    $private = isset($_POST['post-private']) ? 'Y' : '';
    $image = safe_slash_html($_POST['post-image']);
    $content = safe_slash_html($_POST['post-content']);
    if (defined('NMSAVEAUTHOR') && NMSAVEAUTHOR) {
        if (isset($_POST['author'])) {
            $author = safe_slash_html($_POST['author']);
        } else {
            global $USR;
            $author = $USR ? $USR : '';
        }
    }
    # create xml object
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    $obj = $xml->addChild('title');
    $obj->addCData($title);
    $obj = $xml->addChild('date');
    $obj->addCData($date);
    $obj = $xml->addChild('tags');
    $obj->addCData($tags);
    $obj = $xml->addChild('private');
    $obj->addCData($private);
    $obj = $xml->addChild('image');
    $obj->addCData($image);
    $obj = $xml->addChild('content');
    $obj->addCData($content);
    if (isset($author)) {
        $obj = $xml->addChild('author');
        $obj->addCData($author);
    }
    # write data to file
    if (@XMLsave($xml, $file) && nm_update_cache()) {
        nm_generate_sitemap();
        nm_display_message(i18n_r('news_manager/SUCCESS_SAVE'), false, @$backup);
    } else {
        nm_display_message(i18n_r('news_manager/ERROR_SAVE'), true);
    }
}
Пример #13
0
 $xml->addChild('USR', $USR);
 $xml->addChild('PWD', $PASSWD);
 $xml->addChild('EMAIL', $EMAIL);
 $xml->addChild('HTMLEDITOR', '1');
 $xml->addChild('TIMEZONE', $TIMEZONE);
 $xml->addChild('LANG', $LANG);
 if (!XMLsave($xml, GSUSERSPATH . $file)) {
     $kill = i18n_r('CHMOD_ERROR');
 }
 # create password change trigger file
 $flagfile = GSUSERSPATH . getPWDresetName(_id($USR), 'xml');
 copy_file(GSUSERSPATH . $file, $flagfile);
 # create new GSWEBSITEFILE (website.xml) file
 $file = GSWEBSITEFILE;
 $xmls = new SimpleXMLExtended('<item></item>');
 $note = $xmls->addChild('SITENAME');
 $note->addCData($SITENAME);
 $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)) {
Пример #14
0
function delete_in_category($file)
{
    $data = getXML($file);
    $section = $data->parent;
    $id = $data->url;
    $files = CATEGORIESPATH . '' . $section . '.xml';
    if (file_exists($files)) {
        $p = 0;
        $data = getXML($files);
        $array = array();
        foreach ($data->children() as $child) {
            if (sprintf("%s", $child) != $id) {
                $array[$p] = sprintf("%s", $child);
                $p++;
            }
        }
        //$array=array_reverse($array);
        $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
        $xml->addChild('pubDate', date('r'));
        for ($i = 1; $i < $p; $i++) {
            $note = $xml->addChild('f' . $i);
            $note->addCData($array[$i]);
        }
        XMLsave($xml, $files);
    }
}
Пример #15
0
        $count++;
    }
    $langs .= '</select><br />';
} else {
    $langs = '<b>' . i18n_r('LANGUAGE') . '</b>: &nbsp;<code style="color:red;">' . i18n_r('NONE') . '</code> &nbsp;&nbsp;';
}
# salt value generation
$api_file = GSDATAOTHERPATH . GSAUTHFILE;
if (!file_exists($api_file)) {
    if (getDef('GSUSECUSTOMSALT')) {
        $saltval = sha1(GSUSECUSTOMSALT);
    } else {
        $saltval = generate_salt();
    }
    $xml = new SimpleXMLExtended('<item></item>');
    $note = $xml->addChild('apikey');
    $note->addCData($saltval);
    if (!XMLsave($xml, $api_file)) {
        $kill = i18n_r('CHMOD_ERROR');
    }
}
# get salt value
$data = getXML($api_file);
$APIKEY = $data->apikey;
if (empty($APIKEY)) {
    $kill = i18n_r('CHMOD_ERROR');
}
$pagetitle = $site_full_name . ' &middot; ' . i18n_r('INSTALLATION');
get_template('header');
?>
	
Пример #16
0
 public static function toXml($data, $rootNodeName = 'root', $xml = null, $encoding = 'utf-8', $cdata = false)
 {
     if (ini_get('zend.ze1_compatibility_mode') == 1) {
         ini_set('zend.ze1_compatibility_mode', 0);
     }
     if ($xml == null) {
         $xml = new SimpleXMLExtended("<?xml version='1.0' encoding='" . $encoding . "'?><{$rootNodeName} />");
     }
     foreach ($data as $key => $value) {
         if (is_numeric($key)) {
             $key = "row";
         }
         if (is_array($value) || is_object($value)) {
             $node = $xml->addChild($key);
             self::toXml($value, $rootNodeName, $node, $encoding, $cdata);
         } else {
             $value = htmlspecialchars($value);
             if ($cdata === true) {
                 $node = $xml->addChild($key);
                 $node->addCData($value);
             } else {
                 $xml->addChild($key, $value);
             }
         }
     }
     return $xml->asXML();
 }
 /**
  * @brief Create the XML output of the AREL Object and send it to the junaio server.
  * @param ArelObject $oObject Object to be sent out
  */
 public static function outputObject($oObject)
 {
     $object = new SimpleXMLExtended("<object></object>");
     $object->addAttribute('id', (string) $oObject->getID());
     if ($oObject->getTitle()) {
         $object->addCData('title', $oObject->getTitle());
     }
     if ($oObject->getThumbnail()) {
         $object->addCData('thumbnail', $oObject->getThumbnail());
     }
     if ($oObject->getIcon()) {
         $object->addCData('icon', $oObject->getIcon());
     }
     //location
     if ($oObject->getLocation()) {
         $location = $object->addChild("location");
         $oLocation = $oObject->getLocation();
         try {
             $location->addChild('lat', $oLocation[0]);
             $location->addChild('lon', $oLocation[1]);
             if (isset($oLocation[2])) {
                 $location->addChild('alt', $oLocation[2]);
             } else {
                 $location->addChild('alt', 0);
             }
         } catch (Exception $e) {
             return $e;
         }
     }
     //popup
     if ($oObject->getPopup()) {
         $popup = $object->addChild("popup");
         $oPopUp = $oObject->getPopup();
         if ($oPopUp->getDescription()) {
             $popup->addCData('description', $oPopUp->getDescription());
         }
         if ($oPopUp->getButtons()) {
             $buttons = $popup->addChild("buttons");
             $aButtons = $oPopUp->getButtons();
             foreach ($aButtons as $oButton) {
                 $button = $buttons->addCData("button", $oButton[2]);
                 $button->addAttribute("id", $oButton[1]);
                 $button->addAttribute("name", $oButton[0]);
             }
         }
     }
     if ($oObject instanceof ArelObjectModel3D) {
         //assets3D
         $assets3D = $object->addChild("assets3d");
         if ($oObject->getModel()) {
             $assets3D->addCData('model', $oObject->getModel());
         }
         if ($oObject->getMovie()) {
             $assets3D->addCData('movie', $oObject->getMovie());
         }
         if ($oObject->getTexture()) {
             $assets3D->addCData('texture', $oObject->getTexture());
         }
         //transform
         $transform = $assets3D->addChild("transform");
         $oTransform = $oObject->getTransformParent();
         if (isset($oTransform)) {
             $transform->addAttribute("parent", $oTransform);
         }
         try {
             //translation
             $translation = $transform->addChild("translation");
             $oTranslation = $oObject->getTranslation();
             $translation->addChild("x", $oTranslation[0]);
             $translation->addChild("y", $oTranslation[1]);
             $translation->addChild("z", $oTranslation[2]);
             //rotation
             $rotation = $transform->addChild("rotation");
             $oRotationElement = $oObject->getRotation();
             $oRotation = $oRotationElement->getRotationValues();
             $oRotationType = $oRotationElement->getRotationType();
             $rotation->addAttribute("type", $oRotationType);
             if ($oRotationType !== ArelRotation::ROTATION_MATRIX) {
                 $rotation->addChild("x", $oRotation[0]);
                 $rotation->addChild("y", $oRotation[1]);
                 $rotation->addChild("z", $oRotation[2]);
                 if ($oRotationType == ArelRotation::ROTATION_QUATERNION) {
                     $rotation->addChild("w", $oRotation[3]);
                 } else {
                     if ($oRotationType == ArelRotation::ROTATION_AXISANGLE) {
                         $rotation->addChild("angle", $oRotation[3]);
                     }
                 }
             } else {
                 $rotation->addChild("m0", $oRotation[0]);
                 $rotation->addChild("m1", $oRotation[1]);
                 $rotation->addChild("m2", $oRotation[2]);
                 $rotation->addChild("m3", $oRotation[3]);
                 $rotation->addChild("m4", $oRotation[4]);
                 $rotation->addChild("m5", $oRotation[5]);
                 $rotation->addChild("m6", $oRotation[6]);
                 $rotation->addChild("m7", $oRotation[7]);
                 $rotation->addChild("m8", $oRotation[8]);
             }
             //scale
             $scale = $transform->addChild("scale");
             $oScale = $oObject->getScale();
             $scale->addChild("x", $oScale[0]);
             $scale->addChild("y", $oScale[1]);
             $scale->addChild("z", $oScale[2]);
         } catch (Exception $e) {
             return $e;
         }
         //properties
         $pickingEnabled = $oObject->isPickingEnabled();
         $cosID = $oObject->getCoordinateSystemID();
         $shaderMaterial = $oObject->getShaderMaterial();
         $occluding = $oObject->isOccluding();
         $transparency = $oObject->getTransparency();
         $renderPosition = $oObject->getRenderOrderPosition();
         $screenAnchor = $oObject->getScreenAnchor();
         if (isset($cosID) || isset($shaderMaterial) || isset($occluding) || isset($pickingEnabled) || isset($screenAnchor) || isset($transparency) || isset($renderPosition)) {
             $properties = $assets3D->addChild("properties");
             if (isset($cosID)) {
                 $properties->addChild("coordinatesystemid", $cosID);
             }
             if (isset($shaderMaterial)) {
                 $properties->addChild("shadermaterial", $shaderMaterial);
             }
             if ($occluding) {
                 $properties->addChild("occluding", "true");
             }
             if (isset($transparency) && $transparency > 0) {
                 $properties->addChild("transparency", $oObject->getTransparency());
             }
             if (isset($pickingEnabled) && !$pickingEnabled) {
                 $properties->addChild("pickingenabled", "false");
             }
             if (isset($renderPosition)) {
                 $properties->addChild("renderorder", $oObject->getRenderOrderPosition());
             }
             if (isset($screenAnchor)) {
                 $screenAnchorProperty = $properties->addChild("screenanchor", $oObject->getScreenAnchor());
                 if ($oObject->getScreenAnchorFlag() != NULL) {
                     $screenAnchorProperty->addAttribute("flags", $oObject->getScreenAnchorFlag(), null);
                 }
             }
         }
     }
     //viewparameters
     if ($oObject->getVisibility() || $oObject->getMinAccuracy() || $oObject->getMinDistance() || $oObject->getMaxDistance()) {
         $viewparameter = $object->addChild("viewparameters");
         if ($oObject->getVisibility()) {
             $visibility = $viewparameter->addChild("visibility");
             $oVisibility = $oObject->getVisibility();
             if (isset($oVisibility["liveview"]) && !$oVisibility["liveview"]) {
                 $visibility->addChild("liveview", "false");
             }
             if (isset($oVisibility["maplist"]) && !$oVisibility["maplist"]) {
                 $visibility->addChild("maplist", "false");
             }
             if (isset($oVisibility["radar"]) && !$oVisibility["radar"]) {
                 $visibility->addChild("radar", "false");
             }
             //alternatively for 0,1,2
             if (isset($oVisibility[0]) && !$oVisibility[0]) {
                 $visibility->addChild("liveview", "false");
             }
             if (isset($oVisibility[1]) && !$oVisibility[1]) {
                 $visibility->addChild("maplist", "false");
             }
             if (isset($oVisibility[2]) && !$oVisibility[2]) {
                 $visibility->addChild("radar", "false");
             }
         }
         if ($oObject->getMinAccuracy()) {
             $viewparameter->addChild("minaccuracy", $oObject->getMinAccuracy());
         }
         if ($oObject->getMinDistance()) {
             $viewparameter->addChild("mindistance", $oObject->getMinDistance());
         }
         if ($oObject->getMaxDistance()) {
             $viewparameter->addChild("maxdistance", $oObject->getMaxDistance());
         }
     }
     //parameters
     if ($oObject->getParameters()) {
         $parameters = $object->addChild("parameters");
         foreach ($oObject->getParameters() as $key => $parValue) {
             $parameter = $parameters->addCData("parameter", $parValue);
             $parameter->addAttribute("key", $key);
         }
     }
     $out = $object->asXML();
     $pos = strpos($out, "?>");
     echo utf8_encode(trim(substr($out, $pos + 2)));
     ob_flush();
 }
Пример #18
0
 private function saveMenu($post)
 {
     // initialization
     $return = $nodes = $saved = array();
     foreach ($post as $key => $val) {
         if (is_array($val)) {
             $nodes[] = $key;
         }
     }
     // sets up array
     foreach ($post['level'] as $key => $level) {
         foreach ($nodes as $node) {
             $return[$key][$node] = $post[$node][$key];
         }
         // fill empty fields
         if (empty($return[$key]['slug'])) {
             $return[$key]['slug'] = $this->strtoslug($return[$key]['title']);
         }
         // final formatting
         $return[$key]['slug'] = $this->strtoslug($return[$key]['slug']);
         $return[$key]['url'] = $this->transliterate($return[$key]['url']);
         // checks to see slug doesn't already exist
         if (in_array($return[$key]['slug'], $saved)) {
             $return[$key]['slug'] = $return[$key]['slug'] . '-' . rand(0, 100);
         }
         // add to saved array
         $saved[] = $return[$key]['slug'];
     }
     // build xml file
     $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel/>');
     $cdata = array('title', 'url');
     // menu items
     $menu = $xml->addChild('menu');
     foreach ($return as $key => $item) {
         $itemxml = $menu->addChild('item');
         foreach ($item as $field => $val) {
             if (in_array($field, $cdata)) {
                 $itemxml->{$field} = null;
                 $itemxml->{$field}->addCData($val);
             } else {
                 $itemxml->addChild($field, $val);
             }
         }
     }
     // settings
     $settings = $xml->addChild('settings');
     // format the xml file (beautify)
     $dom = new DOMDocument();
     $dom->preserveWhiteSpace = false;
     $dom->loadXML($xml->saveXML());
     $dom->formatOutput = true;
     // save to file
     $post['name'] = $this->strtoslug($post['name']);
     $newfile = GSDATAOTHERPATH . self::FILE . '/' . $post['name'] . '.xml';
     if (isset($post['oldname'])) {
         $oldfile = GSDATAOTHERPATH . self::FILE . '/' . $post['oldname'] . '.xml';
         if (file_exists($oldfile) && !file_exists($newfile)) {
             unlink($oldfile);
         }
     }
     return $dom->save($newfile);
 }
Пример #19
0
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/"
></rss>
XML;
$rss = new SimpleXMLExtended($xml);
$namespaces = $rss->getDocNamespaces(true);
// load the Newblur exported JSON file
$file = file_get_contents("starred_stories.json");
$json = json_decode($file, true);
// Wordpress will choke if our post names aren't unique, so we track
// them separately
$post_names = array();
$channel = $rss->addChild("channel");
$channel->addChild("generator", basename(__FILE__));
$channel->addChild("wxr_version", "1.2", $namespaces["wp"]);
// base_site_url is MUST. WordPress Importer warns if this does not exist
$channel->addChild("base_site_url", "http://asiajin.com/blog", $namespaces["wp"]);
foreach ($json["stories"] as $item) {
    $rssItem = $channel->addChild("item");
    $content = null;
    if (array_key_exists('story_content', $item)) {
        $content = $item['story_content'];
    } else {
        $content = '';
    }
    if (isset($item["story_title"])) {
        $rssItem->addChild("title", $item["story_title"]);
    }
Пример #20
0
function addComponentItem($xml, $title, $value, $active, $slug = null)
{
    if ($title != null && !empty($title)) {
        if ($slug == null || _id($slug) == '') {
            $slug = to7bit($title, 'UTF-8');
            $slug = clean_url($slug);
        }
        $title = safe_slash_html($title);
        $value = safe_slash_html($value);
        $disabled = $active;
        if (!is_object($xml)) {
            $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
        }
        # create the body of components.xml file
        $component = $xml->addChild('item');
        $c_note = $component->addChild('title');
        $c_note->addCData($title);
        $component->addChild('slug', $slug);
        $c_note = $component->addChild('value');
        $c_note->addCData($value);
        $c_note = $component->addChild('disabled');
        $c_note->addCData($disabled);
    }
    // debugLog(var_dump($component->asXML()));
    return $xml;
}
Пример #21
0
 /**
  * converts the internal error and warning list to a XML file
  *
  * @return void
  */
 public function errorsAsXML()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     $root = $dom->createElement("phpsysinfo");
     $dom->appendChild($root);
     $xml = new SimpleXMLExtended(simplexml_import_dom($dom), 'UTF-8');
     $generation = $xml->addChild('Generation');
     $generation->addAttribute('version', PSI_VERSION_STRING);
     $generation->addAttribute('timestamp', time());
     $xmlerr = $xml->addChild("Errors");
     foreach ($this->_arrErrorList as $arrLine) {
         $error = $xmlerr->addCData('Error', $arrLine['message']);
         $error->addAttribute('Function', $arrLine['command']);
     }
     header("Cache-Control: no-cache, must-revalidate\n");
     header("Content-Type: text/xml\n\n");
     echo $xml->getSimpleXmlElement()->asXML();
     exit;
 }
Пример #22
0
 /**
  * recursive function to allow appending child processes to a parent process
  *
  * @param Array             $child      part of the array which should be appended to the XML
  * @param SimpleXMLExtended $xml        XML-Object to which the array content is appended
  * @param Array             &$positions array with parent positions in xml structure
  *
  * @return SimpleXMLExtended Object with the appended array content
  */
 private function _addchild($child, $xml, &$positions)
 {
     foreach ($child as $key => $value) {
         $xmlnode = $xml->addChild("Process");
         foreach ($value as $key2 => $value2) {
             if (!is_array($value2)) {
                 switch ($key2) {
                     case 0:
                         array_push($positions, $value2);
                         $xmlnode->addAttribute('PID', $value2);
                         break;
                     case 1:
                         $xmlnode->addAttribute('ParentID', array_search($value2, $positions));
                         $xmlnode->addAttribute('PPID', $value2);
                         break;
                     case 2:
                         $xmlnode->addAttribute('MemoryUsage', $value2);
                         break;
                     case 3:
                         $xmlnode->addAttribute('Name', $value2);
                         break;
                 }
             } else {
                 $this->_addChild($value2, $xml, $positions);
             }
         }
     }
     return $xml;
 }
Пример #23
0
 /**
  * returns the XML string
  *
  * @return string
  * @throws \Zend_Config_Exception
  */
 public function render()
 {
     $xml = new SimpleXMLExtended('<' . $this->getRootElementName() . ' />');
     if ($this->_config) {
         $extends = $this->_config->getExtends();
         $sectionName = $this->_config->getSectionName();
         if (is_string($sectionName)) {
             $child = $xml->addChild($sectionName);
             $this->_addBranch($this->_config, $child, $xml);
         } else {
             foreach ($this->_config as $sectionName => $data) {
                 if (!$data instanceof \Zend_Config) {
                     $this->addChildConsiderCdata($xml, $sectionName, $data);
                 } else {
                     $child = $xml->addChild($sectionName);
                     if (isset($extends[$sectionName])) {
                         $child->addAttribute('zf:extends', $extends[$sectionName], \Zend_Config_Xml::XML_NAMESPACE);
                     }
                     $this->_addBranch($data, $child, $xml);
                 }
             }
         }
     }
     $dom = dom_import_simplexml($xml)->ownerDocument;
     if ($encoding = $this->getEncoding()) {
         $dom->encoding = $encoding;
     }
     $dom->formatOutput = $this->getFormatOutput();
     $xmlString = $dom->saveXML();
     return $xmlString;
 }
Пример #24
0
 if (isset($_POST['timezone'])) {
     $SITETIMEZONE = var_in($_POST['timezone']);
 }
 if (isset($_POST['lang'])) {
     $SITELANG = var_in($_POST['lang']);
 }
 // check valid lang files
 if (!in_array($LANG . '.php', $lang_array) and !in_array($LANG . '.PHP', $lang_array)) {
     die;
 }
 # create website xml file
 $bakpath = GSBACKUPSPATH . getRelPath(GSDATAOTHERPATH, GSDATAPATH);
 // backups/other/
 createBak(GSWEBSITEFILE, GSDATAOTHERPATH, $bakpath);
 $xmls = new SimpleXMLExtended('<item></item>');
 $note = $xmls->addChild('SITENAME');
 $note->addCData($SITENAME);
 $note = $xmls->addChild('SITEURL');
 $note->addCData($SITEURL);
 $note = $xmls->addChild('TEMPLATE');
 $note->addCData($TEMPLATE);
 $xmls->addChild('PRETTYURLS', $PRETTYURLS);
 $xmls->addChild('PERMALINK', $PERMALINK);
 $xmls->addChild('EMAIL', $SITEEMAIL);
 $xmls->addChild('TIMEZONE', $TIMEZONE);
 $xmls->addChild('LANG', $LANG);
 $xmls->addChild('SITEUSR', $SITEUSR);
 exec_action('settings-website');
 if (!XMLsave($xmls, GSDATAOTHERPATH . GSWEBSITEFILE)) {
     $error = i18n_r('CHMOD_ERROR');
 }
Пример #25
0
/**
 * create a page xml obj
 *
 * @since 3.4
 * @param  str      $title     title of page
 * @param  str      $url       optional, url slug of page, if null title is used
 * @param  array   	$data      optional, array of data fields for page
 * @param  boolean 	$overwrite optional, overwrite exisitng slugs, if false auto increments slug id
 * @return obj                 xml object of page
 */
function createPageXml($title, $url = null, $data = array(), $overwrite = false)
{
    global $reservedSlugs;
    $fields = array('title', 'titlelong', 'summary', 'url', 'author', 'template', 'parent', 'menu', 'menuStatus', 'menuOrder', 'private', 'meta', 'metad', 'metarNoIndex', 'metarNoFollow', 'metarNoArchive', 'content');
    // setup url, falls back to title if not set
    if (!isset($url)) {
        $url = $title;
    }
    $url = prepareSlug($url);
    // prepare slug, clean it, translit, truncate
    $title = truncate($title, GSTITLEMAX);
    // truncate long titles
    // If overwrite is false do not use existing slugs, get next incremental slug, eg. "slug-count"
    if (!$overwrite && (file_exists(GSDATAPAGESPATH . $url . ".xml") || in_array($url, $reservedSlugs))) {
        list($newfilename, $count) = getNextFileName(GSDATAPAGESPATH, $url . '.xml');
        $url = $url . '-' . $count;
        // die($url.' '.$newfilename.' '.$count);
    }
    // store url and title in data, if passed in param they are ignored
    $data['url'] = $url;
    $data['title'] = $title;
    // create new xml
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    $xml->addChild('pubDate', date('r'));
    foreach ($fields as $field) {
        $node = $xml->addChild($field);
        if (isset($data[$field])) {
            $node->addCData($data[$field]);
        }
        // saving all cdata for some reason
    }
    // debugLog(__FUNCTION__ . ': page created with slug of ' . $xml->url);
    return $xml;
}
Пример #26
0
 /**
  * recursive function to allow appending child processes to a parent process
  *
  * @param Array             $child      part of the array which should be appended to the XML
  * @param SimpleXMLExtended $xml        XML-Object to which the array content is appended
  * @param Array             &$positions array with parent positions in xml structure
  *
  * @return SimpleXMLExtended Object with the appended array content
  */
 private function _addchild($child, SimpleXMLExtended $xml, &$positions)
 {
     foreach ($child as $key => $value) {
         $xmlnode = $xml->addChild("Process");
         if (isset($value[0])) {
             array_push($positions, $value[0]);
             $xmlnode->addAttribute('PID', $value[0]);
             $parentid = array_search($value[1], $positions);
             $xmlnode->addAttribute('ParentID', $parentid);
             $xmlnode->addAttribute('PPID', $value[1]);
             $xmlnode->addAttribute('MemoryUsage', $value[2]);
             $xmlnode->addAttribute('Name', $value[3]);
             if (PSI_OS !== 'WINNT') {
                 if ($parentid === 1) {
                     $xmlnode->addAttribute('Expanded', 0);
                 }
                 if (defined('PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED') && PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED === false && $value[3] === "[kthreadd]") {
                     $xmlnode->addAttribute('Expanded', 0);
                 }
             }
         }
         if (isset($value['childs'])) {
             $this->_addChild($value['childs'], $xml, $positions);
         }
     }
     return $xml;
 }
Пример #27
0
$theme_options = '';
# was the form submitted?
if (isset($_POST['submitted']) && isset($_POST['template'])) {
    check_for_csrf("activate");
    # get passed value from form
    $newTemplate = var_in($_POST['template']);
    if (!path_is_safe(GSTHEMESPATH . $newTemplate, GSTHEMESPATH)) {
        die;
    }
    # backup old GSWEBSITEFILE (website.xml) file
    $bakpath = GSBACKUPSPATH . getRelPath(GSDATAOTHERPATH, GSDATAPATH);
    // backups/other/
    createBak($file, $path, $bakpath);
    # udpate GSWEBSITEFILE (website.xml) file with new theme
    $xml = new SimpleXMLExtended('<item></item>');
    $note = $xml->addChild('SITENAME');
    $note->addCData($SITENAME);
    $note = $xml->addChild('SITEURL');
    $note->addCData($SITEURL);
    $note = $xml->addChild('TEMPLATE');
    $note->addCData($newTemplate);
    $xml->addChild('PRETTYURLS', $PRETTYURLS);
    $xml->addChild('PERMALINK', $PERMALINK);
    XMLsave($xml, $path . $file);
    $success = i18n_r('THEME_CHANGED');
    $TEMPLATE = $newTemplate;
    // set new global
}
# get available themes (only look for folders)
$themes_handle = opendir(GSTHEMESPATH) or die("Unable to open " . GSTHEMESPATH);
while ($file = readdir($themes_handle)) {
Пример #28
0
if (!empty($_GET["type"])) {
    $property_type = $_GET["type"];
    #-----------------------------------------------------------------
    #-----------Подключение к базе
    $resource = mysql_connect($server, $login, $password) or die(mysql_error());
    $db = mysql_select_db($db_name) or die("Ошибка базы данных");
    #--------------------------------------------------
    # переменные для заголовка XML файла
    #$generation_date = date("Y-m-d\TH:i:s+04:00",time());
    # дата генерации xml файл в формате ISO 8601
    //$generation_date = date("c",time());
    $date1 = date("Y-m-d", time() - 3600 * 24 * $day_max);
    #---------------------------------------------
    #    Генерация XML, запись заголовка
    $rss = new SimpleXMLExtended('<?xml version="1.0" encoding="utf-8"?><rss version="2.0"></rss>');
    $xml = $rss->addChild('channel');
    $xml->link = $rss_link;
    //$node = $xml-> addChild ('generation-date', $generation_date);
    #---------------------------------------------
    #----------------------------------------------
    #       запрос к таблице flat
    if ($property_type == $name_id_flat) {
        $rss_title = "mari12.ru - продажа квартир";
        $rss_description = "Новые объявления по продаже квартир в Йошкар-Оле и Марий Эл";
        $xml->addChild('title', $rss_title);
        $xml->addChild('description', $rss_description);
        $sqlrequest = 'SELECT tenement.storeys AS storeys, tenement.type_id AS t_typeId, flat.id AS flat_id, flat.price AS price, flat.rooms AS rooms, flat.storey AS floor,
					flat.description AS description, flat.updated_on AS updated_on, street.name AS street_name, photo.name AS photo_name,
					flat.is_owner  AS is_owner, photoT.name AS photo_name_tenement, flat.loggia AS loggia, flat.tenement_id					
					FROM flat 
					LEFT JOIN tenement ON  flat.tenement_id = tenement.id 
Пример #29
0
 $xml->addChild('USR', $USR);
 $xml->addChild('PWD', $PASSWD);
 $xml->addChild('EMAIL', $EMAIL);
 $xml->addChild('HTMLEDITOR', '1');
 $xml->addChild('TIMEZONE', $TIMEZONE);
 $xml->addChild('LANG', $LANG);
 if (!XMLsave($xml, GSUSERSPATH . $file)) {
     $kill = i18n_r('CHMOD_ERROR');
 }
 # create password change trigger file
 $flagfile = GSUSERSPATH . _id($USR) . ".xml.reset";
 copy(GSUSERSPATH . $file, $flagfile);
 # create new website.xml file
 $file = 'website.xml';
 $xmls = new SimpleXMLExtended('<item></item>');
 $note = $xmls->addChild('SITENAME');
 $note->addCData($SITENAME);
 $note = $xmls->addChild('SITEURL');
 $note->addCData($SITEURL);
 $xmls->addChild('TEMPLATE', 'Innovation');
 $xmls->addChild('PRETTYURLS', '');
 $xmls->addChild('PERMALINK', '');
 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($temp, $init);
 }
Пример #30
0
 /** 
  * Creates Blog Posts Cache File
  * 
  * @return bool
  */
 public function createPostsCache()
 {
     $posts = $this->listPosts(true, true);
     if ($posts === false) {
         $posts = array();
     }
     $count = 0;
     $xml = new SimpleXMLExtended('<?xml version="1.0"?><item></item>');
     if (!count($posts) < 1) {
         foreach ($posts as $post) {
             $data = getXML($post['filename']);
             $new_post = $xml->addChild("post");
             foreach ($data as $key => $value) {
                 $post_parent = $new_post->addChild($key);
                 $post_parent->addCData($value);
             }
         }
         $save_cache = XMLsave($xml, BLOGCACHEFILE);
     }
 }