コード例 #1
0
ファイル: vortex.php プロジェクト: ramsay/ramsay-snippets
function get_vortex($vidStr = '', $max_image = 243, $max_quote = 184)
{
    $za = ord('0');
    // Zero ascii code offset.
    if (strlen($vidStr) == 18) {
        //decode vid string to a vortex id.
        for ($i = 0; $i < 18; $i += 3) {
            $vid[$i / 3] = (ord($vidStr[$i]) - $za) * 100;
            $vid[$i / 3] += (ord($vidStr[$i]) - $za) * 10;
            $vid[$i / 3] += ord($vidStr[$i]) - $za;
        }
    } else {
        //Generate a new vortex id
        $vid = array();
        for ($i = 0; $i < 3; $i++) {
            $vid[$i * 2 + 1] = rand(1, $max_quote);
            $vid[$i * 2] = rand(1, $max_image);
        }
    }
    $response = array();
    $response['vid'] = join($vid);
    $panels = array();
    for ($i = 0; $i < 3; $i++) {
        $panels[$i] = array();
        $panels[$i]['image'] = 'http://www.peculiarcomics.com/vortex/img/' . str_pad($vid[$i * 2], 3, '0', STR_PAD_LEFT) . '.jpg';
        $panels[$i]['quote'] = get_quote($vid[$i * 2 + 1]);
    }
    $response['panels'] = $panels;
    return $response;
}
コード例 #2
0
ファイル: import.php プロジェクト: nicost/phplabware
            }
            fclose($fh);
            @unlink("{$tmpdir}/{$tmpfile}");
            printfooter();
        }
        exit;
    }
}
// interpret uploaded file and get information for final parsing (part 2)
if ($_POST['dataupload'] == 'Continue' && may_write($db, $tableid, false, $USERAS)) {
    if ($error_string) {
        echo $error_string;
    }
    $filename = $_FILES['datafile']['name'];
    $delimiter = get_delimiter($delimiter, $delimiter_type);
    $quote = get_quote($quote, $quote_type);
    if ($delimiter && $tableid && $ownerid && ($filename || $tmpfile || $localfile)) {
        if (!$system_settings['filedir']) {
            echo "<h3><i>Filedir</i> was not set.  Please correct this first in <i>setup</i></h3>\n";
            printfooter();
            exit;
        }
        $tmpdir = $system_settings['tmpdir'];
        if ($tmpfile || $localfile || move_uploaded_file($_FILES['datafile']['tmp_name'], "{$tmpdir}/{$filename}")) {
            if ($tmpfile) {
                $filename = $tmpfile;
            }
            // lcoalfiles can also have associated files packaged with them
            if ($localfile) {
                $dumpdir = 'phplabwaredump';
                $filename = $dumpdir . '/dumpcontent.txt';
コード例 #3
0
ファイル: stock.php プロジェクト: jamesrusso/Aastra_Scripts
             }
             $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
         }
     }
     break;
     # Summary
 # Summary
 case 'summary':
     # Retrieve favorites
     $data = Aastra_get_user_context($user, 'stock');
     foreach ($data['favorites'] as $key => $value) {
         if ($value != '') {
             $array[] = $value;
         }
     }
     $return = get_quote($array);
     # Return OK
     if ($return[0]) {
         # Create the object
         require_once 'AastraIPPhoneFormattedTextScreen.class.php';
         $object = new AastraIPPhoneFormattedTextScreen();
         # No color FTS
         if (!Aastra_is_formattedtextscreen_color_supported()) {
             # Process the results
             $nb_carac = Aastra_size_display_line();
             $object->setScrollStart(Aastra_size_formattedtextscreen());
             foreach ($return[1] as $key => $value) {
                 if ($value != NULL) {
                     if ($value[8] != 'N/A') {
                         $last = 'Not Found';
                     } else {