Ejemplo n.º 1
0
                    //var_dump($settings->settings);
                    $settings->update('siteTexts', $decoded['property'], $decoded['value']);
                    $returnUpdate = $decoded['value'];
                    $allowFormatModifier = true;
                }
                //var_dump($settings->settings);
                if (!$settings->save()) {
                    $returnError = "the setting could not be saved!\ncheck permissions for \"{$settings->fileName}\".";
                }
            }
        }
        // format modifier
        if ($allowFormatModifier) {
            if (!empty($decoded['format_modifier'])) {
                $berta->template->loadSmartyPlugin('modifier', $decoded['format_modifier']);
                $modName = 'smarty_modifier_' . $decoded['format_modifier'];
                if (function_exists($modName)) {
                    $returnUpdate = @call_user_func($modName, $returnUpdate);
                }
            }
        }
    }
    // add "last updated" time
    $berta->settings->update('berta', 'lastUpdated', gmdate('D, d M Y H:i:s', time()) . ' GMT');
    $berta->settings->save();
    //log event after update
    BertaUtils::logEvent('after update');
    echo Zend_Json::encode($returnValues ? $returnValues : array('update' => $returnUpdate, 'updateText' => $returnUpdate, 'real' => $returnReal, 'eval_script' => $returnEvalScript, 'error_message' => $returnError, 'params' => $returnParams));
} else {
    echo Zend_Json::encode(array('update' => false, 'real' => false, 'eval_script' => false, 'error_message' => 'NO DATA!'));
}
Ejemplo n.º 2
0
 public function login($name, $pass, $realName, $realPass)
 {
     if ($name && $pass) {
         if ($name == $realName && $pass == $realPass) {
             $this->destroy();
             session_start();
             $this->updateUserSettings(array('name' => $realName));
             //log login event
             BertaUtils::logEvent('login');
             return $this->userLoggedIn = true;
         } else {
             $this->errLogin = self::BERTASECURITY_ERROR_LOGIN_INCORRECT;
             // wrong creditentials
             return false;
         }
     } else {
         $this->errLogin = self::BERTASECURITY_ERROR_LOGIN_VARIABLE;
         // no identification supplied
         return false;
     }
 }