Esempio n. 1
0
/**
 * 从指定URL抓取资源,并将该资源存储到指定空间中
 *
 * @param $url 指定的URL        	
 * @param $bucket 目标资源空间        	
 * @param $key 目标资源文件名        	
 *
 * @return array[] 包含已拉取的文件信息。
 *         成功时: [
 *         [
 *         "hash" => "<Hash string>",
 *         "key" => "<Key string>"
 *         ],
 *         null
 *         ]
 *        
 *         失败时: [
 *         null,
 *         Qiniu/Http/Error
 *         ]
 * @link http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html
 */
function Qiniu_Fetch($self, $url, $bucket, $key)
{
    global $QINIU_FETCH_HOST;
    $resource = base64_urlSafeEncode($url);
    $to = entry($bucket, $key);
    $url = $QINIU_FETCH_HOST . '/fetch/' . $resource . '/to/' . $to;
    return Qiniu_Client_Call($self, $url);
}
Esempio n. 2
0
<?php

$title = "whitespace code";
require "header.php";
entry("what is it?", 'wsdebug is a debugger for the more or
		less famous whitespace programming language, coming along
		with a rather fast interpreter (wsi).
		[ <a href="index.php">more info</a> ]
		');
?>
<hr width="40%"><br><?php 
entry("brainfuck interpreter in whitespace", 'well, first of all, I don\'t really know what that could
		 be good for, but now it\'s written - and I like it :)
		 <br><ul>
		 <li><a href="wsbfi-1.ws">first release</a></li>
		 </ul>');
require "footer.php";
Esempio n. 3
0
                } elseif (preg_match('/^ZZ-art/i', $line['code'])) {
                    $category = 'art';
                } elseif (preg_match('/^ZZ-online/i', $line['code'])) {
                    $category = 'online';
                } elseif (preg_match('/^ZZ-class/i', $line['code'])) {
                    $category = 'class';
                } elseif (preg_match('/^ZZ-gift/i', $line['code'])) {
                    $category = 'gift';
                }
                $sales[$category] = bcadd($sales[$category], $line['price']);
                $total = bcadd($total, $line['price']);
                $costs = bcadd($costs, $line['cost']);
            }
            // $sale[subtotal] is has polarity opposite what we've done for total
            if ($total != bcmul($sale['subtotal'], -1)) {
                $sales['supplies'] = bcsub($sales['supplies'], bcadd($sale['subtotal'], $total));
            }
            foreach ($sales as $category => $amount) {
                // sale
                entry($sale['date'], $memo, $account[$category], $amount);
            }
            if ($costs != "0.00") {
                entry($sale['date'], $memo, $account['inventory'], $costs);
                entry($sale['date'], $memo, $account['costofgoods'], bcmul($costs, -1));
            }
            break;
        default:
            die("Unable to handle transaction type '{$sale['type']}'");
    }
    echo "\r\n";
}
Esempio n. 4
0
        $sentence .= "{$noun} {$verb} {$object}. ";
        $i++;
    }
    return $sentence;
}
function entry()
{
    $paragraphs = "";
    $i = 0;
    while ($i <= 4) {
        $paragraphs .= "<p>" . paragraph() . "</p>";
        $i++;
    }
    return $paragraphs;
}
$random_text = array('title' => 'Random Text', 'body' => entry());
$posts = array($random_text);
if ($_POST) {
    $title = $_POST['new_post_title'];
    $body = $_POST['new_post_body'];
    $posts[] = array('title' => $title, 'body' => $body);
}
?>



<h2>Forms</h2>
<div class="post_body">
<form action="" id="new_post" method="post">
  <fieldset><legend><a href="" onclick="return false;">New Post</a></legend>
	<p>
Esempio n. 5
0
    return $path;
}
function show_false(string $path)
{
    return realpath($path);
}
foreach ($paths as $path) {
    var_dump(file_exists($path));
    // return true
    var_dump(realpath($path));
    // return false
    var_dump(let_it_work($path));
    // it's work
    var_dump(show_false($path));
    // return false
}
function entry(DirectoryIterator $dir = null)
{
    if ($dir === null) {
        $dir = new DirectoryIterator(__DIR__);
    }
    foreach ($dir as $item) {
        $path = $item->getPathname();
        var_dump(file_exists($path));
        // true
        var_dump($item->getRealPath());
        // false
    }
}
entry(new DirectoryIterator('phar://phar_test.phar'));
Esempio n. 6
0
 // /entry.php/<id>
 if (count($path_components) >= 2 && $path_components[1] != "") {
     // Interpret <id> as integer
     $entry_id = intval($path_components[1]);
     // Look up object via ORM
     $entry = Entry::findByID($entry_id);
     if ($entry == null) {
         // Todo not found.
         header("HTTP/1.0 404 Not Found");
         print "Entry id: " . $entry_id . " not found.";
         exit;
     }
     // Check to see if deleting
     if (isset($_REQUEST['delete'])) {
         $entry->delete();
         entry("Content-type: application/json");
         print json_encode(true);
         exit;
     }
     // $new_start_date = false;
     // $new_start_date_obj = null;
     // if ($new_date) {
     //   // $new_start_date = true;
     //   // $date_str = trim($_REQUEST['start_date']);
     //   if ($new_date != "") {
     //     $new_start_date_obj = new DateTime($date_str);
     //   }
     // }
     // $new_end_date = false;
     // $new_end_date_obj = null;
     // if (isset($_REQUEST['end_date'])) {
Esempio n. 7
0
<?php

$title = "download";
require "header.php";
entry("what is it?", 'wsdebug is a debugger for the more or
		less famous whitespace programming language, coming along
		with a rather fast interpreter (wsi).
		[ <a href="index.php">more info</a> ]
		');
?>
<hr width="40%"><br><?php 
entry("wsdebug currently is in alpha-state", 'I\'m currently putting much effort into progressing the
		 development of wsdebug. However my time is a quite limited
		 resource. That\'s why there currently is no release,
		 only the CVS thingy (which\'s however working quite reliable).');
entry("how to get most recent CVS wsdebug thingy?", 'do something like this on your command prompt: <pre>
		cvs -z3 -d:pserver:anonymous@cvs.wsdebug.berlios.de:/cvsroot/wsdebug co wsdebug
		</pre>');
require "footer.php";
Esempio n. 8
0
<?php

$title = "information";
require "header.php";
entry("what is it?", "wsdebug is a debugger for the more or\n\t\tless famous whitespace programming language, coming along\n\t\twith a rather fast interpreter (wsi).");
entry("what the hell is whitespace?", 'Most programming languages like C or Perl do not care for 
		white space characters (like tab, space or newline/linefeed).
		The whitespace programming language works just the other way
		round, don\'t care for any character but those white space ones.
		<br>
		On the whole it\'s just another geeky language like Brainf\'ck
		and others, however more adicting. For details see 
		<a href="http://compsoc.dur.ac.uk/whitespace/">these pages</a>,
		put together by Edwin Brady, the inventor of this language.');
entry("why do I need a debugger then?", 'That\'s kinda easy to answer. If you\'ve written a whole lot
		of instructions you\'ll probably reach the point, where you
		get lost. Then just put your script into wsdebug and step
		through your bunch of whitespace instructions and watch how
		each command manipulates the stack (or heap).
		<br>
		You\'re using another interpreter, that just somewhere aborts?
		Just run your prog through either wsi and wsdebug and watch
		out what it tells, i.e. if a ws-program aborts somewhere, it
		always writes out where it crashed along with a stack dump.');
entry("what now?", '<ul>' . '<li><a href="download.php">download</a></li>' . '<li><a href="somecode.php">some whitespace code</a></li>' . '<li><a href="wspacegen.php">wspacegen</a></li>' . '</ul>');
require "footer.php";
Esempio n. 9
0
<?php

$title = "wspacegen";
require "header.php";
entry("what is it?", 'wsdebug is a debugger for the more or
		less famous whitespace programming language, coming along
		with a rather fast interpreter (wsi).
		[ <a href="index.php">more info</a> ]
		');
?>
<hr width="40%"><br><?php 
entry("wspacegen", 'wspacegen is a nice little tool, allowing to easily put
		 a whitespace program together. It offers you a hierarchic
		 menu system, where you simply choose the commands you\'d
		 like to append, one after another.
		 <br>It\'s using wsdebug\'s approach towards memory management,
		 actually wspacegen and wsdebug used to be one thing, but
		 got forked right after starting.');
entry("wspacegen's hiccups?", 'It\'s yet in pre-alpha state, not allowing to edit or delete
		 stuff. But on the whole I guess it\'s a good idea and a new
		 approach towards whitespace coding.');
entry("where can I get it?", 'If you\'d like to have a closer look at wspacegen,
		<a href="http://sf.net/projects/wspacegen">come here</a>');
require "footer.php";
Esempio n. 10
0
        $date = date('Y-m-d', $t);
        foreach ($snt["who"] as $id) {
            echo "<li><a href=\"reg_abstract?id={$id}&amp;date={$date}\">" . get_member_name($id) . "</a></li>\n";
        }
        echo "</ul>\n";
        echo "</li>\n";
    }
    echo "</ul>\n";
    echo "</div>\n";
}
function reg()
{
    $id = get_valid_id($_REQUEST["id"]);
    $date = get_valid_date($_REQUEST["date"]);
    $t = strtotime($date);
    $talk_data = get_talk_data_or_gen($t, $id);
    if (file_exists(gen_memo_filename($t, $id))) {
        $memo_filename = date('ymd', $t) . "_{$id}.pdf";
        $link = "http://ropas.snu.ac.kr/snt_memo2/" . $memo_filename;
        $memo = "<a href=\"" . $link . "\">" . $memo_filename . "</a>";
    } else {
        $memo = "등록된 메모가 없습니다.";
    }
    $arr = array("ID" => $id, "NAME" => get_member_name($id), "WHEN" => $date, "TITLE" => htmlspecialchars($talk_data["title"]), "ABSTRACT" => htmlspecialchars($talk_data["abstract"]), "MEMO" => $memo);
    echo replace(__ROOT__ . "/template/reg_abstract.temp", $arr);
}
if (my_key_exists("id", $_REQUEST)) {
    reg();
}
entry();
require __ROOT__ . '/template/footer.temp';