Example #1
0
 public function process($name, $value)
 {
     if ($value != null && $value["name"] != null && $value["tmp_name"] != null) {
         $strDest = getRootPath() . $this->options["path"];
         $strName = ereg_replace("[^A-Za-z0-9\\.]", "-", $value["name"]);
         if (!file_exists($strDest)) {
             mkdir($strDest);
         }
         if ($this->options["conflict"] == "make-unique") {
             // fancy action: make files unique
             $strOrigName = $strName;
             $i = 1;
             while (file_exists("{$strDest}/{$strName}")) {
                 $strName = ereg_replace("(\\.[^\\.]*)\$", "_{$i}\\1", $strOrigName);
                 $i++;
             }
         } elseif (file_exists("{$strDest}/{$strName}")) {
             // default action: overwrite
             unlink("{$strDest}/{$strName}");
         }
         copy($value["tmp_name"], "{$strDest}/{$strName}");
         return $strName;
     }
     return "";
 }
Example #2
0
 public function edit($name, $id, $value)
 {
     $value = htmlentities($value);
     $strReturn = "<!-- TINYMCE -->";
     $strReturn .= "<textarea name=\"{$name}\" id=\"{$id}\" rows=\"30\" cols=\"80\" style=\"width: 100%\">{$value}</textarea>";
     $strReturn .= "<script type=\"text/javascript\">\n\t\t\t\ttinyMCE.init({\n\t\t\t\t\t// General options\n\t\t\t\t\tmode : \"exact\",\n\t\t\t\t\ttheme : \"advanced\",\n\t\t\t\t\telements : \"{$id}\",\n\t\t\t\t\tplugins : \"safari,pagebreak,style,layer,table,save,advhr,advimage,imgmap,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount\",\n\t\t\t\t\trelative_urls : false,\n\t\t\t\t\t\n\t\t\t\t\t// Theme options\n\t\t\t\t\ttheme_advanced_buttons1 : \"save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect\",\n\t\t\t\t\ttheme_advanced_buttons2 : \"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,imgmap,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor\",\n\t\t\t\t\ttheme_advanced_buttons3 : \"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen\",\n\t\t\t\t\ttheme_advanced_buttons4 : \"insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak\",\n\t\t\t\t\ttheme_advanced_toolbar_location : \"top\",\n\t\t\t\t\ttheme_advanced_toolbar_align : \"left\",\n\t\t\t\t\ttheme_advanced_statusbar_location : \"bottom\",\n\t\t\t\t\ttheme_advanced_resizing : true,\n\t\t\t\t\t\n\t\t\t\t\t// Content CSS (should be your site CSS)\n\t\t\t\t\t";
     if (file_exists(getRootPath() . "/styles/" . SettingsHelper::getSetting("Theme") . "/lib/editor.css")) {
         $strReturn .= "content_css : \"" . getRootURL() . "/styles/" . SettingsHelper::getSetting("Theme") . "/lib/editor.css\",";
     } else {
         $strReturn .= "content_css : \"lib/tinymce/css/content.css\",";
     }
     $strReturn .= "\n\t\t\t\t\t\n\t\t\t\t\t// Drop lists for link/image/media/template dialogs\n\t\t\t\t\texternal_link_list_url : \"lib/tinymce/lists.php?type=link\",\n\t\t\t\t\texternal_image_list_url : \"lib/tinymce/lists.php?type=image\",\n\t\t\t\t\tmedia_external_list_url : \"lib/tinymce/lists.php?type=media\"\n\t\t\t\t});\n\t\t</script>";
     $strReturn .= "<!-- /TINYMCE -->";
     return $strReturn;
 }
Example #3
0
 public function edit($name, $id, $value)
 {
     $strReturn = "<select name=\"{$name}\" id=\"{$id}\"";
     if (array_key_exists("multiple", $this->options) && $this->options["multiple"] == true) {
         $strReturn .= " multiple";
     }
     $strReturn .= ">";
     $aryOptions = array();
     if (array_key_exists("options", $this->options)) {
         $xmlOptions = $this->options["options"];
         foreach ($xmlOptions as $o) {
             $stcOption = array();
             $stcOption["text"] = $o->nodeValue;
             $stcOption["value"] = $o->getAttribute("value");
             $aryOptions[] = $stcOption;
         }
     } else {
         $objDir = dir(getRootPath() . "/styles");
         while (false !== ($strEntry = $objDir->read())) {
             if (substr($strEntry, 0, 1) != ".") {
                 $stcOption = array();
                 $stcOption["text"] = $strEntry;
                 $stcOption["value"] = $strEntry;
                 $aryOptions[] = $stcOption;
             }
         }
     }
     $blnFound = false;
     foreach ($aryOptions as $o) {
         $v = $o["value"];
         $t = $o["text"];
         if ($v == null) {
             $v = $t;
         }
         if ($v == $value) {
             $strReturn .= "<option value=\"" . $v . "\" selected>" . $t . "</option>";
             $blnFound = true;
         } else {
             $strReturn .= "<option value=\"" . $v . "\">" . $t . "</option>";
         }
     }
     if (!$blnFound) {
         $strReturn .= "<option value=\"" . $value . "\" selected>" . $value . "</option>";
     }
     $strReturn .= "</select>";
     return $strReturn;
 }
Example #4
0
<?php

include_once getRootPath() . "/classes/controls/ListBuilder.php";
?>

<?php 
ListBuilder::init();
?>

<form action="" method="POST" class="edit" id="frmLayout">

	<h2>Editing Layout: <?php 
echo $strNode;
?>
</h2>

	<ul id="actions-nav">
		<li>
			<a href="node-edit.php?node=<?php 
echo $strNode;
?>
">
				<img src="images/go-previous.png" alt="Go back" width="16" height="16" border="0" align="left">
				Go back
			</a>
		</li>
		<li>
			<a href="#" onclick="javascript:$('#frmLayout').submit();return false;">
				<img src="images/page-save.png" alt="Save layout" width="16" height="16" border="0" align="left">
				Save layout
			</a>
Example #5
0
	/**
	 * get file url
	 *
	 * @param string $value
	 * @return string
	 */
	function getFileUrl($value)
	{
		$output = '';
		$wwwroot = removeTrailingSlash(backslashToSlash(getRootPath()));

	
		$urlprefix = "";
		$urlsuffix = "";

		$value = backslashToSlash(getRealPath($value));


		$pos = stripos($value, $wwwroot);
		if ($pos !== false )
		{
			$output  = $urlprefix . substr($value, $pos + strlen($wwwroot)) . $urlsuffix;
		}else 
		{
			$output = $value;
		}
		$protocol = (isset($_SERVER["HTTPS"]) &&  $_SERVER["HTTPS"] == 'on' ? 'https' : 'http');
		return $protocol . "://" .  addTrailingSlash(backslashToSlash($_SERVER['HTTP_HOST'])) . removeBeginingSlash(backslashToSlash($output));
	}
Example #6
0
<?php

include_once getRootPath() . "/classes/core/Page.php";
include_once getRootPath() . "/classes/core/ContentType.php";
if (array_key_exists("node", $_REQUEST)) {
    $strNode = stripslashes($_REQUEST["node"]);
} else {
    $strNode = "/home";
}
if ($strNode == "") {
    $strName = "[root]";
} else {
    $strName = $strNode;
}
if (Page::isPage($strNode)) {
    $objPage = new Page($strNode);
    $objType = $objPage->getContentTypeObject();
    $strType = $objType->name;
} else {
    $strType = "content";
}
$aryTypes = ContentType::getContentTypes();
Example #7
0
<?php

require_once getRootPath() . "/classes/core/Page.php";
if (array_key_exists("node", $_REQUEST)) {
    $strNode = stripslashes($_REQUEST["node"]);
} else {
    $strNode = "/home";
}
$objPage = new Page($strNode);
$objContentType = $objPage->getContentTypeObject();
$strType = $objContentType->getName();
$strName = $objPage->getName();
$aryTypes = ContentType::getContentTypes();
$aryFields = $objContentType->getFields();
if (!isset($aryInvalid)) {
    $aryInvalid = array();
}
$blnActive = $objPage->getActive();
Example #8
0
function getUploadPath()
{
    global $UPLOAD_FOLDER;
    return getRootPath() . $UPLOAD_FOLDER;
}
Example #9
0
<?php

include_once getRootPath() . "/classes/core/Page.php";
include_once getRootPath() . "/classes/core/Layout.php";
if (array_key_exists("node", $_REQUEST)) {
    $strNode = stripslashes($_REQUEST["node"]);
} else {
    $strNode = "/home";
}
$objPage = new Page($strNode);
$strLayout = $objPage->getLayout()->name;
$aryLayouts = Layout::getLayouts();
$aryPlaceholders = $objPage->getLayout()->getPlaceHolders();
$aryPagePlaceholders = $objPage->getPlaceHolders();
$aryViewsSelected = array();
$aryViewsAvailable = array();
foreach ($aryPagePlaceholders as $ph) {
    $strName = strToLower($ph->name);
    $aryViews = $ph->getViews();
    $aryViewsSelected[$strName] = array();
    foreach ($aryViews as $v) {
        $aryViewsSelected[$strName][] = $v->path;
    }
}
foreach ($aryPlaceholders as $strName) {
    $strName = strToLower($strName);
    $aryViewsAvailable[$strName] = PlaceHolder::getViewsAvailable($strName);
}
Example #10
0
    $width = $_GET["w"];
}
if (array_key_exists("h", $_GET) && is_numeric($_GET["h"])) {
    $height = $_GET["h"];
}
if ($path == null) {
    exit;
} elseif ($width == null && $height == null) {
    header("location: {$path}");
    exit;
}
$ext = strToLower(preg_replace("/^.*\\./", "", $path));
$image_path = realpath($path);
$cache_name = "path=" . $path . ";w=" . $width . ";h=;" . $height;
$cache_file = md5($cache_name) . "." . $ext;
$cache_folder_path = getRootPath() . "/" . "_image_cache/";
$cache_folder_url = getRootURL() . "/" . "_image_cache/";
$cache_path = $cache_folder_path . $cache_file;
$cache_url = $cache_folder_url . $cache_file;
if (file_exists($cache_path)) {
    switch ($ext) {
        case "gif":
            header('Content-type: image/gif');
            $cache = imageCreateFromGif($cache_path);
            imageGif($cache);
            break;
        case "jpg":
            header('Content-type: image/jpeg');
            $cache = imageCreateFromJpeg($cache_path);
            imageJpeg($cache);
            break;
 public function test_getRootPath()
 {
     $result = getRootPath(__FILE__);
     $this->assertEquals($result, __FILE__);
 }
Example #12
0
 public function render(Page $PAGE)
 {
     require_once getRootPath() . "/classes/helpers/LayoutHelper.php";
     require_once getRootPath() . "/classes/helpers/SettingsHelper.php";
     include $this->path;
 }
/**
 * get file url
 *
 * @param string $value
 * @return string
 */
function getFileUrl($value)
{
    $wwwroot = removeTrailingSlash(backslashToSlash(getRootPath()));
    $urlprefix = '';
    $urlsuffix = '';
    $value = backslashToSlash(getRealPath($value));
    $pos = stripos($value, $wwwroot);
    if ($pos !== false) {
        $output = $urlprefix . substr($value, $pos + strlen($wwwroot)) . $urlsuffix;
    } else {
        $output = $value;
    }
    $protocol = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 'https' : 'http';
    // Pick up URL up to /admin and exclude /admin  . This is the phpMyFAQ directory
    $pmfBase = strrev(str_replace('nimda/', '', stristr(strrev(backslashToSlash($_SERVER['HTTP_REFERER'])), 'nimda/')));
    if ($pmfBase == $_SERVER['HTTP_HOST']) {
        // phpMyFAQ is not in a subdirectory of a domain
        $pmfRest = str_replace($_SERVER['DOCUMENT_ROOT'], '', stristr($output, $_SERVER['DOCUMENT_ROOT']));
    } else {
        // phpMyFAQ is in a subdirectory of a domain
        // extract subdirectory from URL for comparison with path
        $pmfSame = strrchr($pmfBase, '/');
        // extract the rest of URL including file name from file path
        $pmfRest = str_replace($pmfSame, '', substr(backslashToSlash($output), strrpos(backslashToSlash($output), $pmfSame)));
    }
    return $pmfBase . $pmfRest;
}
Example #14
0
        if (!file_exists($path)) {
            throw new Exception('Aucune fichier trouvé : ' . $path);
        }
        if (!is_writable($path)) {
            throw new Exception('Impossible d\'écrire dans : ' . $path);
        }
        if (is_dir($path)) {
            throw new Exception('Impossible de supprimer un dossier : ' . $path);
        }
        $allowRemovePath = config::byKey('allowRemoveDir', 'script');
        $allowRemovePath[] = config::byKey('userScriptDir', 'script');
        if (!hadFileRight($allowRemovePath, $path)) {
            throw new Exception('Vous n\'etez pas autoriser supprimer : ' . $path);
        }
        unlink($path);
        ajax::success();
    }
    if (init('action') == 'addUserScript') {
        $path = config::byKey('userScriptDir', 'script') . '/' . init('name');
        if (strpos($path, '/') !== 0 || strpos($path, '\\') !== 0) {
            $path = getRootPath() . '/' . $path;
        }
        if (!touch($path)) {
            throw new Exception('Impossible d\'écrire dans : ' . $path);
        }
        ajax::success($path);
    }
    throw new Exception('Aucune methode correspondante à : ' . init('action'));
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
Example #15
0
    throw new Exception('Error 401 Unauthorized');
}
include_file('core', 'script', 'config', 'script');
include_file('3rdparty', 'jquery.fileTree/jqueryFileTree', 'css');
include_file('3rdparty', 'codemirror/lib/codemirror', 'js');
include_file('3rdparty', 'codemirror/lib/codemirror', 'css');
include_file('3rdparty', 'codemirror/addon/edit/matchbrackets', 'js');
include_file('3rdparty', 'codemirror/mode/htmlmixed/htmlmixed', 'js');
include_file('3rdparty', 'codemirror/mode/clike/clike', 'js');
include_file('3rdparty', 'codemirror/mode/php/php', 'js');
include_file('3rdparty', 'codemirror/mode/shell/shell', 'js');
include_file('3rdparty', 'codemirror/mode/python/python', 'js');
include_file('3rdparty', 'codemirror/mode/ruby/ruby', 'js');
include_file('3rdparty', 'codemirror/mode/perl/perl', 'js');
sendVarToJS('eqType', 'script');
sendVarToJS('userScriptDir', getRootPath() . '/' . config::byKey('userScriptDir', 'script'));
?>
<style>
    .CodeMirror-scroll {height: 100%; overflow-y: auto; overflow-x: auto;}
</style>

<div class="row">
    <div class="col-lg-2">
        <div class="bs-sidebar affix">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav fixnav">
                <a class="btn btn-default btn-sm tooltips" id="bt_getFromMarket" title="Récuperer du market" style="display: inline-block;"><i class="fa fa-shopping-cart"></i></a>

                <li class="nav-header">Liste des scripts
                    <i class="fa fa-plus-circle pull-right cursor eqLogicAction" data-action="add" style="font-size: 1.5em;margin-bottom: 5px;"></i>
                </li>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="Rechercher" style="width: 100%"/></li>
Example #16
0
<?php

require_once getRootPath() . "/classes/core/DataType.php";
class type_number extends DataType
{
}
/*  ******* LICENSE ******* 
 *  
 *  Copyright 2009 Joel Cass 
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  you may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at 
 *  
 *  	http://www.apache.org/licenses/LICENSE-2.0 
 *  	
 *  Unless required by applicable law or agreed to in writing, software 
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
 */
Example #17
0
<?php

require_once getRootPath() . "/classes/core/Page.php";
require_once getRootPath() . "/classes/helpers/FileSystemHelper.php";
class PageHelper
{
    public function PageHelper()
    {
    }
    /* STATIC METHODS */
    public static function getInstance()
    {
        return new PageHelper();
    }
    public static function getDescendants($node, $contentType = "", array $aryPages = array())
    {
        $aryTemp = Page::getPages($node);
        foreach ($aryTemp as $objPage) {
            if ($contentType == "" || $objPage->getContentType() == $contentType) {
                $aryPages[] = $objPage;
                $aryPages = PageHelper::getDescendants($objPage->path, $contentType, $aryPages);
            }
        }
        return $aryPages;
    }
    public static function search($node, $keyword, $contentType = "")
    {
        $aryPages = PageHelper::getDescendants($node, $contentType);
        $aryResult = array();
        $strKeyword = strToLower($keyword);
        foreach ($aryPages as $objPage) {
Example #18
0
<?php

require_once getRootPath() . "/classes/core/View.php";
class PlaceHolder
{
    /* PUBLIC VARS */
    var $name;
    var $xml;
    /* PUBLIC METHODS */
    public function PlaceHolder($name, DOMElement $xml)
    {
        $this->name = $name;
        $this->xml = $xml;
    }
    public function render(Page $page)
    {
        $views = $this->getViews();
        foreach ($views as $view) {
            $view->render($page);
        }
    }
    public function getViews()
    {
        $aryViews = array();
        $views_xml = XmlHelper::xpath($this->xml->ownerDocument, "/content/options/placeholders/descendant::placeholder[@name='{$this->name}']/descendant::view");
        foreach ($views_xml as $view_xml) {
            $aryViews[] = new View($view_xml->getAttribute("path"), $view_xml);
        }
        return $aryViews;
    }
    public function setViews(array $views)
Example #19
0
function getDatabasePath()
{
    return getRootPath() . '/database/data.db';
}
Example #20
0
		<input type="file" name="<?php 
    echo $strFieldName;
    ?>
">
		<input type="submit">
	</form>
<?php 
}
?>

<?php 
if (array_key_exists($strFieldName, $_FILES) && $_FILES[$strFieldName] != null && array_key_exists("type", $_GET) && array_key_exists($_GET["type"], $stcTypes)) {
    try {
        $stcType = $stcTypes[$_GET["type"]];
        $fldUpload = $_FILES[$strFieldName];
        $strDest = getRootPath() . "/" . $stcType["path"];
        $strURL = getRootURL() . "/" . $stcType["path"];
        $strName = ereg_replace("[^A-Za-z0-9\\.]", "-", $fldUpload["name"]);
        $strExt = preg_replace("/^.*\\./", "", $strName);
        // check for existing file
        if (array_search($strExt, $aryDenyFileExt, true)) {
            echo "{error:\"Files of that type are not allowed to be uploaded. Sorry.\"}";
            exit;
        }
        // make directory if it doesn't exist
        if (!file_exists($strDest)) {
            $aryDir = split("/", $strDest);
            $strTmp = "";
            for ($i = 0; $i < count($aryDir); $i++) {
                $strTmp = $strTmp . $aryDir[$i] . "/";
                if (!file_exists($strTmp)) {
Example #21
0
<?php

include_once getRootPath() . "/classes/core/Page.php";
$strNode = stripslashes($_REQUEST["node"]);
Page::delete($strNode);
Example #22
0
function hadFileRight($_allowPath, $_path)
{
    $path = cleanPath($_path);
    foreach ($_allowPath as $right) {
        if (strpos($right, '/') !== false || strpos($right, '\\') !== false) {
            if (strpos($right, '/') !== 0 || strpos($right, '\\') !== 0) {
                $right = getRootPath() . '/' . $right;
            }
            if (dirname($path) == $right || $path == $right) {
                return true;
            }
        } else {
            if (basename(dirname($path)) == $right || basename($path) == $right) {
                return true;
            }
        }
    }
    return false;
}
Example #23
0
<?php

require_once getRootPath() . "/classes/helpers/PageHelper.php";
$keyword = $_REQUEST["keyword"];
$aryResult = PageHelper::Search("", $keyword);
Example #24
0
<h2>Installation.</h2>
<div id="installation">
    <h3>Server Message</h3>
<?php 
require_once 'lib/common.php';
$error = '';
$root = getRootPath();
$database = getDatabasePath();
unset($_SESSION['id']);
//Falls Datenbank schon existiert
if (is_readable($database)) {
    $error = "Bitte loesche die vorhandene Datenbank manuell bevor du diese Installation durchfuehrst und aktualisiere die Seite";
}
//Datenbank erstellen
if (!$error) {
    $db = db();
    if (!$db) {
        $error = "Es konnte keine Datenbank erstellt werden.";
    }
}
//SQL Datei finden
if (!$error) {
    $sql = @file_get_contents($root . '/database/init.sql');
    if ($sql == false) {
        $error = 'Die SQL Datei konnte nicht gefunden werden';
    }
}
//Mit Datenbank verbinden und SQL ausführen
if (!$error) {
    $result = $db->exec($sql);
    if ($result == false) {
Example #25
0
	/**
	 * get file url
	 *
	 * @param string $value
	 * @return string
	 */
	function getFileUrl($value)
	{
		$output = '';
		$wwwroot = removeTrailingSlash(backslashToSlash(getRootPath()));

		$urlprefix = "";
		$urlsuffix = "";

	$value = backslashToSlash(getRealPath($value));
		

		$pos = stripos($value, $wwwroot);
		if ($pos !== false && $pos == 0)
		{
			$output  = $urlprefix . substr($value, strlen($wwwroot)) . $urlsuffix;
		}else 
		{
			$output = $value;
		}
		return "http://" .  addTrailingSlash(backslashToSlash($_SERVER['HTTP_HOST'])) . removeBeginingSlash(backslashToSlash($output));
	}
Example #26
0
<?php

require "application.php";
header("content-type: text/javascript");
if (array_key_exists("type", $_GET) && array_key_exists($_GET["type"], $stcTypes)) {
    $stcType = $stcTypes[$_GET["type"]];
    $strPath = getRootPath() . "/" . $stcType["path"];
    $strPath = str_ireplace("\\", "/", $strPath);
    $strURL = getRootURL() . "/" . $stcType["path"];
    $strURL = str_ireplace("\\", "/", $strURL);
    echo "var " . $stcType["tinyMceVarName"] . " = new Array(";
    if (file_exists($strPath)) {
        $aryEntries = scanDir($strPath);
        $blnComma = false;
        for ($i = 0; $i < count($aryEntries); $i++) {
            $strExt = preg_replace("/^.*\\./", "", $aryEntries[$i]);
            if (array_search($strExt, $stcType["extensions"], true)) {
                if ($blnComma) {
                    echo ",";
                }
                $blnComma = true;
                echo "\r\n\t[\"" . $aryEntries[$i] . "\", \"" . $strURL . "/" . $aryEntries[$i] . "\"]";
            }
        }
    }
    echo "\r\n);";
}
Example #27
0
<?php

require_once getRootPath() . "/cms/modules/controller.php";
$params = array();
$params["PAGE"] = $PAGE;
Controller("contact-form", "form", "", $params);
Example #28
0
<?php

require_once "classes/core/Page.php";
if (Page::isPage("/home")) {
    die("System is installed.");
}
if (array_key_exists("password", $_POST) && $_POST["password"] != "" && $_POST["password"] == $_POST["password2"]) {
    // set up admin account
    $strUserFilePath = getRootPath() . "/cms/config/users.php";
    $strUserFile = file_get_contents($strUserFilePath);
    $strUsername = $_POST["username"];
    $strPassword = hash("md5", strtolower($_POST["password"]));
    $strExpression = "/\\\$aryUsers\\[\\] = array\\(\"admin\", \"[^\"]*\"\\);/";
    $strReplace = "\$aryUsers[] = array(\"" . $strUsername . "\", \"" . $strPassword . "\");";
    if (preg_match($strExpression, $strUserFile) > 0) {
        $strUserFile = preg_replace($strExpression, $strReplace, $strUserFile);
    } else {
        $strUserFile = "<?php \$aryUsers = array(); {$strReplace} ?>";
    }
    file_put_contents($strUserFilePath, $strUserFile);
    // create content folder
    if (!is_dir(getPath(""))) {
        mkdir(getPath(""));
    }
    // Create website tree
    if (!Page::isPage("/home")) {
        $home = Page::create("/home", "content");
        $home->setField("Title", "Home");
        $home->setField("Description", "Home page of a default installation of StructureCMS");
        $home->setField("Keywords", "StructureCMS Content Management System");
        $home->setField("Content", "<h2>Welcome to StructureCMS!</h2><p>Your site has been installed and is ready to use. The following links may be of assistance to you.</p><ul><li><a href=\"" . getRootURL() . "/admin\">Administration</a> (U:{$strUsername}, p:" . $_POST["password"] . ")</li><li><a href=\"" . getRootURL() . "/content/footer/search/\">Search</a></li><li><a href=\"" . getRootURL() . "/content/footer/contact/\">Contact</a></li><li><a href=\"" . getRootURL() . "/content/rss/latest/\">RSS Feed</a></li></ul>");
Example #29
0
LayoutHelper::renderField($PAGE, "Title");
?>
 &laquo; <?php 
echo SettingsHelper::getSetting("Site Name");
?>
</title>
	<link href="<?php 
echo getRootURL();
?>
/styles/<?php 
echo SettingsHelper::getSetting("Theme");
?>
/lib/style.css" rel="stylesheet" type="text/css">
	<?php 
if (file_exists(getRootPath() . "/styles/" . SettingsHelper::getSetting("Theme") . "/head.php")) {
    include getRootPath() . "/styles/" . SettingsHelper::getSetting("Theme") . "/head.php";
}
?>
</head>

<body>
	<div id="page-wrapper">
		<div id="page">
			<div id="site-name">
				<span><?php 
echo SettingsHelper::getSetting("Site Name");
?>
</span>
			</div>
			<div id="navigation">
				<?php 
Example #30
0
<?php

require_once getRootPath() . "/cms/config/users.php";
class AdminHelper
{
    /* CONSTANTS */
    const MODE_PUBLIC = "public";
    const MODE_ADMIN = "admin";
    const MODE_PREVIEW = "preview";
    /* STATIC METHODS */
    public static function session_init()
    {
        session_start();
        if (array_key_exists("fc_mode", $_REQUEST)) {
            $_SESSION["fc_mode"] = $_REQUEST["fc_mode"];
        }
    }
    public static function session_footer()
    {
        if (array_key_exists("fc_mode", $_SESSION)) {
            $mode = $_SESSION["fc_mode"];
            if ($mode == AdminHelper::MODE_ADMIN) {
                AdminHelper::admin_footer();
            } elseif ($mode == AdminHelper::MODE_PREVIEW) {
                AdminHelper::preview_footer();
            }
        }
    }
    public static function admin_footer()
    {
        echo "<hr>Admin";