test tag
0, 'dups' => 0); $tag_array = explode(',', $tags); for($i = 0; $i < sizeof($tag_array); $i++) { if(insert_tag(str_replace('"', '', trim($tag_array[$i])), $topic_id)){ $outcome['added']++; }else{ $outcome['dups']++; } } return $outcome; } function insert_tag($tag, $topic_id){ global $db; $sql_array = array('tag' => $tag, 'topic_id' => $topic_id); if(trim($tag) == '') { //exit right away return false; } $sql = 'SELECT * FROM ' . TAGS_TABLE . " WHERE " . $db->sql_build_array('SELECT', $sql_array); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); if($row != null) { return false; } else { $sql = "INSERT INTO " . TAGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_array); $db->sql_query($sql); return true; } } function get_board_tags($limit){ global $db, $config, $auth; $sql = "SELECT t.*, topics.forum_id FROM " . TAGS_TABLE . " t JOIN " . TOPICS_TABLE . " topics ON t.topic_id = topics.topic_id "; $sql = get_cloud_sort($sql); if($limit > 0){ $result = $db->sql_query_limit($sql, $limit, 0); }else{ $result = $db->sql_query($sql); } /* for($i = 0; $i < sizeof($result_set); $i++){ $tag_array[$result_set[$i]['tag']] = $result_set[$i]['tag_count']; } * */ $tag_list = array(); while ($row = $db->sql_fetchrow($result)){ // Do not include those topics the user has no permission to access if ($auth->acl_get('f_read', $row['forum_id'])){ if(isset($tag_list[$row['tag']])){ $tag_list[$row['tag']] += 1; }else{ $tag_list[$row['tag']] = 1; } } } return $tag_list; } function get_topic_tags($topic_id, $limit){ global $db, $config, $auth; $sql = "SELECT t.*, topics.forum_id FROM " . TAGS_TABLE . " t JOIN " . TOPICS_TABLE . " topics ON t.topic_id = topics.topic_id - "; + WHERE t.topic_id = " . (int)$topic_id; $sql = get_cloud_sort($sql); if($limit > 0){ $result = $db->sql_query_limit($sql, $limit, 0); }else{ $result = $db->sql_query($sql); } $tag_list = array(); while ($row = $db->sql_fetchrow($result)){ // Do not include those topics the user has no permission to access if ($auth->acl_get('f_read', $row['forum_id'])){ if(isset($tag_list[$row['tag']])){ $tag_list[$row['tag']] += 1; }else{ $tag_list[$row['tag']] = 1; } } } return $tag_list; } function get_cloud_sort($sql){ global $config; switch($config['ptt_tag_sort']){ case 'random': $sql .= " ORDER BY RAND()"; break; case 'popular': $sql .= ' ORDER BY tag_count DESC'; break; case 'alphabetical': default: $sql .= " ORDER BY t.tag"; break; } return $sql; } function get_tag_cloud($min_size, $max_size, $col1, $col2, $limit){ global $phpEx, $user, $config, $phpbb_root_path; $tags = get_board_tags($limit); if(sizeof($tags) > 0){ $min_count = min(array_values($tags)); $max_count = max(array_values($tags)); $spread = $max_count - $min_count; if($spread == 0){ $spread = 1; } $tag_cloud = ''; $cTools = new ColourTools(); $gradient = $cTools->gradient($col1, $col2, $max_count); foreach ($tags as $tag => $count) { $size = $min_size + ($count - $min_count) * ($max_size - $min_size) / $spread; $tag_param = $tag; if(strpos($tag, ' ') !== false){ $tag_param = '"' . urlencode($tag) . '"'; } $tag_cloud .= ' ' . $tag . ' '; } }else{ $tag_cloud = false; } return $tag_cloud; } function get_tag_list($topic_id, $limit, $type = 'topic', $admin = false){ global $phpbb_root_path, $phpEx, $user; $tag_list = ""; $tags = get_topic_tags($topic_id, $limit); if(sizeof($tags) > 0) { foreach ($tags as $tag => $count) { $tag_param = $tag; if(strpos($tag, ' ') !== false) { $tag_param = '"' . urlencode($tag) . '"'; } if($admin){ //$tag_list .= '     '; } $tag_list .= '' . $tag . ', '; } $tag_list = substr($tag_list, 0, -2); } else { $tag_list = false; } return $tag_list; } /* USED FOR DIFFERENT TAGS DEPENDING ON WETHER IT SHOULD BE BOARD, TOPIC, FROUM. NEEDS RE WORKING function get_topic_tags($type = 'board', $id = 0, $limit = 60){ //TODO: santize input global $db; switch($type){ case 'forum': //forum sql $sql = "SELECT t.tag, COUNT(*) tag_count FROM " . TAGS_TABLE . " t, " . TOPICS_TABLE . " topics WHERE topics.forum_id = $id AND t.topic_id = topics.topic_id GROUP BY t.tag"; break; case 'topic': //topic sql $sql = "SELECT t.tag, COUNT(*) tag_count FROM " . TAGS_TABLE . " t WHERE t.topic_id = $id GROUP BY t.tag"; break; case 'board': default: //board sql $sql = "SELECT t.tag, COUNT(*) tag_count FROM " . TAGS_TABLE . " t GROUP BY t.tag"; } if($limit > 0){ $result = $db->sql_query_limit($sql, $limit, 0); }else{ $result = $db->sql_query($sql); } $result_set = $db->sql_fetchrowset($result); $tag_array = array(); for($i = 0; $i < sizeof($result_set); $i++) { $tag_array[$result_set[$i]['tag']] = $result_set[$i]['tag_count']; } return $tag_array; } function get_tag_list($topic_id, $limit, $type = 'topic', $admin = false){ global $phpbb_root_path, $phpEx, $user; $tag_list = ""; $tags = get_topic_tags($type, $topic_id, $limit); if(sizeof($tags) > 0) { foreach ($tags as $tag => $count) { $tag_param = $tag; if(strpos($tag, ' ') !== false) { $tag_param = '"' . $tag . '"'; } if($admin){ $tag_list .= '     '; } $tag_list .= '' . $tag . ', '; } $tag_list = substr($tag_list, 0, -2); } else { $tag_list = false; } return $tag_list; } function get_tag_cloud($type = 'board', $id = -1, $min_size = 8, $max_size = 26, $limit = 60){ global $phpEx, $user, $config; $tags = get_topic_tags($type, $id, $limit); if(sizeof($tags) > 0) { $min_count = min(array_values($tags)); $max_count = max(array_values($tags)); $spread = $max_count - $min_count; if($spread == 0) { $spread = 1; } $cTools = new ColourTools(); $gradient = $cTools->gradient($config['ptt_colour1'], $config['ptt_colour2'], $max_count); foreach ($tags as $tag => $count) { $size = $min_size + ($count - $min_count) * ($max_size - $min_size) / $spread; $tag_param = $tag; if(strpos($tag, ' ') !== false) { $tag_param = '"' . $tag . '"'; } $tag_cloud .= ' ' . $tag . ' '; } } else { $tag_cloud = false; } return $tag_cloud; } */ function get_num_rows($tags){ global $db, $config, $auth; $end = $config['topics_per_page']; $tag_array = filter_tags($tags); $sql = "SELECT topi.topic_id, topi.forum_id, topi.topic_type, topi.topic_replies_real, topi.topic_replies, topi.topic_status, topi.topic_moved_id, topi.topic_last_post_time, topi.topic_approved, topi.topic_poster, topi.topic_first_poster_name, topi.topic_time, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_poster_id, topi.topic_views, topi.topic_title, topi.icon_id, topi.poll_start, topi.topic_attachment, topi.topic_first_poster_name, COUNT(topi.topic_id) count FROM ". TAGS_TABLE ." t, ". TOPICS_TABLE ." topi"; if(!empty($tag_array['include'])){ $sql .= " WHERE (t.tag IN ("; $sql .= prepare_search_string($tag_array['include']); $sql .= "))"; } if(!empty($tag_array['include']) && !empty($tag_array['exclude'])){ $sql .= " AND "; }else if(empty($tag_array['include']) && !empty($tag_array['exclude'])){ $sql .= " WHERE "; } if(!empty($tag_array['exclude'])){ $sql .= " (topi.topic_id NOT IN ( SELECT top2.topic_id FROM ". TAGS_TABLE ." t2, ". TOPICS_TABLE ." top2 WHERE t2.topic_id = top2.topic_id"; $sql .= prep_exclusion_string($tag_array['exclude']); $sql .= "))"; } $sql .= "AND topi.topic_id = t.topic_id GROUP BY topi.topic_id, topi.forum_id, topi.topic_type, topi.topic_replies_real, topi.topic_replies, topi.topic_status, topi.topic_moved_id, topi.topic_last_post_time, topi.topic_approved, topi.topic_poster, topi.topic_first_poster_name, topi.topic_time, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_poster_id, topi.topic_views, topi.topic_title, topi.icon_id, topi.poll_start, topi.topic_attachment, topi.topic_first_poster_name ORDER BY count DESC"; if(!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Error retrieving search results', '', __LINE__, __FILE__, $sql); } $topic_list = array(); while ($row = $db->sql_fetchrow($result)){ // Do not include those topics the user has no permission to access if ($auth->acl_get('f_read', $row['forum_id'])){ $topic_list[] = $row; } } return sizeof($topic_list); } function search_tags($tags, $start = 0, $end = false){ global $db, $config, $auth; $topics_count = (int) $db->sql_fetchfield('num_topics'); if($end === false){ $end = $config['topics_per_page']; } $tag_array = filter_tags($tags); $sql = "SELECT topi.topic_id, topi.forum_id, topi.topic_type, topi.topic_replies_real, topi.topic_replies, topi.topic_status, topi.topic_moved_id, topi.topic_last_post_time, topi.topic_approved, topi.topic_poster, topi.topic_first_poster_name, topi.topic_time, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_poster_id, topi.topic_views, topi.topic_title, topi.icon_id, topi.topic_attachment, topi.topic_first_poster_name, topi.topic_last_post_id, topi.topic_last_poster_id, topi.topic_last_poster_name, topi.topic_last_poster_colour, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_view_time, topi.poll_start, COUNT(topi.topic_id) count FROM ". TAGS_TABLE ." t, ". TOPICS_TABLE ." topi"; if(!empty($tag_array['include'])){ $sql .= " WHERE (t.tag IN ("; $sql .= prepare_search_string($tag_array['include']); $sql .= "))"; } if(!empty($tag_array['include']) && !empty($tag_array['exclude'])){ $sql .= " AND "; }else if(empty($tag_array['include']) && !empty($tag_array['exclude'])){ $sql .= " WHERE "; } if(!empty($tag_array['exclude'])){ $sql .= "(topi.topic_id NOT IN ( SELECT top2.topic_id FROM ". TAGS_TABLE ." t2, ". TOPICS_TABLE ." top2 WHERE t2.topic_id = top2.topic_id"; $sql .= prep_exclusion_string($tag_array['exclude']); $sql .= "))"; } $sql .= "AND topi.topic_id = t.topic_id GROUP BY topi.topic_id, topi.forum_id, topi.topic_type, topi.topic_replies_real, topi.topic_replies, topi.topic_status, topi.topic_moved_id, topi.topic_last_post_time, topi.topic_approved, topi.topic_poster, topi.topic_first_poster_name, topi.topic_time, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_poster_id, topi.topic_views, topi.topic_title, topi.icon_id, topi.topic_attachment, topi.topic_first_poster_name, topi.topic_last_post_id, topi.topic_last_poster_id, topi.topic_last_poster_name, topi.topic_last_poster_colour, topi.topic_last_post_subject, topi.topic_last_post_time, topi.topic_last_view_time ORDER BY topic_time DESC"; if(!($result = $db->sql_query_limit($sql, $end, $start))) { message_die(GENERAL_ERROR, 'Error retrieving search results', '', __LINE__, __FILE__, $sql); } $topic_list = array(); while ($row = $db->sql_fetchrow($result)){ // Do not include those topics the user has no permission to access if ($auth->acl_get('f_read', $row['forum_id'])){ $topic_list[] = $row; } } return $topic_list; } function prep_exclusion_string($exclude_array){ $string = ''; for($i = 0; $i < sizeof($exclude_array); $i++){ $string .= ' AND t2.tag = \'' . $exclude_array[$i] . '\''; } return $string; } function filter_tags($tags){ $tag_array = tags_to_array($tags); $incl = array(); $excl = array(); $filtered_array = array('include' => $incl, 'exclude' => $excl); for($i = 0; $i < sizeof($tag_array); $i++){ if($tag_array[$i][0] == '-'){ array_push($filtered_array['exclude'], substr($tag_array[$i], 1)); }else{ array_push($filtered_array['include'], $tag_array[$i]); } } return $filtered_array; } function tags_to_array($string){ $str_array = array(); $qoute = false; $str_buffer = ""; $tags = html_entity_decode($string); //$tags = $string; for($i = 0; $i < strlen($tags); $i++ ) { if(($tags[$i] == '"') && $qoute === true) { $qoute = false; } else if(($tags[$i] == '"') && $qoute === false) { $qoute = true; } if($tags[$i] == ' ' && !$qoute) { //str_replace( $str_buffer = str_replace('"', '', $str_buffer); array_push($str_array, $str_buffer); $str_buffer = ""; } else { $str_buffer .= $tags[$i]; } } $str_buffer = htmlspecialchars(str_replace('"', '', $str_buffer)); array_push($str_array, $str_buffer); return $str_array; } function prepare_search_string($str_array){ global $db; $prep_str = ""; for($j = 0; $j < sizeof($str_array); $j++) { $prep_str .= "'" . $db->sql_escape($str_array[$j]) . "',"; } return substr($prep_str, 0, strlen($prep_str)-1); } ?>
Search
 
 

Display results as :
 


Rechercher Advanced Search

Keywords

Latest topics
» Test Blog number one
Latest pictures and photos - Anime Female Wrestling EmptySun Aug 31, 2014 8:50 am by Kelsea

» Akashi Tanikaze
Latest pictures and photos - Anime Female Wrestling EmptySat Aug 30, 2014 11:41 pm by Tatyina

» This is a basic user generated topic.
Latest pictures and photos - Anime Female Wrestling EmptySat Aug 23, 2014 5:14 pm by anegge

» Your first subject
Latest pictures and photos - Anime Female Wrestling EmptyWed Aug 13, 2014 8:41 pm by Kelsea

April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     

Calendar Calendar

Affiliates

free forum

Forumotion on Facebook Forumotion on Twitter Forumotion on YouTube Forumotion on Google+


Recently shared images


Find the photos and images shared by the Anime Female Wrestling community. The images displayed are selected from forum posts and are listed in chronological order (most recent images first). A simple way to rediscover the discussions differently!

  • Latest images