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


PHP ErrorHandler::add_error方法代码示例

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


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

示例1: check_admin_perms_to_user

 /**
  *  check if admin have permissions to change user's setting
  *
  *  Possible options parameters:
  *	 - none
  *
  *	@param object $admin		admin - instance of class Auth
  *	@param object $user			admin - instance of class SerwebUser
  *	@param array $opt			associative array of options
  *	@return bool				TRUE on permit, FALSE on forbid, -1 on failure
  */
 function check_admin_perms_to_user(&$admin, &$user, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return -1;
     }
     /* table name */
     $t_name =& $config->data_sql->uri->table_name;
     /* col names */
     $c =& $config->data_sql->uri->cols;
     /* flags */
     $f =& $config->data_sql->uri->flag_values;
     if (false === ($adm_domains = $admin->get_administrated_domains())) {
         return -1;
     }
     $uid = $user->get_uid();
     $q = "select count(*) \n\t\t      from " . $t_name . "\n\t\t\t  where " . $c->uid . " = " . $this->sql_format($uid, "s") . " and \n\t\t\t        " . $this->get_sql_in($c->did, $adm_domains, true) . " and \n\t\t\t\t\t" . $c->flags . " & " . $f['DB_DELETED'] . " = 0";
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return -1;
     }
     $row = $res->fetchRow(DB_FETCHMODE_ORDERED);
     $res->free();
     return $row[0] ? true : false;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:39,代码来源:method.check_admin_perms_to_user.php

示例2: delete_user_attrs

 /**
  *	delete all user's records from user_attrs
  */
 function delete_user_attrs($uid)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->user_attrs->table_name;
     /* col names */
     $c =& $config->data_sql->user_attrs->cols;
     /* flags */
     $f =& $config->data_sql->user_attrs->flag_values;
     $q = "delete from " . $t_name . " \n\t\t      where " . $c->uid . "  = '" . $uid . "'";
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         if ($res->getCode() == DB_ERROR_NOSUCHTABLE) {
             return true;
         } else {
             ErrorHandler::log_errors($res);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.delete_user_attrs.php

示例3: get_file_versions

 /**
  *	get all versions of file specific for domain
  *
  *  Possible options parameters:
  *		none
  *
  *	@param string $did		domain id
  *	@param string $file		filename (with path)
  *	@param array $opt		associative array of options
  *	@return array			array of versions of file or FALSE on failure
  */
 function get_file_versions($did, $file, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $td_name =& $config->data_sql->domain_settings->table_name;
     /* col names */
     $cd =& $config->data_sql->domain_settings->cols;
     /* flags */
     $fd =& $config->data_sql->domain_settings->flag_values;
     $q = "select " . $cd->version . ", " . $cd->timestamp . ", " . $cd->flags . " \n\t\t      from " . $td_name . " \n\t\t\t  where " . $cd->did . " = " . $this->sql_format($did, "s") . " and\n\t\t\t        " . $cd->filename . " = " . $this->sql_format($file, "s");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         $out[$row[$cd->version]]['timestamp'] = $row[$cd->timestamp];
         $out[$row[$cd->version]]['deleted'] = (bool) ($row[$cd->flags] & $fd["DB_DELETED"]);
         $out[$row[$cd->version]]['dir'] = (bool) ($row[$cd->flags] & $fd["DB_DIR"]);
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:40,代码来源:method.get_file_versions.php

示例4: get_file_content

 /**
  *	get content of file specific for a domain from db
  *
  *  Possible options parameters:
  *		none
  *
  *	@param string $did		domain id
  *	@param string $file		filename (with path)
  *	@param string $version	version of file
  *	@param array $opt		associative array of options
  *	@return string			content of file or FALSE on failure
  */
 function get_file_content($did, $file, $version, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $td_name =& $config->data_sql->domain_settings->table_name;
     /* col names */
     $cd =& $config->data_sql->domain_settings->cols;
     $q = "select " . $cd->content . " \n\t\t      from " . $td_name . " \n\t\t\t  where " . $cd->did . " = " . $this->sql_format($did, "s") . " and\n\t\t\t        " . $cd->filename . " = " . $this->sql_format($file, "s") . " and\n\t\t\t        " . $cd->version . " = " . $this->sql_format($version, "n");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = null;
     if ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         $out = $this->sql_unescape_binary($row[$cd->content]);
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:37,代码来源:method.get_file_content.php

示例5: check_credentials

 function check_credentials($uname, $did, $realm, $passw, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_ldap($errors)) {
         ErrorHandler::add_error($errors);
         return 0;
     }
     $a =& $config->auth_ldap['attrib'];
     $q = array("(" . $a['user'] . "=" . addslashes($user . '@' . $domain) . ") ", 'base_dn' => $config->auth_ldap['dn'], 'attributes' => array($a['uuid'], $a['pass']), 'action' => 'list');
     $res = $this->ldap->query($q);
     if (DB::isError($res)) {
         //if user is not found
         if ($res->getCode() == DB_ERROR_NOSUCHTABLE) {
             return -1;
         } else {
             ErrorHandler::log_errors($res);
             return 0;
         }
     }
     $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
     $res->free();
     // check password
     if ($row[$a['pass']] != $passw) {
         return -1;
     }
     return $row[$a['uuid']];
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:28,代码来源:method.check_credentials.php

示例6: get_missed_calls_of_yesterday

 function get_missed_calls_of_yesterday($uid, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     if ($this->db_host['parsed']['phptype'] == 'mysql') {
         $q_date = " date_format(request_timestamp, '%Y-%m-%d')=date_format(DATE_SUB(CURDATE(), INTERVAL 1 DAY), '%Y-%m-%d') ";
     } else {
         $q_date = " date_trunc('day', request_timestamp)=date_trunc('day', (CURRENT_DATE - INTERVAL '1 DAY')) ";
     }
     $q = "SELECT from_uri, sip_from, request_timestamp, sip_status  " . "FROM " . $config->data_sql->table_missed_calls . " " . "WHERE to_uid='" . $uid . "' and " . $q_date . "ORDER BY request_timestamp DESC ";
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $out[] = $row;
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:26,代码来源:method.get_missed_calls_of_yesterday.php

示例7: get_attr_type_groups

 /**
  * return list of all attributes without atribute named as $att_edit
  * $att_edit may be null
  */
 function get_attr_type_groups($opt = null)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_at =& $config->data_sql->attr_types->table_name;
     /* col names */
     $c =& $config->data_sql->attr_types->cols;
     $q = "select " . $c->group . "\n\t\t    from " . $t_at . " \n\t\t\tgroup by " . $c->group;
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         $out[] = $row[$c->group];
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.get_attr_type_groups.php

示例8: enable_domain

 /**
  *  Enable or disable domain
  *
  *  Possible options:
  *
  *    did		(int)   	default: null
  *      id of domain which will be en/disabled
  *      this option is REQUIRED
  *      
  *    disable	(bool)  	default: false
  *      if true domain will be disabled, otherwise wil be enabled
  *      
  *	@param array $opt		associative array of options
  *	@return bool			TRUE on success, FALSE on failure
  */
 function enable_domain($opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $td_name =& $config->data_sql->domain->table_name;
     /* col names */
     $cd =& $config->data_sql->domain->cols;
     /* flags */
     $fd =& $config->data_sql->domain->flag_values;
     $o_did = isset($opt['did']) ? $opt['did'] : null;
     $o_disable = isset($opt['disable']) ? $opt['disable'] : false;
     if (is_null($o_did)) {
         ErrorHandler::log_errors(PEAR::raiseError('domain for en/disable is not specified'));
         return false;
     }
     $q = "update " . $td_name . " set ";
     if ($o_disable) {
         $q .= $cd->flags . " = " . $cd->flags . " | " . $fd['DB_DISABLED'];
     } else {
         $q .= $cd->flags . " = " . $cd->flags . " & ~" . $fd['DB_DISABLED'];
     }
     $q .= " where " . $cd->did . " = " . $this->sql_format($o_did, "s");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:49,代码来源:method.enable_domain.php

示例9: delete_uri

 /**
  *	delete alias of user
  *
  *	@param string	$uid		owner of the contact 
  *	@param string	$username	username part from URI
  *	@param string	$did		domain part from URI
  *	@param string	$flags		flags of the URI
  *	@param array	$opt		various options
  *	@return bool				TRUE on success, FALSE on failure
  */
 function delete_uri($uid, $scheme, $username, $did, $flags, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table name */
     $t_name =& $config->data_sql->uri->table_name;
     /* col names */
     $c =& $config->data_sql->uri->cols;
     /* flags */
     $f =& $config->data_sql->uri->flag_values;
     $q = "delete from " . $t_name . "\n\t\t      where " . $c->uid . "      = " . $this->sql_format($uid, "s") . " and \n\t\t            " . $c->scheme . "   = " . $this->sql_format($scheme, "s") . " and \n\t\t            " . $c->username . " = " . $this->sql_format($username, "s") . " and \n\t\t            " . $c->did . "      = " . $this->sql_format($did, "s") . " and \n\t\t            " . $c->flags . "    = " . $this->sql_format($flags, "n");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     if (isModuleLoaded('xxl')) {
         // get domain: $alias_d = domainname of $did
         $alias_uri = "sip:" . $username . "@" . $alias_d;
         if (false === $this->clear_proxy_xxl($alias_uri, null, $errors)) {
             ErrorHandler::add_error($errors);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:40,代码来源:method.delete_uri.php

示例10: get_aliases_by_uri

 /**
  *  Get array of aliases of user with given sip-uri
  *
  *  Possible options:
  *		none
  *
  *	@param	string	$sip_uri	URI of user
  *	@param	array	$opt		array of options
  *	@return	array				FALSE on error
  */
 function get_aliases_by_uri($sip_uri, $opt)
 {
     global $config;
     $errors = array();
     /* create connection to proxy where are stored data of user */
     if (isModuleLoaded('xxl') and $this->name != "get_aliases_tmp") {
         $tmp_data = CData_Layer::singleton("get_aliases_tmp", $errors);
         $tmp_data->set_xxl_user_id($sip_uri);
         $tmp_data->expect_user_id_may_not_exists();
         return $tmp_data->get_aliases_by_uri($sip_uri, $errors);
     }
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $tu_name =& $config->data_sql->uri->table_name;
     /* col names */
     $cu =& $config->data_sql->uri->cols;
     /* flags */
     $fu =& $config->data_sql->uri->flag_values;
     //parse username and domain from sip uri
     $reg =& Creg::singleton();
     $uname = $reg->get_username($sip_uri);
     $realm = $reg->get_domainname($sip_uri);
     if (!$uname or !$realm) {
         return array();
     }
     if ($config->multidomain) {
         if (false === ($did = $this->get_did_by_realm($realm, null))) {
             return false;
         }
         if (is_null($did)) {
             return array();
         }
     } else {
         $did = $config->default_did;
     }
     $flags_val = $fu['DB_DISABLED'] | $fu['DB_DELETED'];
     $q = "select " . $cu->uid . " as uid\n\t\t    from " . $tu_name . "\n\t\t\twhere  " . $cu->did . "      = " . $this->sql_format($did, "s") . " and \n\t\t\t       " . $cu->username . " = " . $this->sql_format($uname, "s") . " and \n\t\t\t\t  (" . $cu->flags . " & " . $flags_val . ") = 0";
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
     if (!$row) {
         unset($res);
         return array();
     }
     $uid = $row['uid'];
     if (is_null($uid)) {
         return array();
     }
     $uri_handler =& URIs::singleton($uid);
     if (false === ($out = $uri_handler->get_URIs())) {
         return false;
     }
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:70,代码来源:method.get_aliases_by_uri.php

示例11: del_credentials

 /**
  *  Delete credentials from DB
  *
  *	On error this method returning FALSE.
  *
  *  Possible options:
  *	 - none
  *	
  *
  *	@return bool
  */
 function del_credentials($uid, $did, $uname, $realm, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table name */
     $t_name =& $config->data_sql->credentials->table_name;
     /* col names */
     $c =& $config->data_sql->credentials->cols;
     /* flags */
     $f =& $config->data_sql->credentials->flag_values;
     $q = "delete from " . $t_name . "\n\t\t      where " . $c->uid . "   = " . $this->sql_format($uid, "s") . " and\n\t\t            " . $c->uname . " = " . $this->sql_format($uname, "s") . " and\n\t\t            " . $c->realm . " = " . $this->sql_format($realm, "s");
     if ($config->auth['use_did']) {
         $q .= " and " . $c->did . " = " . $this->sql_format($did, "s");
     }
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:36,代码来源:method.del_credentials.php

示例12: delete_acc

 /**
  *  Purge old acc records
  *
  *  Possible options parameters:
  *		none
  *
  *	@param array $opt		associative array of options
  *	@return bool			TRUE on success, FALSE on failure
  */
 function delete_acc($opt)
 {
     global $config;
     if (!$config->keep_acc_interval) {
         return true;
     }
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return 0;
     }
     /* table's name */
     $t_name =& $config->data_sql->acc->table_name;
     /* col names */
     $c =& $config->data_sql->acc->cols;
     /* flags */
     $f =& $config->data_sql->acc->flag_values;
     if ($this->db_host['parsed']['phptype'] == 'mysql') {
         $q = "delete from " . $t_name . " \n\t\t\t\twhere DATE_ADD(" . $c->request_timestamp . ", INTERVAL " . $config->keep_acc_interval . " DAY) < now()";
     } else {
         $q = "delete from " . $t_name . " \n\t\t\t\twhere (" . $c->request_timestamp . " + INTERVAL '" . $config->keep_acc_interval . " DAY') < now()";
     }
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         //expect that table mayn't exist in installed version
         if ($res->getCode() != DB_ERROR_NOSUCHTABLE) {
             ErrorHandler::log_errors($res);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:41,代码来源:method.delete_acc.php

示例13: get_credentials

 /**
  *  return array of credentials of user
  *
  *  Possible options:
  *	 - none
  *    	
  *	@param	string	$uid	uid of user
  *	@param	array	$opt	array of options
  *	@return array			array of credentials
  */
 function get_credentials($uid, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->credentials->table_name;
     /* col names */
     $c =& $config->data_sql->credentials->cols;
     /* flags */
     $f =& $config->data_sql->credentials->flag_values;
     $q = "select " . $c->did . ", \n\t\t           " . $c->uname . ",\n\t\t           " . $c->realm . ",\n\t\t           " . $c->password . ",\n\t\t           " . $c->ha1 . ",\n\t\t           " . $c->ha1b . ",\n\t\t           " . $c->flags . "\n\t\t    from " . $t_name . " \n\t\t\twhere " . $c->uid . " = " . $this->sql_format($uid, "s") . " and\n\t\t\t      " . $c->flags . " & " . $f['DB_DELETED'] . " = 0\n\t\t\torder by " . $c->realm . ", " . $c->uname;
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     for ($i = 0; $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $i++) {
         $out[$i] = new Credential($uid, $row[$c->did], $row[$c->uname], $row[$c->realm], $row[$c->password], $row[$c->ha1], $row[$c->ha1b], $row[$c->flags]);
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:37,代码来源:method.get_credentials.php

示例14: get_domains_of_admin

 /**
  *  return array of domain ids which can administer given user
  *
  *
  *  Possible options:
  *	 - none
  *      
  *	@param string $uid		
  *	@param array $opt		associative array of options
  *	@return array			array of domain ids or FALSE on error
  */
 function get_domains_of_admin($uid, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $t_name =& $config->data_sql->domain_attrs->table_name;
     /* col names */
     $c =& $config->data_sql->domain_attrs->cols;
     /* flags */
     $f =& $config->data_sql->domain_attrs->flag_values;
     $an =& $config->attr_names;
     $q = "select " . $c->did . " \n\t\t    from " . $t_name . "\n\t\t\twhere  " . $c->name . "  = '" . $an['admin'] . "' and \n\t\t\t       " . $c->value . " = " . $this->sql_format($uid, "s") . " and \n\t\t\t      (" . $c->flags . " & " . $f['DB_DELETED'] . ") = 0 and\n\t\t\t\t  (" . $c->flags . " & " . $f['DB_FOR_SERWEB'] . ") = " . $f['DB_FOR_SERWEB'];
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $out = array();
     for ($i = 0; $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $i++) {
         $out[$i] = $row[$c->did];
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:39,代码来源:method.get_domains_of_admin.php

示例15: get_domain_flags

 /**
  *  return flags of domain with given domain ID as associative array
  *
  *  Keys of associative arrays:
  *   - disabled
  *   - deleted
  *
  *  Possible options:
  *	 - none
  *
  *	@param string $did		domain ID
  *	@param array $opt		associative array of options
  *	@return array			domain flags or FALSE on error
  */
 function get_domain_flags($did, $opt)
 {
     global $config;
     $errors = array();
     if (!$this->connect_to_db($errors)) {
         ErrorHandler::add_error($errors);
         return false;
     }
     /* table's name */
     $td_name =& $config->data_sql->domain->table_name;
     /* col names */
     $cd =& $config->data_sql->domain->cols;
     /* flags */
     $fd =& $config->data_sql->domain->flag_values;
     $q = "select " . $cd->flags . "\n\t\t    from " . $td_name . "\n\t\t\twhere " . $cd->did . "=" . $this->sql_format($did, "s");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         ErrorHandler::log_errors($res);
         return false;
     }
     $disabled = true;
     $deleted = true;
     while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         $disabled = ($disabled and $row[$cd->flags] & $fd['DB_DISABLED']);
         $deleted = ($deleted and $row[$cd->flags] & $fd['DB_DELETED']);
     }
     $res->free();
     return array('disabled' => $disabled, 'deleted' => $deleted);
 }
开发者ID:BackupTheBerlios,项目名称:serweb-frmwrk,代码行数:43,代码来源:method.get_domain_flags.php


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