function page_admin_profile() { global $smarty; $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_admin_profile.tpl'); exit; }
function page_relogin() { global $smarty; $smarty->assign("callback", urlencode($_REQUEST['callback'])); smarty_output('cpanel/page_relogin.tpl'); exit; }
function page_reload() { global $smarty; global $rpcpbx; global $friconf; //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_reload.tpl'); exit; }
function page_option_voip() { global $smarty; global $rpcpbx; global $friconf; $rpcres = sendrequest($rpcpbx->option_confsection_get('asterisk', 'sip.conf', 'general'), 0); $smarty->assign("sip", $rpcres['general']); $rpcres = sendrequest($rpcpbx->option_confsection_get('asterisk', 'iax.conf', 'general'), 0); $smarty->assign("iax", $rpcres['general']); $rpcres = sendrequest($rpcpbx->option_confsection_get('asterisk', 'rtp.conf', 'general'), 0); $smarty->assign("rtp", $rpcres['general']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_option_voip.tpl'); exit; }
function page_option_general() { global $smarty; global $rpcpbx; global $friconf; //取出fastagi $rpcres = sendrequest($rpcpbx->option_confsection_get('freeiris', 'freeiris.conf', 'fastagi'), 0); $smarty->assign("fastagi", $rpcres['fastagi']); //取出voicemail $rpcres = sendrequest($rpcpbx->option_confsection_get('freeiris', 'freeiris.conf', 'voicemail'), 0); $smarty->assign("voicemail", $rpcres['voicemail']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_option_general.tpl'); exit; }
function error_popbox($errorcode, $rawerrstr, $line = null, $function = null, $location, $type) { global $smarty; if ($line == null || $function == null) { $debug = debug_backtrace(); $line = $debug[0]['line']; $function = $debug[0]['function']; } $smarty->assign('errorcode', preg_replace("/\\'|\n/", "", $errorcode)); $smarty->assign('rawerrstr', $rawerrstr); $smarty->assign('line', $line); $smarty->assign("function", $function); $smarty->assign('location', $location); $smarty->assign('type', $type); $smarty->assign("filename", $_SERVER['PHP_SELF']); smarty_output('error_popbox.tpl'); exit; }
function func_admin_edit() { global $smarty; global $rpcpbx; //取得这个用户 $rpcres = sendrequest($rpcpbx->base_dbquery("select * from admin where adminid = '" . $_REQUEST['adminid'] . "'"), 0); $smarty->assign("thisadmin", $rpcres['result_array'][0]); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_admin_edit.tpl'); exit; }
function func_outgoing_add() { global $smarty; global $rpcpbx; global $friconf; //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_outgoing_add.tpl'); exit; }
function func_exten_edit_fxs() { global $smarty; global $rpcpbx; //取得这个用户 $rpcres = sendrequest($rpcpbx->extension_get_sip($_REQUEST['accountcode']), 0); //指定分机不存在 if (!$rpcres['resdata']) { error_page(125, $rpcres['response']['message'], null, null); } $smarty->assign("extension", $rpcres['resdata']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_exten_edit_fxs.tpl'); exit; }
function func_musicmanager_edit() { global $smarty; global $rpcpbx; //取出 $rpcres = sendrequest($rpcpbx->voicefiles_get($_REQUEST['id']), 0); $smarty->assign("file", $rpcres['resdata']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_musicmanager_edit.tpl'); exit; }
function func_queue_edit() { global $smarty; global $rpcpbx; //取得这个用户 $rpcres = sendrequest($rpcpbx->queue_get($_REQUEST['queuenumber']), 0); //指定不存在 if (!$rpcres['resdata']) { error_page(113, $rpcres['response']['message'], null, null); } $smarty->assign("queue", $rpcres['resdata']); $rpcres['confdata']['periodicannouncefrequency'] = $rpcres['confdata']['periodic-announce-frequency']; $smarty->assign("queueconf", $rpcres['confdata']); $members_res = $rpcres['resdata']['members_res']; //取出所有备选分机 $rpcres = sendrequest($rpcpbx->extension_list('order by accountcode', 0, 65536), 0); $extensions = array(); //(排除已选) foreach ($rpcres['extensions'] as $exten) { $nosave = false; foreach ($members_res as $member) { if ($exten['accountcode'] == $member['accountcode']) { $nosave = true; break; } } if ($nosave != true) { array_push($extensions, $exten); } } $smarty->assign("extensions", $extensions); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_queue_edit.tpl'); exit; }
function func_faxstats_list() { global $smarty; global $rpcpbx; global $friconf; //分页显示程序 $limit_from = 0; if (!$_REQUEST['cols_in_page'] || $_REQUEST['cols_in_page'] == 'frist' || $_REQUEST['cols_in_page'] < $friconf['cols_in_page']) { $limit_from = 0; $smarty->assign("pre_cols", 0); $smarty->assign("next_cols", $friconf['cols_in_page']); } else { $limit_from = $_REQUEST['cols_in_page']; $smarty->assign("pre_cols", $_REQUEST['cols_in_page'] - $friconf['cols_in_page']); $smarty->assign("next_cols", $_REQUEST['cols_in_page'] + $friconf['cols_in_page']); } $smarty->assign("from_cols", $limit_from + 1); $smarty->assign("to_cols", $limit_from + $friconf['cols_in_page']); //筛选 $filter = null; if (trim($_REQUEST['accountcode']) != "") { $filter = " where accountcode = '" . $_REQUEST['accountcode'] . "'"; $smarty->assign("accountcode", $_REQUEST['accountcode']); } //取出总量 $rpcres = sendrequest($rpcpbx->base_dbquery("select count(*) from faxqueue " . $filter), 1); $smarty->assign("maxcount", $rpcres['result_array'][0][0]); //列表 $rpcres = sendrequest($rpcpbx->base_dbquery("select * from faxqueue " . $filter . " ORDER BY id desc LIMIT " . $limit_from . "," . $friconf['cols_in_page']), 1); $smarty->assign("table_array", $rpcres['result_array']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_faxstats_list.tpl'); exit; }
function func_digital_option() { global $smarty; global $rpcpbx; global $friconf; $rpcres = sendrequest($rpcpbx->option_confsection_get('freeiris', 'hardwaretel_info.conf', 'digital'), 0); $smarty->assign("digital", $rpcres['digital']); $rpcres = sendrequest($rpcpbx->option_confsection_get('asterisk', 'chan_dahdi.conf', 'channels'), 0); $smarty->assign("chan_dahdi", $rpcres['channels']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_digital_option.tpl'); exit; }
function func_confile_edit() { global $smarty; global $rpcpbx; //取得内容 $rpcres = sendrequest($rpcpbx->option_confile_stream($_REQUEST['folder'], $_REQUEST['filename']), 0); $smarty->assign("filestream", $rpcres['resdata']); $smarty->assign("folder", $_REQUEST['folder']); $smarty->assign("filename", $_REQUEST['filename']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_confile_edit.tpl'); exit; }
function func_sessionflow_list() { global $smarty; global $rpcpbx; $smarty->assign("cdruniqueid", $_REQUEST['cdruniqueid']); $rpcres = sendrequest($rpcpbx->base_dbquery("select * from callsession where id = '" . $_REQUEST['callsessionid'] . "' LIMIT 1"), 0); $smarty->assign("callsession", $rpcres['result_array'][0]); $rpcres = sendrequest($rpcpbx->base_dbquery("select disposition,duration,billsec from cdr where userfield = '" . $rpcres['result_array'][0]['id'] . "," . $rpcres['result_array'][0]['frist_cdruniqueid'] . "' LIMIT 1"), 0); $smarty->assign("cdr", $rpcres['result_array'][0]); //取出 $rpcres = sendrequest($rpcpbx->base_dbquery("select * from callsession_acts where callsessionid = '" . $_REQUEST['callsessionid'] . "' order by actid asc"), 0); $smarty->assign("sessionflow", $rpcres['result_array']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_sessionflow_list.tpl'); exit; }
function func_group_edit() { global $smarty; global $rpcpbx; //取得这个用户 $rpcres = sendrequest($rpcpbx->extengroup_get($_REQUEST['groupid']), 0); //基本 $smarty->assign("this", $rpcres['resdata']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_exten_group_edit.tpl'); exit; }
function func_ivrfiles_list() { global $smarty; global $rpcpbx; global $friconf; //取出所有数据 $rpcres = sendrequest($rpcpbx->ivrmenu_list(), 0); //根据分页显示进行取得数据显示 $smarty->assign("ivrmenu_lists", $rpcres['ivrmenu']); //分页显示计算 $limit_from = 0; if (!$_REQUEST['cols_in_page'] || $_REQUEST['cols_in_page'] == 'frist' || $_REQUEST['cols_in_page'] < $friconf['cols_in_page']) { $limit_from = 0; $smarty->assign("pre_cols", 0); $smarty->assign("next_cols", $friconf['cols_in_page']); } else { $limit_from = $_REQUEST['cols_in_page']; $smarty->assign("pre_cols", $_REQUEST['cols_in_page'] - $friconf['cols_in_page']); $smarty->assign("next_cols", $_REQUEST['cols_in_page'] + $friconf['cols_in_page']); } $smarty->assign("from_cols", $limit_from + 1); $smarty->assign("to_cols", $limit_from + $friconf['cols_in_page']); //取出所有数据 $rpcres = sendrequest($rpcpbx->voicefiles_list('ivrmenu', $limit_from, $friconf['cols_in_page'], $_REQUEST['ivrmenu_filter']), 0); foreach ($rpcres['resdata'] as $key => $value) { $array_filename = preg_split("/\\_/", $value['filename']); $rpcres['resdata'][$key]['caller'] = $array_filename[0]; } $smarty->assign("ivrmenufiles_array", $rpcres['resdata']); $smarty->assign("maxcount", count($rpcres['resdata'])); //过滤器 $smarty->assign("ivrmenu_filter", $_REQUEST['ivrmenu_filter']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_ivrfiles_list.tpl'); exit; }
function func_trunk_edit_dahdi() { global $smarty; global $rpcpbx; // get data $rpcres = sendrequest($rpcpbx->base_dbquery("select trunkprototype from trunk where id = '" . $_REQUEST['id'] . "'"), 1); if ($rpcres['result_array'][0]['trunkprototype'] == "") { error_popbox(143, null, null, null, null, 'submit_failed'); } // isdn-pri mode if ($rpcres['result_array'][0]['trunkprototype'] == 'isdn-pri') { //取得这个 $rpcres = sendrequest($rpcpbx->trunk_get_isdnpri($_REQUEST['id']), 0); $smarty->assign("trunk", $rpcres['resdata']); $rpcres = sendrequest($rpcpbx->trunk_freechan_isdnpri(), 0); $smarty->assign("freechan", $rpcres['freechan']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_trunk_edit_isdnpri.tpl'); } elseif ($rpcres['result_array'][0]['trunkprototype'] == 'fxo') { //取得这个 $rpcres = sendrequest($rpcpbx->trunk_get_fxo($_REQUEST['id']), 0); $smarty->assign("trunk", $rpcres['resdata']); $rpcres = sendrequest($rpcpbx->trunk_freechan_fxo(), 0); $smarty->assign("freechan", $rpcres['freechan']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_trunk_edit_fxo.tpl'); } exit; }
function func_onetouch_list() { global $smarty; global $rpcpbx; //取出 $rpcres = sendrequest($rpcpbx->voicefiles_list('onetouch', null, null, $_REQUEST['accountcode']), 0); $smarty->assign("onetouch", $rpcres['resdata']); $smarty->assign("accountcode", $_REQUEST['accountcode']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_onetouch_list.tpl'); exit; }
function func_router_edit() { global $smarty; global $rpcpbx; //取得这个router $rpcres = sendrequest($rpcpbx->router_get($_REQUEST['id']), 0); $smarty->assign("rule", $rpcres['resdata']); //取出所有的trunk $rpcres = sendrequest($rpcpbx->trunk_list('order by cretime desc', 0, 1000), 0); //列表 $smarty->assign("provider_array", $rpcres['trunks']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); // SIP TEMPlATE smarty_output('cpanel/func_trunkrouter_edit.tpl'); exit; }
function func_conference_edit() { global $smarty; global $rpcpbx; //取得这个用户 $rpcres = sendrequest($rpcpbx->conference_get($_REQUEST['confno']), 1); //指定不存在 if (!$rpcres['resdata']) { error_page(192, $rpcres['response']['message'], null, null); } $smarty->assign("conf", $rpcres['resdata']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_conference_edit.tpl'); exit; }
function func_soundmanager_add() { global $smarty; global $rpcpbx; //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_soundmanager_add.tpl'); exit; }
function page_statistical_main() { global $smarty; global $rpcpbx; global $friconf; //分页显示计算 $limit_from = 0; if (!$_REQUEST['cols_in_page'] || $_REQUEST['cols_in_page'] == 'frist' || $_REQUEST['cols_in_page'] < $friconf['cols_in_page']) { $limit_from = 0; $smarty->assign("pre_cols", 0); $smarty->assign("next_cols", $friconf['cols_in_page']); } else { $limit_from = $_REQUEST['cols_in_page']; $smarty->assign("pre_cols", $_REQUEST['cols_in_page'] - $friconf['cols_in_page']); $smarty->assign("next_cols", $_REQUEST['cols_in_page'] + $friconf['cols_in_page']); } $smarty->assign("from_cols", $limit_from + 1); $smarty->assign("to_cols", $limit_from + $friconf['cols_in_page']); //格式化条件 $sqlwhere = ''; //取出当前要显示的类型 if ($_REQUEST['dcontext'] == 'trunk') { $sqlwhere .= " and dcontext like 'from-trunk%'"; } elseif ($_REQUEST['dcontext'] == 'exten') { $sqlwhere .= " and dcontext like 'from-exten%'"; } $smarty->assign("dcontext", $_REQUEST['dcontext']); //取出 if (trim($_REQUEST['start_date']) != '' && trim($_REQUEST['end_date']) != '') { $sqlwhere .= " and calldate >= '" . $_REQUEST['start_date'] . " 00:00:00' and calldate <= '" . $_REQUEST['end_date'] . " 23:59:59'"; $smarty->assign("start_date", $_REQUEST['start_date']); $smarty->assign("end_date", $_REQUEST['end_date']); } if (trim($_REQUEST['src']) != '') { $sqlwhere .= " and src like '" . preg_replace("/\\*/", "%", $_REQUEST['src']) . "'"; $smarty->assign("src", $_REQUEST['src']); } if (trim($_REQUEST['dst']) != '') { $sqlwhere .= " and dst like '" . preg_replace("/\\*/", "%", $_REQUEST['dst']) . "'"; $smarty->assign("dst", $_REQUEST['dst']); } //如果发现了ID覆盖其他参数 if (trim($_REQUEST['id']) != "") { $sqlwhere = "id = '" . $_REQUEST['id'] . "'"; $smarty->assign("id", $_REQUEST['id']); } //最后生成 $sqlwhere = preg_replace("/^ and/", "", $sqlwhere); if (trim($sqlwhere) != '') { $sqlwhere = 'where ' . $sqlwhere; } //取出所有数据 $rpcres = sendrequest($rpcpbx->base_dbquery("select * from cdr " . $sqlwhere . " order by calldate desc limit " . $limit_from . ',' . $friconf['cols_in_page']), 0); // foreach ($rpcres['result_array'] as $key => $value) { if (trim($value['userfield']) != "") { $session = explode(",", $value['userfield']); $rpcres['result_array'][$key]['callsessionid'] = $session[0]; if (trim($value['uniqueid']) == "") { $rpcres['result_array'][$key]['uniqueid'] = $session[1]; } } } $smarty->assign("recordlist", $rpcres['result_array']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_statistical_main.tpl'); exit; }
function func_ivruserinput_edit() { global $smarty; global $rpcpbx; //不填绝对不行的 if (trim($_REQUEST['id']) == "" || preg_match("/[^0-9]/", $_REQUEST['id'])) { error_popbox(221, null, null, null, null, 'submit_failed'); } if (trim($_REQUEST['ivrnumber']) == "" || preg_match("/[^0-9]/", $_REQUEST['ivrnumber'])) { error_popbox(221, null, null, null, null, 'submit_failed'); } $smarty->assign("id", $_REQUEST['id']); $smarty->assign("ivrnumber", $_REQUEST['ivrnumber']); //取出来数据 $rpcres = sendrequest($rpcpbx->ivrmenu_get_ivruserinput($_REQUEST['id']), 0); $smarty->assign("userinput", $rpcres['resdata']); //取得数据产生IVR菜单表 $rpcres = sendrequest($rpcpbx->ivrmenu_list(), 0); $smarty->assign("ivrmenu_array", $rpcres['ivrmenu']); $ivrmenu_action_array = array(); foreach ($rpcres['ivrmenu'] as $key => $value) { //取得数据 $actres = sendrequest($rpcpbx->ivrmenu_list_action($value['ivrnumber']), 0); $ivrmenu_action_array[$key] = $actres['actions']; } $smarty->assign("ivrmenu_action_array", $ivrmenu_action_array); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/func_ivruserinput_edit.tpl'); }
function page_billing_stat() { global $smarty; global $rpcpbx; global $friconf; //取出费率 $rpcres = sendrequest($rpcpbx->billing_rule_list($_REQUEST['accountcode']), 0); $smarty->assign("rules", $rpcres['rules']); //测试找出可用月份 $avaliable_date = array(); for ($i = 1; $i <= 12; $i++) { $timestamp = strtotime("-" . $i . " month"); $rpcres = sendrequest($rpcpbx->base_dbquery("select id from billinginvoice where calldate >= '" . Date('Y-m', $timestamp) . "-01 00:00:00' and calldate <= '" . Date('Y-m', $timestamp) . "-31 23:59:59' limit 1"), 0); if ($rpcres['result_array'][0]) { array_push($avaliable_date, array('year' => Date('Y', $timestamp), 'month' => Date('m', $timestamp))); } else { #如果这个月没记录那之前一个月也会没记录,所以就不再检索(提高速度) break; } } $smarty->assign("invoice_date", $avaliable_date); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_billing_stat.tpl'); exit; }
function page_main_alert() { global $smarty; global $rpcpbx; global $friconf; //getall alert message //$rpcremote = new HproseHttpClient('http://www.fonoirs.com/usercenter/minable.php'); //$rpcremote->setTimeout(10); //$alertres = $rpcremote->get_mainpageinfo(); //if (!is_a($alertres, "PHPRPC_Error")) { // $smarty->assign("alertres",$alertres); //} //smarty_output('cpanel/page_main_alert.tpl'); $handle = @fopen("http://www.freeiris.org/cn/usercenter/minable.php?action=freeiris", "r"); if (!$handle) { exit; } stream_set_timeout($handle, 3); $content = stream_get_contents($handle); fclose($handle); $smarty->assign("minable", $content); smarty_output('cpanel/page_main_alert.tpl'); exit; }
function page_features_key() { global $smarty; global $rpcpbx; global $friconf; //取出features $rpcres = sendrequest($rpcpbx->features_hotkey_get('pickupexten'), 0); $smarty->assign("pickupexten", $rpcres['pickupexten']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('blindxfer'), 0); $smarty->assign("blindxfer", $rpcres['blindxfer']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('atxfer'), 0); $smarty->assign("atxfer", $rpcres['atxfer']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('parkcall'), 0); $smarty->assign("parkcall", $rpcres['parkcall']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('parkpos'), 0); $smarty->assign("parkpos", $rpcres['parkpos']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('fri2automon'), 0); $smarty->assign("fri2automon", $rpcres['fri2automon']); $rpcres = sendrequest($rpcpbx->features_hotkey_get('nway-start'), 0); $smarty->assign("nwaystart", $rpcres['nway-start']); //取出特殊featerus localnumber号码 $rpcres = sendrequest($rpcpbx->base_readconf('freeiris', 'freeiris.conf'), 0); $smarty->assign("voicemailmain", $rpcres['resdata']['voicemail']['voicemailmain']); //取出特殊features localnumber号码 $rpcres = sendrequest($rpcpbx->base_dbquery("select number from localnumber where assign like '" . 'agi://127.0.0.1/originate_diagnosis?%' . "'"), 1); $smarty->assign("originate_diagnosis", $rpcres['result_array'][0]['number']); //基本 $smarty->assign("res_admin", $_SESSION['res_admin']); smarty_output('cpanel/page_features_key.tpl'); exit; }