コード例 #1
0
ファイル: Config.php プロジェクト: ssrsfs/blg
 /**
  * A shortcut for creating or updating a config value.
  * @param string $name The config name.
  * @param string $value The config value.
  * @return Dbi_Record The resulting record.
  */
 public static function Set($name, $value)
 {
     $config = Model_Config::Get($name);
     if (!$config->exists()) {
         $config = Model_Config::Create();
         $config['configname'] = $name;
     }
     $config['configvalue'] = $value;
     $config->save();
     return $config;
 }
コード例 #2
0
ファイル: edit.php プロジェクト: ssrsfs/blg
 * admin edit controller
 */
Plugin_Breadcrumbs::Add('Edit');
$config = Typeframe::Registry()->getConfig($_REQUEST['config']);
if (!$config) {
    Typeframe::Redirect('Invalid config specified', Typeframe::CurrentPage()->applicationUri(), 1);
    return;
}
if ($config->redirect()) {
    Typeframe::Redirect('Redirecting to ' . $config->name() . ' admin...', $config->redirect());
    return;
}
// update the config settings
if ('POST' == $_SERVER['REQUEST_METHOD']) {
    foreach ($config->items() as $i) {
        $config = Model_Config::Get($i->name());
        if (!$config->exists()) {
            $config = Model_Config::Create();
            $config['configname'] = $i->name();
        }
        $config['configvalue'] = isset($_POST[$i->name()]) ? $_POST[$i->name()] : '';
        $config->save();
    }
    Typeframe::Registry()->purgeRegistryCache();
    Typeframe::Redirect('Configuration updated.', Typeframe::CurrentPage()->applicationUri());
    return;
}
// otherwise, set it up to edit
//if ($config->template()) Typeframe::SetPageTemplate($config->template());
$object = new stdClass();
$object->name = $config->name();
コード例 #3
0
ファイル: index.php プロジェクト: ssrsfs/blg
<?php

$db = Typeframe::Database();
$pm = Typeframe::Pagemill();
Typeframe::SetPageTemplate('/admin/skins/index.html');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $skins = array('TYPEF_SITE_SKIN', 'TYPEF_ADMIN_SKIN', 'TYPEF_MOBILE_SITE_SKIN', 'TYPEF_MOBILE_ADMIN_SKIN');
    $key = $_POST['config'];
    if (in_array($key, $skins)) {
        $config = Model_Config::Get($key);
        if ($config->exists()) {
            $config['configvalue'] = $_POST['skin'];
        } else {
            $config = Model_Config::Create();
            $config['configname'] = $key;
            $config['configvalue'] = $_POST['skin'];
        }
        $config->save();
        Typeframe::Registry()->purgeRegistryCache();
    }
    Typeframe::Redirect('Skins updated.', Typeframe::CurrentPage()->applicationUri());
    return;
}
foreach (Typeframe::GetSkins() as $skin) {
    $row = array();
    $row['skin'] = $skin;
    if (file_exists(TYPEF_DIR . "/skins/{$skin}/config.xml")) {
        $row['configurable'] = true;
    } else {
        $row['configurable'] = false;
    }