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
Sun Aug 31, 2014 8:50 am by Kelsea

» Akashi Tanikaze
Sat Aug 30, 2014 11:41 pm by Tatyina

» This is a basic user generated topic.
Sat Aug 23, 2014 5:14 pm by anegge

» Your first subject
Wed Aug 13, 2014 8:41 pm by Kelsea

August 2017
MonTueWedThuFriSatSun
 123456
78910111213
14151617181920
21222324252627
28293031   

Calendar Calendar

Affiliates

free forum

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


Current date/time is Thu Aug 17, 2017 1:45 pm

Forum Terms of service

The moderators of this forum will try hard to edit or remove reprehensible messages as soon as possible. However, it is impossible for them to review all the messages. You thus admit that all the messages posted on this forum express the sight and opinion of their respective authors and not those of the moderators or the Webmaster (except messages posted by them) and consequently, they cannot be held responsible of the discussions.

This forum uses cookies to store information on your computer. These cookies will not contain any personal information; they are only used to improve comfort while browsing. The address e-mail is only used in order to confirm the details of your registration as your password (and also to send you back your password if you forget it).

- Aggressive or slanderous messages, as well as personal insults and critics, the coarseness and vulgarities, and more generally any message contravening the French laws are prohibited.
- Messages who promote - or evoke - illegal practices are prohibited.
- If you post informations which come from another site
, look first if the site in question doesn't forbid it. Show the address of the site in question in order to respect the work of their administrators!
- Please post your messages only once. The repetitions are unpleasant and useless!
- Please make an effort on grammar and spelling. SMS-style language (ex: r u sk8ing?) is not advised!

Any message contravening the listing above will be edited or removed without additional notice or justification within deadlines which will depend on the availability of the moderators. Any abuse will involve the cancellation of the registration. Internet is neither an anonymous space, nor a space of no-right! We reserve ourselves the possibility of informing your access provider and/or the legal authorities of any malevolent behavior. An IP address of each poster is recorded in order to help us to make you respect these conditions.

By clicking on " I agree to these terms " below:
- You acknowledge to have fully read these current rules;
- You commit yourself to respect unreservedly these current rules;
- You grant the moderators of this forum the right to delete, move or edit any discussion subject at any moment.