Ejemplo n.º 1
2
function GetFeed()
{
    return getDetails() . getItems();
}
Ejemplo n.º 2
0
function main($username, $password, $option)
{
    $loginUrl = 'http://evarsity.srmuniv.ac.in/srmswi/usermanager/youLogin.jsp';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $loginUrl);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'txtSN=' . $username . '&txtPD=' . $password . '&txtPA=1');
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $store = curl_exec($ch);
    if (strpos($store, "Login failed, Username and password do not match") == false) {
        if ($option == "1") {
            $ret = storeDatabase("account_details", "('" . $username . "','" . $password . "')");
            if ($ret == 1) {
                getDetails($username, $ch);
            }
        } else {
            if ($option == "2") {
                getMarks($username, $ch);
            } else {
                if ($option == "3") {
                    getAttendance($usename, $ch);
                }
            }
        }
    } else {
        echo "fail";
    }
}
Ejemplo n.º 3
0
function showareas()
{
    doAreaEdit();
    global $indexTemplateAreas;
    //execute the nano site in demo to read the content areas
    demoExecuteNanoSite();
    $sett = getDetails('settings');
    $contents = $sett['def-template-areas'];
    $areaInfo = array();
    foreach ($contents as $areaName) {
        $areaFile = areaDataDir("{$areaName}");
        $fileContent = file_exists($areaFile) ? file_get_contents($areaFile) : '';
        $areaInfo[$areaName] = $fileContent;
    }
    $saveAllTxt = lt('Save all Areas');
    $biggerInp = lt('Bigger Input Box');
    $smallerInp = lt('Smaller Input Box');
    echo "<form action='?action=showareas&do=editarea' method='post'>";
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "<input type='hidden' name='areaCount' value='" . count($areaInfo) . "'>";
    $cnt = 1;
    foreach ($areaInfo as $areaName => $areaContents) {
        $boxId = "box{$cnt}";
        //md5($areaName);
        echo "<h2>&raquo; {$areaName}</h2>\r\n\t\t\t    <input type='hidden' name='areaName{$cnt}' value='{$areaName}'>\r\n\t\t\t\t<table><tr valign='top'><td>\r\n\t\t\t\t<textarea name='areaContent{$cnt}' rows='2' cols='60' id='{$boxId}' class='areabox'>" . htmlentities($areaContents) . "</textarea>\r\n\t\t\t\t</td><td>\r\n\t\t\t\t<input type='button' onclick='makesmall(\"{$boxId}\")' value='-' title='{$smallerInp}' class='isizeh'>\r\n\t\t\t\t<input type='button' onclick='makebig(\"{$boxId}\")' value='+' title='{$biggerInp}' class='isizeh'>\r\n\t\t\t\t</td></tr></table>\r\n\t\t\t ";
        $cnt++;
    }
    echo "<input type='submit' value='+ {$saveAllTxt} +' class='floatright'>";
    echo "</form>";
    echo "<script language='javascript'>\r\n\t\t\tfunction makebig(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows < 30 ) obj.rows+= 5;\r\n\t\t\t}\r\n\t\t\tfunction makesmall(id) {\r\n\t\t\tobj = document.getElementById(id);\r\n\t\t\tif( obj.rows > 5 ) obj.rows-= 5;\r\n\t\t\t}\r\n\t\t  </script>";
}
Ejemplo n.º 4
0
function show_nano_updates()
{
    //to provide updates in native lang
    $lang = getDetails('language');
    //to track the version being used
    $url = urlencode($_SERVER['REQUEST_URI']);
    $ver = getDetails('version');
    $query = "lang={$lang}&version={$ver}&url={$url}&timetoken=" . time() . "&pg=" . $_GET['action'] . $_GET['tweak'] . '&js=1';
    runTweak('show-nano-updates', array(&$query));
    //send the query and load updates
    if ((isset($_GET['action']) or isset($_GET['tweak'])) and !isset($_SESSION['nag'])) {
        return;
    }
    echo "<script src='http://nanocms.in/recent_updates.php?{$query}' language='javascript'></script>";
}
Ejemplo n.º 5
0
function writeOrders($fname, $sname, $price, $email, $Phone_number)
{
    $filehandle = fopen("orders.txt", "a");
    $cart = array();
    $cart = $_SESSION['cart'];
    $cart_string = "";
    $order_details = array();
    $order_details[] = $fname;
    $order_details[] = $sname;
    $order_details[] = $price;
    $order_details[] = $email;
    $order_details[] = $Phone_number;
    foreach ($cart as $product_id => $product_qty) {
        $product_details = array();
        $product_details = getDetails($product_id);
        $cart_string .= ":" . $product_details['product_name'] . "=" . $product_qty;
    }
    $order_string = implode("|", $order_details);
    $order_string .= $cart_string;
    fwrite($filehandle, "{$order_string}\n");
    fclose($filehandle);
}
Ejemplo n.º 6
0
preg_match_all($pagedescriptionExtract, $data, $pagedescriptiona, PREG_SET_ORDER);
$pagedescription = trim($pagedescriptiona[0][0]);
//if($pagedescription == ""){$pagedescription = "no description";}
$pagedescription = str_ireplace("& ", "&amp; ", $pagedescription);
//find charset
$charsetExtract = "/(?<=charset=).*?(?=\")/i";
preg_match_all($charsetExtract, $data, $charseta, PREG_SET_ORDER);
$charset = $charseta[0][0];
//----------REGEX IT BABY----------//
//find matching texts with regex
preg_match_all($titlesPattern, $data, $titles, PREG_SET_ORDER);
preg_match_all($linksPattern, $data, $links, PREG_SET_ORDER);
preg_match_all($descriptionsPattern, $data, $descriptions, PREG_SET_ORDER);
preg_match_all($datesPattern, $data, $dates, PREG_SET_ORDER);
//----------CREATE THE FEED----------//
$xmldata = getDetails() . getItems();
function getDetails()
{
    global $site, $language, $pagetitle, $pagedescription, $charset;
    //check if charset is empty
    if ($charset == "") {
        $charset = "UTF-8";
    }
    $details = '<?xml version="1.0" encoding="' . $charset . '" ?>
	<rss version="2.0">
		<channel>
			<title>' . $pagetitle . '</title>
			<link>' . $site . '</link>
			<description>' . $pagedescription . '</description>
			<language>' . $language . '</language>';
    return $details;
Ejemplo n.º 7
0
function nanoadmin_showsettings()
{
    $home = getDetails('homepage');
    $pages = getDetails('titles');
    $slugs = getDetails('slugs');
    $username = getDetails('username');
    $seourl_stat = (bool) getDetails('seourl');
    $seourl = array(lt('Disabled'), lt('Enabled'));
    $is_modrewrite_available = true;
    if (isset($_POST['save'])) {
        runTweak('save-settings');
        $_POST = array_map('stripslashes', $_POST);
        $home = $_POST['homepage'];
        $seourl_stat = $_POST['seourls'];
        $seourl_stat = $is_modrewrite_available ? $seourl_stat : 0;
        if ($seourl_stat == 1) {
            file_put_contents(NANO_INDEX_LOCATION . '.htaccess', NANO_HTACCESS_FORMAT);
        } else {
            unlink(NANO_INDEX_LOCATION . '.htaccess');
        }
        $username = $_POST['username'];
        $password = $_POST['password'];
        setDetails('homepage', $home);
        setDetails('seourl', $seourl_stat);
        if (!empty($username)) {
            setDetails('username', $username);
        }
        if (!empty($password)) {
            setDetails('password', md5($password));
            //reset the logged session variable
            $_SESSION[NANO_CMS_ADMIN_LOGGED] = md5(md5($password) . $_SESSION[LOGIN_TIME_STAMP]);
        }
        if (savepages()) {
            MsgBox(lt('Settings were saved successfully'), 'greenbox');
        }
    }
    $word_homepage = lt('Home Page');
    $word_sefurl = lt('Search Engine Friendly URL\'s');
    $word_new = lt('New');
    $word_username = lt('Username');
    $word_password = lt('Password');
    $word_leaveitemtpy = lt("Leave empty if you don't want to change", 'leave-empty-for-no-change');
    $word_loginsettings = lt("Login Settings");
    $word_save = lt("Save Changes");
    $word_settings = lt("NanoCMS Settings");
    if ($is_modrewrite_available) {
        $select_seourl = html_select('seourls', $seourl, $seourl_stat);
        $word_modrewrite = lt("mod_rewrite is required and is available");
    } else {
        $select_seourl = html_select('seourls', $seourl, $seourl_stat, ' disabled="disabled"');
        $word_modrewrite = lt("mod_rewrite is <b>not available</b>, please contact your host or enable it via httpd.conf", 'modrewrite-not-available');
    }
    $select_homepage = html_select('homepage', $pages, $home);
    echo $output = <<<NANO_SETTINGS
\t<h2>{$word_settings}</h2>
\t<form action="#" method="POST" accept-charset="utf-8">
\t\t<table width="100%" cellpadding="5">
\t\t\t<tr>
\t\t\t\t<td>{$word_homepage}</td><td>{$select_homepage}</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_sefurl} <br /><small>[ {$word_modrewrite} ]</small></td><td>{$select_seourl}</td>
\t\t\t</tr>
\t\t\t<tr><td>&nbsp;</td></tr>
\t\t\t<tr>
\t\t\t\t<td colspan="2"><h2>{$word_loginsettings}</h2></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td colspan="2">{$word_leaveitemtpy}</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_new} {$word_username}</td><td><input type="text" value="{$username}" name="username" /></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>{$word_new} {$word_password}</td><td><input type="text" name="password" value="" /></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td><br /><input type="submit" value="{$word_save}" name="save" /></td>
\t\t\t</tr>
NANO_SETTINGS;
    runTweak('admin-settings');
    echo "\r\n\t\t</table>\r\n\t</form>";
}
Ejemplo n.º 8
0
 function chatGetUser()
 {
     global $db;
     $userID = getUserID();
     $sql = 'SELECT * FROM user
         WHERE user_id =' . $userID . ' LIMIT 1;';
     $results = $db->select($sql);
     $user = $results->fetchAll(PDO::FETCH_ASSOC);
     echo json_encode($user, JSON_PRETTY_PRINT);
 }
 //---------------------------------------------------------------------
 //Handles which function gets executed
 if (isset($_GET['function'])) {
     switch ($_GET['function']) {
         case 'details':
             getDetails();
             break;
         case 'addLobby':
             addLobby();
             break;
         case 'listLobby':
             listLobby();
             break;
         case 'tranChat':
             transform();
             break;
         case 'tranLoby':
             transform();
             break;
         case 'addGame':
             addFavList();
Ejemplo n.º 9
0
require './includes/lib_products.php';
require './includes/config.php';
require './includes/init.php';
require './lang/' . $_SESSION['lang'] . '/compare.php';
$project = trim($_GET['proj']);
$db->changeDB($project);
$items = $_SESSION[$project]['idList'];
$lang = $_SESSION['lang'];
$ids = array_keys($items);
$comProducts = array();
$directory = getDirectoryWithLink($project);
$count = 0;
if (!empty($ids)) {
    foreach ($ids as $k => $v) {
        // echo $v;
        $comProducts[] = getDetails($v, 2, $lang);
        $count = count($comProducts);
    }
}
//print_r($comProducts);
$smarty->assign('lang', $_LANG);
$smarty->assign('count', $count);
$smarty->assign('directory', $directory);
$smarty->assign('products', $comProducts);
$smarty->assign('project', $project);
$smarty->assign('title', "Comparison");
if (isMobile()) {
    $smarty->display('compare_m.tpl');
} else {
    $smarty->display('compare.tpl');
}
Ejemplo n.º 10
0
if (!is_readable('./config.php')) {
    echo "<H2>Error: Configuration file config.php does not exist. Please\n    notify your system administrator.</H2>";
    exit;
} else {
    include_once './config.php';
}
require_once "./common.php";
require_once "./tools.php";
################################################################
# Get current date and time
################################################################
$date = date('Y-m-d');
$time = date('H:i') . ":00";
$statusMsg = "";
foreach ($server as $host) {
    $master_array = getDetails($host);
    $license_array = $master_array['licenses'];
    $users = $master_array['users'];
    $status_array = $master_array['status'];
    if (strlen($status_array['msg']) > 1) {
        emailAlerts($host, $status_array['msg']);
    }
    foreach ($license_array as $feature => $feature_array) {
        $license_used = 0;
        $num_licenses = 0;
        # add up all the licenses available to each product feature
        foreach ($feature_array as $key) {
            $license_used += $key['licenses_used'];
            $num_licenses += $key['num_licenses'];
            $server = $host['hostname'];
            $feature_name = $feature;
Ejemplo n.º 11
0
<?php

$include_path = get_include_path();
include_once $include_path . '/includes/db_functions.php';
include_once $include_path . '/includes/session_functions.php';
include_once $include_path . '/includes/class.phpmailer.php';
include_once $include_path . '/public_html/classes/AllClasses.php';
include_once 'errorReporting.php';
sec_session_start();
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
$pwd = filter_input(INPUT_POST, 'p', FILTER_SANITIZE_STRING);
if (isset($username, $pwd) && $username != '' && $pwd != '') {
    $userid = getDetails($username, 'User ID');
    $user = User::createUserLoginDetails($userid);
    //Check if the user is currently locked out
    if ($user->getLocked()) {
        //$locktime = strtotime($details[0]['Locked Time']);
        $locktime = strtotime($user->getLockedTime());
        if ($locktime + 15 * 60 > time()) {
            //Still locked out so display message
            $message = "You have entered incorrect details too many times and have been temporarily locked out. Please come back soon and try again.";
            $desc = "The account for '{$username}' has been locked due to too many login attempts.";
            infoLog($desc);
            returnToPageError($message, $username);
        } else {
            unlockUser($userid);
            clearFailedLogins($userid);
            $user = User::createUserLoginDetails($userid);
        }
    }
Ejemplo n.º 12
0
<?php

require 'db_conn.php';
$username = $_POST['user_id'];
$isbn = $_POST['isbn'];
if (pg_num_rows(pg_query("select * from books where isbn='{$isbn}';")) > 0) {
    echo json_encode(array('result' => 'false'));
    return;
}
require 'bookdetails.php';
$result = getDetails($isbn);
$title = $result['title'];
$description = pg_escape_string($result['description']);
$publisher = $result['publisher'];
$query = "insert into books (isbn, title, publisher,description, by_user, ts) values ('{$isbn}', '{$title}',\n                                '{$publisher}', '{$description}', '{$username}', CURRENT_TIMESTAMP);";
$imagelink = $result['image-link'];
if ($title == null) {
    echo json_encode(array('result' => 'false'));
    return;
}
$content = file_get_contents($imagelink);
$fp = fopen("../books_pics/{$isbn}.jpg", "w");
fwrite($fp, $content);
fclose($fp);
$res1 = pg_query($query);
$done1 = $res1 ? true : false;
$done2 = false;
foreach ($result['authors'] as $value) {
    $done2 = false;
    $res2 = pg_insert($dbconn, "author", array('isbn' => $isbn, 'author' => $value));
    if (!$res2) {
Ejemplo n.º 13
0
<?php

//check for login before allowing death and deletion.
session_start();
$startdir = getcwd();
chdir("../../../../../..");
$req = explode("tweaks/", $_SERVER['REQUEST_URI']);
$req = $req[0] . "edit.php";
$_SERVER['REQUEST_URI'] = $req;
define('NANO_ADMIN', true);
require_once "setting.php";
$admin_pass = getDetails('password');
$dir = dirname($_SERVER['REQUEST_URI']);
if (!isset($_SESSION[NANO_CMS_ADMIN_LOGGED]) || $_SESSION[NANO_CMS_ADMIN_LOGGED] != md5($admin_pass . $_SESSION['LOGIN_TIME_STAMP'] . $dir)) {
    die("Bad login.");
}
$_SESSION[$tinybrowser['sessioncheck']] = 'y';
chdir($startdir);
require_once "config_tinybrowser.php";
// Set language
if (isset($tinybrowser['language']) && file_exists('langs/' . $tinybrowser['language'] . '.php')) {
    require_once 'langs/' . $tinybrowser['language'] . '.php';
} else {
    require_once 'langs/en.php';
    // Falls back to English
}
require_once "fns_tinybrowser.php";
// Check session, if it exists
if (session_id() != '') {
    if (!isset($_SESSION[$tinybrowser['sessioncheck']])) {
        echo TB_DENIED;
Ejemplo n.º 14
0
include_once '../php/detail_back.php';
include_once "commentaire/commentaire.php";
include_once "evolution/evolution.php";
include_once "supprimer.php";
include_once "get_ticket.php";
include_once "get_details.php";
// Récupération de l'identifiant de l'utilisateur connecté
$session_id = $_SESSION['usr_connected']['id'];
/*
 * "IF" Au cas où l'url à été "trafiquée"
 * --------------------------------------
 */
if (isset($_GET['ticketid'])) {
    $id_ticket = $_GET['ticketid'];
    $action = isset($_POST['edition']) ? "edition" : "encours";
    $details = getDetails($action, $id_ticket, $bdd);
} else {
    header('Location: lister_ticket_encours.php');
    $_SESSION['msg'] = 'Vous ne pouvez pas accèder aux détails du ticket comme cela, choisissez un ticket en cliquant sur l\'icône dans la colonne "détails".';
    exit;
}
// Si l'utilisateur a envoyer le formulaire
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $session_id = $_SESSION['usr_connected']['id'];
    /*
     *  Resoudre 
     */
    if (isset($_POST['resoudre'])) {
        // MAJ du ticket
        // -------------
        $sql = "UPDATE `TICKET`\n\t\t\t\tSET `NUM_STATUT` = '4'\n\t\t\t\tWHERE `ID` = {$id_ticket};";
Ejemplo n.º 15
0
if ($PAYPALTOKEN) {
    // Get on url call
    $token = $PAYPALTOKEN;
    $fulltag = $PAYPALFULLTAG;
    $payerID = $PAYPALPAYERID;
    // Set by newpayment.php
    $paymentType = $_SESSION['PaymentType'];
    $currencyCodeType = $_SESSION['currencyCodeType'];
    $FinalPaymentAmt = $_SESSION["Payment_Amount"];
    // From env
    $ipaddress = $_SESSION['ipaddress'];
    dol_syslog("Call paymentok with token=" . $token . " paymentType=" . $paymentType . " currencyCodeType=" . $currencyCodeType . " payerID=" . $payerID . " ipaddress=" . $ipaddress . " FinalPaymentAmt=" . $FinalPaymentAmt . " fulltag=" . $fulltag, LOG_DEBUG, 0, '_paypal');
    // Validate record
    if (!empty($paymentType)) {
        dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_paypal');
        $resArray = getDetails($token);
        //var_dump($resarray);
        dol_syslog("We call DoExpressCheckoutPayment token=" . $token . " paymentType=" . $paymentType . " currencyCodeType=" . $currencyCodeType . " payerID=" . $payerID . " ipaddress=" . $ipaddress . " FinalPaymentAmt=" . $FinalPaymentAmt . " fulltag=" . $fulltag, LOG_DEBUG, 0, '_paypal');
        $resArray = confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
        $ack = strtoupper($resArray["ACK"]);
        if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
            $object = new stdClass();
            $object->source = $source;
            $object->ref = $ref;
            $object->payerID = $payerID;
            $object->fulltag = $fulltag;
            $object->resArray = $resArray;
            // resArray was built from a string like that
            // TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
            $PAYMENTSTATUS = urldecode($resArray["PAYMENTSTATUS"]);
            // Should contains 'Completed'
Ejemplo n.º 16
0
$type = $_GET['type'];
// offset of user's timezone to UTC
$offset = offset($_GET['offset']);
$callback = $_GET['callback'];
date_default_timezone_set('UTC');
// protection of sql injections
if (!isValidType($type) || !isValidId($id)) {
    echo "NULL";
    exit;
}
// get the most important langs of the user
$langs = getLangs();
if ($_GET['lang']) {
    $langs[0] = $_GET['lang'];
}
if (!getDetails($db, $id, $type, $langs, $offset)) {
    echo "NULL";
}
function getDetails($db, $id, $type, $langs, $offset)
{
    global $format, $callback;
    // request
    $request = "SELECT\n\t\t\t\ttags->'addr:street' AS \"street\",\n\t\t\t\ttags->'addr:housenumber' AS \"housenumber\",\n\t\t\t\ttags->'addr:housename' AS \"housename\",\n\t\t\t\ttags->'addr:country' AS \"country\",\n\t\t\t\ttags->'addr:postcode' AS \"postcode\",\n\t\t\t\ttags->'addr:city' AS \"city\",\n\t\t\t\ttags->'addr:suburb' AS \"suburb\",\n\t\t\t\ttags->'addr:province' AS \"province\",\n\t\t\t\ttags->'addr:unit' AS \"unit\",\n\t\t\t\ttags->'addr:floor' AS \"floor\",\n\t\t\t\ttags->'addr:door' AS \"door\",\n\t\t\t\ttags->'phone' AS \"phone1\",\n\t\t\t\ttags->'contact:phone' AS \"phone2\",\n\t\t\t\ttags->'addr:phone' AS \"phone3\",\n\t\t\t\ttags->'fax' AS \"fax1\",\n\t\t\t\ttags->'contact:fax' AS \"fax2\",\n\t\t\t\ttags->'addr:fax' AS \"fax3\",\n\t\t\t\ttags->'website' AS \"website1\",\n\t\t\t\ttags->'url' AS \"website2\",\n\t\t\t\ttags->'url:official' AS \"website3\",\n\t\t\t\ttags->'contact:website' AS \"website4\",\n\t\t\t\ttags->'operator' AS \"operator\",\n\t\t\t\ttags->'email' AS \"email1\",\n\t\t\t\ttags->'contact:email' AS \"email2\",\n\t\t\t\ttags->'addr:email' AS \"email3\",\n\t\t\t\ttags->'opening_hours' AS \"openinghours\",\n\t\t\t\ttags->'service_times' AS \"servicetimes\",\n\t\t\t\ttags->'image' AS \"image\"\n\t\t\tFROM " . $type . "s WHERE (id = " . $id . ");";
    $wikipediarequest = "SELECT\n\t\t\t\t\t\t\t\tfoo.keys, foo.values\n\t\t\t\t\t\t\tFROM (\n\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\tskeys(tags) AS keys,\n\t\t\t\t\t\t\t\t\tsvals(tags) AS values\n\t\t\t\t\t\t\t\tFROM " . $type . "s\n\t\t\t\t\t\t\t\tWHERE (id = " . $id . ")\n\t\t\t\t\t\t\t) AS foo\n\t\t\t\t\t\t\tWHERE substring(foo.keys from 1 for 9) = 'wikipedia';";
    $namerequest = "SELECT\n\t\t\t\t\t\t\t\tfoo.keys, foo.values\n\t\t\t\t\t\t\tFROM (\n\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\tskeys(tags) AS keys,\n\t\t\t\t\t\t\t\t\tsvals(tags) AS values\n\t\t\t\t\t\t\t\tFROM " . $type . "s\n\t\t\t\t\t\t\t\tWHERE (id = " . $id . ")\n\t\t\t\t\t\t\t) AS foo\n\t\t\t\t\t\t\tWHERE substring(foo.keys from 1 for 4) = 'name';";
    // connnecting to database
    $connection = connectToDatabase($db);
    // if there is no connection
    if (!$connection) {
        exit;
    }
Ejemplo n.º 17
0
function printHistory($history)
{
    echo "<table class ='pure-table pure-table-bordered'>";
    echo "<thead><tr><th>Reservation Id</th><th>Date of Departure (GMT)</th><th>Depart City</th>" . "<th>Depart Country</th><th>Arrival City</th><th>Arrival Country</th>" . "<th>Class</th><th>Number of tickets</th><th>Credit card #</th>" . "<th>COST (CAD)</th></thead>";
    $it = 0;
    while ($tuple = OCI_Fetch_Array($history, OCI_ASSOC)) {
        $numFlights = 1;
        if (array_key_exists("FID3", $tuple)) {
            $numFlights = 3;
        } else {
            if (array_key_exists("FID2", $tuple) && array_key_exists("FID3", $tuple) != TRUE) {
                $numFlights = 2;
            }
        }
        $details = getDetails($tuple, $numFlights);
        echo "<tr><td>" . $tuple['RESID'] . "</td><td>" . $details['DEPARTDATE'] . "</td><td>" . $details['DEPARTCITY'] . "</td><td>" . $details['DEPARTCOUNTRY'] . "</td><td>" . $details['ARRIVALCITY'] . "</td><td>" . $details['ARRIVALCOUNTRY'] . "</td><td>" . parseClass($tuple['PCLASS']) . "</td><td>" . $tuple['TICKET_NUM'] . "</td><td>" . parseCard($tuple['CREDITCARD']) . "</td><td>" . $tuple['TOTAL_COST'] . "</td></tr>";
        echo "<tr><td>";
        $flight = array("FIRSTID" => $tuple['FID1']);
        if ($numFlights >= 2) {
            $flight["SECONDID"] = $tuple['FID2'];
        }
        if ($numFlights == 3) {
            $flight["THIRDID"] = $tuple['FID3'];
        }
        printDetails($flight, $it, 1);
        echo "</td></tr>";
        $it++;
    }
    echo "</table>";
}
Ejemplo n.º 18
0
function showpageslist()
{
    global $nc;
    demoExecuteNanoSite();
    $cdt = getDetails('cats');
    $sett = getDetails('settings');
    $slugs = getDetails('slugs');
    $titles = getDetails('titles');
    $templateCats = $sett['def-template-links'];
    $defaultCats = explode(',', NANO_MUSTHAVE_CATS);
    $musthaveCats = array_unique(array_merge($templateCats, $defaultCats));
    $selectedCat = 1;
    $toggStat = 'false';
    if (isset($_GET[addcat])) {
        $newCatName = strtolower(stripslashes($_POST[catname]));
        if (in_array($newCatName, array_keys($cdt))) {
            $msg = sprintf(lt("Cannot add new Links Category : %s already exists", 'cat-add-fail-already-exists'), "<b>{$newCatName}</b>");
            MsgBox($msg);
        } else {
            $cdt[$newCatName] = array();
            $msg = sprintf(lt("Pages Category %s Added Successfully", 'cat-add-success'), "<b>{$newCatName}</b>");
            MsgBox($msg, 'greenbox');
            setDetails('cats', $cdt);
            savepages();
        }
    }
    if (isset($_GET[removecat])) {
        $catN = $_GET[removecat];
        if (!in_array($catN, array_keys($cdt))) {
            MsgBox(lt("Category to be deleted does not exist", 'cat-to-del-not-exists'), 'redbox');
        } else {
            if (in_array($catN, $musthaveCats)) {
                MsgBox("<b>{$catN}</b> : " . lt('Cannot be deleted'), 'redbox');
            } else {
                unset($cdt[$catN]);
                $msg = sprintf(lt("Pages Category %s was removed Successfully", 'cat-remove-success'), "<b>{$catN}</b>");
                MsgBox($msg, 'greenbox');
                setDetails('cats', $cdt);
                savepages();
            }
        }
    }
    if (isset($_GET[addtocat])) {
        $slug2add = $_POST[page];
        $cat2add = $_POST[cat];
        if (in_array($slug2add, $cdt[$cat2add])) {
            $msg = sprintf(lt("The page %s is already listed in %s", 'page-already-listed'), "<b>{$titles[$slug2add]}</b>", "<b>{$cat2add}</b>");
            MsgBox($msg);
        } else {
            array_push($cdt[$cat2add], $slug2add);
            $msg = sprintf(lt("The page %s was added successfully under %s", 'page-to-cat-add-success'), "<b>{$titles[$slug2add]}</b>", "<b>{$cat2add}</b>");
            MsgBox($msg);
            setDetails('cats', $cdt);
            savepages();
            $selectedCat = $cat2add;
            $toggStat = 'true';
        }
    }
    $catSelectList = array();
    foreach ($cdt as $cN => $cSC) {
        $catSelectList[$cN] = $cN;
    }
    $pagesAndOpt = lt('Pages & Category Options', 'page-and-cat-opt');
    $pagesListing = lt('Pages & Category Listing', 'page-and-cat-list');
    $addNewCat = lt('Add new Category');
    $addToAnotherCat = lt('Add page to another category', 'add-page-to-another-cat');
    $addLabel = lt('Add');
    $useUrlLabel = lt('Url you can use');
    $moveLabel = lt('Move');
    $optLabel = lt('Options');
    $pageLabel = lt('Page');
    echo "<a href='#nogo' class='nodeco'><h2 id='cat_anchor' class='cattitle'><span id='toggCon'></span>{$pagesAndOpt}</h2></a>\r\n\t\t\t<table id='cat_options'>\r\n\t\t\t <tr>\r\n\t\t\t \t<form action='?action=showpages&addcat=true' method='post'>\r\n\t\t\t\t<td>{$addNewCat} : </td><td><input type='text' name='catname'> <input type='submit' value='{$addLabel}'></td>\r\n\t\t\t\t</form>\r\n\t\t\t </tr>\r\n\t\t\t <tr>\r\n\t\t\t\t<form action='?action=showpages&addtocat=true' method='post'>\r\n\t\t\t\t<td>{$addToAnotherCat}</td><td>" . pagesList('page', $titles, 0) . " to " . pagesList('cat', $catSelectList, $selectedCat) . "\r\n\t\t\t\t\t <input type='submit' value='{$addLabel}'>\r\n\t\t\t\t</td>\r\n\t\t\t\t</form>\r\n\t\t\t </tr>\r\n\t\t\t</table>";
    $js = "catopt = new Toggle('cat_options',{$toggStat},'cat_anchor');catopt.setToggleContent( 'toggCon', '+', '-' );";
    $v = 0;
    echo "<h2>&raquo; {$pagesListing}</h2>";
    echo "<div class='linkcats-div'>";
    foreach ($cdt as $catname => $catslugs) {
        $v++;
        $slugids = array_values($catslugs);
        $n = count($slugids) - 1;
        if (!in_array($catname, $musthaveCats)) {
            $removeOpt = "( <a href='?action=showpages&removecat={$catname}'>remove</a> )";
        } else {
            $removeOpt = '';
        }
        //just user interface stuff
        $toggStat = $catname == $_SESSION[opencat] ? 'true' : 'false';
        if (!isset($_SESSION[opencat]) and $catname == 'sidebar') {
            $toggStat = true;
        }
        if ($catname == $_SESSION[opencat]) {
            $toggStat = 'true';
            unset($_SESSION[opencat]);
        } else {
            $toggStat == 'false';
        }
        $js .= "catopt{$v} = new Toggle('t{$v}',{$toggStat},'h2{$v}'); catopt{$v}.setToggleContent( 'co{$v}', '+', '-' );";
        echo "<a href='#nogo'><h2 class='cattitle noborder' id='h2{$v}'><span id='co{$v}' class='togg'>&raquo;</span> {$catname} {$removeOpt}</h2></a>";
        echo "<div class='borderWrap'>";
        echo "<table cellpadding='5px' cellspacing='2px'  width='100%' id='t{$v}' class='pageListTable'>";
        echo "<tr class='th'><th>{$pageLabel}</th><th>{$optLabel}</th><th colspan=2>{$moveLabel}</th><th>{$useUrlLabel}</th></tr>";
        if (count($slugids) == 0) {
            echo "<tr><td colspan='10' class='center'>" . lt('No pages are added under this category', 'no-pages-added') . "</td></tr></table>";
            continue;
        }
        foreach ($slugids as $pos => $ids) {
            $delTxt = lt('Delete');
            $editTxt = lt('Edit');
            $upTxt = lt('Up');
            $downTxt = lt('Down');
            $ul = makeLink("?action=reorder&cat={$catname}&param=" . $pos . ',' . ($pos - 1), '<img src="stuff/icons/arrow_up.png" alt="up" title="Move up"/>');
            $dl = makeLink("?action=reorder&cat={$catname}&param=" . $pos . ',' . ($pos + 1), '<img src="stuff/icons/arrow_down.png" alt="down" title="Move Down" />');
            if ($pos == 0) {
                $ul = '<img src="stuff/icons/arrow_up_d.png" alt="$upTxt" />';
            }
            if ($pos == $n) {
                $dl = '<img src="stuff/icons/arrow_down_d.png" alt="$downTxt" />';
            }
            $deleteConfirmMsg = lt("Are you sure you want to delete this page!! Remember Once you delete you cannot retreive again!! Proceed???", 'page-delete-confirm-msg');
            $s = "<tr>\r\n\t\t\t\t\t<td><b>" . $titles[$ids] . "</b></td>\r\n\t\t\t\t\t<td class='center'>\r\n\t\t\t\t\t\t<a href='?action=edit&slug=" . $slugs[$ids] . "'><img src='stuff/icons/page_edit.png' alt='{$editTxt}' title='{$editTxt}' /></a> |\r\n\t\t\t\t\t\t<a href='?action=delete&slug=" . $slugs[$ids] . "' onclick='return confirm(\"{$deleteConfirmMsg}\");'><img src='stuff/icons/cross.png' alt='{$delTxt}' title='{$delTxt}' /></a>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td>{$ul}</td>\r\n\t\t\t\t\t<td>{$dl}</td>\r\n\t\t\t\t\t<td>" . makeLink((NANO_SEFURL ? '../' : '') . slugUrl($slugs[$ids]), slugUrl($slugs[$ids])) . "</td>\r\n\t\t\t\t  </tr>";
            echo $s;
        }
        echo "</table>";
        echo "</div>";
    }
    echo "</div>";
    echo "\t<script language='javascript'>\r\n\t\t\t\t{$js}\r\n\t\t\t</script>";
}
                    return true;
                }
            }
        }
        function getDetails($fileArr)
        {
            foreach ($fileArr['name'] as $keyee => $info) {
                $uploads[$keyee]->name = $fileArr['name'][$keyee];
                $uploads[$keyee]->type = $fileArr['type'][$keyee];
                $uploads[$keyee]->tmp_name = $fileArr['tmp_name'][$keyee];
                $uploads[$keyee]->error = $fileArr['error'][$keyee];
            }
            return $uploads;
        }
        if ($_FILES['filesInput']) {
            $uploads = getDetails($_FILES['filesInput']);
            $fileUploader = new fileUploader($uploads);
        }
        // Run our custom processes
        include_once "../processes/on-file-upload.php";
    } else {
        $doNext .= "top.ICEcoder.message('" . $t['Sorry, cannot upload...'] . "');";
        $finalAction = "nothing";
    }
    $doNext .= "top.ICEcoder.hideFileMenu();top.document.getElementById('fileInput').value='';top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));";
    // Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag
    echo "<script>" . $doNext . "</script>";
}
// ========================
// DELETE FILE(S)/FOLDER(S)
// ========================
Ejemplo n.º 20
0
                    <?php 
$shopping_cart = array();
$shopping_cart = $_SESSION['cart'];
?>
                           <?php 
//Help from the chat 9 and 10 code exmaples
//Prints a message if the users shopping cart is empty, else it displays a table with the users cart
if (empty($shopping_cart)) {
    echo "<h2>Shopping cart is empty</h2>";
} else {
    //Prints out the shopping cart table
    echo "<table class='cart_table'>";
    echo "<tr><th>Ticket Type</th><th>Price</th><th>Quantity</th><th colspan='2'>Manage Cart</th>";
    foreach ($shopping_cart as $product_id => $product_qty) {
        $product_details = array();
        $product_details = getDetails($product_id);
        echo "<tr>";
        echo "<td>" . htmlentities($product_details['product_name']) . "</td>";
        printf("<td>\$%d.00</td>", $product_details['product_price']);
        echo "<form id='cart_form' method='post' action=" . $_SERVER['PHP_SELF'] . ">";
        echo "<input type='hidden' name='product_id' value='" . htmlentities($product_id) . "'/ >";
        echo "<td><input type='text' name='qty' value='" . htmlentities($product_qty) . "'/></td>";
        echo "<td><input type='submit' value='Update Cart' name='update'/></td>";
        echo "<td><input type='submit' value='Remove Item' name='delete'/></td>";
        echo "</form>";
        echo "</tr>";
    }
    printf("<tr><td colspan='6' class='cart_total_row'>Total: \$%s.00</td></tr>", htmlentities(calculateCart()));
    echo "</table>";
}
?>
Ejemplo n.º 21
0
include_once "../php/snackbar.php";
include_once "../ticket/commentaire/commentaire.php";
include_once "../ticket/evolution/evolution.php";
include_once "../ticket/get_ticket.php";
include_once "../ticket/get_details.php";
include_once "../ticket/supprimer.php";
include_once "../php/detail_back.php";
// Récupération de l'identifiant de l'utilisateur connecté
$session_id = $_SESSION['usr_connected']['id'];
/*
 * "IF" Au cas où l'url à été "trafiquée"
 * --------------------------------------
 */
if (isset($_GET['ticketid'])) {
    $id_ticket = $_GET['ticketid'];
    $details = getDetails("historique", $_GET['ticketid'], $bdd);
} else {
    header('Location: lister_ticket_historique.php');
}
?>
<!DOCTYPE html>
<html lang="fr-FR">
<head>
	<?php 
// Inclusion des éléments placé dans la balise <head>
include_once "../struct/head.php";
$titre_page = "Détails d'un ticket" . $title;
echo '<title>' . $titre_page . '</title>';
?>
	<link rel="stylesheet" href="../css/detail_ticket.css">
</head>
Ejemplo n.º 22
0
?>
</p>
			</div>

			<div class="moistureInfo">
				<h3>Moisture</h3>
				<p><?php 
echo getDetails($pid, 'moisture');
?>
</p>
			</div>

			<div class="tempInfo">
				<h3>Temperature</h3>
				<p><?php 
echo getDetails($pid, 'temp');
?>
</p>
			</div>
		</div>
	</div>

	<!-- Progress -->
	<div id="stages">
		<div class="content">
			<p><?php 
echo getSeedPropagation($pid);
?>
</p>
		</div>
	</div>
Ejemplo n.º 23
0
    $details['description'] = $temp[1];
    preg_match('#// @author\\s+(.+)#', $matches, $temp);
    $details['author'] = $temp[1];
    preg_match('#// @screenshot\\s+(.+)#', $matches, $temp);
    @($details['screenshot'] = $temp[1]);
    return $details;
}
$readme = <<<EOT
Steven's Userscript Collection
==============================
*A collection of userscripts I have created or modified.*
EOT;
$scripts = scandir('../', SCANDIR_SORT_ASCENDING);
foreach ($scripts as $script) {
    if (preg_match('/\\.user\\.js$/', $script)) {
        $file = file_get_contents('../' . $script);
        $details = getDetails($file);
        $readme .= "\n[" . $details['name'] . '](https://github.com/StevenRoddis/userscripts/blob/master/' . rawurlencode($script) . ")\n------------";
        //name & subheading
        /*if($details['author'])
        		$readme .= "\nAuthor: ".$details['author'];*/
        if ($details['description']) {
            $readme .= "\n" . $details['description'];
        }
        if ($details['screenshot']) {
            $readme .= "\n\n![Screenshot](" . $details['screenshot'] . ")";
        }
        $readme .= "\n\n------------";
    }
}
file_put_contents('../README.md', $readme);
Ejemplo n.º 24
0
        $ret = $value->nodeValue;
    }
    return $ret;
}
function getDetails($result)
{
    $html = new DOMDocument();
    $html->loadHTML($result);
    $xpath = new DOMXPath($html);
    $details = $xpath->query("//div[@class='detailssubbox']");
    $i = 0;
    $ret = "";
    foreach ($details as $value) {
        $i++;
        if ($i == 3) {
            $ret = $value->nodeValue;
        }
    }
    return $ret;
}
$title = getTitle($result);
$img = getImg($result, $title[0]);
$MRP = getMRP($result);
$offer = getOfferPrice($result);
$features = getFeatures($result);
$details = getDetails($result);
$myfile = fopen("results.txt", "w") or die("Unable to open file!");
$write = $img . "~" . $title . "~" . $MRP . "~" . $offer . "~" . $features . "~" . $details;
echo $write;
fwrite($myfile, $write);
fclose($myfile);
Ejemplo n.º 25
0
 * Date: 2016/1/28
 * Time: 21:40
 */
require 'includes/init.php';
require 'includes/config.php';
require 'includes/lib_products.php';
require 'includes/lib_comment.php';
$lang = $_SESSION['lang'];
$user = $_SESSION['member'];
require './lang/' . $_SESSION['lang'] . '/details.php';
$proj = trim($_GET['proj']);
require "data/{$proj}/pictureAddress.php";
$_SESSION['project'] = $proj;
$GLOBALS['db']->changeDB($proj);
$id = trim($_GET['id']);
$details = getDetails($id, 3, $lang);
/*获取目录*/
$directory = getDirectoryWithLink($proj);
/*获取图片相对地址*/
$addrs = $pictureAddresses[$id];
//print_r($comments);
//print_r($details['Pros']);
//print_r($details['Cons']);
$product = array('name' => $details['name'], 'manufacturer' => $details['manufacturer'], 'id' => $id);
$smarty->assign('title', $product['manufacturer'] . " " . $product['name']);
$smarty->assign('product', $product);
$smarty->assign('project', $proj);
$smarty->assign('score', $details['evaluations'][0]['value']);
$smarty->assign('evals', $details['evaluations'][0]);
$smarty->assign('props', $details['property']);
$smarty->assign("Pros", $details['Pros']);
Ejemplo n.º 26
0
function demoExecuteNanoSite()
{
    global $indexTemplateAreas, $indexTemplateLL;
    $sett = getDetails('settings');
    $catt = getDetails('cats');
    $indexLastModified = filemtime(NANO_CMS_PAGE);
    if ($sett['index-last-modified'] >= $indexLastModified) {
        return;
    }
    $removeFunctionList = array('show_sidebar', 'show_content_slug', 'show_title', 'require_once');
    $replaceFunction = 'dummyFunction';
    $demoContentToRun = file_get_contents(NANO_CMS_PAGE);
    $demoContentToRun = str_replace('show_content_area', 'readIntoAreaList', $demoContentToRun);
    $demoContentToRun = str_replace('show_links', 'readIntoLinksList', $demoContentToRun);
    $demoContentToRun = str_replace($removeFunctionList, $replaceFunction, $demoContentToRun);
    ob_start();
    eval(" ?> " . $demoContentToRun . " <?php ");
    $cont = ob_get_contents();
    ob_end_clean();
    MsgBox(lt("Template Changes Detected! Config & Settings updated!", 'template-changes-detected'));
    $newcatt = array_diff($indexTemplateLL, array_keys($catt));
    foreach ($newcatt as $newcatname) {
        $catt[$newcatname] = array();
    }
    foreach ($indexTemplateAreas as $k => $v) {
        $indexTemplateAreas[$k] = strtolower($v);
    }
    $sett['index-last-modified'] = $indexLastModified;
    $sett['def-template-areas'] = array_unique($indexTemplateAreas);
    $sett['def-template-links'] = array_unique($indexTemplateLL);
    setDetails('settings', $sett);
    setDetails('cats', $catt);
    savepages();
}
Ejemplo n.º 27
0
 function Tweak($tN)
 {
     global $tweakData;
     $activeTweaks = getDetails('active-tweaks');
     $this->tweakName = slugify($tN);
     $tweakData[$this->tweakName]['name'] = $tN;
     if (in_array($this->tweakName, $activeTweaks)) {
         $this->isActive = true;
     }
 }
Ejemplo n.º 28
0
$table->setColAttributes(1, "width=\"180\"");
# grab all the different server types
foreach ($server as $host) {
    $type[] = $host['type'];
}
# return only unique types
$types = array_unique($type);
# loop thru each unique type and make up status table
foreach ($types as $type) {
    $servers = findServers($type, "type");
    if (sizeof($servers) > 0) {
        $table->addRow(array(strtoupper($type) . " Servers"), $headerStyle, "TH");
        $table->setCellAttributes($table->getRowCount() - 1, 0, "colspan='" . $table->getColCount() . "'");
        for ($i = 0; $i < sizeof($servers); $i++) {
            $cur = current($servers);
            $status_array = getDetails($cur);
            # does this host contain a webui?
            # currently only RLM offers webui
            if (isset($cur["webui"])) {
                $host = "<a href=\"" . $cur["webui"] . "\">" . $cur["hostname"] . "</a>";
            } else {
                $host = $cur["hostname"];
            }
            $table->AddRow(array($host, $cur["desc"], strtoupper($status_array["status"]["service"]), $status_array["status"]["clients"], $status_array["status"]["listing"], $status_array["status"]["master"], $status_array["status"]["version"]));
            # Set the background color of status cell
            $table->updateCellAttributes($table->getRowCount() - 1, 2, "class='" . $status_array["status"]["service"] . "'");
            $table->updateCellAttributes(1, 0, "");
            # fetch status
            $statusMsg = AppendStatusMsg($statusMsg, $status_array["status"]["msg"]);
            # next!
            next($servers);
Ejemplo n.º 29
0
function getSingleTidList($tids, $imgMode = false)
{
    if (empty($tids)) {
        return array();
    }
    global $_G, $expireTime;
    //某用户组获取某些tids的信息
    $cacheKey = 'bigapp_group_tids_' . $_G['groupid'] . '_' . implode(', ', $tids);
    $md5Key = md5($cacheKey);
    true === BIGAPP_DEV && runlog('bigapp', 'bigapp group tids key: ' . $cacheKey . ', md5 key: ' . $md5Key);
    loadcache($cacheKey);
    $ret = array();
    if (!isset($_G['cache'][$md5Key]) || empty($_G['cache'][$md5Key]) || TIMESTAMP - $_G['cache'][$md5Key]['expiration'] > $expireTime) {
        //1. 获取本用户组允许浏览的板块
        $fInfos = getGroupFroumInfo();
        $fids = array_keys($fInfos);
        //2. 获取本用户组能获取到的主题,考虑板块因素
        $ret = getSingleThreadsFromForums($tids, $fids);
        //3. 扩展主题信息
        extendThreadsInfo($ret, $fInfos);
        //4. 获取附件图片的信息
        getDetails($ret);
        savecache($md5Key, array('variable' => $ret, 'expiration' => TIMESTAMP));
        true === BIGAPP_DEV && runlog('bigapp', 'save thread infos for group and tids [ cache key: ' . $cacheKey . ', md5 key: ' . $md5Key . ',  group id: ' . $_G['groupid'] . ', tids: ' . implode(', ', $tids) . ', img mode: ' . intval($imgMode) . ' ]');
    } else {
        true === BIGAPP_DEV && runlog('bigapp', 'get thread info from cache [ cache key: ' . $cacheKey . ', md5 key: ' . $md5Key . ', group id: ' . $_G['groupid'] . ', tids: ' . implode(', ', $tids) . ', img mode: ' . intval($imgMode) . ' ]');
        $ret = $_G['cache'][$md5Key]['variable'];
    }
    if (!$imgMode) {
        foreach ($ret as &$l) {
            $l['message_abstract'] = '';
            $l['attachment_urls'] = array();
        }
        unset($l);
    }
    return $ret;
}
Ejemplo n.º 30
-1
if ($argc < 2) {
    showHelp();
} else {
    if (!isset($argv[1])) {
        exit("Must specify a directory to scan\n");
    }
    if (!is_dir($argv[1])) {
        exit($argv[1] . "' is not a directory\n");
    }
    echo "\ndirList-JSON-Hash by aancw\n\n";
    $useHash = false;
    $urlPrefix = "";
    for ($i = 1; $i < $argc; $i++) {
        if ($argv[$i] == "-hash") {
            $useHash = true;
        }
        if ($argv[$i] == "-u") {
            $urlPrefix = $argv[$i + 1];
        }
    }
    echo "Please be patient because sometime it take long time depend on how big your directory size :)\n";
    $realPath = realpath($argv[1]);
    $dirRoot = basename($realPath);
    $outputJSON = json_encode(getDetails(getList($argv[1]), $useHash, $realPath, $dirRoot, $urlPrefix), JSON_PRETTY_PRINT);
    $filename = "output-" . date("Ymd-His") . ".json";
    echo "Creating JSON File " . $filename . "\n";
    $fh = fopen($filename, 'w');
    fwrite($fh, $outputJSON);
    fclose($fh);
    echo "Done! Your JSON has been saved to " . $filename . "\n";
}