コード例 #1
0
function getProducts(simple_html_dom $DOM, $exact_gpu)
{
    $product = array();
    $items = $DOM->getElementById('LFrame_prdList_pnlGridView');
    if (empty($items)) {
        echo '<h1 style="color:#fff;padding:64px 0;">EVGA Down for maintenance or experiencing technical difficulties</h1>';
        return false;
    }
    foreach ($items->find('div.grid-item-outer') as $td) {
        $title = $td->find('a.pl-grid-pname');
        $title = checkSet($title);
        if ($exact_gpu !== '') {
            // Only add gpu listing to the array which contain $exact_gpu
            if (stristr($title, $exact_gpu) !== false) {
            } else {
                continue;
            }
        }
        $GPUlink = $title->href;
        $title->href = 'http://www.evga.com' . $GPUlink;
        $title->style = '';
        $img = $td->find('img');
        $img = checkSet($img);
        $imgsrc = $img->src;
        $part = $td->find('p.pl-grid-pn');
        $part = checkSet($part);
        $part = str_replace('Part Number: ', '', $part);
        $desc = $td->find('div.pl-grid-info ul');
        $desc = checkSet($desc);
        $price = $td->find('p.pl-grid-price');
        $price = checkSet($price);
        $sale = $td->find('.btnAddCart');
        if (isset($sale[0])) {
            $sale = '<a href="http://www.evga.com' . $GPUlink . '" class="btn btn-success">In Stock</a>';
        } else {
            $sale = '<a href="#" class="btn btn-default" disabled="disabled">OOS</a>';
        }
        $product[$part] = array('title' => trim($title), 'img' => trim($imgsrc), 'part' => preg_replace('/\\s+/', ' ', $part), 'desc' => preg_replace('/\\s+/', ' ', $desc), 'price' => preg_replace('/\\s+/', ' ', $price), 'sale' => trim($sale));
        unset($GPUlink);
        unset($imgsrc);
    }
    return $product;
}
コード例 #2
0
<?php

header('Content-type: text/csv');
ini_set("auto_detect_line_endings", true);
$FN_FILE = './data/CSV_Database_of_First_Names.csv';
$LN_FILE = './data/CSV_Database_of_Last_Names.csv';
$NUM_RECORDS = checkSet('recordcount', 100, false);
$FN_Array = csvToArray($FN_FILE);
$FN_Array_Sz = count($FN_Array);
$LN_Array = csvToArray($LN_FILE);
$LN_Array_Sz = count($LN_Array);
$output = array();
//CSV Header
$output[] = array('Mother', 'DOB', 'Father', 'DOB', 'Son', 'DOB', 'Daughter', 'DOB');
for ($i = 0; $i < $NUM_RECORDS; $i++) {
    $surName = rand(1, $LN_Array_Sz - 1);
    $output[] = array($FN_Array[rand(1, $FN_Array_Sz - 1)][0] . ' ' . $LN_Array[rand(1, $LN_Array_Sz - 1)][0], date("m/d/Y"), $FN_Array[rand(1, $FN_Array_Sz - 1)][0] . ' ' . $LN_Array[$surName][0], date("m/d/Y"), $FN_Array[rand(1, $FN_Array_Sz - 1)][0] . ' ' . $LN_Array[$surName][0], date("m/d/Y"), $FN_Array[rand(1, $FN_Array_Sz - 1)][0] . ' ' . $LN_Array[$surName][0], date("m/d/Y"));
}
str_putcsv($output);
echo implode(PHP_EOL, $output);
function str_putcsv(&$array)
{
    $arraySz = count($array);
    for ($i = 0; $i < $arraySz; $i++) {
        $array[$i] = implode(',', $array[$i]);
    }
    return $array;
}
function csvToArray($fileName)
{
    $array = array();
コード例 #3
0
ファイル: index.php プロジェクト: scirelli/garminparser
<?php

session_start();
require_once 'lib/checkSet.php';
$serverURL = 'http://' . $_SERVER['HTTP_HOST'] . '/garmin';
$sessionID = isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : '';
$uid = checkSet('uid', '', false);
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Garmin TCX to GPX</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">

        <script src="js/vendor/modernizr-2.6.2.min.js"></script>
    </head>
    <body>
        <!--[if eq IE]>
            <p class="chromeframe">You are using a <strong>PoS</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->
        <div id="wrap">
コード例 #4
0
ファイル: ready.php プロジェクト: scirelli/garminparser
<html>
    <body>
        <?php 
require_once './lib/fileZipper.php';
require_once './setup.php';
require_once './lib/getDirFiles.php';
require_once './lib/checkSet.php';
require_once './lib/GarminConverter.php';
require_once './lib/TCXFileSplitter.php';
require_once './lib/GPSVisualizerFileDownload.php';
$ffGPXFileName = checkSet('ffGPXFileName', microtime(true), false);
/*
//Start Converting
$files = getDirFiles( './data/Tracks', 'tcx' ); 
$cvtr = new GarminConverter();
$vfd  = new GPSVisualizerFileDownload();
echo '<table><thead><tr><th>Count</th><th>Files</th></tr></thead><tbody>';
for( $i=0,$l=count($files); $i<$l; $i++ ){
    echo '<tr><td>' . $i . '</td><td>';
    echo 'Converting: ' . $files[$i] . '<br/>';
    $url  = $cvtr->convert( $paths['trackDir'] . $files[$i] );
    if( $url ){
        $vfd->saveAs( $files[$i] . '.gpx', $url );
        echo 'Saved: ' . $files[$i] . '.gpx';
    }else{
        echo $url;
    }
    echo '</td></tr>';
    flush();
}
echo '</tbody></table><br/>';
コード例 #5
0
			loadIntClass($c['command']);
			eval('new '.ucwords($c['command']).'('.$params.');');
			unset($cronJobs[$i]);
		}
	}
}
	
function setCron(){
	global $cronJobs;
	$string = '<?php $cronJobs = array(';
	$first2 = true;
	while(list($k,$v) = each($cronJobs)){
		if(!$first2) $string .= ',';
		$first2 = false;
		$string .= 'array(\'time\'=>'.$v['time'].',\'command\'=>\''.$v['command'].'\',\'parameters\'=>array(';
		$first3 = true;																							
		for($z = 0; $z < count($v['parameters']);++$i){
			if(!$first3) $string .=',';
			$first3 = false;
			$string .= '\''.$v['parameters'][$z].'\'';
		}
		$string .= '))';
	}
	$string .=');';
	$fileloc = fopen(ROOT.DS.MAIN.DS.'library'.DS.'cron_jobs.php', 'w');
	fwrite($fileloc,$string);
	fclose($fileloc);
}
checkSet();
setCron();
exit;
コード例 #6
0
    } else {
        // if all is well, we return TRUE
        return TRUE;
    }
}
// check ALL the REQUEST variables
function checkSet()
{
    return isset($_REQUEST['userName'], $_REQUEST['userPassword'], $_REQUEST['userRepeatPass'], $_REQUEST['userEmail'], $_REQUEST['userCell'], $_REQUEST['userCarrier']);
}
function checkEmail($email)
{
    return preg_match('/^\\S+@[\\w\\d.-]{2,}\\.[\\w]{2,6}$/iU', $email) ? TRUE : FALSE;
}
// check all our variables are set
if (checkSet() != FALSE) {
    // Sanity check the username variable.
    if (empty($_REQUEST['userName']) == FALSE && sanityCheck($_REQUEST['userName'], 'string', 25) != FALSE) {
        if (User::find('username', $_REQUEST['userName']) != NULL) {
            echo '<p style="color:red">Username is already in use.  Please try another username.</p>';
            exit;
        } else {
            $userName = $_REQUEST['userName'];
        }
    } else {
        echo '<p style="color:red">Username is not set</p>';
        $_REQUEST['userName'] = '';
        exit;
    }
    // *************** TODO **************
    // *Verify that username is available*
コード例 #7
0
ファイル: frame.php プロジェクト: scirelli/spiderman
require_once '../../constants.php';
require_once BASEPATH . 'lib/checkSet.php';
require_once BASEPATH . 'lib/ITimer.php';
require_once BASEPATH . 'lib/SCTimerSimple.php';
require_once '../assets/lib/WebUtils.php';
require_once '../assets/lib/IDocParser.php';
require_once '../assets/lib/IParserListener.php';
require_once '../assets/lib/CompositeDocParser.php';
require_once '../assets/lib/Parsers/LogParser.php';
require_once '../assets/lib/AnchorParser.php';
require_once '../assets/lib/ParserFactory.php';
require_once '../assets/lib/spiderman.php';
$ffRoot = checkSet('ffRoot', '', false);
$ffLimits = checkSet('ffLimits', null, false);
$ffAvoid = checkSet('ffAvoid', null, false);
$ffParsers = checkSet('ffParsers', '', false);
if ($ffLimits != null) {
    $ffLimits = explode(',', $ffLimits);
}
if ($ffAvoid != null) {
    $ffAvoid = explode(',', $ffAvoid);
}
if ($ffParsers != null) {
    $ffParsers = explode(',', $ffParsers);
} else {
    $ffParsers = array();
}
?>
<html>
    <head>
        <style type="text/css">