Exemple #1
0
 function __construct($sf, $url, $sec)
 {
     $this->sec = $sec;
     $this->sf = $sf;
     $this->pg = $sf[_PAGETAG_][$url];
     $this->st = $sf["site"];
     if (array_key_exists("json", $this->pg)) {
         $json = skymo::getJson(_JSONDIR_ . $this->pg["json"] . ".json");
         if (is_array($json)) {
             foreach ($json as $item => $val) {
                 $this->{$item} = array_reverse($val);
             }
         }
     }
 }
Exemple #2
0
 public function checkLogin($un, $pw)
 {
     $res = false;
     $j = skymo::getJson(_PASSWD_);
     if ($j) {
         if (array_key_exists("users", $j)) {
             $this->pwArr = $j["users"];
             if (array_key_exists($un, $this->pwArr)) {
                 $res = $this->pwVerify($pw, $this->pwArr[$un]["pw"]);
                 if (!$res) {
                     $this->errCode = 4;
                 }
             } else {
                 $this->errCode = 3;
             }
         } else {
             $this->errCode = 2;
         }
     } else {
         $this->errCode = 1;
     }
     return $res;
 }
Exemple #3
0
}
function write()
{
    global $changes, $t, $siteFile;
    if ($changes) {
        $t->msg = "Changed";
        $j = str_replace("},", "},\n", json_encode($t->sf, 128));
        if ($j) {
            $t->msg = "Written";
            file_put_contents($siteFile, $j);
        }
    }
}
$t->msg = "Ready";
if (array_key_exists(_ADMPAR_, $q)) {
    $t->sitepg = $t->sf[_PAGETAG_][$q[_ADMPAR_]];
    if (!$t->sec->viewPage($t->sitepg)) {
        skymo::http403();
    } else {
        $t->msg = "Set";
        $t->pgurl = $q[_ADMPAR_];
        $t->flds = skymo::getJson(_FLDDIR_ . _PAGETAG_ . ".json");
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $t->msg = "Posted";
            foreach ($t->flds as $fld) {
                setfld($fld["tag"], $fld["type"]);
            }
            write();
        }
    }
}
Exemple #4
0
<?php

require_once "config/localsettings.php";
require_once _SCRDIR_ . "templ.php";
require_once _SCRDIR_ . "skymo.php";
require_once _SCRDIR_ . "security.php";
if (isset($allowedHost)) {
    if ($_SERVER[HTTP_HOST] != $allowedHost) {
        skymo::http404();
    }
}
parse_str($_SERVER['QUERY_STRING'], $q);
$url = "/";
$j = skymo::getJson($siteFile);
$msg = skymo::getJson($msgFile);
$queryPage = _PAGEPAR_;
if (_DEBUG_) {
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
}
if (is_array($j)) {
    if (array_key_exists(_PAGETAG_, $j)) {
        if (array_key_exists($queryPage, $q)) {
            $url = $q[$queryPage];
        }
        if ($url == "") {
            $url = "/";
        }
        if (array_key_exists($url, $j[_PAGETAG_])) {
            $sec = new userSecurity();
            if ($sec->viewPage($j[_PAGETAG_][$url])) {