function make_url_friendly($str, $separator = "-") { $illegal = array("—", """, "&", "©", "«", "»", "–", "·", "‘", "’", "“", "”", " ", "`", "~", "!", "@", "#", "\$", "%", "^", "&", "*", "(", ")", "--", "-", "-", "_", "__", "+", "=", "{", "}", "[", "]", ";", ":", "'", "¥", "\"", ",", ".", "<", ">", "/", "?", "\\", "|"); $str = str_replace($illegal, $separator, trim($str)); $str = preg_replace('/[^a-zA-Z0-9\\s\\-]/', '', $str); if (strpos($str, "--") !== false) { $str = make_url_friendly($str, $separator); } while (substr($str, strlen($str) - 1, 1) == "-") { $str = substr($str, 0, strlen($str) - 1); } return $str; }
echo $tag; ?> </a> <?php } ?> </div> <p class="more"> <a class="" href="<?php echo base_url(); ?> index.php/blog/view/<?php echo $p->id; ?> /<?php echo make_url_friendly($p->title); ?> /" title="Read Entry">Read</a> <?php if ($this->session->userdata('loggedin')) { ?> <a href="<?php echo base_url(); ?> index.php/blog/edit/<?php echo $p->id; ?> /" title="Edit Post">Edit</a> <?php } ?>
message_die(GENERAL_ERROR, $lang['Yahoo_search_error_no_gzip']); } } else { $out = ''; global $config; $sql = 'SELECT topic_id, topic_title FROM ' . TOPICS_TABLE . "\n\t\t\tWHERE forum_id IN ({$forums_sql})\n\t\t\tORDER BY topic_time DESC"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $protocol = $default_config['cookie_secure'] ? 'https://' : 'http://'; $server_name = $default_config['server_name']; $server_port = $default_config['server_port'] == '80' ? '' : ':' . $default_config['server_port']; $script_path = $default_config['script_path']; //URL REWRITE MOD START if ($config['url_rw'] == '1' || $config['url_rw_guests'] == '1' && $user->data['user_id'] == ANONYMOUS) { $viewtopic_url = str_replace('--', '-', make_url_friendly($row['topic_title']) . '-vt' . $row['topic_id'] . '.html'); } else { $viewtopic_url = CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $row['topic_id']; } //URL REWRITE MOD END //$viewtopic_url = 'viewtopic.' . PHP_EXT . '?' . POST_TOPIC_URL . '=' . $row['topic_id']; $out .= $protocol . $server_name . $server_port . $script_path . $viewtopic_url . "\r\n"; } $out .= request_var('additional_urls', '', true); $search_savepath = request_var('search_savepath', '', true); $filename = IP_ROOT_PATH . $search_savepath . '/urllist.txt'; if (!($file_handle = fopen($filename, 'w'))) { message_die(GENERAL_ERROR, sprintf($lang['Yahoo_search_error_unopenable_file'], $filename)); } if (fwrite($file_handle, $out) === FALSE) { message_die(GENERAL_ERROR, sprintf($lang['Yahoo_search_error_unwritable_file'], $filename));
/** * Fill post object */ public function fillPostObject($h) { $edit = false; if ($h->cage->post->getAlpha('post_process') == 'editpost') { $post_id = $h->cage->post->testInt('post_id'); if ($post_id) { $h->readPost($post_id); $edit = true; } } // get author $h->post->author = $h->cage->post->testInt('post_author'); // get the allowed tas: $journal_settings = $h->getSerializedSettings('journal'); $allowed_tags = $journal_settings['allowable_tags']; // get content - return false if no content $h->post->content = trim(sanitize($h->cage->post->getHtmLawed('post_content'), 'tags', $allowed_tags)); // get title - take first 60 chars from content if no title provided $h->post->title = trim($h->cage->post->getHtmLawed('post_title')); if (!$h->post->title) { $h->post->title = truncate($h->post->content, 60); } // make title into a url $title = html_entity_decode($h->post->title, ENT_QUOTES, 'UTF-8'); if (!$title) { $title = $h->lang['journal_no_title']; } $h->post->url = make_url_friendly($title); $num = 2; while (!$edit && $h->isPostUrl($h->post->url)) { //prevent duplicate url slugs by appending a number $h->post->url = $h->post->url . "-" . $num; $num++; } $error = $this->checkErrors($h, $edit); return $error; }
function build_index($cur = 'Root', $cat_break = false, &$forum_moderators, $real_level = -1, $max_level = -1, &$keys) { global $template, $db, $cache, $config, $user, $lang, $images, $theme; global $tree, $bbcode, $lofi; if (empty($bbcode)) { include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; } // init $display = false; // get the sub_forum switch value $sub_forum = intval($config['sub_forum']); if ($sub_forum == 2 && defined('IN_VIEWFORUM')) { $sub_forum = 1; } $pack_first_level = $sub_forum == 2; // verify the cat_break parm if ($cur != 'Root' && $real_level == -1) { $cat_break = false; } // display the level $CH_this = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1; // display each kind of row // root level head if ($real_level == -1) { // get max inc level $max = -1; if ($sub_forum == 2) { $max = 0; } if ($sub_forum == 1) { $max = 1; } $keys = array(); $keys = get_auth_keys($cur, false, -1, $max); $max_level = get_max_depth($cur, false, -1, $keys, $max); } // table header if ($config['split_cat'] && $cat_break && $real_level == 0 || (!$config['split_cat'] || !$cat_break) && $real_level == -1) { // if break, get the local max level if ($config['split_cat'] && $cat_break && $real_level == 0) { $max_level = 0; // the array is sorted $start = false; $stop = false; for ($i = 0; $i < sizeof($keys['id']) && !$stop; $i++) { if ($start && $tree['main'][$keys['idx'][$i]] == $tree['main'][$CH_this]) { $stop = true; $break; } if ($keys['id'][$i] == $cur) { $start = true; } if ($start && !$stop && $keys['level'][$i] > $max_level) { $max_level = $keys['level'][$i]; } } } $template->assign_block_vars('catrow', array('MAIN_CAT_ID' => $cur)); $template->assign_block_vars('catrow.tablehead', array('L_FORUM' => $CH_this < 0 ? $lang['Forum'] : get_object_lang($cur, 'name'), 'INC_SPAN' => $max_level + 2)); } // get the level $level = $keys['level'][$keys['keys'][$cur]]; // sub-forum view management $pull_down = true; if ($sub_forum > 0) { $pull_down = false; // JHL 2012/03/09 //if (($real_level == 0) && ($sub_forum == 1)) if ($real_level == 0 && ($sub_forum == 1 || $sub_forum == 3)) { $pull_down = true; } } if ($level >= 0) { // cat header row if ($tree['type'][$CH_this] == POST_CAT_URL && $pull_down) { // display a cat row $cat = $tree['data'][$CH_this]; $cat_id = $tree['id'][$CH_this]; // get the class colors $class_catLeft = 'cat'; $class_cat = 'cat'; $class_rowpic = 'rowpic'; // send to template $template->assign_block_vars('catrow', array('MAIN_CAT_ID' => $cur)); $template->assign_block_vars('catrow.cathead', array('CAT_TITLE' => get_object_lang($cur, 'name'), 'CAT_DESC' => preg_replace('/<[^>]+>/', '', get_object_lang($cur, 'desc')), 'CLASS_CATLEFT' => $class_catLeft, 'CLASS_CAT' => $class_cat, 'CLASS_ROWPIC' => $class_rowpic, 'INC_SPAN' => $max_level - $level + 2, 'U_VIEWCAT' => append_sid(CMS_PAGE_FORUM . '?' . POST_CAT_URL . '=' . $cat_id))); // add indentation to the display for ($k = 1; $k <= $level; $k++) { $template->assign_block_vars('catrow.cathead.inc', array('INC_CLASS' => $k % 2 ? $theme['td_class1'] : $theme['td_class2'])); } // something displayed $display = true; } } // forum header row if ($level >= 0) { if ($tree['type'][$CH_this] == POST_FORUM_URL || $tree['type'][$CH_this] == POST_CAT_URL && !$pull_down) { // get the data $data = $tree['data'][$CH_this]; $id = $tree['id'][$CH_this]; $type = $tree['type'][$CH_this]; $sub = !empty($tree['sub'][$cur]) && $tree['auth'][$cur]['tree.auth_view']; // specific to the data type $title = get_object_lang($cur, 'name'); $desc = get_object_lang($cur, 'desc'); // specific to something attached if ($sub) { $i_new = $images['forum_sub_unread']; $a_new = $lang['New_posts']; $i_norm = $images['forum_sub_read']; $a_norm = $lang['No_new_posts']; $i_locked = $images['forum_sub_locked_read']; $a_locked = $lang['Forum_locked']; } else { $i_new = $images['forum_nor_unread']; $a_new = $lang['New_posts']; $i_norm = $images['forum_nor_read']; $a_norm = $lang['No_new_posts']; $i_locked = $images['forum_nor_locked_read']; $a_locked = $lang['Forum_locked']; } // forum link type if ($tree['type'][$CH_this] == POST_FORUM_URL && !empty($tree['data'][$CH_this]['forum_link'])) { $i_new = $images['forum_link']; $a_new = $lang['Forum_link']; $i_norm = $images['forum_link']; $a_norm = $lang['Forum_link']; $i_locked = $images['forum_link']; $a_locked = $lang['Forum_link']; } // front icon $link_class = !empty($data['tree.unread_topics']) ? '-new' : ''; $folder_image = !empty($data['tree.unread_topics']) ? $i_new : $i_norm; $folder_alt = !empty($data['tree.unread_topics']) ? $a_new : $a_norm; if ($data['tree.locked']) { $folder_image = $i_locked; $folder_alt = $a_locked; } // moderators list $l_moderators = ''; $moderator_list = ''; if ($type == POST_FORUM_URL) { if (sizeof($forum_moderators[$id]) > 0) { $l_moderators = sizeof($forum_moderators[$id]) == 1 ? $lang['Moderator'] : $lang['Moderators']; $moderator_list = implode(', ', $forum_moderators[$id]); } } // last post $last_post = $lang['No_Posts']; if (isset($data['tree.forum_last_post_id']) && $data['tree.forum_last_post_id'] && (isset($data['tree.topic_last_post_auth']) && $data['tree.topic_last_post_auth'])) { $topic_title = htmlspecialchars_clean($data['tree.topic_title']); $topic_title_plain = $topic_title; $topic_title_short = $topic_title; // SMILEYS IN TITLE - BEGIN if ($config['smilies_topic_title'] && !$lofi) { $bbcode->allow_smilies = $config['allow_smilies'] ? true : false; $topic_title = $bbcode->parse_only_smilies($topic_title); } // SMILEYS IN TITLE - END $topic_title = empty($data['title_compl_infos']) ? $topic_title : $data['title_compl_infos'] . ' ' . $topic_title; if (strlen($topic_title) > intval($config['last_topic_title_length']) - 3) { // remove tags from the short version, in case a smiley or a quick title prefix is in there $topic_title_short = substr(strip_tags($topic_title), 0, intval($config['last_topic_title_length'])) . '...'; } $topic_title = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . (!empty($data['forum_id']) ? POST_FORUM_URL . '=' . $data['forum_id'] . '&' : '') . POST_POST_URL . '=' . $data['tree.forum_last_post_id']) . '#p' . $data['tree.forum_last_post_id'] . '" title="' . $topic_title_plain . '">' . $topic_title_short . '</a><br />'; $last_post_time = create_date_ip($config['default_dateformat'], $data['tree.post_time'], $config['board_timezone']); $last_post = $config['last_topic_title'] ? $topic_title : ''; $last_post .= $last_post_time . '<br />'; $last_post .= $data['tree.post_user_id'] == ANONYMOUS ? $data['tree.post_username'] . ' ' : colorize_username($data['tree.post_user_id'], $data['tree.post_username'], $data['tree.user_color'], $data['tree.user_active']); $last_post .= '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . (!empty($data['forum_id']) ? POST_FORUM_URL . '=' . $data['forum_id'] . '&' : '') . POST_POST_URL . '=' . $data['tree.forum_last_post_id']) . '#p' . $data['tree.forum_last_post_id'] . '" title="' . $topic_title_plain . '"><img src="' . ($data['tree.unread_topics'] ? $images['icon_newest_reply'] : $images['icon_latest_reply']) . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; } // links to sub-levels $links = ''; // JHL 2012/03/09 //if ($sub && (!$pull_down || (($type == POST_FORUM_URL) && ($sub_forum > 0))) && (intval($config['sub_level_links']) > 0)) if ($sub && (!$pull_down || $type == POST_FORUM_URL && $sub_forum > 0) && (intval($config['sub_level_links']) > 0 && $sub_forum != 3)) { for ($j = 0; $j < sizeof($tree['sub'][$cur]); $j++) { if ($tree['auth'][$tree['sub'][$cur][$j]]['auth_view']) { $wcur = $tree['sub'][$cur][$j]; $wthis = $tree['keys'][$wcur]; $wdata = $tree['data'][$wthis]; $wname = get_object_lang($wcur, 'name'); $wdesc = get_object_lang($wcur, 'desc'); switch ($tree['type'][$wthis]) { case POST_FORUM_URL: $wpgm = append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $tree['id'][$wthis]); break; case POST_CAT_URL: $wpgm = append_sid(CMS_PAGE_FORUM . '?' . POST_CAT_URL . '=' . $tree['id'][$wthis]); break; default: $wpgm = append_sid(CMS_PAGE_FORUM); break; } $link = ''; $wdesc = preg_replace('/<[^>]+>/', '', $wdesc); if (intval($config['sub_level_links']) == 2) { $wsub = !empty($tree['sub'][$wcur]) && $tree['auth'][$wcur]['tree.auth_view']; // specific to something attached if ($wsub) { $wi_new = $images['icon_minicat_new']; $wa_new = $lang['New_posts']; $wi_norm = $images['icon_minicat']; $wa_norm = $lang['No_new_posts']; $wi_locked = $images['icon_minicat_locked']; $wa_locked = $lang['Forum_locked']; } else { $wi_new = $images['icon_minipost_new']; $wa_new = $lang['New_posts']; $wi_norm = $images['icon_minipost']; $wa_norm = $lang['No_new_posts']; $wi_locked = $images['icon_minipost_lock']; $wa_locked = $lang['Forum_locked']; } // forum link type if ($tree['type'][$wthis] == POST_FORUM_URL && !empty($wdata['forum_link'])) { $wi_new = $images['icon_minilink']; $wa_new = $lang['Forum_link']; $wi_norm = $images['icon_minilink']; $wa_norm = $lang['Forum_link']; $wi_locked = $images['icon_minilink']; $wa_locked = $lang['Forum_link']; } // front icon $wfolder_image = $wdata['tree.unread_topics'] ? $wi_new : $wi_norm; $wfolder_alt = $wdata['tree.unread_topics'] ? $wa_new : $wa_norm; if ($wdata['tree.locked']) { $wfolder_image = $wi_locked; $wfolder_alt = $wa_locked; } if ($lofi == true) { $wlast_post = ''; } else { $wlast_post = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $wdata['tree.forum_last_post_id']) . '#p' . $wdata['tree.forum_last_post_id'] . '">'; $wlast_post .= '<img src="' . $wfolder_image . '" alt="' . $wfolder_alt . '" title="' . $wfolder_alt . '" /></a> '; } } $class = $wfolder_image == $wi_new ? 'forumlink2-new' : 'forumlink2'; if ($wname != '') { $link = '<a href="' . $wpgm . '" title="' . $wdesc . '" class="' . $class . '">' . $wname . '</a>'; } if ($link != '') { $links .= ($links != '' ? ', ' : '') . $wlast_post . $link; } } } } // forum icon $icon_img = empty($data['icon']) ? '' : (isset($images[$data['icon']]) ? $images[$data['icon']] : $data['icon']); // UPI2DB - BEGIN if ($user->data['upi2db_access']) { $folder_image_ar_big = $images['forum_nor_ar']; $cat_image_ar_big = $images['forum_sub_ar']; $forum_id = $data['forum_id']; if (!$data['tree.unread_topics'] && !$sub) { if (is_array($user->data['upi2db_unread']['always_read']['forums']) && !in_array($forum_id, $user->data['upi2db_unread']['always_read']['forums'])) { $mark_always_read = '<a href="' . append_sid(CMS_PAGE_FORUM . '?forum_id=' . $forum_id . '&always_read=set') . '"><img src="' . $folder_image . '" alt="' . $lang['upi2db_always_read_forum'] . '" title="' . $lang['upi2db_always_read_forum'] . '" /></a>'; } else { $mark_always_read = '<a href="' . append_sid(CMS_PAGE_FORUM . '?forum_id=' . $forum_id . '&always_read=unset') . '"><img src="' . $folder_image_ar_big . '" alt="' . $lang['upi2db_always_read_forum_unset'] . '" title="' . $lang['upi2db_always_read_forum_unset'] . '" /></a>'; } } else { if ($sub) { $mark_always_read = '<img src="' . $folder_image . '" alt="' . $lang['upi2db_cat_cant_mark_always_read'] . '" title="' . $lang['upi2db_cat_cant_mark_always_read'] . '" />'; } else { $mark_always_read = '<img src="' . $folder_image . '" alt="' . $folder_alt . '" title="' . $folder_alt . '" />'; } } } else { $mark_always_read = '<img src="' . $folder_image . '" alt="' . $folder_alt . '" title="' . $folder_alt . '" />'; } // UPI2DB - END if ($config['url_rw'] == true || $config['url_rw_guests'] == true && $user->data['user_id'] == ANONYMOUS) { $url_viewforum = $type == POST_FORUM_URL ? append_sid(str_replace('--', '-', make_url_friendly($title) . '-vf' . $id . '.html')) : append_sid(str_replace('--', '-', make_url_friendly($title) . '-vc' . $id . '.html')); } else { $url_viewforum = $type == POST_FORUM_URL ? append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $id) : append_sid(CMS_PAGE_FORUM . '?' . POST_CAT_URL . '=' . $id); } // send to template if ($config['show_rss_forum_icon'] && $data['forum_index_icons'] == 1 && $type == POST_FORUM_URL) { $rss_feed_icon = ''; if (!$data['tree.locked'] && $user->data['session_logged_in']) { $rss_feed_icon .= ' <a href="' . append_sid(CMS_PAGE_POSTING . '?mode=newtopic&' . POST_FORUM_URL . '=' . $id) . '"><img src="' . $images['vf_topic_nor'] . '" alt="' . $lang['Post_new_topic'] . '" title="' . $lang['Post_new_topic'] . '" /></a>'; } $rss_feed_icon .= ' <a href="' . append_sid('rss.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $id) . '"><img src="' . $images['nav_menu_feed'] . '" alt="' . $lang['Rss_news_feeds'] . '" title="' . $lang['Rss_news_feeds'] . '" /></a>'; } else { $rss_feed_icon = ' '; } $template->assign_block_vars('catrow', array()); $template->assign_block_vars('catrow.forumrow', array('FORUM_FOLDER_IMG' => $folder_image, 'ICON_IMG' => $icon_img, 'RSS_FEED_ICON' => $rss_feed_icon, 'FORUM_NAME' => $title, 'FORUM_DESC' => $desc, 'FORUM_TYPE' => $type == POST_FORUM_URL ? 'forum' : 'category', 'POSTS' => $data['tree.forum_posts'], 'TOPICS' => $data['tree.forum_topics'], 'ONLINE' => $config['show_forums_online_users'] == true ? '<br />' . $lang['Online'] . ': ' . $data['tree.forum_online'] : '', 'LAST_POST' => $last_post, 'MODERATORS' => $moderator_list, 'L_MODERATOR' => empty($moderator_list) ? '' : (empty($l_moderators) ? '<br />' : '<br /><b>' . $l_moderators . ':</b> '), 'L_LINKS' => empty($links) ? '' : (empty($lang['Subforums']) ? '' : '<b>' . $lang['Subforums'] . ':</b> '), 'LINKS_BR' => empty($links) ? '' : '<br />', 'LINKS_ROWSPAN' => empty($links) ? '' : ' rowspan="2"', 'LINKS' => $links, 'L_FORUM_FOLDER_ALT' => $folder_alt, 'U_MARK_ALWAYS_READ' => $mark_always_read, 'L_POST_NEW_TOPIC' => $lang['Post_new_topic'], 'U_VIEWFORUM' => $url_viewforum, 'U_POST_NEW_TOPIC' => append_sid(CMS_PAGE_POSTING . '?mode=newtopic&' . POST_FORUM_URL . '=' . $id), 'LINK_CLASS' => $link_class, 'INC_SPAN' => $max_level - $level + 1, 'INC_CLASS' => !($level % 2) ? $theme['td_class1'] : $theme['td_class2'])); // display icon if (!empty($icon_img)) { $template->assign_block_vars('catrow.forumrow.forum_icon', array()); } // add indentation to the display for ($k = 1; $k <= $level; $k++) { $template->assign_block_vars('catrow.forumrow.inc', array('INC_CLASS' => $k % 2 ? $theme['td_class1'] : $theme['td_class2'])); } // forum link type if ($tree['type'][$CH_this] == POST_FORUM_URL && !empty($tree['data'][$CH_this]['forum_link'])) { $s_hit_count = ''; if ($tree['data'][$CH_this]['forum_link_hit_count']) { $s_hit_count = sprintf($lang['Forum_link_visited'], $tree['data'][$CH_this]['forum_link_hit']); } $template->assign_block_vars('catrow.forumrow.forum_link', array('HIT_COUNT' => $s_hit_count)); } else { $template->assign_block_vars('catrow.forumrow.forum_link_no', array()); } // something displayed $display = true; } } // display sub-levels if (!empty($tree['sub'][$cur])) { for ($i = 0; $i < sizeof($tree['sub'][$cur]); $i++) { if (!empty($keys['keys'][$tree['sub'][$cur][$i]])) { $wdisplay = build_index($tree['sub'][$cur][$i], $cat_break, $forum_moderators, $level + 1, $max_level, $keys); if ($wdisplay) { $display = true; } } } } if ($level >= 0) { // forum footer row if ($tree['type'][$CH_this] == POST_FORUM_URL) { } } if ($level >= 0) { // cat footer if ($tree['type'][$CH_this] == POST_CAT_URL && $pull_down) { $template->assign_block_vars('catrow', array()); $template->assign_block_vars('catrow.catfoot', array('INC_SPAN' => $max_level - $level + 5)); // add indentation to the display for ($k = 1; $k <= $level; $k++) { $template->assign_block_vars('catrow.catfoot.inc', array('INC_SPAN' => $max_level - $level + 5, 'INC_CLASS' => $k % 2 ? $theme['td_class1'] : $theme['td_class2'])); } } } // root level footer if ($config['split_cat'] && $cat_break && $real_level == 0 || (!$config['split_cat'] || !$cat_break) && $real_level == -1) { $template->assign_block_vars('catrow', array()); $template->assign_block_vars('catrow.tablefoot', array()); } return $display; }
/** * Saves the submitted story to the database */ public function processSubmission($h, $key) { $h->post->id = $h->cage->post->getInt('submit_post_id'); if ($h->post->id) { $h->readPost(); } // read what we've already got for this post // get the last submitted data by this user: $submitted_data = $this->loadSubmitData($h, $key); $editorial = $submitted_data['submit_editorial']; /* MOST PROBLEMS ARE CAUSED BY THESE LINES: BE VERY CAREFUL HERE BECAUSE WHAT MIGHT WORK FOR POST SUBMISSION COULD SCREW UP EDIT POST OR WHAT MIGHT WORK FOR EDITORIALS MIGHT SCREW UP NON-EDITORIALS AND VICE-VERSA. THE FOLLOWING WORKS FOR ALL (I think) */ if ($editorial) { $h->post->origUrl = "self"; } if ($submitted_data['submit_orig_url']) { $h->post->origUrl = $submitted_data['submit_orig_url']; } /* MOST PROBLEMS ARE CAUSED BY THE ABOVE LINES: */ if ($h->post->origUrl == "self") { $h->post->domain = get_domain(urldecode(BASEURL)); // returns domain including http:// } else { $h->post->domain = get_domain(urldecode($h->post->origUrl)); // returns domain including http:// } $h->post->title = $submitted_data['submit_title']; $title = html_entity_decode($h->post->title, ENT_QUOTES, 'UTF-8'); $h->post->url = make_url_friendly($title); $h->post->content = $submitted_data['submit_content']; $h->post->type = 'news'; // This is the type we use to distinguish social bookmarking from forums, blogs, etc. if (!$h->post->id) { $h->post->author = $h->currentUser->id; } // no author yet if (isset($submitted_data['submit_status'])) { $h->post->status = $submitted_data['submit_status']; } else { $h->post->status = 'processing'; } if (isset($submitted_data['submit_category'])) { $h->post->category = $submitted_data['submit_category']; } if (isset($submitted_data['submit_tags'])) { $h->post->tags = $submitted_data['submit_tags']; } $h->vars['submitted_data'] = $submitted_data; $h->pluginHook('submit_2_process_submission'); if ($h->post->id != 0) { $h->updatePost(); // Updates an existing post (e.g. returning to step 2 from step 3 to modify it) } else { $h->addPost(); // Adds a new post // Now that the post is in the database with an ID and category assigned, we can get its url and update that field: if ($h->post->origUrl == "self") { $post_id = $h->post->vars['last_insert_id']; $h->post->origUrl = $h->url(array('page' => $post_id)); // update the url with the real one $sql = "UPDATE " . TABLE_POSTS . " SET post_orig_url = %s WHERE post_id = %d"; $query = $h->db->prepare($sql, urlencode($h->post->origUrl), $post_id); $h->db->query($query); } // tidy up by deleting all processing posts older than 30 minutes: $h->deleteProcessingPosts(); } }
} if ($html) { $msg .= '<h3>' . $lang['digest_topic'] . '<a href="' . $topic_url . '">' . $row2['topic_title'] . '</a></h3>' . $line_break; $msg .= '<table class="forumline tw98pct">' . $line_break; } else { $msg .= $line_break . "<< " . $lang['digest_topic'] . ' ' . $row2['topic_title'] . ', ' . $topic_url . " >>" . $line_break . $line_break; } } // Show message information if (!empty($config['url_rw'])) { $post_url = DIGEST_SITE_URL . str_replace ('--', '-', make_url_friendly($row2['topic_title']) . '-vp' . $row2['post_id'] . '.html#p' . $row2['post_id']); } else { $post_url = DIGEST_SITE_URL . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $row2['post_id'] . '#p' . $row2['post_id']; } if ($html) { $msg .= '<tr>' . $line_break; $msg .= '<th style="text-align: left;">' . $lang['digest_link'] . ': <a href="' . $post_url . '">' . $row2['post_id'] . '</a> - ' . $lang['digest_post_time'] . ': ' . $display_time . ' ' . gmdate('T', $row2['post_time']) . ' - ' . $lang['digest_author'] . ': ' . $row2['Posted by'] . '</th>' . $line_break; $msg .= '</tr>' . $line_break; if ($show_text) { /* // Remove BBCode and replace \n with <br />, makes for nicer presentation $this_msg = '<td>' . preg_replace('/\[\S+\]/', '', $post_text) . '</td>';
{ $redirect = str_replace ('--', '-', make_url_friendly($subject) . '-vt' . $topic_id . '.html'); } // If the above URL points to a location outside the phpBB directories // move the slashes on the next line to the start of the following line: //redirect(append_sid($redirect, true), true); redirect(append_sid($redirect, true)); } elseif (($mode == 'reply') || ($mode == 'editpost') || ($mode == 'newtopic')) { // URL for redirection after posting or editing a post $redirect = CMS_PAGE_VIEWTOPIC . '?' . (!empty($forum_id_append) ? ($forum_id_append . '&') : '') . (!empty($topic_id_append) ? ($topic_id_append . '&') : '') . POST_POST_URL . '=' . $post_id; $post_append = '#p' . $post_id; if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS))) { $redirect = str_replace ('--', '-', make_url_friendly($subject) . '-vp' . $post_id . '.html'); } // If the above URL points to a location outside the phpBB directories // move the slashes on the next line to the start of the following line: //redirect(append_sid($redirect, true) . $post_append, true); redirect(append_sid($redirect, true) . $post_append); } // MOD: Redirect to Post (normal post) - END $template->assign_vars(array('META' => $return_meta)); message_die(GENERAL_MESSAGE, $return_message); } } $notes = ''; if($refresh || isset($_POST['del_poll_option']) || ($error_msg != '')) {
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $l_edit_id, create_date($config['default_dateformat'], $row['post_edit_time'], $config['board_timezone']), $row['post_edit_count']); } else { $l_edited_by = ''; } if ($row['enable_autolinks_acronyms']) { $message = $bbcode->acronym_pass($message); $message = $bbcode->autolink_text($message, $forum_id); } if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS))) { $mini_post_url = str_replace ('--', '-', make_url_friendly($row['post_subject']) . '-vp' . $row['post_id'] . '.html#p' . $row['post_id']); } else { $mini_post_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $row['post_id']) . '#p' . $row['post_id']; } // Again this will be handled by the templating code at some point $row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('postrow', array( 'DOWNLOAD_POST' => append_sid(CMS_PAGE_VIEWTOPIC . '?download=' . $row['post_id'] . '&' . POST_TOPIC_URL . '=' .$topic_id), 'ROW_CLASS' => $row_class, 'POSTER_NAME' => $poster, 'POSTER_NAME_NL' => $poster_no_link, // Mighty Gorgon - Multiple Ranks - BEGIN
// End session management $topic_title = request_var('topic_title', '', true); $topic_id = request_var('topic_id', 0); $topic_url = request_var('topic_url', '', true); $message = request_var('message', '', true); $PHP_SELF = $_SERVER['SCRIPT_NAME']; if (!$user->data['session_logged_in']) { redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=' . 'tellafriend.' . PHP_EXT . '&topic_title=' . urlencode($topic_title) . '&topic_id=' . $topic_id .'&topic_url=' . urlencode($topic_url), true)); } if (($config['url_rw'] == true) || ($config['url_rw_guests'] == true)) { $topic_link = create_server_url() . make_url_friendly($topic_title) . '-vt' . $topic_id . '.html'; } else { $topic_link = create_server_url() . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id; } // Was an URl sent instead of a topic id? if (($topic_id == 0) && ($topic_url != '')) { $topic_link = create_server_url() . $topic_url; } $mail_body = str_replace("{TOPIC}", htmlspecialchars_decode($topic_title), $lang['TELL_FRIEND_BODY']); $mail_body = str_replace("{LINK}", $topic_link, $mail_body); $mail_body = str_replace("{SITENAME}", $config['sitename'], $mail_body);
function url_replace_callback_kb2($matches) { //"make_url_friendly('\\6') . '-kba\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'", return make_url_friendly($matches[6]) . '-kba' . $matches[1] . '.html' . if_query($matches[2]) . stripslashes($matches[5] . $matches[6]) . '</a>'; }
function check_restricted_words($str) { $str = make_url_friendly($str, " "); $words = array_filter(explode(" ", $str), "remove_empty"); foreach ($words as $value) { $checkQ = db_query("SELECT 1\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\temprivo.restricted_words\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tword = '" . $value . "'"); if (db_num_rows($checkQ)) { return false; } } # no restricted words found return true; }
$topic_priority = $config['sitemap_sticky_priority']; break; default: $topic_priority = $config['sitemap_default_priority']; } if ($topic['topic_status'] == 1) { $topic_change = 'never'; } else { $topic_change = 'always'; } if ( ($config['url_rw'] == '1') || ( ($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS) ) ) { $url = $server_url. str_replace ('--', '-', make_url_friendly($topic['topic_title']) . '-vt' . $topic['topic_id'] . '.html'); } else { $url = $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic['topic_id']; } $template->assign_block_vars('topics', array( 'TOPIC_URL' => $url, 'TOPIC_TIME' => gmdate('Y-m-d\TH:i:s'.'+00:00', $topic['post_time']), 'TOPIC_PRIORITY' => $topic_priority, 'TOPIC_CHANGE' => $topic_change ) ); $lasttopic = $topic['topic_id']; }
function display_files($sort_method, $sort_order, $start, $show_file_message, $cat_id = false) { global $db, $config, $template, $images, $lang; global $pafiledb_config, $pafiledb_functions; $filelist = false; if (empty($cat_id)) { $cat_where = ''; } else { $cat_where = "AND f1.file_catid = {$cat_id}"; } $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) AS total_comments\n\t\t\tFROM " . PA_FILES_TABLE . " AS f1\n\t\t\t\tLEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file\n\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id\n\t\t\t\tLEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id\n\t\t\tWHERE f1.file_pin = " . FILE_PINNED . "\n\t\t\tAND f1.file_approved = 1\n\t\t\t{$cat_where}\n\t\t\tGROUP BY f1.file_id\n\t\t\tORDER BY {$sort_method} {$sort_order}"; $result = $db->sql_query($sql); $file_rowset = array(); $total_file = 0; while ($row = $db->sql_fetchrow($result)) { if ($this->auth[$row['file_catid']]['auth_read']) { $file_rowset[] = $row; } } $db->sql_freeresult($result); $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id)\n\t\t\tFROM " . PA_FILES_TABLE . " AS f1\n\t\t\t\tLEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file\n\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id\n\t\t\t\tLEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id\n\t\t\tWHERE f1.file_pin <> " . FILE_PINNED . "\n\t\t\tAND f1.file_approved = 1\n\t\t\t{$cat_where}\n\t\t\tGROUP BY f1.file_id\n\t\t\tORDER BY {$sort_method} {$sort_order}"; if (!($result = $pafiledb_functions->sql_query_limit($sql, $pafiledb_config['settings_file_page'], $start))) { message_die(GENERAL_ERROR, 'Couldn\'t get file info for this category', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { if ($this->auth[$row['file_catid']]['auth_read']) { $file_rowset[] = $row; } } $db->sql_freeresult($result); $where_sql = !empty($cat_id) ? "AND file_catid = {$cat_id}" : ''; $sql = "SELECT COUNT(file_id) as total_file\n\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\tWHERE file_approved='1'\n\t\t\t{$where_sql}"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $total_file = $row['total_file']; unset($row); for ($i = 0; $i < sizeof($file_rowset); $i++) { //=================================================== // Format the date for the given file //=================================================== $date = create_date_ip($config['default_dateformat'], $file_rowset[$i]['file_time'], $config['board_timezone']); //=================================================== // Get rating for the file and format it //=================================================== //$rating = ($file_rowset[$i]['rating'] != 0) ? round($file_rowset[$i]['rating'], 2) . ' / 10' : $lang['Not_rated']; //$rating2 = ($file_rowset[$i]['rating'] != 0) ? sprintf("%.1f", round(($file_rowset[$i]['rating']), 0)/2) : '0.0'; $rating2 = $file_rowset[$i]['rating'] != 0 ? sprintf("%.1f", round($file_rowset[$i]['rating'], 0) / 2) : '0.0'; //=================================================== // If the file is new then put a new image in front of it //=================================================== $is_new = false; if (time() - $pafiledb_config['settings_newdays'] * 24 * 60 * 60 < $file_rowset[$i]['file_time']) { $is_new = true; } $cat_name = empty($cat_id) ? $this->cat_rowset[$file_rowset[$i]['file_catid']]['cat_name'] : ''; $cat_url = append_sid('dload.' . PHP_EXT . '?action=category&cat_id=' . $file_rowset[$i]['file_catid']); //=================================================== // Get the post icon fot this file //=================================================== if ($file_rowset[$i]['file_pin'] != FILE_PINNED) { if ($file_rowset[$i]['file_posticon'] == 'none' || $file_rowset[$i]['file_posticon'] == 'none.gif') { $posticon = IP_ROOT_PATH . FILES_ICONS_DIR . 'default.png'; } else { $posticon = IP_ROOT_PATH . FILES_ICONS_DIR . $file_rowset[$i]['file_posticon']; } } else { $posticon = IP_ROOT_PATH . $images['forum_link']; } //echo $posticon; //=================================================== // Assign Vars //=================================================== $xs_new = $is_new ? '-new' : ''; if ($config['url_rw'] == '1' || $config['url_rw_guests'] == '1' && $user->data['user_id'] == ANONYMOUS) { $url_file = append_sid(str_replace('--', '-', make_url_friendly($file_rowset[$i]['file_name']) . '-df' . $file_rowset[$i]['file_id'] . '.html')); } else { $url_file = append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_rowset[$i]['file_id']); } //$url_file = append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_rowset[$i]['file_id']); $template->assign_block_vars('file_rows', array('L_NEW_FILE' => $lang['New_file'], 'PIN_IMAGE' => $posticon, 'FILE_NEW_IMAGE' => IP_ROOT_PATH . $images['pa_file_new'], 'HAS_SCREENSHOTS' => !empty($file_rowset[$i]['file_ssurl']) ? true : false, 'SS_AS_LINK' => $file_rowset[$i]['file_sshot_link'] ? true : false, 'FILE_SCREENSHOT' => $file_rowset[$i]['file_ssurl'], 'FILE_SCREENSHOT_URL' => IP_ROOT_PATH . 'images/screenshot.gif', 'FILE_NAME' => $file_rowset[$i]['file_name'], 'FILE_DESC' => $file_rowset[$i]['file_desc'], 'FILE_SIZE' => get_formatted_filesize($file_rowset[$i]['file_size']), 'DATE' => $date, 'RATING' => $rating2, 'FILE_DLS' => $file_rowset[$i]['file_dls'], 'CAT_NAME' => $cat_name, 'IS_NEW_FILE' => $is_new, 'XS_NEW' => $xs_new, 'U_CAT' => $cat_url, 'U_FILE' => $url_file, 'U_FILE_EDIT' => append_sid('dload.' . PHP_EXT . '?action=user_upload&file_id=' . $file_rowset[$i]['file_id']))); $filelist = true; } if ($filelist) { $action = empty($cat_id) ? 'viewall' : 'category&cat_id=' . $cat_id; $template->assign_vars(array('L_CATEGORY' => $lang['Category'], 'L_RATING' => $lang['DlRating'], 'L_DOWNLOADS' => $lang['Dls'], 'L_DATE' => $lang['Date'], 'L_NAME' => $lang['Name'], 'L_FILE' => $lang['File'], 'L_FILE_SIZE' => $lang['File_size'], 'L_UPDATE_TIME' => $lang['Update_time'], 'L_SCREENSHOTS' => $lang['Scrsht'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'L_ASC' => $lang['Sort_Ascending'], 'L_DESC' => $lang['Sort_Descending'], 'SORT_NAME' => $sort_method == 'file_name' ? 'selected="selected"' : '', 'SORT_TIME' => $sort_method == 'file_time' ? 'selected="selected"' : '', 'SORT_RATING' => $sort_method == 'rating' ? 'selected="selected"' : '', 'SORT_DOWNLOADS' => $sort_method == 'file_dls' ? 'selected="selected"' : '', 'SORT_UPDATE_TIME' => $sort_method == 'file_update_time' ? 'selected="selected"' : '', 'SORT_ASC' => $sort_order == 'ASC' ? 'selected="selected"' : '', 'SORT_DESC' => $sort_order == 'DESC' ? 'selected="selected"' : '', 'PAGINATION' => generate_pagination(append_sid('dload.' . PHP_EXT . '?action=' . $action . '&sort_method=' . $sort_method . '&sort_order=' . $sort_order), $total_file, $pafiledb_config['settings_file_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $pafiledb_config['settings_file_page']) + 1, ceil($total_file / $pafiledb_config['settings_file_page'])), 'FILELIST' => $filelist, 'ID' => $cat_id, 'START' => $start, 'S_ACTION_SORT' => append_sid('dload.' . PHP_EXT . '?action=' . $action))); } else { $template->assign_vars(array('NO_FILE' => $show_file_message, 'L_NO_FILES' => $lang['No_files'], 'L_NO_FILES_CAT' => $lang['No_files_cat'])); } }
/** * Add a new category * * @param int $parent * @param str $new_cat_name * @return bool */ public function addCategory($h, $parent = 0, $new_cat_name = '') { $sql = "SELECT category_order FROM " . TABLE_CATEGORIES . " WHERE category_id = %d"; $category_order = $h->db->get_var($h->db->prepare($sql, $parent)); $position = $category_order + 1; // our new category will go right after the parent category // return false if duplicate name $sql = "SELECT category_name FROM " . TABLE_CATEGORIES . " WHERE category_name = %s"; $exists = $h->db->get_var($h->db->prepare($sql, $new_cat_name)); if ($exists) { return false; } // increment category_order for all categories after the parent: $sql = "SELECT category_id, category_name, category_order FROM " . TABLE_CATEGORIES . " WHERE category_order > %d ORDER BY category_order ASC"; $categories = $h->db->get_results($h->db->prepare($sql, $category_order)); if ($categories) { foreach ($categories as $category) { $sql = "UPDATE " . TABLE_CATEGORIES . " SET category_order = category_order+1, category_updateby = %d WHERE category_id = %d"; $h->db->query($h->db->prepare($sql, $h->currentUser->id, $category->category_id)); } } //insert new category after parent category: $sql = "INSERT INTO " . TABLE_CATEGORIES . " (category_parent, category_name, category_safe_name, category_order, category_updateby) VALUES (%d, %s, %s, %d, %d)"; $h->db->query($h->db->prepare($sql, $parent, $new_cat_name, make_url_friendly($new_cat_name), $position, $h->currentUser->id)); $this->rebuildTree($h, 1, 0); // // refresh data in memcache // if ($h->memCache) { // $this->setCatMemCache($h); // } return true; }
function album_build_index($user_id, &$keys, $cur_cat_id = ALBUM_ROOT_CATEGORY, $real_level = ALBUM_ROOT_CATEGORY, $max_level = ALBUM_ROOT_CATEGORY, $newestpic = NULL) { global $template, $db, $config, $album_config, $lang, $images, $user, $album_data; // init some variables $display = false; $moderators = ''; $last_pic_info = ''; $cat_total_comments = 0; $album_show_pic_url = 'album_showpage.' . PHP_EXT; // display the level $AH_this = isset($album_data['keys'][$cur_cat_id]) ? $album_data['keys'][$cur_cat_id] : ALBUM_ROOT_CATEGORY; // root level head if ($real_level == ALBUM_ROOT_CATEGORY || !is_array($keys)) { // get max inc level $keys = array(); $keys = album_get_auth_keys($cur_cat_id, ALBUM_AUTH_VIEW); //, true, -1, -1); $max_level = album_get_max_depth($keys, ALBUM_AUTH_VIEW, $cur_cat_id); //, false); $newestpic = album_no_newest_pictures($album_config['new_pic_check_interval'], $album_data['id']); } // get the level $level = $keys['level'][$keys['keys'][$cur_cat_id]]; // if 'top level category, then write the link to it if ($level == ALBUM_ROOT_CATEGORY + 1) { $links = ''; $newpics_sub_link = ''; $total_pics = 0; $first_pic_id = 0; $last_pic_id = 0; $sub_total_pics = 0; $total_comments = 0; // display a cat row $cat = $album_data['data'][$AH_this]; $cat_id = $cat['cat_id']; // sub categories for current category $cats = array(); // specific to the data type $title = album_get_object_lang($cur_cat_id, 'name'); $desc = album_get_object_lang($cur_cat_id, 'desc'); // get all the cat id for current cat and it's subs, $cats will hold all the ids album_get_sub_cat_ids($cat_id, $cats, ALBUM_AUTH_VIEW, ALBUM_INCLUDE_PARENT_ID); // we got the cat_id, we now need to get the value for the next sub category for this category for ($j = 0; $j < sizeof($album_data['sub'][$cur_cat_id]); $j++) { $link = ''; // get the 'cur' for the current sub category $subcur = $album_data['sub'][$cur_cat_id][$j]; // get the keys for current iterated sub level $subthis = $album_data['keys'][$subcur]; if ($album_data['auth'][$subcur]['view'] == 0) { continue; } // get the row data for current iterated sub level $subdata = $album_data['data'][$subthis]; // get the name of the category $subname = album_get_object_lang($subcur, 'name'); // get the description of the category $subdesc = album_get_object_lang($subcur, 'desc'); $subpgm = append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $album_data['id'][$subthis])); // the number of picture for the sub category (only one level down) $sub_cats = array(); // get the all the sub category ids for this sub category album_get_sub_cat_ids($subcur, $sub_cats, ALBUM_AUTH_VIEW, ALBUM_INCLUDE_PARENT_ID); // get the number of pictures in current sub category and its sub categories $sub_total_pics = album_get_total_pics($sub_cats); $new_images_flag = false; for ($i = 0; $i < sizeof($sub_cats); $i++) { $total_new = $total_new + $newestpic[$sub_cats[$i]]; if ($new_images_flag == false && $total_new > 0) { $new_images_flag = true; } } // are they any pictures in the current category ? // then display it after the category name (only sub) switch (intval($sub_total_pics)) { case 0: $sub_total_pics = sprintf($lang['Multiple_Sub_Total_Pics'], $sub_total_pics); break; case 1: $sub_total_pics = sprintf($lang['One_Sub_Total_Pics'], $sub_total_pics); break; default: $sub_total_pics = sprintf($lang['Multiple_Sub_Total_Pics'], $sub_total_pics); } if ($subname != '') { $total = 0; // calculate for all the subcats in this branch for ($i = 0; $i < sizeof($sub_cats); $i++) { $total = $total + $newestpic[$sub_cats[$i]]; } //$last_pic_id = album_get_last_pic_id($album_data['sub'][$cur_cat_id][$j]); $new_images_class = $total > 0 ? '-new' : ''; $xs_new = $total > 0 ? '-new' : ''; $slideshow_img_xs = $xs_new ? $images['icon_minipost_new'] : $images['icon_minipost']; $link_spacer = '<img src="' . $images['spacer'] . '" width="1" height="0" />'; $subfolder_img = '<img src="' . $slideshow_img_xs . '" style="vertical-align: middle;" title="' . $sub_total_pics . '" alt="' . $sub_total_pics . '"/>'; $sub_cat_separator = $i != count($sub_cats) ? ',' : ''; //$slideshow_link = append_sid(album_append_uid("album_showpage." . PHP_EXT . "?pic_id=" . $last_pic_id . "&slideshow=5")); $link = $link_spacer . $subfolder_img . ' <a href="' . $subpgm . '" title="' . $subdesc . '" class="forumlink2' . $new_images_class . '"><b>' . $subname . '</b></a><b>' . $sub_cat_separator . '</b> '; } if ($link != '') { $total = 0; // calculate for all the subcats in this branch for ($i = 0; $i < sizeof($sub_cats); $i++) { $total = $total + $newestpic[$sub_cats[$i]]; } // Mighty Gorgon - Slideshow - BEGIN $ss_cat_id = $album_data['sub'][$cur_cat_id][$j]; if (album_get_total_pic_cat($ss_cat_id) > 0 && $album_config['show_slideshow']) { //$xs_new = ($total > 0) ? '-new' : ''; $first_pic_id = album_get_first_pic_id($cur_cat_id); $last_pic_id = album_get_last_pic_id($ss_cat_id); $slideshow_link = append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $last_pic_id . '&slideshow=5')); $slideshow_link_full = '[<a href="' . $slideshow_link . '">' . $lang['Slideshow'] . '</a>]'; //$slideshow_link_full = '<a href="' . $slideshow_link . '">' . $lang['Slideshow'] . ' ' . $slideshow_img . '</a>'; } else { $slideshow_link_full = ''; } // Mighty Gorgon - Slideshow - END if ($total > 0) { $new_text = $total == 1 ? sprintf($lang['One_new_picture'], $total) : sprintf($lang['Multiple_new_pictures'], $total); $newpics_sub_link = ' <img src="' . $images['mini_new_pictures'] . '" alt="' . $new_text . '" title="' . $new_text . '"> '; $link = $link . $slideshow_link_full; } if ($album_config['line_break_subcats'] == 1) { $links .= $links != '' ? $link . '<br /> ' : '<br /> ' . $link . '<br /> '; } else { $links .= $links != '' ? ', ' . $link : $link; } } } // for .... // is there a moderator group for this category ? if ($cat['cat_moderator_groups'] != '') { // if we got some moderators AND some sub categories, // then make sure the sub categories are on a new line if (!empty($links) && ($moderators = album_get_moderator_info($cat)) != '') { $moderators .= '<br />'; } } $cat_desc = album_get_object_lang($cur_cat_id, 'desc'); if (!empty($cat_desc) && !empty($links)) { $cat_desc .= '<br />'; } // Mighty Gorgon - Slideshow - BEGIN $new_images = intval($newestpic[$cur_cat_id]) != 0 || $new_images_flag ? true : false; $xs_new = intval($newestpic[$cur_cat_id]) != 0 || $new_images_flag ? '-new' : ''; if (album_get_total_pic_cat($cur_cat_id) > 0 && $album_config['show_slideshow']) { $first_pic_id = album_get_first_pic_id($cur_cat_id); $slideshow_img_xs = $xs_new ? $images['icon_newest_reply'] : $images['icon_latest_reply']; $slideshow_img = '<img src="' . $slideshow_img_xs . '" alt="' . $lang['Slideshow'] . '" title="' . $lang['Slideshow'] . '" />'; $slideshow_link = append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $first_pic_id . '&slideshow=5')); $slideshow_link_full = ' [<a href="' . $slideshow_link . '">' . $lang['Slideshow'] . '</a>] '; } else { $slideshow_link_full = ''; } // Mighty Gorgon - Slideshow - END if ($xs_new) { $cat_img = intval(sizeof($sub_cats)) > 0 ? $images['forum_sub_unread'] : ($cat_img = $images['forum_nor_unread']); } else { $cat_img = intval(sizeof($sub_cats)) > 0 ? $images['forum_sub_read'] : ($cat_img = $images['forum_nor_read']); } if ($config['url_rw'] == '1' || $config['url_rw_guests'] == '1' && $user->data['user_id'] == ANONYMOUS) { $cat_url = append_sid(str_replace('--', '-', make_url_friendly(album_get_object_lang($cur_cat_id, 'name')) . '-ac' . $cat_id . '.html')); } else { $cat_url = append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)); } // send all the data to the template, except for the sub categories links $template->assign_block_vars('catmain', array()); $template->assign_block_vars('catmain.catrow', array('CAT_TITLE' => album_get_object_lang($cur_cat_id, 'name'), 'CAT_IMG' => $cat_img, 'SLIDESHOW' => $slideshow_link_full, 'CAT_DESC' => $cat_desc, 'XS_NEW' => $xs_new, 'U_VIEWCAT' => $cat_url, 'L_MODERATORS' => empty($moderators) ? '' : $lang['Moderators'] . ' :', 'MODERATORS' => $moderators)); if (intval($newestpic[$cur_cat_id]) != 0) { $new_text = $newestpic[$cur_cat_id] > 1 ? sprintf($lang['Multiple_new_pictures'], $newestpic[$cur_cat_id]) : sprintf($lang['One_new_picture'], $newestpic[$cur_cat_id]); $xs_new = intval($newestpic[$cur_cat_id]) != 0 ? '-new' : ''; $template->assign_block_vars('catmain.catrow.newpics', array('I_NEWEST_PICS' => $images['mini_new_pictures'], 'L_NEWEST_PICS' => $new_text)); } if ($album_config['show_index_total_pics'] == 1) { // get the total amount of pictures for current category and its sub categories $template->assign_block_vars('catmain.catrow.total_pics', array('TOTAL_PICS' => album_get_total_pics($cats))); } if ($album_config['show_index_total_comments'] == 1) { // the total number of comments for current category and its sub categories $template->assign_block_vars('catmain.catrow.total_comments', array('TOTAL_COMMENTS' => album_get_comment_count($cats))); } if ($album_config['show_index_pics'] == 1) { $template->assign_block_vars('catmain.catrow.pics', array('PICS' => $cat['count'])); } if ($album_config['show_index_comments'] == 1) { $cat_total_comments = album_get_comment_count($cat_id); $template->assign_block_vars('catmain.catrow.comments', array('COMMENTS' => empty($cat_total_comments) ? 0 : $cat_total_comments)); } if ($album_config['show_index_last_comment'] == 1) { $last_comment_info = album_get_last_comment_info($cats); $template->assign_block_vars('catmain.catrow.last_comment', array('LAST_COMMENT_INFO' => empty($last_comment_info) ? $lang['No_Comment_Info'] : $last_comment_info)); } if ($album_config['show_index_last_pic'] == 1) { // get the last picture information and the last comment information $last_pic_info = album_get_last_pic_info($cats, $last_pic_id); $template->assign_block_vars('catmain.catrow.last_pic', array('LAST_PIC_INFO' => empty($last_pic_info) ? $lang['No_Pics'] : $last_pic_info)); } if ($album_config['show_index_thumb'] == 1) { // add the index thumbnail picture to the template if ($last_pic_id == 0 || $album_config['show_index_last_pic'] == 0) { album_get_last_pic_info($cats, $last_pic_id); } if ($album_config['fullpic_popup'] == 0) { $pic_url_sid = append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $last_pic_id)); $pic_target = '_self'; } else { $pic_url_sid = append_sid(album_append_uid('album_pic.' . PHP_EXT . '?pic_id=' . $last_pic_id)); $pic_target = '_blank'; } $pic_thumb_sid = append_sid(album_append_uid('album_thumbnail.' . PHP_EXT . '?pic_id=' . $last_pic_id)); if ($album_config['show_img_no_gd'] == 1) { //$thumb_size = 'width="' . $album_config['thumbnail_size'] . '" height="' . $album_config['thumbnail_size'] . '"'; $thumb_size = 'width="' . $album_config['thumbnail_size'] . '"'; } else { $thumb_size = ''; } if ($last_pic_id == 0) { $pic_url = ''; } else { $pic_url = '<a href="' . $pic_url_sid . '" target="' . $pic_target . '"><img src="' . $pic_thumb_sid . '" ' . $thumb_size . ' alt="' . $lang['Last_Index_Thumbnail'] . '" title="' . $lang['Last_Index_Thumbnail'] . '" /></a>'; } $template->assign_block_vars('catmain.catrow.thumb', array('LAST_PIC_URL' => $pic_url)); } // add the sub category links row to the template if (!empty($links)) { if ($user_id == ALBUM_PUBLIC_GALLERY && $album_config['show_index_subcats'] == 1 || $user_id != ALBUM_PUBLIC_GALLERY && $album_config['personal_show_subcats_in_index'] == 1) { $template->assign_block_vars('catmain.catrow.subcat_link', array('L_LINKS' => $lang['Album_sub_categories'], 'LINKS' => $links)); } } // something displayed, yeah baby $display = true; } // if ($level == 0)... // display sub-levels for ($i = 0; $i < sizeof($album_data['sub'][$cur_cat_id]); $i++) { if (!empty($keys['keys'][$album_data['sub'][$cur_cat_id][$i]])) { $subdisplay = album_build_index($user_id, $keys, $album_data['sub'][$cur_cat_id][$i], $level + 1, $max_level, $newestpic); if ($subdisplay) { $display = true; } } } return $display; }
$v = 0; $regoptions = ''; while ($v < $regoptions_count - 1) { $regoptions .= $regoption_array[$v] . '-'; $v++; } $regoptions .= array_pop($regoption_array); } // Event Registration - END $topic_pagination = generate_topic_pagination($forum_id, $topic_id, $replies); if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS))) { $view_topic_url = append_sid(str_replace ('--', '-', make_url_friendly($topic_title) . '-vt' . $topic_id . '.html')); } else { $view_topic_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . $kb_mode_append); } $topic_author = ($topic_rowset[$i]['user_id'] == ANONYMOUS) ? (($topic_rowset[$i]['post_username'] != '') ? $topic_rowset[$i]['post_username'] : $lang['Guest']) : colorize_username($topic_rowset[$i]['user_id'], $topic_rowset[$i]['username'], $topic_rowset[$i]['user_color'], $topic_rowset[$i]['user_active']); if (($user->data['user_level'] != ADMIN) && !empty($topic_rowset[$i]['user_mask']) && empty($topic_rowset[$i]['user_active'])) { $topic_author = $lang['INACTIVE_USER']; } //$first_post_time = create_date_ip($config['default_dateformat'], $topic_rowset[$i]['topic_time'], $config['board_timezone']); $first_post_time = create_date_ip($lang['DATE_FORMAT_VF'], $topic_rowset[$i]['topic_time'], $config['board_timezone'], true);
/** * a function to makea url friendly * * @return string */ protected function inspekt($val) { return make_url_friendly($val); }
/** * Send user notifications on new topic or reply */ function send_notifications($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $config, $lang, $db, $user; global $bbcode; $current_time = time(); include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; if ($mode != 'delete') { if ($mode == 'reply') { // Look for users with notification enabled $sql = "SELECT u.user_id, u.user_email, u.user_lang, u.username, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . TOPICS_WATCH_TABLE . " tw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE tw.topic_id = " . $topic_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('tw.user_id', $this->exclude_users, true, true) . "\n\t\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND u.user_id = tw.user_id\n\t\t\t\t\t\tAND u.user_active = 1"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { if (!in_array($row['user_id'], $this->notify_userid)) { if ($row['user_email'] != '') { $this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']); } $this->notify_userid[] = $row['user_id']; $this->notify_forum_name = $row['forum_name']; } } $db->sql_freeresult($result); } if ($mode == 'newtopic' || $mode == 'reply') { // Reply or New Topic forum notification $sql = "SELECT u.user_id, u.user_email, u.user_lang, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE fw.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('fw.user_id', array_merge($this->exclude_users, $this->notify_userid), true, true) . "\n\t\t\t\t\t\tAND fw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND f.forum_notify = '1'\n\t\t\t\t\t\tAND u.user_id = fw.user_id\n\t\t\t\t\t\tAND u.user_active = 1"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { if (!in_array($row['user_id'], $this->notify_userid)) { if ($row['user_email'] != '') { $this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']); } $this->notify_userid[] = $row['user_id']; $this->notify_forum_name = $row['forum_name']; } } $db->sql_freeresult($result); } // Users array built, so start sending notifications if (sizeof($this->notify_userdata) > 0) { include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $server_url = create_server_url(); $topic_title = unprepare_message($topic_title); $topic_title = censor_text($topic_title); $post_text = unprepare_message($post_data['message']); $post_text = censor_text($post_text); if (!empty($config['html_email'])) { $bbcode->allow_bbcode = !empty($config['allow_bbcode']) ? $config['allow_bbcode'] : false; $bbcode->allow_html = !empty($config['allow_html']) ? $config['allow_html'] : false; $bbcode->allow_smilies = !empty($config['allow_smilies']) ? $config['allow_smilies'] : false; $post_text = $bbcode->parse($post_text); } else { $post_text = $bbcode->plain_message($post_text, ''); } for ($i = 0; $i < sizeof($this->notify_userdata); $i++) { $emailer->use_template('topic_notify', $this->notify_userdata[$i]['user_lang']); $emailer->bcc($this->notify_userdata[$i]['user_email']); // The Topic_reply_notification lang string below will be used // if for some reason the mail template subject cannot be read // ... note it will not necessarily be in the posters own language! $emailer->set_subject($lang['Topic_reply_notification']); // This is a nasty kludge to remove the username var ... till (if?) translators update their templates $emailer->msg = preg_replace('#[ ]?{USERNAME}#', $this->notify_userdata[$i]['username'], $emailer->msg); if ($config['url_rw'] == '1') { $topic_url = $server_url . str_replace('--', '-', make_url_friendly($topic_title) . '-vp' . $post_id . '.html#p' . $post_id); } else { $topic_url = $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id; } $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'TOPIC_TITLE' => $topic_title, 'POST_TEXT' => $post_text, 'POSTERNAME' => $post_data['username'], 'FORUM_NAME' => $this->notify_forum_name, 'ROOT' => $server_url, 'U_TOPIC' => $topic_url, 'U_STOP_WATCHING_TOPIC' => $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id . '&unwatch=topic')); $emailer->send(); $emailer->reset(); } } // Emails sent, so set users were notified $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE topic_id = " . $topic_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true); $db->sql_query($sql); $sql = "UPDATE " . FORUMS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE forum_id = " . $forum_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true); $db->sql_query($sql); // Delete notification for poster if present, or re-activate it if requested if (!$notify_user && !empty($row['topic_id'])) { $this->delete_topic_watch($user->data['user_id'], $topic_id); } elseif ($notify_user && empty($row['topic_id'])) { $this->delete_topic_watch($user->data['user_id'], $topic_id); $this->insert_topic_watch($user->data['user_id'], $topic_id, $forum_id, TOPIC_WATCH_UN_NOTIFIED); } } }
if (!$is_auth['auth_read'] || !$is_auth['auth_view']) { message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type'])); } $topic_title = $post_data['topic_title']; $topic_title_enc = urlencode(ip_utf8_decode($topic_title)); $topic_title_enc_utf8 = urlencode($topic_title); // URL Rewrite - BEGIN // Rewrite Social Bookmars URLs if any of URL Rewrite rules has been enabled // Forum ID and KB Mode removed from topic_url_enc to avoid compatibility problems with redirects in tell a friend if (($config['url_rw'] == true) || ($config['url_rw_guests'] == true)) { $topic_url = create_server_url() . make_url_friendly($topic_title) . (empty($link_topic) ? ('-vp' . $post_id . '.html' . $post_id_append_url) : ('-vt' . $topic_id . '.html')); } else { $topic_url = create_server_url() . ip_build_url(CMS_PAGE_VIEWTOPIC, array($topic_id_append, $post_id_append), false) . $post_id_append_url; } $topic_url_ltt = htmlspecialchars($topic_url); $topic_url_enc = urlencode(ip_utf8_decode($topic_url)); $topic_url_enc_utf8 = urlencode($topic_url); // URL Rewrite - END // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); $template->assign_vars(array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id,
} $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_time, p.pic_lock FROM " . ALBUM_TABLE . " AS p WHERE p.pic_cat_id IN (" . $allowed_cat . ") $wheresql ORDER BY p.pic_id " . $config['sitemap_sort'] . " LIMIT " . $config['sitemap_topic_limit']; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $pic_priority = $config['sitemap_default_priority']; $pic_change = 'never'; if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS))) { $url = $server_url . str_replace ('--', '-', make_url_friendly($row['pic_title']) . '-asp' . $row['pic_id'] . '.html'); } else { $url = $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $row['pic_id']; } $xml_sitemap_body .= ' <url> <loc>' . $url . '</loc> <lastmod>' . gmdate('Y-m-d\TH:i:s' . '+00:00', $row['pic_time']) . '</lastmod> <changefreq>' . $pic_change . '</changefreq> <priority>' . $pic_priority . '</priority> </url>'; $lastpic = $row['pic_id']; } $db->sql_freeresult();
index.php/blog/insert" title="Create New Post">New Post</a></li> <li><a href="<?php echo base_url(); ?> index.php/blog/logout" title="Logout">Logout</a></li> </ul> <?php } ?> </div> <div class="span-24 last" id="content"> <div class="span-18" id="post"> <?php $this->load->view('message_view'); if (isset($post)) { echo '<h2><a href="' . base_url() . 'index.php/blog/view/' . $post->id . '/' . make_url_friendly($post->title) . '/" title="' . $post->title . '">' . $post->title . '</a></h2>'; echo '<div class="date">'; echo 'Posted on ' . $post->date; echo '</div>'; echo '<div id="post-body">'; echo $post->body; echo '<div id="post-footer">'; echo '<div id="tags">'; $tags = explode(' ', $post->tags); echo 'Tagged: '; foreach ($tags as $tag) { echo '<a class="tag" href="' . base_url() . 'index.php/blog/tagged/' . $tag . '/" title="View questions tagged ' . $tag . '">' . $tag . '</a>'; } echo '</div>'; echo '<a href="' . base_url() . 'index.php/blog/comments/' . $post->id . '/" title="View Comment(s)">' . $commentcount . ' comments</a>'; if ($post->commentlock == 'locked') {