当前位置: 首页>>代码示例>>PHP>>正文


PHP ewiki_db::CREATE方法代码示例

本文整理汇总了PHP中ewiki_db::CREATE方法的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_db::CREATE方法的具体用法?PHP ewiki_db::CREATE怎么用?PHP ewiki_db::CREATE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ewiki_db的用法示例。


在下文中一共展示了ewiki_db::CREATE方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ewiki_cache_url

function ewiki_cache_url($url, $cache_min = 1200)
{
    global $ewiki_cache_ctype;
    #-- check if fresh enough in cache (20min)
    $data = ewiki_db::GET($url);
    if (time() <= $data["lastmodified"] + $cache_min) {
        $ewiki_cache_ctype = $data["Content-Type"];
        return $data["content"];
    }
    #-- retrieve
    $req = new http_request("GET", $url);
    $req->header["Accept"] = "application/atom+xml, application/rss+xml, text/rss, xml/*, */*rss*";
    if ($data["meta"]["Last-Modified"]) {
        $req->headers["If-Modified-Since"] = $data["meta"]["Last-Modified"];
    }
    if ($data["meta"]["Etag"]) {
        $req->headers["If-None-Match"] = $data["meta"]["Etag"];
    }
    $result = $req->go();
    #-- create/overwrite cache entry
    if ($result->status == 200) {
        $data = ewiki_db::CREATE($url, 0x0, "ewiki_cache_url");
        $data["flags"] = 0x0;
        $data["content"] = $result->body;
        foreach ($result->headers as $i => $v) {
            $data["meta"][$i] = $v;
        }
        $data["meta"]["class"] = "temp";
        $data["meta"]["kill-after"] = time() + $cache_min;
        if ($t = $data["meta"]["Last-Modified"]) {
            //    $data["lastmodified"] = ewiki_decode_datetime($t);
        }
        ewiki_db::WRITE($data, "_OVERWRITE=1");
    }
    $ewiki_cache_ctype = $data["Content-Type"];
    return $data["content"];
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:37,代码来源:http_cache.php

示例2: PUT

 function PUT($path, $ct, $charset)
 {
     #-- let's call the auth routine once more??
     $this->auth();
     #-- get old page version
     $id = $this->id($path);
     $data = ewiki_db::GET($id) or $data = ewiki_db::CREATE($id);
     #-- read from whereever
     $data["content"] = $this->get_body();
     #-- check content-type
     if ($ct != "text/wiki" && $ct != "text/plain") {
         return "422 Only WikiPages Accepted";
     }
     #-- save back to db
     ewiki_db::UPDATE($data);
     $data["version"] += 1;
     $ok = ewiki_db::WRITE($data);
     #-- handle response here
     if ($ok) {
         return "200 Written Successfully";
     }
     return "500 Couldn't Save";
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:23,代码来源:webdav.php

示例3: ewiki_mpi_bugreport

function ewiki_mpi_bugreport($action, $args, &$iii, &$s)
{
    global $ewiki_id;
    $MAIN = $ewiki_id;
    //"BugReports";
    $ELSE = $args[0] or $ELSE = rtrim($MAIN, "s");
    $o = "";
    if ($_REQUEST["br_save"]) {
        #-- check parameters
        $content = $_REQUEST["content"];
        $title = $_REQUEST["title"];
        $author = $_REQUEST["author"];
        if (strlen($content) < 50) {
            return "<p><b>Insufficient information for a useful BugReport.</b></p>";
        }
        if (strstr($title, "???")) {
            $title = substr($content, 0, 50);
        }
        #-- make page name for bug report
        $new_id = ewiki_title_to_pagename($title, $ELSE);
        #-- generate bug page text
        $new = "This page is part of the {$MAIN} series. Please go there to submit a new bug or to see the list of all existing reports.\n";
        if ($m = $_REQUEST["br_notify"]) {
            $new .= "\n[notify:{$m}]\n";
        }
        $new .= "\n----\n\n" . "!! {$title}\n\n";
        foreach ($_REQUEST["i"] as $i => $v) {
            if ($v != "unknown") {
                $new .= "| {$i} | {$v} |\n";
            }
        }
        $new .= "| status | __open__ |\n <?plugin BugReportState ?" . "> \n";
        $new .= "\n{$author}: {$content}\n\n";
        #-- create new bug report page
        $data = ewiki_db::CREATE($new_id);
        $data["content"] = $new;
        ewiki_db::UPDATE($data);
        $data["version"] = 1;
        $ok = ewiki_db::WRITE($data);
        if (!$ok) {
            return "<b>Error</b> while creating new bug report page. Please go back and change the title (at least two words required), so we can try again.";
        }
        #-- store bugreport entry on main page
        $data = ewiki_db::GET($MAIN);
        $list_e = "| __open__ | {$new_id} | {$title} |\n";
        $data["content"] = preg_replace("/(\n\\|.+\\|.+\\|\\s*\n)/", "\$1{$list_e}", $data["content"], 1);
        ewiki_db::UPDATE($data);
        $data["version"]++;
        ewiki_db::WRITE($data);
        if ($notify = function_exists($pf = "ewiki_notify_edit_hook")) {
            $pf($MAIN, $data, $uu);
        }
        #-- append to page output
        $iii[] = array("\n\n| new bug report [#added \"added\"] as {$new_id} |\n\n", 0xffff, "core");
    } else {
        $url = ewiki_script("", $ewiki_id);
        $ver = EWIKI_VERSION;
        $current_vers = "<option>{$ver}";
        for ($i = $ver[strlen($ver) - 1] - 1; $i > 0; $i--) {
            $current_vers .= "<option>" . substr($ver, 0, strlen($ver) - 1) . $i;
        }
        $o .= <<<EOT
<form style="border:2px #444455 solid; background:#9999aa; padding:5px;"class="BugReport" action="{$url}#added" method="POST" enctype="multipart/form-data">
bug title: <input type="text" name="title" value="???" size="50">
<br/>
<br/>
YourName: <input type="text" name="author" value="anonymous" size="30">
<br/>
<br/>
your ewiki version: <select name="i[ewiki version]"><option>unknown<option>other{$current_vers}<option>CVS today<option>CVS yesterday<option>CVS last week<option>two weeks old<option>latest -dev<option>R1.02a<option>R1.01f<option>R1.01e<option>R1.01d<option>R1.01c<option>R1.01b<option>R1.01a</select>
plattform: <select name="i[operating system]"><option>unknown<option>other<option>Win4<option>NT (2K,XP)<option>Unix<option>Linux<option>OS X</select>
<br/>
database: <select name="i[database backend]"><option>unknown<option>mysql<option>db_flat_files<option>db_fast_files<option>anydb: other<option>anydb: pgsql<option>dzf2<option>dba/dbm<option>phpwiki13<option>zip<option>other<option>own</select>
php version: <select name="i[php version]"><option>unknown<option>4.0.x<option>4.1.x<option>4.2.x<option>4.3.x<option>4.4/4.5 (CVS)<option>5.0-beta/rc<option>5.0.x<option>CGI/suPHP<option>PHP/FastCGI<option>SafeMode 4.x</select>
<br>
problem category (vague): <select name="i[bug category]"><option>unknown<option>general<option>feature request<option>get running<option>markup<option>links<option>error message<option>plugin<option>page plugin<option>action plugin<option>auth plugin<option>aview plugin<option>edit plugin<option>feature extension<option>link tweak plugin<option>mpi plugin<option>spages<option>lib extension<option>module plugin<option>db plugin<option>configuration<option>documentation</select>
<br/>
<br/>
long error description:<br /> 
<textarea name="content" cols="75" rows="8">
</textarea>
<br/><br/>
<input type="submit" name="br_save" value="create bug page">
<br/>
<br/>
email notification <input type="text" name="br_notify" value="" size="16">
<br/><small>(opt., only enter if you want get notified on any responses)</small>
<br/>
</form>
EOT;
    }
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:93,代码来源:mpi_bugreport.php

示例4: scan_dir

 #-- scan for files
 $ls = scan_dir($dir);
 foreach ($ls as $fn) {
     if (fnmatch($glob, $fn)) {
         $id = "{$prefix}{$fn}";
         #-- checking for entry
         if ($data = ewiki_db::GET($id)) {
             // our cache entries don't have any flag set
             if ($data["flags"] & EWIKI_DB_F_TYPE) {
                 continue;
                 // real page exists, definetely won't overwrite
             }
         }
         #-- read
         $content = file_get_contents("{$dir}/{$fn}");
         $data = ewiki_db::CREATE($id, 0x0);
         $data["content"] = $content;
         $data["meta"]["class"] = "search";
         #-- write
         ewiki_db::WRITE($id, "_OVERWRITE=1");
     }
 }
 #-- returns only filenames (no dirs) with leading dirspec omitted
 function scan_dir($dir, $pfix = "")
 {
     $r = array();
     $dh = opendir($dir);
     while ($fn = readdir($dh)) {
         if (is_dir("{$dir}/{$pfix}{$fn}")) {
             $r += scan_dir($dir, "{$pfix}{$fn}/");
         } else {
开发者ID:gpuenteallott,项目名称:rox,代码行数:31,代码来源:xt_searchcache_staticf.php

示例5: serialize

<?php

/*
   This part writes back the $anacron[] timestamps, so we can keep track
   of when we run which parts in here.
*/
#-- update
if ($anacron && ANACRON_ID) {
    echo "[{$cron}]: writing back anacron timestamps\n";
    #-- get old
    $data = ewiki_db::GET(ANACRON_ID) or $data = ewiki_db::CREATE(ANACRON_ID);
    #-- vars
    $data["flags"] = EWIKI_DB_F_SYSTEM;
    ewiki_db::UPDATE($data);
    $data["lastmodified"] = $anacron["last"] = EWIKI_CRON;
    $data["content"] = serialize($anacron);
    #-- overwrite
    ewiki_db::WRITE($data, 1) or $data["version"]++ && ewiki_db::WRITE($data);
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:19,代码来源:Z17anacron.php

示例6: trim

        $data["refs"] = "\n\n" . trim(trim($data["refs"], "\n"), "\r") . "\n\n";
    }
    // {content}
    if ($data["flags"] & EWIKI_DB_F_TEXT) {
        $data["content"] = preg_replace("/\r*(\n)\r?/", "\$1", $data["content"]);
    }
    #-- ok, throw into DB
    if (ewiki_db::WRITE($data, $overwrite = 1)) {
        echo "<div class=\"msg\">page written into database</div>\n\n";
    } else {
        echo "<div class=\"msg\">error writing entry to db</div>\n\n";
    }
}
#-- fill with inital data
if ($_REQUEST["create"] && !$data) {
    $data = ewiki_db::CREATE($id);
}
#-- start output
echo '<form action="edit.php" method="POST" enctype="multipart/form-data">';
echo '<input type="hidden" name="id" value="' . htmlentities($id) . '">';
#-- {id}
print_field($data, "id", 32);
#-- {version}
print_field($data, "version", 3, "", "");
echo ' <input type="submit" name="refresh" value="refr" title="refresh view, show given version"> ';
echo ' <a href="list_vers.php?id=' . urlencode($id) . '">...</a> ';
echo '<input type="submit" name="delete" value="del" title="delete current page version"><br>' . "\n";
#-- {flags}
print_flags($data);
#-- {author} and {hits}, {created}, {lastmodified}
print_field($data, "author", 26);
开发者ID:gpuenteallott,项目名称:rox,代码行数:31,代码来源:edit.php


注:本文中的ewiki_db::CREATE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。