$smarty->compile_dir = $g_smarty_folder . 'templates_c';
$smarty->cache_dir = $g_smarty_folder . 'cache';
$smarty->config_dir = $g_smarty_folder . 'configs';
// Application Variables
$g_app_name = "Asterisk Voicemail for iPhone";
$g_app_version = "0.11";
$smarty->assign('app_name', $g_app_name);
$smarty->assign('app_version', $g_app_version);
// Session
$s_mailbox = "";
doSessionCheck($s_mailbox);
$smarty->assign('mailbox', $s_mailbox);
$smarty->assign('mailbox_formatted', format_phone($s_mailbox));
// Security for Media
$secret_key = md5($_SERVER['REMOTE_ADDR'] . $g_secret_salt);
$smarty->assign('secret_key', $secret_key);
// Get messages (into an array)
$arr_messages_inbox = GetMessageArray("INBOX", $s_mailbox);
$arr_messages_old = GetMessageArray("Old", $s_mailbox);
$smarty->assign('messages_inbox', $arr_messages_inbox);
$smarty->assign('messages_old', $arr_messages_old);
// Get Settings Screen info
$c_settings = GetSettings($s_mailbox);
$smarty->assign('c_settings', $c_settings);
// Check for updates
if ($g_check_for_updates != false) {
    $current_version = doCheckVersion($g_app_version);
    $smarty->assign('current_version', $current_version);
}
// Display the smarty template
$smarty->display($g_smarty_template_folder . 'main.tpl');
예제 #2
0
파일: api.php 프로젝트: ralexandru/NagiosTV
        $sql .= "WHERE current_state <> 0 AND ";
        $sql .= "(problem_has_been_acknowledged = 1 OR notifications_enabled = 0) ";
        //if (is_numeric($lastid)) $sql .= "AND (servicestatus_id > ".$lastid.") ";
        $sql .= "ORDER BY problem_has_been_acknowledged DESC, status_update_time ";
        $sql .= "DESC LIMIT 500;";
        break;
    case "history":
        $sql = "SELECT n.*, o.name1, o.name2 FROM nagios_notifications n ";
        $sql .= "INNER JOIN nagios_objects o ON n.object_id=o.object_id ";
        if (is_numeric($lastid)) {
            $sql .= "WHERE (notification_id > " . $lastid . ") ";
        }
        $sql .= "ORDER BY start_time DESC LIMIT " . $maxcount . ";";
        break;
    case "versioncheck":
        $latest_version = doCheckVersion($client_version);
        $json_version = array('version' => $latest_version);
        print json_encode($json_version);
        exit;
        break;
    default:
        $fail = array('OK' => 0, 'ERROR' => 'Bad Request');
        print json_encode($fail);
        exit;
        break;
}
// Prep Database
$my_db = new DB();
$my_db->construct($g_db_host, $g_db_name, $g_db_user, $g_db_pass);
$my_db->connect();
$my_db->select();