Merge branch 'master' of github.com:shish/shimmie2

This commit is contained in:
Shish 2012-03-02 17:42:11 +00:00
commit 8bab5b1c0a
5 changed files with 30 additions and 8 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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<proto>\w+)\:(?:user=(?P<user>\w+)(?:;|$)|password=(?P<password>\w+)(?:;|$)|host=(?P<host>[\w\.\-]+)(?:;|$)|dbname=(?P<dbname>[\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) {

View File

@ -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
");

21
contrib/log_net/main.php Normal file
View File

@ -0,0 +1,21 @@
<?php
/*
* Name: Logging (Network)
* Author: Shish <webmaster@shishnet.org>
* 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");
}
}
}
?>

View File

@ -89,7 +89,7 @@ class TagListTheme extends Themelet {
$html .= ' <a class="tag_info_link" href="'.$link.'">?</a>';
}
$link = $this->tag_link($row['tag']);
$html .= ' <a class="tag_name" href="$link">'.$h_tag_no_underscores.'</a>';
$html .= ' <a class="tag_name" href="'.$link.'">'.$h_tag_no_underscores.'</a>';
if($tag_list_num) {
$html .= ' <span class="tag_count">'.$count.'</span>';
}