Exemple #1
0
 function drawLinks()
 {
     global $current_page, $num_edge_entries, $num_display_entries, $ellipse_text, $prev_text, $next_text, $prev_show_always, $next_show_always;
     $interval = getInterval();
     $np = numPages();
     // Generate "Previous"-Link
     if ($prev_text && ($current_page > 0 || $prev_show_always)) {
         appendItem($current_page - 1, array("text" => $prev_text, "classes" => "prev"));
     }
     // Generate starting points
     if ($interval[0] > 0 && $num_edge_entries > 0) {
         $end = min($num_edge_entries, $interval[0]);
         for ($i = 0; $i < $end; $i++) {
             appendItem($i);
         }
         if ($num_edge_entries < $interval[0] && $ellipse_text) {
             echo "<span>" . $ellipse_text . "</span>";
         }
     }
     // Generate interval links
     for ($i = $interval[0]; $i < $interval[1]; $i++) {
         appendItem($i);
     }
     // Generate ending points
     if ($interval[1] < $np && $num_edge_entries > 0) {
         if ($num_edge_entries < $interval[1] && $ellipse_text) {
             echo "<span>" . $ellipse_text . "</span>";
         }
         $begin = max($np - $num_edge_entries, $interval[1]);
         for ($i = $begin; $i < $np; $i++) {
             appendItem($i);
         }
     }
     // Generate "Next"-Link
     if ($next_text && ($current_page < $np - 1 || $next_show_always)) {
         appendItem($current_page + 1, array("text" => $next_text, "classes" => "next"));
     }
 }
function createAutoblog($type, $sitename, $siteurl, $rssurl)
{
    if ($type == 'generic' || empty($type)) {
        $var = updateType($siteurl);
        $type = $var['type'];
        if (!empty($var['name'])) {
            if (!stripos($siteurl, $var['name'] === false)) {
                $sitename = ucfirst($var['name']) . ' - ' . $sitename;
            }
        }
    }
    if (folderExists($siteurl, $rssurl)) {
        throw new Exception('Erreur : l\'autoblog ' . $sitename . ' existe déjà.');
    }
    $foldername = urlToFolder($siteurl, $rssurl);
    if (mkdir($foldername, 0755, false)) {
        $fp = fopen($foldername . '/index.php', 'w+');
        if (!fwrite($fp, "<?php require_once '../autoblog.php'; ?>")) {
            throw new Exception('Impossible d\'écrire le fichier index.php');
        }
        fclose($fp);
        $fp = fopen($foldername . '/vvb.ini', 'w+');
        if (!fwrite($fp, '[VroumVroumBlogConfig]
SITE_TYPE="' . $type . '"
SITE_TITLE="' . $sitename . '"
SITE_DESCRIPTION="Site original : <a href=\'' . $siteurl . '\'>' . $sitename . '</a>"
SITE_URL="' . $siteurl . '"
FEED_URL="' . $rssurl . '"
ARTICLES_PER_PAGE="' . getArticlesPerPage($type) . '"
UPDATE_INTERVAL="' . getInterval($type) . '"
UPDATE_TIMEOUT="' . getTimeout($type) . '"')) {
            throw new Exception('Impossible d\'écrire le fichier vvb.ini');
        }
        fclose($fp);
    } else {
        throw new Exception('Impossible de créer le répertoire.');
    }
    updateXML('new_autoblog_added', 'new', $foldername, $sitename, $siteurl, $rssurl);
    unlink(AUTOBLOGS_CACHE_FILENAME);
}
Exemple #3
0
<?php 
$query = $DB->query("SELECT COUNT(*) AS plc FROM `" . DB_PREFIX . "_Players` WHERE game = '" . $DB->real_escape_string($game) . "'");
$result = $query->fetch_assoc();
$num_players = $result['plc'];
$query = $DB->query("SELECT COUNT(*) AS sc FROM `" . DB_PREFIX . "_Servers` WHERE game = '" . $DB->real_escape_string($game) . "'");
$result = $query->fetch_assoc();
$num_servers = $result['sc'];
$lastevent = false;
$query = $DB->query("SELECT MAX(eventTime) as lastEvent\n\t\tFROM `" . DB_PREFIX . "_Events_Frags` AS ef\n\t\tLEFT JOIN `" . DB_PREFIX . "_Servers` AS s\n\t\t\tON s.serverId = ef.serverId\n\t\tWHERE s.game = '" . $DB->real_escape_string($game) . "'");
if (SHOW_DEBUG && $DB->error) {
    var_dump($DB->error);
}
$result = $query->fetch_assoc();
if (!empty($result['lastEvent'])) {
    $timstamp = strtotime($result['lastEvent']);
    $lastevent = getInterval($timstamp);
}
$query->free();
?>
<p>
	<ul>
		<li>
			<?php 
echo "<b>{$num_players}</b> ", l('players'), " ", l('ranked on'), " <b>{$num_servers}</b> ", l('servers'), ".";
?>
		</li>
		<?php 
if ($lastevent) {
    ?>
			<li>
				<?php 
 //echo "URL Used / Accessed: ".$dSensorURL."</br>";
 $dSoutput = post_data($dSensorURL, $dSensorstring);
 //print_r($dSoutput);
 // a. Quantity
 $Quantity = array('Quantity', 'definition');
 $myQuantity = parse_describeSense($dSoutput, $Quantity);
 $myCleanQuantity = cleanQuantity($myQuantity);
 //print_r($myCleanQuantity);
 // b. co-ordinates
 $reference = array('Point', 'srsName', 'gml:id');
 $myCoOrd = getCoOrdinates($dSoutput, $reference);
 //echo "</br></br>";
 //print_r($myCoOrd);
 // c. Sensing time Interval
 $reference = 'interval';
 $myInterval = getInterval($dSoutput, $reference);
 //echo "</br></br>";
 //print_r($myInterval);
 $SampleTbegin = getTimeSeperated($myInterval[0]['interval']['begin']);
 $SampleTend = getTimeSeperated($myInterval[0]['interval']['end']);
 echo "<table border=0>";
 echo "<tr><td><b> Server URL </b></td><td>" . $_SESSION['rawURL'] . "</td></tr>";
 echo "<tr><td><b> Sensor Name </b></td><td>" . $myCoOrd[0]['gml:id'] . "</td></tr>";
 echo "<tr><td><b> Sensor Deployment Date </b></td><td>Date : " . $SampleTbegin[0] . " Time : " . $SampleTbegin[1] . "</td></tr>";
 echo "<tr><td><b> Last Update </b></td><td>Date : " . $SampleTend[0] . " Time : " . $SampleTend[1] . "</td></tr>";
 echo "<tr><td><b>" . $myCleanQuantity[0]['Quantity'] . "</b></td><td>" . $myCleanQuantity[0]['Value'] . " mV</td></tr>";
 echo "<tr><td><b>" . $myCleanQuantity[1]['Quantity'] . "</b></td><td>" . $myCleanQuantity[1]['Value'] . " bytes </td></tr>";
 echo "<tr><td><b>" . $myCleanQuantity[2]['Quantity'] . "</b></td><td>" . $myCleanQuantity[2]['Value'] . " minutes </td></tr>";
 echo "<tr><td><b>" . $myCleanQuantity[3]['Quantity'] . "</b></td><td>" . $myCleanQuantity[3]['Value'] . " minutes </td></tr>";
 echo "<tr><td><b> Co-Ordinate Reference System </b></td><td>" . $myCoOrd[0]['srsName'] . "</td></tr>";
 echo "<tr><td><b> Latitude </b></td><td>" . $myCoOrd[0]['coordinates']['lat'] . " decimal degrees </td></tr>";
Exemple #5
0
mysqli_select_db($link, $database) or die("Database tidak bisa dibuka");
$act = $_GET['act'];
switch ($act) {
    case 'getbarang':
        if (isset($_GET['po_id'])) {
            getBarang($link, $_GET['po_id'], $_GET['rak_id']);
        }
        break;
    case 'getbarangorder':
        if (isset($_GET['po_id'])) {
            getBarangOrder($link, $_GET['po_id']);
        }
        break;
    case 'getinterval':
        if (isset($_POST['supplierId'])) {
            echo json_encode(getInterval($link, $_POST['supplierId']));
        }
        break;
    case 'tambahrpo':
        $rpoId = tambahRpo($link, $_POST['param']);
        tambahRpoDetail($link, $rpoId, $_POST['param']['supplier_id']);
        header('location:input.php?id=' . $rpoId);
        break;
    case 'hitung':
        $poId = $_POST['poId'];
        $barcode = $_POST['barcode'];
        /*
         * Ambil hasil perhitungan untuk avg daily sales dan saran order
         */
        $hasil = hitung($link, $poId, $barcode);
        /*
 function ActualStEdTime($StoreRawURL, $DescribeSenStr, $myProcedure, $RespFormat)
 {
     $ArrayOfTime = array();
     for ($i = 0; $i < sizeof($myProcedure); $i++) {
         $dSensorURL = GetDescribeSenURL2($DescribeSenStr, $myProcedure[$i], $RespFormat);
         $dSensorURL = $StoreRawURL . $dSensorURL;
         $dSensorstring = "";
         //
         //echo "URL Used / Accessed: ".$dSensorURL."</br>";
         $dSoutput = post_data($dSensorURL, $dSensorstring);
         //print_r($dSoutput);
         // c. Sensing time Interval
         $reference = 'interval';
         $myInterval = getInterval($dSoutput, $reference);
         //echo "</br></br>";
         //print_r($myInterval);
         $SampleTbegin = $myInterval[0]['interval']['begin'];
         $SampleTend = $myInterval[0]['interval']['end'];
         $ArrayOfTime[$i][0] = $SampleTbegin;
         $ArrayOfTime[$i][1] = $SampleTend;
     }
     return $ArrayOfTime;
 }