for those purposes. This was clearly stated in the page you used to submit your note, please carefully re-read those instructions before submitting future contributions. Bug submissions and feature requests should be entered at . For documentation errors use the bug system, and classify the bug as "Documentation problem". Support and ways to find answers to your questions can be found at . Your note has been removed from the online manual.'; db_connect(); $action = (isset($_REQUEST['action']) ? preg_replace('/[^\w\d\s_]/', '', $_REQUEST['action']) : ''); $id = (isset($_REQUEST['id']) ? intval($_REQUEST['id']) : ''); /*------ BEGIN SEARCH ------*/ if (!$action) { head("user notes"); // someting done before ? if ($id) { $str = 'Note #' . $id . ' has been '; switch ($_GET['was']) { case 'delete' : case 'reject' : $str .= ($_GET['was'] == 'delete') ? 'deleted' : 'rejected'; $str .= ' and removed from the manual'; break; case 'edit' : $str .= ' edited'; break; case 'resetall' : $str .= ' reset to 0 votes.'; break; case 'resetup' : $str .= ' reset to 0 up votes.'; break; case 'resetdown' : $str .= ' reset to 0 down votes.'; break; case 'deletevotes' : $str = 'The selected votes have been deleted!'; // INTENTIONALLY missing the concat operator } echo $str . '
'; } if (isset($_REQUEST['keyword']) || isset($_REQUEST["view"])) { // Pagination start $page = isset($_REQUEST["page"]) ? intval($_REQUEST["page"]) : 0; $NextPage = isset($_REQUEST["page"]) ? intval($_REQUEST["page"]) : 0; $type = isset($_REQUEST["type"]) ? intval($_REQUEST["type"]) : 0; if($page < 0) { $page = 0; } if($NextPage < 0) { $NextPage = 0; } $limit = $page * 10; $page++; $limitVotes = $NextPage * 25; $NextPage++; $PrevPage = ($NextPage - 2) > -1 ? $NextPage - 2 : 0; // Pagination end if(isset($_REQUEST['keyword'])) { $query = new Query('SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, note.*, UNIX_TIMESTAMP(note.ts) AS ts '. 'FROM note '. 'LEFT JOIN(votes) ON (note.id = votes.note_id) '. 'WHERE '); if (is_numeric($_REQUEST['keyword'])) { $search_heading = 'Search results for #' . (int) $_REQUEST['keyword']; $query->add('note.id = ?', [$_REQUEST['keyword']]); } elseif (substr($_REQUEST['keyword'], 0, 5) == 'sect:') { $search_heading = 'Search results for ' . hsc($_REQUEST['keyword']) . ''; $section = str_replace('*', '%', substr($_REQUEST['keyword'], 5)); $query->add("note.sect LIKE ? GROUP BY note.id ORDER BY note.sect, note.ts LIMIT ?int, 10", [$section, $limit]); } else { $search_heading = 'Search results for ' . hsc($_REQUEST['keyword']) . ''; $query->add( "note.note LIKE ? GROUP BY note.id LIMIT ?int, 10", ['%' . $_REQUEST['keyword'] . '%', $limit]); } $result = db_query_safe($query->get()); } else { /* Added new voting information to be included in note from votes table. */ /* First notes */ if ($type == 1) { $search_heading = 'First notes'; $result = db_query_safe("SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, note.*, UNIX_TIMESTAMP(note.ts) AS ts ". "FROM note ". "LEFT JOIN(votes) ON (note.id = votes.note_id) ". "GROUP BY note.id ORDER BY note.id ASC LIMIT ?int, 10", [$limit]); /* Minor notes */ } else if ($type == 2) { $search_heading = 'Minor notes'; $result = db_query_safe("SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, note.*, UNIX_TIMESTAMP(note.ts) AS ts ". "FROM note ". "LEFT JOIN(votes) ON (note.id = votes.note_id) ". "GROUP BY note.id ORDER BY LENGTH(note.note) ASC LIMIT ?int, 10", [$limit]); /* Top rated notes */ } else if ($type == 3) { $search_heading = 'Top rated notes'; $result = db_query_safe("SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, ". "ROUND((SUM(votes.vote) / COUNT(votes.vote)) * 100) AS rate, ". "(SUM(votes.vote) - (COUNT(votes.vote) - SUM(votes.vote))) AS arating, ". "note.id, note.sect, note.user, note.note, UNIX_TIMESTAMP(note.ts) AS ts ". "FROM note ". "JOIN(votes) ON (note.id = votes.note_id) ". "GROUP BY note.id ORDER BY arating DESC, up DESC, rate DESC, down DESC LIMIT ?int, 10", [$limit]); /* Bottom rated notes */ } else if ($type == 4) { $search_heading = 'Bottom rated notes'; $result = db_query_safe("SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, ". "ROUND((SUM(votes.vote) / COUNT(votes.vote)) * 100) AS rate, ". "(SUM(votes.vote) - (COUNT(votes.vote) - SUM(votes.vote))) AS arating, ". "note.id, note.sect, note.user, note.note, UNIX_TIMESTAMP(note.ts) AS ts ". "FROM note ". "JOIN(votes) ON (note.id = votes.note_id) ". "GROUP BY note.id ORDER BY arating ASC, up ASC, rate ASC, down DESC LIMIT ?int, 10", [$limit]); /* Votes table view */ } else if ($type == 5) { $search_votes = true; // set this only to change the output between votes table and notes table if (!empty($_GET['votessearch'])) { if (($iprange = wildcard_ip($_GET['votessearch'])) !== false) { $search = html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'); $start = $iprange[0]; $end = $iprange[1]; $resultCount = db_query_safe("SELECT count(votes.id) AS total_votes FROM votes JOIN (note) ON (votes.note_id = note.id) WHERE ". "(hostip >= ? AND hostip <= ?) OR (ip >= ? AND ip <= ?)", [$start, $end, $start, $end]); $resultCount = mysql_fetch_assoc($resultCount); $resultCount = $resultCount['total_votes']; $isSearch = '&votessearch=' . hsc($search); $result = db_query_safe( 'SELECT votes.id, UNIX_TIMESTAMP(votes.ts) AS ts, votes.vote, votes.note_id, note.sect, votes.hostip, votes.ip '. 'FROM votes JOIN(note) ON (votes.note_id = note.id) '. 'WHERE (hostip >= ? AND hostip <= ?) OR (ip >= ? AND ip <= ?) '. 'ORDER BY votes.id DESC LIMIT ?int, 25', [$start, $end, $start, $end, $limitVotes]); } elseif (filter_var(html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'), FILTER_VALIDATE_IP)) { $searchip = (int) ip2long(filter_var(html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'), FILTER_VALIDATE_IP)); $resultCount = db_query_safe("SELECT count(votes.id) AS total_votes FROM votes JOIN(note) ON (votes.note_id = note.id) WHERE hostip = ? OR ip = ?", [$searchip, $searchip]); $resultCount = mysql_fetch_assoc($resultCount); $resultCount = $resultCount['total_votes']; $isSearch = '&votessearch=' . hsc(long2ip($searchip)); $result = db_query_safe( "SELECT votes.id, UNIX_TIMESTAMP(votes.ts) AS ts, votes.vote, votes.note_id, note.sect, votes.hostip, votes.ip ". "FROM votes JOIN(note) ON (votes.note_id = note.id) ". "WHERE hostip = ? OR ip = ? ". "ORDER BY votes.id DESC LIMIT ?int, 25", [$searchip, $searchip, $limitVotes]); } else { $search = (int) html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'); $resultCount = db_query_safe("SELECT count(votes.id) AS total_votes FROM votes JOIN(note) ON (votes.note_id = note.id) WHERE votes.note_id = ?", [$search]); $resultCount = mysql_fetch_assoc($resultCount); $resultCount = $resultCount['total_votes']; $isSearch = '&votessearch=' . hsc($search); $result = db_query_safe( "SELECT votes.id, UNIX_TIMESTAMP(votes.ts) AS ts, votes.vote, votes.note_id, note.sect, votes.hostip, votes.ip ". "FROM votes JOIN(note) ON (votes.note_id = note.id) ". "WHERE votes.note_id = ? ". "ORDER BY votes.id DESC LIMIT ?int, 25", [$search, $limitVotes]); } } else { $isSearch = null; $resultCount = db_query_safe("SELECT COUNT(votes.id) AS total_votes FROM votes JOIN(note) ON (votes.note_id = note.id)"); $resultCount = mysql_fetch_assoc($resultCount); $resultCount = $resultCount['total_votes']; $result = db_query_safe( "SELECT votes.id, UNIX_TIMESTAMP(votes.ts) AS ts, votes.vote, votes.note_id, note.sect, votes.hostip, votes.ip ". "FROM votes JOIN(note) ON (votes.note_id = note.id) ". "ORDER BY votes.id DESC LIMIT ?int, 25", [$limitVotes]); } /* IPs with the most votes -- aggregated data */ } elseif ($type == 6) { $votes_by_ip = true; // only set this get the table for top IPs with votes $result = db_query_safe( "SELECT DISTINCT(votes.ip), COUNT(votes.ip) as votes, COUNT(DISTINCT(votes.note_id)) as notes, ". "INET_NTOA(votes.ip) AS ip, MIN(UNIX_TIMESTAMP(votes.ts)) AS `from`, MAX(UNIX_TIMESTAMP(votes.ts)) AS `to` ". "FROM votes ". "JOIN (note) ON (votes.note_id = note.id) GROUP BY votes.ip ORDER BY votes DESC LIMIT 100"); /* Last notes */ } else { $search_heading = 'Last notes'; $result = db_query_safe( "SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, note.*, UNIX_TIMESTAMP(note.ts) AS ts ". "FROM note LEFT JOIN(votes) ON (note.id = votes.note_id) ". "GROUP BY note.id ORDER BY note.id DESC LIMIT ?int, 10", [$limit]); } } if ($result) { /* This is a special table only used for viewing the most recent votes */ $t = (isset($_GET['type']) ? '&type=' . $_GET['type'] : null); if (!empty($search_votes)) { $from = $limitVotes + 1; $to = $NextPage * 25; $to = $to > $resultCount ? $resultCount : $to; if ($resultCount) { echo "

Showing $from - $to of $resultCount results.

"; echo "
". "". " ". " \n". " \n". " \n". " \n". " \n". " \n". " \n". " \n"; } else { echo "

No results found...

"; } } /* This is a special table only used for viewing top IPs by votes */ if (!empty($votes_by_ip)) { echo "". "
Most Recent Votes
Date Vote Note ID Note Section Host IP Client IP
". " ". " \n". " \n". " \n". " \n". " \n". " \n". " \n". " \n"; } if (!empty($search_heading)) { echo "

$search_heading

"; } while ($row = mysql_fetch_assoc($result)) { /* I had to do this because the JOIN queries will return a single row of NULL values even when no rows match. So the `if (mysql_num_rows($result))` check earlier becomes useless and as such I had to replace it with this. */ if (mysql_num_rows($result) == 1 && !array_filter($row)) { echo "

No results found...

"; continue; } $id = isset($row['id']) ? $row['id'] : null; /* This div is only available in cases where the query includes the voting info */ if (isset($row['up']) && isset($row['down'])) { $rating = isset($row['arating']) ? $row['arating'] : ($row['up'] - $row['down']); if ($rating < 0) { $rating = "$rating"; } elseif ($rating > 0) { $rating = "$rating"; } else { $rating = "$rating"; } if (isset($row['rate'])) { // not all queries select the rate $percentage = $row['rate']; } else { if ($row['up'] + $row['down']) { // prevents division by zero warning $percentage = round(($row['up'] / ($row['up'] +$row['down'])) * 100); } else { $precentage = 0; } } $percentage = sprintf('%d%%', $percentage); echo "
\n". "
Up votes: {$row['up']}
\n". "
Down votes: {$row['down']}
\n". "
Rating: $rating ($percentage like this)
\n". "
\n". " Reset all votes |". " Reset up votes |". " Reset down votes |". " See Votes\n". "
\n". "
\n"; } /* This is a special table only used for viewing the most recent votes */ if (!empty($search_votes)) { $row['ts'] = date('Y-m-d H:i:s', $row['ts']); $row['vote'] = '+1' : 'red;">-1') . ''; $row['hostip'] = long2ip($row['hostip']); $row['ip'] = long2ip($row['ip']); $notelink = "http://php.net/{$row['sect']}#{$row['note_id']}"; $sectlink = "http://php.net/{$row['sect']}"; echo " \n". " \n". " \n". " \n". " \n". " \n". " \n". " \n". " \n"; /* This is a special table only used for viewing top IPs by votes */ } elseif(!empty($votes_by_ip)) { $from = date('Y-m-d H:i:s', $row['from']); $to = date('Y-m-d H:i:s', $row['to']); $ip = hsc($row['ip']); echo " \n". " \n". " \n". " \n". " \n". " \n". " \n"; /* Everything else in search should fall through here */ } else { echo "

",clean_note($row['note']), "
",date("d-M-Y h:i",$row['ts'])," ", hsc($row['user']),"
", "Note id: $id
\n", "http://php.net/manual/en/{$row['sect']}.php#{$id}
\n", "Edit Note
"; foreach ($note_del_reasons AS $reason => $text) { echo '', 'Delete Note: ', hsc($text), "
\n"; } echo "Delete Note: other reason
", "Reject Note", "

", "
"; } } /* This is a special table only used for viewing the most recent votes */ if (!empty($search_votes)) { if ($resultCount) { echo " \n". "
IPs With Most Votes
Client IP Address Number of Votes Number of Notes First Vote Cast Last Vote Cast
{$row['ts']}{$row['vote']}{$row['note_id']}{$row['sect']}{$row['hostip']}{$row['ip']}
$ip{$row['votes']}{$row['notes']}{$from}{$to}
\n". "\n". "". "
\n"; } echo "
\n". " Search for votes by IP address or Note ID - (wild card searches are allowed e.g. 127.0.0.*): ". " \n". "\n". "\n". "
\n"; } /* This is a special table only used for viewing top IPs by votes */ if (!empty($votes_by_ip)) { echo " \n". "\n". "

This information should only be used to determine if there are any IP addresses with an unusually high ". "number of votes placed in a small timeframe to help detect spam and other potential abuse.

\n". "

Also note that a 0.0.0.0 IP address indicates a client IP could not be resolved at the time of voting.

"; } if((isset($_REQUEST["view"]) || isset($_REQUEST['keyword'])) && empty($search_votes)) { $keyword = isset($_REQUEST['keyword']) ? '&keyword=' . urlencode($_REQUEST['keyword']) : ''; echo "

Next 10"; } elseif (isset($_REQUEST["view"]) && !empty($search_votes)) { echo "

"; if (isset($NextPage) && $NextPage > 1) { echo "< Prev 25 "; } if (isset($to) && isset($resultCount) && $to < $resultCount) { echo " Next 25 >"; } echo "

"; } } } ?>

Menu

Mass change of sections

View last 10 notes

View first 10 notes

View minor 10 notes

View top 10 rated notes

View bottom 10 rated notes

View votes table

IPs with the most votes

Search notes within a section

User contributed voting statistics

add("sect = ?", [$_REQUEST["old_sect"]]); } if (!empty($_REQUEST["ids"])) { if (preg_match('~^([0-9]+, *)*[0-9]+$~i', $_REQUEST["ids"])) { if ($where->get() !== '') { $where->add(' AND '); } // Safe because we checked that ids is a comma-separated list of numbers. $where->add("id IN (".$_REQUEST['ids'].")"); } else { echo "

Incorrect format of notes IDs.

\n"; $step = 0; } } if ($step == 2) { $query = new Query('UPDATE note SET sect = ? WHERE ', [$_REQUEST["new_sect"]]); $query->addQuery($where); db_query($query); echo "

Mass change succeeded.

\n"; } elseif ($step == 1) { if (!empty($_REQUEST["new_sect"]) && $where) { $query = new Query('SELECT COUNT(*) FROM note WHERE '); $query->addQuery($where); $result = db_query($query); if (!($count = mysql_result($result, 0, 0))) { echo "

There are no such notes.

\n"; } else { $step = 2; $msg = "Are you sure to change section of $count note(s)"; $msg .= (!empty($_REQUEST["ids"]) ? " with IDs " . hsc($_REQUEST['ids']) . "" : ""); $msg .= (!empty($_REQUEST["old_sect"]) ? " from section " . hsc($_REQUEST['old_sect']) . "" : ""); $msg .= " to section " . hsc($_REQUEST['new_sect']) . "?"; echo "

$msg

\n"; ?>
"> "> ">
You have to fill-in new section.

\n"; } if (!$where) { echo "

You have to fill-in curent section or notes IDs (or both).

\n"; } } } if ($step < 2) { ?>

Change section of notes which fit these criteria:

Current section: " size="30" maxlength="80" /> (filename without extension)
Notes IDs: " size="30" maxlength="80" /> (comma separated list)
Move to section: " size="30" maxlength="80" />
Back to notes index

\n"; foot(); exit; case 'approve': if ($id) { if ($row = note_get_by_id($id)) { if ($row['status'] != 'na') { die ("Note #$id has already been approved"); } if ($row['id'] && db_query_safe("UPDATE note SET status=NULL WHERE id=?", [$id])) { note_mail_on_action( $cuser, $id, "note {$row['id']} approved from {$row['sect']} by $cuser", "This note has been approved and will appear in the manual.\n\n----\n\n{$row['note']}" ); } print "Note #$id has been approved and will appear in the manual"; exit; } } case 'reject': case 'delete': if ($id) { if ($row = note_get_by_id($id)) { if ($row['id'] && db_query_safe("DELETE note,votes FROM note LEFT JOIN (votes) ON (note.id = votes.note_id) WHERE note.id = ?", [$id])) { $action_taken = ($action == "reject" ? "rejected" : "deleted"); note_mail_on_action( $cuser, $id, "note {$row['id']} $action_taken from {$row['sect']} by $cuser", "Note Submitter: " . safe_email($row['user']) . (isset($reason) ? "\nReason: $reason" : " ") . "\n\n----\n\n{$row['note']}"); if ($action == 'reject') { note_mail_user($row['user'], "note $row[id] rejected and deleted from $row[sect] by notes editor $cuser",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); } } //if we came from an email, report _something_ if (isset($_GET['report'])) { header('Location: user-notes.php?id=' . $id . '&was=' . $action); exit; } else { //if not, just close the window echo ''; } exit; } } /* falls through, with id not set. */ case 'preview': case 'edit': if ($id) { $note = (isset($_POST['note']) ? $_POST['note'] : null); if (!isset($note) || $action == 'preview') { head("user notes"); } $row = note_get_by_id($id); $email = (isset($_POST['email']) ? html_entity_decode($_POST['email'],ENT_QUOTES) : $row['user']); $sect = (isset($_POST['sect']) ? html_entity_decode($_POST['sect'],ENT_QUOTES) : $row['sect']); if (isset($note) && $action == "edit") { if (db_query_safe('UPDATE note SET note=?,user=?,sect=?,updated=NOW() WHERE id=?', [html_entity_decode($note,ENT_QUOTES), $email, $sect, $id])) { note_mail_on_action( $cuser, $id, "note {$row['id']} modified in {$row['sect']} by $cuser", $note."\n\n--was--\n{$row['note']}\n\nhttp://php.net/manual/en/{$row['sect']}.php" ); if ($row["sect"] != $sect) { note_mail_user($email, "note $id moved from $row[sect] to $sect by notes editor $cuser", "----- Copy of your note below -----\n\n".$note); } header('Location: user-notes.php?id=' . $id . '&was=' . $action); exit; } } $note = isset($note) ? $note : $row['note']; if ($action == "preview") { echo "

",clean_note($note), "
",date("d-M-Y h:i",$row['ts'])," ", hsc($email),"

"; } ?>
Section:
email:
No votes exist for Note ID ". hsc($id) ."!

"; } else { if ($action == 'resetall' && isset($_POST['resetall'])) { db_query_safe('DELETE FROM votes WHERE votes.note_id = ?', [$id]); /* 1 for up votes */ } elseif ($action == 'resetup' && isset($_POST['resetup'])) { db_query_safe('DELETE FROM votes WHERE votes.note_id = ? AND votes.vote = 1', [$id]); /* 0 for down votes */ } elseif ($action == 'resetdown' && isset($_POST['resetdown'])) { db_query_safe('DELETE FROM votes WHERE votes.note_id = ? AND votes.vote = 0', [$id]); } header('Location: user-notes.php?id=' . urlencode($id) . '&was=' . urlencode($action)); } } else { $sql = 'SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down, note.*, UNIX_TIMESTAMP(note.ts) AS ts '. 'FROM note '. 'JOIN(votes) ON (note.id = votes.note_id) '. 'WHERE note.id = ?'; $result = db_query_safe($sql, [$id]); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $out = "

\nAre you sure you want to reset all votes for Note #". hsc($row['id']) ."? "; if ($action == 'resetall') { $out .= "This will permanently delete all ". hsc($row['up']) ." up votes and ". hsc($row['down']) ." down votes for this note.\n

\n". "
\n". " \n". "
\n"; } elseif ($action == 'resetup') { $out .= "This will permanently delete all ". hsc($row['up']) ." up votes for this note.\n

\n". "
\n". " \n". "
\n"; } elseif ($action == 'resetdown') { $out .= "This will permanently delete all ". hsc($row['down']) ." down votes for this note.\n

\n". "
\n". " \n". "
\n"; } echo $out; } else { echo "

Note ". hsc($id) ." does not exist!

"; } } } else { echo "

Note id not supplied...

"; } foot(); exit; case 'deletevotes': /* Only those with privileges in allow_mass_change may use these options */ if (!allow_mass_change($cuser)) { die("You do not have access to use this feature!"); } /* Delete votes -- effectively deletes votes found in the votes table matching all supplied ids */ if (empty($_POST['deletevote']) || !is_array($_POST['deletevote'])) { die("No vote ids supplied!"); } $ids = []; foreach ($_POST['deletevote'] as $id) { $ids[] = (int) $id; } $ids = implode(',',$ids); // This is safe, because $ids is an array of integers. if (db_query_safe("DELETE FROM votes WHERE id IN ($ids)")) { header('Location: user-notes.php?id=1&view=notes&was=' . urlencode($action) . (isset($_REQUEST['type']) ? ('&type=' . urlencode($_REQUEST['type'])) : null) . (isset($_REQUEST['votessearch']) ? '&votessearch=' . urlencode($_REQUEST['votessearch']) : null) ); } exit; case 'sect': head('user notes'); ?>

Search within a section

You can search notes within specified section of the PHP manual using form below or by prepending your query with sect: in regular search form (like sect:book.mysql).

You can use * as a wildcard, like mysql.*. Query like function.json-* should show all notes for JSON functions (use sect:function.json-* in case of generic form).

Section:
= ?', [$today]); $stats_sql['This Week'] = new Query('SELECT COUNT(votes.id) AS total FROM votes WHERE UNIX_TIMESTAMP(votes.ts) >= ?', [$week]); $stats_sql['This Month'] = new Query('SELECT COUNT(votes.id) AS total FROM votes WHERE UNIX_TIMESTAMP(votes.ts) >= ?', [$month]); $stats_sql['Yesterday'] = new Query('SELECT COUNT(votes.id) AS total FROM votes WHERE UNIX_TIMESTAMP(votes.ts) >= ? AND UNIX_TIMESTAMP(votes.ts) < ?', [$yesterday, $today]); $stats_sql['Last Week'] = new Query('SELECT COUNT(votes.id) AS total FROM votes WHERE UNIX_TIMESTAMP(votes.ts) >= ? AND UNIX_TIMESTAMP(votes.ts) < ?', [$lastweek, $week]); $stats_sql['Last Month'] = new Query('SELECT COUNT(votes.id) AS total FROM votes WHERE UNIX_TIMESTAMP(votes.ts) >= ? AND UNIX_TIMESTAMP(votes.ts) < ?', [$lastmonth, $month]); foreach ($stats_sql as $key => $query) { $result = db_query($query); $row = mysql_fetch_assoc($result); $stats[$key] = $row['total']; } ?>

User contributed voting statistics

$stat) { ?>
:

 

Go back to the notes management

'$action' is not a recognized action, or no id was specified.

"; foot(); } // ---------------------------------------------------------------------------------- // Use class names instead of colors ini_set('highlight.comment', 'comment'); ini_set('highlight.default', 'default'); ini_set('highlight.keyword', 'keyword'); ini_set('highlight.string', 'string'); ini_set('highlight.html', 'html'); // Copied over from phpweb (should be syncronised if changed) function clean_note($text) { // Highlight PHP source $text = highlight_php(trim($text), TRUE); // Turn urls into links $text = preg_replace( '!((mailto:|(http|ftp|nntp|news):\/\/).*?)(\s|<|\)|"|\\|\'|$)!', '\1\4', $text ); return $text; } // Highlight PHP code function highlight_php($code, $return = FALSE) { // Using OB, as highlight_string() only supports // returning the result from 4.2.0 ob_start(); highlight_string($code); $highlighted = ob_get_contents(); ob_end_clean(); // Fix output to use CSS classes and wrap well $highlighted = '
' . str_replace( [ ' ', '
', '\n", ''; if ($return) { return $highlighted; } else { echo $highlighted; } } // Send out a mail to the note submitter, with an envelope sender ignoring bounces function note_mail_user($mailto, $subject, $message) { $mailto = clean_antispam($mailto); if (is_emailable_address($mailto)) { mail( $mailto, $subject, $message, "From: ". NOTES_MAIL, "-fbounces-ignored@php.net -O DeliveryMode=b" ); } } // Return data about a note by its ID function note_get_by_id($id) { if ($result = db_query_safe('SELECT *, UNIX_TIMESTAMP(ts) AS ts FROM note WHERE id=?', [$id])) { if (!mysql_num_rows($result)) { die("Note #$id doesn't exist. It has probably been deleted/rejected already."); } return mysql_fetch_assoc($result); } return FALSE; } // Sends out a notification to the mailing list when // some action is performed on a user note. function note_mail_on_action($user, $id, $subject, $body) { mail(NOTES_MAIL, $subject, $body, "From: $user@php.net\r\nIn-Reply-To: ", "-f{$user}@php.net"); } // Allow some users to mass change IDs in the manual function allow_mass_change($user) { if (in_array( $user, [ "vrana", "goba", "nlopess", "didou", "bjori", "philip", "bobby", "danbrown", "mgdm", "googleguy", "levim", ] ) ) { return TRUE; } else { return FALSE; } } // Return safe to print version of email address function safe_email($mail) { if (in_array($mail, ["php-general@lists.php.net", "user@example.com"])) { return ''; } elseif (preg_match("!(.+)@(.+)\.(.+)!", $mail)) { return str_replace(['@', '.'], [' at ', ' dot '], $mail); } return $mail; } // Return a valid IPv4 range (as 0-indexed two element array) based on wildcard IP string function wildcard_ip($ip) { $start = explode(".", $ip); if (count($start) != 4) { return false; } foreach ($start as $part) { if ($part === "*") { continue; } if ($part > 255 || $part < 0 || !is_numeric($part)) { return false; } } $end = []; foreach (array_keys($start, "*", true) as $key) { $start[$key] = "0"; $end[$key] = "255"; } foreach ($start as $key => $part) { if (!isset($end[$key])) { $end[$key] = $start[$key]; } } ksort($end); $start = ip2long(implode('.',$start)); $end = ip2long(implode('.',$end)); if ($end - $start <= 0) { return false; } return [$start, $end]; }