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


PHP log_errors函数代码示例

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


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

示例1: send_im

 function send_im($user, $recipient, $message, $opt, &$errors)
 {
     global $config, $lang_set;
     $sip_msg = "MESSAGE\n" . addslashes($recipient) . "\n" . ".\n" . "From: " . $user->get_uri() . "\n" . "To: <" . addslashes($recipient) . ">\n" . "p-version: " . $config->psignature . "\n" . "Contact: <" . $config->web_contact . ">\n" . "Content-Type: text/plain; charset=" . $lang_set['charset'] . "\n.\n" . str_Replace("\n.\n", "\n. \n", $message) . "\n.\n\n";
     if ($config->use_rpc) {
         if (!$this->connect_to_xml_rpc(null, $errors)) {
             return false;
         }
         $params = array(new XML_RPC_Value($sip_msg, 'string'));
         $msg = new XML_RPC_Message('t_uac_dlg', $params);
         $res = $this->rpc->send($msg);
         if ($this->rpc_is_error($res)) {
             log_errors($res, $errors);
             return false;
         }
     } else {
         /* construct FIFO command */
         $fifo_cmd = ":t_uac_dlg:" . $config->reply_fifo_filename . "\n" . $sip_msg;
         if (false === write2fifo($fifo_cmd, $errors, $status)) {
             return false;
         }
         /* we accept any status code beginning with 2 as ok */
         if (substr($status, 0, 1) != "2") {
             $errors[] = $status;
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.send_im.php

示例2: set_db_charset

 /**
  *	set charset for comunication with DB
  */
 function set_db_charset($charset, $opt, &$errors)
 {
     global $config;
     $this->db_charset = $charset;
     /* if connection to db is estabilished run sql query setting the charset */
     if ($this->db) {
         if ($this->db_host['parsed']['phptype'] == 'mysql') {
             $charset_mapping = array('utf-8' => 'utf8', 'iso-8859-1' => 'latin1', 'iso-8859-2' => 'latin2', 'windows-1250' => 'cp1250', 'iso-8859-7' => 'greek', 'iso-8859-8' => 'hebrew', 'iso-8859-9' => 'latin5', 'iso-8859-13' => 'latin7', 'windows-1251' => 'cp1251');
         } else {
             $charset_mapping = array('utf-8' => 'utf8', 'iso-8859-1' => 'latin1', 'iso-8859-2' => 'latin2', 'iso-8859-3' => 'latin3', 'iso-8859-4' => 'latin4', 'iso-8859-5' => 'ISO_8859_5', 'iso-8859-6' => 'ISO_8859_6', 'iso-8859-7' => 'ISO_8859_7', 'iso-8859-8' => 'ISO_8859_8', 'iso-8859-9' => 'latin5', 'iso-8859-10' => 'latin6', 'iso-8859-13' => 'latin7', 'iso-8859-14' => 'latin8', 'iso-8859-15' => 'latin9', 'iso-8859-16' => 'latin10', 'windows-1250' => 'win1250', 'windows-1251' => 'win1251');
         }
         if (strtolower($charset) == 'default') {
             $q = "set NAMES DEFAULT";
         } else {
             $ch = isset($charset_mapping[$this->db_charset]) ? $charset_mapping[$this->db_charset] : $this->db_charset;
             $q = "set NAMES '" . $ch . "'";
         }
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             log_errors($res, $errors);
             return false;
         }
     }
     /* otherwise do nothing, charset will be set after connect to DB */
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.set_db_charset.php

示例3: get_VM

 function get_VM($user, $mid, &$errors)
 {
     global $config, $lang_str;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     $q = "select subject, file from " . $config->data_sql->table_voice_silo . " where mid=" . $mid . " and " . $this->get_indexing_sql_where_phrase_uri($user);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     if (!$res->numRows()) {
         $errors[] = $lang_str['err_voice_msg_not_found'];
         return false;
     }
     $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
     $res->free();
     @($fp = fopen($config->voice_silo_dir . $row->file, 'r'));
     if (!$fp) {
         $errors[] = $lang_str['err_can_not_open_message'];
         return false;
     }
     Header("Content-Disposition: attachment;filename=" . RawURLEncode(($row->subject ? $row->subject : "received message") . ".wav"));
     Header("Content-type: audio/wav");
     @fpassthru($fp);
     @fclose($fp);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.get_vm.php

示例4: set_password_to_user

 /**
  *	set password for user
  */
 function set_password_to_user($user, $passwd, &$errors)
 {
     global $config;
     if (!$this->connect_to_db($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;
     $ha1 = md5($user->get_username() . ":" . $user->get_realm() . ":" . $passwd);
     $ha1b = md5($user->get_username() . "@" . $user->get_realm() . ":" . $user->get_realm() . ":" . $passwd);
     if (!$config->clear_text_pw) {
         $passwd = "";
     }
     $q = "update " . $t_name . " \n\t\t    set " . $c->password . " = " . $this->sql_format($passwd, "s") . ", \n\t\t\t    " . $c->ha1 . "      = " . $this->sql_format($ha1, "s") . ", \n\t\t\t\t" . $c->ha1b . "     = " . $this->sql_format($ha1b, "s") . "\n\t\t\twhere " . $c->uid . "   = " . $this->sql_format($user->get_uid(), "s") . " and\n\t\t\t      " . $c->uname . " = " . $this->sql_format($user->get_username(), "s") . " and\n\t\t\t\t  " . $c->realm . " = " . $this->sql_format($user->get_realm(), "s");
     if ($config->auth['use_did']) {
         $q .= " and " . $c->did . " = " . $this->sql_format($user->get_did(), "s");
     }
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:31,代码来源:method.set_password_to_user.php

示例5: get_new_domain_id

 /**
  *  return new id for a domain
  *
  *  Possible options:
  *	 none
  *      
  *	@param array $opt		associative array of options
  *	@param array $errors	error messages
  *	@return int				new id or FALSE on error
  */
 function get_new_domain_id($opt, &$errors)
 {
     global $config;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     /* table's name */
     $td_name =& $config->data_sql->domain->table_name;
     $ta_name =& $config->data_sql->domain_attrs->table_name;
     /* col names */
     $cd =& $config->data_sql->domain->cols;
     $ca =& $config->data_sql->domain_attrs->cols;
     /* flags */
     $fd =& $config->data_sql->domain->flag_values;
     $fa =& $config->data_sql->domain_attrs->flag_values;
     $q = "select max(" . $this->get_sql_cast_to_int_funct($cd->did) . ")\n\t\t    from " . $td_name . "\n\t\t\twhere " . $this->get_sql_regex_match("^[0-9]+\$", $cd->did, null);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     $row1 = $res->fetchRow(DB_FETCHMODE_ORDERED);
     $res->free();
     $q = "select max(" . $this->get_sql_cast_to_int_funct($ca->did) . ")\n\t\t    from " . $ta_name . "\n\t\t\twhere " . $this->get_sql_regex_match("^[0-9]+\$", $ca->did, null);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     $row2 = $res->fetchRow(DB_FETCHMODE_ORDERED);
     $res->free();
     return max($row1[0], $row2[0]) + 1;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:43,代码来源:method.get_new_domain_id.php

示例6: del_VM

 function del_VM($user, $mid, &$errors)
 {
     global $config;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     $q = "select file from " . $config->data_sql->table_voice_silo . " where mid=" . $mid . " and " . $this->get_indexing_sql_where_phrase_uri($user);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     if (!$res->numRows()) {
         $errors[] = "Message not found or you haven't access to message";
         return false;
     }
     $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
     $res->free();
     @($unl = unlink($config->voice_silo_dir . $row->file));
     if (!$unl and file_exists($config->voice_silo_dir . $row->file)) {
         $errors[] = "Error when deleting message";
         return false;
     }
     $q = "delete from " . $config->data_sql->table_voice_silo . " where mid=" . $mid . " and " . $this->get_indexing_sql_where_phrase_uri($user);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:31,代码来源:method.del_vm.php

示例7: get_VMs

 function get_VMs($user, &$errors)
 {
     global $config, $sess;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     $q = "select mid, src_addr, inc_time, subject, file from " . $config->data_sql->table_voice_silo . " where " . $this->get_indexing_sql_where_phrase_uri($user);
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     $out = array();
     for ($i = 0; $row = $res->fetchRow(DB_FETCHMODE_OBJECT); $i++) {
         if (date('Y-m-d', $row->inc_time) == date('Y-m-d')) {
             $time = "today " . date('H:i', $row->inc_time);
         } else {
             $time = date('Y-m-d H:i', $row->inc_time);
         }
         $out[$i]['subject'] = $row->subject;
         $out[$i]['src_addr'] = htmlspecialchars($row->src_addr);
         $out[$i]['time'] = $time;
         $out[$i]['url_reply'] = $sess->url("send_im.php?kvrk=" . uniqid("") . "&sip_addr=" . rawURLEncode($row->src_addr));
         $out[$i]['url_get'] = $sess->url("ms_get_v_msg.php?kvrk=" . uniqid("") . "&mid=" . rawURLEncode($row->mid));
         $out[$i]['url_dele'] = $sess->url("message_store.php?kvrk=" . uniqid("") . "&dele_vm=" . rawURLEncode($row->mid));
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.get_vms.php

示例8: 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

示例9: del_contact

 /**
  *	delete contact from USRLOC
  *
  *	@param string $uid		UID of the owner of the contact
  *	@param string $contact	contact which should be removed
  *	@param array $errors	
  *	@return bool			TRUE on success, FALSE on failure
  */
 function del_contact($uid, $contact, &$errors)
 {
     global $config;
     if ($config->use_rpc) {
         if (!$this->connect_to_xml_rpc(null, $errors)) {
             return false;
         }
         $params = array(new XML_RPC_Value($config->ul_table, 'string'), new XML_RPC_Value($uid, 'string'), new XML_RPC_Value($contact, 'string'));
         $msg = new XML_RPC_Message('usrloc.delete_contact', $params);
         $res = $this->rpc->send($msg);
         if ($this->rpc_is_error($res)) {
             log_errors($res, $errors);
             return false;
         }
         return true;
     } else {
         /* construct FIFO command */
         $fifo_cmd = ":usrloc.delete_contact:" . $config->reply_fifo_filename . "\n" . $config->ul_table . "\n" . $uid . "\n" . $contact . "\n\n";
         //contact
         $message = write2fifo($fifo_cmd, $errors, $status);
         if ($errors) {
             return false;
         }
         /* we accept any 2xx as ok */
         if (substr($status, 0, 1) != "2") {
             $errors[] = $status;
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:39,代码来源:method.del_contact.php

示例10: get_customers

 /**
  *  return array (indexed by customer ID) of customers
  *
  *  Keys of associative arrays:
  *    id	-	id of customer
  *    name	-	name of customer
  *    address  
  *    email
  *    phone
  *
  *  Possible options:
  *
  *    exclude	(string)	default: null
  *      exclude customer with this id from result
  *      
  *    single    (string)    default: null  
  *      return only customer with this id
  *      
  *	@param array $opt		associative array of options
  *	@param array $errors	error messages
  *	@return array			array of customers or FALSE on error
  */
 function get_customers($opt, &$errors)
 {
     global $config, $sess;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     /* table's name */
     $tc_name =& $config->data_sql->customers->table_name;
     /* col names */
     $cc =& $config->data_sql->customers->cols;
     $o_exclude = isset($opt['exclude']) ? $opt['exclude'] : null;
     $o_single = isset($opt['single']) ? $opt['single'] : null;
     $o_order_by = (isset($opt['order_by']) and isset($cc->{$opt}['order_by'])) ? $cc->{$opt}['order_by'] : "";
     $o_order_desc = !empty($opt['order_desc']) ? "desc" : "";
     if (!is_null($o_single)) {
         $qw = " where " . $cc->cid . "  = " . $this->sql_format($o_single, "n") . " ";
     } elseif (!is_null($o_exclude)) {
         $qw = " where " . $cc->cid . " != " . $this->sql_format($o_exclude, "n") . " ";
     } else {
         $qw = "";
     }
     if (is_null($o_single)) {
         /* get num rows */
         $q = "select count(*) from " . $tc_name . $qw;
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             log_errors($res, $errors);
             return false;
         }
         $row = $res->fetchRow(DB_FETCHMODE_ORDERED);
         $this->set_num_rows($row[0]);
         $res->free();
     } else {
         $this->set_num_rows(1);
     }
     /* if act_row is bigger then num_rows, correct it */
     $this->correct_act_row();
     $q = "select " . $cc->cid . ", " . $cc->name . ", " . $cc->phone . ", " . $cc->address . ", " . $cc->email . " \n\t\t    from " . $tc_name . $qw;
     if ($o_order_by) {
         $q .= " order by " . $o_order_by . " " . $o_order_desc;
     }
     $q .= $this->get_sql_limit_phrase();
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     $out = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
         $out[$row[$cc->cid]]['cid'] = $row[$cc->cid];
         $out[$row[$cc->cid]]['name'] = $row[$cc->name];
         $out[$row[$cc->cid]]['phone'] = $row[$cc->phone];
         $out[$row[$cc->cid]]['address'] = $row[$cc->address];
         $out[$row[$cc->cid]]['email'] = $row[$cc->email];
         $out[$row[$cc->cid]]['primary_key'] = array('cid' => &$out[$row[$cc->cid]]['cid']);
     }
     $res->free();
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:81,代码来源:method.get_customers.php

示例11: update_customer

 /**
  *  update customer table by $values
  *
  *  Keys of associative array $values:
  *    name
  *    address
  *    email
  *    phone
  *
  *  Possible options:
  *
  *    primary_key	(array) required
  *      contain primary key of record which should be updated
  *      The array contain the same keys as functon get_customers returned in entry 'primary_key'
  *
  *    insert  	(bool) default:true
  *      if true, function insert new record, otherwise update old record
  *
  *	  new_id	(bool)
  *		In this option is returned ID of new created customer. 
  *		Option is created only if 'insert'=true
  *
  *	@param array $values	values
  *	@param array $opt		associative array of options
  *	@param array $errors	error messages
  *	@return bool			TRUE on success, FALSE on failure
  */
 function update_customer($values, &$opt, &$errors)
 {
     global $config;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     /* table's name */
     $tc_name =& $config->data_sql->customers->table_name;
     /* col names */
     $cc =& $config->data_sql->customers->cols;
     $opt_insert = isset($opt['insert']) ? (bool) $opt['insert'] : false;
     if (!$opt_insert and (!isset($opt['primary_key']) or !is_array($opt['primary_key']) or empty($opt['primary_key']))) {
         log_errors(PEAR::raiseError('primary key is missing'), $errors);
         return false;
     }
     if ($opt_insert) {
         $sem = new Shm_Semaphore(__FILE__, "s", 1, 0600);
         /* set semaphore to be sure there will not be generated same id for two customers */
         if (!$sem->acquire()) {
             return false;
         }
         $q = "select max(" . $cc->cid . ") from " . $tc_name;
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             ErrorHandler::log_errors($res);
             $sem->release();
             return false;
         }
         $next_id = 1;
         if ($row = $res->fetchRow(DB_FETCHMODE_ORDERED)) {
             if (!is_null($row[0])) {
                 $next_id = $row[0] + 1;
             }
         }
         $q = "insert into " . $tc_name . " (\n\t\t\t\t\t   " . $cc->cid . ", " . $cc->name . ", " . $cc->address . ", " . $cc->email . ", " . $cc->phone . "\n\t\t\t    ) \n\t\t\t\tvalues (\n\t\t\t\t\t   " . $this->sql_format($next_id, "n") . ", \n\t\t\t\t\t   " . $this->sql_format($values['name'], "s") . ", \n\t\t\t\t\t   " . $this->sql_format($values['address'], "s") . ", \n\t\t\t\t\t   " . $this->sql_format($values['email'], "s") . ", \n\t\t\t\t\t   " . $this->sql_format($values['phone'], "s") . "\n\t\t\t\t )";
         $opt['new_id'] = $next_id;
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             log_errors($res, $errors);
             $sem->release();
             return false;
         }
         $sem->release();
     } else {
         $q = "update " . $tc_name . " \n\t\t\t    set " . $cc->name . "   =" . $this->sql_format($values['name'], "s") . ",  \n\t\t\t        " . $cc->address . "=" . $this->sql_format($values['address'], "s") . ", \n\t\t\t        " . $cc->email . "  =" . $this->sql_format($values['email'], "s") . ", \n\t\t\t        " . $cc->phone . "  =" . $this->sql_format($values['phone'], "s") . "\n\t\t\t\twhere " . $cc->cid . "  =" . $this->sql_format($opt['primary_key']['cid'], "n");
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             log_errors($res, $errors);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:80,代码来源:method.update_customer.php

示例12: logDebugMessages

function logDebugMessages($message, $show = false)
{
    log_errors($message);
    if (!$show) {
        ob_start();
    }
    print '<br>Information log: <hr><pre>';
    debug_print_backtrace();
    print '</pre>';
    if (!$show) {
        log_errors(ob_get_clean());
    }
}
开发者ID:ktincheva,项目名称:simpleAPI,代码行数:13,代码来源:helper.functions.php

示例13: del_phonebook_entry

 function del_phonebook_entry($user, $pbid, &$errors)
 {
     global $config;
     if (!$this->connect_to_db($errors)) {
         return false;
     }
     $q = "delete from " . $config->data_sql->table_phonebook . " \n\t\t    where " . $this->get_indexing_sql_where_phrase($user) . " and \n\t\t\t      id=" . $this->sql_format($pbid, "n");
     $res = $this->db->query($q);
     if (DB::isError($res)) {
         log_errors($res, $errors);
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:14,代码来源:method.del_phonebook_entry.php

示例14: store_greeting

 function store_greeting($user, $greeting_file, &$errors)
 {
     global $config;
     if ($config->users_indexed_by == 'uuid') {
         if (!copy($greeting_file, $config->greetings_spool_dir . $user->get_uid() . ".wav")) {
             log_errors(PEAR::raiseError("store greeting failed"), $errors);
             return false;
         }
     } else {
         if (!copy($greeting_file, $config->greetings_spool_dir . $user->get_domainname() . "/" . $user->get_username() . ".wav")) {
             log_errors(PEAR::raiseError("store greeting failed"), $errors);
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:16,代码来源:method.store_greeting.php

示例15: set_db_collation

 /**
  * set collation - for MySQL >= 4.1
  */
 function set_db_collation($collation, $opt, &$errors)
 {
     global $config;
     $this->db_collation = $collation;
     /* if connection to db is estabilished run sql query setting the collation */
     if ($this->db) {
         $q = "set collation_connection='" . $this->db_collation . "'";
         $res = $this->db->query($q);
         if (DB::isError($res)) {
             log_errors($res, $errors);
             return false;
         }
     }
     /* otherwise do nothing, collation will be set after connect to DB */
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:19,代码来源:method.set_db_collation.php


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