Example #1
0
// Cache for 4 hours
if ($age > 3600 * 4 || !$settings->enableCaching) {
    $metaTitle = $lGeneral["Pages"];
    include layoutPath . "/template/metaHeader.template.php";
    $output = $metaHeader;
    global $page;
    $result = $dbi->query("SELECT id FROM " . pageTableName . " WHERE showInMenu=1 AND parentId=0 ORDER BY position");
    if ($result->rows()) {
        $previousSelected = false;
        for ($i = 0; list($pageId) = $result->fetchrow_array(); $i++) {
            $page1 = new Page($pageId);
            $isParent = !empty($page) ? $page1->isParent($page->id) : false;
            // Prepare template values
            $metaCount = -1;
            $metaTitle = $page1->title;
            $metaLink = $page1->getPageLink();
            // Include template
            include layoutPath . "/template/metaBody.template.php";
            $output .= $metaBody;
            $previousSelected = $isParent;
        }
    }
    include layoutPath . "/template/metaFooter.template.php";
    $output .= $metaFooter;
    // Save output in cache
    $fp = fopen($cache, 'w');
    fwrite($fp, $output);
    fclose($fp);
} else {
    $output = file_get_contents($cache);
}
Example #2
0
function printNavigationOption($id = 0, $dashes = 0)
{
    global $dbi;
    $result = $dbi->query("SELECT id FROM " . pageTableName . " WHERE parentId=" . $dbi->quote($id) . " AND id!=0 ORDER BY position");
    for ($i = 0; list($id2) = $result->fetchrow_array(); $i++) {
        $page = new Page($id2);
        echo "<option value=\"" . $page->getPageLink() . "\">";
        for ($j = 0; $j < $dashes; $j++) {
            echo "- ";
        }
        echo $page->title;
        echo "</option>";
        if (!empty($id2)) {
            printNavigationOption($id2, $dashes + 1);
        }
        $j = 0;
    }
}
Example #3
0
    }
}
// Display login widget
if (file_exists(widgetPath . "/system/login.php")) {
    include widgetPath . "/system/login.php";
}
?>
					</div>
				</div>

				<div class="layoutNavigation">
					<?php 
$default = new Page(pageDefaultPage);
?>
					<a href="<?php 
echo $default->getPageLink();
?>
" class="navigation1"><?php 
echo $default->title;
?>
</a>
					<?php 
if (!empty($this->navigationLinks)) {
    for ($i = 0; $i < sizeof($this->navigationLinks); $i++) {
        echo " ยป <a href=\"" . $this->navigationLinks[$i][0] . "\" class=\"navigation1\">" . $this->navigationLinks[$i][1] . "</a>";
    }
}
?>
		
				</div>
			</div>
Example #4
0
 /**
  * Print search results for a given search string.
  * @param	$searchString
  * @param	$limit
  * @param	$page
  * @param	$viewAll
  */
 function printSearchResults($searchString, $limit = 0, $page = 0, $viewAll = 0)
 {
     global $dbi, $login;
     $result = $dbi->query("SELECT id,MATCH(title,text,leftText,rightText) AGAINST (" . $dbi->quote($searchString) . " IN BOOLEAN MODE) AS score FROM " . pageTableName . " WHERE MATCH(title, text, leftText, rightText) AGAINST (" . $dbi->quote($searchString) . " IN BOOLEAN MODE) ORDER BY score DESC" . (!empty($limit) && $viewAll ? " LIMIT " . $limit * $page . "," . $limit : (!empty($limit) ? " LIMIT " . $limit : "")));
     $highlight = str_replace("\"", "", stripslashes($searchString));
     for ($i = 0; list($id, $score) = $result->fetchrow_array(); $i++) {
         $page = new Page($id);
         printSearchResultItem($searchString, $page->title, $page->text, $page->getPageLink(), $score);
     }
     $result->finish();
 }
Example #5
0
    $login->printLoginForm();
    exit;
}
// Delete page
if (!empty($_POST["deletePage"])) {
    // Delete page
    $pageObject->deletePage($pageObject->id);
    // Redirect to page index
    redirect(scriptUrl . "/" . folderPage . "/" . filePageIndex);
} else {
    if (!empty($_GET["save"])) {
        $errors = $pageObject->savePage();
        // Redirect to page index if referer is empty
        if (!$errors->hasErrors()) {
            $referer = getPostValue("referer");
            redirect(!empty($referer) ? $referer : $pageObject->getPageLink());
        }
    }
}
// Add navigation links
$site->addNavigationLink(scriptUrl . "/" . folderAdmin, $lAdminIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderPage, $lPageIndex["Header"]);
if (!empty($pageObject->id)) {
    $site->addNavigationLink(scriptUrl . "/" . folderPage . "/" . filePageEdit . "?pageId=" . $pageObject->id, $lEditPage["EditPage"]);
} else {
    $site->addNavigationLink(scriptUrl . "/" . folderPage . "/" . filePageEdit, $lEditPage["NewPage"]);
}
// Print common header
$site->printHeader();
// Print header text
echo "<p>";