From 409a3b9b23f2797b4e0420bcb06488a68ccd5962 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 26 Feb 2012 15:24:37 +0000 Subject: [PATCH 1/4] network logging, for irccat --- .gitignore | 1 + contrib/log_net/main.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 contrib/log_net/main.php diff --git a/.gitignore b/.gitignore index b4ced277..fdcffdfa 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ ext/image_hash_ban ext/ipban ext/link_image ext/log_db +ext/log_net ext/mass_tagger ext/news ext/notes diff --git a/contrib/log_net/main.php b/contrib/log_net/main.php new file mode 100644 index 00000000..a35ea54a --- /dev/null +++ b/contrib/log_net/main.php @@ -0,0 +1,21 @@ + + * Link: http://code.shishnet.org/shimmie2/ + * Description: Send log events to a network port. + * Visibility: admin + */ + +class LogNet extends Extension { + public function onLog(LogEvent $event) { + global $user; + + if($event->priority > 10) { + $username = ($user && $user->name) ? $user->name : "Anonymous"; + $str = sprintf("%2d %15s (%s): %s - %s", $event->priority, $_SERVER['REMOTE_ADDR'], $username, $event->section, $event->message); + system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); + } + } +} +?> From 8f4992255632dfba0e04218cb36611d94c5d91b3 Mon Sep 17 00:00:00 2001 From: Justin Brewer Date: Mon, 27 Feb 2012 17:37:09 -0600 Subject: [PATCH 2/4] Fixed Popular Tags List All the links pointed to /post/list/$link --- ext/tag_list/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 59f7c556..a0684041 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -89,7 +89,7 @@ class TagListTheme extends Themelet { $html .= ' ?'; } $link = $this->tag_link($row['tag']); - $html .= ' '.$h_tag_no_underscores.''; + $html .= ' '.$h_tag_no_underscores.''; if($tag_list_num) { $html .= ' '.$count.''; } From af33a36c89d832e66b22ae12f7c8fcd8ed83a7fe Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Wed, 29 Feb 2012 14:56:05 -0500 Subject: [PATCH 3/4] Typo in SQL --- contrib/bookmarks/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bookmarks/main.php b/contrib/bookmarks/main.php index ea983689..381ab7da 100644 --- a/contrib/bookmarks/main.php +++ b/contrib/bookmarks/main.php @@ -41,7 +41,7 @@ class Bookmarks extends Extension { id SCORE_AIPK, owner_id INTEGER NOT NULL, url TEXT NOT NULL, - title TET NOT NULL, + title TEXT NOT NULL, INDEX (owner_id), FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE "); From 9ac45f5363f581388468673e91890b3c36a072ac Mon Sep 17 00:00:00 2001 From: Justin Brewer Date: Fri, 2 Mar 2012 10:17:13 -0600 Subject: [PATCH 4/4] Regex for PDO DSN Old regex matched ADOdb URI. Also, this regex allows the user, pass, host and database information to appear in any order. --- contrib/admin/main.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/admin/main.php b/contrib/admin/main.php index f4a78545..7e746eb3 100644 --- a/contrib/admin/main.php +++ b/contrib/admin/main.php @@ -139,12 +139,12 @@ class AdminPage extends Extension { private function dbdump(Page $page) { $matches = array(); - preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches); - $software = $matches[1]; - $username = $matches[2]; - $password = $matches[3]; - $hostname = $matches[4]; - $database = $matches[5]; + preg_match("#^(?P\w+)\:(?:user=(?P\w+)(?:;|$)|password=(?P\w+)(?:;|$)|host=(?P[\w\.\-]+)(?:;|$)|dbname=(?P[\w_]+)(?:;|$))+#", DATABASE_DSN, $matches); + $software = $matches['proto']; + $username = $matches['user']; + $password = $matches['password']; + $hostname = $matches['host']; + $database = $matches['dbname']; // TODO: Support more than just MySQL.. switch($software) {