/**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer(['main', 'main_wo_header_nav', 'category_items'], function ($view) {
         $this->user_session = validate_session();
         //fetch all the categories
         $arrCategory = DB::table('category_master')->get();
         //fetch all the item types
         $arrType = DB::table('type_master')->get();
         foreach ($arrCategory as $key => $category) {
             foreach ($arrType as $key1 => $type) {
                 if ($type->category == $category->cat_id) {
                     $arrTypeCategoryWise[$category->cat_id][] = $type;
                 }
             }
         }
         //get category id versus category name array
         $arrCetegory_id_name = getKeyValueArray('cat_id', 'name', $arrCategory, 'object');
         $arrType_id_name = getKeyValueArray('type_id', 'name', $arrType, 'object');
         //get cart items count
         if ($this->user_session->is_logged_in) {
             $user_id = $this->user_session->user_id;
         } else {
             $user_id = null;
         }
         //get cart details
         if ($this->user_session->is_logged_in) {
             $count_cart = DB::connection('mongodb')->collection('cart')->where('user_id', $user_id)->orWhere('session_id', session_id())->count();
         } else {
             $count_cart = DB::connection('mongodb')->collection('cart')->where('session_id', session_id())->count();
         }
         $view->with(compact('count_cart', 'arrTypeCategoryWise', 'arrCategory', 'arrType', 'arrCetegory_id_name', 'arrType_id_name'));
     });
 }
 function __construct()
 {
     session_start();
     $this->user_session = validate_session();
     $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
     $web_root = $protocol . $_SERVER['HTTP_HOST'];
     define('WEB_ROOT', $web_root);
     define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']);
 }
function &login()
{
    // Check if there is still a valid session
    validate_session(true);
    // Create the HTML array and initialize values
    $HTML = array();
    $HTML['email'] = '';
    $HTML['datepicker'] = '';
    $HTML['login_error'] = '';
    // Check if it was a page load or a submission
    if (getRequest('submitted', true, 'post') !== 'yes') {
        return $HTML;
    }
    // It was a page load so get the post values
    foreach ($HTML as $key => &$value) {
        $value = getRequest($key, true, 'post');
    }
    // Validate the email and password
    $date = explode('-', $HTML['datepicker']);
    if (empty($HTML['email'])) {
        $HTML['login_error'] = 'Email Cannot be empty';
    } elseif (empty($HTML['datepicker'])) {
        $HTML['login_error'] = 'Date of birth cannot be empty';
    } elseif (filter_var($HTML['email'], FILTER_VALIDATE_EMAIL) === false) {
        $HTML['login_error'] = 'Invalid Email Address';
    } else {
        // The datepicker makes sure it is a valid date
        // But should still check incase someone scripts a request
        if (count($date) != 3 or !checkdate(intval($date[0]), intval($date[1]), intval($date[2]))) {
            $HTML['login_error'] = "Invalid Date";
        }
    }
    // If no errors, set session variable and go to account
    if (empty($HTML['login_error'])) {
        // Create a database record
        if (empty($GLOBALS['DB'])) {
            die('Database Link is not set');
        }
        $query = sprintf('INSERT INTO project (email, dob, ipaddr) VALUES (\'%s\',\'%s\',\'%s\')', mysql_real_escape_string($HTML['email']), mysql_real_escape_string($date[2] . '-' . $date[0] . '-' . $date[1]), mysql_real_escape_string(util_getenv('REMOTE_ADDR')));
        $result = mysql_query($query);
        // Make sure it executed properly
        if (!$result) {
            $HTML['login_error'] = 'Database Error. Please try again later';
            return $HTML;
        }
        set_SESSION('dob', $HTML['datepicker']);
        set_header('app');
        exit;
    }
    // There were errors so load the login page again with errors
    return $HTML;
}
Exemple #4
0
function start_session($conn)
{
    //DEBUG
    //END DEBUG
    $userAgent = $_SERVER['HTTP_USER_AGENT'];
    $time = time();
    if (!isset($_COOKIE['token'])) {
        $workerId = $_GET['workerId'];
        $assignmentId = $_GET['assignmentId'];
        $timeExpire = $time + 3600;
        $turkSubmitTo = $_GET['turkSubmitTo'];
        $token = create_token($workerId, $userAgent, $time);
        set_app_cookies($token, $workerId, $turkSubmitTo, $timeExpire);
        store_session($conn, $assignmentId, $workerId, $timeExpire, $time, $userAgent, $token);
    } else {
        $truth = validate_session($conn, $_COOKIE['token'], $_COOKIE['workerId'], $userAgent);
        if (!$truth) {
            //GOTO FAIL
            echo 'failed';
            header('Location: /gotofail.html');
        }
    }
}
function login_sequence($link, $login_form = 0)
{
    $_SESSION["prefs_cache"] = false;
    if (SINGLE_USER_MODE) {
        authenticate_user($link, "admin", null);
        cache_prefs($link);
        load_user_plugins($link, $_SESSION["uid"]);
    } else {
        if (!$_SESSION["uid"] || !validate_session($link)) {
            if (AUTH_AUTO_LOGIN && authenticate_user($link, null, null)) {
                $_SESSION["ref_schema_version"] = get_schema_version($link, true);
            } else {
                authenticate_user($link, null, null, true);
            }
            if (!$_SESSION["uid"]) {
                render_login_form($link, $login_form);
            }
        } else {
            /* bump login timestamp */
            db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]);
        }
        if ($_SESSION["uid"] && $_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
            setcookie("ttrss_lang", $_SESSION["language"], time() + SESSION_COOKIE_LIFETIME);
        }
        if ($_SESSION["uid"]) {
            cache_prefs($link);
            load_user_plugins($link, $_SESSION["uid"]);
        }
    }
}
Exemple #6
0
              name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
              var regexS = "[\\?&]" + name + "=([^&#]*)";
              var regex = new RegExp(regexS);
              var results = regex.exec(window.location.search);
              if(results == null)
                return "";
              else
                return decodeURIComponent(results[1].replace(/\+/g, " "));
            }
    </script>
    </head>
  <body>

<?php 
// Logged in?
if ($_SESSION["uid"] && validate_session()) {
    ?>
    <!-- Show form -->
    <form id="gritttt-form" method="post" action="">
        <div id="gritttt-logo">
            <a href="http://gritttt-rss.nicolashoening.de/" target="_blank">
                <img src="./gritttt-logo.png" alt="Go to Home of Gritttt" title="Go to Home of Gritttt"/>
            </a>
        </div>
        <div id="gritttt-heading">Share this page in your tt-rss:</div> 
        <br/>
        <input id="gritttt-url" name="gritttt-url" type="hidden" size="40" name="url"></input>
        <div id="gritttt-row-title">
            <label for="gritttt-title">Title:</label>
            <input id="gritttt-title" name="gritttt-title" type="text" size="60" name="title"></input>
        </div>
Exemple #7
0
function login_sequence($link, $mobile = false)
{
    if (!SINGLE_USER_MODE) {
        $login_action = $_POST["login_action"];
        # try to authenticate user if called from login form
        if ($login_action == "do_login") {
            $login = $_POST["login"];
            $password = $_POST["password"];
            $remember_me = $_POST["remember_me"];
            if (authenticate_user($link, $login, $password)) {
                $_POST["password"] = "";
                $_SESSION["language"] = $_POST["language"];
                $_SESSION["ref_schema_version"] = get_schema_version($link, true);
                $_SESSION["bw_limit"] = !!$_POST["bw_limit"];
                if ($_POST["profile"]) {
                    $profile = db_escape_string($_POST["profile"]);
                    $result = db_query($link, "SELECT id FROM ttrss_settings_profiles\n\t\t\t\t\t\t\tWHERE id = '{$profile}' AND owner_uid = " . $_SESSION["uid"]);
                    if (db_num_rows($result) != 0) {
                        $_SESSION["profile"] = $profile;
                        $_SESSION["prefs_cache"] = array();
                    }
                }
                header("Location: " . $_SERVER["REQUEST_URI"]);
                exit;
                return;
            } else {
                $_SESSION["login_error_msg"] = __("Incorrect username or password");
            }
        }
        if (!$_SESSION["uid"] || !validate_session($link)) {
            render_login_form($link, $mobile);
            //header("Location: login.php");
            exit;
        } else {
            /* bump login timestamp */
            db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]);
            if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
                setcookie("ttrss_lang", $_SESSION["language"], time() + SESSION_COOKIE_LIFETIME);
            }
            /* bump counters stamp since we're getting reloaded anyway */
            $_SESSION["get_all_counters_stamp"] = time();
        }
    } else {
        return authenticate_user($link, "admin", null);
    }
}
<?php

require_once 'globals.php';
validate_session('tutor_licom');
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Sistema de pasantías.</title>
        <link href="css/estilo.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div class="container">
            <div class="header">
                <?php 
include "include/cabecera.php";
?>
            </div>
            <?php 
require_once "include/menu_licom.php";
?>
            <div class="content">
                <?php 
require_once "include/fecha.php";
?>
                <div align="center">

                    <h2>Seleccione una opción en el menú de la izquierda.</h2>

                </div>
Exemple #9
0
}
init_connection($link);
$subop = $_REQUEST["subop"];
$mode = $_REQUEST["mode"];
if ((!$op || $op == "rss" || $op == "dlg") && !$_REQUEST["noxml"]) {
    header("Content-Type: application/xml; charset=utf-8");
} else {
    header("Content-Type: text/plain; charset=utf-8");
}
if (ENABLE_GZIP_OUTPUT) {
    ob_start("ob_gzhandler");
}
if (SINGLE_USER_MODE) {
    authenticate_user($link, "admin", null);
}
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" && $op != "rss" && $op != "getUnread" && $op != "getProfiles" && $op != "share" && $op != "fbexport" && $op != "logout" && $op != "pubsub") {
    if ($op == 'pref-feeds' && $_REQUEST['subop'] == 'add') {
        header("Content-Type: text/html");
        login_sequence($link);
        render_login_form($link);
    } else {
        header("Content-Type: text/plain");
        print json_encode(array("error" => array("code" => 6)));
    }
    return;
}
$purge_intervals = array(0 => __("Use default"), -1 => __("Never purge"), 5 => __("1 week old"), 14 => __("2 weeks old"), 31 => __("1 month old"), 60 => __("2 months old"), 90 => __("3 months old"));
$update_intervals = array(0 => __("Default interval"), -1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_intervals_nodefault = array(-1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_methods = array(0 => __("Default"), 1 => __("Magpie"), 2 => __("SimplePie"), 3 => __("Twitter OAuth"));
if (DEFAULT_UPDATE_METHOD == "1") {
Exemple #10
0
<?php

/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   Page: index.php - Site default document.  Runs functions to validate session, validate requested page, and generate HTML to be displayed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
#Load system framework
include 'vitae/system_on_load.php';
#Validate session and requested page definition
validate_session();
$display_page = load_page_definition();
#Generate page and print to console/browser
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
echo $display_page->print_title();
<?php

require '../fpdf/fpdf.php';
require_once '../globals.php';
require_once '../db.php';
validate_session('estudiante');
date_default_timezone_set('America/Caracas');
class PDF_MC_Table extends FPDF
{
    var $widths;
    var $aligns;
    var $height;
    function SetWidths($w)
    {
        //Set the array of column widths
        $this->widths = $w;
    }
    function SetAligns($a)
    {
        //Set the array of column alignments
        $this->aligns = $a;
    }
    function Row($data)
    {
        $height = 2;
        //Calculate the height of the row
        $nb = $height;
        for ($i = 0; $i < count($data); $i++) {
            $nb = max($nb, $this->NbLines($this->widths[$i], $data[$i]));
        }
        $h = 5 * $nb;
<?php

require '../fpdf/fpdf.php';
require_once '../globals.php';
require_once '../db.php';
validate_session("estudiante");
date_default_timezone_set('America/Caracas');
$db = new PgDB();
$id = session_var('usuario_id');
$qry = "SELECT nombre, apellido, cedula, dirigido_a, numero_carta FROM usuario INNER JOIN pasantia ON pasantia.usuario_id = usuario.id AND usuario.id = {$id}";
$reco = $db->query($qry);
$row = pg_fetch_array($reco);
$pdf = new FPDF('P', 'mm', 'Letter');
$pdf->AddPage();
$fecha = date('d-m-Y', time());
$nroCP = "{$row['numero_carta']}";
$ciudadano = "{$row['dirigido_a']}";
$nombre = "{$row['nombre']} {$row['apellido']}";
$cedula = "{$row['cedula']}";
//linea superior
$pdf->Line(28, 20, 187, 20);
$pdf->Line(28, 20.7, 187, 20.7);
//linea inferior
$pdf->Line(28, 53, 187, 53);
$pdf->Line(28, 53.7, 187, 53.7);
//linea izquierda
$pdf->Line(186, 54, 186, 20);
$pdf->Line(186.7, 54, 186.7, 20);
//linea derecha
$pdf->Line(28, 54, 28, 20);
$pdf->Line(28.7, 54, 28.7, 20);
Exemple #13
0
<?php

require_once 'globals.php';
validate_session('dpe');
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Sistema de pasantías.</title>
        <link href="css/estilo.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div class="container">
            <div class="header">
                <?php 
include "include/cabecera.php";
?>
            </div>
            <?php 
require_once "include/menu_dpe.php";
?>
            <div class="content">
                <?php 
require_once "include/fecha.php";
?>
                <div align="center">

                    <h2>Seleccione una opción en el menú de la izquierda.</h2>

                </div>
/**
 * Logs a user out of SiT
 * 
 * @author Paul Heaney
 * @param string $sessionid - The session ID to log out of
 * @return Array - Status
 */
function logout($sessionid)
{
    $status = new SoapStatus();
    if (validate_session($sessionid)) {
        session_id($sessionid);
        session_start();
        // End the session, remove the cookie and destroy all data registered with the session
        $_SESSION['auth'] = FALSE;
        $_SESSION['portalauth'] = FALSE;
        $_SESSION = array();
        session_unset();
        session_destroy();
        if (isset($_COOKIE[session_name()])) {
            setcookie(session_name(), '', time() - 42000, '/');
        }
    } else {
        $status->set_error('session_not_valid');
    }
    return array('status' => $status->getSOAPArray());
}
function &signup($edit = false)
{
    // Check if there is still a valid session
    validate_session(!$edit);
    $valid_input = true;
    // Create the HTML array with empty values
    $HTML = array();
    $HTML['password'] = '';
    $HTML['confirm_password'] = '';
    $HTML['email'] = '';
    $HTML['city'] = '';
    $HTML['countryID'] = '';
    $HTML['password_encrypted'] = '';
    // Check the submitted field
    if (getRequest('submitted', true, 'post') !== 'yes') {
        // Fill in the fields if it is an edit
        if ($edit) {
            $fields = getUserInfo(get_SESSION('userID'));
            $HTML['email'] = $fields['email'];
            $HTML['city'] = $fields['city'];
            $HTML['countryID'] = $fields['countryID'];
            $HTML['password_encrypted'] = $fields['password_encrypted'];
        }
        // Populate the select drop down box
        getCountries($HTML['country_options_escape'], $HTML['countryID']);
        return $HTML;
    }
    // Fill the array with the form data
    foreach ($HTML as $key => &$value) {
        $value = getRequest($key, true, 'post');
    }
    // Validate the email
    if (empty($HTML['email'])) {
        $HTML['email_error'] = 'Email cannot be empty';
        $valid_input = false;
    } else {
        if (filter_var($HTML['email'], FILTER_VALIDATE_EMAIL) === false) {
            $HTML['email_error'] = 'Invalid Email Address';
            $valid_input = false;
        } else {
            $newID = validate_record($HTML['email']);
            if ($newID > 0 and (!$edit or $newID !== trim(get_SESSION('userID')))) {
                $HTML['email_error'] = 'An account already exists with that email';
                $valid_input = false;
            }
        }
    }
    // Validate the password
    $saved_pass = false;
    if ($edit and empty($HTML['password']) or $HTML['password'] === PASS_HOLDER and !empty($HTML['password_encrypted'])) {
        // use the password that was saved before
        $saved_pass = true;
    } else {
        if (empty($HTML['password'])) {
            $HTML['confirm_password_error'] = 'Password cannot be empty';
            $valid_input = false;
        } else {
            if ($HTML['password'] !== $HTML['confirm_password']) {
                $HTML['confirm_password_error'] = 'Passwords do not match';
                $valid_input = false;
            } else {
                if (!preg_match('/(?=.*\\d)(?=.*[a‐z])(?=.*[A-Z])(?=.*[\\.\\+\\\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\',"~`&@_;\\/#%-]).{6,20}/', $HTML['password'])) {
                    $HTML['confirm_password_error'] = 'Password must be 6-20 chars and more secure!';
                    $valid_input = false;
                }
            }
        }
    }
    // Validate the city
    if (empty($HTML['city'])) {
        $HTML['city_error'] = 'City cannot be empty';
        $valid_input = false;
    } else {
        if (preg_match('/(?=.*[\\d\\.\\+\\\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\'"~`&@_;\\/#%])/', $HTML['city'])) {
            $HTML['city_error'] = 'Special characters are not allowed';
            $valid_input = false;
        }
    }
    // Validate the country
    if (empty($HTML['countryID'])) {
        $HTML['countryID_error'] = 'Please select your country';
        $valid_input = false;
    } else {
        if (!validate_countryID($HTML['countryID'])) {
            $HTML['countryID_error'] = 'Invalid country submitted';
            $valid_input = false;
        }
    }
    if ($valid_input) {
        // If it is the edit page update the user and return to account page
        if ($edit) {
            updateUser($HTML, $saved_pass);
            set_header('account');
            exit;
        }
        if (empty($GLOBALS['DB'])) {
            die('Database Link is not set');
        }
        // Create a user
        $query = sprintf('INSERT INTO users (email, password, city, countryID) VALUES (\'%s\',\'%s\',\'%s\',\'%s\')', mysql_real_escape_string($HTML['email']), mysql_real_escape_string($saved_pass ? $HTML['password_encrypted'] : md5($HTML['password'])), mysql_real_escape_string($HTML['city']), mysql_real_escape_string($HTML['countryID']));
        $result = mysql_query($query);
        // Make sure it executed properly
        if (!$result) {
            $HTML['signup_error'] = 'Error adding user';
            return $HTML;
        }
        set_SESSION('userID', validate_record($HTML['email']));
        set_header('account');
        exit;
    }
    // Populate the select drop down box since we have to go back to the page
    getCountries($HTML['country_options_escape'], $HTML['countryID']);
    // Store the password if it was valid and changed
    if (empty($HTML['confirm_password_error'])) {
        if (!empty($HTML['password']) and $HTML['password'] !== PASS_HOLDER) {
            $HTML['password_encrypted'] = md5($HTML['password']);
            $HTML['password'] = PASS_HOLDER;
            $HTML['confirm_password'] = PASS_HOLDER;
        }
        // Clear the password if it was invalid or set it back to do not change if it is an edit page
    } else {
        if (!$edit) {
            $HTML['password_encrypted'] = '';
        }
        $HTML['password'] = '';
        $HTML['confirm_password'] = '';
    }
    return $HTML;
}
Exemple #16
0
function login_sequence($link, $mobile = false)
{
    $_SESSION["prefs_cache"] = array();
    if (!SINGLE_USER_MODE) {
        $login_action = $_POST["login_action"];
        # try to authenticate user if called from login form
        if ($login_action == "do_login") {
            $login = $_POST["login"];
            $password = $_POST["password"];
            $remember_me = $_POST["remember_me"];
            if (authenticate_user($link, $login, $password)) {
                $_POST["password"] = "";
                $_SESSION["language"] = $_POST["language"];
                $_SESSION["ref_schema_version"] = get_schema_version($link, true);
                $_SESSION["bw_limit"] = !!$_POST["bw_limit"];
                header("Location: " . $_SERVER["REQUEST_URI"]);
                exit;
                return;
            } else {
                $_SESSION["login_error_msg"] = __("Incorrect username or password");
            }
        }
        if (!$_SESSION["uid"] || !validate_session($link)) {
            render_login_form($link, $mobile);
            //header("Location: login.php");
            exit;
        } else {
            /* bump login timestamp */
            db_query($link, "UPDATE ttirc_users SET last_login = NOW(), \n\t\t\t  \t\ttwitter_last_id = NULL WHERE id = " . $_SESSION["uid"]);
            if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
                setcookie("ttirc_lang", $_SESSION["language"], time() + SESSION_COOKIE_LIFETIME);
            }
            /* Enable automatic connections */
            db_query($link, "UPDATE ttirc_connections SET enabled = true \n\t\t\t\t\tWHERE auto_connect = true AND owner_uid = " . $_SESSION["uid"]);
            initialize_user_prefs($link, $_SESSION["uid"]);
            /*				$tmp_result = db_query($link, "SELECT id FROM ttirc_connections
            					WHERE status != ".CS_DISCONNECTED." AND owner_uid = " .
            					$_SESSION["uid"]);
            	
            				while ($conn = db_fetch_assoc($tmp_result)) {
            					push_message($link, $conn['id'], "---",
            						"Accepted connection from " . $_SERVER["REMOTE_ADDR"], 
            						true);
            				} */
        }
    } else {
        return authenticate_user($link, "admin", null);
    }
}
Exemple #17
0
no_cache_incantation();
startup_gettext();
$script_started = getmicrotime();
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!init_connection($link)) {
    return;
}
header("Content-Type: text/plain; charset=utf-8");
if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
    ob_start("ob_gzhandler");
}
if (SINGLE_USER_MODE) {
    authenticate_user($link, "admin", null);
}
// TODO remove and handle within Handlers
if (!($_SESSION["uid"] && validate_session($link))) {
    if ($op == 'pref-feeds' && $method == 'add') {
        header("Content-Type: text/html");
        login_sequence($link);
        render_login_form($link);
    } else {
        header("Content-Type: text/plain");
        print json_encode(array("error" => array("code" => 6)));
    }
    return;
}
$purge_intervals = array(0 => __("Use default"), -1 => __("Never purge"), 5 => __("1 week old"), 14 => __("2 weeks old"), 31 => __("1 month old"), 60 => __("2 months old"), 90 => __("3 months old"));
$update_intervals = array(0 => __("Default interval"), -1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_intervals_nodefault = array(-1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_methods = array(0 => __("Default"), 1 => __("Magpie"), 2 => __("SimplePie"), 3 => __("Twitter OAuth"));
if (DEFAULT_UPDATE_METHOD == "1") {
/**
 * Lists a set of incidents
 * @author Paul Heaney
 * @param string $sessionid - the sessionid
 * @param int $owner - List incidents of this owner (0 for all)
 * @param int $status - 0 for ALL, 1 for all Active, 2 for all open
 * @return Array - array of incidents[] Status
 */
function list_incidents($sessionid, $owner = 0, $status = 1)
{
    global $sit;
    $status = new SoapStatus();
    $incidents = array();
    if (!empty($sessionid) and validate_session($sessionid)) {
        if (user_permission($sit[2], 6)) {
            /*
             * SELECT i.*, uTOwner.realname AS townerName FROM `users` AS uo, `incidents` AS i  LEFT JOIN `users` AS uTOwner ON uTOwner.id = i.towner WHERE i.owner = uo.id
             */
            $sql = "SELECT i.*, uOwner.realname AS ownerName, uTOwner.realname AS townerName, p.name AS priorityName, ";
            $sql .= "s.name AS skill, ist.name AS statusNameInternal, ist.ext_name AS statusNameExternal ";
            $sql .= "FROM `{$GLOBALS['dbIncidentStatus']}` AS ist,  `{$GLOBALS['dbUsers']}` AS uOwner, `{$GLOBALS['dbPriority']}` AS p, ";
            $sql .= "`{$GLOBALS['dbIncidents']}` AS i LEFT JOIN `{$GLOBALS['dbUsers']}` AS uTOwner  ON uTOwner.id = i.towner ";
            $sql .= "LEFT JOIN `{$GLOBALS['dbSoftware']}` AS s ON s.id = i.softwareid ";
            $sql .= " WHERE i.owner = uOwner.id AND i.priority = p.id AND i.status = ist.id ";
            if ($owner > 0) {
                $sql .= "AND (i.owner = {$owner} OR i.towner = {$owner}) ";
            }
            switch ($status) {
                case 1:
                    $sql .= "AND i.status = " . STATUS_ACTIVE . " ";
                    break;
                case 2:
                    $sql .= "AND (i.status != " . STATUS_CLOSED . " AND i.status !=  " . STATUS_UNASSIGNED . ") ";
                    break;
            }
            debug_log("SQL: {$sql}");
            $result = mysql_query($sql);
            if (mysql_error()) {
                trigger_error(mysql_error(), E_USER_WARNING);
            }
            if (mysql_num_rows($result) > 0) {
                while ($obj = mysql_fetch_object($result)) {
                    $incident = new Incident();
                    $incident->incidentid = $obj->id;
                    $incident->title = $obj->title;
                    $incident->owner = $obj->ownerName;
                    $incident->ownerid = $obj->owner;
                    $incident->towner = $obj->townerName;
                    $incident->townerid = $obj->towner;
                    $incident->priority = $obj->priorityName;
                    $incident->priorityid = $obj->priority;
                    $incident->currentstatusid = $obj->status;
                    $incident->currentstatusinternal = $GLOBALS[$obj->statusNameInternal];
                    $incident->currentstatusexternal = $GLOBALS[$obj->statusNameExternal];
                    $incident->skill = $obj->skill;
                    $incident->skillid = $obj->softwareid;
                    $incident->maintenanceid = $obj->maintenanceid;
                    $incident->servicelevel = $obj->servicelevel;
                    $incidents[] = $incident;
                }
            }
        } else {
            $status->set_error('no_access');
        }
    } else {
        $status->set_error('session_not_valid');
    }
    return array('incidents' => $incidents, 'status' => $status->getSOAPArray());
}
Exemple #19
0
function login_sequence()
{
    if (SINGLE_USER_MODE) {
        @session_start();
        authenticate_user("admin", null);
        startup_gettext();
        load_user_plugins($_SESSION["uid"]);
    } else {
        if (!validate_session()) {
            $_SESSION["uid"] = false;
        }
        if (!$_SESSION["uid"]) {
            if (AUTH_AUTO_LOGIN && authenticate_user(null, null)) {
                $_SESSION["ref_schema_version"] = get_schema_version(true);
            } else {
                authenticate_user(null, null, true);
            }
            if (!$_SESSION["uid"]) {
                @session_destroy();
                setcookie(session_name(), '', time() - 42000, '/');
                render_login_form();
                exit;
            }
        } else {
            /* bump login timestamp */
            db_query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]);
            $_SESSION["last_login_update"] = time();
        }
        if ($_SESSION["uid"]) {
            startup_gettext();
            load_user_plugins($_SESSION["uid"]);
            /* cleanup ccache */
            db_query("DELETE FROM ttrss_counters_cache WHERE owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t\t\t\t(SELECT COUNT(id) FROM ttrss_feeds WHERE\n\t\t\t\t\t\t\tttrss_feeds.id = feed_id) = 0");
            db_query("DELETE FROM ttrss_cat_counters_cache WHERE owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t\t\t\t(SELECT COUNT(id) FROM ttrss_feed_categories WHERE\n\t\t\t\t\t\t\tttrss_feed_categories.id = feed_id) = 0");
        }
    }
}
} else {
    if (!$_REQUEST["noxml"]) {
        header("Content-Type: text/html; charset=utf-8");
    } else {
        header("Content-Type: text/plain; charset=utf-8");
    }
}
if (!$op) {
    header("Content-Type: application/xml");
    print_error_xml(7);
    exit;
}
if (SINGLE_USER_MODE) {
    authenticate_user($link, "admin", null);
}
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" && $op != "rss" && $op != "getUnread" && $op != "publish" && $op != "getProfiles") {
    if ($op == "rpc" || $op == "viewfeed" || $op == "view") {
        print_error_xml(6);
        die;
    } else {
        print "\n\t\t\t<html><body>\n\t\t\t\t<p>Error: Not logged in.</p>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tif (parent.window != 'undefined') {\n\t\t\t\t\t\tparent.window.location = \"tt-rss.php\";\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\twindow.location = \"tt-rss.php\";\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t</body></html>\n\t\t\t";
    }
    exit;
}
$purge_intervals = array(0 => __("Use default"), -1 => __("Never purge"), 5 => __("1 week old"), 14 => __("2 weeks old"), 31 => __("1 month old"), 60 => __("2 months old"), 90 => __("3 months old"));
$update_intervals = array(0 => __("Default interval"), -1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_intervals_nodefault = array(-1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_methods = array(0 => __("Default"), 1 => __("Magpie"), 2 => __("SimplePie"));
if (ENABLE_SIMPLEPIE) {
    $update_methods[0] .= ' (SimplePie)';
} else {
<?php

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    require_once "..\\admin_common.php";
} else {
    require_once "../admin_common.php";
}
validate_session($identity);
$thisoperator = new CSLH_operator();
$chatarray = $thisoperator->arrayofchats();
// get the info of this user..
$query = "SELECT * FROM livehelp_users WHERE sessionid='" . $identity['SESSIONID'] . "'";
$people = $mydatabase->query($query);
if ($people->numrows() != 0) {
    $people = $people->fetchRow(DB_FETCHMODE_ASSOC);
    $UNTRUSTED['myid'] = $people['user_id'];
    $operator_id = $UNTRUSTED['myid'];
    $channel = $people['onchannel'];
}
$jsrn = get_jsrn($identity);
if (!isset($UNTRUSTED['cleartonow'])) {
    $UNTRUSTED['cleartonow'] = "";
}
if (!isset($UNTRUSTED['offset'])) {
    $UNTRUSTED['offset'] = "";
}
if (!isset($UNTRUSTED['clear'])) {
    $UNTRUSTED['clear'] = "";
}
if (!isset($UNTRUSTED['channel'])) {
    $UNTRUSTED['channel'] = 0;
Exemple #22
0
require_once "db.php";
require_once "db-prefs.php";
startup_gettext();
$script_started = microtime(true);
if (!init_plugins()) {
    return;
}
header("Content-Type: text/json; charset=utf-8");
if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
    ob_start("ob_gzhandler");
}
if (SINGLE_USER_MODE) {
    authenticate_user("admin", null);
}
if ($_SESSION["uid"]) {
    if (!validate_session()) {
        header("Content-Type: text/json");
        print error_json(6);
        return;
    }
    load_user_plugins($_SESSION["uid"]);
}
$purge_intervals = array(0 => __("Use default"), -1 => __("Never purge"), 5 => __("1 week old"), 14 => __("2 weeks old"), 31 => __("1 month old"), 60 => __("2 months old"), 90 => __("3 months old"));
$update_intervals = array(0 => __("Default interval"), -1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$update_intervals_nodefault = array(-1 => __("Disable updates"), 15 => __("Each 15 minutes"), 30 => __("Each 30 minutes"), 60 => __("Hourly"), 240 => __("Each 4 hours"), 720 => __("Each 12 hours"), 1440 => __("Daily"), 10080 => __("Weekly"));
$access_level_names = array(0 => __("User"), 5 => __("Power User"), 10 => __("Administrator"));
$op = str_replace("-", "_", $op);
$override = PluginHost::getInstance()->lookup_handler($op, $method);
if (class_exists($op) || $override) {
    if ($override) {
        $handler = $override;