Esempio n. 1
0
function getPagesXmlValuesContent()
{
    global $pagesArray;
    $file = CATEGORIESPATH . "pages.xml";
    if (file_exists($file)) {
        // load the xml file and setup the array.
        $thisfile = file_get_contents($file);
        $data = simplexml_load_string($thisfile);
        $pages = $data->item;
        foreach ($pages as $page) {
            $key = $page->url;
            $pagesArray[(string) $key] = array();
            foreach ($page->children() as $opt => $val) {
                $pagesArray[(string) $key][(string) $opt] = (string) $val;
            }
        }
        $path = CONTENTPATH;
        $dir_handle = @opendir($path) or die("Unable to open {$path}");
        $filenames = array();
        while ($filename = readdir($dir_handle)) {
            $ext = substr($filename, strrpos($filename, '.') + 1);
            if ($ext == "xml") {
                $filenames[] = $filename;
            }
        }
        if (count($pagesArray) != count($filenames)) {
            create_pagesxmlContent('true');
            getPagesXmlValuesContent();
        }
    } else {
        create_pagesxmlContent('true');
        getPagesXmlValuesContent();
    }
}
Esempio n. 2
0
 *
 * @package * @CORE
 * @subpackage Page-Edit
 */
// Setup inclusions
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
// Variable settings
login_cookie_check();
$id = isset($_GET['id']) ? $_GET['id'] : null;
$ptype = isset($_GET['type']) ? $_GET['type'] : null;
$path = CONTENTPATH;
$counter = '0';
$table = '';
getPagesXmlValuesContent();
$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');