• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ewiki_database函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ewiki_database函数的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_database函数的具体用法?PHP ewiki_database怎么用?PHP ewiki_database使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ewiki_view_append_attachments

function ewiki_view_append_attachments($id, $data, $action)
{
    $o = '<hr /><h4><a href="' . ewiki_script(EWIKI_ACTION_ATTACHMENTS, $id) . '">' . ewiki_t("ATTACHMENTS") . '</a></h4>';
    $scan = 's:7:"section";' . serialize($id);
    $result = ewiki_database("SEARCH", array("meta" => $scan));
    #### BEGIN MOODLE CHANGES - show attachments link only if there are attachments.
    ####                      - don't show the attachments on the content page.
    if (count($result->entries) <= 0) {
        $o = '';
    }
    //   $ord = array();
    //   while ($row = $result->get()) {
    //      $ord[$row["id"]] = $row["created"];
    //   }
    //   arsort($ord);
    //
    //    foreach ($ord as $id => $uu) {
    //        $row = ewiki_database("GET", array("id"=>$id));
    //        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
    //            continue;
    //        }
    //        $o .= ewiki_entry_downloads($row, "*");
    //    }
    #### END MOODLE CHANGES
    return $o;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:26,代码来源:downloads.php


示例2: ewiki_edit_patch

function ewiki_edit_patch($id, &$data)
{
    $version = optional_param('version', null);
    $content = optional_param('content', '');
    $r = false;
    $base = ewiki_database("GET", array("id" => $id, "version" => $version));
    if (!$base) {
        return false;
    }
    $fn_base = EWIKI_TMP . "/ewiki.base." . md5($base["content"]);
    $fn_requ = EWIKI_TMP . "/ewiki..requ." . md5($content);
    $fn_patch = EWIKI_TMP . "/ewiki.patch." . md5($base["content"]) . "-" . md5($content);
    $fn_curr = EWIKI_TMP . "/ewiki.curr." . md5($data["content"]);
    if ($f = fopen($fn_base, "w")) {
        fwrite($f, $base["content"]);
        fclose($f);
    } else {
        return false;
    }
    if ($f = fopen($fn_requ, "w")) {
        fwrite($f, $content);
        fclose($f);
    } else {
        unlink($fn_base);
        return false;
    }
    if ($f = fopen($fn_curr, "w")) {
        fwrite($f, $data["content"]);
        fclose($f);
    } else {
        unlink($fn_base);
        unlink($fn_requ);
        return false;
    }
    exec("diff -c {$fn_base} {$fn_requ} > {$fn_patch}", $output, $retval);
    if ($retval) {
        exec("patch {$fn_curr} {$fn_patch}", $output, $retval);
        if (!$retval) {
            /// mrc - ?? what is $curr supposed to be ??
            $_REQUEST["version"] = $_POST["version"] = $_GET["version"] = $curr["version"];
            $_REQUEST["content"] = $_POST["content"] = $_GET["content"] = implode("", file($fn_curr));
            $r = true;
        }
    }
    unlink($fn_base);
    unlink($fn_requ);
    unlink($fn_patch);
    unlink($fn_curr);
    return $r;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:50,代码来源:patchsaving.php


示例3: ewiki_edit_save_pageimgcntrl

/**
 * Save selected pageimage value by setting it in the meta field of save data array
 * passed by reference.
 * 
 * @param array save associative array of ewiki form data
 */
function ewiki_edit_save_pageimgcntrl(&$save)
{
    if (isset($_REQUEST['pageimagecntrl'])) {
        if ($_REQUEST['pageimagecntrl'] == -1) {
            unset($save['meta']['pageimage']);
        } else {
            $imageExist = ewiki_database('FIND', array($_REQUEST['pageimagecntrl']));
            //var_dump($imageExist);
            if ($imageExist[$_REQUEST['pageimagecntrl']]) {
                $save['meta']['pageimage'] = $_REQUEST['pageimagecntrl'];
            }
        }
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:20,代码来源:pageimage.php


示例4: ewiki_edit_patch

function ewiki_edit_patch($id, &$data)
{
    $r = false;
    $base = ewiki_database("GET", array("id" => $id, "version" => $_REQUEST["version"]));
    if (!$base) {
        return false;
    }
    $fn_base = EWIKI_TMP . "/ewiki.base." . md5($base["content"]);
    $fn_requ = EWIKI_TMP . "/ewiki..requ." . md5($_REQUEST["content"]);
    $fn_patch = EWIKI_TMP . "/ewiki.patch." . md5($base["content"]) . "-" . md5($_REQUEST["content"]);
    $fn_curr = EWIKI_TMP . "/ewiki.curr." . md5($data["content"]);
    if ($f = fopen($fn_base, "w")) {
        fwrite($f, $base["content"]);
        fclose($f);
    } else {
        return false;
    }
    if ($f = fopen($fn_requ, "w")) {
        fwrite($f, $_REQUEST["content"]);
        fclose($f);
    } else {
        unlink($fn_base);
        return false;
    }
    if ($f = fopen($fn_curr, "w")) {
        fwrite($f, $data["content"]);
        fclose($f);
    } else {
        unlink($fn_base);
        unlink($fn_requ);
        return false;
    }
    exec("diff -c {$fn_base} {$fn_requ} > {$fn_patch}", $output, $retval);
    if ($retval) {
        exec("patch {$fn_curr} {$fn_patch}", $output, $retval);
        if (!$retval) {
            $_REQUEST["version"] = $curr["version"];
            $_REQUEST["content"] = implode("", file($fn_curr));
            $r = true;
        }
    }
    unlink($fn_base);
    unlink($fn_requ);
    unlink($fn_patch);
    unlink($fn_curr);
    ewiki_log("patchsaving of {$id}[{$data[version]}] was " . ($r ? "" : "un") . "successful", 2);
    return $r;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:48,代码来源:patchsaving.php


示例5: ewiki_page_wantedpages

function ewiki_page_wantedpages($id, $data, $action)
{
    $wanted = array();
    #-- collect referenced pages
    $result = ewiki_database("GETALL", array("refs"));
    while ($row = $result->get()) {
        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
            continue;
        }
        $refs .= $row["refs"];
    }
    #-- build array
    $refs = array_unique(explode("\n", $refs));
    #-- strip existing pages from array
    $refs = ewiki_database("FIND", $refs);
    foreach ($refs as $id => $exists) {
        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
            continue;
        }
        if (!$exists && !strstr($id, "://") && strlen(trim($id))) {
            $wanted[] = $id;
        }
    }
    // to prevent empty <ul></ul> getting printed out, we have to interate twice.
    // once to make sure the <ul></ul> is needed at all.
    // MDL-7861, <ul></ul> does not validate.
    $printul = false;
    foreach ($wanted as $page) {
        $link = ewiki_link_regex_callback(array($page, $page));
        if (strstr($link, "?</a>")) {
            $printul = true;
        }
    }
    #-- print out
    if ($printul) {
        $o .= "<ul>";
        foreach ($wanted as $page) {
            $link = ewiki_link_regex_callback(array($page, $page));
            if (strstr($link, "?</a>")) {
                $o .= "<li>" . $link . "</li>";
            }
        }
        $o .= "</ul>";
    }
    return $o;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:46,代码来源:wantedpages.php


示例6: ewiki_page_orphanedpages

function ewiki_page_orphanedpages($id, $data, $action)
{
    global $ewiki_links;
    $o = ewiki_make_title($id, ewiki_t($id), 2);
    $pages = array();
    $refs = array();
    $orphaned = array();
    #-- read database
    $db = ewiki_database("GETALL", array("refs", "flags"));
    $n = 0;
    while ($row = $db->get()) {
        $p = $row["id"];
        #-- remove self-reference
        $row["refs"] = str_replace("\n{$p}\n", "\n", $row["refs"]);
        #-- add to list of referenced pages
        $rf = explode("\n", trim($row["refs"]));
        $refs = array_merge($refs, $rf);
        if ($n++ > 299) {
            $refs = array_unique($refs);
            $n = 0;
        }
        // (clean-up only every 300th loop)
        #-- add page name
        if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
            $pages[] = $row["id"];
        }
    }
    $refs = array_unique($refs);
    #-- check pages to be referenced from somewhere
    foreach ($pages as $p) {
        if (!ewiki_in_array($p, $refs)) {
            if (!EWIKI_PROTECTED_MODE || EWIKI_PROTECTED_MODE_HIDING || ewiki_auth($p, $uu, "view")) {
                $orphaned[] = $p;
            }
        }
    }
    #-- output
    $o .= ewiki_list_pages($orphaned, 0);
    return $o;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:40,代码来源:orphanedpages.php


示例7: ewiki_page_index

function ewiki_page_index($id = 0, $data = 0, $action = 0, $args = array())
{
    global $ewiki_plugins;
    $o = ewiki_make_title($id, ewiki_t($id), 2);
    $sorted = array();
    $sorted = array_merge($sorted, array_keys($ewiki_plugins["page"]));
    $exclude = "\n" . implode("\n", preg_split("/\\s*[,;:\\|]\\s*/", $args["exclude"])) . "\n";
    $result = ewiki_database("GETALL", array("flags"));
    while ($row = $result->get()) {
        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
            continue;
        }
        if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
            if (!stristr($exclude, "\n" . $row["id"] . "\n")) {
                $sorted[] = $row["id"];
            }
        }
    }
    natcasesort($sorted);
    $o .= ewiki_list_pages($sorted, 0, 0, $ewiki_plugins["list_dict"][0]);
    return $o;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:22,代码来源:pageindex.php


示例8: ewiki_valid_pages

function ewiki_valid_pages($bool_allowimages = 0, $virtual_pages = 0)
{
    //$time=getmicrotime();
    global $ewiki_plugins;
    $result = ewiki_database("GETALL", array("flags", "refs", "meta"));
    while ($row = $result->get()) {
        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $str_null, "view")) {
            continue;
        }
        $isbinary = $row["meta"]["class"] == "image" || $row["meta"]["class"] == "file" ? true : false;
        if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT || ($bool_allowimages ? $isbinary : 0)) {
            $temp_refs = explode("\n", $row["refs"]);
            foreach ($temp_refs as $key => $value) {
                if (empty($value)) {
                    unset($temp_refs[$key]);
                }
            }
            if ($isbinary) {
                $a_validpages[$row["id"]] = $temp_array = array("refs" => $temp_refs, "type" => $row["meta"]["class"], "touched" => FALSE);
            } else {
                $a_validpages[$row["id"]] = $temp_array = array("refs" => $temp_refs, "type" => "page", "touched" => FALSE);
            }
            unset($temp_refs);
        }
    }
    if ($virtual_pages) {
        #-- include virtual pages to the sitemap.
        $virtual = array_keys($ewiki_plugins["page"]);
        foreach ($virtual as $vp) {
            if (!EWIKI_PROTECTED_MODE || !EWIKI_PROTECTED_MODE_HIDING || ewiki_auth($vp, $str_null, "view")) {
                $a_validpages[$vp] = array("refs" => array(), "type" => "page", "touched" => FALSE);
            }
        }
    }
    return $a_validpages;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:36,代码来源:sitemap.php


示例9: ewiki_page_wiki_dump_send


//.........这里部分代码省略.........
        #  $archive = new ewiki_virtual_zip();
        #} elseif ($arctype == "TAR") {
        #  $archivename=EWIKI_WIKIDUMP_ARCNAME."$rootid.tar";
        #  $archive = new ewiki_virtual_tarball();
        #} else {
        #  die();
        #}
        /// Create/Set Directory
        $wname = clean_filename(strip_tags(format_string($wiki->name, true)));
        if ($exportdestinations) {
            if (wiki_is_teacher($wiki)) {
                $exportdir = $CFG->dataroot . "/" . $course->id . "/" . $exportdestinations;
            } else {
                add_to_log($course->id, "wiki", "hack", "", format_string($wiki->name, true) . ": Tried to export a wiki as non-teacher into {$exportdestinations}.");
                error("You are not a teacher !");
            }
        } else {
            $exportbasedir = tempnam("/tmp", "WIKIEXPORT");
            @unlink($exportbasedir);
            @mkdir($exportbasedir);
            /// maybe we need to check the name here...?
            $exportdir = $exportbasedir . "/" . $wname;
            @mkdir($exportdir);
            if (!is_dir($exportdir)) {
                error("Cannot create temporary directory {$exportdir} !");
            }
        }
        $a_pagelist = array_unique($a_pagelist);
        #-- convert all pages
        foreach ($a_pagelist as $pagename) {
            if (!in_array($pagename, $a_virtual)) {
                $id = $pagename;
                #-- not a virtual page
                $row = ewiki_database("GET", array("id" => $pagename));
                $content = "";
            } elseif ($withvirtualpages) {
                $id = $pagename;
                #-- is a virtual page
                $pf = $ewiki_plugins["page"][$id];
                $content = $pf($id, $content, "view");
                if ($exportformats == 1) {
                    $content = str_replace('$content', $content, str_replace('$title', $id, $HTML_TEMPLATE));
                }
                $fn = urlencode($id);
                $fn = preg_replace(EWIKI_DUMP_FILENAME_REGEX, "", $fn);
                $fn = $fn . $html_ext;
            } else {
                continue;
            }
            if (empty($content)) {
                switch ($row["flags"] & EWIKI_DB_F_TYPE) {
                    // Text Page
                    case EWIKI_DB_F_TEXT:
                        #print "<pre>"; print_r($row[content]); print "\n-------------</pre>";
                        if ($exportformats == 1) {
                            /// HTML-Export
                            $content = ewiki_format($row["content"]);
                        } else {
                            $content = $row["content"];
                        }
                        # Binary files link adjustment when html
                        if ($exportformats == 1) {
                            $content = str_replace($a_images, $a_rimages, $content);
                        }
                        $fn = preg_replace(EWIKI_DUMP_FILENAME_REGEX, "", urlencode($id));
                        $fn = $fn . $html_ext;
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:67,代码来源:moodle_wikidump.php


示例10: get

 function get($all = 0, $flags = 0x0)
 {
     $row = array();
     $prot_hide = $flags & 0x20 && EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING;
     do {
         if (count($this->entries)) {
             #-- fetch very first entry from $entries list
             $r = array_shift($this->entries);
             #-- finish if buffered entry
             if (is_array($r) && !$all) {
                 $row = $r;
             } else {
                 if (is_array($r)) {
                     $r = $r["id"];
                 }
                 $r = ewiki_database("GET", array("id" => $r));
                 if (!$all) {
                     foreach ($this->keys as $key) {
                         $row[$key] = $r[$key];
                     }
                 } else {
                     $row = $r;
                 }
             }
             unset($r);
         } else {
             return NULL;
             // no more entries
         }
         #-- expand {meta} field
         if (is_array($row) && is_string(@$row["meta"])) {
             $row["meta"] = unserialize($row["meta"]);
         }
         #-- drop unwanted results
         if ($prot_hide && !ewiki_auth($row["id"], $row, $ewiki_action)) {
             $row = array();
         }
     } while ($prot_hide && empty($row));
     return $row;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:40,代码来源:ewiki.php


示例11: ewiki_initialization_wizard

function ewiki_initialization_wizard($id, &$data, &$action)
{
    global $ewiki_plugins;
    #-- proceed only if frontpage missing or explicetely requested
    if (strtolower($id) == "wikisetupwizard" || $id == EWIKI_PAGE_INDEX && $action == "edit" && empty($data["version"]) && !$_REQUEST["abort"]) {
        if ($_REQUEST["abort"]) {
        } elseif (empty($_REQUEST["init"])) {
            $o = "<h2>WikiSetupWizard</h2>\n";
            $o .= "You don't have any pages in your Wiki yet, so we should try to read-in the default ones from <tt>init-pages/</tt> now.<br /><br />";
            $o .= '<a href="' . ewiki_script("", $id, array("init" => "now")) . '">[InitializeWikiDatabase]</a>';
            $o .= " &nbsp; ";
            $o .= '<a href="' . ewiki_script("", $id, array("abort" => "this")) . '">[NoThanks]</a>';
            $o .= "<br /><br />";
            #-- analyze and print settings and misconfigurations
            $pf_db = $ewiki_plugins["database"][0];
            $db = substr($pf_db, strrpos($pf_db, "_") + 1);
            $o .= '<table border="0" width="90%" class="diagnosis">';
            $o .= '<tr><td>DatabaseBackend</td><td>';
            $o .= "<b>" . $db . "</b><br />";
            if ($db == "files") {
                $o .= "<small>_DBFILES_DIR='</small><tt>" . EWIKI_DBFILES_DIRECTORY . "'</tt>";
                if (strpos(EWIKI_DBFILES_DIRECTORY, "tmp")) {
                    $o .= "<br /><b>Warning</b>: Storing your pages into a temporary directory is not what you want (there they would get deleted randomly), except for testing purposes of course. See the README.";
                }
            } else {
                $o .= "(looks ok)";
            }
            $o .= "</td></tr>";
            $o .= '<tr><td>WikiSoftware</td><td>ewiki ' . EWIKI_VERSION . "</td></tr>";
            $o .= "</table>";
            #-- more diagnosis
            if (ini_get("magic_quotes")) {
                $o .= "<b>Warning</b>: Your PHP interpreter has enabled the ugly and outdated '<i>magic_quotes</i>'. This will lead to problems, so please ask your provider to correct it; or fix it yourself with .htaccess settings as documented in the README. Otherwise don't forget to include() the <tt>fragments/strip_wonderful_slashes.php</tt> (it's ok to proceed for the moment).<br /><br />";
            }
            if (ini_get("register_globals")) {
                $o .= "<b>Security warning</b>: The horrible '<i>register_globals</i>' setting is enabled. Without always using <tt>fragments/strike_register_globals.php</tt> or letting your provider fix that, you could get into trouble some day.<br /><br />";
            }
            return '<div class="wiki view WikiSetupWizard">' . $o . '</div>';
        } else {
            ewiki_database("INIT", array());
            if ($dh = @opendir($path = EWIKI_INIT_PAGES)) {
                while ($filename = readdir($dh)) {
                    if (preg_match('/^([' . EWIKI_CHARS_U . ']+[' . EWIKI_CHARS_L . ']+\\w*)+/', $filename)) {
                        $found = ewiki_database("FIND", array($filename));
                        if (!$found[$filename]) {
                            $content = implode("", file("{$path}/{$filename}"));
                            ewiki_scan_wikiwords($content, $ewiki_links, "_STRIP_EMAIL=1");
                            $refs = "\n\n" . implode("\n", array_keys($ewiki_links)) . "\n\n";
                            $save = array("id" => "{$filename}", "version" => "1", "flags" => "1", "content" => $content, "author" => ewiki_author("ewiki_initialize"), "refs" => $refs, "lastmodified" => filemtime("{$path}/{$filename}"), "created" => filectime("{$path}/{$filename}"));
                            ewiki_database("WRITE", $save);
                        }
                    }
                }
                closedir($dh);
            } else {
                return "<b>ewiki error</b>: could not read from directory " . realpath($path) . "<br />\n";
            }
            #-- try to view/ that newly inserted page
            if ($data = ewiki_database("GET", array("id" => $id))) {
                $action = "view";
            }
            #-- let ewiki_page() proceed as usual
            return "";
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:66,代码来源:init.php


示例12: wiki_admin_revert

function wiki_admin_revert($proceed, $authorfieldpattern, $changesfield, $howtooperate, $deleteversions)
{
    $ret = "";
    #-- params
    $m_time = $changesfield * 3600;
    $depth = $deleteversions - 1;
    $depth = $depth > 0 ? $depth : 0;
    #-- walk through
    $result = ewiki_database("GETALL", array("id", "author", "lastmodified"));
    while ($row = $result->get()) {
        $id = $row["id"];
        #-- which versions to check
        $verZ = $row["version"];
        if ($howtooperate == "lastonly") {
            $verA = $verZ;
        } else {
            $verA = $verZ - $depth;
            if ($verA <= 0) {
                $verA = 1;
            }
        }
        for ($ver = $verA; $ver <= $verZ; $ver++) {
            #-- load current $ver database entry
            if ($verA != $verZ) {
                $row = ewiki_database("GET", array("id" => $id, "version" => $ver));
            }
            #-- match
            if (stristr($row["author"], $authorfieldpattern) && $row["lastmodified"] + $m_time > time()) {
                $ret .= "{$id} (" . get_string("versionstodelete", "wiki") . ": ";
                #-- delete multiple versions
                if ($howtooperate == "allsince") {
                    while ($ver <= $verZ) {
                        $ret .= " {$ver}";
                        if ($proceed) {
                            ewiki_database("DELETE", array("id" => $id, "version" => $ver));
                        }
                        $ver++;
                    }
                } else {
                    $ret .= " {$ver}";
                    if ($proceed) {
                        ewiki_database("DELETE", $row);
                    }
                }
                $ret .= ")<br />";
                break;
            }
        }
        #-- for($ver)
    }
    #-- while($row)
    return $ret;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:53,代码来源:lib.php


示例13: ewiki_page_filedownload

function ewiki_page_filedownload($id, $data, $action, $def_sec = "")
{
    global $ewiki_binary_icons, $ewiki_upload_sections;
    $o = ewiki_make_title($id, $id, 2);
    #<off>#   $o .= ewiki_t("DWNL_SEEUPL", '$scr'=>ewiki_script("", ""));
    #-- params (section, orderby)
    $orderby = $_REQUEST["orderby"] or $orderby = "created";
    if ($def_sec) {
        $section = $def_sec;
    } else {
        $section = $_REQUEST["section"] or $section = "";
        if (count($ewiki_upload_sections) > 1) {
            $oa = array();
            $ewiki_upload_sections["*"] = "*";
            if (empty($ewiki_plugins["action"][EWIKI_ACTION_ATTACHMENTS])) {
                $ewiki_upload_sections["**"] = "**";
            }
            foreach ($ewiki_upload_sections as $sec => $title) {
                $oa[] = '<a href="' . ewiki_script("", $id, array("orderby" => $orderby, "section" => $sec)) . '">' . $title . "</a>";
            }
            $o .= '<div class="mdl-align darker">' . implode(" &middot; ", $oa) . '</div><br />';
        }
    }
    #-- collect entries
    $files = array();
    $sorted = array();
    $result = ewiki_database("GETALL", array("flags", "meta", "created", "hits", "userid"));
    while ($row = $result->get()) {
        if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_BINARY) {
            $m =& $row["meta"];
            if (!$section) {
                $section = "**";
            }
            if ($m["section"] != $section) {
                if ($section == "**") {
                } elseif ($section == "*" && !empty($ewiki_upload_sections[$m["section"]])) {
                } else {
                    continue;
                }
            } else {
            }
            $files[$row["id"]] = $row;
            $sorted[$row["id"]] = $row[$orderby];
        }
    }
    #-- sort
    arsort($sorted);
    #-- slice
    $pnum = $_REQUEST[EWIKI_UP_PAGENUM] or $pnum = 0;
    if (count($sorted) > EWIKI_LIST_LIMIT) {
        $o_nl .= '<div class="lighter">&gt;&gt; ';
        for ($n = 0; $n < (int) (count($sorted) / EWIKI_LIST_LIMIT); $n++) {
            $o_nl .= '<a href="' . ewiki_script("", $id, array("orderby" => $orderby, "section" => $section, EWIKI_UP_PAGENUM => $n)) . '">[' . $n . "]</a>  ";
        }
        $o_nl .= '</div><br />';
        $o .= $o_nl;
    }
    $sorted = array_slice($sorted, $pnum * EWIKI_LIST_LIMIT, EWIKI_LIST_LIMIT);
    #-- output
    if (empty($sorted)) {
        $o .= ewiki_t("DWNL_NOFILES");
    } else {
        foreach ($sorted as $id => $uu) {
            $row = $files[$id];
            $o .= ewiki_entry_downloads($row, $section[0] == "*", true);
        }
    }
    $o .= $o_nl;
    return $o;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:70,代码来源:downloads.php


示例14: ewiki_page_stupid_diff

function ewiki_page_stupid_diff($id, $data, $action)
{
    global $wiki, $moodle_format;
    if ($uu = $GLOBALS["ewiki_diff_versions"]) {
        list($new_ver, $old_ver) = $uu;
        $data = ewiki_database("GET", array("id" => $id, "version" => $new_ver));
    } else {
        $new_ver = $data["version"];
        $old_ver = $new_ver - 1;
    }
    if ($old_ver > 0) {
        $data0 = ewiki_database("GET", array("id" => $id, "version" => $old_ver));
    }
    $a->new_ver = $new_ver;
    $a->old_ver = $old_ver;
    $a->pagename = $id;
    $o = ewiki_make_title($id, get_string("differences", "wiki", $a));
    # Different handling for html: closes Bug #1530 - Wiki diffs useless when using HTML editor
    if ($wiki->htmlmode == 2) {
        /// first do the formatiing to get normal display format without filters
        $options = new object();
        $options->smiley = false;
        $options->filter = false;
        $content0 = format_text($data0['content'], $moodle_format, $options);
        $content = format_text($data['content'], $moodle_format, $options);
        /// Remove all new line characters. They will be placed at HTML line breaks.
        $content0 = preg_replace('/\\n|\\r/i', ' ', $content0);
        $content0 = preg_replace('/(\\S)\\s+(\\S)/', '$1 $2', $content0);
        // Remove multiple spaces.
        $content = preg_replace('/\\n|\\r/i', ' ', $content);
        $content = preg_replace('/(\\S)\\s+(\\S)/', '$1 $2', $content);
        /// Replace <p>&nbsp;</p>
        $content0 = preg_replace('#(<p( [^>]*)?>(&nbsp;|\\s+)</p>)|(<p( [^>]*)?></p>)#i', "\n", $content0);
        $content = preg_replace('#(<p( [^>]*)?>(&nbsp;|\\s+)</p>)|(<p( [^>]*)?></p>)#i', "\n", $content);
        /// Place new line characters at logical HTML positions.
        $htmlendings = array('+(<br.*?>)+iU', '+(<p( [^>]*)?>)+iU', '+(</p>)+i', '+(<hr.*?>)+iU', '+(<ol.*?>)+iU', '+(</ol>)+i', '+(<ul.*?>)+iU', '+(</ul>)+i', '+(<li.*?>)+iU', '+(</li>)+i', '+(</tr>)+i', '+(<div.*?>)+iU', '+(</div>)+i');
        $htmlrepl = array("\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n");
        $content0 = preg_replace($htmlendings, $htmlrepl, $content0);
        $content = preg_replace($htmlendings, $htmlrepl, $content);
    } else {
        $content0 = $data0["content"];
        $content = $data["content"];
    }
    $txt0 = preg_split("+\\s*\n+", trim($content0));
    $txt2 = preg_split("+\\s*\n+", trim($content));
    $diff0 = array_diff($txt0, $txt2);
    $diff2 = array_diff($txt2, $txt0);
    foreach ($txt2 as $i => $line) {
        $i2 = $i;
        while ($rm = $diff0[$i2++]) {
            if ($wiki->htmlmode == 2) {
                if ($rm == '<br />') {
                    //ugly hack to fix line breaks
                    $rm = '';
                }
                $o .= "<b>-</b><font color=\"#990000\">" . format_text($rm, $moodle_format, $options) . "</font><br />\n";
            } else {
                $o .= "<b>-</b><font color=\"#990000\"><tt>" . s($rm) . "</tt></font><br />\n";
            }
            unset($diff0[$i2 - 1]);
        }
        if (in_array($line, $diff2)) {
            if ($wiki->htmlmode == 2) {
                if ($line == '<br />') {
                    //ugly hack to fix line breaks
                    $line = '';
                }
                $o .= "<b>+</b><font color=\"#009900\">" . format_text($line, $moodle_format, $options) . "</font><br />\n";
            } else {
                $o .= "<b>+</b><font color=\"#009900\"><tt>" . s($line) . "</tt></font><br />\n";
            }
        } else {
            if ($wiki->htmlmode == 2) {
                $o .= format_text($line, $moodle_format, $options) . "\n";
            } else {
                $o .= "&nbsp; " . s($line) . "<br />\n";
            }
        }
    }
    foreach ($diff0 as $rm) {
        $o .= "<b>-</b><font color=\"#990000\"> <tt>" . s($rm) . "</tt></font><br />\n";
    }
    return $o;
}
开发者ID:veritech,项目名称:pare-project,代码行数:84,代码来源:diff.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ewiki_make_title函数代码示例发布时间:2022-05-15
下一篇:
PHP ewiki_auth函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap