diff --git a/contrib/admin_utils/main.php b/contrib/admin_utils/main.php index 259e1e80..0b6bc8c3 100644 --- a/contrib/admin_utils/main.php +++ b/contrib/admin_utils/main.php @@ -38,6 +38,17 @@ class AdminUtils extends Extension { global $database; $database->execute("UPDATE tags SET tag=lower(tag)"); } + private function check_for_orphanned_images() { + $orphans = array(); + foreach(glob("images/*") as $dir) { + foreach(glob("$dir/*") as $file) { + $hash = str_replace("$dir/", "", $file); + if(!$this->db_has_hash($hash)) { + $orphans[] = $hash; + } + } + } + } // }}} // admin page HTML {{{ private function build_form() { diff --git a/contrib/home/counter_link.txt b/contrib/home/counter_link.txt new file mode 100644 index 00000000..fa7d344a --- /dev/null +++ b/contrib/home/counter_link.txt @@ -0,0 +1 @@ +maybe the counter source http://kokagex.hp.infoseek.co.jp/ \ No newline at end of file diff --git a/contrib/home/counters/default/0.gif b/contrib/home/counters/default/0.gif new file mode 100644 index 00000000..6c348e53 Binary files /dev/null and b/contrib/home/counters/default/0.gif differ diff --git a/contrib/home/counters/default/1.gif b/contrib/home/counters/default/1.gif new file mode 100644 index 00000000..1c33ee35 Binary files /dev/null and b/contrib/home/counters/default/1.gif differ diff --git a/contrib/home/counters/default/2.gif b/contrib/home/counters/default/2.gif new file mode 100644 index 00000000..e6df16c1 Binary files /dev/null and b/contrib/home/counters/default/2.gif differ diff --git a/contrib/home/counters/default/3.gif b/contrib/home/counters/default/3.gif new file mode 100644 index 00000000..3ee1bcd9 Binary files /dev/null and b/contrib/home/counters/default/3.gif differ diff --git a/contrib/home/counters/default/4.gif b/contrib/home/counters/default/4.gif new file mode 100644 index 00000000..aabf1217 Binary files /dev/null and b/contrib/home/counters/default/4.gif differ diff --git a/contrib/home/counters/default/5.gif b/contrib/home/counters/default/5.gif new file mode 100644 index 00000000..46f4940b Binary files /dev/null and b/contrib/home/counters/default/5.gif differ diff --git a/contrib/home/counters/default/6.gif b/contrib/home/counters/default/6.gif new file mode 100644 index 00000000..cd316a0a Binary files /dev/null and b/contrib/home/counters/default/6.gif differ diff --git a/contrib/home/counters/default/7.gif b/contrib/home/counters/default/7.gif new file mode 100644 index 00000000..6019a72f Binary files /dev/null and b/contrib/home/counters/default/7.gif differ diff --git a/contrib/home/counters/default/8.gif b/contrib/home/counters/default/8.gif new file mode 100644 index 00000000..9baa78f2 Binary files /dev/null and b/contrib/home/counters/default/8.gif differ diff --git a/contrib/home/counters/default/9.gif b/contrib/home/counters/default/9.gif new file mode 100644 index 00000000..1e3f85f7 Binary files /dev/null and b/contrib/home/counters/default/9.gif differ diff --git a/contrib/home/main.php b/contrib/home/main.php new file mode 100644 index 00000000..98e1fc69 --- /dev/null +++ b/contrib/home/main.php @@ -0,0 +1,134 @@ + +* Link: http://trac.shishnet.org/shimmie2/ +* License: GPLv2 +* Description: Extension adds a page "home" containing user specified +* links and a counter showing total number of posts. The +* page is accessed via /home. +*/ + +class Home extends Extension { + + public function receive_event($event) { + global $page; + if(is_a($event, 'PageRequestEvent') && ($event->page == "home")) + { + // this is a request to display this page so output the page. + $this->output_pages(); + } + if(is_a($event, 'SetupBuildingEvent')) + { + $counters = array(); + foreach(glob("ext/home/counters/*") as $counter_dirname) { + $name = str_replace("ext/home/counters/", "", $counter_dirname); + $counters[ucfirst($name)] = $name; + } + + $sb = new SetupBlock("Home Page"); + $sb->add_label("Page Links - Example: [$"."base/index|Posts]"); + $sb->add_longtext_option("home_links", "
"); + $sb->add_choice_option("home_counter", $counters, "
Counter: "); + $sb->add_label("
Note: page accessed via /home"); + $event->panel->add_main_block($sb); + } + if(is_a($event, 'ConfigSaveEvent')) + { + $event->config->set_string_from_post("home_links"); + $event->config->set_string_from_post("home_counter"); + } + } + + private function get_body() + { + // returns just the contents of the body + global $database; + global $config; + $base_href = $config->get_string('base_href'); + $data_href = $config->get_string('data_href'); + $sitename = $config->get_string('title'); + $contact_link = $config->get_string('contact_link'); + $counter_dir = $config->get_string('home_counter'); + + $total = ceil($database->db->GetOne("SELECT COUNT(*) FROM images")); + + $numbers = array(); + $numbers = str_split($total); + $num_comma = number_format($total); + + $counter_text = ""; + foreach ($numbers as $cur) + { + $counter_text .= " $cur "; + } + + // get the homelinks and process them + $main_links = $config->get_string('home_links'); + $main_links = str_replace('$base', $base_href, $main_links); + $main_links = str_replace('[', "", $main_links); + $main_links = str_replace(']', "", $main_links); + + return " +
+

+ $sitename +

+ +
+
+
+ +
+
+
+ contact – Serving $num_comma posts +
+ +
+ Powered by Shimmie +
+
+ $counter_text +
+
"; + } + + private function output_pages() + { + // output a sectionalised list of all the main pages on the site. + global $config; + $base_href = $config->get_string('base_href'); + $data_href = $config->get_string('data_href'); + $sitename = $config->get_string('title'); + $theme_name = $config->get_string('theme'); + + $body = $this->get_body(); + + print << + + $sitename + + + + + $body + + +EOD; + exit; + } + +} +add_event_listener(new Home()); +?>