Example #1
0
function do_admin_body()
{
    runTweak('do-admin-body');
    if ($_GET['action'] == 'addpage') {
        addpage();
    } elseif ($_GET['action'] == 'delete') {
        doDelete();
    } elseif ($_GET['action'] == 'edit') {
        performEdit();
    } elseif ($_GET['action'] == 'showpages') {
        showpageslist();
    } elseif ($_GET['action'] == 'editarea') {
        doAreaEdit();
    } elseif ($_GET['action'] == 'showareas') {
        nanoadmin_showareas();
    } elseif ($_GET['action'] == 'settings') {
        nanoadmin_showsettings();
    } elseif ($_GET['action'] == 'tweakers') {
        showTweakers();
    } elseif (isset($_GET[tweak])) {
        showTweaksInterface();
    } elseif (!isset($_GET['action'])) {
        $introPage = NANO_ADMIND_DESIGN_BASE . "intro.php";
        runTweak('intro-page', array(&$introPage));
        require_once $introPage;
    }
}
function showareas()
{
    doAreaEdit();
    global $indexTemplateAreas;
    //execute the nano site in demo to read the content areas
    demoExecuteNanoSite();
    $sett = getDetails('settings');
    $contents = $sett['def-template-areas'];
    $areaInfo = array();
    foreach ($contents as $areaName) {
        $areaFile = areaDataDir("{$areaName}");
        $fileContent = file_exists($areaFile) ? file_get_contents($areaFile) : '';
        $areaInfo[$areaName] = $fileContent;
    }
    $saveAllTxt = lt('Save all Areas');
    $biggerInp = lt('Bigger Input Box');
    $smallerInp = lt('Smaller Input Box');
    echo "<form action='?action=showareas&do=editarea' method='post'>";
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "<input type='hidden' name='areaCount' value='" . count($areaInfo) . "'>";
    $cnt = 1;
    foreach ($areaInfo as $areaName => $areaContents) {
        $boxId = "box{$cnt}";
        //md5($areaName);
        echo "<h2>&raquo; {$areaName}</h2>\r\n\t\t\t    <input type='hidden' name='areaName{$cnt}' value='{$areaName}'>\r\n\t\t\t\t<table><tr valign='top'><td>\r\n\t\t\t\t<textarea name='areaContent{$cnt}' rows='2' cols='60' id='{$boxId}' class='areabox'>" . htmlentities($areaContents) . "</textarea>\r\n\t\t\t\t</td><td>\r\n\t\t\t\t<input type='button' onclick='makesmall(\"{$boxId}\")' value='-' title='{$smallerInp}' class='isizeh'>\r\n\t\t\t\t<input type='button' onclick='makebig(\"{$boxId}\")' value='+' title='{$biggerInp}' class='isizeh'>\r\n\t\t\t\t</td></tr></table>\r\n\t\t\t ";
        $cnt++;
    }
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "</form>";
    echo "<script language='javascript'>\r\n\t\t\tfunction makebig(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows < 30 ) obj.rows+= 5;\r\n\t\t\t}\r\n\t\t\tfunction makesmall(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows > 5 ) obj.rows-= 5;\r\n\t\t\t}\r\n\t\t  </script>";
}
Example #3
0
        echo "<h2>{$areaName}</h2>\r\n\t\t\t  <form action='?action=editarea' method='post'>\r\n\t\t\t\t<textarea name='content' rows='2' cols='60' id='{$boxId}' class='areabox'>" . htmlentities($fileContent) . "</textarea>\r\n\t\t\t\t<input type='hidden' name='areaname' value='{$areaName}'><br />\r\n\t\t\t\t<input type='submit' value='Save'>\r\n\t\t\t\t<input type='button' onclick='makebig(\"{$boxId}\")' value='  +  ' title='Bigger Input'>\r\n\t\t\t\t<input type='button' onclick='makesmall(\"{$boxId}\")' value='  -  ' title='Smaller Input'>\r\n\t\t\t\t<input type='button' onclick='makenarrow(\"{$boxId}\")' value='  <  ' title='Narrower Input'>\r\n\t\t\t\t<input type='button' onclick='makewide(\"{$boxId}\")' value='  >  ' title='Wider Input'>\r\n\t\t\t  </form>";
    }
    echo "<script langua='javascript'>\r\n\t\t\tfunction makebig(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows < 30 ) obj.rows+= 3;\r\n\t\t\t}\r\n\t\t\tfunction makesmall(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows > 3 ) obj.rows-= 3;\r\n\t\t\t}\r\n\t\t\tfunction makewide(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.cols < 90 ) obj.cols+= 5;\r\n\t\t\t}\r\n\t\t\tfunction makenarrow(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.cols > 60 ) obj.cols-= 5;\r\n\t\t\t}\r\n\t\t  </script>";
}
// automatically gets the content_areas present in the template ////////////////////////////////
$indexTemplateAreas = array();
function readIntoAreaList($l, $a = '', $b = '')
{
    global $indexTemplateAreas;
    $indexTemplateAreas[] = $l;
}
function dummyFunction($a = '', $b = '', $c = '', $d = '', $e = '', $f = '')
{
}
function demoExecuteNanoSite()
{
    $removeFunctionList = array('show_sidebar', 'show_content_slug', 'show_title', 'require_once');
    $replaceFunction = 'dummyFunction';
    $demoContentToRun = file_get_contents(NANO_CMS_PAGE);
    $demoContentToRun = str_replace('show_content_area', 'readIntoAreaList', $demoContentToRun);
    $demoContentToRun = str_replace($removeFunctionList, $replaceFunction, $demoContentToRun);
    ob_start();
    eval(" ?> " . $demoContentToRun . " <?php ");
    $cont = ob_get_contents();
    ob_end_clean();
}
performMove();
doAreaEdit();
performEdit();
// include the template of the admin area :)  ///////////////////////////////////////////////////
require_once "data/admindesign.php";