Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('fax_active_view')) { //access granted } else { echo "access denied"; exit; } if ((!permission_exists('fax_active_all')) && ($show == 'all')) { echo "access denied"; exit; } $fax_uuid = false; if(isset($_REQUEST['id'])) { $fax_uuid = check_str($_REQUEST["id"]); } //add multi-lingual support $language = new text; $text = $language->get(); //get the HTTP values and set as variables $show = trim($_REQUEST["show"]); if ($show != "all") { $show = ''; } //include theme config for button images include_once("themes/".$_SESSION['domain']['template']['name']."/config.php"); $where = 'where (1 = 1)'; if($show !== 'all'){ $where .= 'and (t3.domain_name = \'' . check_str($_SESSION['domain_name']) . '\')'; } else if($fax_uuid){ if(!permission_exists('fax_active_all')){ $where .= 'and (t3.domain_name = \'' . check_str($_SESSION['domain_name']) . '\')'; } $where .= 'and (t1.fax_uuid =\'' . check_str($fax_uuid) . '\')'; } $sql = <<prepare(check_sql($sql)); if ($prep_statement) { if($prep_statement->execute()) { $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); } } unset($prep_statement, $sql, $where); //if the connnection is available then run it and return the results if ($result === false) { var_dump($db->errorInfo()); $msg = "
".$text['message-fail']."
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } else { //define js function call var $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; //show buttons echo ""; echo " "; echo " "; echo " "; echo " "; echo "
"; echo " \"".$text['label-refresh_pause']."\""; echo " "; if (permission_exists('fax_active_all')) { if ($show == "all") { echo " \n"; } else { echo " \n"; } } echo "
"; // show title echo "".$text['fax-active_title'].""; echo "

\n"; echo $text['fax-active_description']."\n"; echo "

\n"; //set the alternating color for each row $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //show the results echo "
\n"; //show headers echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; foreach ($result as &$row) { $fax_uri = $row['uri']; $domain_name = $row['domain_name']; $task_enabled = ($row['interrupted'] == 'true') ? 'Disable': 'Enable'; $task_status = $text['fax-active_status_wait']; $task_next_time = $row['next_time']; if($row['status'] > 0){ if($row['status'] <= 3){ $task_status = $text['fax-active_status_execute']; } else if($row['status'] == 10){ $task_status = $text['fax-active_status_success']; } else{ $task_status = $text['fax-active_status_fail']; } } $fax_server = $row['fax_server_name']; if ($show == 'all') { $fax_server .= '@' . $domain_name; } $task_files = ''; if(!empty($row['fax_file'])){ $task_files .= ' ' . basename($row['fax_file']); } if(!empty($row['wav_file'])){ $task_files .= '
 ' . basename($row['wav_file']); } else if(!empty($row['greeting'])){ $task_files .= '
 ' . basename($row['greeting']); } //replace gateway uuid with name if (sizeof($_SESSION['gateways']) > 0) { foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) { $fax_uri = str_replace($gateway_uuid, $gateway_name, $fax_uri); } } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = ($c) ? 0 : 1; } echo "\n"; echo "\n"; echo "
" . $text['fax-active_title_fax_server'] . "" . $text['fax-active_title_enabled'] . "" . $text['fax-active_title_status'] . "" . $text['fax-active_title_next_time'] . "" . $text['fax-active_title_files'] . "" . $text['fax-active_title_uri'] . "
" . $fax_server . " " . $task_enabled . " " . $task_status . " " . $task_next_time . " " . $task_files . " " . $fax_uri . " ".$v_link_label_delete."
\n"; } ?>