From frik85@svn.reactos.org Sun Dec 16 00:04:33 2007 From: frik85@svn.reactos.org To: ros-diffs@reactos.org Subject: [ros-diffs] [frik85] 31264: ReactOS paste service * improved data-i/o code * new features like word-wrap * bug fixes URI: http://www.reactos.org/paste/ Date: Sat, 15 Dec 2007 23:04:21 +0000 Message-ID: <20071215230421.58A94FF03@mail.smartxx.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4828836663999086265==" --===============4828836663999086265== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: frik85 Date: Sun Dec 16 02:04:19 2007 New Revision: 31264 URL: http://svn.reactos.org/svn/reactos?rev=3D31264&view=3Drev Log: ReactOS paste service * improved data-i/o code * new features like word-wrap * bug fixes URI: http://www.reactos.org/paste/ Modified: trunk/web/reactos.org/htdocs/paste/inc/account.php trunk/web/reactos.org/htdocs/paste/inc/header.php trunk/web/reactos.org/htdocs/paste/inc/help.php trunk/web/reactos.org/htdocs/paste/inc/highlight.php trunk/web/reactos.org/htdocs/paste/inc/paste.php trunk/web/reactos.org/htdocs/paste/inc/recent.php trunk/web/reactos.org/htdocs/paste/index.php Modified: trunk/web/reactos.org/htdocs/paste/inc/account.php URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/paste/in= c/account.php?rev=3D31264&r1=3D31263&r2=3D31264&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/reactos.org/htdocs/paste/inc/account.php (original) +++ trunk/web/reactos.org/htdocs/paste/inc/account.php Sun Dec 16 02:04:19 20= 07 @@ -24,7 +24,7 @@ require_once("/web/reactos.org/htdocs/roscms/inc/subsys_login.php"); $RSDB_intern_user_id =3D roscms_subsys_login('', ROSCMS_LOGIN_OPTIONAL, "/"= . $RSDB_intern_path); */ - $RSDB_intern_user_id=3D0; + $RSDB_intern_user_id=3D2; $RSDB_USER_name=3D"Anonymous"; =20 if($RSDB_intern_user_id !=3D 0) { @@ -40,5 +40,6 @@ else { $RSDB_USER_name =3D "Anonymous"; } + //echo "
A lot of paste sites have appeared lately, and many of them are quite si= milar. The ReactOS "Copy&Paste" paste service provide a unique = list of features and a broad range of code highlight support. It uses rafb.net's code h= ighlight php library which is free available under BSD license.
The paste is accessable for 7 days.
+The paste is accessable for 7 days (default setting). The timeframe can = be set between 1 to 7 days as per paste setting.
Modified: trunk/web/reactos.org/htdocs/paste/inc/highlight.php URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/paste/in= c/highlight.php?rev=3D31264&r1=3D31263&r2=3D31264&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/reactos.org/htdocs/paste/inc/highlight.php (original) +++ trunk/web/reactos.org/htdocs/paste/inc/highlight.php Sun Dec 16 02:04:19 = 2007 @@ -496,7 +496,60 @@ "varchar", "variable", "varying", "verbose", "version", "view", "volatile", "when", "whenever", "where", "with", "without", - "work", "write", "year", "zone") + "work", "write", "year", "zone"), +=09 +=09 + "Bash" =3D> array( + "alias", "break", "case", "continue", + "do", "done", "elif", "else", + "esac", "exit", "export", "fi", + "for", "if", "in", "return", + "set", "then", "unalias", "unset", + "while", "halt", "ifconfig", "lsmod", + "modprobe", "reboot", "rmmod", "route", + "shutdown", "traceroute", "awk", "basename", + "cat", "cp", "echo", "egrep", + "fgrep", "gawk", "grep", "gzip", + "kill", "killall", "less", "md", + "mkdir", "mv", "nice", "pidof", + "ps", "rd", "read", "rm", + "rmdir", "sed", "sleep", "test", + "touch", "ulimit", "uname", "usleep", + "zcat", "zless" + ), +=09 + "Batch" =3D> array( + "do", "else", "end", "errorlevel", + "exist", "exit", "for", "goto", + "if", "not", "pause", "return", + "say", "select", "then", "when", + "ansi", "append", "assign", "attrib", + "autofail", "backup", "basedev", "boot", + "break", "buffers", "cache", "call", + "cd", "chcp", "chdir", "chkdsk", + "choice", "cls", "cmd", "codepage", + "command", "comp", "copy", "country", + "date", "ddinstal", "debug", "del", + "detach", "device", "devicehigh", "devinfo", + "dir", "diskcoache", "diskcomp", "diskcopy", + "doskey", "dpath", "dumpprocess", "eautil", + "endlocal", "erase", "exit_vdm", "extproc", + "fcbs", "fdisk", "fdiskpm", "files", + "find", "format", "fsaccess", "fsfilter", + "graftabl", "iopl", "join", "keyb", "keys", + "label", "lastdrive", "libpath", "lh", "loadhigh", + "makeini", "maxwait", "md", "mem", "memman", "mkdir", "mode", "move", + "net", "patch", "path", "pauseonerror", "picview", "pmrexx", "print", + "printmonbufsize", "priority", "priority_disk_io", "prompt", "protectonly", + "protshell", "pstat", "rd", "recover", "reipl", "ren", "rename", "replace", + "restore", "rmdir", "rmsize", "run", "set", "setboot", "setlocal", "shell",= =20 + "shift", "sort", "spool", "start", "subst", "suppresspopups", "swappath",=20 + "syslevel", "syslog", "threads", "time", "timeslice", "trace", "tracebuf", = + "tracefmt", "trapdump", "tree", "type", "undelete", "unpack", "use", + "ver", "verify", "view", "vmdisk", "vol", + "xcopy", "xcopy32", "xdfcopy", + "echo", "off", "on" + ) =20 ); =20 @@ -751,7 +804,7 @@ =20 $mirc[line_comment]["\n"] =3D normal_text; $mirc[line_comment][0] =3D line_comment; - +=09 $ruby =3D $perl; =20 $python =3D $perl; @@ -850,6 +903,9 @@ $xml[dq_escape][";"] =3D dq_literal; =20 $xml[dq_escape][0] =3D dq_escape; =20 =20 + $bash =3D $perl; + $batch =3D $c89;; +=09 // // Main state transition table // @@ -869,7 +925,9 @@ "PL/I" =3D> $pli, "SQL" =3D> $sql, "XML" =3D> $xml, - "Scheme" =3D> $sch + "Scheme" =3D> $sch, + "Bash" =3D> $bash, + "Batch" =3D> $batch ); =20 =20 @@ -949,6 +1007,10 @@ $process["XML"][xml_tag][dq_literal] =3D "rtrim1"; $process["XML"][dq_literal][xml_tag] =3D "rtrim1"; $process["XML"][dq_literal][dq_escape] =3D "rtrim1"; +=09 + $process["Bash"] =3D $process["Perl"]; + $process["Batch"] =3D $process["C++"]; + =20 $process_end["C89"] =3D "syntax_highlight_helper"; $process_end["C++"] =3D $process_end["C89"]; @@ -965,7 +1027,8 @@ $process_end["PL/I"] =3D $process_end["C89"]; $process_end["SQL"] =3D $process_end["C89"]; $process_end["Scheme"] =3D "sch_syntax_helper"; - + $process_end["Bash"] =3D $process_end["C89"]; + $process_end["Batch"] =3D $process_end["C89"]; =20 $edges["C89"][normal_text .",". dq_literal] =3D '"'; $edges["C89"][normal_text .",". sq_literal] =3D '\''; @@ -1049,6 +1112,10 @@ $edges["XML"][sq_literal . "," . xml_tag] =3D '\''; $edges["XML"][sq_literal . "," . sq_escape] =3D '&';=20 $edges["XML"][sq_escape . "," . sq_literal] =3D '';=20 + + $edges["Bash"] =3D $edges["Perl"]; + $edges["Batch"] =3D $edges["C89"]; +=09 =20 // // The State Machine Modified: trunk/web/reactos.org/htdocs/paste/inc/paste.php URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/paste/in= c/paste.php?rev=3D31264&r1=3D31263&r2=3D31264&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/reactos.org/htdocs/paste/inc/paste.php (original) +++ trunk/web/reactos.org/htdocs/paste/inc/paste.php Sun Dec 16 02:04:19 2007 @@ -29,94 +29,109 @@ } =09 if ($ros_paste_SET_pasteid) { + create_header(); + $query_pasteid=3Dmysql_query("SELECT *=20 FROM `paste_service`=20 - WHERE `paste_id` =3D '".mysql_real_escape_string($ros_paste_SET_pas= teid)."'=20 + WHERE `paste_id` =3D '".mysql_real_escape_string($ros_paste_SET_pas= teid)."' =20 LIMIT 1 ;");=09 $result_pasteid =3D mysql_fetch_array($query_pasteid); =09 - echo '= '; - echo "No related paste exists.
"; + } else if (compareDate((date('Y')."-".date('m')."-".date('d')),stripDate($= result_pasteid['paste_datetime'])) <=3D $result_pasteid['paste_days']) { + =09 + echo ''; + echo "Pasted by:
+ Language:
+ Description:
+ Pasted on:
+ Expire after: days
+ Paste history: ";
- =09
-?>
-
-
Pasted by:
-Language:
-Description:
-Pasted on:
-Expire after: days
-Paste history:
Add line numbers'; - } - else { - echo ' |=20 - " target=3D"_blank">Download as Text |=20 - ">Other recent= pastes |=20 - ">Create new paste
- +'; - echo $ros_paste_SET_textcontent; - echo ''; + echo 'Add line numbers'; } else { -?> -
Remove line numbers'; + } + ?> |=20 + " target=3D"_blank">Download as Text=20 + " target=3D"_blank">(word-warp) |=20 + ">Other recen= t pastes |=20 + ">Create new paste + paste expired"); + } +=09 + $ros_paste_SET_textcontent =3D htmlspecialchars($contents); + if ($result_pasteid['paste_tabs'] !=3D "0") { + $PASTE_var_tabs =3D ""; + for($xxx=3D0; $xxx<$result_pasteid['paste_tabs']; $xxx++){ + $PASTE_var_tabs .=3D " "; } + $ros_paste_SET_textcontent =3D str_replace("\t",$PASTE_var_tabs,$ros_pa= ste_SET_textcontent); + } =09 - ?>- |
-
'; + echo $ros_paste_SET_textcontent; + echo ''; + } + else { + ?> +
+ | +
Pastes expire by default after 7 days, if desired even earlier.
+Pastes expire by default after 7 days, if desired even earlier. This page= lists the 50 most recent pastes.
Date |
- Language<=
/font> |
- Nick |
- Description |
+ Date=
div> |
+ Description=
font> |
+ Nick=
div> |
+ Language |
+ Lines |
+ Size=
div> |
"> |
+ "> | +"> | +"> byte |
\n\n";
+ $filename =3D $ros_paste_SET_content."/".$result_pasteid['paste_id'].".t=
xt";
+ $handle =3D @fopen($filename, "r");
+ $contents =3D @fread($handle, @filesize($filename));
+ @fclose($handle);
+ $ros_paste_SET_textcontent =3D $contents;
//$ros_paste_SET_textcontent =3D str_replace(" "," ",$ros_paste_SET=
_textcontent);
if ($result_pasteid['paste_tabs'] !=3D "0") {
$PASTE_var_tabs =3D "";
@@ -104,7 +111,11 @@
}
$ros_paste_SET_textcontent =3D str_replace("\t",$PASTE_var_tabs,$ros_pa=
ste_SET_textcontent);
}
- echo $ros_paste_SET_textcontent;
+ if (@$ros_paste_SET_pasteflag =3D=3D "textw") {
+ echo wordwrap($ros_paste_SET_textcontent, 80, "\n", true);
+ } else {
+ echo $ros_paste_SET_textcontent;
+ }
}
else {
include("inc/header.php");
@@ -116,18 +127,20 @@
break;
case "conditions": // Conditions
include("inc/header.php");
+ create_header();
include("inc/conditions.php");
include("inc/footer.php");
break;
case "help": // Help & FAQ
include("inc/header.php");
+ create_header();
include("inc/help.php");
include("inc/footer.php");
break;
case "recent": // Recent Pastes
include("inc/header.php");
+ create_header();
include("inc/account.php");
- include("inc/tools.php");
include("inc/recent.php");
include("inc/footer.php");
break;
--===============4828836663999086265==--