diff --git a/.gitignore b/.gitignore index b1d70c05..e0874880 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ sql.log shimmie.log !lib/images ext/admin +ext/amazon_s3 ext/artists ext/autocomplete ext/ban_words @@ -28,6 +29,7 @@ ext/handle_flash ext/handle_ico ext/handle_mp3 ext/handle_svg +ext/holiday ext/home ext/image_hash_ban ext/ipban @@ -36,6 +38,7 @@ ext/log_db ext/news ext/notes ext/numeric_score +ext/oekaki ext/piclens ext/pm ext/pools @@ -44,6 +47,7 @@ ext/random_image ext/rating ext/regen_thumb ext/report_image +ext/resize ext/res_limit ext/rss_comments ext/rss_images @@ -56,7 +60,7 @@ ext/tagger ext/tag_history ext/text_score ext/tips -ext/amazon_s3 +ext/twitter_soc ext/upload_cmd ext/wiki ext/word_filter diff --git a/README.txt b/README.txt index 97d8955a..622d90a9 100644 --- a/README.txt +++ b/README.txt @@ -40,10 +40,10 @@ Installation Upgrade from 2.3.X ~~~~~~~~~~~~~~~~~~ The database connection setting in config.php has changed; now using -PDO DSN format [1] rather than ADODB URI [2] +PDO DSN format rather than ADODB URI: - [1] :user=;password=;host=;dbname= - [2] ://:@/ + OLD: $database_dsn = "://:@/"; + NEW: define("DATABASE_DSN", ":user=;password=;host=;dbname="); The rest should be automatic, just unzip into a clean folder and copy across config.php, images and thumbs folders from the old version. This diff --git a/contrib/admin/theme.php b/contrib/admin/theme.php index 038b9be7..18cc9687 100644 --- a/contrib/admin/theme.php +++ b/contrib/admin/theme.php @@ -35,14 +35,15 @@ class AdminPageTheme extends Themelet { /* First check Requires you to click the checkbox to enable the delete by query form */ - $dbqcheck = " - if(document.getElementById("dbqcheck").checked == false){ - document.getElementById("dbqtags").disabled = true; - document.getElementById("dbqsubmit").disabled = true; + $dbqcheck = 'javascript:$(function() { + if($("#dbqcheck:checked").length != 0){ + $("#dbqtags").attr("disabled", false); + $("#dbqsubmit").attr("disabled", false); }else{ - document.getElementById("dbqtags").disabled = false; - document.getElementById("dbqsubmit").disabled = false; - }"; + $("#dbqtags").attr("disabled", true); + $("#dbqsubmit").attr("disabled", true); + } + });'; /* Second check Requires you to confirm the deletion by clicking ok. */ @@ -52,7 +53,7 @@ class AdminPageTheme extends Themelet { if(confirm('Are you sure you wish to delete all images using these tags?')){ return true; }else{ - return false; + return false; } } " diff --git a/contrib/artists/main.php b/contrib/artists/main.php index f035224a..ada1b4e5 100644 --- a/contrib/artists/main.php +++ b/contrib/artists/main.php @@ -43,6 +43,14 @@ class Artists implements Extension { if ($event instanceof PageRequestEvent) $this->handle_commands($event); + + if ($event instanceof SearchTermParseEvent) { + $matches = array(); + if(preg_match("/^author=(.*)$/", $event->term, $matches)) { + $char = $matches[1]; + $event->add_querylet(new Querylet("Author = :author_char", array("author_char"=>$char))); + } + } } public function try_install() { @@ -131,7 +139,7 @@ class Artists implements Extension { $database->execute("UPDATE images SET author = ? WHERE id = ?" , array( - mysql_real_escape_string($artistName) + $artistName , $event->image->id )); } @@ -434,7 +442,7 @@ class Artists implements Extension { { global $database; - $result = $database->get_one("SELECT COUNT(1) FROM artist_urls WHERE url = ?", array(mysql_real_escape_string($url))); + $result = $database->get_one("SELECT COUNT(1) FROM artist_urls WHERE url = ?", array($url)); return ($result != 0); } @@ -442,7 +450,7 @@ class Artists implements Extension { { global $database; - $result = $database->get_one("SELECT COUNT(1) FROM artist_members WHERE name = ?", array(mysql_real_escape_string($member))); + $result = $database->get_one("SELECT COUNT(1) FROM artist_members WHERE name = ?", array($member)); return ($result != 0); } @@ -450,7 +458,7 @@ class Artists implements Extension { { global $database; - $result = $database->get_one("SELECT COUNT(1) FROM artist_alias WHERE alias = ?", array(mysql_real_escape_string($alias))); + $result = $database->get_one("SELECT COUNT(1) FROM artist_alias WHERE alias = ?", array($alias)); return ($result != 0); } @@ -461,7 +469,7 @@ class Artists implements Extension { $result = $database->get_one("SELECT COUNT(1) FROM artist_alias WHERE artist_id = ? AND alias = ?", array( $artistID - , mysql_real_escape_string($alias) + , $alias )); return ($result != 0); } @@ -469,14 +477,14 @@ class Artists implements Extension { private function get_artistID_by_url($url) { global $database; - $result = $database->get_row("SELECT artist_id FROM artist_urls WHERE url = ?", array(mysql_real_escape_string($url))); + $result = $database->get_row("SELECT artist_id FROM artist_urls WHERE url = ?", array($url)); return $result['artist_id']; } private function get_artistID_by_memberName($member) { global $database; - $result = $database->get_row("SELECT artist_id FROM artist_members WHERE name = ?", array(mysql_real_escape_string($member))); + $result = $database->get_row("SELECT artist_id FROM artist_members WHERE name = ?", array($member)); return $result['artist_id']; } private function get_artistName_by_artistID($artistID) @@ -623,8 +631,8 @@ class Artists implements Extension { global $database; $database->execute("UPDATE artists SET name = ?, notes = ?, updated = now(), user_id = ? WHERE id = ? " , array( - mysql_real_escape_string($name) - , mysql_real_escape_string($notes) + $name + , $notes , $userID , $artistID )); @@ -719,7 +727,7 @@ class Artists implements Extension { global $database; $database->execute("UPDATE artist_alias SET alias = ?, updated = now(), user_id = ? WHERE id = ? " , array( - mysql_real_escape_string($alias) + $alias , $userID , $aliasID )); @@ -748,7 +756,7 @@ class Artists implements Extension { global $database; $database->execute("UPDATE artist_urls SET url = ?, updated = now(), user_id = ? WHERE id = ?" , array( - mysql_real_escape_string($url) + $url , $userID , $urlID )); @@ -778,7 +786,7 @@ class Artists implements Extension { $database->execute("UPDATE artist_members SET name = ?, updated = now(), user_id = ? WHERE id = ?" , array( - mysql_real_escape_string($memberName) + $memberName , $userID , $memberID )); @@ -855,8 +863,8 @@ class Artists implements Extension { (?, ?, ?, now(), now())", array( $user->id - , mysql_real_escape_string($name) - , mysql_real_escape_string($notes) + , $name + , $notes )); $result = $database->get_row("SELECT LAST_INSERT_ID() AS artistID", array()); @@ -872,7 +880,7 @@ class Artists implements Extension { $result = $database->get_one("SELECT COUNT(1) FROM artists WHERE name = ?" , array( - mysql_real_escape_string($name) + $name )); return ($result != 0); } @@ -938,7 +946,7 @@ class Artists implements Extension { global $database; $artistID = $database->get_row("SELECT id FROM artists WHERE name = ?" , array( - mysql_real_escape_string($name) + $name )); return $artistID['id']; } @@ -949,7 +957,7 @@ class Artists implements Extension { $artistID = $database->get_row("SELECT artist_id FROM artist_alias WHERE alias = ?" , array( - mysql_real_escape_string($alias) + $alias )); return $artistID["artist_id"]; } @@ -1092,7 +1100,7 @@ class Artists implements Extension { $database->execute("INSERT INTO artist_urls (artist_id, created, updated, url, user_id) VALUES (?, now(), now(), ?, ?)" , array( $artistID - , mysql_real_escape_string($url) + , $url , $userID )); } @@ -1126,7 +1134,7 @@ class Artists implements Extension { $database->execute("INSERT INTO artist_alias (artist_id, created, updated, alias, user_id) VALUES (?, now(), now(), ?, ?)" , array( $artistID - , mysql_real_escape_string($alias) + , $alias , $userID )); } @@ -1159,7 +1167,7 @@ class Artists implements Extension { $database->execute("INSERT INTO artist_members (artist_id, name, created, updated, user_id) VALUES (?, ?, now(), now(), ?)" , array( $artistID - , mysql_real_escape_string($member) + , $member , $userID )); } @@ -1173,7 +1181,7 @@ class Artists implements Extension { $result = $database->get_one("SELECT COUNT(1) FROM artist_members WHERE artist_id = ? AND name = ?" , array( $artistID - , mysql_real_escape_string($member) + , $member )); return ($result != 0); } @@ -1187,7 +1195,7 @@ class Artists implements Extension { $result = $database->get_one("SELECT COUNT(1) FROM artist_urls WHERE artist_id = ? AND url = ?" , array( $artistID - , mysql_real_escape_string($url) + , $url )); return ($result != 0); } diff --git a/contrib/browser_search/main.php b/contrib/browser_search/main.php index 0b458a64..fc113121 100755 --- a/contrib/browser_search/main.php +++ b/contrib/browser_search/main.php @@ -36,7 +36,6 @@ class BrowserSearch implements Extension { // First, we need to build all the variables we'll need $search_title = $config->get_string('title'); - //$search_form_url = $config->get_string('base_href'); //make_link('post/list'); $search_form_url = make_link('post/list/{searchTerms}'); $suggenton_url = make_link('browser_search/')."{searchTerms}"; $icon_b64 = base64_encode(file_get_contents("favicon.ico")); diff --git a/contrib/et/main.php b/contrib/et/main.php index 8b4c0099..e098240b 100644 --- a/contrib/et/main.php +++ b/contrib/et/main.php @@ -48,8 +48,7 @@ class ET implements Extension { $info['sys_disk'] = to_shorthand_int(disk_total_space("./") - disk_free_space("./")) . " / " . to_shorthand_int(disk_total_space("./")); $info['sys_server'] = $_SERVER["SERVER_SOFTWARE"]; - include "config.php"; // more magical hax - $proto = preg_replace("#(.*)://.*#", "$1", $database_dsn); + $proto = preg_replace("#(.*)://.*#", "$1", DATABASE_DSN); #$db = $database->db->ServerInfo(); #$info['sys_db'] = "$proto / {$db['version']}"; diff --git a/contrib/favorites/main.php b/contrib/favorites/main.php index f6c6ef5b..ad37edd0 100644 --- a/contrib/favorites/main.php +++ b/contrib/favorites/main.php @@ -144,8 +144,10 @@ class Favorites extends SimpleExtension { image_id INTEGER NOT NULL, user_id INTEGER NOT NULL, created_at DATETIME NOT NULL, + INDEX(image_id), UNIQUE(image_id, user_id), - INDEX(image_id) + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE ) "); $config->set_int("ext_favorites_version", 1); diff --git a/contrib/forum/main.php b/contrib/forum/main.php index 7a0caed0..a2b2365e 100644 --- a/contrib/forum/main.php +++ b/contrib/forum/main.php @@ -197,7 +197,7 @@ class Forum extends SimpleExtension { $hasErrors = true; $errors .= "
You cannot have an empty title.
"; } - else if (strlen(mysql_real_escape_string(html_escape($_POST["title"]))) > 255) + else if (strlen(html_escape($_POST["title"])) > 255) { $hasErrors = true; $errors .= "
Your title is too long.
"; @@ -318,7 +318,7 @@ class Forum extends SimpleExtension { private function save_new_thread($user) { - $title = mysql_real_escape_string(html_escape($_POST["title"])); + $title = html_escape($_POST["title"]); $sticky = html_escape($_POST["sticky"]); if($sticky == ""){ @@ -344,7 +344,7 @@ class Forum extends SimpleExtension { { global $config; $userID = $user->id; - $message = mysql_real_escape_string(html_escape($_POST["message"])); + $message = html_escape($_POST["message"]); $max_characters = $config->get_int('forumMaxCharsPerPost'); $message = substr($message, 0, $max_characters); diff --git a/contrib/forum/theme.php b/contrib/forum/theme.php index ea460b47..40b015d9 100644 --- a/contrib/forum/theme.php +++ b/contrib/forum/theme.php @@ -83,8 +83,6 @@ class ForumTheme extends Themelet { global $config, $page/*, $user*/; $theme_name = $config->get_string('theme'); - $data_href = $config->get_string('base_href'); - $base_href = $config->get_string('base_href'); $html = ""; $n = 0; diff --git a/contrib/handle_flash/theme.php b/contrib/handle_flash/theme.php index a0e8cbb4..aec6bb9f 100644 --- a/contrib/handle_flash/theme.php +++ b/contrib/handle_flash/theme.php @@ -9,6 +9,7 @@ class FlashFileHandlerTheme extends Themelet { codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' height='{$image->height}' width='{$image->width}' + wmode='opaque' > @@ -16,6 +17,7 @@ class FlashFileHandlerTheme extends Themelet { pluginspage='http://www.macromedia.com/go/getflashplayer' height='{$image->height}' width='{$image->width}' + wmode='opaque' type='application/x-shockwave-flash'> "; $page->add_block(new Block("Flash Animation", $html, "main", 0)); diff --git a/contrib/holiday/main.php b/contrib/holiday/main.php new file mode 100644 index 00000000..598e2a89 --- /dev/null +++ b/contrib/holiday/main.php @@ -0,0 +1,33 @@ + + * Link: http://www.codeanimu.net + * License: GPLv2 + * Description: Use an additional stylesheet on certain holidays. + */ +class Holiday extends SimpleExtension { + public function onInitExt(Event $event) { + global $config; + $config->set_default_bool("holiday_aprilfools", false); + } + + public function onSetupBuilding(Event $event) { + global $config; + $sb = new SetupBlock("Holiday Theme"); + $sb->add_bool_option("holiday_aprilfools", "Enable April Fools"); + $event->panel->add_block($sb); + } + + public function onPageRequest(Event $event) { + global $config; + $date = /*date('d/m') == '01/01' ||date('d/m') == '14/02' || */date('d/m') == '01/04'/* || date('d/m') == '24/12' || date('d/m') == '25/12' || date('d/m') == '31/12'*/; + if($date){ + if($config->get_bool("holiday_aprilfools")){ + $this->theme->display_holiday($date); + } + } + } + +} +?> diff --git a/contrib/holiday/stylesheets/aprilfools.css b/contrib/holiday/stylesheets/aprilfools.css new file mode 100644 index 00000000..9250c688 --- /dev/null +++ b/contrib/holiday/stylesheets/aprilfools.css @@ -0,0 +1,11 @@ +BODY { + /* It's a bit crazy but, april fools is supposed to be crazy. + This flips the entire page upside down. + TODO: Add a way for the user to disable this */ + + -webkit-transform: rotate(-180deg); /*Safari*/ + -moz-transform: rotate(-180deg); /*Firefox*/ + -o-transform: rotate(-180deg); /*Opera*/ + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); /*IE6*/ + ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; /*IE7+?*/ +} diff --git a/contrib/holiday/theme.php b/contrib/holiday/theme.php new file mode 100644 index 00000000..2012f3ee --- /dev/null +++ b/contrib/holiday/theme.php @@ -0,0 +1,20 @@ +"; + $page->add_html_header("$csssheet"); + } + } +} +?> diff --git a/contrib/home/main.php b/contrib/home/main.php index f46c6238..b6172016 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -28,14 +28,13 @@ class Home extends SimpleExtension { public function onPageRequest(PageRequestEvent $event) { global $config, $page; if($event->page_matches("home")) { - $base_href = $config->get_string('base_href'); - $data_href = get_base_href(); + $base_href = get_base_href(); $sitename = $config->get_string('title'); $theme_name = $config->get_string('theme'); $body = $this->get_body(); - $this->theme->display_page($page, $sitename, $data_href, $theme_name, $body); + $this->theme->display_page($page, $sitename, $base_href, $theme_name, $body); } } @@ -58,8 +57,7 @@ class Home extends SimpleExtension { // returns just the contents of the body global $database; global $config; - $base_href = $config->get_string('base_href'); - $data_href = get_base_href(); + $base_href = get_base_href(); $sitename = $config->get_string('title'); $contact_link = $config->get_string('contact_link'); $counter_dir = $config->get_string('home_counter', 'default'); @@ -71,7 +69,7 @@ class Home extends SimpleExtension { $counter_text = ""; for($n=0; $nset_mode("data"); $page->set_data(<< $sitename - +