function sql_query($query = "", $transaction = FALSE) { // Remove any pre-existing queries unset($this->query_result); if ($query != "") { nt_common_add_debug($query); $this->num_queries++; $this->query_result = mysqli_query($this->db_connect_id, $query); } if ($this->query_result) { return $this->query_result; } else { return $transaction == 'END_TRANSACTION' ? true : false; } }
<?php require_once 'common.php'; require_once 'functions_tool_administration.php'; //if (!tool_admin_applications_check('tool_admin')) nt_common_redirect('index.php'); nt_common_add_debug('-- Starting on \'tool_administration.php\''); if (!isset($NELTOOL['GET_VARS']['toolmode'])) { $NELTOOL['GET_VARS']['toolmode'] = 'help'; } $tool_menu_item = tool_admin_menu_get_item_from_key($NELTOOL['GET_VARS']['toolmode']); $IE_CHECK = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'); $tpl->assign('tool_title', 'Administration / ' . $tool_menu_item['title']); $tpl->assign('tool_menu', tool_admin_menu_get_list($IE_CHECK)); //$tool_admin_menu); // defined in 'functions_tool_administration.php' switch ($NELTOOL['GET_VARS']['toolmode']) { case 'help': /* * ################################################################################################### * Help Admin * ################################################################################################### */ if ($IE_CHECK) { $tpl->assign('ie_check', true); } else { $tpl->assign('ie_check', false); } break; case 'logs': /* * ################################################################################################### * Logs Admin
<?php require_once 'common.php'; require_once 'functions_tool_notes.php'; if (!tool_admin_applications_check('tool_notes')) { nt_common_redirect('index.php'); } nt_common_add_debug('-- Starting on \'tool_notes.php\''); $tpl->assign('tool_title', "Notes"); if (tool_admin_applications_check('tool_notes_global')) { $tpl->assign('restriction_tool_notes_global', true); } if (isset($NELTOOL['GET_VARS']['note_id'])) { $note_id = $NELTOOL['GET_VARS']['note_id']; $tool_note_data = tool_notes_get_id($nel_user['user_id'], $note_id); $tpl->assign('tool_note_edit_data', $tool_note_data); } if (isset($NELTOOL['POST_VARS']['toolaction'])) { $tool_action = $NELTOOL['POST_VARS']['toolaction']; switch ($tool_action) { case 'create': $note_title = $NELTOOL['POST_VARS']['tool_form_note_title']; $note_data = $NELTOOL['POST_VARS']['tool_form_note_data']; $note_active = $NELTOOL['POST_VARS']['tool_form_note_active']; $note_global = isset($NELTOOL['POST_VARS']['tool_form_note_global']) ? $NELTOOL['POST_VARS']['tool_form_note_global'] : 0; $note_mode = $NELTOOL['POST_VARS']['tool_form_note_mode']; $note_uri = $NELTOOL['POST_VARS']['tool_form_note_popup_uri']; $note_restriction = $NELTOOL['POST_VARS']['tool_form_note_popup_restriction']; $tool_error = tool_notes_add($nel_user['user_id'], $note_title, $note_data, $note_active, $note_global, $note_mode, $note_uri, $note_restriction); if ($tool_error != "") { $tpl->assign('tool_alert_message', $tool_error);
function invokeError($methodName, $errorString) { global $tpl; nt_common_add_debug("AS Error in '{$methodName}' : {$errorString}"); $tpl->assign('tool_as_error', "AS Error in '{$methodName}' : {$errorString}"); }
function tool_las_read_file($filename, $max_lines, $line_start, &$line_previous, &$line_next) { $data = null; $line_previous = $line_start - $max_lines; $line_next = $line_start + $max_lines; if ($line_previous < 0) { $line_previous = -1; } $lines_read = 0; if ($fp = fopen($filename, 'r')) { // skip lines up to $line_start for ($i = 0; $i < $line_start; ++$i) { fgets($fp); } for ($i = 0; $i < $max_lines; ++$i) { $tmp = fgets($fp); if ($tmp) { $tmp = trim($tmp); if ($tmp != '') { $data[] = $tmp; } $lines_read++; } else { break; } } fclose($fp); } if ($lines_read < $max_lines) { $line_next = -1; } nt_common_add_debug("tool_las_read_file() : " . $max_lines . " - " . $line_start . " - " . $line_previous . " - " . $line_next); return $data; }
$view_forum_data = tool_gl_parse_forum_view($view_forum_data_raw); if (is_array($view_forum_data)) { $tpl->assign('tool_guild_forums', $view_forum_data); } else { $tpl->assign('tool_guild_forums_error', $view_forum_data); } } } } break; } } if (isset($NELTOOL['GET_VARS']['eid'])) { $locate_eid = $NELTOOL['GET_VARS']['eid']; } $status = $adminService->getStates(); nt_common_add_debug($status); $domainServices = tool_main_parse_status($status); $filteredServices = array(); reset($domainServices); foreach ($domainServices as $aKey => $aService) { // we are only interested in EGS if ($aService['ShortName'] == 'EGS') { $filteredServices[] = $aService; } } $tpl->assign('tool_services_list', $filteredServices); } } } $tpl->display('tool_guild_locator.tpl');
$adminService = new MyAdminService(); if (@$adminService->connect($AS_Host, $AS_Port, $res) === false) { nt_common_add_debug($res); $tpl->assign('tool_domain_error', $res); } else { $now = time(); $rrd_webs = array(); reset($rrd_values); foreach ($rrd_values as $rrd_value) { nt_common_add_debug(" getHighRezGraph : " . $tool_selected_variable_data['service'] . "." . $tool_selected_variable_data['variable'] . " , " . ($now - $rrd_value[0] / 1000) . " , " . $now . " , " . $rrd_value[1]); $tmp = $adminService->getHighRezGraph($tool_selected_variable_data['service'] . '.' . $tool_selected_variable_data['variable'], $now - $rrd_value[0] / 1000, $now, $rrd_value[1]); //nt_common_add_debug(" getHighRezGraph : ". $tool_selected_variable_data['service'] .".". $tool_selected_variable_data['variable'] ." , ". ($rrd_value[0] / 1000) ." , 0 , 0"); //$tmp = $adminService->getHighRezGraph($tool_selected_variable_data['service'] .'.'. $tool_selected_variable_data['variable'], ($rrd_value[0] / 1000), 0, 0); nt_common_add_debug($tmp); $mean_values = tool_graphs_extract_mean_values($tmp); nt_common_add_debug($mean_values); if (sizeof($mean_values['val'])) { $graph = new Graph(480, 160); $graph->SetMargin(35, 10, 5, 25); // left - right - top - bottom // Now specify the X-scale explicit but let the Y-scale be auto-scaled //$graph->SetScale("intlin",0,0,$adjstart,$adjend); $graph->SetScale("intlin"); // display grids $graph->xgrid->Show(true, true); $graph->ygrid->Show(true, true); //$graph->SetGridDepth(DEPTH_FRONT); // Setup the callback and adjust the angle of the labels $graph->xaxis->SetLabelFormatCallback('tool_graphs_xaxis_callback'); //$graph->xaxis->title->Set("ms."); //$graph->xaxis->SetLabelAngle(90);
<?php require_once 'common.php'; require_once 'functions_tool_main.php'; nt_common_add_debug('-- Starting on \'tool_actions.php\''); if (!tool_admin_applications_check('tool_actions')) { nt_common_redirect('index.php'); } $tpl->assign('tool_title', "Actions"); $tpl->display('tool_actions.tpl');
$tpl->assign('tool_shard_orders', $shardRunOrders); $tpl->assign('tool_shard_su_name', tool_main_get_su_from_status($domainServices)); $tpl->assign('tool_shard_infos', $shardInfos); $tpl->assign('tool_shard_ws_states', array('close', 'dev', 'restricted', 'open')); if (isset($shardInfos[$AS_InternalName])) { $tpl->assign('tool_restart_ws_state', $shardInfos[$AS_InternalName]['state']); } if (isset($tool_restart_stop_list) && isset($tool_restart_info) && tool_admin_applications_check('tool_main_easy_restart')) { // lets get a list of services for each group $tool_restart_start_group_list = tool_main_get_restart_services($AS_InternalName, $domainServices, $tool_restart_start_list); $tpl->assign('tool_restart_start_actions', $tool_restart_start_group_list); $tool_restart_stop_group_list = tool_main_get_all_restart_services($tool_restart_start_group_list); $tpl->assign('tool_restart_stop_actions', $tool_restart_stop_group_list); // get the shard id $tool_restart_shard_id = tool_main_get_shardid_from_status($domainServices, $AS_InternalName); $tpl->assign('tool_restart_shard_id', $tool_restart_shard_id); // find the shard egs for broadcasts $tool_restart_egs_name = tool_main_get_egs_from_status($domainServices, $AS_InternalName); $tpl->assign('tool_restart_egs_name', $tool_restart_egs_name); } } $tool_hd_list = tool_main_get_hd_data_for_domain($view_domain_id); nt_common_add_debug($tool_hd_list); $tpl->assign('tool_hd_list', $tool_hd_list); $tpl->assign('tool_hd_time', tool_main_get_last_hd_time_for_domain($view_domain_id)); } //else //{ // nt_common_add_debug('invalid host/port!'); //} $tpl->display('index.tpl');
$nel_user['has_lock'] = false; //nt_common_add_debug($nel_user); // load the user application menu $tool_application_list = tool_admin_applications_build_menu_list($nel_user['access']); $tpl->assign('nel_menu', $tool_application_list); $tpl->assign('menu_style', $nel_user['user_menu_style']); $tpl->assign('unknown_menu', 'imgs/icon_unknown.png'); if (isset($nel_user['new_login'])) { $default_user_application_id = 0; if ($nel_user['user_default_application_id'] > 0) { $default_user_application_id = $nel_user['user_default_application_id']; } elseif ($nel_user['group_default_application_id'] > 0) { $default_user_application_id = $nel_user['group_default_application_id']; } if ($default_user_application_id > 0) { nt_common_add_debug("default application : user:"******" group:" . $nel_user['group_default_application_id']); $default_user_application_data = tool_admin_applications_get_default($tool_application_list, $default_user_application_id); nt_common_redirect($default_user_application_data['application_uri']); exit; } } $nel_tool_extra_css = ''; if (BG_IMG !== null) { $nel_tool_extra_css .= "<style><!--\n"; $nel_tool_extra_css .= "body { background: url(" . BG_IMG . "); }\n"; $nel_tool_extra_css .= "--></style>\n"; } $tpl->assign('nel_tool_extra_css', $nel_tool_extra_css); $tpl->assign('system_time', time()); nt_common_add_debug('-- Common init. complete.'); }
function nt_common_assert($script, $line, $message) { nt_common_add_debug('ASSERT (' . $script . ':' . $line . ') : ' . ereg_replace('^.*//\\*', '', $message)); //exit; }
function tool_gl_view_forum($host, $shard, $guild, $thread = null, $recover = null) { $ch = curl_init(); if (trim($host) == "") { return "No MFS Web Host Configured for this domain!"; } $url = "http://" . $host . "/admin.php"; $uri_params = 'user_login=support'; $uri_params .= '&shard=' . $shard; $uri_params .= '&forum=' . $guild; if ($thread !== null && $recover === null) { $uri_params .= '&thread=' . $thread; } elseif ($recover !== null && $thread !== null) { $uri_params .= '&recover_thread=' . $guild; $uri_params .= '&recover_threadthread=' . $thread; } nt_common_add_debug("curling '{$url}' with '{$uri_params}'"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $uri_params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 0 = debug , 1 = normal curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // 0 = debug , 1 = normal curl_setopt($ch, CURLOPT_NOPROGRESS, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_HEADER, 1); // has to be 1 due to using redirections curl_setopt($ch, CURLOPT_TIMEOUT, 120); ob_start(); $curlOutput = curl_exec($ch); ob_end_clean(); $curlError = curl_errno($ch); if ($curlError != 0) { $outp = "CURL Error [ {$curlError} ] : " . curl_error($ch); } else { $curlData = tool_gl_CurlParseResponse($curlOutput); $outp = $curlData[2]; } curl_close($ch); return $outp; }
function tool_graphs_get_list($dir, $shard_match) { $data = array(); if (substr($dir, -1) != '/') { $dir .= '/'; } if (is_dir($dir)) { if ($handle = opendir($dir)) { //fes_arispotle_01.NetSpeedLoop.hrd //egs_arispotle.TickSpeedLoop.hrd $my_ereg = "^([^_]+_(" . $shard_match . ")(_[^\\ \\.])?)\\.([^\\ ]+)\\.([hr])rd\$"; $my_ereg = "^([^_]+_(" . $shard_match . ")(_[^\\ \\.])?)\\.([^\\ ]+)\\.rrd\$"; $my_ereg = "^([^_]+(_[^_]+)?_(" . $shard_match . ")(_[^\\ \\.])?)\\.([^.]+)\\.rrd\$"; //nt_common_add_debug($my_ereg); // 0: complete file name // 1: service alias (eg. fes_arispotle_01) // 2: n/a // 3: shard (eg. arispotle) // 4: n/a // 5: variable (eg. NetSpeedLoop) // 6: graph type, h/r : high/low (removed) while (($file = readdir($handle)) !== false) { if ($file != '.' && $file != '..') { //nt_common_add_debug("checking : ". $file); if (ereg($my_ereg, $file, $params)) { $high_file = str_replace('.rrd', '.hrd', $file); if (!file_exists($dir . $high_file)) { $high_file = ''; } //nt_common_add_debug($params); $tmp = array('low_file' => $params[0], 'high_file' => $high_file, 'service' => $params[1], 'shard' => $params[3], 'variable' => $params[5]); $data[$params[5]][] = $tmp; } } } closedir($handle); } } nt_common_add_debug(array(array_keys($data), $data)); return array('variables' => array_keys($data), 'datas' => $data); }