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


PHP Error::setError方法代码示例

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


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

示例1: getContent

 public function getContent()
 {
     // User is logged in
     if (LOGGED) {
         $this->subcodename = 'logged';
         $tpl = new PHPTAL('blocks/user_panel/logged.html');
         $tpl->user = User::format(User::$id, User::$nickname, User::$groupId);
         $pm_item = User::$pmNew ? array(t('Messages <strong>(New: %new)</strong>', array('%new' => $user->pm_new)), 'pm/inbox') : array(t('Messages'), 'pm');
         $tpl->items = items(array($pm_item[0] => HREF . $pm_item[1], t('Administration') => HREF . 'admin', t('Edit profile') => HREF . 'edit_profile', t('Log out') => HREF . 'logout'));
         return $tpl->execute();
     } else {
         $err = new Error();
         $note = new Notifier('note-user_panel');
         $this->subcodename = 'not_logged';
         $form = array('logname' => null, 'password' => null);
         if ($_POST['login'] && $_POST['user_panel']) {
             $form['logname'] = $_POST['logname-session'] ? filter($_POST['logname-session'], 100) : '';
             $form['password'] = $_POST['password-session'] ? $_POST['password-session'] : '';
             $err->setError('logname_empty', t('Logname field is required.'))->condition(!$form['logname']);
             $err->setError('logname_not_exists', t('Entered logname is not registered.'))->condition(!User::loginNameRegistered($form['logname']));
             $err->setError('password_empty', t('Password field is required.'))->condition(!$form['password']);
             $err->setError('password_incorrect', t('ERROR_PASS_INCORRECT'))->condition($form['password'] && !User::loginPasswordCorrect($form['password']));
             if ($err->noErrors()) {
                 redirect('./');
             } else {
                 $note->error($err->toArray());
             }
         }
         $tpl = new PHPTAL('blocks/user_panel/not_logged.html');
         $tpl->note = $note;
         $tpl->form = $form;
         $tpl->err = $err->toArray();
         return $tpl->execute();
     }
 }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:35,代码来源:user_panel.block.php

示例2: getContent

    public function getContent()
    {
        global $sql;
        //Lang::load('blocks/shoutbox/lang.*.php');
        $err = new Error();
        $note = new Notifier('note-shoutbox');
        $form['author'] = LOGGED ? User::$nickname : '';
        $form['message'] = '';
        if (isset($_POST['reply-shoutbox'])) {
            $form['author'] = LOGGED ? User::$nickname : filter($_POST['author-shoutbox'], 100);
            $form['message'] = filter($_POST['message-shoutbox'], Kio::getConfig('message_max', 'shoutbox'));
            $err->setError('author_empty', t('Author field is required.'))->condition(!$form['author']);
            $err->setError('author_exists', t('Entered nickname is registered.'))->condition(!LOGGED && is_registered($form['author']));
            $err->setError('message_empty', t('Message field is required.'))->condition(!$form['message']);
            // No errors
            if ($err->noErrors()) {
                $sql->exec('
					INSERT INTO ' . DB_PREFIX . 'shoutbox (added, author, message, author_id, author_ip)
					VALUES (
						' . TIMESTAMP . ',
						"' . $form['author'] . '",
						"' . cut($form['message'], Kio::getConfig('message_max', 'shoutbox')) . '",
						' . UID . ',
						"' . IP . '")');
                $sql->clearCache('shoutbox');
                $note->success(t('Entry was added successfully.'));
                redirect(HREF . PATH . '#shoutbox');
            } else {
                $note->error($err->toArray());
            }
        }
        // If cache for shoutbox doesn't exists
        if (!($entries = $sql->getCache('shoutbox'))) {
            $query = $sql->query('
				SELECT u.nickname, u.group_id, s.added, s.author, s.author_id, s.message
				FROM ' . DB_PREFIX . 'shoutbox s
				LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = s.author_id
				ORDER BY s.id DESC
				LIMIT ' . Kio::getConfig('limit', 'shoutbox'));
            while ($row = $query->fetch()) {
                if ($row['author_id']) {
                    $row['author'] = User::format($row['author_id'], $row['nickname'], $row['group_id']);
                    $row['message'] = parse($row['message'], Kio::getConfig('parser', 'shoutbox'));
                }
                $entries[] = $row;
            }
            $sql->putCacheContent('shoutbox', $entries);
        }
        try {
            $tpl = new PHPTAL('blocks/shoutbox/shoutbox.tpl.html');
            $tpl->entries = $entries;
            $tpl->err = $err->toArray();
            $tpl->form = $form;
            $tpl->note = $note;
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e->getMessage());
            //echo Note::error($e->getMessage());
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:60,代码来源:shoutbox.block.php

示例3: getForm

 public static function getForm($errors = array())
 {
     global $cfg;
     if (LOGGED) {
         redirect(REFERER);
     }
     $note = new Notifier();
     $err = new Error();
     if ($errors) {
         $note->error($errors);
     }
     if ($_POST['login'] && $_POST['module']) {
         $form = array('logname' => $_POST['logname-session'] ? filter($_POST['logname-session'], 100) : '', 'password' => $_POST['password-session'] ? filter($_POST['password-session'], 100) : '');
         $err->setError('empty_logname', t('Logname field is required.'))->condition(!$form['logname']);
         $err->setError('logname_not_exists', t('The logname you used isn&apos;t registered.'))->condition($form['logname'] && !User::loginNameRegistered($form['logname']));
         $err->setError('password_empty', t('Password field is required.'))->condition(!$form['password']);
         $err->setError('password_invalid', t('Password is invalid.'))->condition($form['password'] && !User::loginPasswordCorrect($form['password']));
         $err->noErrors() ? redirect(REFERER) : $note->restore()->error($err->toArray());
     }
     $tpl = new PHPTAL('modules/login/form.html');
     $tpl->form = $form;
     $tpl->err = $err->toArray();
     $tpl->note = $note;
     echo $tpl->execute();
 }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:25,代码来源:login.module.php

示例4: validateModel

 public static function validateModel($model, $attrmapping = false)
 {
     //		if(\GO\Base\Util\Http::isPostRequest()){
     //			if(!empty($attrmapping)){
     //				foreach($attrmapping as $attr=>$replaceattr){
     //					$model->$replaceattr = $_POST[$attr];
     //				}
     //			}
     $errors = array();
     if (!$model->validate()) {
         $errors = $model->getValidationErrors();
     }
     if ($model->customfieldsRecord && !$model->customfieldsRecord->validate()) {
         $errors = array_merge($errors, $model->customfieldsRecord->getValidationErrors());
     }
     if (count($errors)) {
         foreach ($errors as $attribute => $message) {
             $formAttribute = isset($attrmapping[$attribute]) ? $attrmapping[$attribute] : $attribute;
             Input::setError($formAttribute, $message);
             // replace is needed because of a mix up with order model and company model
         }
         Error::setError(\GO::t('errorsInForm'));
         return false;
     } else {
         return true;
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:27,代码来源:Error.php

示例5: connect

 public function connect()
 {
     if (!isset($this->_dbh)) {
         if ($this->_dbh = @mysql_connect(HOST, USER, PASS)) {
             $this->_dbh = @mysql_select_db(BD, $this->_dbh);
         } else {
             $Error = new Error();
             $Error->setError('Não foi possível efetuar a conexão com o MySQL.');
             $Error->ShowError();
         }
     }
     return $this;
 }
开发者ID:renatorabelo,项目名称:PAS,代码行数:13,代码来源:MySQL.class.php

示例6: Show

 function Show()
 {
     $va_nums = explode(';', $this->request->getParameter('n', pString));
     $va_error_messages = array();
     if (is_array($va_nums)) {
         $o_err = new Error(0, '', '', '', false, false);
         foreach ($va_nums as $vn_error_number) {
             $o_err->setError($vn_error_number, '', '', false, false);
             $va_error_messages[] = $o_err->getErrorMessage();
         }
     }
     $this->view->setVar('error_messages', $va_error_messages);
     $this->view->setVar('referrer', $this->request->getParameter('r', pString));
     $this->render('error_html.php');
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:15,代码来源:ErrorController.php

示例7: Show

 function Show()
 {
     $o_purify = new HTMLPurifier();
     $va_nums = explode(';', $this->request->getParameter('n', pString));
     $va_error_messages = $this->notification->getNotifications();
     if ((!is_array($va_error_messages) || sizeof($va_error_messages) == 0) && is_array($va_nums)) {
         $o_err = new Error(0, '', '', '', false, false);
         foreach ($va_nums as $vn_error_number) {
             $o_err->setError($vn_error_number, '', '', false, false);
             $va_error_messages[] = $o_err->getErrorMessage();
         }
     }
     $this->view->setVar('error_messages', $va_error_messages);
     $this->view->setVar('referrer', $o_purify->purify($this->request->getParameter('r', pString)));
     $this->render('error_html.php');
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:16,代码来源:ErrorController.php

示例8: getContent

    public function getContent()
    {
        global $sql;
        $this->note = new Notifier();
        $err = new Error();
        // Redirect logged users to front page
        // Activate account
        // registration/activate/234/sfs9fsefsef36dsdgesefe4td
        if (u1 == 'activate' && ctype_digit(u2)) {
            return $this->accountActivation();
        } else {
            if (Kio::getConfig('type', 'registration') == 0) {
                return $this->note->error('Rejestracja została <strong>wstrzymana</strong>.');
            } else {
                //			Kio::addJsCode('$(\'#check_logname\').click(function(){alert();});');
                // Registering
                if (isset($_POST['register'])) {
                    // filter(string, limit)
                    $form = array('logname' => $_POST['logname'] ? filter($_POST['logname'], 100) : '', 'nickname' => $_POST['nickname'] ? filter($_POST['nickname'], 100) : '', 'pass' => $_POST['pass'] ? filter($_POST['pass'], 100) : '', 'pass2' => $_POST['pass2'] ? filter($_POST['pass2'], 100) : '', 'email' => strtolower(filter($_POST['email'], 100)), 'rules' => $_POST['rules'] ? true : false, 'newsletter' => $_POST['newsletter'] ? 1 : 0, 'pm_notify' => $_POST['pm_notify'] ? 1 : 0, 'hide_email' => $_POST['hide_email'] ? 1 : 0);
                    // Errors
                    $err->setError('logname_empty', t('Logname field is required.'))->condition(!$form['logname']);
                    $err->setError('logname_exists', t('The logname you used is already registered.'))->condition(is_registered($form['logname'], 'logname'));
                    $err->setError('nickname_empty', t('Nickname field is required.'))->condition(!$form['nickname']);
                    $err->setError('nickname_exists', t('The nickname you used is already registered.'))->condition(is_registered($form['nickname'], 'nickname'));
                    $err->setError('pass_empty', t('Password field is required.'))->condition(!$form['pass']);
                    $err->setError('pass_not_match', t('Passwords do not match.'))->condition($form['pass'] != $form['pass2'] && $form['pass']);
                    $err->setError('email_empty', t('E-mail field is required.'))->condition(!$form['email']);
                    $err->setError('email_invalid', t('E-mail address you entered is invalid.'))->condition($form['email'] && !is_email($form['email']));
                    $err->setError('email_exists', t('The e-mail you used is already registered.'))->condition(is_registered($form['email'], 'email'));
                    $err->setError('rules_not_accepted', t('Accepting the rules is required.'))->condition(!$form['rules'] && Kio::getConfig('show_rules', 'registration'));
                    // No errors
                    if ($err->noErrors()) {
                        $blocked = 1;
                        switch (Kio::getConfig('type', 'registration')) {
                            case 1:
                                $blocked = 'NULL';
                                $message = 'Rejestracja przebiegła pomyślnie, możesz się teraz zalogować.';
                                break;
                            case 2:
                                $message = 'Rejestracja przebiegła pomyślnie.<br />Wymagana jest aktywacja konta poprzez kliknięcie w odnośnik wysłany na Twoją skrzynkę e-mail.';
                                break;
                            default:
                                $message = 'Rejestracja przebiegła pomyślnie.<br />Wymagana jest aktywacja konta przez administratora, wówczas zostaniesz powiadomiony e-mail&#39;em.';
                        }
                        // Detect country
                        $form['country'] = end(explode('.', gethostbyaddr(IP)));
                        $form['country'] = $lang_system['COUNTRIES'][$form['country']] ? $form['country'] : '';
                        $stmt = $sql->prepare('
						INSERT INTO ' . DB_PREFIX . 'users
						SET
							logname = :logname,
							nickname = :nickname,
							email = :email,
							pass = :pass,
							registered = :registered,
							country = :country,
							newsletter = :newsletter,
							pm_notify = :pm_notify,
							hide_email = :hide_email,
							blocked = :blocked,
							time_zone = :time_zone,
							ip = :ip,
							auth_code = :auth_code,
							http_agent = :http_agent;
							
						UPDATE ' . DB_PREFIX . 'stats
						SET content = content + 1
						WHERE name = "registered_users"');
                        $stmt->execute(array('logname' => $form['logname'], 'nickname' => $form['nickname'], 'email' => $form['email'], 'pass' => md5($form['pass']), 'registered' => TIMESTAMP, 'country' => $form['country'], 'newsletter' => $form['newsletter'], 'pm_notify' => $form['pm_notify'], 'hide_email' => $form['hide_email'], 'blocked' => 1, 'time_zone' => Kio::getConfig('time_zone'), 'ip' => IP, 'auth_code' => auth_code($form['logname']), 'http_agent' => filter($_SERVER['HTTP_USER_AGENT'], 250)));
                        $this->note->success($message);
                        redirect(HREF . 'registration');
                    } else {
                        $this->note->error($err->toArray());
                    }
                }
                //			// No action
                //			else
                //			{
                //				$this->note->info(array(t('Register and enjoy additional services.')));
                //			}
                try {
                    $tpl = new PHPTAL('modules/registration/registration.tpl.html');
                    $tpl->form = $form;
                    $tpl->entries = $entries;
                    $tpl->err = $err->toArray();
                    $tpl->note = $this->note;
                    return $tpl->execute();
                } catch (Exception $e) {
                    return template_error($e);
                }
            }
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:93,代码来源:registration.module.php

示例9:

    $row['ESTADOCIVIL'] == 'V' ? print 'selected="selected"' : "";
    ?>
 value="V"><span>Viuvo(a)</span></option>
                            <option <?php 
    $row['ESTADOCIVIL'] == 'D' ? print 'selected="selected"' : "";
    ?>
 value="D"><span>Divorciado(a)</span></option>
                        </select>
                    </p>
                    <p><span style="width: 120px">Avaliação Médica:</span><textarea rows="5" cols="50"
                                                                                    name="avaliacao"><?php 
    $row['AVALIACAOMEDICA'];
    ?>
</textarea></p>
                    <hr>
					<input name="Id" type="hidden" value="<?php 
    echo $_GET['id'];
    ?>
"/>
					<input class="submit" type="submit" name="alterarcliente" style="margin: 10px 0 0 0;"  value="Alterar"/>
                    <input class="submit" type="button" onclick="history.go(-1);" value="Cancelar" style="margin: 0 0 0 10px;"/>
						
                </form>
            </div>
        </div>
    </div>
<?php 
} else {
    $Error->setError('� preciso estar logado para acessar a p�gina!');
    $Error->ShowDie();
}
开发者ID:renatorabelo,项目名称:PAS,代码行数:31,代码来源:IdososAlter.php

示例10: getContent

    public function getContent()
    {
        global $sql;
        $err = new Error();
        $form = array();
        if (Kio::getConfig('informations', 'contact')) {
            $info = Notifier::factory('note-contact_info')->info(parse(Kio::getConfig('informations', 'contact'), BBCODE . AUTOLINKS . EMOTICONS . CENSURE . PRE));
        }
        if (isset($_POST['send'])) {
            // Form values
            $form = array('receiver' => filter($_POST['receiver'], 100), 'sender' => LOGGED ? User::$nickname : filter($_POST['sender'], 100), 'email' => LOGGED ? User::$email : filter($_POST['email'], 100), 'subject' => filter($_POST['subject'], 100), 'message' => filter($_POST['message'], 250));
            if (!empty($_COOKIE[COOKIE . '-flood-contact']) && Kio::getConfig('flood_interval')) {
                $err->setError('flood', t('ERROR_FLOOD'));
            } else {
                // Errors
                if (!LOGGED) {
                    $err->setError('sender_empty', t('Sender field is required.'))->condition(!$form['sender']);
                    $err->setError('sender_exists', t('ERROR_SENDER_EXISTS'))->condition(is_registered($form['sender'], 'nickname'));
                    $err->setError('email_empty', t('E-mail address field is required.'))->condition(!$form['email']);
                    $err->setError('email_invalid', t('ERROR_EMAIL_INVALID'))->condition($form['email'] && !is_email($form['email']));
                }
                //				$err->setError('phone_invalid', t('ERROR_PHONE_INVALID'))
                //					->condition($form['phone'] && !preg_match('#^[0-9 ()+-]+$#', $form['phone']));
                $err->setError('subject_empty', t('Subject field is required.'))->condition(!$form['subject']);
                $err->setError('message_empty', t('Message field is required.'))->condition(!$form['message']);
            }
            if ($err->noErrors()) {
                $from = "From: {$form['email']}2";
                $msg = "Imię: {$imie}\nE-Mail: {$form['email']}2\nTelefon: {$telefon}\n\nTreść wiadomości:\n{$form['message']}\n\n\n----\nWiadomość została wysłana ze strony {$adres}\nIP: {$ip}";
                echo mail($form['email'], $temat, $msg, $from) ? $note->success(t('SUCCESS')) . redirect() : $note->error(t('Wystąpił błąd, spróbuj wysłać później'));
                if (Kio::getConfig('flood_interval')) {
                    setcookie(COOKIE . '-contact', 'true', TIMESTAMP + Kio::getConfig('flood_interval') + 1, '/');
                }
                $to = "someone@example.com";
                $subject = "Test mail";
                $message = "Hello! This is a simple email message.";
                $from = "someonelse@example.com";
                $headers = "From: {$from}";
                mail($to, $subject, $message, $headers);
            } else {
                $this->note->error($err->toArray());
            }
        }
        $stmt = $sql->setCache('contact')->prepare('
			SELECT id, nickname, group_id
			FROM ' . DB_PREFIX . 'users
			WHERE id IN (:receivers)');
        $stmt->bindParam(':receivers', Kio::getConfig('receivers', 'contact'));
        $stmt->execute();
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $row['g_name'] = Kio::getGroup($row['group_id'], 'name');
            $receivers[] = $row;
        }
        try {
            $tpl = new PHPTAL('modules/contact/contact.tpl.html');
            $tpl->message_limit = Kio::getConfig('message_max', 'contact');
            $tpl->form = $form;
            $tpl->user = User::toArray();
            $tpl->receivers = $receivers;
            $tpl->err = $err->toArray();
            $tpl->note = $this->note;
            $tpl->info = isset($info) ? $info : '';
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e);
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:67,代码来源:contact.module.php

示例11:

                                        href="?page=UsuariosAlter&id=<?php 
            echo $value['CDUSUARIO'];
            ?>
"
                                        style="text-decoration: none; color: #FFFFFF;">Alterar</a></th>
                                <th class="delete" id="ExclUsuarios"><a
                                        href="?page=UsuariosExcl&id=<?php 
            echo $value['CDUSUARIO'];
            ?>
"
                                        style="text-decoration: none; color: #FFFFFF;">Excluir</a></th>
                            </tr>
                                <?php 
        }
    }
    ?>
                    <tr>
                        <th class="insert" id="InsUsuarios"><a href="?page=UsuariosCad"
                                                            style="text-decoration: none; color: #FFFFFF;">Incluir</a>
                        </th>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php 
} else {
    $Error->setError('É preciso estar logado para acessar a página!');
    $Error->ShowDie();
}
开发者ID:renatorabelo,项目名称:PAS,代码行数:31,代码来源:Usuarios.php

示例12: postError

 /**
  * Adds a new error
  *
  * @param int $pn_num
  * @param string $ps_message
  * @param string $ps_context
  */
 function postError($pn_num, $ps_message, $ps_context, $ps_source = '')
 {
     $o_error = new Error();
     $o_error->setErrorOutput($this->opb_die_on_error);
     $o_error->setHaltOnError($this->opb_die_on_error);
     $o_error->setError($pn_num, $ps_message, $ps_context, $ps_source);
     array_push($this->errors, $o_error);
     return true;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:16,代码来源:DbBase.php

示例13: postError

 public function postError($pn_num, $ps_message, $ps_context, $ps_source = '')
 {
     $o_error = new Error();
     $o_error->setErrorOutput($this->error_output);
     $o_error->setError($pn_num, $ps_message, $ps_context, $ps_source);
     if (!$this->errors) {
         $this->errors = array();
     }
     array_push($this->errors, $o_error);
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:11,代码来源:BaseObject.php

示例14:

                                <li><a href="?page=PosicaoEstoque">Posição de estoque</a></li>
                                <li><a href="?page=LogAtivos">Saída/Entrada Ativos</a></li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li><a href="?page=Logout">Sair do Sistema</a>
            </ul>
        </nav>
    </header>
    <div id="site_content">
        <div id="content">
            <h1>Produtos</h1>
			<?php 
    if (empty($arrValue)) {
        $Error->setError('Não há produto cadastrado!');
        $Error->ShowError();
    }
    ?>
            <div id="table">
                <table>
                    <thead>
                    <tr>
                        <th>Id</th>
                        <th>Nome</th>
                        <th>Descrição</th>
                        <th>Tipo de Produto</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
开发者ID:renatorabelo,项目名称:PAS,代码行数:31,代码来源:Produtos.php

示例15: _msgEnCrypt

 /**
  * 消息体加密处理.
  * @param unknown $msg
  * @return unknown|string
  */
 private function _msgEnCrypt($msg)
 {
     if (!$this->is_encrypt) {
         return $msg;
     }
     $timeStamp = trim($_GET['timestamp']);
     $nonce = trim($_GET['nonce']);
     $pc = $this->_getCryptObject();
     $ret_msg = '';
     $errCode = $pc->encryptMsg($msg, $timeStamp, $nonce, $ret_msg);
     if ($errCode == 0) {
         return $ret_msg;
     }
     Error::setError('124', '消息加密失败');
     $this->_exit();
 }
开发者ID:zhongyu2005,项目名称:demo,代码行数:21,代码来源:WxMessageHand.class.php


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