本文整理汇总了PHP中ErrorHandler::log_errors方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::log_errors方法的具体用法?PHP ErrorHandler::log_errors怎么用?PHP ErrorHandler::log_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::log_errors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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']];
}
示例5: delete_user_missed_calls
/**
* delete all missed calls of user
* if $timestamp is not null delete only calls older than $timestamp
*/
function delete_user_missed_calls($uid, $timestamp)
{
global $config;
$errors = array();
if (!$this->connect_to_db($errors)) {
ErrorHandler::add_error($errors);
return false;
}
/* table's name */
$t_mc =& $config->data_sql->missed_calls->table_name;
/* flags */
$f_mc =& $config->data_sql->missed_calls->flag_values;
$q = "delete from " . $t_mc . " \n\t\t\twhere to_uid='" . $uid . "'";
if (!is_null($timestamp)) {
$q .= " and request_timestamp < '" . gmdate("Y-m-d H:i:s", $timestamp) . "'";
}
$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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: get_new_user_id
/**
* return new id for a user
*
* Possible options:
* - none
*
* @param array $opt associative array of options
* @return int new id or FALSE on error
*/
function get_new_user_id($opt)
{
global $config;
$errors = array();
if (!$this->connect_to_db($errors)) {
ErrorHandler::add_error($errors);
return false;
}
/* table's name */
$tc_name =& $config->data_sql->credentials->table_name;
$ta_name =& $config->data_sql->user_attrs->table_name;
/* col names */
$cc =& $config->data_sql->credentials->cols;
$ca =& $config->data_sql->user_attrs->cols;
/* flags */
$fc =& $config->data_sql->credentials->flag_values;
$fa =& $config->data_sql->user_attrs->flag_values;
$q = "select max(" . $this->get_sql_cast_to_int_funct($cc->uid) . ")\n\t\t from " . $tc_name . "\n\t\t\twhere " . $this->get_sql_regex_match("^[0-9]+\$", $cc->uid, null);
$res = $this->db->query($q);
if (DB::isError($res)) {
ErrorHandler::log_errors($res);
return false;
}
$row1 = $res->fetchRow(DB_FETCHMODE_ORDERED);
$res->free();
$q = "select max(" . $this->get_sql_cast_to_int_funct($ca->uid) . ")\n\t\t from " . $ta_name . "\n\t\t\twhere " . $this->get_sql_regex_match("^[0-9]+\$", $ca->uid, null);
$res = $this->db->query($q);
if (DB::isError($res)) {
ErrorHandler::log_errors($res);
return false;
}
$row2 = $res->fetchRow(DB_FETCHMODE_ORDERED);
$res->free();
return max($row1[0], $row2[0]) + 1;
}
示例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);
}