cvs: php-gtk-web / manual1-lookup.php /include manual1-lookup.inc shared-manual.inc shared-manual1.inc /manual1 about-notes.php add-note.php
admin-notes.php browse-notes.php browse.php note.sql set-magic-cookie.php unset-magic-cookie.php

From: Date: Tue, 14 Mar 2006 21:37:13 +0000
Subject: cvs: php-gtk-web / manual1-lookup.php /include manual1-lookup.inc shared-manual.inc shared-manual1.inc /manual1 about-notes.php add-note.php
admin-notes.php browse-notes.php browse.php note.sql set-magic-cookie.php unset-magic-cookie.php
Groups: php.gtk.webmaster 
Request: Send a blank email to php-gtk-webmaster+get-2936@lists.php.net to get a copy of this message
sfox Tue Mar 14 21:37:13 2006 UTC Added files: /php-gtk-web/include manual1-lookup.inc shared-manual1.inc /php-gtk-web manual1-lookup.php /php-gtk-web/manual1 about-notes.php add-note.php admin-notes.php browse-notes.php browse.php note.sql set-magic-cookie.php unset-magic-cookie.php Modified files: /php-gtk-web/include shared-manual.inc Log: - Adding the new manual1 dir - The PHP_GTK_1 version of the manual will be generated into this dir - A few files have been duplicated accordingly so that the existing search will/should work with v1 - Toplevel files haven't been touched yet. The existing copy of v1 will remain in /manual until v2 is built

http://cvs.php.net/viewcvs.cgi/php-gtk-web/include/shared-manual.inc?r1=1.58&r2=1.59&diff_format=u Index: php-gtk-web/include/shared-manual.inc diff -u php-gtk-web/include/shared-manual.inc:1.58 php-gtk-web/include/shared-manual.inc:1.59 --- php-gtk-web/include/shared-manual.inc:1.58 Mon Nov 21 01:12:04 2005 +++ php-gtk-web/include/shared-manual.inc Tue Mar 14 21:37:13 2006 @@ -325,7 +325,7 @@ echo '<tr valign="top">'; echo '<td bgcolor="#e0e0e0" colspan="2">'; echo 'User contributed notes are not available on this mirror site; try '; - print_link('http://www.php.net/manual/'.$LANG.'/'.$id, 'here'); + print_link('http://gtk.php.net/manual/'.$LANG.'/'.$id, 'here'); echo '.<br></td></tr>'; } else { echo '<tr valign="top">'; http://cvs.php.net/viewcvs.cgi/php-gtk-web/include/manual1-lookup.inc?view=markup&rev=1.1 Index: php-gtk-web/include/manual1-lookup.inc +++ php-gtk-web/include/manual1-lookup.inc <?php /* NOTE: If there is documentation for a new extension, the extension's classes, enums and flags will need to be added to the $classes array before this search script will work with it!! */ /* set up the tools for the job - this array tests class and enum names in order to capitalize them correctly, throughout the search routines */ $classes = array('GtkAccelGroup.', 'GtkAccelLabel.', 'GtkAdjustment.', 'GtkAlignment.', 'GtkArrow.', 'GtkAspectFrame.', 'GtkBin.', 'GtkBox.', 'GtkBoxChild.', 'GtkButton.', 'GtkButtonBox.', 'GtkCalendar.', 'GtkCheckButton.', 'GtkCheckMenuItem.', 'GtkCList.', 'GtkCListRow.', 'GtkColorSelection.', 'GtkColorSelectionDialog.', 'GtkCombo.', 'GtkContainer.', 'GtkCTree.', 'GtkCTreeNode.', 'GtkCurve.', 'GtkData.', 'GtkDialog.', 'GtkDrawingArea.', 'GtkEditable.', 'GtkEntry.', 'GtkEventBox.', 'GtkFileSelection.', 'GtkFixed.', 'GtkFixedChild.', 'GtkFontSelection.', 'GtkFontSelectionDialog.', 'GtkFrame.', 'GtkGammaCurve.', 'GtkHandleBox.', 'GtkHBox.', 'GtkHButtonBox.', 'GtkHPaned.', 'GtkHRuler.', 'GtkHScale.', 'GtkHScrollbar.', 'GtkHSeparator.', 'GtkImage.', 'GtkInputDialog.', 'GtkInvisible.', 'GtkItem.', 'GtkItemFactory.', 'GtkLabel.', 'GtkLayout.', 'GtkList.', 'GtkListItem.', 'GtkMenu.', 'GtkMenuBar.', 'GtkMenuItem.', 'GtkMenuShell.', 'GtkMisc.', 'GtkNotebook.', 'GtkObject.', 'GtkOptio! nMenu.', 'GtkPacker.', 'GtkPaned.', 'GtkPixmap.', 'GtkPlug.', 'GtkPreview.', 'GtkProgress.', 'GtkProgressbar.', 'GtkRadioButton.', 'GtkRadioMenuItem.', 'GtkRange.', 'GtkRuler.', 'GtkScale.', 'GtkScrollbar.', 'GtkScrolledWindow.', 'GtkSelectionData.', 'GtkSeparator.', 'GtkSocket.', 'GtkSpinButton.', 'GtkStatusBar.', 'GtkStyle.', 'GtkTable.', 'GtkTableChild.', 'GtkTearoffMenuItem.', 'GtkText.', 'GtkTipsQuery.', 'GtkToggleButton.', 'GtkToolBar.', 'GtkToolTips.', 'GtkTree.', 'GtkTreeItem.', 'GtkVBox.', 'GtkVButtonBox.', 'GtkViewport.', 'GtkVPaned.', 'GtkVRuler.', 'GtkVScale.', 'GtkVScrollbar.', 'GtkVSeparator.', 'GtkWidget.', 'GtkWindow.', 'GdkAtom.', 'GdkBitmap.', 'GdkColor.', 'GdkColormap.', 'GdkCursor.', 'GdkDragContext.', 'GdkEvent.', 'GdkEventAny.', 'GdkEventExpose.', 'GdkFont.', 'GdkGC.', 'GdkPixmap.', 'GdkVisual.', 'GdkWindow.', 'GdkCapStyle.', 'GdkCursorType.', 'GdkDragAction.', 'GdkEventMask.', 'GdkEventType.', 'GdkFill.', 'GdkFontType.', 'GdkFunction.', 'GdkInputCondi! tion.', 'GdkJoinStyle.', 'GdkLineStyle.', 'GdkModifierType.', 'GdkRgbD ither.', 'GdkSubwindowMode.', 'GdkVisualType.', 'GtkAccelFlags.', 'GtkAnchorType.', 'GtkArrowType.', 'GtkAttachOptions.', 'GtkButtonAction.', 'GtkButtonBoxStyle.', 'GtkCalendarDisplayOptions.', 'GtkCellType.', 'GtkCornerStyle.', 'GtkCTreeExpanderStyle.', 'GtkCTreeExpansionType.', 'GtkCTreeLineStyle.', 'GtkCurveType.', 'GtkDestDefaults.', 'GtkDirectionType.', 'GtkFontFilterType.', 'GtkFontType.', 'GtkJustification.', 'GtkObjectFlags.', 'GtkOrientation.', 'GtkPackerOptions.', 'GtkPackType.', 'GtkPolicyType.', 'GtkPositionType.', 'GtkPreviewType.', 'GtkProgressBarOrientation.', 'GtkProgressBarStyle.', 'GtkReliefStyle.', 'GtkResizeMode.', 'GtkScrollType.', 'GtkSelectionMode.', 'GtkShadowType.', 'GtkSideType.', 'GtkSortType.', 'GtkSpinButtonUpdatePolicy.', 'GtkSpinType.', 'GtkStateType.', 'GtkSubmenuPlacement.', 'GtkToolbarChildType.', 'GtkToolbarSpaceStyle.', 'GtkToolbarStyle.', 'GtkTreeViewMode.', 'GtkUpdateType.', 'GtkVisibility.', 'GtkWidgetFlags.', 'GtkWindowPosition.', 'Gtk! WindowType.', 'GtkScintilla.', 'GtkSQPane.', 'GladeXML.'); function tryprefix($lang, $func, $prefix) { global $classes, $full_match; $full_match = (int)0; $types = array('method.', 'signal.', 'property.'); $hit = array(); $part = array(); /* get the 'ext' element of gtk/gdk filenames */ $first = substr($prefix, 0, 3); /* get the 'ext' element of non-gtk/gdk filenames */ $ext = array(); $dir = opendir("$_SERVER[DOCUMENT_ROOT]/manual1/$lang"); while(($item = readdir($dir))!== false) { if(!is_dir($item)) { $part = explode('.', $item); if(strlen($part[0]) < 4 && $part[0] !== "gtk" && $part[0] !== "gdk" && !in_array($part[0], $ext)) $ext[sizeof($ext)] = $part[0]; } } closedir($dir); /* just so's we don't have to guess wildly at capitalisation in classes/enums */ for($i = 0; $i < sizeof($classes); $i++) { if(stristr($classes[$i], "${func}.")) $pos = $i; } $realname = $classes[$pos]; /* check for classes, enums and static functions */ if(strstr($func, "gdk") || strstr($func, "gtk") || strstr($prefix, "method")) { /* check for full gtk/gdk function name (e.g. 'gtkwindow::set_title') */ if(strstr($prefix, "method") && strlen($prefix) > 11) { $try = "/manual1/${lang}/${first}.${prefix}${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { /* check for the same under other extensions */ foreach($ext as $first) { $try = "/manual1/${lang}/${first}.${prefix}${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } } } } else { /* check for a gtk/gdk static function, full class or enum name */ $try = "/manual1/${lang}/${prefix}${func}.php"; $constructor = "/manual1/${lang}/${prefix}${func}.constructor.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$constructor")) { $try = "/manual1/${lang}/${prefix}${realname}php"; $constructor = "/manual1/${lang}/${prefix}${realname}constructor.php"; $full_match = $full_match + 2; $hit = array($try, $constructor); } else if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { $try = "/manual1/${lang}/${prefix}enum.${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $try = "/manual1/${lang}/${prefix}enum.${realname}php"; $full_match++; $hit[] = $try; } } } } if(!$hit) { /* go through the extension classes */ foreach($ext as $prefix) { $try = "/manual1/${lang}/${prefix}.${func}.php"; $constructor = "/manual1/${lang}/${prefix}.${func}.constructor.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$constructor")) { $try = "/manual1/${lang}/${prefix}.${realname}php"; $constructor = "/manual1/${lang}/${prefix}.${realname}constructor.php"; $full_match = $full_match + 2; $hit = array($try, $constructor); } else if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { /* cover against futureshock - non-g*k enums */ $try = "/manual1/${lang}/${prefix}.enum.${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $try = "/manual1/${lang}/${prefix}.enum.${realname}php"; $full_match++; $hit[] = $try; } } } } return $hit; } function wildcard($lang, $func, $hit) { global $classes, $full_match; $full_match = (int)0; $dir = opendir("$_SERVER[DOCUMENT_ROOT]/manual1/$lang"); while(($item = readdir($dir))!== false) { $part = explode('.', $item); $gtk = $part[0]; $class = substr($part[1], 0, 3); $enum = substr($part[2], 0, 3); $method = substr($part[3], 0, 3); if($gtk == $class || $gtk == $enum || ($gtk !== "gtk" && $gtk !== "gdk")) { if(stristr($part[1], $func) || stristr($part[2], $func)) { if($part[2] !== "method" && $part[2] !== "property" && $part[2] !== "signal") { $try = "/manual1/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { if(stristr($part[1], $func)) $uc = $part[1]; else $uc = $part[2]; for($i = 0; $i < sizeof($classes); $i++) { if(stristr($classes[$i], "$uc.")) $pos = $i; } $realname = $classes[$pos]; if ($uc == $part[1]) { $try = "/manual1/${lang}/$part[0].$realname$part[2]"; } else { $try = "/manual1/${lang}/$part[0].$part[1].$realname$part[3]"; } similar_text(strtolower($func), strtolower($uc), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } } if($part[1] == "method") { if(strstr($part[2], $func)) { $try = "/manual1/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { similar_text(strtolower($func), strtolower($part[2]), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } if(($gtk == $class || ($gtk !== "gtk" && $gtk !== "gdk")) && strstr($part[3], $func)) { $try = "/manual1/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { for($i = 0; $i < sizeof($classes); $i++) { if(stristr($classes[$i], "$part[1].")) $pos = $i; } $realname = $classes[$pos]; $try = "/manual1/${lang}/$part[0].$realname$part[2].$part[3].$part[4]"; similar_text(strtolower($func), strtolower($part[3]), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } closedir($dir); return $hit; } function find_manual_page($lang, $function) { $tried = 0; $hit = array(); /* fast track, single return :) */ if(strstr($function, "::")) { list($funcpre, $funcpost) = split("::", $function); $try = tryprefix($lang, $funcpost, "$funcpre.method."); if($try) return $try; } elseif(strtolower(substr($function, 0, 3)) == "gtk" || strtolower(substr($function, 0, 3 == "gdk"))) { $prefix = strtolower(substr($function, 0, 3)); $try = tryprefix($lang, $function, "$prefix."); if($try) return $try; } else { /* if there's no :: or gtk in there we could be looking for anything */ $try = wildcard($lang, $function, $hit); /* if($try) $result = array_merge($try, $result); */ if ($try) return $try; } /* if($result) { return $result; } */ return ""; } ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/include/shared-manual1.inc?view=markup&rev=1.1 Index: php-gtk-web/include/shared-manual1.inc +++ php-gtk-web/include/shared-manual1.inc <?php define(NAV_NONE, 0); define(NAV_CLASSENTRY, 1); define(NAV_CONSTRUCTOR, 2); define(NAV_METHOD, 3); define(NAV_SIGNAL, 4); define(NAV_ENUM, 5); mysql_connect("localhost","nobody",""); mysql_select_db("gtk"); $NEXT = $PREV = $UP = $HOME = array(false, false); $TOC = array(); $SIDEBAR_DATA = ''; function recursive_trim(&$s, $k) { if (is_array($s)) { array_walk($s, 'recursive_trim'); } else { $s = trim($s); } } function setupNavigation($data) { global $NEXT, $PREV, $UP, $HOME, $TOC, $tstamp; @array_walk($data, 'recursive_trim'); $HOME = @$data["home"]; $HOME[0] = "./"; $NEXT = @$data["next"]; $PREV = @$data["prev"]; $TOC = @$data["toc"]; $UP = @$data["up"]; $tstamp = gmdate("D, d M Y",getlastmod()); } function makeBorderTOC($this) { global $NEXT, $PREV, $UP, $HOME, $TOC; global $SIDEBAR_DATA; $SIDEBAR_DATA = '<form method="get" action="/manual1-lookup.php">'; /* ALTER FOR LOCAL "../../php-gtk-web/manual1-lookup.php" */ $SIDEBAR_DATA.= '<table border="0" CELLPADDING="4" CELLSPACING="0" WIDTH="160">'; if(sizeof($TOC) > 1) { $SIDEBAR_DATA.= '<tr valign="top"><td><small>' . 'lookup: <input type="text" class="small" name="function" size="10"> ' . make_submit('small_submit.gif', 'lookup', 'bottom') . '<br></small></td></tr>'; $SIDEBAR_DATA.= '<tr bgcolor="#cccccc"><td></td></tr>'; $SIDEBAR_DATA.= '<tr valign="top"><td>' . make_link('./', make_image('caret-t.gif', $HOME[1]) . $HOME[1] ) . '<br></td></tr>'; $SIDEBAR_DATA.= '<tr bgcolor="#cccccc"><td></td></tr>'; if (($HOME[1] != $UP[1]) && $UP[1]) { $SIDEBAR_DATA.= '<tr valign="top"><td>' . make_link($UP[0], make_image('caret-u.gif', $UP[1]) . $UP[1] ) . '<br></td></tr>'; } $SIDEBAR_DATA.= '<tr valign="top"><td><small>'; for ($i = 0; $i < count($TOC); $i++) { list($url, $title, $type) = $TOC[$i]; if (!$url || !$title) { continue; } $end = '0.gif'; if ($title == $this) { $end = '1.gif'; } switch($type) { case NAV_CLASSENTRY: $img = "icon-o".$end; break; case NAV_CONSTRUCTOR: $img = "icon-c".$end; break; case NAV_METHOD: $img = "icon-m".$end; break; case NAV_SIGNAL: $img = "icon-s".$end; break; case NAV_ENUM: $img = "icon-e".$end; break; default: $img = "box-".$end; } if ($UP[0] == 'funcref.php') { $title = eregi_replace(" functions\$", "", $title); } $SIDEBAR_DATA .= '&nbsp;' . make_link($url, make_image($img, $title) . $title ) . '<br>'; } $SIDEBAR_DATA.= '</small></td></tr>'; } $SIDEBAR_DATA.= '</table></form>'; } function navigationBar($title, $id, $loc) { global $NEXT, $PREV, $tstamp; echo '<table border="0" width="580" bgcolor="#e0e0e0" cellpadding="0" cellspacing="4">'; echo '<tr><td>'; if ($PREV[1]) { echo make_link( $PREV[0] , make_image('caret-l.gif', 'previous') . $PREV[1] ) ; } echo '<br></td>'; echo '<td align="right">'; if ($NEXT[1]) { echo make_link( $NEXT[0] , $NEXT[1] . make_image('caret-r.gif', 'next') ) ; } echo '<br></td>'; echo '</tr>'; echo '<tr bgcolor="#cccccc"><td colspan="2">'; spacer(1,1); echo '<br></td></tr>'; echo '<tr>'; echo '<td align="right" colspan="2"><small>Last updated: '.$tstamp.'<br>'; # if ($loc == 'bottom') { # $back_url = 'http://' . $_SERVER['SERVER_NAME'] . # (($_SERVER['SERVER_PORT']==80) ? '' : ':'.$_SERVER['SERVER_PORT'] ) . # $_SERVER['PHP_SELF']; # } else { global $LANGUAGES; $links = array(); if($LANGUAGES){ foreach($LANGUAGES as $code=>$name) { if (file_exists("../$code/$id")) { $links[] = make_link("../$code/$id", $name); } } } $file = substr($id,0,-4); if (file_exists("html/$file.html")) { $links[] = make_link("html/$file.html", 'Plain HTML'); } if (count($links)) { echo 'view this page in ' . join (delim(), $links); echo '<br></small></td></tr>'; } echo "</table>\n"; } function makeTitle($title) { echo '<tr bgcolor="#d0d0d0" valign="top">'; echo '<td colspan="2"><b>' . $title . '</b><br></td>'; echo "</tr>\n"; } function makeEntry($row, $show_admin = true, $show_rating = true ) { global $MAGIC_COOKIE; echo '<tr valign="top">'; echo '<td bgcolor="#e0e0e0" colspan="2">'; echo '<table border="0" cellpadding="2" cellspacing="0" width="100%">'; echo '<tr valign="top"><td>'; $name = htmlspecialchars($row['user']); if ($name && $name != "php-gtk@lists.php.net" && $name != "user@example.com") { if (ereg("(.+)@(.+)\.(.+)",$name)) { echo '<a href="mailto:'.$name.'">'.$name.'</a><br>'; } else { echo '<b>'.$name.'</b><br>'; } } echo '<small>' . date("d-M-Y h:i", $row['xwhen']) . '</small>'; echo '<br></td>'; echo '<td align="right" nowrap><small>'; if (isset($MAGIC_COOKIE) && $show_admin) { print_link('/manual1/admin-notes.php?action=edit+' . $row['id'] . '&brief=1', make_image('notes-edit.gif', 'edit note') ); echo '&nbsp'; print_link('/manual1/admin-notes.php?action=reject+' . $row['id'] . '&brief=1&popup=1', make_image('notes-reject.gif', 'reject note'), 'admin' ); echo '&nbsp'; print_link('/manual1/admin-notes.php?action=delete+' . $row['id'] . '&brief=1&popup=1', make_image('notes-delete.gif', 'delete note'), 'admin' ); } echo '<br>'; if ($show_rating) { echo 'rating: '; if ( $row['votes'] > 2 ) { printf('<b>%.01f</b>', $row['rate'] ); } else { echo '<b><font color="#cc0000">new</font></b>'; } echo ' | rate: '; for ($i=1; $i<=5; $i++) { if ($i>1) { echo ' <font color="#999999">|</font> '; } print_link(htmlspecialchars($_SERVER['PHP_SELF']).'?rate_id='.$row['id'].'&rate_note='.$i, $i); } echo '<br>'; } echo '</small></td></tr>'; echo '<tr bgcolor="#f0f0f0"><td colspan="2">'; echo clean_note($row['note']). '<br>'; echo '</td></tr>'; echo '</table>'; echo '</td></tr>'; } function updateNotesVoting() { # probably a better way/place to do this, but ... if ($_GET['rate_id'] && $_GET['rate_note']) { $p = parse_url($_SERVER['HTTP_REFERER']); echo "\n\n<!-- " . $p['path'] . " :: " . $_SERVER['SCRIPT_NAME'] . " -->\n\n"; /* prevent outside scripts from voting */ if ($_SERVER['SCRIPT_NAME']==$p['path']) { $query = 'UPDATE note SET votes=votes+1, rating=rating+' . min(5, $_GET['rate_note']) . ' WHERE id=' . $_GET['rate_id']; $result_id = @mysql_query($query); } } } function manualGetUserNotes($title, $id) { // if we're gtk.php.net, get it from the local DB // otherwise look in "/manual1/usernotes/$title.txt" (if present) $notes = array(); # if(is_primary_site() || strstr($MYSITE,"localhost")) { if ( true ) { updateNotesVoting(); $query = "SELECT *, UNIX_TIMESTAMP(ts) AS xwhen, IF(votes=0, 10, rating/votes) AS rate FROM note " . "WHERE sect='$title' OR sect='$id' ORDER BY xwhen DESC, id"; echo "\n\n<!-- DEBUG: $query -->\n\n"; $result_id = @mysql_query($query); if ($result_id && mysql_num_rows($result_id) > 0) { echo "\n\n<!-- DEBUG: numrows=" . mysql_num_rows($result_id) . " -->\n\n"; while ($row = mysql_fetch_array($result_id)) { $notes[] = $row; } } else { echo "\n\n<!-- DEBUG: err=" . @mysql_error($result_id) . " -->\n\n"; } } else { $notes_file = "../usernotes/" . urlencode( $title ) . ".txt"; if ( @file_exists( $notes_file ) ) { $fp = @fopen($notes_file,"r"); if ($fp) { $body = fread($fp,filesize($notes_file)); if (strlen($body)) { $notes = @unserialize($body); } fclose($fp); } } } return $notes; } function manualUserNotes($title, $id) { global $LANG, $MYSITE; $cur = substr(dirname($_SERVER['PHP_SELF']), -2); if($cur=='al') { $cur='en'; } echo "<BR>\n\n"; echo '<table border="0" cellpadding="4" cellspacing="0" width="100%">'; $notes = manualGetUserNotes($title, $id); $back_url = 'http://' . $_SERVER['SERVER_NAME'] . (($SERVER_PORT==80) ? '' : ':'.$_SERVER['SERVER_PORT'] ) . htmlspecialchars($_SERVER['PHP_SELF']); echo '<tr bgcolor="#d0d0d0" valign="top">'; echo '<td><small>User Contributed Notes<br></small><b>' . $title . '</b><br></td>'; echo '<td align="right">'; print_link('/manual1/add-note.php?sect='.$id.'&redirect='.$back_url, make_image('notes-add.gif','add a note') ); echo "&nbsp;"; print_link('/manual1/about-notes.php', make_image('notes-about.gif', 'about notes') ); echo "<br></td>\n"; echo "</tr>\n"; if ( sizeof($notes) == 0 ) { if ( false ) { echo '<tr valign="top">'; echo '<td bgcolor="#e0e0e0" colspan="2">'; echo 'User contributed notes are not available on this mirror site; try '; print_link('http://gtk.php.net/manual1/'.$LANG.'/'.$id, 'here'); echo '.<br></td></tr>'; } else { echo '<tr valign="top">'; echo '<td bgcolor="#e0e0e0" colspan="2">'; echo 'There are no user contributed notes for this page.'; echo '<br></td></tr>'; } } else { foreach($notes as $note) { makeEntry($note); } echo "<tr bgcolor=\"#d0d0d0\" valign=\"top\">\n"; echo "<td colspan=\"2\" align=\"right\">\n"; print_link('/manual1/add-note.php?sect='.$id.'&redirect='.$back_url, make_image('notes-add.gif','add a note') ); echo "&nbsp;"; print_link('/manual1/about-notes.php', make_image('notes-about.gif', 'about notes') ); echo "<br></td>\n"; echo "</tr>\n"; } echo "</table><br><br>\n"; } function sendManualHeaders($charset, $LANG) { global $LANG; Header("Content-type: text/html;charset=UTF-8"); Header("Content-language: $LANG"); } function manualHeader($title, $id="") { global $HTDIG; makeBorderTOC($title); commonHeader('PHP-GTK 1 Manual: '.$title); # create links to plain html and other languages if (!$HTDIG) { navigationBar($title, $id, "top"); } } function manualFooter($title, $id="") { global $HTDIG; if (!$HTDIG) { manualUserNotes($title,$id); navigationBar($title, $id, "bottom"); } commonFooter(); } function dehtmlspecialchars($str) { $str = str_replace("&gt;",">",$str); $str = str_replace("&lt;","<",$str); $str = str_replace("&quot;","\"",$str); $str = str_replace("&amp;","&",$str); return $str; } ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1-lookup.php?view=markup&rev=1.1 Index: php-gtk-web/manual1-lookup.php +++ php-gtk-web/manual1-lookup.php <?php require_once 'prepend.php'; require_once 'manual1-lookup.inc'; $pattern = $_POST['pattern']; $function = $_GET['function']; if (!$function && $pattern) $function = $pattern; $function = strtolower($function); /* it gets messy trying to pass $lang around - so get it from the referral dir */ if(strstr(dirname($_SERVER[HTTP_REFERER]), "manual1/")) { $lang = substr(dirname($_SERVER[HTTP_REFERER]), -2); } else { $lang="en"; } /* there's always one, eh? */ if($lang == "BR") $lang = "pt_BR"; function make404($lang) { commonHeader("404 Not Found"); $no_path = str_replace("/php-gtk-web/manual1-lookup.php?lang=$lang&function=", "", htmlspecialchars($_SERVER[REQUEST_URI])); $no_path = ereg_replace('&[x]=[0-9]&[y]=[0-9]', '', $no_path); echo "<br>&nbsp;<H1>Not Found</H1><br>"; if(strlen($no_path) < 3) echo "&nbsp;<B>" . $no_path . "</B> is too short to be used as a search string. <a href=$_SERVER[HTTP_REFERER]>Go back and try something longer</a><br><br><br><br><br><br><br>"; else echo "&nbsp;The function <B>" . $no_path . "</B> could not be found. <a href=$_SERVER[HTTP_REFERER]>Try again</a><br><br><br><br><br><br><br>"; commonFooter(); } function multi_choice($file, $lang) { global $full_match; $request = $_GET['function']; $switch = (int)0; if($full_match > 1) { commonHeader('multiple choice'); echo "<br><br>"; echo "<h1>Which &quot;$request&quot; did you want?</h1>\n"; echo "<br>"; } elseif($full_match < 1) { commonHeader('multiple choice'); echo "<br><br>"; echo "<h1>There is no exact match for &quot;$request&quot;.<br>Here is a list of the nearest matches:</h1>\n"; echo "<br>"; $switch = 1; } for($i = 0; $i < sizeof($file); $i++) { $path[$i] = str_replace("/manual1/", "", $file[$i]); $bits[$i][] = explode(".", $path[$i]); foreach($bits[$i] as $piece) { $GTK = substr(strtoupper($piece[0]), strlen($lang) + 1); $classlink = strtolower($file[$i]); if(strpos($classlink, "pt_br")) $classlink = str_replace("pt_br", "pt_BR", $classlink); if(sizeof($piece) == 5 && $piece[2] == "method") { similar_text(strtolower($request), strtolower($piece[3]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; /* We should have a nice clean separate function for $full_match == 1) */ } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match == 0)) { echo "<P>&nbsp;$piece[3]() as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[1] $piece[2]</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 5 && $piece[2] == "property") { $prop = strtolower(substr($piece[1], 3, strlen($piece[1]))); if(strstr($prop, "event")) $prop = "event"; similar_text(strtolower($request), strtolower($piece[3]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match == 0)) { echo "<P>&nbsp;\$$prop-&gt;$piece[3] as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[1] $piece[2]</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 5) { similar_text(strtolower($request), strtolower($piece[3]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match == 0)) { echo "<P>&nbsp;&quot;$piece[3]&quot; as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[1] $piece[2]</a></B>"; $i++; } } elseif(sizeof($piece) == 4 && $piece[1] == "enum") { similar_text(strtolower($request), strtolower($piece[2]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match !== 1)) { echo "<P>&nbsp;[$piece[2]Value] as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[2] $piece[1]s</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 4 && $piece[2] == "constructor") { similar_text(strtolower($request), strtolower($piece[1]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match !== 1)) { echo "<P>&nbsp;$piece[1]() as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[1] $piece[2]</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 4) { similar_text(strtolower($request), strtolower($piece[2]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match !== 1)) { echo "<P>&nbsp;$piece[2]() as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$GTK function</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 3 && $piece[2] == "constructor") { similar_text(strtolower($request), strtolower($piece[1]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match !== 1)) { echo "<P>&nbsp;$piece[1]() as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink.php'>$piece[1] $piece[2]</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } elseif(sizeof($piece) == 3) { similar_text(strtolower($request), strtolower($piece[1]), $percent); if($percent == 100 && $full_match == 1) { header("Location: http://$_SERVER[HTTP_HOST]$classlink"); exit; } elseif(($percent == 100 && $full_match > 1) || ($percent > 50 && $full_match !== 1)) { echo "<P>&nbsp;$piece[1] as in the <B><a href = 'http://$_SERVER[HTTP_HOST]$classlink'>$piece[1] class</a></B>"; if($switch == 0) echo "?"; echo "</P>"; } } } } echo "<br><a href=$_SERVER[HTTP_REFERER]>Back</a>"; commonFooter(); } $function = strtolower($_GET['function']); if(strlen($function) < 3) { make404($lang); exit; } $file = find_manual_page($lang, $function); if(is_array($file)) { if(sizeof($file) < 2) { $file = strtolower($file[0]); if(strpos($file, "pt_br")) $file = str_replace("pt_br", "pt_BR", $file); header("Location: http://$_SERVER[HTTP_HOST]$file"); exit; } multi_choice($file, $lang); exit; } elseif($file && !is_array($file)) { $file = strtolower($file); if(strpos($file, "pt_br")) $file = str_replace("pt_br", "pt_BR", $file); header("Location: http://$_SERVER[HTTP_HOST]$file"); exit; } else { make404($lang); exit; } ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/about-notes.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/about-notes.php +++ php-gtk-web/manual1/about-notes.php <?php commonHeader("PHP-GTK 1 Manual Notes"); ?> <P> The manual notes interface allows you to add notes to the online version of the PHP-GTK 1 manual. These notes are then shared with other PHP-GTK users when they browse the manual online. </P> <P> Periodically, the developers may go through the notes and incorporate the information in them into the documentation proper. </P> <P> These notes are only visible at <A href="http://gtk.php.net/manual1/">gtk.php.net</A> because that's where the database that stores them is located. If (when) the PHP-GTK website is mirrored in several locations, we'll work out a way of having the notes available across all the mirror sites. </P> <!-- <P> These notes are <B>not</B> the place to report <A href="http://gtk.php.net/bugs">bugs</A>! </P> --> <?php commonFooter(); ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/add-note.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/add-note.php +++ php-gtk-web/manual1/add-note.php <?php require_once 'shared-manual1.inc'; /* # Notes only available at main mirror site for now if ($HTTP_SERVER_VARS["HTTP_HOST"]!='gtk.php.net') { Header('Location: http://gtk.php.net' . $HTTP_SERVER_VARS['REQUEST_URI'] ); exit; } */ $mailto = 'php-gtk-webmaster@lists.php.net'; commonHeader('PHP-GTK 1 Manual Notes'); /* clean off leading and trailing whitespace */ $user = trim($user_email); $note = trim($note); /* don't pass through example username */ if ($user_email == 'user@example.com') { $user_email = ''; } if ($note == '') { unset ($note); } # turn the POST data into GET data so we can do the redirect /* if(!strstr($MYSITE,"gtk.php.net")) { Header("Location: http://gtk.php.net/manual1/add-note.php?sect=".urlencode($sect)."&lang=".urlencode($lang)."&redirect=".urlencode($redirect)); exit; } */ if (isset($note) && isset($action) && strtolower($action) != "preview") { $now = date("Y-m-d H:i:s"); $query = "INSERT INTO note (user, note, sect, ts, lang) VALUES "; # no need to call htmlspecialchars() -- we handle it on output $query .= "('$user_email','$note','$sect','$now','$lang')"; if (mysql_query($query)) { echo "<P>Your submission was successful -- thanks for contributing!</P>"; $new_id = mysql_insert_id(); $msg = stripslashes($note); $msg .= "\n\n $redirect \n"; # make sure we have a return address. if (!$user_email) { $user_email = "php-gtk@lists.php.net"; } mail($mailto, "note $new_id added to $sect", $msg, "From: $user_email"); } else { # mail it. mail($mailto, "failed manual v1 note query", $query); echo "<P>There was an error processing your submission. " . "It has been automatically e-mailed to the developers.</P>"; } echo '<P>You can <A href="' . $redirect. '">go back</A> from whence you came,' . 'or you can <A href="http://gtk.php.net/manual1/">go to the front of the manual</A>.</P>'; } else { if (isset($note) && strtolower($action) == "preview") { echo '<P>This is what your entry will look like, roughly:</P>'; echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">'; $temp = array( 'user' => stripslashes($user_email), 'note' => stripslashes($note), 'xwhen' => time() ); makeEntry($temp, false, false); echo "</table>"; } else { ?> <P> You can contribute to the PHP-GTK 1 manual from the comfort of your browser! Just add your comment in the big field below, and, optionally, your email address in the little one (usual anti-spam practices are OK, e.g. johnNOSPAM@doe.NO_SPAM.com). </P> <P> Note that most HTML tags are not allowed in the posts. We tried allowing them in the past, but people invariably made a mess of things making the manual hard to read for everybody. You can include &lt;p&gt;, &lt;/p&gt;, and &lt;br&gt; tags. </P> <P> Carefully read the following note. If your post falls into one of the categories mentioned there, it will be rejected by one of the editors. </P> <P> <B>Note:</B> If you are trying to <A href="http://gtk.php.net/bugs">report a bug</A>, or <a href="http://gtk.php.net/bugs">request a new feature or language change</a>, you're in the wrong place. If you are just commenting on the fact that something is not documented, save your breath. This is where <B>you</B> add to the documentation, not where you ask <B>us</B> to add the documentation. This is also not the correct place to <A href="http://www.php.net/support.php">ask questions</A> (even if you see others have done that before, we are editing the notes slowly but surely). If you post a note in any of the categories above, it will edited and/or removed. </P> <P> Just to make the point once more. The notes are being edited and support questions/bug reports/feature request/comments on lack of documentation, are being <b>deleted</b> from them (and you may get a <b>rejection</b> email), so if you post a question/bug/feature/complain, it will be removed (but once you get an answer/bug solution/function documentation, feel free to come back and add it here!). </P> <P> That said, you can change your mind and <a href="http://www.php.net/support.php">click here to go to the support pages</a> or <a href="http://gtk.php.net/bugs">click here to submit a bug report or request a feature</a>. </P> <?php } if (!$user_email) { $user_email = "user@example.com"; } if (!isset($sect)) { echo "<P><b>To add a note, you must click on the 'Add Note' button " . "on the bottom of a manual page so we know where to add the note!</b></P>"; } else { ?> <form method="POST" action="/manual1/add-note.php"> <input type="hidden" name="sect" value="<?echo $sect;?>"> <input type="hidden" name="redirect" value="<?echo $redirect;?>"> <input type="hidden" name="lang" value="<?echo $lang;?>"> <table border="0" cellpadding="5" cellspacing="0" bgcolor="#e0e0e0"> <TR VALIGN="top"> <TD ALIGN="right">Your email address:<BR></TD> <td><input type="text" name="user_email" size="40" maxlength="40" value="<?echo htmlspecialchars(stripslashes($user_email))?>"></td> </TR> <TR VALIGN="top"> <TD ALIGN="right">Your note:<BR></TD> <td><textarea name="note" rows="6" cols="40" wrap="virtual"><?echo htmlspecialchars(stripslashes($note))?></textarea><br> </TD> </TR> <TR> <td colspan="2" align="right"> <input type="submit" name="action" value="Preview"> <input type="submit" name="action" value="Add Note"> </td> </tr> </TABLE> </FORM> <?php } } commonFooter(); ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/admin-notes.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/admin-notes.php +++ php-gtk-web/manual1/admin-notes.php <?php //require_once 'cvs-auth.inc'; require_once 'email-validation.inc'; require_once 'shared-manual1.inc'; $mailto = 'php-gtk-webmaster@lists.php.net'; $num_entries_per_page = 50; if (isset($MAGIC_COOKIE)) { list($user, $pass) = explode(":", base64_decode($MAGIC_COOKIE)); } /* if(!strstr($MYSITE,"www.php.net")) { Header("Location: http://gtk.php.net/manual1/admin-notes.php"); exit; } */ updateNotesVoting(); commonHeader("PHP-GTK 1 Manual Notes Administration"); echo "<h1>PHP-GTK 1 Manual Notes Administration</h1>\n\n"; echo "<P>If you just want to browse the manual notes, you're better off " . "<A href=\"http://gtk.php.net/manual1/browse-notes.php\">here</A>.</P>\n"; if ($action != '') { list ($action, $id) = explode(' ', $action); if ($action!='edit'&& !isset($MAGIC_COOKIE)) { echo "<P><B>Authorization failed.</B></P>"; commonFooter(); exit; } switch($action) { case 'delete': $query = 'SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE id='.$id; if ($result = mysql_query($query)) { $row = mysql_fetch_array($result); mail($mailto, "note ".$row['id']." deleted from ".$row['sect']." by $user",stripslashes($row['note']),"From: ".$user."@php.net"); $query = 'DELETE FROM note WHERE id=' . $id; if (mysql_query($query)) { echo '<P><B>Note deleted.</B></P>'; if ($popup) { echo '<script language="javascript">window.close();</script>'; } } } break; case 'reject': $reject_text = "If you are receiving this email is because your note posted\n"; $reject_text .= "to the on-line PHP-GTK 1 manual has been removed by one of the editors.\n\n"; $reject_text .= "Read the following paragraphs carefully, because they contain\n"; $reject_text .= "pointers to resources better suited for requesting support or\n"; $reject_text .= "reporting bugs, none of which are to be included in manual notes\n"; $reject_text .= "because there are mechanisms and groups in place to deal with\n"; $reject_text .= "those issues.\n\n"; $reject_text .= "The user contributed notes are not an appropriate place to\n"; $reject_text .= "ask questions, report bugs or suggest new features; please\n"; $reject_text .= "use the resources listed in <http://www.php.net/support.php>\n"; $reject_text .= "for those purposes. This was clearly stated in the page\n"; $reject_text .= "you used to submit your note, please carefully re-read\n"; $reject_text .= "those instructions before submitting future contributions.\n\n"; $reject_text .= "Bug Submissions should be entered at <http://gtk.php.net/bugs/>\n"; $reject_text .= "Feature Requests should also be entered at <http://gtk.php.net/bugs/>\n"; $reject_text .= "Support and ways to find answers to your guestions can be found\n"; $reject_text .= "at <http://www.php.net/support.php>\n\n"; $reject_text .= "Your note has been removed from the on-line manual.\n\n"; $query = 'SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE id='.$id; if ($result = mysql_query($query)) { $row = mysql_fetch_array($result); // email the submitter if the address looks reasonable // uses functions in include/email-validation.inc $submitter = clean_AntiSPAM($row['user']); echo "<P>Note ".$row['id']." by: ".$row['user']." ($submitter) "; if (is_emailable_address($submitter)) { mail($submitter,"note ".$row['id']." rejected and deleted from ".$row['sect']." by notes editor $user",$reject_text."----- Copy of your note below -----\n\n".stripslashes($row['note']),"From: ".$user."@php.net"); } // email to the list mail($mailto, "note ".$row['id']." rejected and deleted from ".$row['sect']." by $user",stripslashes($row['note']),"From: ".$user."@php.net"); $query = 'DELETE FROM note WHERE id=' . $id; if (mysql_query($query)) { echo '<B>rejected and deleted.</B></P>'; } if ($popup) { echo '<script language="javascript">window.close();</script>'; } } break; case 'edit': echo "<P>Only people with " . make_link('http://www.php.net/cvs-php.php', 'CVS accounts') . " are able to edit the manual notes, so please don't email us asking when this doesn't work for you.</P>"; $query = 'SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE id='.$id; if ($result = mysql_query($query)) { $row = mysql_fetch_array($result); echo '<FORM method="POST" action="/manual1/admin-notes.php">'; echo '<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#e0e0e0">'; echo '<TR valign="top"><TD align="right"><small>E-mail:<br></small></TD>' . '<TD><INPUT type="text" size="40" name="nuser" value="',$row['user'], '"><BR></TD></TR>'; echo '<TR valign="top"><TD align="right"><small>Note:<br></small></TD>' . '<TD><TEXTAREA name="note" rows="8" cols="50">' . $row['note'] . '</TEXTAREA><BR></TD></TR>'; echo '<TR valign="top"><TD align="right"><small>Reset rating:<br></small></TD>' . '<TD><SELECT name="rating">'; echo '<OPTION VALUE="0">leave unchanged'; echo '<OPTION VALUE="-1">clear all votes'; for ($i=1; $i<=5; $i++) { echo '<OPTION VALUE="' . $i . '">set to '.$i. "\n"; } echo '</SELECT><BR></TD></TR>'; echo '<tr bgcolor="#cccccc"><td colspan="2"></td></tr>'; echo '<TR valign="top"><TD align="right"><small>Your CVS username:<br></small></TD>' . '<TD><INPUT type="text" size="8" name="user" value="' . $user . '"><BR></TD></TR>'; echo '<TR valign="top"><TD align="right"><small>Your CVS password:<br></small></TD>' . '<TD><INPUT type="password" size="8" name="pass" value="' . $pass . '"><BR></TD></TR>'; echo '<TR valign="top"><TD align="right"><small>Remember me:<br></small></TD>' . '<TD><INPUT type="checkbox" name="saveme" checked value="1"><BR></TD></TR>'; echo '<TR><TD colspan="2"><INPUT type="submit" name="action" value="modify ' . $id . '"></TD></TR>'; echo "</TABLE></FORM>\n"; commonFooter(); exit; } else { echo "<P><B>Unable to find note for editing.</B></P>\n"; } break; case 'modify': $query = 'SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE id='.$id; if ($result = mysql_query($query)) { $row = mysql_fetch_array($result); } $add_url = "\n\nhttp://gtk.php.net/manual1/en/".$row['sect']."\n"; $query = "UPDATE note SET user='$nuser',note='$note'"; $rating = (int)$rating; if ($rating==-1) { $query .= ",votes=0,rating=0"; } else if ($rating > 0) { $query .= ",votes=10,rating=(10*".$rating.")"; } $query .= " WHERE id=$id"; if (mysql_query($query)) { echo "<P><B>Record modified.</B></P>"; mail($mailto, "note ".$row['id']." modified in ".$row['sect']." by $user",stripslashes($note).$add_url,"From: ".$user."@php.net"); } else { echo "<P><B>Record not modified (query failed).</B></P>"; } break; default: if (!empty($action)) { echo "<P><B>Didn't understand action '$action'.</B></P>"; } } // end of switch } // end of if($action != "") $MAGIC_COOKIE = 'temp'; include 'browse.php'; commonFooter(); ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/browse-notes.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/browse-notes.php +++ php-gtk-web/manual1/browse-notes.php <?php require_once 'shared-manual1.inc'; /* if(!strstr($MYSITE,"www.php.net")) { Header("Location: http://www.php.net/manual/browse-notes.php"); exit; } */ commonHeader("Browse PHP-GTK 1 Manual Notes"); echo '<h1>Browse PHP-GTK 1 Manual Notes</h1>'; updateNotesVoting(); include 'browse.php'; commonFooter(); http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/browse.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/browse.php +++ php-gtk-web/manual1/browse.php <?php $query = "SELECT DISTINCT(LEFT(sect,1)) AS first FROM note ORDER BY first"; $result = mysql_query($query) or die(mysql_error()); $used = array(); $fl = ''; if ( mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { if (!$fl) { $fl = $row['first']; } $used[ $row['first'] ] = true; } } $links = array(); for($i=ord('a'); $i<=ord('z'); $i++ ) { $l = chr($i); if (isset($used[$l])) { $links[] = make_link($PHP_SELF.'?let='.$l, '<b>'.$l.'</b>' ); } else { $links[] = $l; } } $jumpbar = '<table border="0" cellpadding="4" cellspacing="0" width="100%">' . '<tr bgcolor="#d0d0d0" valign="top">' . '<td align="right" colspan="2"><small>Jump to: ' . join (' <font color="#999999">|</font> ', $links ) . '<br></small></td>' . "</tr>\n" . "</table><BR>\n\n"; echo $jumpbar; if(!$let) { $let = $fl; } echo '<table border="0" cellpadding="4" cellspacing="0" width="100%">'; $query = "SELECT *, UNIX_TIMESTAMP(ts) AS xwhen, IF(votes=0, 10, rating/votes) AS rate FROM note " . "WHERE sect LIKE '$let%' ORDER BY sect, rate DESC, id"; $result = mysql_query($query) or die(mysql_error()); $numrows = mysql_num_rows($result); if ( $numrows > 0) { $last = ''; while ($row = mysql_fetch_array($result)) { if ($row['sect'] != $last) { makeTitle( $row['sect'] ); $last = $row['sect']; } makeEntry($row); } } else if (!$fl) { echo '<TR><TD COLSPAN="2">No entries for any section</B>.<BR></TD></TR>'; } else { echo '<TR><TD COLSPAN="2">No entries for <B>'.$let.'</B>.<BR></TD></TR>'; } echo '</table>'; if ($numrows > 10 ) { echo $jumpbar; } ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/note.sql?view=markup&rev=1.1 Index: php-gtk-web/manual1/note.sql +++ php-gtk-web/manual1/note.sql # # Table structure for table 'note' # CREATE TABLE note ( id mediumint(9) NOT NULL auto_increment, sect varchar(80), user varchar(80), note text, ts datetime, status varchar(16), lang varchar(16), votes mediumint(9) DEFAULT '0' NOT NULL, rating mediumint(9) DEFAULT '0' NOT NULL, PRIMARY KEY (id), KEY sect (sect) ); http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/set-magic-cookie.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/set-magic-cookie.php +++ php-gtk-web/manual1/set-magic-cookie.php <!-- Uncomment this if we ever get cvs-auth access again. <? if (isset($user) && isset($pass)) { $MAGIC_COOKIE = base64_encode("$user:$pass"); # we set a cookie good for five years SetCookie('MAGIC_COOKIE', base64_encode("$user:$pass"), time()+(86400*365*5), '/' ); commonHeader('Magic Cookie'); echo '<h1>Magic Cookie</h1>'; echo "<P><b>Cookie set</b>.</P>"; } else { commonHeader('Magic Cookie'); echo '<h1>Magic Cookie</h1>'; } if (isset($MAGIC_COOKIE)) { list($user,$pass) = explode(":", base64_decode($MAGIC_COOKIE)); } ?> <form action="<?echo $PHP_SELF;?>" method="POST"> User: <input type=text name=user value="<?echo $user;?>"> <br> Pass: <input type=password name=pass value="<?echo $pass;?>"> <br> <input type="submit"> </form> <? commonFooter(); --> <?php header("Location: http://master.php.net/manage/users.php"); exit; ?> http://cvs.php.net/viewcvs.cgi/php-gtk-web/manual1/unset-magic-cookie.php?view=markup&rev=1.1 Index: php-gtk-web/manual1/unset-magic-cookie.php +++ php-gtk-web/manual1/unset-magic-cookie.php <?php SetCookie('MAGIC_COOKIE', '', 0, '/'); unset($MAGIC_COOKIE); commonHeader('Magic Cookie'); echo '<h1>Magic Cookie</h1>'; echo '<P><b>Cookie unset</b>.</P>'; commonFooter(); ?>
« previous php.gtk.webmaster (#2936) next »