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


PHP Errors::add方法代码示例

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


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

示例1: receivePayment

 function receivePayment()
 {
     global $CFG;
     if (empty($_REQUEST['tx'])) {
         return false;
     }
     $auth_info = Link::executeScript($CFG->paypal_submit_url, array('tx' => $_REQUEST['tx'], 'at' => $CFG->paypal_tocken, 'cmd' => '_notify-synch'));
     $is_approved = stristr($auth_info, 'SUCCESS');
     if ($is_approved) {
         $auth_info = str_ireplace('SUCCESS', '', $auth_info);
         Messages::add($CFG->paypal_success_message);
         self::$item_count = mb_substr_count($auth_info, 'item_number');
         return self::parseInfo($auth_info);
     } else {
         Errors::add($CFG->paypal_failure_message);
         return false;
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:18,代码来源:Paypal.php

示例2: logIn

 public static function logIn($user = false, $pass = false, $table = false, $session_name = false)
 {
     global $CFG;
     $user = strip_tags(mysql_real_escape_string($user));
     $pass = strip_tags(mysql_real_escape_string($pass));
     $table = $table ? $table : 'admin';
     $session_name = $session_name ? $session_name : 'user_info';
     self::$session_name = $session_name;
     if (empty($user) && empty($pass) && !$_SESSION[$session_name]['user']) {
         return false;
     }
     if (!empty($user) || !empty($pass)) {
         if (empty($user)) {
             Errors::add($CFG->login_empty_user);
             return false;
         }
         if (empty($pass)) {
             Errors::add($CFG->login_empty_pass);
             return false;
         }
     }
     if (empty($CFG->dbname)) {
         Errors::add($CFG->no_database_error);
         return false;
     }
     $user = $user ? trim($user) : $_SESSION[$session_name]['user'];
     $pass = $pass ? trim($pass) : $_SESSION[$session_name]['pass'];
     if (empty($user) || empty($pass)) {
         return false;
     }
     if (!User::verify($user, $pass, $table)) {
         Errors::add($CFG->login_invalid);
         User::logOut(1);
         return false;
     }
     $_SESSION[$session_name] = User::getInfo($user, $table);
     self::$logged_in = true;
     self::$info = $_SESSION[$session_name];
     return true;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:40,代码来源:User.php

示例3: get

 function get($p_id = 0, $count = false)
 {
     global $CFG;
     if (empty($this->url) && !$this->show_all) {
         Errors::add($CFG->comments_no_url_error);
         return false;
     }
     if (!($this->record_id > 0) && !$this->show_all) {
         Errors::add($CFG->comments_no_record_error);
         return false;
     }
     $sql_filter = $this->sql_filter;
     $sql = "SELECT comments.* FROM {$this->table} ";
     if ($sql_filter) {
         $matches = String::getSubstring($sql_filter, '[', ']');
         foreach ($matches as $match) {
             if (strstr($match, ',')) {
                 $join_path = explode(',', $match);
                 if (is_array($join_path)) {
                     foreach ($join_path as $join_field) {
                         $join_field_parts = explode('.', $join_field);
                         $join_table = $join_field_parts[0];
                         $j_field = $join_field_parts[1];
                         $join_tables[$join_table][] = $j_field;
                     }
                     $sql_filter = str_ireplace('[' . $match . ']', $join_field, $sql_filter);
                 }
             } elseif (strstr($match, '.')) {
                 $join_field_parts = explode('.', $match);
                 $join_table = $join_field_parts[0];
                 $j_field = $join_field_parts[1];
                 $join_tables[$join_table][] = $j_field;
                 $sql_filter = str_replace('[', '', str_replace(']', '', $sql_filter));
             }
         }
     }
     if ($join_tables) {
         foreach ($join_tables as $r_table => $r_field) {
             $j_field = $prev_field == 'id' ? $r_field[0] : 'id';
             $j_field = $r_table == $prev_table ? $prev_field : $r_field[0];
             if ($r_table != $this->table) {
                 $sql .= " LEFT JOIN {$r_table} ON ({$prev_table}.{$prev_field} = {$r_table}.{$j_field}) ";
             }
             $prev_table = $r_table;
             $prev_field = count($r_field) > 1 ? $r_field[1] : $r_field[0];
         }
     }
     $sql .= " WHERE 1 ";
     if ($sql_filter) {
         $sql_filter = String::doFormulaReplacements($sql_filter);
         $sql .= " AND (" . $sql_filter . ') ';
     }
     $sql .= (!$this->show_all ? "AND {$this->table}.url = '{$this->url}' AND {$this->table}.record_id = {$this->record_id}" : "") . " " . (!$count ? "AND {$this->table}.p_id = {$p_id}" : '') . " \n\t\tORDER BY {$this->table}.date DESC ";
     if ($this->max_comments) {
         $sql .= " LIMIT 0,{$this->max_comments}";
     }
     $result = db_query_array($sql);
     if ($result) {
         foreach ($result as $row) {
             $this->count++;
             $id = $row['id'];
             $comments[$id] = $row;
             $comments[$id]['children'] = Comments::get($id);
         }
     }
     return $comments;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:67,代码来源:Comments.php

示例4: array

    $_SESSION['ba_c_currency'] = $_REQUEST['c_currency'];
} else {
    if (empty($_SESSION['ba_c_currency'])) {
        $_SESSION['ba_c_currency'] = $_SESSION['c_currency'];
    }
}
$c_currency = $_SESSION['ba_c_currency'];
API::add('BitcoinAddresses', 'get', array(false, $c_currency, false, 30, 1));
API::add('Content', 'getRecord', array('bitcoin-addresses'));
$query = API::send();
$bitcoin_addresses = $query['BitcoinAddresses']['get']['results'][0];
$content = $query['Content']['getRecord']['results'][0];
$page_title = Lang::string('bitcoin-addresses');
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'add' && $_SESSION["btc_uniq"] == $_REQUEST['uniq']) {
    if (strtotime($bitcoin_addresses[0]['date']) >= strtotime('-1 day')) {
        Errors::add(Lang::string('bitcoin-addresses-too-soon'));
    }
    if (!is_array(Errors::$errors)) {
        API::add('BitcoinAddresses', 'getNew', array($c_currency));
        API::add('BitcoinAddresses', 'get', array(false, $c_currency, false, 30, 1));
        $query = API::send();
        $bitcoin_addresses = $query['BitcoinAddresses']['get']['results'][0];
        Messages::add(Lang::string('bitcoin-addresses-added'));
    }
}
$_SESSION["btc_uniq"] = md5(uniqid(mt_rand(), true));
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
开发者ID:bitdoviz,项目名称:wlox-frontend,代码行数:31,代码来源:bitcoin-addresses.php

示例5: deleteRecursive

 public static function deleteRecursive($table, $id)
 {
     global $CFG;
     if (!$table || !($id > 0)) {
         return false;
     }
     if (!db_delete($table, $id)) {
         Errors::add($CFG->ajax_delete_error);
         return false;
     }
     $sql = "SELECT id FROM {$table} WHERE p_id = {$id}";
     $result = db_query_array($sql);
     if ($result) {
         foreach ($result as $row1) {
             $id1 = $row1['id'];
             self::deleteRecursive($table, $id1);
         }
     }
 }
开发者ID:MirellJ,项目名称:backstage2,代码行数:19,代码来源:DB.php

示例6: array

            exit;
        }
    }
}
if ($sell && !is_array(Errors::$errors)) {
    $sell_market_price1 = !empty($_REQUEST['sell_market_price']);
    $sell_stop = !empty($_REQUEST['sell_stop']);
    $sell_stop_price1 = $sell_stop ? $sell_stop_price1 : false;
    $sell_limit = !empty($_REQUEST['sell_limit']);
    $sell_limit = !$sell_stop && !$sell_market_price1 ? 1 : $sell_limit;
    $sell_price1 = $sell_market_price1 ? $current_bid : $sell_price1;
    API::add('Orders', 'executeOrder', array(0, $sell_stop && !$sell_limit ? $sell_stop_price1 : $sell_price1, $sell_amount1, $c_currency1, $currency1, $user_fee_ask, $sell_market_price1, $order_info['id'], false, false, $sell_stop_price1));
    $query = API::send();
    $operations = $query['Orders']['executeOrder']['results'][0];
    if (!empty($operations['error'])) {
        Errors::add($operations['error']['message']);
    } else {
        if ($operations['edit_order'] > 0) {
            $uniq_time = time();
            $_SESSION["editorder_uniq"][$uniq_time] = md5(uniqid(mt_rand(), true));
            if (count($_SESSION["editorder_uniq"]) > 3) {
                unset($_SESSION["editorder_uniq"][min(array_keys($_SESSION["editorder_uniq"]))]);
            }
            Link::redirect('open-orders.php', array('transactions' => $operations['transactions'], 'edit_order' => 1));
            exit;
        } else {
            $uniq_time = time();
            $_SESSION["editorder_uniq"][$uniq_time] = md5(uniqid(mt_rand(), true));
            if (count($_SESSION["editorder_uniq"]) > 3) {
                unset($_SESSION["editorder_uniq"][min(array_keys($_SESSION["editorder_uniq"]))]);
            }
开发者ID:bitdoviz,项目名称:wlox-frontend,代码行数:31,代码来源:edit-order.php

示例7: elseif

        $step1 = true;
    }
} elseif (!empty($_REQUEST['step']) && $_REQUEST['step'] == 3) {
    if (!($token1 > 0)) {
        Errors::add(Lang::string('security-no-token'));
    }
    if (!is_array(Errors::$errors)) {
        API::settingsChangeId($authcode1);
        API::token($token1);
        API::add('User', 'verifiedGoogle');
        $query = API::send();
        if ($query['error'] == 'security-incorrect-token') {
            Errors::add(Lang::string('security-incorrect-token'));
        }
        if ($query['error'] == 'request-expired') {
            Errors::add(Lang::string('settings-request-expired'));
        }
        if (!is_array(Errors::$errors)) {
            Messages::add(Lang::string('security-success-message'));
            $step4 = true;
        } else {
            $step3 = true;
        }
    } else {
        $step3 = true;
    }
}
if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') {
    $notice = Lang::string('settings-change-notice');
} elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'security-disabled-message') {
    Messages::add(Lang::string('security-disabled-message'));
开发者ID:bitdoviz,项目名称:wlox-frontend,代码行数:31,代码来源:security.php

示例8: sendSMS

 static function sendSMS($authy_id = false)
 {
     global $CFG;
     API::add('User', 'sendSMS', array($authy_id));
     $query = API::send();
     $response = $query['User']['sendSMS']['results'][0];
     if (!$response || !is_array($response)) {
         Errors::add(Lang::string('security-com-error'));
     } elseif ($response['success'] == false) {
         Errors::merge($response['errors']);
     } else {
         return true;
     }
 }
开发者ID:gfts,项目名称:1btcxe-frontend,代码行数:14,代码来源:User.php

示例9: Panier

define('NO_LOGIN_REQUIRE', TRUE);
include 'conf/conf.php';
$action = !empty($_REQUEST['ajax']) ? $_REQUEST['ajax'] : exit;
switch ($action) {
    case "addPanier":
        if (isset($_POST)) {
            $panier = new Panier();
            $panier->addItem($_POST['code-produit'], $_POST['nb-produit']);
            Utils::json(array('result' => 'success'));
        }
        break;
    case "inscription":
        $controle = new Errors();
        if (empty($_POST['codeClientSignIn'])) {
            $controle->add('Veuillez saisir votre code client', 'codeClientSignIn');
        }
        if (empty($_POST['emailSignIn'])) {
            $controle->add('Veuillez saisir votre adresse email', 'emailSignIn');
        }
        if (empty($_POST['emailSignIn2'])) {
            $controle->add('Veuillez confirmez votre adresse email', 'emailSignIn2');
        }
        if ($_POST['emailSignIn'] != $_POST['emailSignIn2']) {
            $controle->add('Les adresses email ne sont pas identiques', 'emailNotSame');
        }
        if ($controle->isEmpty()) {
            $codeClientSignIn = $_POST['codeClientSignIn'];
            $emailSignIn = $_POST['emailSignIn'];
            $customer = UtilisateursManager::getUtilisateurByCodeClientAndEmail($codeClientSignIn, $emailSignIn);
            if ($customer) {
开发者ID:JoffreyC22,项目名称:algobreizh,代码行数:30,代码来源:ajax.php

示例10: addError

 /**
  * Add validation error
  *
  * @param string $error_msg
  * @param string|null $attribute
  */
 public function addError($error_msg, $attribute = 'base')
 {
     $this->errors->add($attribute, $error_msg);
 }
开发者ID:gigorok,项目名称:php-orm,代码行数:10,代码来源:Validations.php

示例11: foreach

        $query = API::send();
        Messages::add(Lang::string('bank-accounts-added-message'));
        $bank_accounts = $query['BankAccounts']['get']['results'][0];
    }
}
if ($remove_id1 > 0) {
    $found = false;
    if (!empty($bank_accounts) && is_array($bank_accounts)) {
        foreach ($bank_accounts as $account) {
            if ($account['id'] == $remove_id1) {
                $found = true;
            }
        }
    }
    if (!$found) {
        Errors::add(Lang::string('bank-accounts-remove-error'));
    }
    if (!is_array(Errors::$errors)) {
        API::add('BankAccounts', 'delete', array($remove_id1));
        API::add('BankAccounts', 'get');
        $query = API::send();
        Messages::add(Lang::string('bank-accounts-removed-message'));
        $bank_accounts = $query['BankAccounts']['get']['results'][0];
    }
}
$_SESSION["bankaccount_uniq"] = md5(uniqid(mt_rand(), true));
include 'includes/head.php';
?>
<div class="page_title">
	<div class="container">
		<div class="title"><h1><?php 
开发者ID:bitdoviz,项目名称:wlox-frontend,代码行数:31,代码来源:bank-accounts.php

示例12: elseif

         if ($row['month']) {
             if ($month != date('n') && $month != date('m')) {
                 continue;
             }
         }
         if ($row['year']) {
             if ($year != date('Y') && $year != date('y')) {
                 continue;
             }
         }
     }
     if ($method['method'] == 'emailNotify') {
         if (Email::send($CFG->form_email, $row1[$email_field], $message['title'], $CFG->form_email_from, false, $message['content'], $row1)) {
             Messages::add($CFG->email_sent_message);
         } else {
             Errors::add($CFG->email_send_error);
         }
     } elseif ($method['method'] == 'createRecord') {
         $CFG->save_called = 1;
         $form = new Form('cron', false, false, false, $control_args['table'], false, 1);
         $form->get($row1['id']);
         $form->createRecord($method_args['table'], $method_args['insert_array'], $method_args['trigger_field'], $method_args['trigger_value'], $method_args['day'], $method_args['month'], $method_args['year'], $method_args['send_condition'], $method_args['any_modification'], $method_args['register_changes'], $method_args['on_new_record_only'], $method_args['store_row'], $method_args['if_not_exists'], $method_args['run_in_cron']);
         unset($form);
     } elseif ($method['method'] == 'editRecord') {
         $CFG->save_called = 1;
         $form = new Form('cron', false, false, false, $control_args['table'], false, 1);
         $form->get($row1['id']);
         $form->editRecord($method_args['table'], $method_args['insert_array'], $method_args['trigger_field'], $method_args['trigger_value'], $method_args['day'], $method_args['month'], $method_args['year'], $method_args['send_condition'], $method_args['any_modification'], $method_args['register_changes'], $method_args['on_new_record_only'], $method_args['store_row'], $method_args['edit_record_field_id'], $method_args['run_in_cron']);
         unset($form);
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:31,代码来源:cron.php

示例13: ucfirst

                        Utils::writeAPhpManager($chemin . '/' . 'managers/', ucfirst($table[$bddName]) . 'Manager', $describes, $table[$bddName]);
                    }
                    break;
                case '0':
                    exit;
                    break;
            }
        }
    }
}
// section backoffice
if (isset($_POST['submit-backoffice'])) {
    if (isset($_POST)) {
        $error = new Errors();
        if (empty($_POST['PATH_CLASS'])) {
            $error->add('Veuilliez sassir le nom de la base de donnés. ', 'DBNAME');
        }
        if (empty($_POST['PATH'])) {
            $error->add('Veuilliez sassir le chemi des fichers ', 'PATH');
        }
        if ($error->isEmpty()) {
            $dir = $_POST['PATH_CLASS'];
            $files = scandir($dir);
            $menu = array();
            foreach ($files as $file) {
                if (count(explode('.php', $file)) > 1) {
                    $name = explode('.php', $file);
                    array_push($menu, $name[0]);
                    $content = file_get_contents($dir . $file);
                    explode($content);
                    // creation controller ;
开发者ID:kingdom96,项目名称:Generateur-des-projets,代码行数:31,代码来源:index.php

示例14: Errors

<?php

require 'conf/conf.php';
define('PAGE', 'CONTACT');
require 'conf/conf_page.php';
$sentMail = 'sentmail';
if (!empty($_POST)) {
    if (isset($_POST['submit'])) {
        $controle = new Errors();
        if (empty($_POST['email'])) {
            $controle->add('Veuillez saisir votre e-mail', 'email');
        }
        if (empty($_POST['name'])) {
            $controle->add('Veuillez saisir votre nom', 'name');
        }
        if (empty($_POST['message'])) {
            $controle->add('Veuillez saisir votre message', 'message');
        }
        if ($controle->isEmpty()) {
            $sentMessage = new Mail();
            $customer = UtilisateursManager::getUtilisateursById($_SESSION['customer']['idClient']);
            $sentMail = $sentMessage->Contact($customer);
            if ($sentMail) {
                $sentMail = 'send';
            }
        }
    }
}
echo $twig->render('contact.twig', array('PAGE' => $_PAGE, 'controle' => isset($controle) && !empty($controle) ? $controle : null, 'POST' => isset($_POST) && !empty($_POST) ? $_POST : '', 'send' => $sentMail));
开发者ID:JoffreyC22,项目名称:algobreizh,代码行数:29,代码来源:contact.php

示例15: grid

 function grid($name, $caption = false, $link_url = false, $link_is_tab = false, $concat_char = false)
 {
     global $CFG;
     $form = Control::getControls($CFG->editor_page_id, 'form', $CFG->editor_is_tab);
     if (!$form) {
         Errors::add('No form action created yet.');
         return false;
     }
     foreach ($form as $id => $control) {
         if (is_array($control['methods'])) {
             foreach ($control['methods'] as $method) {
                 $args = unserialize($method['arguments']);
                 if ($method['method'] == 'grid' && $args['name'] == $name) {
                     $grid_id = $id;
                     $grid_method = $method;
                     $grid_control = $control;
                     break 2;
                 }
             }
         }
     }
     if (!($grid_id > 0)) {
         Errors::add('No grid input called ' . $name . ' exists. Create it on the form action first.');
         return false;
     }
     if ($CFG->pm_editor) {
         $method_name = Form::peLabel($CFG->method_id, 'grid');
     }
     $this->in_grid = true;
     $this->grid_table = $this->table . '_grid_' . $name;
     $inputs_array = Control::getSubMethods($method['id'], $control['params']['class']);
     $HTML .= '<div class="record_grid"><div class="caption">' . $caption . $method_name . '</div><table>';
     if ($inputs_array) {
         $HTML .= '<tr>';
         foreach ($inputs_array as $args) {
             $HTML .= '<th>' . $args['caption'] . '</th>';
         }
         $HTML .= '</tr>';
         $values = DB::getGridValues($this->table . '_grid_' . $name, $subtable_fields, $this->record_id);
         if ($values) {
             foreach ($values as $row) {
                 $num_empty = 0;
                 $c1 = count($inputs_array);
                 if (is_array($inputs_array)) {
                     foreach ($inputs_array as $k => $v) {
                         if (stristr($k, 'checkBox')) {
                             $c1--;
                         }
                     }
                 }
                 foreach ($row as $key => $row1) {
                     if ($key != 'id' && empty($row1)) {
                         $num_empty++;
                     }
                 }
                 if ($num_empty >= $c1) {
                     continue;
                 }
                 $this->grid_values = $row;
                 $HTML .= '<tr>';
                 foreach ($inputs_array as $args) {
                     $HTML .= '<td>' . self::field($args['name'], $args['caption'], $args['subtable'], $args['subtable_fields'], $link_url, $concat_char, true, $args['f_id_field'], false, false, false, $link_is_tab) . '</td>';
                 }
                 $HTML .= '</tr>';
             }
         }
     }
     $HTML .= '</table></div>';
     $this->in_grid = false;
     $this->grid_table = false;
     $this->HTML[] = $HTML;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:72,代码来源:Record.php


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