function &recreate_from_get_param($val) { $val .= ":"; //add stop mark to input string $parts = array(); for ($i = 0, $j = 0; $i < strlen($val); $i++) { if ($val[$i] != ":") { continue; } //skip quoted ":" if (isset($val[$i + 1]) and $val[$i + 1] == "'" and isset($val[$i - 1]) and $val[$i - 1] == "'") { $i++; continue; } // at $i position is single ":" $parts[] = substr($val, $j, $i - $j); $j = $i + 1; } foreach ($parts as $k => $v) { $parts[$k] = str_replace("':'", ":", $v); } if ($parts[0] == "") { $parts[0] = null; } //if UID is empty, set it to null if ($parts[1] == "") { $parts[1] = null; } //if DID is empty, set it to null $obj =& SerwebUser::instance($parts[0], $parts[2], $parts[1], $parts[3]); return $obj; }
function action_register(&$errors) { global $config, $data, $lang_str; $an =& $config->attr_names; /* generate confirmation string */ $confirm = md5(uniqid(rand())); /* obtain password */ if ($this->opt['choose_passw']) { $password = $_POST['passwd']; } else { /* generate new password */ $password = substr(md5(uniqid('')), 0, 5); } if (!$this->opt['create_new_domain']) { /* get domain name */ $domains =& Domains::singleton(); if (false === ($domain_name = $domains->get_domain_name($this->did))) { $data->transaction_rollback(); return false; } } else { $domain_name = $this->opt['create_new_domain']; } /* set value of option 'require_confirmation' */ if (is_null($this->opt['require_confirmation'])) { $o = array(); /* if creating new domain we does not know the DID */ if (!$this->opt['create_new_domain']) { $o['did'] = $this->did; } if (false === ($this->opt['require_confirmation'] = Attributes::get_attribute($an['require_conf'], $o))) { return false; } } if (false === $data->transaction_start()) { return false; } if ($this->opt['create_new_domain']) { $sem = new Shm_Semaphore(__FILE__, "s", 1, 0600); /* set semaphore to be sure there will not be generated same domain id for two domains */ if (!$sem->acquire()) { $data->transaction_rollback(); return false; } if (false === ($this->did = Domains::generate_new_did($this->opt['create_new_domain']))) { $data->transaction_rollback(); $sem->release(); return false; } $opt = array("enabled" => !$this->opt['require_confirmation']); if (false === DomainManipulator::add_alias($this->did, $this->opt['create_new_domain'], $opt)) { $data->transaction_rollback(); $sem->release(); return false; } $a_vals = array("alias" => $this->opt['create_new_domain']); if (false === DomainManipulator::update_domain_attrs($this->did, $a_vals)) { $data->transaction_rollback(); $sem->release(); return false; } $sem->release(); } /* prepare array of attributes */ $opt = array(); $attrs = Attributes::post_attrs_to_array($this->attributes, $opt); /* add subscriber */ $opts = array("disabled" => $this->opt['require_confirmation']); if (false === Registration::add_subscriber($_POST['uname'], $this->did, $password, $attrs, $opts)) { $data->transaction_rollback(); return false; } $uid = $opts['uid']; $realm = $opts['realm']; $serweb_user =& SerwebUser::instance($uid, $_POST['uname'], $this->did, $realm); $user_param = $serweb_user->to_get_param(); /* get handler of user attrs */ $ua =& User_Attrs::singleton($uid); /* get handler of domain attrs */ $da =& Domain_Attrs::singleton($this->did); if (!is_null($this->opt['set_lang_attr'])) { $u_lang = $this->opt['set_lang_attr']; /* get the attr_type of the lang attribute */ $at_handler =& Attr_types::singleton(); if (false === ($lang_type = $at_handler->get_attr_type($an['lang']))) { $data->transaction_rollback(); return false; } if (is_null($lang_type)) { ErrorHandler::add_error("Type of attribute 'lang' doesn't exists"); $data->transaction_rollback(); return false; } /* format the value */ $lang_type->check_value($u_lang); /* store lang into DB */ if (false === $ua->set_attribute($an['lang'], $u_lang)) { $data->transaction_rollback(); return false; } } if ($this->opt['create_new_domain']) { /* when creating new domain, set admin privilege for the user */ if (false === $ua->set_attribute($an['is_admin'], "1")) { $data->transaction_rollback(); return false; } /* and assign user as admin of the domain */ if (false === $da->set_attribute($an['admin'], array($uid))) { $data->transaction_rollback(); return false; } } if ($this->opt['require_confirmation']) { if (false === $ua->set_attribute($an['confirmation'], $confirm)) { $data->transaction_rollback(); return false; } if (false === $ua->set_attribute($an['pending_ts'], time())) { $data->transaction_rollback(); return false; } if ($this->opt['create_new_domain']) { if (false === $da->set_attribute($an['confirmation'], $confirm)) { $data->transaction_rollback(); return false; } if (false === $da->set_attribute($an['pending_ts'], time())) { $data->transaction_rollback(); return false; } } } if ($this->opt['create_numeric_alias']) { $sem = new Shm_Semaphore(__FILE__, "s", 1, 0600); /* set semaphore to be sure there will not be same aliases for two users */ if (!$sem->acquire()) { $data->transaction_rollback(); return false; } // generate alias number if (false === ($alias = $data->get_new_alias_number($this->did, null))) { $data->transaction_rollback(); $sem->release(); return false; } /* store alias to URI table */ $o = array('disabled' => $this->opt['require_confirmation'], 'canon' => false); if (false === $data->add_uri($uid, 'sip', $alias, $this->did, $o)) { $data->transaction_rollback(); $sem->release(); return false; } /* reset the semaphore */ if (!$sem->release()) { $data->transaction_rollback(); return false; } } $sip_address = "sip:" . $_POST['uname'] . "@" . $domain_name; $login_url = $config->root_uri . ($this->opt['admin_login'] ? $config->admin_pages_path : $config->user_pages_path) . $this->opt['login_script']; $admin_url = $config->root_uri . $config->admin_pages_path . $this->opt['login_script']; $username = $config->fully_qualified_name_on_login ? $_POST['uname'] . "@" . $domain_name : $_POST['uname']; $confirmation_url = $config->root_uri . $config->user_pages_path . $this->opt['confirmation_script'] . "?nr=" . $confirm . (isModuleLoaded('xxl') ? "&pr=" . RawURLEncode(base64_encode($proxy['proxy'])) : ""); if (is_null($this->opt['mail_file_conf'])) { $this->opt['mail_file_conf'] = $this->opt['mail_file']; } if ($this->opt['create_new_domain']) { if ($this->opt['require_confirmation']) { $mail_file = $this->opt['mail_file_domain_conf']; } else { $mail_file = $this->opt['mail_file_domain']; } } else { if ($this->opt['require_confirmation']) { $mail_file = $this->opt['mail_file_conf']; } else { $mail_file = $this->opt['mail_file']; } } $mail = read_lang_txt_file($mail_file, "txt", $_SESSION['lang'], array(array("domain", $domain_name), array("sip_address", $sip_address), array("login_url", $login_url), array("admin_url", $admin_url), array("confirmation_url", $confirmation_url), array("username", $username), array("password", $password), array("email", isset($_POST[$an['email']]) ? $_POST[$an['email']] : ""), array("first_name", isset($_POST[$an['fname']]) ? $_POST[$an['fname']] : ""), array("last_name", isset($_POST[$an['lname']]) ? $_POST[$an['lname']] : ""))); if ($mail === false) { /* needn't write message to log. It's written by function read_lang_txt_file */ $errors[] = $lang_str['err_sending_mail']; $data->transaction_rollback(); return false; } $o = array('did' => $this->did); if (false === ($from_header = Attributes::get_attribute($an['contact_email'], $o))) { return false; } if ($from_header) { $mail['headers']['from'] = $from_header; } if (!send_mail($_POST[$an['email']], $mail['body'], $mail['headers'])) { $errors[] = $lang_str['err_sending_mail']; $this->controler->_form_load_defaults(); $data->transaction_rollback(); return false; } if (false === $data->transaction_commit()) { return false; } if ($this->opt['redirect_on_register']) { $this->controler->change_url_for_reload($this->opt['redirect_on_register']); } return array("m_user_registered=" . RawURLEncode($this->opt['instance_id']), "reg_sip_adr=" . RawURLEncode($sip_address), "require_conf=" . RawURLEncode($this->opt['require_confirmation']), $user_param); //$user_param sets the user_id holding ny controller }
function action_send_pass(&$errors) { global $data, $config, $lang_str; if (isset($_GET['pr'])) { $proxy = base64_decode($_GET['pr']); if ($proxy and isModuleLoaded('xxl')) { if (false === $data->set_home_proxy($proxy)) { return false; } } } if (isModuleLoaded('xxl') and !$proxy) { $errors[] = $lang_str['err_reg_conf_not_exists_conf_num']; return false; } if (empty($_GET['u'])) { $errors[] = $lang_str['err_reg_conf_not_exists_conf_num']; return false; } $an =& $config->attr_names; /* get uid */ $o = array('name' => $an['confirmation'], 'value' => $this->nr); if (false === ($attrs = $data->get_attr_by_val("user", $o))) { return false; } if (empty($attrs[0]['id'])) { ErrorHandler::add_error($lang_str['err_reg_conf_not_exists_conf_num']); return false; } $uid = $attrs[0]['id']; /* recreate instance of SerwebUser class from get param */ $serweb_user =& SerwebUser::recreate_from_get_param($_GET['u']); /* and compare if uid obtained from user_attrs match to uid inside $serweb_user object */ if ($uid != $serweb_user->get_uid()) { ErrorHandler::add_error($lang_str['err_reg_conf_not_exists_conf_num']); return false; } /* get email address of user */ $user_attrs =& User_Attrs::singleton($uid); if (false === ($email = $user_attrs->get_attribute($an['email']))) { return false; } /* generate new password */ $password = substr(md5(uniqid('')), 0, 5); if (false === $data->set_password_to_user($serweb_user, $password, $errors)) { return false; } $mail = read_lang_txt_file($this->opt['mail_file_pass'], "txt", $_SESSION['lang'], array(array("domain", $this->opt['domain']), array("password", $password))); if ($mail === false) { /* needn't write message to log. It's written by function read_lang_txt_file */ $errors[] = $lang_str['err_sending_mail']; return false; } if (false === $this->set_from_header($mail['headers'])) { return false; } if (!send_mail($email, $mail['body'], $mail['headers'])) { $errors[] = $lang_str['err_sending_mail']; return false; } /* unset attribute confirmation */ if (false === $user_attrs->unset_attribute($an['confirmation'])) { return false; } return array("m_fp_pass_sended=" . RawURLEncode($this->opt['instance_id'])); }
/** * Initialy set $this->user_id */ function init_this_uid() { //first try get user_id from session variable if (isset($_SESSION['page_controler_user_id'])) { $this->user_id = $_SESSION['page_controler_user_id']; $this->come_from_admin_interface = true; } //second if userauth param is given, get user_id from it if (!empty($_GET[$this->ch_user_param_name()])) { $uid =& SerwebUser::recreate_from_get_param($_GET[$this->ch_user_param_name()]); if (is_a($uid, 'SerwebUser')) { $this->check_perms_to_user = true; $this->user_id = $_SESSION['page_controler_user_id'] = $uid; $this->come_from_admin_interface = true; } } //if still user_id is null, get it from $_SESSION['auth'] object if (is_null($this->user_id) and isset($_SESSION['auth']) and is_a($_SESSION['auth'], "Auth")) { $this->user_id = $_SESSION['auth']->get_logged_user(); } }
/** * Function return array of associtive arrays containig subscribers * * Keys of associative arrays: * - username * - domain * - name * - fname * - lname * - phone * - email_address * - get_param * - aliases * - disabled * * Possible options parameters: * - from_domains (array) - array of domain IDs from which are * returned subscribers. By default are * returned all subscribers. (default:null) * - get_user_aliases (bool) - should return aliases of users? Could be * disabled from performance reasons. * (default: true) * - get_sip_uri (bool) - return sip address of user (default: false) * - get_timezones (bool) - return timezone of users * - only_users (array) - Array of user IDs. if is set, only users * from this array are returned (default:null) * - return_all (bool) - if true, the result isn't limited by LIMIT * sql phrase (default: false) * - only_agreeing (bool) - if true, only subscribers agreeing to look * up for them are returned (default: false) * - get_credentials (bool) - return credentials of users in output * array (default: false) * - count_only (bool) - just count users matching the filter. * If this option is true, integer is * returned instead of array * - get_disabled (bool) - include disabled users to the result(default: true) * - get_deleted (bool) - include deleted users to the result(default: false) * * @return array array of users or FALSE on error */ function get_users($filter, $opt) { global $config; $errors = array(); if (!$this->connect_to_db($errors)) { ErrorHandler::add_error($errors); return false; } /* table's name */ $ta_name =& $config->data_sql->user_attrs->table_name; $tc_name =& $config->data_sql->credentials->table_name; $tu_name =& $config->data_sql->uri->table_name; $tl_name =& $config->data_sql->location->table_name; $td_name =& $config->data_sql->domain->table_name; $tda_name =& $config->data_sql->domain_attrs->table_name; /* col names */ $ca =& $config->data_sql->user_attrs->cols; $cc =& $config->data_sql->credentials->cols; $cu =& $config->data_sql->uri->cols; $cl =& $config->data_sql->location->cols; $cd =& $config->data_sql->domain->cols; $cda =& $config->data_sql->domain_attrs->cols; /* flags */ $fa =& $config->data_sql->user_attrs->flag_values; $fc =& $config->data_sql->credentials->flag_values; $fu =& $config->data_sql->uri->flag_values; $an =& $config->attr_names; $opt_from_domains = isset($opt['from_domains']) ? $opt['from_domains'] : null; $opt_get_aliases = isset($opt['get_user_aliases']) ? (bool) $opt['get_user_aliases'] : true; $opt_get_sip_uri = isset($opt['get_sip_uri']) ? (bool) $opt['get_sip_uri'] : false; $opt_get_timezones = isset($opt['get_timezones']) ? (bool) $opt['get_timezones'] : false; $opt_uid_filter = isset($opt['only_users']) ? $opt['only_users'] : null; $opt_return_all = isset($opt['return_all']) ? (bool) $opt['return_all'] : false; $opt_count_only = isset($opt['count_only']) ? (bool) $opt['count_only'] : false; $opt_agreeing = isset($opt['only_agreeing']) ? (bool) $opt['only_agreeing'] : false; $opt_get_disabled = isset($opt['get_disabled']) ? (bool) $opt['get_disabled'] : true; $opt_get_deleted = isset($opt['get_deleted']) ? (bool) $opt['get_deleted'] : false; $opt_get_credentials = isset($opt['get_credentials']) ? (bool) $opt['get_credentials'] : false; $o_order_by = isset($opt['order_by']) ? $opt['order_by'] : ""; $o_order_desc = !empty($opt['order_desc']) ? "desc" : ""; $filter_join_fn = $filter_join_ln = $filter_join_ph = $filter_join_em = false; $qw = array(); if (!empty($filter['username'])) { $qw[] = $filter['username']->to_sql("cr." . $cc->uname); } if (!empty($filter['realm'])) { $qw[] = $filter['realm']->to_sql("cr." . $cc->realm); } if (!empty($filter['uid'])) { $qw[] = $filter['uid']->to_sql("cr." . $cc->uid); } if (!empty($filter['fname'])) { $qw[] = $filter['fname']->to_sql("afn." . $ca->value); $filter_join_fn = true; } if (!empty($filter['lname'])) { $qw[] = $filter['lname']->to_sql("aln." . $ca->value); $filter_join_ln = true; } if (!empty($filter['email'])) { $qw[] = $filter['email']->to_sql("aem." . $ca->value); $filter_join_em = true; } if (!empty($filter['phone'])) { $qw[] = $filter['phone']->to_sql("aph." . $ca->value); $filter_join_ph = true; } if (!$opt_get_disabled) { $qw[] = "(cr." . $cc->flags . " & " . $fc['DB_DISABLED'] . ") = 0"; } if (!$opt_get_deleted) { $qw[] = "(cr." . $cc->flags . " & " . $fc['DB_DELETED'] . ") = 0"; } if (!empty($filter['sipuri'])) { $q_uri = "select " . $cu->uid . " \n from " . $tu_name . " u join " . $td_name . " d\n on u." . $cu->did . " = d." . $cd->did . "\n where " . $filter['sipuri']->to_sql("concat('sip:', " . $cu->username . ", '@', " . $cd->name . ")"); $qw[] = "(cr." . $cc->uid . " IN (" . $q_uri . "))"; } $query_c = ""; if ($qw) { $query_c = implode(" and ", $qw); } $q_online = ""; if (!empty($filter['onlineonly']) and $filter['onlineonly']->value) { $q_online = " join " . $tl_name . " loc on (cr." . $cc->uid . " = loc." . $cl->uid . ") "; } $q_admins = ""; if (!empty($filter['adminsonly']) and $filter['adminsonly']->value) { $q_admins = " join " . $ta_name . " adm \n\t\t\t on (cr." . $cc->uid . " = adm." . $ca->uid . " and \n\t\t\t\t\t\t adm." . $ca->name . "='" . $an['is_admin'] . "' and\n\t\t\t\t\t\t\tadm." . $ca->value . "='1') "; } $q_agree = ""; if ($opt_agreeing) { $q_agree = " join " . $ta_name . " aag \n\t\t\t on (cr." . $cc->uid . " = aag." . $ca->uid . " and \n\t\t\t\t\t\t aag." . $ca->name . "='" . $an['allow_find'] . "' and\n\t\t\t\t\t\t\taag." . $ca->value . "='1') "; } $q_uri = ""; if (!empty($filter['alias'])) { $q_uri = " join (select distinct " . $cu->uid . " \n from " . $tu_name . " \n where " . $filter['alias']->to_sql($cu->username) . ") auri \n on cr." . $cc->uid . " = auri." . $cu->uid . " "; } $q_dom_filter = ""; if (!empty($filter['domain'])) { if ($config->auth['use_did']) { $q_dom_filter = " join (select distinct " . $cd->did . " \n from " . $td_name . " \n where " . $filter['domain']->to_sql($cd->name) . ") dom \n on cr." . $cc->did . "=dom." . $cd->did . " "; } else { $q_dom_filter = " join (select distinct doa." . $cda->value . " as realm \n from " . $tda_name . " doa \n join " . $td_name . " dom \n on (doa." . $cda->did . " = dom." . $cd->did . " and \n " . $filter['domain']->to_sql("dom." . $cd->name) . " )\n where doa." . $cda->name . " = '" . $an['digest_realm'] . "') idom \n on idom.realm = cr." . $cc->realm . " "; } } $q_domains = ""; if (!is_null($opt_from_domains)) { if (!$opt_get_deleted) { $q_domains_w = " and " . $cu->flags . " & " . $fu['DB_DELETED'] . " = 0"; } $q_domains = " join (select distinct " . $cu->uid . " \n from " . $tu_name . " \n where " . $this->get_sql_in($cu->did, $opt_from_domains, true) . $q_domains_w . ") iuri \n on cr." . $cc->uid . " = iuri." . $cu->uid . " "; } $q_uid_filter = ""; if (!is_null($opt_uid_filter)) { $q_uid_filter = " and " . $this->get_sql_in("cr." . $cc->uid, $opt_uid_filter, true); } $q_tz_cols = $q_tz_from = ""; if ($opt_get_timezones) { $q_tz_from = " left outer join " . $ta_name . " atz \n\t\t\t on (cr." . $cc->uid . " = atz." . $ca->uid . " and \n\t\t\t\t\t\t atz." . $ca->name . "='" . $an['timezone'] . "') "; $q_tz_cols = ", atz." . $ca->value . " as timezone "; } if (!$opt_return_all or $opt_count_only) { /* get num rows */ $q = "select count(*) \n\t\t\t\t from " . $tc_name . " cr " . $q_online . $q_admins . $q_dom_filter . $q_domains . $q_uri . $q_agree; if ($filter_join_fn) { $q .= " left outer join " . $ta_name . " afn\n on (cr." . $cc->uid . " = afn." . $ca->uid . " and afn." . $ca->name . "='" . $an['fname'] . "')"; } if ($filter_join_ln) { $q .= "left outer join " . $ta_name . " aln\n on (cr." . $cc->uid . " = aln." . $ca->uid . " and aln." . $ca->name . "='" . $an['lname'] . "')"; } if ($filter_join_ph) { $q .= "left outer join " . $ta_name . " aph\n on (cr." . $cc->uid . " = aph." . $ca->uid . " and aph." . $ca->name . "='" . $an['phone'] . "')"; } if ($filter_join_em) { $q .= "left outer join " . $ta_name . " aem\n on (cr." . $cc->uid . " = aem." . $ca->uid . " and aem." . $ca->name . "='" . $an['email'] . "')"; } if ($query_c or $q_uid_filter) { $q .= " where " . $query_c . $q_uid_filter; } $res = $this->db->query($q); if (DB::isError($res)) { ErrorHandler::log_errors($res); return false; } $row = $res->fetchRow(DB_FETCHMODE_ORDERED); $this->set_num_rows($row[0]); $res->free(); /* if act_row is bigger then num_rows, correct it */ $this->correct_act_row(); if ($opt_count_only) { return $row[0]; } } $q = "select cr." . $cc->uid . " as uid,\n\t\t\t cr." . $cc->uname . " as username,\n\t\t cr." . $cc->did . " as did,\n\t\t\t cr." . $cc->realm . " as realm,\n\t\t\t\t\t afn." . $ca->value . " as fname,\n\t\t\t\t\t aln." . $ca->value . " as lname,\n\t\t\t\t\t aph." . $ca->value . " as phone,\n\t\t\t\t\t aem." . $ca->value . " as email,\n\t\t\t\t\t cr." . $cc->flags . " & " . $fc['DB_DISABLED'] . " as disabled,\n\t\t\t\t\t cr." . $cc->flags . " & " . $fc['DB_DELETED'] . " as deleted,\n\t\t\t\t\t trim(concat(afn." . $ca->value . ", ' ', aln." . $ca->value . ")) as name\n\t\t\t\t\t " . $q_tz_cols . "\n\t\t\t from " . $tc_name . " cr " . $q_online . $q_admins . $q_dom_filter . $q_domains . $q_uri . $q_agree . $q_tz_from . "\n\t\t\t left outer join " . $ta_name . " afn\n\t\t\t on (cr." . $cc->uid . " = afn." . $ca->uid . " and afn." . $ca->name . "='" . $an['fname'] . "')\n\t\t\t left outer join " . $ta_name . " aln\n\t\t\t on (cr." . $cc->uid . " = aln." . $ca->uid . " and aln." . $ca->name . "='" . $an['lname'] . "')\n\t\t\t left outer join " . $ta_name . " aph\n\t\t\t on (cr." . $cc->uid . " = aph." . $ca->uid . " and aph." . $ca->name . "='" . $an['phone'] . "')\n\t\t\t left outer join " . $ta_name . " aem\n\t\t\t on (cr." . $cc->uid . " = aem." . $ca->uid . " and aem." . $ca->name . "='" . $an['email'] . "')"; if ($query_c or $q_uid_filter) { $q .= " where " . $query_c . $q_uid_filter; } if ($o_order_by) { $q .= " order by " . $o_order_by . " " . $o_order_desc; } $q .= $opt_return_all ? "" : $this->get_sql_limit_phrase(); $res = $this->db->query($q); if (DB::isError($res)) { ErrorHandler::log_errors($res); return false; } $out = array(); while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { $i = $row['uid']; $out[$i]['uid'] = $row['uid']; $out[$i]['username'] = $row['username']; $out[$i]['realm'] = $row['realm']; $out[$i]['serweb_auth'] =& SerwebUser::instance($row['uid'], $row['username'], $config->auth['use_did'] ? $row['did'] : null, $row['realm']); $out[$i]['domain'] = $out[$i]['serweb_auth']->get_domainname(); $out[$i]['name'] = $row['name']; $out[$i]['fname'] = $row['fname']; $out[$i]['lname'] = $row['lname']; $out[$i]['phone'] = $row['phone']; $out[$i]['email_address'] = $row['email']; $out[$i]['get_param'] = $out[$i]['serweb_auth']->to_get_param(); $out[$i]['disabled'] = (bool) $row['disabled']; $out[$i]['deleted'] = (bool) $row['deleted']; if ($opt_get_timezones) { $out[$i]['timezone'] = $row['timezone']; } if ($opt_get_aliases or $opt_get_sip_uri) { $out[$i]['aliases'] = ''; $out[$i]['sip_uri'] = ''; $uri_handler =& URIs::singleton($row['uid']); if (false === ($uris = $uri_handler->get_URIs())) { return false; } if ($opt_get_aliases) { $alias_arr = array(); foreach ($uris as $val) { $alias_arr[] = $val->get_username(); } $out[$i]['aliases'] = implode(", ", $alias_arr); $out[$i]['uris'] = $uris; } if ($opt_get_sip_uri) { if (false === ($uri = $uri_handler->get_URI())) { return false; } if (!is_null($uri)) { if (false === ($out[$i]['sip_uri'] = $uri->to_string())) { return false; } } } } if ($opt_get_credentials) { if (false === ($credentials = $this->get_credentials($row['uid'], null))) { return false; } $out[$i]['credentials'] = array(); foreach ($credentials as $k => $v) { if (false === ($out[$i]['credentials'][] = $v->to_smarty())) { return false; } } } } $res->free(); return $out; }
/** * create references to auth info for backward compatibility */ function create_serweb_auth_references() { $this->serweb_auth =& SerwebUser::instance_by_refs($this->auth['uid'], $this->auth['uname'], $this->auth['did'], $this->auth['realm']); /* if (! is_object($this->serweb_auth)){ $this->serweb_auth = new SerwebUser(); } $this->serweb_auth->uid = &$this->auth['uid']; $this->serweb_auth->did = &$this->auth['did']; $this->serweb_auth->username = &$this->auth['uname']; $this->serweb_auth->realm = &$this->auth['realm']; */ }