コード例 #1
0
ファイル: general.lib.php プロジェクト: appcoding2/nano-cms
function savepages()
{
    global $nc;
    runTweak('on-save-pages');
    $pagesdata = serialize($nc);
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("file writing error"), 'redbox');
    }
}
コード例 #2
0
ファイル: general.lib.php プロジェクト: appcoding2/nano-cms
function savepages()
{
    global $NANO;
    runTweak('on-save-pages');
    $pagesdata = serialize($NANO);
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("File writing error"), 'redbox');
        return false;
    }
    return true;
}
コード例 #3
0
function savepages()
{
    global $NANO;
    runTweak('on-save-pages');
    $pagesdata = serialize($NANO);
    $pagesdata = '<?php header("Location: ../index.php"); /*    DO NOT EDIT THIS FILE' . "\n{$pagesdata}\n*/?>";
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        MsgBox(lt("File writing error"), 'redbox');
        return false;
    }
    return true;
}
コード例 #4
0
function doAreaEdit()
{
    if (isset($_GET['do']) and $_GET['do'] == 'editarea') {
        $areaCount = stripslashes($_POST[areaCount]);
        $errCnt = 0;
        for ($i = 1; $i <= $areaCount; $i++) {
            $areaNamei = stripslashes($_POST["areaName{$i}"]);
            $areaContenti = stripslashes($_POST["areaContent{$i}"]);
            $areaFilei = areaDataDir("{$areaNamei}");
            $areaFilei = strtolower($areaFilei);
            if (!put2file($areaFilei, $areaContenti)) {
                $errCnt++;
                $msg = sprintf(lt("Error saving area : <b>%s</b> to file <b>%s</b>", 'error-saving-area-to-file'), $areaNamei, $areaFilei);
                MsgBox($msg);
            }
        }
        if ($errCnt == 0) {
            MsgBox(lt("All Area contents saved Successfully", 'areas-save-success'));
        }
        //header("location:?action=showareas");
    }
}
コード例 #5
0
function addpage()
{
    $addtErrMsg = array();
    $catlist = getDetails('cats');
    $newp = new Page();
    $newp->newPageInit();
    $newp->addToCat('sidebar');
    if (isset($_POST[save])) {
        $isFormSubmitted = true;
        $content = stripslashes($_POST[content]);
        $title = stripslashes($_POST[title]);
        $newp->editTitle($title);
        $slug = $newp->slug;
        //	Fixed category adding
        $postVariables = $_POST;
        $selectedCats = array();
        foreach ($postVariables as $catKey => $categoryName) {
            if (strpos($catKey, 'check_') !== false) {
                $selectedCats[] = $categoryName;
            }
        }
        if (count($selectedCats) == 0) {
            $selectedCats[] = 'sidebar';
        }
        $newp->cats = $selectedCats;
        // $newp->commitChanges(); // dont commit yet
        // fix complete
        if ($title != '' and $content != '') {
            $newPageFile = pageDataDir($slug);
            if (!file_exists($newPageFile)) {
                //view all cats
                $newp->commitChanges();
                //debug($newp);
                runTweak('new-page', array('page-obj' => &$newp, 'page-content' => &$content));
                if (put2file($newPageFile, $content)) {
                    savepages();
                }
                $m = lt("The page was created successfully", 'page-create-success') . '<br />';
                $m .= lt("File Created") . " : " . $newPageFile . "<br />";
                $m .= lt("Content") . " : " . substr(strip_tags($content), 0, 100) . (strlen($content) > 100 ? '...' : '') . "<br />";
                MsgBox($m);
                return;
                // success
            } else {
                $addtErrMsg[] = lt("Save Failed");
                if (file_exists($newPageFile)) {
                    $addtErrMsg[] = lt("A page with similar Title already exists!!", 'similar-page-title-exists');
                }
            }
        } else {
            $addtErrMsg[] = lt("Either the title or the content is/are empty!!! Please check your input!!<br />", 'title-or-content-empty');
        }
        //die('f****d');
        //savepages();
    }
    if (count($addtErrMsg) != 0 and isset($title)) {
        //error occured
        $em = '';
        foreach ($addtErrMsg as $msg) {
            $em .= "<li>{$msg}</li>";
        }
        MsgBox(lt("Errors Occured") . " : <ul>{$em}</ul>", 'background:#FFE8E8;border:1px solid #AE0000');
    }
    //debug($addtErrMsg);
    $formAction = "?action=addpage";
    $submitButton = lt('Add Page');
    $chkboxs = checkBoxList(getDetails('cats'), $newp->cats);
    $pageTitleLabel = lt('Page Title');
    $catsLabel = lt('Categories');
    $contentLabel = lt('Content');
    $addnewpageLabel = lt('Add new Page');
    echo $te = <<<TET
\t<form action='{$formAction}' method=post class='pagemod_form'>
\t\t<h2>{$addnewpageLabel}</h2>
\t\t<table width='98%' border='0'>
\t\t  <tr>
\t\t\t<td width='20%'>{$pageTitleLabel}</td>
\t\t\t<td><input type='text' value='{$title}' name='title'></td>
\t\t\t<td align='right'><input type='submit' value='{$submitButton}' name='save'></td>
\t\t  </tr>
\t\t  <tr>
\t\t\t<td>{$catsLabel}</td>
\t\t\t<td colspan=2>{$chkboxs}</td>
\t\t  </tr>
\t\t</table>
\t\t<h2>{$contentLabel}</h2>
\t\t<table width="98%">
\t\t  <tr><td colspan=2>
\t\t\t<textarea name='content' rows=20 cols=70 id='editbox' class='editbox'>{$content}</textarea>
\t\t  </td></tr>
\t\t  <tr><td colspan=2><br /><input type='submit' value='{$submitButton}' name='save'></td></tr>
\t\t</table>
\t</form>
TET;
    runTweak('after-add-form-display');
}
コード例 #6
0
ファイル: nanoadmin.php プロジェクト: appcoding2/nano-cms
function savepages()
{
    global $WebPagesList;
    $pagesdata = serialize($WebPagesList);
    if (!put2file(PAGES_DETAILS_FILE, $pagesdata)) {
        die("file writing error");
    }
}
コード例 #7
0
ファイル: nanoadmin.php プロジェクト: appcoding2/nano-cms
function doAreaEdit()
{
    if (isset($_GET[action]) and $_GET[action] == 'editarea') {
        $areaName = stripslashes($_POST[areaname]);
        $content = stripslashes($_POST[content]);
        $areaFile = areaDataDir("{$areaName}");
        //die( $areaFile );
        if (!put2file($areaFile, $content)) {
            echo "error saving area";
        }
        header("location:?action=showareas");
    }
}
コード例 #8
0
function saveUserCheck($adminUsername, $userData)
{
    $adminFile = getSystemRoot(RAZOR_ADMIN_FILENAME) . 'admin/core/admin_config.php';
    $adminProfile = file_get_contents($adminFile);
    if (isset($adminProfile)) {
        $adminProfile = str_replace("RAZOR['" . $userData['finduser'] . "'] = '" . $userData['username'] . "'", "RAZOR['" . $userData['finduser'] . "'] = '" . $adminUsername . "'", $adminProfile);
    }
    $result = put2file('admin/core/admin_config.php', $adminProfile);
    if ($result) {
        $result = false;
    } else {
        $result = lt('Error writing data to file') . '...';
    }
    return $result;
}
コード例 #9
0
 function saveContents($pathToInstall)
 {
     foreach ($this->zipContents as $parts) {
         if ($parts->Path != '') {
             // check dir exists, if not create it //
             if (!file_exists('../' . $pathToInstall . $parts->Path)) {
                 $splitPath = array();
                 $splitPath = explode('/', $parts->Path);
                 $checkPath = '../' . $pathToInstall;
                 foreach ($splitPath as $pathBit) {
                     $checkPath .= $pathBit;
                     if (!file_exists($checkPath)) {
                         mkdir($checkPath, 0755);
                     }
                     $checkPath .= '/';
                 }
             }
             $path = $parts->Path . '/';
         } else {
             $path = '';
         }
         put2file($pathToInstall . $path . $parts->Name, $parts->Data);
     }
 }