⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ewiki.php

📁 很棒的在线教学系统
💻 PHP
📖 第 1 页 / 共 5 页
字号:
      $data = array(         "version" => &$_REQUEST["version"],         "content" => &$_REQUEST["content"]      );   }   else {      if (empty($data["version"])) {         $data["version"] = 1;      }      @$data["content"] .= "";   }   #-- normalize to DOS newlines   $data["content"] = str_replace("\015\012", "\012", $data["content"]);   $data["content"] = str_replace("\015", "\012", $data["content"]);   $data["content"] = str_replace("\012", "\015\012", $data["content"]);   $hidden_postdata["version"] = &$data["version"];   #-- edit textarea/form   // deleted name="ewiki", can not find the reference, and it's breaking xhtml   $o .= ewiki_t("EDIT_FORM_1")       . '<form method="post" enctype="multipart/form-data" action="'       . ewiki_script("edit", $id) . '" '       . ' accept-charset="'.EWIKI_CHARSET.'">' . "\n";   $o .= '<div>';   #-- additional POST vars   foreach ($hidden_postdata as $name => $value) {       $o .= '<input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n";   }   ($cols = strtok($ewiki_config["edit_box_size"], "x*/,;:")) && ($rows = strtok("x, ")) || ($cols=70) && ($rows=15);   global $ewiki_use_editor, $ewiki_editor_content;   $ewiki_editor_content=1;   if($ewiki_use_editor) {     ob_start();     $usehtmleditor = can_use_html_editor();     echo '<table><tr><td>';     if ($usehtmleditor) { //clean and convert before editing         $options = new object();         $options->smiley = false;         $options->filter = false;         $oldtext = format_text(ewiki_format($data["content"]), $moodle_format, $options);     } else {         $oldtext = ewiki_format($data["content"]);     }     print_textarea($usehtmleditor, $rows, $cols, 680, 400, "content", $oldtext);     echo '</td></tr></table>';     if ($usehtmleditor) {        use_html_editor("content");     }     $o .= ob_get_contents();          ob_end_clean();        } else {   ##### END MOODLE ADDITION #####     $o .= '<textarea wrap="soft" id="ewiki_content" name="content" rows="'.$rows.'" cols="'.$cols.'">'        . s($data["content"]) . "</textarea>"        . $GLOBALS["ewiki_t"]["C"]["EDIT_TEXTAREA_RESIZE_JS"];   ##### BEGIN MOODLE ADDITION #####   }   ##### END MOODLE ADDITION #####      #-- more <input> elements before the submit button   if ($pf_a = $ewiki_plugins["edit_form_insert"]) foreach ($pf_a as $pf) {      $o .= $pf($id, $data, $action);   }   ##### BEGIN MOODLE ADDITION (Cancel Editing into Button) #####   $o .= "\n<br />\n"      . '<input type="submit" name="save" value="'. ewiki_t("SAVE") . '" />'."\n"      . '<input type="submit" name="preview" value="'. ewiki_t("PREVIEW") . '" />' . "\n"      . '<input type="submit" name="canceledit" value="'. ewiki_t("CANCEL_EDIT") . '" />' . "\n";#      . ' &nbsp; <a href="'. ewiki_script("", $id) . '">' . ewiki_t("CANCEL_EDIT") . '</a>';   ##### END MOODLE ADDITION #####   #-- additional form elements   if ($pf_a = $ewiki_plugins["edit_form_append"]) foreach ($pf_a as $pf) {      $o .= $pf($id, $data, $action);   }   $o .= "\n</div></form>\n";   //   . ewiki_t("EDIT_FORM_2");  // MOODLE DELETION   return('<div class="edit-box">'. $o .'</div>');}#-- pic upload formfunction ewiki_page_edit_form_final_imgupload(&$o, &$id, &$data, &$action) {   if (EWIKI_SCRIPT_BINARY && EWIKI_UP_UPLOAD && EWIKI_IMAGE_MAXSIZE) {      $o .= "\n<br />\n". '<div class="image-upload">'      . '<form action='      . '"'. ewiki_script_binary("", EWIKI_IDF_INTERNAL, "", "_UPLOAD=1") .'"'      . ' method="post" enctype="multipart/form-data" target="_upload">'      . '<fieldset class="invisiblefieldset">'      . '<input type="hidden" name="MAX_FILE_SIZE" value="'.EWIKI_IMAGE_MAXSIZE.'" />'      . '<input type="file" name="'.EWIKI_UP_UPLOAD.'"'      . (defined("EWIKI_IMAGE_ACCEPT") ? ' accept="'.EWIKI_IMAGE_ACCEPT.'" />' : " />")      . '<input type="hidden" name="'.EWIKI_UP_BINARY.'" value="'.EWIKI_IDF_INTERNAL.'" />'      . '&nbsp;&nbsp;&nbsp;'      . '<input type="submit" value="'.ewiki_t("UPLOAD_PICTURE_BUTTON").'" />'      . '</fieldset></form></div>'. "\n";  }}function ewiki_page_edit_preview(&$data) {#### BEGIN MOODLE CHANGES      global $moodle_format;      $preview_text=$GLOBALS["ewiki_plugins"]["render"][0]($_REQUEST["content"], 1, EWIKI_ALLOW_HTML || (@$data["flags"]&EWIKI_DB_F_HTML));   return( '<div class="preview">'           . "<hr noshade>"           . "<div class='mdl-right'>" . ewiki_t("PREVIEW") . "</div><hr noshade><br />\n"           . format_text($preview_text, $moodle_format)           . "<br /><br /><hr noshade><br />"           . "</div>"   );#### END MOODLE CHANGES   }function ewiki_control_links($id, &$data, $action) {   global $ewiki_plugins, $ewiki_ring, $ewiki_config;   $action_links = & $ewiki_config["action_links"][$action];   #-- disabled   if (!$ewiki_config["control_line"]) {      return("");   }   $o = "\n"      . '<div class="mdl-right action-links control-links">'      . "\n<br />\n"      . "<hr noshade>" . "\n";   if (@$data["forced_version"]) {      $o .= '<form action="' . ewiki_script("edit", $id) . '" method="post">' .            '<fieldset class="invisiblefieldset">'.            '<input type="hidden" name="edit" value="old" />' .            '<input type="hidden" name="version" value="'.$data["forced_version"].'" />' .            '<input type="submit" value="' . ewiki_t("OLDVERCOMEBACK") . '" /></form> ';   }   else {      foreach ($action_links as $action => $title)      if (!empty($ewiki_plugins["action"][$action]) || !empty($ewiki_plugins["action_always"][$action]) || strpos($action, ":/"))      {         if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($id, $data, $action))  { continue; }         $o .= '<a href="'            . (strpos($action, ":/") ? $action : ewiki_script($action, $id))            . '">' . ewiki_t($title) . '</a> &middot; ';      }   }   if ($data["lastmodified"] >= UNIX_MILLENNIUM) {       $o .= '<small>' . strftime(ewiki_t("LASTCHANGED"), @$data["lastmodified"]) . '</small>';   }   $o .= "</div>\n";   return($o);}# ============================================================= rendering ===########  ###   ###  #########  ###  ###   ###  ###############  ####  ###  #########  ###  ####  ###  ##########       ##### ###  ###             ##### ###  #########    #########  ###  ####  ###  #########  ############    #########  ###  ####  ###  #########  #########       ### #####  ###   ###  ###  ### #####  ###########  ###  ####  #########  ###  ###  ####  ###############  ###   ###  #########  ###  ###   ###  #######/*   The _format() function transforms $wiki_source pages into <html> strings,   also calls various markup and helper plugins during the transformation   process. The $params array can activate various features and extensions.   only accepts UNIX newlines!*/function ewiki_format (            $wiki_source,            $params = array()         ){   global $ewiki_links, $ewiki_plugins, $ewiki_config;   #-- state vars   $params = @array_merge($ewiki_config["format_params"], $params);   $s = array(      "in" => 0,         # current input $iii[] block array index      "para" => "",      "line" => "",      "post" => "",      # string to append after current line/paragraph      "line_i" => 0,      "lines" => array(),      "list" => "",      # lists      "tbl" => 0,        # open table?      "indent" => 0,     # indentation      "close" => array(),   );   #-- aliases   $in = &$s["in"];    $line = &$s["line"];   $lines = &$s["lines"];   $para = &$s["para"];   $post = &$s["post"];   $list = &$s["list"];   #-- input and output arrays   if ($wiki_source[0] == "<") {            # also prepend an empty line       $wiki_source = "\n" . $wiki_source;    # for faster strpos() searchs   }   $iii = array(      0 => array(         0 => $wiki_source."\n",    # body + empty line         1 => 0x0FFF,               # flags (0x1=WikiMarkup, 0x2=WikiLinks, 0x100=BlockPlugins)         2 => "core",               # block plugin name      )   );   $ooo = array(   );   unset($wiki_source);   #-- plugins   $pf_tbl = @$ewiki_plugins["format_table"][0];   $pf_line = @$ewiki_plugins["format_line"];   #-- wikimarkup (wm)   $htmlentities = $ewiki_config["htmlentities"];   $wm_indent = &$ewiki_config["wm_indent"];   $wm_table_defaults = &$ewiki_config["wm_table_defaults"];   $wm_source = &$ewiki_config["wm_source"];   $wm_list = &$ewiki_config["wm_list"];   $wm_list_chars = implode("", array_keys($wm_list));   $wm_style = &$ewiki_config["wm_style"];   $wm_start_end = &$ewiki_config["wm_start_end"];   #-- eleminate html   $iii[0][0] = strtr($iii[0][0], $htmlentities);   unset($htmlentities["&"]);   #-- pre-processing plugins (working on wiki source)   if ($pf_source = $ewiki_plugins["format_source"]) {      foreach ($pf_source as $pf) $pf($iii[0][0]);   }   #-- simple markup   $iii[0][0] = strtr($iii[0][0], $wm_source);   #-- separate input into blocks ------------------------------------------   foreach ($ewiki_config["format_block"] as $btype => $binfo) {      #-- disabled block plugin?      if ($binfo[2] && !$params[$binfo[2]])  {         continue;      }      #-- traverse $iii[]      $in = -1;      while ((++$in) < count($iii)) {         #-- search fragment delimeters         if ($iii[$in][1] & 0x0100)         while (            ($c = & $iii[$in][0]) &&            (($l = strpos($c, $binfo[0])) !== false) &&            ($r = strpos($c, $binfo[1], $l))   )         {            $l_len = strlen($binfo[0]);            $r_len = strlen($binfo[1]);            $repl = array();            // pre-text            if (($l > 0) && trim($text = substr($c, 0, $l))) {               $repl[] = array($text, 0xFFFF, "core");            }            // the extracted part            if (trim($text = substr($c, $l+$l_len, $r-$l-$r_len))) {               $repl[] = array($text, $binfo[3], "$btype");            }            // rest            if (($r+$r_len < strlen($c)) && trim($text = substr($c, $r+$r_len))) {               $repl[] = array($text, 0xFFFF, "core");            }            array_splice($iii, $in, 1, $repl);            $in += 1;         }      }   }   #-- run format_block plugins   $in = -1;   while ((++$in) < count($iii)) {      if (($btype = $iii[$in][2]) && ($pf_a = $ewiki_plugins["format_block"][$btype])) {         $c = &$iii[$in][0];         foreach ($pf_a as $pf) {               # current buffer $c and pointer $in into $iii[] and state $s            $pf($c, $in, $iii, $s, $btype);         }      }   }   #-- wiki markup ------------------------------------------------------   $para = "";   $in = -1;      while ((++$in) < count($iii)) {      #-- wikimarkup      if ($iii[$in][1] & 0x0001) {         #-- input $lines buffer, and output buffer $ooo array         $lines = explode("\n", $iii[$in][0]);         $ooo[$in] = array(            0 => "",            1 => $iii[$in][1]         );         $out = &$ooo[$in][0];         $s["block"] = ($iii[$in][2] != "core");  # disables indentation & paragraphs         #-- walk through wiki source lines         $line_max = count($lines);         foreach ($lines as $s["line_i"]=>$line) {//echo "<pre>line={$s[line_i]}:".htmlspecialchars($line).":".htmlspecialchars($line[0])."</pre>";            #-- empty lines separate paragraphs            if (!strlen($line)) {               ewiki_format_close_para($ooo, $s);               ewiki_format_close_tags($ooo, $s);               if (!$s["block"]) {                  $out .= "\n";               }            }            #-- horiz bar            if (!strncmp($line, "----", 4)) {               $out .= "<hr noshade>\n";               continue;            }            #-- html comment            #if (!strncmp($line, "&lt;!--", 7)) {            #   $out .= "<!-- " . htmlentities(str_replace("--", "__", substr($line, 7))) . " -->\n";            #   continue;            #}            ($c0 = $line[0])            or ($c0 = "\000");            #-- tables            ### MOODLE CHANGE: TRIM            if (($c0 == "|") && ($line[strlen(trim($line))-1] == "|")) {               if (!$s["tbl"]) {                  ewiki_format_close_para($ooo, $s);                  ewiki_format_close_tags($ooo, $s);                  $s["list"] = "";               }               $line = substr($line, 1, -1);               if ($pf_tbl) {                   $pf_tbl($line, $ooo, $s);               }               else {                  if (!$s["tbl"]) {    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -