本文整理汇总了PHP中Kernel::isDemo方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::isDemo方法的具体用法?PHP Kernel::isDemo怎么用?PHP Kernel::isDemo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::isDemo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserPasswd
public function setUserPasswd()
{
$from = _request('from', '');
if (0 && Kernel::isDemo()) {
return Kernel::noDemo();
}
$comptes_service =& CopixClassesFactory::Create('comptes|ComptesService');
$userinfo = $comptes_service->checkLoginAccess(_request('login'));
$passwd1 = trim(_request('passwd1'));
$passwd2 = trim(_request('passwd2'));
if ($passwd1 == '' || strlen($passwd1) < 6) {
$urlReturn = CopixUrl::get('comptes||getUser', array('node_type' => _request('node_type'), 'node_id' => _request('node_id'), 'login' => _request('login'), 'error' => 'tooshortpassword', 'from' => $from));
return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn);
}
if ($passwd2 == '' || $passwd1 != $passwd2) {
$urlReturn = CopixUrl::get('comptes||getUser', array('node_type' => _request('node_type'), 'node_id' => _request('node_id'), 'login' => _request('login'), 'error' => 'notsamepassword', 'from' => $from));
return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn);
}
$user_dao =& CopixDAOFactory::create("kernel|kernel_copixuser");
$user_new = $user_dao->getByLogin(_request('login'));
$user_new[0]->password_dbuser = md5(_request('passwd1'));
$user_dao->update($user_new[0]);
//print_r($user_new);
if ($from == 'assistance') {
$urlReturn = CopixUrl::get('assistance||users');
} else {
$urlReturn = CopixUrl::get('comptes||getNode', array('type' => _request('node_type'), 'id' => _request('node_id')));
}
return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn);
}
示例2: noDemo
public function noDemo()
{
if (Kernel::isDemo()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nodemo'), 'TITLE_PAGE' => CopixI18N::get('kernel|kernel.error.demomode'), 'back' => CopixUrl::get('||')));
// 'back'=>'javascript:history.go(-1);' ));
}
}
示例3: setPrefs
public function setPrefs()
{
if (0 && Kernel::isDemo()) {
return Kernel::noDemo();
}
CopixHTMLHeader::addCSSLink(_resource("styles/module_prefs.css"));
CopixHTMLHeader::addOthers('<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"/>');
CopixHTMLHeader::addOthers('<META HTTP-EQUIV="Expires" CONTENT="-1"/>');
CopixHTMLHeader::addOthers('<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"/>');
$tpl = new CopixTpl();
// Liste des modules qui peuvent avoir des préférences...
$modules = Prefs::getModules();
$arModulesPath = CopixConfig::instance()->arModulesPath;
$datas = array();
$errors = array();
reset($modules);
foreach ($modules as $mod_key => $mod_val) {
foreach ($arModulesPath as $modulePath) {
$class_file = $modulePath . $mod_val->rep . '/' . COPIX_CLASSES_DIR . 'mod' . $mod_val->rep . 'prefs.class.php';
if (!file_exists($class_file)) {
continue;
}
$module_class =& CopixClassesFactory::Create($mod_val->rep . '|mod' . $mod_val->rep . 'prefs');
reset($_POST);
// Parcours de tous les parametres passé en POST, pour chaque module.
foreach ($_POST as $post_key => $post_val) {
if (ereg('^' . $mod_val->rep . '_(.+)$', $post_key, $regs)) {
$datas[$mod_val->rep][$regs[1]] = $post_val;
}
}
// Appel de la fonction de vérification du module.
if (method_exists($module_class, 'checkPrefs')) {
$d = isset($datas[$mod_val->rep]) ? $datas[$mod_val->rep] : null;
$error = $module_class->checkPrefs($mod_val->rep, $d);
if (sizeof($error)) {
$errors[$mod_val->rep] = $error;
}
}
}
}
if (sizeof($errors)) {
//print_r($errors);
// $tplPrefs = new CopixTpl ();
// Liste des modules disponibles...
reset($modules);
foreach ($modules as $mod_key => $mod_val) {
foreach ($arModulesPath as $modulePath) {
$class_file = $modulePath . $mod_val->rep . '/' . COPIX_CLASSES_DIR . 'mod' . $mod_val->rep . 'prefs.class.php';
if (!file_exists($class_file)) {
continue;
}
// Chargement de la classe...
$module_class =& CopixClassesFactory::Create($mod_val->rep . '|mod' . $mod_val->rep . 'prefs');
// Récupération de la structure des prefs...
$d = isset($data[$mod_val->rep]) ? $data[$mod_val->rep] : null;
$pref = $module_class->getPrefs($d);
$pref['code'] = $mod_val->rep;
if (isset($pref['form'])) {
// Protection contre les modules aux prefs vides
foreach ($pref['form'] as $key => $val) {
if (isset($val['code']) && isset($_POST[$pref['code'] . '_' . $val['code']])) {
$pref['form'][$key]['value'] = $_POST[$pref['code'] . '_' . $val['code']];
}
//print_r($val);
if (isset($val['code']) && isset($errors[$pref['code']][$val['code']])) {
$pref['form'][$key]['error'] = $errors[$pref['code']][$val['code']];
}
}
}
$prefs[] = $pref;
}
}
$tpl->assign('TITLE_PAGE', CopixI18N::get('prefs.moduleDescription'));
$tpl->assign('MAIN', CopixZone::process('prefs|prefs', array('prefs' => $prefs)));
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
} else {
reset($modules);
foreach ($modules as $mod_key => $mod_val) {
foreach ($arModulesPath as $modulePath) {
$class_file = $modulePath . $mod_val->rep . '/' . COPIX_CLASSES_DIR . 'mod' . $mod_val->rep . 'prefs.class.php';
if (!file_exists($class_file)) {
continue;
}
$module_class =& CopixClassesFactory::Create($mod_val->rep . '|mod' . $mod_val->rep . 'prefs');
$d = isset($datas[$mod_val->rep]) ? $datas[$mod_val->rep] : null;
$module_class->setPrefs($mod_val->rep, $d);
}
}
}
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('prefs|default|default', array('msg' => 'save')));
}