当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::reset方法代码示例

本文整理汇总了PHP中Error::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::reset方法的具体用法?PHP Error::reset怎么用?PHP Error::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     if (is_a($session['user'], 'Member') && $user['perms'] >= ADMIN) {
         global $_MAPITEMS, $_QUERYPARAMS;
         if (!isset($request['id']) || intval($request['id']) == 0) {
             $template->setInfo('content', $template->getVar('L_INVALIDCATEGORY'), FALSE);
             return TRUE;
         }
         $category = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['category'] . " FROM " . CATEGORIES . " c LEFT JOIN " . INFO . " i ON c.category_id = i.id WHERE i.id = " . intval($request['id']));
         if (!is_array($category) || empty($category)) {
             $template->setInfo('content', $template->getVar('L_INVALIDCATEGORY'), FALSE);
             return TRUE;
         }
         $parent_id = $dba->getValue("SELECT id FROM " . MAPS . " WHERE varname = 'categories'");
         $dba->beginTransaction();
         /* Insert the main category MAP item */
         $map =& new AdminInsertMap();
         /* Set the default data for this category MAP element */
         $category_array = array_merge(array('name' => $category['name'], 'varname' => 'category' . $category['id'], 'parent_id' => $parent_id), $_MAPITEMS['category'][0]);
         /**
          * Insert the main category MAP information
          */
         Error::reset();
         $map->insertNode($category_array, $category['id']);
         if (Error::grab()) {
             $error =& Error::grab();
             $template->setError('content', $template->getVar($error->message));
             return TRUE;
         }
         $category_map_id = $dba->getInsertId();
         /**
          * Insert the secondary category MAP information
          */
         for ($i = 1; $i < count($_MAPITEMS['category']) - 1; $i++) {
             if (isset($_MAPITEMS['category'][$i]) && is_array($_MAPITEMS['category'][$i])) {
                 $category_array = array_merge(array('parent_id' => $category_map_id), $_MAPITEMS['category'][$i]);
                 $category_array['name'] = $template->getVar('L_' . strtoupper($category_array['varname']));
                 Error::reset();
                 $map->insertNode($category_array, $category['id']);
                 if (Error::grab()) {
                     $error =& Error::grab();
                     $template->setError('content', $template->getVar($error->message));
                     return TRUE;
                 }
             }
         }
         $dba->commitTransaction();
         /**
          * If we've gotten to this point.. redirect
          */
         $template->setInfo('content', sprintf($template->getVar('L_ADDEDCATEGORYPERMS'), $category['name']), FALSE);
         $template->setRedirect('admin.php?act=categories', 3);
         if (!@touch(CACHE_FILE, time() - 86460)) {
             @unlink(CACHE_FILE);
         }
     } else {
         $template->setError('content', $template->getVar('L_YOUNEEDPERMS'));
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:60,代码来源:categories.class.php

示例2: ValidateLoginKey

 function ValidateLoginKey($info)
 {
     global $_DBA, $_SETTINGS;
     if (!isset($info['k4_autolog'])) {
         return FALSE;
     }
     if ($info['k4_autolog'] == '' || empty($info['k4_autolog'])) {
         return FALSE;
     }
     $info = $info['k4_autolog'];
     if (strlen($info) <= 32 || strlen($info) > $_SETTINGS['maxuserlength'] + 32) {
         return FALSE;
     }
     $name = substr($info, 0, strlen($info) - 32);
     $key = substr($info, strlen($info) - 32, strlen($info));
     Error::reset();
     $name = $_DBA->Quote($name);
     $key = $_DBA->Quote($key);
     $result = $_DBA->GetValue("SELECT id FROM " . USERS . " WHERE name='{$name}' AND priv_key='{$key}'");
     if (Error::grab()) {
         return trigger_error("Unable to select the user ID.", E_USER_ERROR);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:24,代码来源:user.inc.php

示例3: Execute

 function Execute(&$template, $request, &$dba, &$session, &$user)
 {
     $this->dba =& $dba;
     if (is_a($session['user'], 'Member') && $user['perms'] >= ADMIN) {
         $map =& new AdminInsertMap();
         Error::reset();
         $map->insertNode($request);
         if (Error::grab()) {
             $error =& Error::grab();
             return $template->setError('content', $template->getVar($error->message));
         }
         /* Redirect the user */
         $template->setInfo('content', $template->getVar('L_ADDEDMAPSITEM'), FALSE);
         $template->setRedirect('admin.php?act=permissions_gui', 3);
         if (!@touch(CACHE_FILE, time() - 86460)) {
             @unlink(CACHE_FILE);
         }
     } else {
         $template->setError('content', $template->getVar('L_YOUNEEDPERMS'));
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:22,代码来源:maps.class.php

示例4: delete

 /**
  * Удаление новости
  *
  * @param integer $id ID новости
  * @return boolean <p>Возвращает <b>TRUE</b> в случае успеха.
  * </p>
  * <p>
  * Возвращает <b>FALSE</b> в случае ошибки. Саму ошибку можно получить с помощью
  * функции <b>Error::get</b>
  */
 public static function delete($id)
 {
     Error::reset();
     try {
         $return = self::getManager()->delete($id);
     } catch (Exception $ex) {
         Error::set($ex);
         $return = false;
     }
     return $return;
 }
开发者ID:jarick,项目名称:bx,代码行数:21,代码来源:News.php

示例5: clearOld

 /**
  * Удаляет старые капчи
  *
  * @param integer $day Через сколько дней считать капчу устаревшей
  * @return boolean <p>Возвращает <b>TRUE</b> в случае успеха.
  * </p>
  * <p>
  * Возвращает <b>FALSE</b> в случае ошибки. Саму ошибку можно получить с помощью
  * функции <b>Error::get</b>
  * </p>
  */
 public static function clearOld($day = 30)
 {
     Error::reset();
     try {
         $return = self::getManager()->clearOld($day);
     } catch (Exception $ex) {
         Error::set($ex);
         $return = false;
     }
     return $return;
 }
开发者ID:jarick,项目名称:bx,代码行数:22,代码来源:Captcha.php


注:本文中的Error::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。