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; }
static function getArchiveLink($filter = '', $taxonomy_term = Null) { $permalink_structure = Get_Option('permalink_structure'); # Get base url if ($taxonomy_term) { $base_url = Get_Term_Link($taxonomy_term); } else { $base_url = Get_Post_Type_Archive_Link(self::$post_type_name); } if (!empty($permalink_structure)) { return User_TrailingSlashIt(SPrintF('%1$s/filter:%2$s', RTrim($base_url, '/'), RawURLEncode($filter))); } else { return Add_Query_Arg(array('filter' => RawURLEncode($filter)), $base_url); } }
function export_to_xml($dtdfile = "") { $at_h =& Attr_types::singleton(); if (false === ($attr_types = $at_h->get_attr_types())) { return false; } Header("Content-Disposition: attachment;filename=" . RawURLEncode("attr-types-" . date("Y-m-d") . ".xml")); header("Content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?" . ">\n"; if ($dtdfile) { echo "<!DOCTYPE attr_types SYSTEM \"" . $dtdfile . "\">\n"; } echo "<attr_types>\n"; foreach ($attr_types as $at) { echo $this->at_to_xml($at); } echo "</attr_types>\n"; return true; }
function play_greeting($user, &$errors) { global $config, $lang_str; if ($config->users_indexed_by == 'uuid') { @($fp = fopen($config->greetings_spool_dir . $user->get_uid() . ".wav", 'rb')); } else { @($fp = fopen($config->greetings_spool_dir . $user->get_domainname() . "/" . $user->get_username() . ".wav", 'rb')); } if (!$fp) { //try open default greeting @($fp = fopen($config->greetings_spool_dir . "default.wav", 'rb')); if (!$fp) { log_errors(PEAR::raiseError($lang_str['err_can_not_open_greeting']), $errors); return false; } } Header("Content-Disposition: attachment;filename=" . RawURLEncode("greeting.wav")); Header("Content-type: audio/wav"); @fpassthru($fp); @fclose($fp); return true; }
function action_dele(&$errors) { global $data; if (false === $data->del_im($this->user_id->get_uid(), $_GET['im_dele_id'])) { return false; } return array("m_im_deleted=" . RawURLEncode($this->opt['instance_id'])); }
function action_send(&$errors) { global $data; if (false === $data->send_im($this->user_id, $_POST['im_sip_address'], $_POST['im_instant_message'], array(), $errors)) { $this->f->load_defaults(); return false; } return array("m_im_sended=" . RawURLEncode($this->opt['instance_id']), "m_im_sended_uri=" . RawURLencode($_POST['im_sip_address'])); }
if ($perm->have_perm('hostmaster')) { $usr_pref->set_opt('perm', 'hostmaster'); } else { $usr_pref->set_opt('perm', 'admin'); } } else { $usr_pref->set_opt('perm', 'user'); } $pu->set_opt('change_pass', $config->allow_change_password); //create copy of some options from config in order to sensitive options will not accessible via templates $cfg = new stdclass(); $cfg->enable_dial_voicemail = $config->enable_dial_voicemail; $cfg->enable_test_firewall = $config->enable_test_firewall; $cfg->allow_change_usrloc = $config->allow_change_usrloc; $smarty->assign_by_ref("config", $cfg); $smarty->assign('url_ctd', "javascript: open_ctd_win_default('" . RawURLEncode("sip:" . $controler->user_id->get_username() . "@" . $controler->user_id->get_domainname()) . "');"); $smarty->assign('url_stun', "javascript:stun_applet_win('stun_applet.php', " . $config->stun_applet_width . ", " . $config->stun_applet_height . ");"); $smarty->assign('url_admin', $sess->url($config->admin_pages_path . "users.php?kvrk=" . uniqid(""))); $controler->add_reqired_javascript("functions.js"); $controler->add_apu($pu); $controler->add_apu($aliases); $controler->add_apu($acl); $controler->add_apu($usr_pref); $controler->add_apu($at_sel); $controler->assign_form_name("pd", $usr_pref); $controler->assign_form_name("pd", $pu); if ($config->allow_change_usrloc) { $controler->add_apu($ul); $controler->assign_form_name("ul", $ul); $controler->set_submit_for_form("ul", array('type' => 'image', 'text' => $lang_str['b_add'], 'src' => get_path_to_buttons("btn_add.gif", $sess_lang))); }
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'])); }
function action_add(&$errors) { global $data; if (false === $data->add_contact($this->user_id->get_uid(), $_POST['ul_sip_address'], $_POST['ul_expires'], $errors)) { return false; } return array("m_ul_added=" . RawURLEncode($this->opt['instance_id'])); }
/** * Method delete the customer * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_delete(&$errors) { global $data; /* check if customer owning some domains */ $opt = array('filter' => array('customer_id' => new Filter("customer_id", $this->act_id, "="))); if (false === ($domains = $data->get_domains($opt, $errors))) { return false; } if (count($domains)) { /* set error message */ $errors = $this->opt['err_owning_domains']; /* get customers in order to the list can be displayed */ $this->get_customers($errors); /* unset customer id in the form in order to if * someone submit the form, the action 'add' will perform, * not action 'update' */ $this->f->elements['cu_id']['ob']->value = null; return false; } $opt = array('primary_key' => array('cid' => $this->act_id)); if (false === $data->delete_customer($opt, $errors)) { return false; } if ($this->opt['redirect_on_delete']) { $this->controler->change_url_for_reload($this->opt['redirect_on_delete']); } return array("m_cu_deleted=" . RawURLEncode($this->opt['instance_id'])); }
function action_update(&$errors) { global $config; $an =& $config->attr_names; foreach ($this->acl_control as $row) { // if value has been checked if (!empty($_POST["acl_chk_" . $row]) and !in_array($row, $this->acl)) { $this->acl[] = $row; //add value to the array } // if value has been unchecked if (empty($_POST["acl_chk_" . $row]) and false !== ($k = array_search($row, $this->acl))) { unset($this->acl[$k]); //remove value from array } } /* get user attrs object */ $ua =& User_Attrs::singleton($this->user_id->get_uid()); if (false === $ua->set_attribute($an['acl'], $this->acl)) { return false; } if ($this->opt['redirect_on_update']) { $this->controler->change_url_for_reload($this->opt['redirect_on_update']); } return array("m_acl_updated=" . RawURLEncode($this->opt['instance_id'])); }
/** * assign variables to smarty */ function pass_values_to_html() { global $smarty; $refresh_urls = array(); foreach ($this->opt['timeouts'] as $k => $v) { $refresh_urls[] = array("url" => $this->controler->url($_SERVER['PHP_SELF'] . "?refresh_updated=1&refresh_timeout=" . RawURLEncode($k)), "label" => $v, "timeout" => $k); } $smarty->assign($this->opt['smarty_url_refresh_arr'], $refresh_urls); $smarty->assign($this->opt['smarty_refresh_timeout'], $this->session['timeout']); }
function action_set_admin_privileges(&$errors) { global $config; $an =& $config->attr_names; /* get user attrs object */ $ua =& User_Attrs::singleton($this->user_id->get_uid()); if (false === $ua->set_attribute($an['is_admin'], "1")) { return false; } return array("m_pr_updated=" . RawURLEncode($this->opt['instance_id'])); }
function format_items_for_output() { global $sess; $out = array(); $i = 0; foreach ($this->item_list as $value => $label) { if ($value == $this->item_id and !is_null($this->item_id)) { continue; } $out[$i]['label'] = $label; $out[$i]['value'] = $value; $out[$i]['url_dele'] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&at_dele=1&item=" . RawURLEncode($value)); $out[$i]['url_edit'] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&at_edit=1&item=" . RawURLEncode($value)); $i++; } return $out; }
function action_update(&$errors) { global $data; if ($this->whitelist === false) { return false; } /* an error in getting whitelist */ /* if $_POST['whitelist'] is missing, create it as empty array */ if (!isset($_POST['whitelist']) or !is_array($_POST['whitelist'])) { $_POST['whitelist'] = array(); } /* in which fields of $this->whitelist array are values with wich we are eorking? It may by only username in fields 'username_uri' or whole sip address in field 'uri' */ $uri_field = $this->opt['username_in_target_only'] ? 'username_uri' : 'uri'; /* copy values from corresponding fields to one dimensional array. Preserve keys. */ $current_whitelist = array(); foreach ($this->whitelist as $key => $val) { $current_whitelist[$key] = $val[$uri_field]; } /* get uris which should be deleted - is missing in POST array. Key are still preserved */ $del = array_diff($current_whitelist, $_POST['whitelist']); if (is_array($del)) { foreach ($del as $key => $val) { $opt = array('primary_key' => $this->whitelist[$key]['primary_key']); if (false === $data->del_whitelist_entry($this->user_id, $opt, $errors)) { return false; } } } /* get uris which should be inserted - is missing in $this->whitelist array. Key aren't preserved */ $ins = array_diff($_POST['whitelist'], $current_whitelist); if (is_array($ins)) { foreach ($ins as $val) { /* if we are working only with usernames, append the tomain and initial 'sip:' */ if ($this->opt['username_in_target_only']) { $val = "sip:" . $val . "@" . $this->opt['domain_for_targets']; } $values = array('uri' => $val); if (false === $data->add_whitelist_entry($this->user_id, $values, NULL, $errors)) { return false; } } } return array("m_wlist_updated=" . RawURLEncode($this->opt['instance_id'])); }
function action_update(&$errors) { global $data; //if password should be changed if ($_POST['pu_passwd']) { if (false === $data->set_password_to_user($this->user_id, $_POST['pu_passwd'], $errors)) { return false; } } return array("m_pu_updated=" . RawURLEncode($this->opt['instance_id'])); }
/** * perform action edit layout file * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_edit_layout_file(&$errors) { global $sess; $this->smarty_action = "edit_layout"; $this->url_back_to_default = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&back_to_default_layout=1&filename=" . RawURLEncode($this->filename)); return true; }
/** * Method perform action import * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_import(&$errors) { global $data; $import_obj = new attr_types_import(); $result = $import_obj->setInputFile($_FILES['at_file']['tmp_name']); if (PEAR::isError($result)) { ErrorHandler::log_errors($result); return false; } $result = $import_obj->parse(); if (PEAR::isError($result)) { ErrorHandler::log_errors($result); return false; } if ($err = $import_obj->get_errors()) { ErrorHandler::add_error($err); return false; } $new_at = $import_obj->get_attr_types(); $at_h =& Attr_types::singleton(); if (false === ($current_at = $at_h->get_attr_types())) { return false; } $current_at_names = array_keys($current_at); if (!empty($_POST['at_purge'])) { /* purge old attribute types */ foreach ($current_at_names as $v) { if (false === $data->del_attr_type($v, null)) { return false; } } } foreach ($new_at as $v) { if (empty($_POST['at_purge']) and in_array($v->get_name(), $current_at_names)) { /* if current attribute already exists */ if ($_POST['at_exists'] == "update") { if (false === $data->del_attr_type($v->get_name(), null)) { return false; } } else { continue; } } /* store attr type to DB */ if (false === $data->update_attr_type($v, null, null)) { return false; } } if ($this->opt['redirect_on_import']) { $this->controler->change_url_for_reload($this->opt['redirect_on_import']); } $get = array('at_imported=' . RawURLEncode($this->opt['instance_id'])); return $get; }
/** * Method perform action add * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_add(&$errors) { global $data; /* create new attribute */ $atr = new Attr_type("", 2, "string", "", "", 0, 0, 0, 0, 0); /* modify the attribute by values obtained from html form */ $this->set_attr_type_by_post($atr); /* store changes to DB */ if (false === $data->update_attr_type($atr, null, null)) { return false; } /* redirect to extended setting if attribute use it */ if (Attr_type::get_apu_edit($atr->get_type())) { $this->controler->change_url_for_reload($this->opt['type_spec_script'] . "?attrib_name=" . RawURLEncode($atr->get_name()) . "&kvrk=" . uniqID("")); } return true; }
/** * Method update the domain. * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_update(&$errors) { if (!isset($_POST['do_customer'])) { $_POST['do_customer'] = null; } if (!isset($_POST['do_new_name'])) { $_POST['do_new_name'] = null; } if (false === $this->update_domain($_POST['do_new_name'], $_POST['do_customer'], $errors)) { return false; } if ($this->opt['redirect_on_update']) { $this->controler->change_url_for_reload($this->opt['redirect_on_update']); } return array("m_do_updated=" . RawURLEncode($this->opt['instance_id'])); }
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 pass_values_to_html() { global $smarty, $sess; $smarty->assign_by_ref($this->opt['smarty_action'], $this->smarty_action); $smarty->assign($this->opt['smarty_download_url'], $sess->url($_SERVER['PHP_SELF'] . "?vm_download_g=" . RawURLEncode($this->opt['instance_id']))); }
function action_update(&$errors) { global $available_languages, $config; $_SESSION['lang'] = $_POST['ls_language']; if ($this->opt['save_to_cookie']) { setcookie('serweb_lang', $_SESSION['lang'], time() + 31536000, $config->root_path); } if ($this->opt['save_to_user_attr']) { $an =& $config->attr_names; $attrs =& User_Attrs::singleton($this->controler->user_id->get_uid()); if (false === $attrs->set_attribute($an['lang'], $available_languages[$_SESSION['lang']][2])) { return false; } } return array("m_ls_updated=" . RawURLEncode($this->opt['instance_id'])); }
function action_update(&$errors) { global $data; //update all changed attributes foreach ($this->opt['attributes'] as $att) { //skip attributes which has not access to change if (!$this->access_to_change($att)) { continue; } //if att value is changed if ($_POST[$att] != $_POST["_hidden_" . $att]) { switch ($this->opt['attrs_kind']) { case "uri": if (false === $this->uri_attrs->set_attribute($att, $_POST[$att])) { return false; } break; case "user": if (false === $this->user_attrs->set_attribute($att, $_POST[$att])) { return false; } break; case "domain": if (false === $this->domain_attrs->set_attribute($att, $_POST[$att])) { return false; } break; case "global": if (false === $this->global_attrs->set_attribute($att, $_POST[$att])) { return false; } break; } } } switch ($this->opt['attrs_kind']) { case "domain": if (false === $data->reload_domains(null, $errors)) { return false; } break; case "global": if (false === $data->reload_global_attrs(null, $errors)) { return false; } break; } if ($this->opt['on_update_callback']) { call_user_func_array($this->opt['on_update_callback'], array(&$this)); } if ($this->opt['redirect_on_update']) { $this->controler->change_url_for_reload($this->opt['redirect_on_update']); } return array("m_attrs_updated=" . RawURLEncode($this->opt['instance_id'])); }
/** * Method perform action update * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_update(&$errors) { if ($this->session['sort_col'] == $this->col_to_sort) { $this->session['reverse_order'] = !$this->session['reverse_order']; } else { $this->session['sort_col'] = $this->col_to_sort; $this->session['reverse_order'] = false; } if (!empty($this->opt['on_change_callback'])) { call_user_func($this->opt['on_change_callback']); } if (isset($this->base_apu->opt['screen_name'])) { $msg = "Sorting order changed to sort entries by '" . $this->col_to_sort . "'"; if ($this->session['reverse_order']) { $msg .= " in reverse order"; } action_log($this->base_apu->opt['screen_name'], "sort", $msg); } if (!empty($this->session['get_param'])) { return (array) $this->session['get_param']; } $get = array('sorter_updated=' . RawURLEncode($this->opt['instance_id'])); $get = array_merge($get, $this->get_params); return $get; }
/** * Return URL that access given css file from templates directory. * Templates directory is not usualy accessible via html directory tree. * So there is getter script inside the styles directory that access the * css file and return its content to HTML browser. * * In rare cases this might not work. I.e. webserwer from webmin execute * only files with .cgi extension. To solve it this method could be * overriden with another one that will return URL to customized getter * script. * * @param string $file The filename of the required file with path * relatively to templates directory */ function css_from_tpl_getter($file) { global $config; return $config->style_src_path . "core/get_css.php?css=" . RawURLEncode($file); }
} } $language = $AR->user->data->language; if (!$AR->nls->list[$language]) { $language = 'en'; } $language = preg_replace('/[^a-z0-9_]/i', '', $language); $ARnls->load('', $language); $ARnls->load('vedor-editor-v9', $language); $getargs = "?vdLanguage=" . RawURLEncode($language); // CAS vars; if ($requestorHost) { $getargs .= "&requestorHost=" . RawURLEncode($requestorHost); } if ($requestorPort) { $getargs .= "&requestorPort=" . RawURLEncode($requestorPort); } // load editor.ini, in case the editor is started directly, not through the // js.html file $oldnls = $this->nls; $this->setnls($language); $options = $this->call("editor.ini", $arCallArgs); $vdBrowseRoot = $options['browse']['root']; if (!$vdBrowseRoot) { $vdBrowseRoot = $options['vdBrowseRoot']; // for backwards compat. if (!$vdBrowseRoot) { $vdBrowseRoot = $this->currentsite(); } } $this->setnls($oldnls);
/** * Method perform action default * * @param array $errors array with error messages * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_default(&$errors) { //get list of all atributes which could be displayed on tihis page $avail_attrs = $this->apu_attrs->get_all_avaiable_attributes(); $at =& Attr_types::singleton(); if (false === ($grps = $at->get_attr_groups())) { return false; } if (false === ($types = $at->get_attr_types())) { return false; } //make list of not empty groups $avail_grps = array(); foreach ($avail_attrs as $attr) { $avail_grps[$types[$attr]->get_group()] = true; } $tabs = array(); foreach ($grps as $k => $v) { //skip group with no attributes if (empty($avail_grps[$v])) { continue; } $page = $_SERVER['PHP_SELF'] . "?attr_grp=" . RawURLEncode($v); $label = $at->get_attr_group_label($v); $tabs[] = new Ctab(true, $label, $page); if ($v == $this->session['selected_grp']) { $this->selected_grp['tab'] = $page; } } $this->selected_grp['grp'] = $this->session['selected_grp']; $this->tabs =& $tabs; return true; }
function Encode($value) { return is_array($value) ? $this->EncodeArray($value) : str_replace('%7E', '~', str_replace('+', ' ', RawURLEncode($value))); }
/** * Method perform action update * * @return array return array of $_GET params fo redirect or FALSE on failure */ function action_update() { $this->session['name'] = $_POST['hello_world_name']; action_log($this->opt['screen_name'], $this->action, "update name to: " . $this->session['name']); $get = array('hello_world_updated=' . RawURLEncode($this->opt['instance_id'])); return $get; }