• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP setError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中setError函数的典型用法代码示例。如果您正苦于以下问题:PHP setError函数的具体用法?PHP setError怎么用?PHP setError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Save

 function Save($text, $bStripSlashes = true)
 {
     //remove due to serialize bug $text=stripslashes($text);
     if ($bStripSlashes) {
         $text = stripslashes($text);
     }
     if (is_file($this->path) && !is_writable($this->path)) {
         return setError(sprintf(_("Can not open file %s for writing."), $this->getName()) . ' ' . _("Check file permissisons"));
     }
     if (!is_dir($this->getParentPath())) {
         $oDirParent = $this->getParent();
         if (!$oDirParent->mkdir()) {
             return false;
         }
     }
     $fic = fopen($this->path, "w");
     if (!$fic) {
         return setError(sprintf(_("Can not open file %s for writing."), $this->getName()) . ' ' . _("Check file permissisons"));
     }
     //replace the $text
     if ($this->getExtension() == 'xml') {
         $text = str_replace(array('<textareatag', '</textareatag'), array('<textarea', '</textarea'), $text);
     }
     if (strlen($text) > 0) {
         if (fwrite($fic, $text) == FALSE) {
             setError(_("An error occur while writing text"));
             fclose($fic);
             return false;
         }
     }
     fclose($fic);
     return true;
 }
开发者ID:ecomotion,项目名称:pollencms,代码行数:33,代码来源:ptextfile.php


示例2: getItems

 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.method, a.location,a.tdate,s.sport_abbr, a.competition');
     $query->from($db->quoteName('#__htraininglogs_tr_sessions') . ' AS a');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_tr_competitions') . ' AS cc ON a.id = cc.tr_id');
     $query->select('cc.title as comptitle,cc.class_place,cc.is_team,cc.owntime,cc.toptimecat,cc.comp_cat');
     $query->select('s.sport_abbr');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_cfg_sport') . ' AS s ON a.sport_id = s.id');
     $query->select('c1.title as category,c1.keyvalue');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_conf_groups') . ' AS c1 ON (c1.keyvalue = cc.comp_cat) AND c1.ctype =300');
     $query->select('c2.title as type,c1.keyvalue');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_conf_groups') . ' AS c2 ON (c2.keyvalue = cc.is_champ) AND c2.ctype =400');
     $query->select('tt.title as toptime,tt.ordering');
     $query->join('LEFT', $db->quoteName('#__htraininglogs_cfg_toptime') . ' AS tt ON (tt.id = cc.toptimecat)');
     $query->where('(a.competition IN (2, 1))');
     $query->where('a.state =1');
     $query->where('a.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->order('a.tdate ASC');
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_VALUEBASEDGRAPH_FAIL'));
         return false;
     }
     return $items;
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:28,代码来源:competitionshelper.php


示例3: deleteLayerGroup

function deleteLayerGroup($xmlDoc, &$rootNode, $paramsNode) {
  $isAdmin = false;
  $user = $GLOBALS['user'];
  $user_roles = $user->roles;
  if($user->uid) {
    if(in_array(SITE_ADMIN_ROLE, $user_roles)) {
      $isAdmin = true;
    }
  }

  if(!$isAdmin) {
    setError($xmlDoc, $rootNode, "You are not authorized.");
    return;
  }

  $groupNode = $paramsNode->getElementsByTagName('group')->item(0);
  $group_id = $groupNode->getAttribute("id");

  if($group_id == NULL || $group_id == '' || $group_id == 0) {
    setError($xmlDoc, $rootNode, "Select a layer group to delete.");
    return;
  }

  $query = 'delete from "Layer_Group" where id = %d';
  $query_args = array($group_id);
  $result = db_query($query, $query_args);
  if(!$result) {
    setError($xmlDoc, $rootNode, "Could not delete the group. Please try after sometime.");
  } else {
    setNoError($xmlDoc, $rootNode, "The group has been deleted successfully.");
  }
}
开发者ID:rahool,项目名称:maplocator,代码行数:32,代码来源:metadata_layergroups.php


示例4: secureArea

function secureArea($group)
{
    global $SETTINGS;
    if (!isUserInRole($group)) {
        setError('Du besitzt nicht die nötigen Rechte!');
        header("location: {$SETTINGS['url']}/");
        exit;
    }
}
开发者ID:hackyourlife,项目名称:evoc,代码行数:9,代码来源:login.php


示例5: actionUpdate

 /**
  * Updates an existing StudentPhone model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $studentId = $model->student_id;
     $student = Student::findOne($studentId);
     if (!user()->can('updateStudent', ['student' => $student])) {
         setError('Access denied.');
         return $this->redirect(['/student/view', 'id' => $studentId], 403);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['student' => $student, 'model' => $model]);
     }
 }
开发者ID:NewPaltzKarateAcademy,项目名称:KIMS,代码行数:21,代码来源:StudentPhoneController.php


示例6: extrapage_sitemap

/**
 * extrapage_sitemap
 * This is the extrapagesite map event function
 * This function check the name of the page and if it is sitemap.xml, generate the site map.
 *
 * @param unknown_type $strPage
 * @param unknown_type $site
 * @return unknown
 */
function extrapage_sitemap($strPage, &$site)
{
    if ($strPage == 'sitemap.xml') {
        $strTplFile = dirname(__FILE__) . SLASH . 'google_sitemap.tpl';
        if (!$site->template_exists($strTplFile)) {
            setError('Error in plugin google site map. Can not find the google_sitemap.tpl file.');
            printFatalHtmlError();
            die;
        }
        header('Content-Type: text/xml;');
        $site->display($strTplFile);
        return true;
    }
    return false;
}
开发者ID:ecomotion,项目名称:pollencms,代码行数:24,代码来源:plugin_google_sitemap.php


示例7: checkKey

 function checkKey()
 {
     if (stristr($_SERVER['SERVER_NAME'], 'localhost') !== FALSE) {
         return true;
     }
     //try to connect to server licence
     if (!isset($_SERVER['HTTP_HOST'])) {
         return setError(__('HTTP_HOST not defined'));
     }
     $strLicenceStatus = file_get_contents(LICENCE_URL . urlencode($_SERVER['HTTP_HOST']));
     if ($strLicenceStatus === 'OK') {
         return true;
     }
     return setError($strLicenceStatus);
 }
开发者ID:ecomotion,项目名称:pollencms,代码行数:15,代码来源:checkkey.php


示例8: sendErrorResponse

function sendErrorResponse($msg) {
  // create a new XML document
  $doc = new DomDocument('1.0');

  // create root node
  $respNode = $doc->createElement('response');
  $respNode = $doc->appendChild($respNode);

  setError($doc, $respNode, $msg);

  // get completed xml document
  $xml_string = $doc->saveXML();

  return $xml_string;
}
开发者ID:rahool,项目名称:maplocator,代码行数:15,代码来源:xmlfunctions.php


示例9: motopressSetPageTemplate

function motopressSetPageTemplate()
{
    require_once 'verifyNonce.php';
    require_once 'access.php';
    require_once 'functions.php';
    require_once 'getLanguageDict.php';
    $pageId = $_POST['pageId'];
    $template = $_POST['template'];
    $lang = getLanguageDict();
    if (!$pageId or !$template) {
        setError($lang->setPageTemplateError);
    }
    if (!update_post_meta($pageId, '_wp_page_template', $template)) {
        setError($lang->setPageTemplateError);
    }
    exit;
}
开发者ID:nelclassico,项目名称:hapvidaplanos,代码行数:17,代码来源:setPageTemplate.php


示例10: init

function init()
{
    require 'lib.searchengine.php';
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    $bActivate = $oConfigFile->getDirectParam('ACTIVATE');
    if ($bActivate !== "true") {
        return setError(_('Please check your configuration. You must activate it befor try to index the content'));
    }
    if (!createBase()) {
        return false;
    }
    if (!synchroBase()) {
        return false;
    }
    echo gettext('Data base has been populated successfully');
    return true;
}
开发者ID:ecomotion,项目名称:pollencms,代码行数:18,代码来源:ajax_action.php


示例11: setLocalePath

 function setLocalePath($strPath = false, $strDomain = false)
 {
     $strDomain = !$strDomain ? 'messages' : $strDomain;
     $strPath = !$strPath ? SITE_PATH . 'core/locale' : $strPath;
     if (!is_dir($strPath)) {
         return setError(sprintf('Can not change the local path to %s. Directory not exists'), $strPath);
     }
     global $configFile;
     $locale = $configFile->getDirectParam('USER_LANGUAGE');
     T_setlocale(LC_ALL, $locale);
     bindtextdomain($strDomain, $strPath);
     // bind_textdomain_codeset is supported only in PHP 4.2.0+
     if (function_exists('bind_textdomain_codeset')) {
         bind_textdomain_codeset($strDomain, 'utf-8');
     }
     textdomain($strDomain);
     return true;
 }
开发者ID:ecomotion,项目名称:pollencms,代码行数:18,代码来源:localization.php


示例12: getItems

 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('count(ft.id) as days,ft.ft_id, cf.title,avg(ft.fitness_value) as value,cf.unit,cf.color');
     $query->from($db->quoteName('#__htraininglogs_ft_fitness') . ' AS ft');
     $query->leftjoin('#__htraininglogs_cfg_fitness AS cf ON ft.ft_id = cf.id');
     $query->where('cf.user_id = ' . $user->id);
     $query->where('ft.date1 BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->group('cf.title,unit');
     $query->order('cf.ordering');
     $db->setQuery($query);
     $valuebased = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     return $valuebased;
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:19,代码来源:fitness_datahelper.php


示例13: f

 function f($e)
 {
     if ($e instanceof ForbiddenException) {
         return setError(403, 'FORBIDDEN');
     } else {
         if ($e instanceof WrongMethodException) {
             return setError(405, 'WRONG METHOD');
         } else {
             if ($e instanceof BadRequestException) {
                 return setError(400, 'BAD REQUEST');
             } else {
                 if ($e instanceof NotFoundException) {
                     return setError(404, 'NOT FOUND');
                 } else {
                     return setError(500, 'INTERNAL SERVER ERROR');
                 }
             }
         }
     }
 }
开发者ID:zivanof,项目名称:fun_project,代码行数:20,代码来源:Controller.php


示例14: getGroupparams

 public static function getGroupparams()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from($db->quoteName('#__htraininglogs_cfg_category') . ' AS ft');
     $query->where('(ctype="b") or (ctype="g")');
     $db->setQuery($query);
     $data = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     $groupparam = array('RECOM', 'GA!', 'KA1', 'GA2', 'KA2', 'WSA', 'ALT', 'STD', 'BELSTD', 'KM', 'CLMB');
     foreach ($data as $sub) {
         $groupparam[$sub->cat_abbr] = new stdClass();
         $groupparam[$sub->cat_abbr]->color = $sub->color;
     }
     return $groupparam;
 }
开发者ID:hogeh,项目名称:htraininglogs,代码行数:20,代码来源:helper.php


示例15: doLogin

function doLogin()
{
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        return;
    }
    if (!isset($_POST['username']) || !isset($_POST['login'])) {
        setError('Ungültige Anmeldedaten');
        return;
    }
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    if ($username == '' || $password == '') {
        setError('Ungültige Anmeldedaten');
        return;
    }
    if (authenticate($username, $password)) {
        session_start();
        session_unset();
        session_regenerate_id(true);
        $_SESSION['username'] = $_POST['username'];
    }
}
开发者ID:r0the,项目名称:paedawan,代码行数:22,代码来源:session.php


示例16: getItems

 public static function getItems($period, $user, $yachs = 'ntime', $sport = '*', $currentpage = 'weekpage')
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $data = new stdClass();
     $query->select('sc.sport  ,sc.multiplier, sc.color,' . '(SELECT count(DISTINCT t.id) FROM `#__htraininglogs_tr_sessions` t left join `#__htraininglogs_tr_splittimes` AS ss on (t.id = ss.tr_id) where (ss.state=1) AND(t.state=1) AND (ss.sport_id = i.sport_id) AND tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59" ) AS no_sessions,' . '(SELECT count(DISTINCT (date(w.tdate))) FROM `#__htraininglogs_tr_sessions` w left join `#__htraininglogs_tr_splittimes` AS ss on ( w.id = ss.tr_id ) WHERE (ss.state=1)AND(w.state=1)AND( ss.sport_id = i.sport_id) AND w.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59") as no_days,' . 'sum( i.km ) AS km, sum( i.climb ) AS climb, sum( i.etime ) AS etime, sum( i.ntime ) AS ntime,' . 'sum(i.' . $yachs . '*(c.group=1)) as RECOM,sum(i.' . $yachs . '*(c.group=2)) as GA1,sum(i.' . $yachs . '*(c.group=3)) as KA1,' . 'sum(i.' . $yachs . '*(c.group=4)) as GA2,sum(i.' . $yachs . '*(c.group=5)) as KA2,sum(i.' . $yachs . '*(c.group=6)) as WSA,' . 'sum(i.' . $yachs . '*(c.group=0)) as Alt');
     $query->from($db->quoteName('#__htraininglogs_cfg_sport') . ' AS sc,' . $db->quoteName('#__htraininglogs_tr_sessions') . ' AS a');
     $query->leftjoin('`#__htraininglogs_tr_intensitylevels` as i on a.id = i.tr_id');
     $query->leftjoin('`#__htraininglogs_cfg_intensity` AS c ON i.int_id = c.id');
     if ($sport != '*') {
         $query->where('sc.id in (' . $sport . ')');
     }
     $query->where('c.sport_id = sc.id');
     $query->where('a.state = 1');
     $query->where('i.state = 1');
     $query->where('a.user_id = ' . $user->id);
     $query->where('a.user_id = ' . $user->id);
     $query->where('a.tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->group('sport ,multiplier');
     $query->order('sc.ordering');
     $db->setQuery($query);
     $data->sports = $db->loadObjectlist();
     if ($db->getErrorNum()) {
         setError(JText::_('COM_HTRAININGLOGS_GET_TRSESSION_FAIL'));
         return false;
     }
     $query = $db->getQuery(true);
     $query->select('count(DISTINCT (id)) as TE,count(DISTINCT date(tdate)) as TT');
     $query->from($db->quoteName('#__htraininglogs_tr_sessions'));
     if ($sport != '*') {
         $query->where('sport_id in (' . $sport . ')');
     }
     $query->where('tdate BETWEEN "' . $period->anfdat->format('Y-m-d') . ' 0:00:00" AND "' . $period->enddat->format('Y-m-d') . ' 23:59:59"');
     $query->where('state = 1');
     $db->setQuery($query);
     $data->sum = $db->loadObject();
     return $data;
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:38,代码来源:sum_tablehelper.php


示例17: _Or

 public function _Or($conditionData)
 {
     if (!($this->lastShackle == "Where")) {
         return setError(3);
     }
     $this->Where($conditionData, " OR ");
     return $this;
 }
开发者ID:afliw,项目名称:ponponpon,代码行数:8,代码来源:testm.php


示例18: get_option

 function get_option($option)
 {
     //Retrieves various runtime behaviours of the current FTP stream
     $this->_resetError();
     switch ($option) {
         case "FTP_TIMEOUT_SEC":
             return FTP_TIMEOUT;
         case "PHP_FTP_OPT_AUTOSEEK":
             return FALSE;
     }
     setError(-1, "Unknown option: {$option}");
     return false;
 }
开发者ID:oostrumoo,项目名称:testproject,代码行数:13,代码来源:ftp.class.php


示例19: sniff_token

 /**
  * Token Sniffer
  * Checks whether a post contains a valid token
  */
 public function sniff_token()
 {
     $locale = fusion_get_locale();
     $error = FALSE;
     if (!empty($_POST)) {
         // Check if a token is being posted and make sure is a string
         if (!isset($_POST['fusion_token']) || !isset($_POST['form_id']) || !is_string($_POST['fusion_token']) || !is_string($_POST['form_id'])) {
             $error = $locale['token_error_2'];
         } elseif (!isset($_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             // Require set pageHash.
             $error = $locale['token_error_9'];
             // Check if the token exists in storage
         } elseif (!in_array($_POST['fusion_token'], $_SESSION['csrf_tokens'][self::pageHash()][$_POST['form_id']])) {
             $error = $locale['token_error_10'] . stripinput($_POST['fusion_token']);
         } elseif (!self::verify_token(0)) {
             $error = $locale['token_error_3'] . stripinput($_POST['fusion_token']);
         }
     }
     // Check if any error was set
     if ($error !== FALSE) {
         // Flag the token as invalid
         $this->tokenIsValid = FALSE;
         // Flag that something went wrong
         $this->stop();
         if ($this->debug) {
             // Add Error Notices
             setError(2, $error, FUSION_SELF, FUSION_REQUEST, "");
             addNotice('danger', $error);
         }
     }
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:35,代码来源:defender.inc.php


示例20: motopressDuplicateTemplate

function motopressDuplicateTemplate()
{
    require_once 'verifyNonce.php';
    require_once 'settings.php';
    require_once 'access.php';
    require_once ABSPATH . '/wp-admin/includes/theme.php';
    require_once 'InitTemplate.php';
    require_once 'functions.php';
    require_once 'getLanguageDict.php';
    $pageId = $_POST['pageId'];
    $templateToDuplicate = $_POST['templateToDuplicate'];
    $newTemplateName = trim($_POST['newTemplateName']);
    global $motopressSettings;
    $lang = getLanguageDict();
    $errors = array();
    $templateDir = $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/';
    if ($pageId && $templateToDuplicate && $newTemplateName) {
        $newTemplateFile = uniqid('page-') . '.php';
        if (!preg_match('/^[^\\*\\/]{1,30}$/is', $newTemplateName)) {
            setError($lang->validationName);
        }
        // If template with new name already exists
        $pageTemplates = get_page_templates();
        foreach ($pageTemplates as $name => $file) {
            if (strcasecmp($newTemplateName, $name) == 0) {
                setError($lang->duplicateErrorTemplateExists);
                //$errors[] = 'Template `'. $name .'` already exists.';
                break;
            }
        }
        if (file_exists($templateDir . $templateToDuplicate)) {
            $oldTemplateFile = file_get_contents($templateDir . $templateToDuplicate);
            $oldTemplateFile = InitTemplate::removePhpComment($oldTemplateFile);
            $oldTemplateFile = InitTemplate::removeEmptyPhp($oldTemplateFile);
            $oldTemplateFile = InitTemplate::reinit($oldTemplateFile, $newTemplateFile, 'main');
            $oldTemplateFile = InitTemplate::setAnnotations($oldTemplateFile, array('template_name' => 'Template Name: ' . $newTemplateName));
            if (!file_put_contents($templateDir . $newTemplateFile, $oldTemplateFile)) {
                setError($lang->duplicateError);
                //$errors[] = 'Error on: file_put_contents("'.$templateDir . $newTemplateFile.'", $oldTemplateFile)';
            }
            if (!update_post_meta($pageId, '_wp_page_template', $newTemplateFile)) {
                unlink($templateDir . $newTemplateFile);
                setError($lang->duplicateError);
                //$errors[] = 'Error on: update_post_meta('.$pageId.', "_wp_page_template", "'.$newTemplateFile.'")';
            }
            $request = array('value' => $newTemplateFile, 'name' => $newTemplateName);
            echo json_encode($request);
        } else {
            $errors[] = strtr($lang->duplicateErrorTemplateNotExist, array('%template%' => $templateDir . $templateToDuplicate));
        }
    } else {
        $errors[] = $lang->duplicateError;
    }
    if (!empty($errors)) {
        if ($motopressSettings['debug']) {
            setError($errors);
        } else {
            setError($lang->duplicateError);
        }
    }
    exit;
}
开发者ID:nelclassico,项目名称:hapvidaplanos,代码行数:62,代码来源:duplicateTemplate.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP setErrorVars函数代码示例发布时间:2022-05-15
下一篇:
PHP setCookies函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap