Example #1
0
 public function init()
 {
     // Get all settings
     Shineisp_Registry::set('Settings', Settings::getAll());
     // Statuses are used everywhere in system, so we need to make just one query
     Shineisp_Registry::set('Status', Statuses::getAll());
 }
Example #2
0
 public static function assign(&$var)
 {
     $all = Settings::getAll();
     if (is_array($all)) {
         if (is_object($var)) {
             foreach ($all as $row) {
                 $normalized_name = Settings::_normalizeName($row['name']);
                 if (!is_array($row['value'])) {
                     $var->{$normalized_name} = html_entity_decode($row['value']);
                 } else {
                     $var->{$normalized_name} = $row['value'];
                 }
             }
         } else {
             foreach ($all as $row) {
                 $normalized_name = Settings::_normalizeName($row['name']);
                 if (!is_array($row['value'])) {
                     $var->{$normalized_name} = html_entity_decode($row['value']);
                 } else {
                     $var->{$normalized_name} = $row['value'];
                 }
             }
         }
     }
 }
 public function defaultAction()
 {
     if (!Auth::isAdmin()) {
         $this->accessDenied();
         return;
     }
     $pages = new Pages();
     $this->view->assign('pagetree', $pages->getChildren());
     $this->view->assign('settings', Settings::getAll());
 }
Example #4
0
<?php

if ($config->isPOST()) {
    foreach ($_POST as $post => $value) {
        $set = explode('_', $post);
        if (is_array($set)) {
            $conf = new Settings($set[1]);
            $conf->value = $value;
            $conf->save();
        }
    }
    Messages::addNotice('Settings successfully saved.');
    jump('index.php?page=settings');
}
$conf = new Settings();
$smarty->assign('settings', $conf->getAll());
Example #5
0
$s = new Settings("gisicle.json");
session_start();
define("USERNAME_BACKEND", "admin");
define("PASSWORD_BACKEND", "admin");
$f->dispHead();
if (isset($_GET["exit"])) {
    unset($_SESSION["login"]);
}
if (isset($_POST["username"]) && isset($_POST["password"])) {
    if ($_POST["username"] == USERNAME_BACKEND && $_POST["password"] == PASSWORD_BACKEND) {
        $_SESSION["login"] = 1;
    } else {
        $f->dispLoginError();
    }
}
if (isset($_SESSION["login"])) {
    if (isset($_POST["gifsicle_settings"])) {
        $PostAr = $_POST;
        unset($PostAr["gifsicle_settings"]);
        foreach ($PostAr as $key => $value) {
            $s->set($key, $value);
        }
    }
    if (isset($_GET["clear"])) {
        $g->clearCache();
    }
    $f->dispAdminPage($g->nbAndSize(), $s->getAll());
} else {
    $f->dispLoginForm();
}
$f->dispFoot();