Changeset 2313
- Timestamp:
- 12/18/10 13:21:10 (17 months ago)
- Location:
- branches/1.5
- Files:
-
- 1 removed
- 8 modified
-
Hotaru.php (modified) (2 diffs)
-
install/index.php (modified) (1 diff)
-
install/install-upgrade.php (modified) (2 diffs)
-
install/install_tables.php (modified) (1 diff)
-
libs/AdminPages.php (modified) (1 diff)
-
libs/Caching.php (modified) (1 diff)
-
libs/Comment.php (deleted)
-
libs/Initialize.php (modified) (1 diff)
-
libs/UserAuth.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/Hotaru.php
r2307 r2313 40 40 protected $post; // Post object 41 41 protected $avatar; // Avatar object 42 protected $comment; // Comment object43 42 protected $includes; // for CSS/JavaScript includes 44 43 protected $pageHandling; // PageHandling object … … 2012 2011 /* ************************************************************* 2013 2012 * 2014 * COMMENT FUNCTIONS2015 *2016 * *********************************************************** */2017 2018 /**2019 * Count comments2020 *2021 * @param bool $digits_only - return just the count (if false, returns "3 comments", etc.)2022 * @param string $no_comments_text - e.g. "Leave a comment" or "No comments"2023 * @return string - text to show, e.g. "3 comments"2024 */2025 function countComments($digits_only = true, $no_comments_text = '')2026 {2027 $comment = new Comment();2028 return $comment->countComments($this, $digits_only, $no_comments_text);2029 }2030 2031 2032 /**2033 * Count all user comments2034 *2035 * @param int $user_id2036 * @return int2037 */2038 function countUserComments($user_id = 0)2039 {2040 $comment = new Comment();2041 return $comment->countUserComments($this, $user_id);2042 }2043 2044 2045 /**2046 * Physically delete all comments by a specified user (and responses)2047 *2048 * @param array $user_id2049 * @return bool2050 */2051 public function deleteComments($user_id)2052 {2053 $comment = new Comment();2054 return $comment->deleteComments($this, $user_id);2055 }2056 2057 2058 /**2059 * Get comment from database2060 *2061 * @param int $comment_id2062 * @return array|false2063 */2064 function getComment($comment_id = 0)2065 {2066 $comment = new Comment();2067 return $comment->getComment($this, $comment_id);2068 }2069 2070 2071 /**2072 * Read comment2073 *2074 * @param array $comment_row pulled from database2075 */2076 function readComment($comment_row = array())2077 {2078 $comment = new Comment();2079 return $comment->readComment($this, $comment_row);2080 }2081 2082 2083 /* *************************************************************2084 *2085 2013 * WIDGET FUNCTIONS 2086 2014 * -
branches/1.5/install/index.php
r2308 r2313 499 499 } else { 500 500 501 $tables = array('blocked', 'categories', ' comments', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'widgets');501 $tables = array('blocked', 'categories', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'widgets'); 502 502 503 503 // delete *all* tables in db: -
branches/1.5/install/install-upgrade.php
r2309 r2313 260 260 if (!$exists) { 261 261 // Alter the Users table to include user_lastvisit 262 $sql = "ALTER TABLE " . TABLE_COMMENTS . "ADD comment_votes_down smallint(11) NOT NULL DEFAULT '0' AFTER comment_votes";262 $sql = "ALTER TABLE ".DB_PREFIX."comments ADD comment_votes_down smallint(11) NOT NULL DEFAULT '0' AFTER comment_votes"; 263 263 $h->db->query($h->db->prepare($sql)); 264 264 } … … 268 268 if (!$exists) { 269 269 // Alter the Users table to include user_lastvisit 270 $sql = "ALTER TABLE " . TABLE_COMMENTS . "CHANGE comment_votes comment_votes_up smallint(11) NOT NULL DEFAULT '0'";270 $sql = "ALTER TABLE ".DB_PREFIX."comments CHANGE comment_votes comment_votes_up smallint(11) NOT NULL DEFAULT '0'"; 271 271 $h->db->query($h->db->prepare($sql)); 272 272 } 273 273 274 274 // move any negative comment vote counts to the down column 275 $sql = "SELECT comment_id, comment_votes_up FROM " . TABLE_COMMENTS . "WHERE comment_votes_up < %d";275 $sql = "SELECT comment_id, comment_votes_up FROM ".DB_PREFIX."comments WHERE comment_votes_up < %d"; 276 276 $negatives = $h->db->get_results($h->db->prepare($sql, 0)); 277 277 if ($negatives) { 278 278 foreach ($negatives as $neg) { 279 $sql = "UPDATE " . TABLE_COMMENTS . "SET comment_votes_up = %d, comment_votes_down = %d WHERE comment_id = %d";279 $sql = "UPDATE ".DB_PREFIX."comments SET comment_votes_up = %d, comment_votes_down = %d WHERE comment_id = %d"; 280 280 $h->db->query($h->db->prepare($sql, 0, abs($neg->comment_votes_up), $neg->comment_id)); 281 281 } -
branches/1.5/install/install_tables.php
r2308 r2313 83 83 $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (category_name, category_safe_name) VALUES (%s, %s)"; 84 84 $db->query($db->prepare($sql, urlencode('All'), urlencode('all'))); 85 }86 87 88 // COMMENTS TABLE - comments89 90 if ($table_name == "comments") {91 //echo "table doesn't exist. Stopping before creation."; exit;92 $sql = "CREATE TABLE `" . DB_PREFIX . $table_name . "` (93 `comment_id` int(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,94 `comment_archived` enum('Y','N') NOT NULL DEFAULT 'N',95 `comment_updatedts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,96 `comment_post_id` int(20) NOT NULL DEFAULT '0',97 `comment_user_id` int(20) NOT NULL DEFAULT '0',98 `comment_parent` int(20) DEFAULT '0',99 `comment_date` timestamp NULL,100 `comment_status` varchar(32) NOT NULL DEFAULT 'approved',101 `comment_content` text NULL,102 `comment_votes_up` smallint(11) NOT NULL DEFAULT '0',103 `comment_votes_down` smallint(11) NOT NULL DEFAULT '0',104 `comment_subscribe` tinyint(1) NOT NULL DEFAULT '0',105 `comment_updateby` int(20) NOT NULL DEFAULT 0,106 FULLTEXT (`comment_content`),107 INDEX (`comment_archived`),108 INDEX (`comment_post_id`),109 INDEX (`comment_status`)110 ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='Post Comments';";111 echo $lang['install_step2_creating_table'] . ": '" . DB_PREFIX . $table_name . "'...<br />\n";112 $db->query($sql);113 85 } 114 86 -
branches/1.5/libs/AdminPages.php
r2312 r2313 385 385 DB_PREFIX.'usermeta', 386 386 DB_PREFIX.'categories', 387 DB_PREFIX.'comments',388 387 DB_PREFIX.'miscdata', 389 388 DB_PREFIX.'posts', -
branches/1.5/libs/Caching.php
r2309 r2313 204 204 break; 205 205 case 'comments': 206 $sql = "SELECT comment_updatedts FROM ". TABLE_COMMENTS."ORDER BY comment_updatedts DESC LIMIT 1";206 $sql = "SELECT comment_updatedts FROM ".DB_PREFIX."comments ORDER BY comment_updatedts DESC LIMIT 1"; 207 207 break; 208 208 case 'commentvotes': -
branches/1.5/libs/Initialize.php
r2309 r2313 114 114 'TABLE_BLOCKED' => 'blocked', 115 115 'TABLE_CATEGORIES' => 'categories', 116 'TABLE_COMMENTS' => 'comments',117 116 'TABLE_MISCDATA' => 'miscdata', 118 117 'TABLE_PLUGINS' => 'plugins', -
branches/1.5/libs/UserAuth.php
r2249 r2313 327 327 $viewee->updatePermissions($h); 328 328 if ($role_check == 'killspammed' || $role_check == 'deleted') { 329 $h->deleteComments($viewee->id); // includes child comments from *other* users 329 if (isset($h->vars['comment'])) { 330 $h->vars['comment']->deleteComments($h, $viewee->id); // includes child comments from *other* users 331 } 330 332 $h->deletePosts($viewee->id); // includes tags and votes for self-submitted posts 331 333