function view($VAR) { $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }
function popup($VAR) { $this->newsletter_construct(); $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }
function user_view($VAR) { # Check that the correct account owns this billing record $dbx =& DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'account_billing WHERE id = ' . $dbx->qstr(@$VAR['id']) . ' AND account_id = ' . $dbx->qstr(SESS_ACCOUNT) . ' AND site_id = ' . $dbx->qstr(DEFAULT_SITE); $rs = $dbx->Execute($sql); if (@$rs->RecordCount() == 0) { return false; } $this->construct(); $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }
function view($VAR) { $this->static_page_category_construct(); $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }
function view($VAR) { $this->constructor(); $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }
function view($VAR) { global $smarty, $C_auth; $this->construct(); $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $smart = $db->view($VAR, $this, $type); $dbm = new CORE_database(); $db =& DB(); # Add the change recur schedule options to the array: for ($i = 0; $i < count($smart); $i++) { # get recent invoice details for this service $p = AGILE_DB_PREFIX; $sql = "SELECT A.id, A.date_orig, A.total_amt, A.billed_amt, A.process_status \n \t\t\t\t\t\tFROM {$p}invoice A\n \t\t\t\t\t\tWHERE A.site_id = " . DEFAULT_SITE . "\n \t\t\t\t\t\tAND\n \t\t\t\t\t\t( \n \t\t\t\t\t\t A.id={$smart[$i]['invoice_id']}\n \t\t\t\t\t\tOR\n \t\t\t\t\t\t A.id in (select distinct invoice_id from {$p}invoice_item where \n \t\t\t\t\t\t service_id={$smart[$i]['id']} )\n \t\t\t\t\t\t) \t\t\n \t\tORDER BY A.id DESC "; # Joe rewrote the query, its dog slow $sql = "SELECT A.id, A.date_orig, A.total_amt, A.billed_amt, A.process_status \n\t\t\t\tFROM {$p}invoice_item B inner join {$p}invoice A on\n\t\t\t\t(B.invoice_id=A.id and service_id={$smart[$i]['id']}) \n\t\t\t\tWHERE A.site_id = " . DEFAULT_SITE . " AND B.site_id = " . DEFAULT_SITE . " \n\t\t\t\tORDER BY A.id DESC"; $inv = $db->SelectLimit($sql, 5); if ($inv != false && $inv->RecordCount() > 0) { while (!$inv->EOF) { if ($inv->fields['total_amt'] > $inv->fields['billed_amt'] && $inv->fields['suspend_billing'] != 1) { $inv->fields['due'] = $inv->fields['total_amt'] - $inv->fields['billed_amt']; } $smart[$i]["invoice"][] = $inv->fields; $inv->MoveNext(); } } # allow modification of service plan? if (!empty($VAR['user']) && !empty($smart[$i]['product_id'])) { } elseif (empty($VAR['user'])) { } else { $smart[$i]['recur_modify'] = "0"; } # get recurring details? if (!empty($VAR['user']) && $smart[$i]['recur_schedule_change'] == 1 && !empty($smart[$i]['product_id'])) { $do = true; } elseif (empty($VAR['user']) && !empty($smart[$i]['product_id'])) { $do = true; } else { $do = false; } if ($do && $smart[$i]['date_next_invoice'] > 0 && !empty($smart[$i]['product_id'])) { # Get the product details: $sql = $dbm->sql_select('product', '*', "id = {$smart[$i]['product_id']}", '', $db); $prod = $db->Execute($sql); $fields = $prod->fields; global $C_auth; $g_ar = unserialize($fields["price_group"]); if (is_array($g_arr)) { foreach ($g_ar as $period => $price_arr) { foreach ($price_arr as $group => $vals) { if (@$price_arr["show"] == "1") { if (is_numeric($group) && $C_auth->auth_group_by_account_id($smart[$i]['account_id'], $group)) { if ($vals["price_base"] != "" && $vals["price_base"] > 0) { if (empty($ret[$period]['base']) || $vals["price_base"] < $ret[$period]['base']) { $ret[$period]['base'] = $vals["price_base"]; } } } } } } } if (!is_array($ret)) { if (!empty($VAR['user'])) { $ret["{$smart[$i]["recur_schedule"]}"]["base"] = $smart[$i]["price"]; $smarty->assign('recur_price', $ret); } else { $smarty->assign('recur_price', false); } } else { $smarty->assign('recur_price', $ret); } } else { $smarty->assign('recur_price', false); } } $smarty->clear_assign('service'); $smarty->assign('service', $smart); }
function view($VAR) { global $smarty; $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $dx = new CORE_database(); $rs = $dx->view($VAR, $this, $type); # get the list of available servers to define as "next server" $db =& DB(); $sql = 'SELECT id,name FROM ' . AGILE_DB_PREFIX . 'host_server WHERE id != ' . $db->qstr($rs[0]['id']) . ' AND next_host_server_id != ' . $db->qstr($rs[0]['id']) . ' AND provision_plugin = ' . $db->qstr($rs[0]['provision_plugin']) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); if (@$rs->RecordCount() > 0) { $arr[0] = ''; while (!$rs->EOF) { $arr[$rs->fields['id']] = $rs->fields['name']; $rs->MoveNext(); } $smarty->assign('next_server_options', $arr); $smarty->assign('next_server', true); } else { $smarty->assign('next_server', false); } }
function view($VAR) { $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); ################################################# # Get the data for each affiliate plugin: global $C_translate, $smarty; $id = @$VAR['id']; $path = PATH_PLUGINS . '/affiliate/'; $pre = ''; $ext = '.php'; $count = 0; chdir($path); $dir = opendir($path); while ($file_name = readdir($dir)) { $display = true; if ($file_name != '..' && $file_name != '.') { if (!empty($ext)) { $cute = preg_replace('@' . $ext . '$@', "", $file_name); if (!preg_match('@' . $ext . '$@', $file_name)) { $display = false; } } if (!empty($pre)) { $cute = preg_replace('@^' . $pre . '@', "", $cute); if (!preg_match('@^' . $pre . '@', $file_name)) { $display = false; } } if ($display) { $name = $cute; if ($arr_count = $this->plugin_affiliate_list($cute, $id)) { $count = count($arr_count); } else { $count = 0; } $cute = preg_replace("/_/", " ", $cute); $cute = preg_replace("/-/", " ", $cute); $smart[] = array('name' => $cute, 'plugin' => $name, 'count' => $count); $count++; } } } $smarty->assign('plugindata', $smart); }
function view($VAR) { ### Check that user is logged in: if (SESS_LOGGED != '1') { echo "Sorry, you must be logged in!"; return false; } $this->account_construct(); /* check for sub account */ if (!empty($VAR['id']) && $VAR['id'] != SESS_ACCOUNT) { if ($this->isParentAccount($VAR['id'])) { $VAR['account_id'] = $VAR['id']; global $smarty; $smarty->assign('issubaccount', true); } else { return false; } } else { $VAR['id'] = SESS_ACCOUNT; $VAR['account_id'] = SESS_ACCOUNT; } ### Retrieve the record: $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); ### Get the static vars: global $smarty; require_once PATH_CORE . 'static_var.inc.php'; $static_var = new CORE_static_var(); $arr = $static_var->update_form('account', 'update', SESS_ACCOUNT); if (gettype($arr) == 'array') { $smarty->assign('static_var', $arr); } else { $smarty->assign('static_var', false); } /* get child accounts */ if (empty($smarty->_tpl_vars['account'][0]['parent_id']) || $smarty->_tpl_vars['account'][0]['parent_id'] == $smarty->_tpl_vars['account'][0]['id']) { $db =& DB(); $rs = $db->Execute(sqlSelect($db, "account", "id,first_name,last_name,email,username", "parent_id=" . $db->qstr(SESS_ACCOUNT))); if ($rs && $rs->RecordCount()) { while (!$rs->EOF) { $smart[] = $rs->fields; $rs->MoveNext(); } $smarty->assign('subaccount', $smart); } } }
function view($VAR) { $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); ### Get the static vars: global $smarty; require_once PATH_CORE . 'static_var.inc.php'; $static_var = new CORE_static_var(); $ids = explode(',', $VAR['id']); $arr = $static_var->update_form($this->module, 'update', $ids[0]); if (gettype($arr) == 'array') { $smarty->assign('static_var', $arr); } else { $smarty->assign('static_var', false); } }
function view($VAR) { global $smarty; $this->construct(); $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); ### Define the group mapping.... $id = @$VAR['id']; ### Get the variables for this map plugin: $db =& DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'db_mapping WHERE id = ' . $db->qstr(@$VAR["id"]) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $result = $db->Execute($sql); ### error reporting: if ($result === false) { global $C_debug; $C_debug->error('db_mapping.inc.php', 'view', $db->ErrorMsg()); return; } $file = $result->fields['map_file']; $group_map = $result->fields['group_map']; if ($group_map != '') { $group_map = unserialize($group_map); } else { $group_map = array(); } if ($file != '') { include_once PATH_PLUGINS . 'db_mapping/' . $file . '.php'; eval('$_MAP = new map_' . strtoupper($file) . ';'); ### If this map type is 'db' groups based: if ($_MAP->map['group_type'] == 'db' || $_MAP->map['group_type'] == 'db-status') { ### Connect to the DB & get the groups: $dbm = new db_mapping(); $db = $dbm->DB_connect($id, 'false'); eval('@$db_prefix = DB2_PREFIX' . strtoupper($file) . ';'); $sql = "SELECT * FROM " . $db_prefix . "" . $_MAP->map['group_map']['table'] . "\n\t\t\t\t\t\t\t ORDER BY " . $_MAP->map['group_map']['name']; $db2 = $db->Execute($sql); if ($db2 === false) { global $C_debug; $C_debug->error('db_mapping.inc.php', 'view', $db->ErrorMsg()); $smarty->assign('db_mapping_result', $db->ErrorMsg()); return; } ### get the remote groups... if ($db2->RecordCount() > 0) { $i = 0; while (!$db2->EOF) { $smart[$i]['id'] = $db2->fields[$_MAP->map['group_map']['id']]; $smart[$i]['name'] = $db2->fields[$_MAP->map['group_map']['name']]; $db2->MoveNext(); $i++; } ### Get the local groups: $db =& DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'group WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' ORDER BY name'; $groups = $db->Execute($sql); if ($groups === false) { global $C_debug; $C_debug->error('db_mapping.inc.php', 'view', $db->ErrorMsg()); return; } if ($groups->RecordCount() > 0) { $i = 0; while (!$groups->EOF) { $id = $groups->fields['id']; $smartgr[$i]['id'] = $groups->fields['id']; $smartgr[$i]['name'] = $groups->fields['name']; for ($ii = 0; $ii < count($smart); $ii++) { $rid = $smart[$ii]['id']; $name = $smart[$ii]['name']; $checked = false; if (isset($group_map[$id][$rid]) && $group_map[$id][$rid] != false) { $checked = true; } $smartgr[$i]['remote'][$ii]['id'] = $rid; $smartgr[$i]['remote'][$ii]['name'] = $name; $smartgr[$i]['remote'][$ii]['check'] = $checked; } $groups->MoveNext(); $i++; } ### Define smarty vars $smarty->assign('db_mapping_result', false); $smarty->assign('db_mapping_template', 'db_mapping:group_map_' . $_MAP->map['group_type']); $smarty->assign('db_mapping_groups', $smartgr); } else { global $C_translate; $message = $C_translate->translate('no_local_groups', 'db_mapping', ''); $smarty->assign('db_mapping_result', $message); } } else { global $C_translate; $message = $C_translate->translate('no_remote_groups', 'db_mapping', ''); $smarty->assign('db_mapping_result', $message); } } elseif ($_MAP->map['group_type'] == 'status') { ### This is at 'status' based database map ### Get the local groups: $db =& DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'group WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' ORDER BY name'; $groups = $db->Execute($sql); ### error reporting: if ($groups === false) { global $C_debug; $C_debug->error('db_mapping.inc.php', 'view', $db->ErrorMsg()); return; } if ($groups->RecordCount() > 0) { $i = 0; while (!$groups->EOF) { $id = $groups->fields['id']; $smart[$i]['id'] = $groups->fields['id']; $smart[$i]['name'] = $groups->fields['name']; @($smart[$i]['value'] = $group_map[$id]); $groups->MoveNext(); $i++; } } ### Assign the smarty vars: $smarty->assign('db_mapping_result', false); $smarty->assign('db_mapping_template', 'db_mapping:group_map_status'); $smarty->assign('db_mapping_groups', $smart); } else { ### No group mapping for this database map global $C_translate; $message = $C_translate->translate('no_group_mapping', 'db_mapping', ''); $smarty->assign('db_mapping_result', $message); } } else { global $C_translate; $message = $C_translate->translate('file_error', 'db_mapping', ''); $smarty->assign('db_mapping_result', $message); } }
function view($VAR) { global $smarty; $type = "view"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $smart = $db->view($VAR, $this, $type); # echo "<pre>".print_r($smart,true)."</pre>"; $db =& DB(); $rs = $db->Execute(sqlSelect($db, "voip_sip", "*", "sip=::" . $smart[0]['did'] . "::")); while (!$rs->EOF) { $smarty->assign('sip_' . $rs->fields['keyword'], $rs->fields['data']); $rs->MoveNext(); } $sip_canreinvite_options['yes'] = 'Yes'; $sip_canreinvite_options['no'] = 'No'; $sip_canreinvite_options['update'] = 'Update'; $smarty->assign('sip_canreinvite_options', $sip_canreinvite_options); $sip_dtmfmode_options['info'] = 'Info'; $sip_dtmfmode_options['rfc2833'] = 'RFC 2833'; $sip_dtmfmode_options['inband'] = 'In-band Audio'; $smarty->assign('sip_dtmfmode_options', $sip_dtmfmode_options); $sip_nat_options['yes'] = 'Yes'; $sip_nat_options['no'] = 'No'; $sip_nat_options['always'] = 'Always'; $smarty->assign('sip_nat_options', $sip_nat_options); }
function affiliate($VAR) { $type = "view"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->view($VAR, $this, $type); }