function render_article($subject, $article, $info) { global $locale; $category = "<a href='" . INFUSIONS . "articles/articles.php?cat_id=" . $info['cat_id'] . "'>" . $info['cat_name'] . "</a>\n"; $comment = "<a href='" . INFUSIONS . "articles/articles.php?article_id=" . $info['article_id'] . "#comments'> " . format_word($info['article_comments'], $locale['fmt_comment']) . " </a>\n"; echo render_breadcrumbs(); echo "<!--pre_article-->"; echo "<article>\n"; echo "<div class='news-action text-right'>"; echo "<a title='" . $locale['global_075'] . "' href='" . BASEDIR . "print.php?type=A&item_id=" . $info['article_id'] . "'><i class='entypo print'></i></a>"; echo !empty($info['edit_link']) ? "<a href='" . $info['edit_link'] . "' title='" . $locale['global_076'] . "' /><i class='entypo pencil'></i></a>\n" : ''; echo "</div>\n"; echo "<div class='news-info'>" . ucfirst($locale['posted']) . " <span class='news-date'>" . showdate("%d %b %Y", $info['article_date']) . "</span> " . $locale['in'] . " {$category} " . $locale['and'] . " {$comment}</div>\n"; echo "<h2 class='news-title'>{$subject}</h2>"; echo "<div class='article'>\n"; echo ($info['article_breaks'] == "y" ? nl2br($article) : $article) . "<br />\n"; echo "</div>\n"; echo "<hr />\n"; echo "<div class='news-user-info clearfix m-b-10'>\n"; echo "<h4>" . $locale['about'] . " <a href='" . BASEDIR . "profile.php?lookup=" . $info['user_id'] . "'>" . $info['user_name'] . "</a>\n</h4>"; echo "<div class='pull-left m-r-10'>" . display_avatar($info, '80px') . "</div>\n"; echo "<strong>" . getuserlevel($info['user_level']) . "</strong><br/>\n"; echo "<strong>" . $locale['joined'] . showdate('newsdate', $info['user_joined']) . "</strong><br/>\n"; echo "</div>\n"; echo "</article>"; echo "<!--sub_article-->"; echo $info['page_nav']; echo "<hr />\n"; if ($info['article_allow_comments']) { showcomments("A", DB_ARTICLES, "article_id", $_GET['article_id'], INFUSIONS . "articles/articles.php?article_id=" . $_GET['article_id']); } if ($info['article_allow_ratings']) { showratings("A", $_GET['article_id'], INFUSIONS . "articles/articles.php?article_id=" . $_GET['article_id']); } }
function render_comments($c_data, $c_info) { global $locale; opentable(format_word(number_format(count($c_data)), $locale['fmt_comment'])); if (!empty($c_data)) { echo "<div class='comments floatfix'>\n"; $c_makepagenav = ''; if ($c_info['c_makepagenav'] !== FALSE) { echo $c_makepagenav = "<div style='text-align:center;margin-bottom:5px;'>" . $c_info['c_makepagenav'] . "</div>\n"; } foreach ($c_data as $data) { echo "<div class='comments_container m-b-15'><div class='pull-left m-r-10'>"; echo $data['user_avatar']; echo "</div>\n"; echo "<div class='overflow-hide'>\n"; if ($data['edit_dell'] !== FALSE) { echo "\n\t\t\t\t\t<div class='pull-right text-smaller comment_actions'>\n\t\t\t\t\t" . $data['edit_dell'] . "\n\t\t\t\t\t</div>\n"; } echo "<div class='comment_name'>\n"; echo "<a href='" . FUSION_REQUEST . "#c" . $data['comment_id'] . "' id='c" . $data['comment_id'] . "' name='c" . $data['comment_id'] . "'>#" . $data['i'] . "</a> "; echo $data['comment_name']; echo "<span class='text-smaller mid-opacity m-l-10'>" . $data['comment_datestamp'] . "</span>\n"; echo "</div>\n"; echo "<div class='comment_message'>" . $data['comment_message'] . "</div>\n"; echo "</div>\n</div>\n"; } echo $c_makepagenav; if ($c_info['admin_link'] !== FALSE) { echo "<div style='float:right' class='comment_admin'>" . $c_info['admin_link'] . "</div>\n"; } echo "</div>\n"; } else { echo "<div class='no_comment'>\n"; echo $locale['c101'] . "\n"; echo "</div>\n"; } closetable(); }
function render_comments($c_data, $c_info) { global $locale, $settings; if (!empty($c_data)) { echo "<div class='clearfix m-b-20'>\n"; if ($c_info['admin_link'] !== FALSE) { echo "<div class='pull-right'>" . $c_info['admin_link'] . "</div>\n"; } echo "<h2 class='m-t-0 pull-left display-inline-block'>" . format_word(count($c_data), $locale['fmt_comment']) . "</h2>\n"; echo "</div>\n"; echo "<div class='comments clearfix'>\n"; foreach ($c_data as $data) { $comm_count = "<a href='" . FUSION_REQUEST . "#c" . $data['comment_id'] . "' id='c" . $data['comment_id'] . "' name='c" . $data['comment_id'] . "'>#" . $data['i'] . "</a>"; echo "<div class='m-t-20 comment-main clearfix'>\n"; echo $settings['comments_avatar'] ? "<div class='comment-avatar pull-left m-r-10'>" . $data['user_avatar'] . "</div>\n" : ''; echo "<div class='overflow-hide'>\n"; echo "<div class='comment-header'>\n"; echo "<div class='pull-right'>\n"; echo "<span class='comment-count text-dark m-r-10'>" . $comm_count . "</span>\n"; if ($data['edit_dell'] !== FALSE) { echo "<span class='comment_actions'>" . $data['edit_dell'] . "\n</span>\n"; } echo "</div>"; echo "<h4 class='display-inline'>" . $data['comment_name'] . "</h4>\n<span class='m-l-5 text-smaller m-t-5 text-lighter'>" . $data['comment_datestamp'] . "</span>"; echo "</div>\n"; echo "<div class='comments-body'>\n"; echo $data['comment_message']; echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; } echo $c_info['c_makepagenav'] ? "<div class='flleft'>" . $c_info['c_makepagenav'] . "</div>\n" : ""; echo "</div>\n"; } else { echo "<div class='nocomments-message spacer'>" . $locale['c101'] . "</div>\n"; } }
function display_comments($news_comments, $link = FALSE, $class = FALSE, $mode = '1') { global $locale; $start_link = $link ? "<a class='comments-item " . $class . "' href='" . $link . "'>" : ''; $end_link = $link ? "</a>\n" : ''; $str = $mode == 1 ? format_word($news_comments, $locale['fmt_comment']) : $news_comments; if ($news_comments > 0) { return $start_link . "<i title='" . $locale['global_073'] . "' class='entypo icomment high-opacity m-l-0'></i>" . $str . $end_link; } else { return $start_link . "<i title='" . sprintf($locale['global_089'], $locale['global_077']) . "' class='entypo icomment high-opacity m-l-0'></i> " . $str . $end_link; } }
/** * Get thread posts info */ private function get_thread_post() { global $forum_settings, $locale, $userdata; $user_sig_module = \PHPFusion\UserFields::check_user_field('user_sig'); $user_web_module = \PHPFusion\UserFields::check_user_field('user_web'); $userid = isset($userdata['user_id']) ? (int) $userdata['user_id'] : 0; switch ($this->thread_info['section']) { case 'oldest': $sortCol = 'post_datestamp ASC'; break; case 'latest': $sortCol = 'post_datestamp DESC'; break; case 'high': $sortCol = 'vote_points DESC'; break; default: $sortCol = 'post_datestamp ASC'; } // @todo: where to calculate has voted without doing it in while loop? require_once INCLUDES . "mimetypes_include.php"; $result = dbquery("\n\t\t\t\t\tSELECT p.*,\n\t\t\t\t\tt.thread_id,\n\t\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar, u.user_level, u.user_posts, u.user_groups, u.user_joined, u.user_lastvisit, u.user_ip,\n\t\t\t\t\t" . ($user_sig_module ? " u.user_sig," : "") . ($user_web_module ? " u.user_web," : "") . "\n\t\t\t\t\tu2.user_name AS edit_name, u2.user_status AS edit_status,\n\t\t\t\t\tcount(a1.attach_id) 'attach_image_count',\n\t\t\t\t\tcount(a2.attach_id) 'attach_files_count',\n\t\t\t\t\tSUM(v.vote_points) as vote_points, count(v2.thread_id) as has_voted\n\t\t\t\t\tFROM " . DB_FORUM_POSTS . " p\n\t\t\t\t\tINNER JOIN " . DB_FORUM_THREADS . " t ON t.thread_id = p.thread_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.post_id = p.post_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v2 on v2.thread_id = p.thread_id AND v2.vote_user = '******'\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u ON p.post_author = u.user_id\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.post_id = p.post_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.post_id = p.post_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tWHERE p.thread_id='" . intval($_GET['thread_id']) . "' AND post_hidden='0'\n\t\t\t\t\t" . ($this->thread_info['thread']['forum_type'] == '4' ? "OR p.post_id='" . intval($this->thread_info['post_firstpost']) . "'" : '') . "\n\t\t\t\t\tGROUP by p.post_id\n\t\t\t\t\tORDER BY {$sortCol} LIMIT " . intval($_GET['rowstart']) . ", " . intval($forum_settings['posts_per_page'])); $this->thread_info['post_rows'] = dbrows($result); if ($this->thread_info['post_rows'] > 0) { /* Set Threads Navigation */ $this->thread_info['thread_posts'] = format_word($this->thread_info['post_rows'], $locale['fmt_post']); $this->thread_info['page_nav'] = ''; if ($this->thread_info['max_post_items'] > $this->thread_info['posts_per_page']) { $this->thread_info['page_nav'] = "<div class='pull-right'>" . makepagenav($_GET['rowstart'], $this->thread_info['posts_per_page'], $this->thread_info['max_post_items'], 3, INFUSIONS . "forum/viewthread.php?thread_id=" . $this->thread_info['thread']['thread_id'] . (isset($_GET['highlight']) ? "&highlight=" . urlencode($_GET['highlight']) : '') . "&") . "</div>"; } $i = 1; while ($pdata = dbarray($result)) { // Format Post Message $post_message = $pdata['post_smileys'] ? parsesmileys($pdata['post_message']) : $pdata['post_message']; $post_message = nl2br(parseubb($post_message)); if (isset($_GET['highlight'])) { $post_message = "<div class='search_result'>" . $post_message . "</div>\n"; } // Marker $marker = array('link' => "#post_" . $pdata['post_id'], "title" => "#" . ($i + $_GET['rowstart']), 'id' => "post_" . $pdata['post_id']); $post_marker = "<a class='marker' href='" . $marker['link'] . "' id='" . $marker['id'] . "'>" . $marker['title'] . "</a>"; $post_marker .= "<a title='" . $locale['forum_0241'] . "' href='#top'><i class='entypo up-open'></i></a>\n"; // Post Attachments $post_attachments = ""; if ($pdata['attach_files_count'] || $pdata['attach_image_count']) { if ($this->getThreadPermission("can_download_attach")) { $attachResult = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . intval($pdata['post_id']) . "'"); if (dbrows($attachResult) > 0) { $aImage = ""; $aFiles = ""; while ($attachData = dbarray($attachResult)) { if (in_array($attachData['attach_mime'], img_mimeTypes())) { $aImage .= display_image_attach($attachData['attach_name'], "50", "50", $pdata['post_id']) . "\n"; } else { $aFiles .= "<div class='display-inline-block'><i class='entypo attach'></i><a href='" . FUSION_SELF . "?thread_id=" . $pdata['thread_id'] . "&getfile=" . $attachData['attach_id'] . "'>" . $attachData['attach_name'] . "</a> "; $aFiles .= "[<span class='small'>" . parsebytesize(filesize(INFUSIONS . "forum/attachments/" . $attachData['attach_name'])) . " / " . $attachData['attach_count'] . $locale['forum_0162'] . "</span>]</div>\n"; } } if (!empty($aFiles)) { $post_attachments .= "<div class='emulated-fieldset'>\n"; $post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_files_count'] > 1 ? $locale['forum_0158'] : $locale['forum_0157']) . "</span>\n"; $post_attachments .= "<div class='attachments-list m-t-10'>" . $aFiles . "</div>\n"; $post_attachments .= "</div>\n"; } if (!empty($aImage)) { $post_attachments .= "<div class='emulated-fieldset'>\n"; $post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_image_count'] > 1 ? $locale['forum_0156'] : $locale['forum_0155']) . "</span>\n"; $post_attachments .= "<div class='attachments-list'>" . $aImage . "</div>\n"; $post_attachments .= "</div>\n"; if (!defined('COLORBOX')) { define('COLORBOX', TRUE); add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />"); add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>"); add_to_jquery("\$('a[rel^=\"attach\"]').colorbox({ current: '" . $locale['forum_0159'] . " {current} " . $locale['forum_0160'] . " {total}',width:'80%',height:'80%'});"); } } } else { $post_attachments = "Failed to fetch the attachment"; } } else { $post_attachments = "<small><i class='fa fa-clipboard'></i> " . $locale['forum_0184'] . "</small>\n"; } } $pdata += array("user_online" => $pdata['user_lastvisit'] >= time() - 3600 ? TRUE : FALSE, "is_first_post" => $pdata['post_id'] == $this->thread_info['post_firstpost'] ? TRUE : FALSE, "is_last_post" => $pdata['post_id'] == $this->thread_info['post_lastpost'] ? TRUE : FALSE, "user_profile_link" => profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']), "user_avatar_image" => display_avatar($pdata, '40px', FALSE, FALSE, 'img-rounded'), "user_ip" => $forum_settings['forum_ips'] && iMOD ? $locale['forum_0268'] . ' ' . $pdata['post_ip'] : '', "user_post_count" => format_word($pdata['user_posts'], $locale['fmt_post']), "print" => array('link' => BASEDIR . "print.php?type=F&item_id=" . $_GET['thread_id'] . "&post=" . $pdata['post_id'] . "&nr=" . ($i + $_GET['rowstart']), 'title' => $locale['forum_0179']), "post_marker" => $post_marker, "marker" => $marker, "post_attachments" => $post_attachments); $pdata['post_message'] = $post_message; /** * User Stuffs, Sig, User Message, Web */ // Quote & Edit Link if ($this->getThreadPermission("can_reply")) { if (!$this->thread_info['thread']['thread_locked']) { $pdata['post_quote'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'] . "&quote=" . $pdata['post_id'], 'title' => $locale['forum_0266']); if (iMOD || ($forum_settings['forum_edit_lock'] == TRUE && $pdata['is_last_post'] || $forum_settings['forum_edit_lock'] == FALSE) && $userdata['user_id'] == $pdata['post_author'] && ($forum_settings['forum_edit_timelimit'] <= 0 || time() - $forum_settings['forum_edit_timelimit'] * 60 < $pdata['post_datestamp'])) { $pdata['post_edit'] = array('link' => INFUSIONS . "forum/viewthread.php?action=edit&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], 'title' => $locale['forum_0265']); } $pdata['post_reply'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], 'title' => $locale['forum_0509']); } elseif (iMOD) { $pdata['post_edit'] = array('link' => INFUSIONS . "forum/viewthread.php?action=edit&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], 'title' => $locale['forum_0265']); } } // rank img if ($pdata['user_level'] <= USER_LEVEL_ADMIN) { if ($forum_settings['forum_ranks']) { $pdata['user_rank'] = show_forum_rank($pdata['user_posts'], $pdata['user_level'], $pdata['user_groups']); // in fact now is get forum rank } else { $pdata['user_rank'] = getuserlevel($pdata['user_level']); } } else { if ($forum_settings['forum_ranks']) { $pdata['user_rank'] = iMOD ? show_forum_rank($pdata['user_posts'], 104, $pdata['user_groups']) : show_forum_rank($pdata['user_posts'], $pdata['user_level'], $pdata['user_groups']); } else { $pdata['user_rank'] = iMOD ? $locale['userf1'] : getuserlevel($pdata['user_level']); } } // Website if ($pdata['user_web'] && (iADMIN || $pdata['user_status'] != 6 && $pdata['user_status'] != 5)) { $user_web_url_prefix = !preg_match("@^http(s)?\\:\\/\\/@i", $pdata['user_web']) ? "http://" . $pdata['user_web'] : $pdata['user_web']; $pdata['user_web'] = array('link' => $user_web_url_prefix . $pdata['user_web'], 'title' => $locale['forum_0364']); } else { $pdata['user_web'] = array('link' => '', 'title' => ''); } // PM link $pdata['user_message'] = array('link' => '', 'title' => ''); if (iMEMBER && $pdata['user_id'] != $userdata['user_id'] && (iADMIN || $pdata['user_status'] != 6 && $pdata['user_status'] != 5)) { $pdata['user_message'] = array('link' => BASEDIR . 'messages.php?msg_send=' . $pdata['user_id'], "title" => $locale['send_message']); } // User Sig if ($pdata['user_sig'] && isset($pdata['post_showsig']) && $pdata['user_status'] != 6 && $pdata['user_status'] != 5) { $pdata['user_sig'] = nl2br(parseubb(parsesmileys(stripslashes($pdata['user_sig'])), "b|i|u||center|small|url|mail|img|color")); } else { $pdata['user_sig'] = ""; } // Voting - need up or down link - accessible to author also the vote // answered and on going questions. // Answer rating $pdata['vote_message'] = ''; //echo $data['forum_type'] == 4 ? "<br/>\n".(number_format($data['thread_postcount']-1)).$locale['forum_0365']."" : ''; // answers // form components $pdata['post_checkbox'] = iMOD ? "<input type='checkbox' name='delete_post[]' value='" . $pdata['post_id'] . "'/>" : ''; $pdata['post_votebox'] = ''; if ($this->thread_info['thread']['forum_type'] == 4) { if ($this->getThreadPermission("can_rate")) { // can vote. $pdata['vote_up'] = array('link' => INFUSIONS . "forum/postify.php?post=voteup&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], "title" => $locale['forum_0265']); $pdata['vote_down'] = array('link' => INFUSIONS . "forum/postify.php?post=votedown&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], "title" => $locale['forum_0265']); $pdata['post_votebox'] = "<div class='text-center'>\n"; $pdata['post_votebox'] .= "<a href='" . $pdata['vote_up']['link'] . "' class='btn btn-default btn-xs m-b-5 p-5' title='" . $locale['forum_0265'] . "'>\n<i class='entypo up-dir icon-xs'></i></a>"; $pdata['post_votebox'] .= "<h3 class='m-0'>" . (!empty($pdata['vote_points']) ? $pdata['vote_points'] : 0) . "</h3>\n"; $pdata['post_votebox'] .= "<a href='" . $pdata['vote_down']['link'] . "' class='btn btn-default btn-xs m-t-5 p-5' title='" . $locale['forum_0265'] . "'>\n<i class='entypo down-dir icon-xs'></i></a>"; $pdata['post_votebox'] .= "</div>\n"; } else { $pdata['post_votebox'] = "<div class='text-center'>\n"; $pdata['post_votebox'] .= "<h3 class='m-0'>" . (!empty($pdata['vote_points']) ? $pdata['vote_points'] : 0) . "</h3>\n"; $pdata['post_votebox'] .= "</div>\n"; } } // Edit Reason - NOT WORKING? $pdata['post_edit_reason'] = ''; if ($pdata['post_edittime']) { $edit_reason = "<div class='edit_reason m-t-10'><small>" . $locale['forum_0164'] . profile_link($pdata['post_edituser'], $pdata['edit_name'], $pdata['edit_status']) . $locale['forum_0167'] . showdate("forumdate", $pdata['post_edittime']) . "</small>\n"; if ($pdata['post_editreason'] && iMEMBER) { $edit_reason .= "<br /><a id='reason_pid_" . $pdata['post_id'] . "' rel='" . $pdata['post_id'] . "' class='reason_button small' data-target='reason_div_pid_" . $pdata['post_id'] . "'>"; $edit_reason .= "<strong>" . $locale['forum_0165'] . "</strong>"; $edit_reason .= "</a>\n"; $edit_reason .= "<div id='reason_div_pid_" . $pdata['post_id'] . "' class='reason_div small'>" . $pdata['post_editreason'] . "</div>\n"; } $edit_reason .= "</div>\n"; $pdata['post_edit_reason'] = $edit_reason; $this->edit_reason = TRUE; } // Custom Post Message Link/Buttons $pdata['post_links'] = ''; $pdata['post_links'] .= !empty($pdata['post_quote']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['post_quote']["title"] . "' href='" . $pdata['post_quote']['link'] . "'>" . $pdata['post_quote']['title'] . "</a>\n" : ''; $pdata['post_links'] .= !empty($pdata['post_edit']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['post_edit']["title"] . "' href='" . $pdata['post_edit']['link'] . "'>" . $pdata['post_edit']['title'] . "</a>\n" : ''; $pdata['post_links'] .= !empty($pdata['print']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['print']["title"] . "' href='" . $pdata['print']['link'] . "'>" . $pdata['print']['title'] . "</a>\n" : ''; $pdata['post_links'] .= !empty($pdata['user_web']) ? "<a class='btn btn-xs btn-default' class='forum_user_actions' href='" . $pdata['user_web']['link'] . "' target='_blank'>" . $pdata['user_web']['title'] . "</a>\n" : ''; $pdata['post_links'] .= !empty($pdata['user_message']) ? "<a class='btn btn-xs btn-default' href='" . $pdata['user_message']['link'] . "' target='_blank'>" . $pdata['user_message']['title'] . "</a>\n" : ''; // Post Date $pdata['post_date'] = $locale['forum_0524'] . " " . timer($pdata['post_datestamp']) . " - " . showdate('forumdate', $pdata['post_datestamp']); $pdata['post_shortdate'] = $locale['forum_0524'] . " " . timer($pdata['post_datestamp']); $pdata['post_longdate'] = $locale['forum_0524'] . " " . showdate('forumdate', $pdata['post_datestamp']); $this->thread_info['post_items'][$pdata['post_id']] = $pdata; $i++; } } }
/** Custom data formatter */ function parseInfo($data) { global $locale, $dl_settings; $download_image = ''; if ($data['download_image'] && $dl_settings['download_screenshot'] == "1") { $hiRes_image_path = get_download_image_path($data['download_image'], $data['download_image_thumb'], TRUE); $lowRes_image_path = get_download_image_path($data['download_image'], $data['download_image_thumb'], FALSE); $download_image = "<a href='" . INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'] . "'>" . thumbnail($lowRes_image_path, '100px') . "</a>"; } return array('download_anchor' => "<a name='download_" . $data['download_id'] . "' id='download_" . $data['download_id'] . "'></a>", 'download_description_short' => nl2br(parseubb(parsesmileys(html_entity_decode(stripslashes($data['download_description_short']))))), 'download_description' => nl2br(parseubb(parsesmileys(html_entity_decode(stripslashes($data['download_description']))))), 'download_link' => INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'], 'download_category_link' => "<a href='" . INFUSIONS . "downloads/downloads.php?cat_id=" . $data['download_cat'] . "'>" . $data['download_cat_name'] . "</a>\n", 'download_readmore_link' => "<a href='" . INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'] . "'>" . $locale['download_1006'] . "</a>\n", 'download_title' => stripslashes($data['download_title']), 'download_image' => $download_image, 'download_thumb' => get_download_image_path($data['download_image'], $data['download_image_thumb'], FALSE), "download_count" => format_word($data['download_count'], $locale['fmt_download']), "download_comments" => format_word($data['count_comment'], $locale['fmt_comment']), 'download_sum_rating' => format_word($data['sum_rating'], $locale['fmt_rating']), 'download_count_votes' => format_word($data['count_votes'], $locale['fmt_vote']), 'download_user_avatar' => display_avatar($data, '25px', '', TRUE, 'img-rounded'), 'download_user_link' => profile_link($data['user_id'], $data['user_name'], $data['user_status'], 'strong'), 'download_post_time' => showdate('shortdate', $data['download_datestamp']), 'download_post_time2' => $locale['global_049'] . " " . timer($data['download_datestamp']), 'download_file_link' => file_exists(DOWNLOADS . '/files/' . $data['download_file']) ? INFUSIONS . "downloads/downloads.php?file_id=" . $data['download_id'] : ''); }
function format_word($w) { return format_word($w, $this->language); }
function do_table($w, $values0, $values1, $values2, $values3, $values4, $ignore, $format_value, $format_word, $get_link = NULL, $extras = NULL, $optimization = 0) { ?> <div class="scrollable"><?php if ($values1 and !$values2 and !$values3 and !$values4 and !$values0) { ?> <table class="text-center inflection inflection-small" id="word<?php echo $w->id(); ?> _forms"><?php foreach ($values1[false] as $_1) { ?> <tr><th><?php echo format_value($_1); ?> </th></tr><tr><td><?php echo format_word(PATH($w, $_1)->get(), $w->lang(), true); ?> </td></tr><?php } } else { ?> <table class="text-left inflection" id="word<?php echo $w->id(); ?> _forms"><?php $first0 = $last0 = NULL; _get_first_last($values0, $first0, $last0); if (!$values0) { $values0 = [FALSE]; $values1 = [$values1, "_" => $values1]; $values2 = [$values2, "_" => $values2]; $values3 = [$values3, "_" => $values3]; $values4 = [$values4, "_" => $values4]; } foreach ($values0 as $_key => $_0) { $name0 = $_0; // FIXME if ($name0 === " ") { $name0 = FALSE; } if (!$values1[$_0]) { $values1[$_0] = [FALSE]; } if (!$values2[$_0]) { $values2[$_0] = [FALSE]; } if (!$values3[$_0]) { $values3[$_0] = [FALSE]; } if (!$values4[$_0]) { $values4[$_0] = [FALSE]; } $path = PATH($w, $_0); if ($_0 !== $first0) { // Blank row to separate sub-tables based on $values0 ?> <tr><th> </th></tr><?php } // values0 : table name // values1 : major vertical // values2 : minor vertical // values3 : major horizontal // values4 : minor horizontal $_1 = (count($values1[$_0]) > 1 or $values1[$_0][0] !== FALSE); ?> <tr><?php $hspan1 = $_1 !== FALSE ? 2 : 1; if ($name0 === FALSE) { ?> <th colspan="<?php echo $hspan1; ?> "> </th><?php } else { ?> <th colspan="<?php echo $hspan1; ?> " class="greatest"><?php echo $format_value($name0); ?> </th><?php } if ($values3[$_0]) { foreach ($values3[$_0] as $_3) { ?> <th colspan="<?php echo count($values4[$_0][$_3]); ?> " class="major"><?php echo $format_value($_3); ?> </th><?php } } ?> </tr><?php if (!array_key_exists("_", $values4[$_0])) { $values4[$_0]["_"] = []; } if ($values4[$_0]["_"] and $values4[$_0]["_"][0] !== FALSE) { ?> <tr><th colspan="<?php echo $hspan1; ?> "> </th><?php foreach ($values3[$_0] as $_3) { if ($values4[$_0][$_3]) { foreach ($values4[$_0][$_3] as $_4) { ?> <th class="minor"><?php echo $format_value($_4); ?> </th><?php } } } ?> </tr><?php $hspan4 = 1; } elseif ($values4[$_0]["_"]) { $hspan4 = count($values4[$_0]["_"]); foreach ($values4[$_0] as &$v) { $v = [""]; } } else { $hspan4 = 1; } foreach ($values1[$_0] as $_1) { if ($_1 !== FALSE) { ?> <tr><?php ?> <th colspan="2" class="major"><?php echo $format_value($_1); ?> </th><?php ?> </tr><?php } // Previous row (directly above) $p_2 = NULL; foreach ($values2[$_0][$_1] as $_2) { ?> <tr><?php if ($_1 !== FALSE) { ?> <th> </th><?php } ?> <th class="minor"><?php echo $format_value($_2); ?> </th><?php $row = []; $last = NULL; foreach ($values3[$_0] as $_3) { $acc = []; $i = -1; foreach ($values4[$_0][$_3] as $_4) { $p = PATH($w, $_0, $_1, $_3, $_4, $_2); if ($i < 0 or $p->get() != $last or !$last) { $acc[] = []; $last = $p->get(); $i += 1; } $acc[$i][] = [$p, 2 => $_3, $_4]; } if (!($optimization & 2) or count($acc) != 1 and count($acc) != count($values4)) { $acc = []; foreach ($values4[$_0][$_3] as $_4) { $p = PATH($w, $_0, $_1, $_3, $_4, $_2); $acc[] = [[$p, 2 => $_3, $_4]]; } } $row = array_merge($row, $acc); } $first1 = $last1 = NULL; _get_first_last($values1[$_0], $first1, $last1); $first2 = $last2 = NULL; _get_first_last($values2[$_0][$_1], $first2, $last2); $first3 = $last3 = NULL; _get_first_last($values3[$_0], $first3, $last3); $first4 = $last4 = NULL; _get_first_last($values4[$_0][$_3], $first4, $last4); foreach ($row as $val_group) { $p = $val_group[0][0]; $_ = count($val_group) - 1; $_30 = $val_group[0][2]; $_40 = $val_group[0][3]; $_31 = $val_group[$_][2]; $_41 = $val_group[$_][3]; if ($_ === 0) { $_3 = $_30; $_4 = $_40; $ditto = ($p_2 and $p->get() and PATH($w, $_0, $_1, $_3, $_4, $p_2)->get() == $p->get()); } else { $_3 = $_4 = NULL; $ditto = FALSE; } ?> <td colspan="<?php echo $hspan4 * count($val_group); ?> " <?php $classes = ""; if (!$first4 or $_40 === $first4) { $classes .= " leftline"; } if (!$last4 or $_41 === $last4) { $classes .= " rightline"; } if (!$first2 or $_2 === $first2) { $classes .= " topline"; } if (!$last2 or $_2 === $last2) { $classes .= " bottomline"; } if ((!$first4 or $_40 === $first4) and $_30 !== $first3) { $classes .= " leftline"; } echo " class='{$classes}' "; if (count($val_group) > 1) { echo " style='text-align: center;'"; } ?> ><?php if ($get_link !== NULL) { $link = $get_link($p); } else { $link = NULL; } if (ISWORD($link)) { $link = "dictionary.php?id=" . $link->id(); } if ($link) { ?> <a class="word-ref" href="<?php echo $link; ?> "><?php } if (!_in_ignore($p, $ignore) or !$p->hasvalue()) { $val = $format_word($p->get(), $p); } else { $val = '<abbr class="symbolic" title="You\'ve not learned this yet">—</abbr>'; } if (count($val_group) > 1) { $val = "" . "<span style='float: right;'>→</span>" . "<span style='float: left;'>←</span>" . $val; } elseif ($ditto and $optimization & 1) { $val = " ″"; # ditto mark $val = " ⁄ ⁄"; #echo "↓"; } echo $val; if ($link) { ?> </a><?php } if ($extras !== NULL) { $extras($p); } ?> </td><?php } ?> </tr><?php $p_2 = $_2; } } } } ?> </table></div><?php }
if (is_callable($answers)) { $answers = $answers($selections, defaultDB()); } if (!is_array($answers)) { $reason = "answers were not in an array"; return $try(); } $process = function ($answer) use($dopick, &$stop, &$correct, $lang) { if ($stop) { return; } $ret = $dopick($answer, TRUE); if ($ret === NULL) { $stop = TRUE; } else { $ret = format_word($ret, $lang); } return $ret; }; if (array_key_exists("correct", $answers) and array_key_exists("acceptable", $answers) and is_array($answers["correct"]) and is_array($answers["acceptable"])) { $results = ["correct" => array_map($process, $answers["correct"]), "acceptable" => array_map($process, $answers["acceptable"])]; } else { if (array_key_exists("correct", $answers) and is_array($answers["correct"]) and array_key_exists("expr", $answers) and is_string($answers["expr"])) { $results = ["correct" => array_map($process, $answers["correct"]), "expr" => $dopick($answers["expr"], TRUE)]; } else { $results = array_map($process, $answers); } } if ($stop) { return $try(); }
$res1 = choose_n_unique($res1, 4); $res = array_merge($res0, $res1); foreach ($res as &$r) { $r = definition(defaultDB(), $r); } foreach ($res as &$r) { $r = ["correct" => $r->word()->id() === $pick_db["word"]->id(), "value" => ((string) $r->path() ? "(" . $r->path() . ") " : "") . str_replace("\n", ", ", $r->value())]; } return $res; }, "choices0-tooltip" => "Pick correct definition"]]], "random-definitions-stage28-29-fr" => ["name" => "Stage 28–29 Vocabulary (FR)", "category" => "Vocabulary", "lang" => "la", "options" => [["help" => "Choose a correct definition for the given word", "selections" => ["word" => function ($_, $db, $path) { $s = $db->searcher(); $s->stmt .= "\n\t\t\t\t\t\tWHERE word_id IN (\n\t\t\t\t\t\t\tSELECT word_id FROM definitions\n\t\t\t\t\t\t\tWHERE def_lang = 'en'\n\t\t\t\t\t\t\tAND def_type IS NULL\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND word_lang = 'la'\n\t\t\t\t\t\tAND word_id NOT IN (\n\t\t\t\t\t\t\tSELECT word_id FROM attributes\n\t\t\t\t\t\t\tWHERE attr_tag = 'template' OR attr_tag = 'hidden'\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\tSELECT attr_value FROM attributes\n\t\t\t\t\t\t\tWHERE word_id = words.word_id\n\t\t\t\t\t\t\tAND attr_tag = 'clc-stage' \n\t\t\t\t\t\t) IN (28,29)"; $s->args = []; return $s->rand(); }], "sentence" => [$OP_LQUOTE, function ($pick_db) { return format_word($pick_db["word"]->name()); }, $OP_RQUOTE, $OP_COLON, $OP_USER_INPUT], "answer0-language" => "en", "answer0" => function ($pick_db, $db) { global $mysqli; $query = $mysqli->prepare("\n\t\t\t\t\tSELECT DISTINCT def_id FROM definitions\n\t\t\t\t\tWHERE def_lang = 'en'\n\t\t\t\t\tAND def_type IS NULL\n\t\t\t\t\tAND word_id = (?)\n\t\t\t\t"); $res = NULL; sql_getmany($query, $res, ["i", $pick_db["word"]->id()]); $query->close(); if (!$res) { return NULL; } $ret = []; $ret2 = []; foreach ($res as $r) { $ret = array_merge($ret, explode("\n", definition(defaultDB(), $r)->value())); } foreach ($ret as $r) {
// Start Item based on $result and $info['blog_rows'] if ($info['blog_max_rows'] > $blog_settings['blog_pagination'] && (!isset($_GET['readmore']) || !isnum($_GET['readmore']))) { $info['blog_nav'] = makepagenav($_GET['rowstart'], $blog_settings['blog_pagination'], $info['blog_max_rows'], 3); } if (!empty($info['blog_rows'])) { while ($data = dbarray($result)) { // remove category image binding on item. each item is capable of housing hundreds of category. $blog_image = "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . thumbnail(INFUSIONS . "blog/images/blog_default.jpg", '150px') . "</a>"; if ($data['blog_image']) { $hiRes_image_path = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], TRUE); $lowRes_image_path = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], FALSE); $blog_image = "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . thumbnail($lowRes_image_path, '150px') . "</a>"; } $blog_blog = parse_textarea($data['blog_blog']); $blog_extended = parse_textarea($data['blog_extended']); $cdata = array('blog_ialign' => $data['blog_ialign'] == 'center' ? 'clearfix' : $data['blog_ialign'], 'blog_anchor' => "<a name='blog_" . $data['blog_id'] . "' id='blog_" . $data['blog_id'] . "'></a>", 'blog_blog' => preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $data['blog_breaks'] == "y" ? nl2br($blog_blog) : $blog_blog), 'blog_extended' => preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $data['blog_breaks'] == "y" ? nl2br($blog_extended) : $blog_extended), 'blog_link' => INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'], 'blog_category_link' => "", 'blog_readmore_link' => "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . $locale['blog_1006'] . "</a>\n", 'blog_subject' => stripslashes($data['blog_subject']), 'blog_image' => $blog_image, 'blog_thumb' => get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], FALSE), "blog_reads" => format_word($data['blog_reads'], $locale['fmt_read']), "blog_comments" => format_word($data['count_comment'], $locale['fmt_comment']), 'blog_sum_rating' => format_word($data['sum_rating'], $locale['fmt_rating']), 'blog_count_votes' => format_word($data['count_votes'], $locale['fmt_vote']), 'blog_user_avatar' => display_avatar($data, '35px', '', TRUE, 'img-rounded'), 'blog_user_link' => profile_link($data['user_id'], $data['user_name'], $data['user_status'], 'strong')); // refetch category per item and parse as string if (!empty($data['blog_cat'])) { $blog_cat = str_replace(".", ",", $data['blog_cat']); $result2 = dbquery("SELECT blog_cat_id, blog_cat_name from " . DB_BLOG_CATS . " WHERE blog_cat_id in ({$blog_cat})"); $rows2 = dbrows($result2); if ($rows2 > 0) { $i = 1; while ($catData = dbarray($result2)) { $cdata['blog_category_link'] .= "<a href='" . INFUSIONS . "blog/blog.php?cat_id=" . $catData['blog_cat_id'] . "'>" . $catData['blog_cat_name'] . "</a>"; $cdata['blog_category_link'] .= $i == $rows2 ? "" : ", "; $i++; } } } $data = array_merge($data, $cdata);
/** * Displays forum mood listing */ private function displayMoodList() { $locale = fusion_get_locale('', FORUM_ADMIN_LOCALE); $mood_max_count = dbcount("(mood_id)", DB_FORUM_MOODS, ""); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $mood_max_count ? intval($_GET['rowstart']) : 0; $mood_query = "SELECT fm.*, count(post_id) 'mood_count' FROM " . DB_FORUM_MOODS . " fm\n LEFT JOIN " . DB_POST_NOTIFY . " pn ON pn.notify_mood_id = fm.mood_id\n GROUP BY mood_id ORDER BY mood_id ASC LIMIT 0, 16"; $mood_result = dbquery($mood_query); $rows = dbrows($mood_result); if ($rows > 0) { ?> <table class="table table-responsive table-striped table-hover m-t-20 m-b-20"> <thead> <tr> <td class="col-xs-2"><?php echo $locale['forum_107']; ?> </td> <td class="col-xs-2"><?php echo $locale['forum_108']; ?> </td> <td><?php echo $locale['forum_109']; ?> </td> <td><?php echo $locale['forum_115']; ?> </td> <td><?php echo $locale['forum_110']; ?> </td> <td><?php echo $locale['forum_111']; ?> </td> <td><?php echo $locale['forum_112']; ?> </td> </tr> </thead> <tbody> <?php while ($data = dbarray($mood_result)) { $edit_link = clean_request("ref=mood_form&action=edit&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE); $delete_link = clean_request("ref=mood_form&action=delete&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE); ?> <tr> <td> <a href="<?php echo $edit_link; ?> "> <?php echo QuantumFields::parse_label($data['mood_name']); ?> </a> </td> <td><?php echo sprintf($locale['forum_113'], ucfirst(fusion_get_userdata("user_name")), QuantumFields::parse_label($data['mood_description'])); ?> </td> <td> <?php if (!empty($data['mood_icon'])) { ?> <i class="<?php echo $data['mood_icon']; ?> "></i> <?php } ?> </td> <td><?php echo format_word($data['mood_count'], $locale['fmt_post']); ?> </td> <td><?php echo getgroupname($data['mood_notify']); ?> </td> <td><?php echo getgroupname($data['mood_access']); ?> </td> <td> <a href="<?php echo $edit_link; ?> "><?php echo $locale['edit']; ?> </a> - <a href="<?php echo $delete_link; ?> "><?php echo $locale['delete']; ?> </a> </td> </tr> <?php } ?> </tbody> </table> <?php if ($mood_max_count > 16) { echo makepagenav($_GET['rowstart'], $rows, $mood_max_count, 3); } ?> <?php } else { ?> <div class="well text-center"><?php echo $locale['forum_114']; ?> </div> <?php } }
function do_pick($t, $db, &$pick_db, &$reason) { if ($db === NULL) { $db = defaultDB(); } if ($t === NULL) { $reason = "pick was null"; return $t; } elseif (ISOP($t) or ISHTML($t)) { return $t; } elseif (ISPICK($t)) { return $t->rand($db); } elseif (is_string($t)) { return $t; } elseif (is_callable($t)) { $t = _process_value($t, $pick_db, $db); if ($t === NULL) { $reason = "custom function returned NULL"; return $t; } else { return do_pick($t, $db, $pick_db, $reason); } } elseif (array_key_exists("condition", $t) and !$t["condition"]($pick_db, $db, null)) { return FALSE; } elseif (array_key_exists("value", $t)) { return _process_value($t["value"], $pick_db, $db); } if (!($word = safe_get("word", $t))) { $searcher = $db->searcher(); #var_dump(array_keys($searcher->master)); if (array_key_exists("name", $t)) { $searcher = $searcher->name(_process_value($t["name"], $pick_db, $db)); } if (array_key_exists("language", $t)) { $searcher = $searcher->lang(_process_value($t["language"], $pick_db, $db)); } elseif (array_key_exists("lang", $t)) { $searcher = $searcher->lang(_process_value($t["lang"], $pick_db, $db)); } if (array_key_exists("speechpart", $t)) { $searcher = $searcher->partofspeech(_process_value($t["speechpart"], $pick_db, $db)); } elseif (array_key_exists("spart", $t)) { $searcher = $searcher->partofspeech(_process_value($t["spart"], $pick_db, $db)); } if (array_key_exists("attr", $t)) { foreach ($t["attr"] as $k => $v) { $v = _process_value($v, $pick_db, $db); if ($reverse = substr($k, 0, 1) === "!") { $k = substr($k, 1); $m = "only_without_attr"; } else { $m = "only_with_attr"; } $searcher = $searcher->{$m}($v !== NULL ? ATTR($k, $v) : ATTR($k)); } } $word = $searcher->rand(); } if (!ISWORD($word)) { $reason = "could not find a word with name " . var_export($t["name"], 1) . " and attrs " . var_export(safe_get("attr", $t), 1); return; } if (array_key_exists("store_word", $t)) { $pick_db[$t["store_word"]] = $word; } $word->read_paths(); $path = PATH($word); if (array_key_exists("path", $t)) { $p = $t["path"]; if (!is_array($p)) { $p = _process_value($p, $pick_db, $db, $path); } foreach ($p as $k => $_) { $path->add2([$k => _process_value($_, $pick_db, $db, $path)]); } } if (array_key_exists("verb-gender", $t)) { $g = $t["verb-gender"]; $g = _process_value($g, $pick_db, $db, $path); if ($g !== NULL and $path->exists()) { $path->add($g); if (!$path->hasvalue()) { $path->take("gender"); } } } if ($path->hasvalue() || !(string) $path) { $ret = $path->hasvalue() ? $path->get() : $word->name(); if (array_key_exists("store", $t)) { $pick_db[$t["store"]] = $ret; } if (array_key_exists("store_path", $t)) { $pick_db[$t["store_path"]] = $path; } return format_word($ret, $word->lang()); } else { $reason = "path '{$path}' didn't exist in word with id <a target='_blank' href='dictionary.php?id=" . $word->id() . "'>" . $word->id() . "</a> or was NULL"; return; } }
function display_inflection($w, $hidden = TRUE) { if ($c = $w->cached()) { if (($_ = json_decode($c, true)) === NULL) { echo $c; return; } else { $c = $_; } for ($i = 0; $i < count($c); $i++) { if ($i === 0) { echo $c[$i]; } else { echo format_word($c[$i]); } } return; } else { ob_start(); } $pronunciations = $w->pronunciations(); //error_log($pronunciations); $w->clear_connections(); $connections = $w->connections(); list($values0, $values1, $values2, $values3, $values4) = word_table_values($w); if (!$values0 and !$values1 and !$values3 and !$values4 and !$values2) { ?> <span id="word<?php echo $w->id(); ?> _forms">(No inflection for this word)</span><?php return; } ?> Inflection <?php display_icon("visibility", $hidden ? "Show" : "Hide", "toggle-forms" . $w->id()); if ($pronunciations) { ?> <span id="toggle-pronunciations<?php echo $w->id(); ?> _outer"> [<a href="javascript:void(0)" id="toggle-pronunciations<?php echo $w->id(); ?> ">show IPA</a>]<br><br> </span><?php } ?> <span id="toggle-quizzing<?php echo $w->id(); ?> _outer"> [<a href="javascript:void(0)" id="toggle-quizzing<?php echo $w->id(); ?> ">cover forms</a>]<br><br> </span><?php do_table($w, $values0, $values1, $values2, $values3, $values4, NULL, "format_value", function ($v, $p) use($w) { return format_word($p, $w->lang(), true); }, function ($p) use($connections) { $p = (string) $p; foreach ($connections as $connect) { if ($connect->type() === $p) { return $connect->to(); } } }, function ($p) use($pronunciations, $w) { $p = (string) $p; $made_div = FALSE; $last_type = NULL; $first = TRUE; foreach ($pronunciations as $pron) { if ((string) $pron->path() !== $p) { continue; } if ($pron->type() !== "IPA") { continue; } if (!$made_div) { ?> <span class="word<?php echo $w->id(); ?> _pronunciation"><?php $made_div = TRUE; } ?> <br><?php $last_type = $pron->type(); if ($pron->sublang()) { ?> <sup>[<?php echo $pron->sublang(); ?> ]</sup><?php } ?> [<?php echo format_pron($pron->value()); ?> ]<?php $first = FALSE; } if ($made_div) { ?> </span><?php } }); ?> <script type="text/javascript"> $(function(){ var c = "<?php echo $w->id(); ?> "; var selector = $('#word'+c+'_forms, #toggle-pronunciations'+c+'_outer, #toggle-quizzing'+c+'_outer'); $('#toggle-forms'+c).click(function () { selector.toggle(); var vis = $('#word'+c+'_forms').is(':visible'); $('#toggle-forms'+c).attr('title', vis ? 'Hide' : 'Show'); if (!vis) $('.word'+c+'_pronunciation').hide(); }); <?php if (!$hidden) { ?> selector.hide(); <?php } ?> $('#toggle-forms'+c).trigger("click"); $('#toggle-pronunciations'+c).click(function () { $('.word'+c+'_pronunciation').toggle(); $('#toggle-pronunciations'+c).attr('title', $('.word'+c+'_pronunciation').is(':visible') ? 'hide IPA' : 'show IPA'); }); $('#toggle-quizzing'+c).click(function () { $('#word'+c+' td').addClass('hidden').on('click', function() {$(this).removeClass('hidden').off('click')}); }); $('.word'+c+'_pronunciation, #toggle-pronunciations').hide(); }); </script> <?php $w->set_cached(ob_get_contents()); ob_end_flush(); }
/** * Display Comments * @param $comment_type * @param $comment_db * @param $comment_col * @param $comment_item_id * @param $clink */ public function showComments($comment_type, $comment_db, $comment_col, $comment_item_id, $clink) { global $aidlink; $locale = fusion_get_locale(); $locale += fusion_get_locale('', LOCALE . LOCALESET . "user_fields.php"); $cpp = $this->settings['comments_per_page']; $comment_data = array('comment_id' => isset($_GET['comment_id']) && isnum($_GET['comment_id']) ? $_GET['comment_id'] : 0, 'comment_name' => '', 'comment_message' => '', 'comment_datestamp' => time(), 'comment_item_id' => $comment_item_id, 'comment_type' => $comment_type, 'comment_cat' => 0, 'comment_ip' => USER_IP, 'comment_ip_type' => USER_IP_TYPE, 'comment_hidden' => 0); /** Delete */ if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_name='" . $this->userdata['user_id'] . "'")) { $result = dbquery("\n DELETE FROM " . DB_COMMENTS . "\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\n\t\t\t\tAND comment_name='" . $this->userdata['user_id'] . "'")); } redirect($clink . ($this->settings['comments_sorting'] == "ASC" ? "" : "&c_start=0")); } if ($this->settings['comments_enabled'] == "1") { $this->c_arr['c_info']['comments_count'] = format_word(0, $this->locale['fmt_comment']); // Handle Comment Posts if ((iMEMBER || $this->settings['guestposts']) && isset($_POST['post_comment'])) { if (!iMEMBER && $this->settings['guestposts']) { // Process Captchas $_CAPTCHA_IS_VALID = FALSE; include INCLUDES . "captchas/" . $this->settings['captcha'] . "/captcha_check.php"; if (!isset($_POST['captcha_code']) && $_CAPTCHA_IS_VALID == FALSE) { \defender::stop(); addNotice("danger", $locale['u194']); } } $comment_data = array('comment_id' => isset($_GET['comment_id']) && isnum($_GET['comment_id']) ? $_GET['comment_id'] : 0, 'comment_name' => iMEMBER ? $this->userdata['user_id'] : form_sanitizer($_POST['comment_name'], '', 'comment_name'), 'comment_message' => form_sanitizer($_POST['comment_message'], '', 'comment_message'), 'comment_datestamp' => time(), 'comment_item_id' => $comment_item_id, 'comment_type' => $comment_type, 'comment_cat' => form_sanitizer($_POST['comment_cat'], 0, 'comment_cat'), 'comment_ip' => USER_IP, 'comment_ip_type' => USER_IP_TYPE, 'comment_hidden' => 0); if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && $comment_data['comment_id']) { // Update comment if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $comment_data['comment_id'] . "'\n AND comment_item_id='" . $comment_item_id . "'\n AND comment_type='" . $comment_type . "'\n AND comment_name='" . $this->userdata['user_id'] . "'\n AND comment_hidden='0'") && \defender::safe()) { $c_name_query = "SELECT comment_name FROM " . DB_COMMENTS . " WHERE comment_id='" . $comment_data['comment_id'] . "'"; $comment_data['comment_name'] = dbresult(dbquery($c_name_query), 0); dbquery_insert(DB_COMMENTS, $comment_data, 'update'); if ($this->settings['comments_sorting'] == "ASC") { $c_operator = "<="; } else { $c_operator = ">="; } $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_id" . $c_operator . "'" . $comment_data['comment_id'] . "'\n AND comment_item_id='" . $comment_item_id . "'\n AND comment_type='" . $comment_type . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; addNotice("success", $locale['global_027']); redirect(self::format_clink($clink) . "&c_start=" . (isset($c_start) && isnum($c_start) ? $c_start : "")); } } else { // Save New comment if (!dbcount("(" . $comment_col . ")", $comment_db, $comment_col . "='" . $comment_item_id . "'")) { redirect(BASEDIR . "index.php"); } if (\defender::safe()) { $c_start = 0; $id = 0; if ($comment_data['comment_name'] && $comment_data['comment_message']) { require_once INCLUDES . "flood_include.php"; if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='" . USER_IP . "'")) { dbquery_insert(DB_COMMENTS, $comment_data, 'save'); $id = dblastid(); if ($this->settings['comments_sorting'] == "ASC") { $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; } } redirect(self::format_clink($clink) . "&c_start=" . $c_start . "#c" . $id); } } } } $c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'"); if (!isset($_GET['c_start']) && $c_rows > $cpp) { $_GET['c_start'] = (ceil($c_rows / $cpp) - 1) * $cpp; } if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])) { $_GET['c_start'] = 0; } $comment_query = "\n SELECT tcm.*, tcu.user_id, tcu.user_name, tcu.user_avatar, tcu.user_status\n FROM " . DB_COMMENTS . " tcm\n LEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n WHERE comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'\n ORDER BY comment_datestamp " . $this->settings['comments_sorting'] . ", comment_cat DESC"; $query = dbquery($comment_query); if (dbrows($query) > 0) { $i = $this->settings['comments_sorting'] == "ASC" ? $_GET['c_start'] + 1 : $c_rows - $_GET['c_start']; if ($c_rows > $cpp) { $this->c_arr['c_info']['c_makepagenav'] = makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink . "&", "c_start"); } if (iADMIN && checkrights("C")) { $this->c_arr['c_info']['admin_link'] = "<!--comment_admin-->\n"; $this->c_arr['c_info']['admin_link'] .= "<a href='" . ADMIN . "comments.php" . $aidlink . "&ctype=" . $comment_type . "&comment_item_id=" . $comment_item_id . "'>" . $this->locale['c106'] . "</a>"; } while ($row = dbarray($query)) { $actions = array("edit_dell" => "", "edit_link" => "", "delete_link" => ""); if (iADMIN && checkrights("C") || iMEMBER && $row['comment_name'] == $this->userdata['user_id'] && isset($row['user_name'])) { $edit_link = clean_request('c_action=edit&comment_id=' . $row['comment_id'], array('c_action', 'comment_id'), false) . "#edit_comment"; $delete_link = clean_request('c_action=delete&comment_id=' . $row['comment_id'], array('c_action', 'comment_id'), false); $comment_actions = "<!---comment_actions--><div class='btn-group'>\n <a class='btn btn-xs btn-default' href='{$edit_link}'>" . $this->locale['c108'] . "</a>\n <a class='btn btn-xs btn-default' href='{$delete_link}' onclick=\"return confirm('" . $this->locale['c110'] . "');\"><i class='fa fa-trash'></i>" . $this->locale['c109'] . "</a>\n </div><!---//comment_actions-->\n "; $actions = array("edit_link" => array('link' => $edit_link, 'name' => $this->locale['c108']), "delete_link" => array('link' => $delete_link, 'name' => $this->locale['c109']), "edit_dell" => $comment_actions); } $reply_form = ""; if (isset($_GET['comment_reply']) && $_GET['comment_reply'] == $row['comment_id']) { $locale = fusion_get_locale(); $comment_data['comment_cat'] = $row['comment_id']; $reply_form = openform("comments_reply_form", "post", FUSION_REQUEST, array("class" => "comments_reply_form")); if (iGUEST) { $reply_form .= form_text('comment_name', fusion_get_locale('c104'), $comment_data['comment_name'], array('max_length' => 30)); } $reply_form .= form_hidden("comment_cat", "", $comment_data['comment_cat']); $reply_form .= form_textarea("comment_message", "", $comment_data['comment_message'], array("tinymce" => "simple", "type" => fusion_get_settings("tinymce_enabled") ? "tinymce" : "bbcode", "input_id" => "comment_message-" . $i, "required" => true)); if (iGUEST && (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) { $_CAPTCHA_HIDE_INPUT = FALSE; $reply_form .= "<div class='m-t-10 m-b-10'>"; $reply_form .= "<label class='col-xs-12 col-sm-3'>" . $locale['global_150'] . "</label><div class='col-xs-12 col-sm-9'>\n"; ob_start(); include INCLUDES . "captchas/" . $this->settings['captcha'] . "/captcha_display.php"; $reply_form .= ob_get_contents(); ob_end_clean(); if (!$_CAPTCHA_HIDE_INPUT) { $reply_form .= "<br />\n<label for='captcha_code'>" . $locale['global_151'] . "</label>"; $reply_form .= "<br />\n<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />\n"; } $reply_form .= "</div>\n"; $reply_form .= "</div>\n"; } $reply_form .= form_button('post_comment', $locale['c102'], $locale['c102'], array('class' => 'btn-success m-t-10')); $reply_form .= closeform(); } /** formats $row */ $row = array("comment_id" => $row['comment_id'], "comment_cat" => $row['comment_cat'], "i" => $i, "user_avatar" => display_avatar($row, '50px', '', false, 'img-rounded'), "user" => array("user_id" => $row['user_id'], "user_name" => $row['user_name'], "user_avatar" => $row['user_avatar'], "status" => $row['user_status']), "reply_link" => clean_request("comment_reply=" . $row['comment_id'], array("comment_reply"), false), "reply_form" => $reply_form, "comment_datestamp" => showdate('shortdate', $row['comment_datestamp']), "comment_time" => timer($row['comment_datestamp']), "comment_message" => "<!--comment_message-->\n" . nl2br(parseubb(parsesmileys($row['comment_message']))) . "<!--//comment_message-->\n", "comment_name" => $row['user_name'] ? profile_link($row['comment_name'], $row['user_name'], $row['user_status'], 'strong text-dark') : $row['comment_name']); $row += $actions; $id = $row['comment_id']; $parent_id = $row['comment_cat'] === NULL ? "0" : $row['comment_cat']; $data[$id] = $row; $this->c_arr['c_con'][$parent_id][$id] = $row; $this->settings['comments_sorting'] == "ASC" ? $i++ : $i--; } // Paginate the array $this->c_arr['c_con'][0] = array_chunk($this->c_arr['c_con'][0], $cpp, true); // Pass cpp settings $this->c_arr['c_info']['comments_per_page'] = $cpp; $this->c_arr['c_info']['comments_count'] = format_word(number_format($i - 1, 0), $this->locale['fmt_comment']); } echo "<a id='comments' name='comments'></a>"; render_comments($this->c_arr['c_con'], $this->c_arr['c_info']); render_comments_form($comment_type, $clink, $comment_item_id, isset($_CAPTCHA_HIDE_INPUT) ? $_CAPTCHA_HIDE_INPUT : FALSE); } }
if ($reverse = substr($attr, 0, 1) === "!") { $attr = substr($attr, 1); } if (strpos($attr, "=") === FALSE) { $a = ATTR($attr); } else { list($name, $value) = explode("=", $attr, 2); $a = ATTR($name, $value); } if ($a !== NULL) { if (!$reverse) { $searcher = $searcher->only_with_attr($a); } else { $searcher = $searcher->only_without_attr($a); } } } $list = $searcher->all(); } else { $list = []; foreach ($ids as $id) { $list[] = WORD(defaultDB(), intval($id)); } } $res = vec_norm(array_map(function ($e) { if (no_format($e)) { return ["data" => $e->name(), "value" => $e->id() . "", "display" => $e->info()]; } return ["data" => $e->name(), "value" => $e->id() . "", "display" => format_word($e->info())]; }, $list)); echo json_encode($res);
$info['album_stats'] .= $locale['423'] . profile_link($latest_update['user_id'], $latest_update['user_name'], $latest_update['user_status']) . "" . $locale['424'] . showdate("longdate", $latest_update['photo_datestamp']) . "\n"; $result = dbquery("SELECT tp.*,\n\t\t\t\t\ttu.user_id, tu.user_name, tu.user_status, tu.user_avatar,\n\t\t\t\t\tSUM(tr.rating_vote) 'sum_rating',\n\t\t\t\t\tCOUNT(tr.rating_vote) 'count_rating',\n\t\t\t\t\tCOUNT(tr.rating_item_id) 'count_votes'\n\t\t\t\t\tFROM " . DB_PHOTOS . " tp\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu ON tp.photo_user=tu.user_id\n\t\t\t\t\tLEFT JOIN " . DB_RATINGS . " tr ON tr.rating_item_id = tp.photo_id AND tr.rating_type='P'\n\t\t\t\t\tWHERE album_id='" . intval($_GET['album_id']) . "'\n\t\t\t\t\tGROUP BY photo_id ORDER BY photo_order\n\t\t\t\t\tlimit " . intval($_GET['rowstart']) . "," . intval($gallery_settings['gallery_pagination'])); $info['photo_rows'] = dbrows($result); $info['page_nav'] = $info['max_rows'] > $gallery_settings['gallery_pagination'] ? makepagenav($_GET['rowstart'], $gallery_settings['gallery_pagination'], $info['max_rows'], 3, INFUSIONS . "gallery/gallery.php?album_id=" . $_GET['album_id'] . "&") : ''; if ($info['photo_rows'] > 0) { // this is photo while ($data = dbarray($result)) { // data manipulation $data += array("photo_link" => array('link' => INFUSIONS . "gallery/gallery.php?photo_id=" . $data['photo_id'], 'name' => $data['photo_title']), "image" => displayPhotoImage($data['photo_id'], $data['photo_filename'], $data['photo_thumb1'], $data['photo_thumb2'], INFUSIONS . "gallery/gallery.php?photo_id=" . $data['photo_id']), "title" => $data['photo_title'] ? $data['photo_title'] : $data['image'], "description" => $data['photo_description'] ? nl2br(parse_textarea($data['photo_description'])) : '', "photo_views" => format_word($data['photo_views'], $locale['fmt_views'])); if (iADMIN && checkrights("PH")) { global $aidlink; $data['photo_edit'] = array("link" => INFUSIONS . "gallery/gallery_admin.php" . $aidlink . "&section=photo_form&action=edit&photo_id=" . $data['photo_id'], "name" => $locale['edit']); $data['photo_delete'] = array("link" => INFUSIONS . "gallery/gallery_admin.php" . $aidlink . "&section=actions&action=delete&photo_id=" . $data['photo_id'], "name" => $locale['delete']); } if ($data['photo_allow_comments']) { $data += array("photo_votes" => $data['count_votes'] > 0 ? $data['count_votes'] : '0', "photo_comments" => array('link' => $data['photo_link']['link'] . '#comments', 'name' => $data['count_votes'], 'word' => format_word($data['count_votes'], $locale['fmt_comment']))); } if ($data['photo_allow_ratings']) { $data += array("sum_rating" => $data['sum_rating'] > 0 ? $data['sum_rating'] : '0', "photo_ratings" => array('link' => $data['photo_link']['link'] . '#ratings', 'name' => $data['sum_rating'], 'word' => $data['sum_rating'] > 0 ? $data['sum_rating'] / $data['count_rating'] * 10 . "/10" : "0/10")); } $info['item'][] = $data; } } } render_photo_album($info); } else { redirect(INFUSIONS . 'gallery/gallery.php'); } } else { /* Main Index */ add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"));
openside(""); echo form_select('album_id', $locale['photo_0003'], $callback_data['album_id'], array('options' => get_albumOpts(), 'inline' => TRUE)); echo form_button('publish', $locale['gallery_0158'], $locale['gallery_0158'], array('class' => 'btn-primary m-r-10')); closeside(); echo "</div></div>\n"; echo form_button('publish', $locale['gallery_0158'], $locale['gallery_0158'], array('class' => 'btn-primary m-r-10')); echo form_button('delete', $locale['gallery_0159'], $locale['gallery_0159'], array('class' => 'btn-warning m-r-10')); echo closeform(); } } } } else { $result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='p' order by submit_datestamp desc\n\t\t\t"); $rows = dbrows($result); if ($rows > 0) { echo "<div class='well'>" . sprintf($locale['gallery_0151'], format_word($rows, $locale['fmt_submission'])) . "</div>\n"; echo "<table class='table table-striped'>\n"; echo "<tr>\n"; echo "<th>" . $locale['gallery_0152'] . "</th>\n<th>" . $locale['gallery_0153'] . "</th><th>" . $locale['gallery_0154'] . "</th><th>" . $locale['gallery_0155'] . "</th>"; echo "</tr>\n"; echo "<tbody>\n"; while ($data = dbarray($result)) { $submit_criteria = unserialize($data['submit_criteria']); echo "<tr>\n"; echo "<td><a href='" . clean_request("submit_id=" . $data['submit_id'], array("section", "aid"), TRUE) . "'>" . $submit_criteria['photo_title'] . "</a></td>\n"; echo "<td>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</td>\n"; echo "<td>" . timer($data['submit_datestamp']) . "</td>\n"; echo "<td>" . $data['submit_id'] . "</td>\n"; echo "</tr>\n"; } echo "</tbody>\n</table>\n";
$extendedSettings = array(); if (!fusion_get_settings("tinymce_enabled")) { $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['blog_0426b'], "form_name" => "inputform"); } echo form_textarea('blog_extended', $locale['blog_0426'], $callback_data['blog_extended'], $extendedSettings); echo form_button('preview', $locale['blog_0436'], $locale['blog_0436'], array('class' => 'btn-default m-r-10')); echo form_button('publish', $locale['blog_0134'], $locale['blog_0134'], array('class' => 'btn-primary m-r-10')); echo form_button('delete', $locale['blog_0135'], $locale['blog_0135'], array('class' => 'btn-warning m-r-10')); echo closeform(); } } } else { $result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='b' order by submit_datestamp desc\n\t\t\t"); $rows = dbrows($result); if ($rows > 0) { echo "<div class='well'>" . sprintf($locale['blog_0137'], format_word($rows, $locale['fmt_submission'])) . "</div>\n"; echo "<table class='table table-striped'>\n"; echo "<tr>\n"; echo "<th>" . $locale['blog_0136'] . "</th>\n<th>" . $locale['blog_0142'] . "</th><th>" . $locale['blog_0143'] . "</th><th>" . $locale['blog_0144'] . "</th>"; echo "</tr>\n"; echo "<tbody>\n"; while ($data = dbarray($result)) { $submit_criteria = unserialize($data['submit_criteria']); echo "<tr>\n"; echo "<td><a href='" . clean_request("submit_id=" . $data['submit_id'], array("section", "aid"), TRUE) . "'>" . $submit_criteria['blog_subject'] . "</a></td>\n"; echo "<td>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</td>\n"; echo "<td>" . timer($data['submit_datestamp']) . "</td>\n"; echo "<td>" . $data['submit_id'] . "</td>\n"; echo "</tr>\n"; } echo "</tbody>\n</table>\n";
/** * Theme Overview Page */ public function display_theme_overview() { global $locale, $aidlink; $theme_dbfile = '/theme_db.php'; $data = array("theme_name" => $this->theme_name, "theme_screenshot" => "", "theme_author" => "", "theme_web" => "", "theme_license" => 'AGPL3', "theme_version" => "", "theme_description" => ""); if (file_exists(THEMES . $this->theme_name . $theme_dbfile)) { // new 9.00 include THEMES . $this->theme_name . $theme_dbfile; $data['theme_name'] = !empty($theme_title) ? $theme_title : $data['theme_name']; $data['theme_screenshot'] = isset($theme_screenshot) && file_exists(THEMES . $this->theme_name . "/" . $theme_screenshot) ? THEMES . $this->theme_name . "/" . $theme_screenshot : IMAGES . 'imagenotfound.jpg'; $data['theme_author'] = !empty($theme_author) ? $theme_author : $data['theme_author']; $data['theme_web'] = !empty($theme_web) ? $theme_web : $data['theme_web']; $data['theme_license'] = !empty($theme_license) ? $theme_license : $data['theme_license']; $data['theme_version'] = !empty($theme_version) ? $theme_version : $data['theme_version']; $data['theme_description'] = !empty($theme_description) ? $theme_description : $data['theme_description']; // Find widgets if (isset($theme_newtable) || isset($theme_insertdbrow) && Admin::theme_widget_exists($data['theme_name'])) { // count how many widget components $data['theme_widgets'] = isset($theme_newtable) ? count($theme_newtable) : 0; $data['theme_widget_status'] = dbcount("(settings_name)", DB_SETTINGS_THEME, "settings_theme='" . $data['theme_name'] . "'") > 0 ? TRUE : FALSE; } } else { $data['theme_screenshot'] = file_exists(THEMES . $this->theme_name . "/screenshot.jpg") ? THEMES . $this->theme_name . "/screenshot.jpg" : IMAGES . 'imagenotfound.jpg'; } $result = dbquery("SELECT * FROM " . DB_THEME . " WHERE theme_name='" . $this->theme_name . "' ORDER BY theme_datestamp DESC"); if (dbrows($result) > 0) { echo "<div class='m-b-20 p-b-20 m-t-20'>\n"; echo openform('preset-form', 'post', FUSION_REQUEST, array('notice' => 0, 'max_tokens' => 1)); while ($preset = dbarray($result)) { // @to fix: set as active, edit, delete options. echo "<div class='list-group-item m-t-10 display-inline-block clearfix text-center'>\n" . thumbnail($data['theme_screenshot'], '150px') . "\n\t\t\t\t<div class='display-block strong m-t-10 m-b-20'>" . trimlink($preset['theme_title'], 30) . "</div>"; echo "<div class='btn-group m-t-10 m-b-10'>\n"; if ($preset['theme_active'] == 1) { echo form_button('active', $locale['theme_1003'], 'active', array('class' => 'btn-sm btn-default active', 'deactivate' => 1)); } else { echo form_button('load_preset', $locale['theme_1004'], $preset['theme_id'], array('class' => 'btn-sm btn-default', 'icon' => 'entypo upload')); } // dropdown echo "<a data-toggle='dropdown' class='btn btn-default btn-sm dropdown-toggle'><i class='fa fa-cog fa-fw'></i><span class='caret'></span></a>\n"; echo "<ul class='dropdown-menu'>\n"; echo "<li><a href='" . clean_request("section=css&e_action=edit&preset=" . $preset['theme_id'], array("aid", "action", "theme"), TRUE) . "'>" . $locale['edit'] . "</a></li>\n"; echo "<li><a href='" . clean_request("delete_preset=" . $preset['theme_id'], array("aid", "action", "theme"), TRUE) . "'>" . $locale['delete'] . "</a></li>\n"; echo "</ul>\n"; echo form_hidden('theme', '', $preset['theme_name']); echo "</div>\n"; echo "</div>\n"; } echo closeform(); echo "</div>\n"; } else { echo "<div class='m-t-20 well text-center'>" . $locale['theme_1030'] . "</div>\n"; } echo "<div class='row'>\n"; echo "<div class='col-xs-12 col-sm-6'>\n"; echo "<span><strong>" . $locale['theme_1001'] . "</strong> " . $data['theme_name'] . "</span><br/>"; if ($data['theme_description']) { echo "<span><strong>" . $locale['theme_1025'] . "</strong> " . $data['theme_description'] . "</span><br/>"; } if (isset($data['theme_widgets'])) { echo "<span><strong>" . $locale['theme_1027'] . "</strong> " . format_word($data['theme_widgets'], $locale['theme_1021']) . "</span><br/>"; } echo "</div>\n<div class='col-xs-12 col-sm-6'>\n"; if ($data['theme_author']) { echo "<span><strong>" . $locale['theme_1026'] . "</strong> " . $data['theme_author'] . "</span><br/>"; } if ($data['theme_web']) { echo "<span><strong>" . $locale['theme_1015'] . "</strong><a href='" . $data['theme_web'] . "'> Link</a></span><br/>"; } if ($data['theme_version']) { echo "<span><strong>" . $locale['theme_1014'] . "</strong> " . $data['theme_version'] . "</span><br/>"; } if ($data['theme_license']) { echo "<span><strong>" . $locale['theme_1013'] . "</strong> " . $data['theme_license'] . "</span><br/>"; } echo "<span><strong>" . $locale['theme_1028'] . "</strong> " . dbrows($result) . "</span><br/>"; echo "</div>\n"; echo "</div>\n"; }
/** * Get thread structure when given specific tag id * @param string $tag_id * @param bool|FALSE $filter * @return array */ public static function get_tag_thread($tag_id = '0', $filter = FALSE) { $info = array(); $locale = fusion_get_locale("", FORUM_LOCALE); $forum_settings = ForumServer::get_forum_settings(); $userdata = fusion_get_userdata(); $userdata['user_id'] = !empty($userdata['user_id']) ? (int) intval($userdata['user_id']) : 0; $lastVisited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(); /** * Get threads with filter conditions (XSS prevention) */ $thread_query = "\n SELECT\n count(t.thread_id) 'thread_max_rows',\n count(a1.attach_id) 'attach_image',\n count(a2.attach_id) 'attach_files'\n FROM " . DB_FORUM_THREADS . " t\n LEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n INNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n #LEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id\n LEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n LEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n #LEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n LEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n LEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n WHERE " . in_group('t.thread_tags', intval($tag_id), '.') . " AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . "\n " . (isset($filter['condition']) ? $filter['condition'] : '') . "\n GROUP BY tf.forum_id\n "; $thread_result = dbquery($thread_query); $thread_rows = dbrows($thread_result); $count = array("thread_max_rows" => 0, "attach_image" => 0, "attach_files" => 0); $info['item'][$tag_id]['forum_threadcount'] = 0; $info['item'][$tag_id]['forum_threadcount_word'] = format_word($count['thread_max_rows'], $locale['fmt_thread']); if ($thread_rows > 0) { $count = dbarray($thread_result); $info['item'][$tag_id]['forum_threadcount'] = 0; $info['item'][$tag_id]['forum_threadcount_word'] = format_word($count['thread_max_rows'], $locale['fmt_thread']); } $info['thread_max_rows'] = $count['thread_max_rows']; if ($info['thread_max_rows'] > 0) { $info['threads']['pagenav'] = ""; $info['threads']['pagenav2'] = ""; // anti-XSS filtered rowstart $_GET['thread_rowstart'] = isset($_GET['thread_rowstart']) && isnum($_GET['thread_rowstart']) && $_GET['thread_rowstart'] <= $count['thread_max_rows'] ? $_GET['thread_rowstart'] : 0; $thread_query = "\n SELECT t.*, tf.forum_type, tf.forum_name, tf.forum_cat,\n tu1.user_name ' author_name', tu1.user_status 'author_status', tu1.user_avatar 'author_avatar',\n tu2.user_name 'last_user_name', tu2.user_status 'last_user_status', tu2.user_avatar 'last_user_avatar',\n p1.post_datestamp, p1.post_message,\n IF (n.thread_id > 0, 1 , 0) 'user_tracked',\n count(v.vote_user) 'thread_rated',\n count(pv.forum_vote_user_id) 'poll_voted',\n p.forum_poll_title,\n count(v.post_id) AS vote_count,\n a1.attach_name, a1.attach_id,\n a2.attach_name, a2.attach_id,\n count(a1.attach_mime) 'attach_image',\n count(a2.attach_mime) 'attach_files',\n min(p2.post_datestamp) 'first_post_datestamp'\n FROM " . DB_FORUM_THREADS . " t\n LEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n INNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n LEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id\n LEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n LEFT JOIN " . DB_FORUM_POSTS . " p2 ON p2.thread_id = t.thread_id\n LEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n #LEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n LEFT JOIN " . DB_FORUM_VOTES . " v on v.thread_id = t.thread_id AND v.vote_user='******'user_id'] . "' AND v.forum_id = t.forum_id AND tf.forum_type='4'\n LEFT JOIN " . DB_FORUM_POLL_VOTERS . " pv on pv.thread_id = t.thread_id AND pv.forum_vote_user_id='" . $userdata['user_id'] . "' AND t.thread_poll=1\n LEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n LEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n LEFT JOIN " . DB_FORUM_THREAD_NOTIFY . " n on n.thread_id = t.thread_id and n.notify_user = '******'user_id'] . "'\n WHERE " . in_group('t.thread_tags', intval($tag_id), '.') . " AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . "\n " . (isset($filter['condition']) ? $filter['condition'] : '') . "\n " . (multilang_table("FO") ? "AND tf.forum_language='" . LANGUAGE . "'" : '') . "\n GROUP BY t.thread_id\n " . (isset($filter['order']) ? $filter['order'] : '') . "\n LIMIT " . intval($_GET['thread_rowstart']) . ", " . $forum_settings['threads_per_page']; $cthread_result = dbquery($thread_query); if (dbrows($cthread_result) > 0) { while ($threads = dbarray($cthread_result)) { $icon = ""; $match_regex = $threads['thread_id'] . "\\|" . $threads['thread_lastpost'] . "\\|" . $threads['forum_id']; if ($threads['thread_lastpost'] > $lastVisited) { if (iMEMBER && ($threads['thread_lastuser'] == $userdata['user_id'] || preg_match("(^\\.{$match_regex}\$|\\.{$match_regex}\\.|\\.{$match_regex}\$)", $userdata['user_threads']))) { $icon = "<i class='" . get_forumIcons('thread') . "' title='" . $locale['forum_0261'] . "'></i>"; } else { $icon = "<i class='" . get_forumIcons('new') . "' title='" . $locale['forum_0260'] . "'></i>"; } } $author = array('user_id' => $threads['thread_author'], 'user_name' => $threads['author_name'], 'user_status' => $threads['author_status'], 'user_avatar' => $threads['author_avatar']); $lastuser = array('user_id' => $threads['thread_lastuser'], 'user_name' => $threads['last_user_name'], 'user_status' => $threads['last_user_status'], 'user_avatar' => $threads['last_user_avatar']); $threads += array("thread_link" => array("link" => FORUM . "viewthread.php?thread_id=" . $threads['thread_id'], "title" => $threads['thread_subject']), "forum_type" => $threads['forum_type'], "thread_pages" => makepagenav(0, $forum_settings['posts_per_page'], $threads['thread_postcount'], 3, FORUM . "viewthread.php?thread_id=" . $threads['thread_id'] . "&"), "thread_icons" => array('lock' => $threads['thread_locked'] ? "<i class='" . self::get_forumIcons('lock') . "' title='" . $locale['forum_0263'] . "'></i>" : '', 'sticky' => $threads['thread_sticky'] ? "<i class='" . self::get_forumIcons('sticky') . "' title='" . $locale['forum_0103'] . "'></i>" : '', 'poll' => $threads['thread_poll'] ? "<i class='" . self::get_forumIcons('poll') . "' title='" . $locale['forum_0314'] . "'></i>" : '', 'hot' => $threads['thread_postcount'] >= 20 ? "<i class='" . self::get_forumIcons('hot') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'reads' => $threads['thread_views'] >= 20 ? "<i class='" . self::get_forumIcons('reads') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'image' => $threads['attach_image'] > 0 ? "<i class='" . self::get_forumIcons('image') . "' title='" . $locale['forum_0313'] . "'></i>" : '', 'file' => $threads['attach_files'] > 0 ? "<i class='" . self::get_forumIcons('file') . "' title='" . $locale['forum_0312'] . "'></i>" : '', 'icon' => $icon), "thread_starter" => $locale['forum_0006'] . timer($threads['first_post_datestamp']) . " " . $locale['by'] . " " . profile_link($author['user_id'], $author['user_name'], $author['user_status']) . "</span>", "thread_author" => $author, "thread_last" => array('avatar' => display_avatar($lastuser, '30px', '', '', ''), 'profile_link' => profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']), 'time' => $threads['post_datestamp'], 'post_message' => parseubb(parsesmileys($threads['post_message'])), "formatted" => "<div class='pull-left'>" . display_avatar($lastuser, '30px', '', '', '') . "</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='overflow-hide'>" . $locale['forum_0373'] . " <span class='forum_profile_link'>" . profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']) . "</span><br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . timer($threads['post_datestamp']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>")); if ($threads['thread_sticky']) { $info['threads']['sticky'][$threads['thread_id']] = $threads; } else { $info['threads']['item'][$threads['thread_id']] = $threads; } } } if ($info['thread_max_rows'] > $forum_settings['threads_per_page']) { $info['threads']['pagenav'] = makepagenav($_GET['thread_rowstart'], $forum_settings['threads_per_page'], $info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart"); $info['threads']['pagenav2'] = makepagenav($_GET['thread_rowstart'], $forum_settings['threads_per_page'], $info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart", TRUE); } } return (array) $info; }
/** * Gallery Album Listing UI */ function gallery_album_listing() { global $locale, $gll_settings, $aidlink; // xss $albumRows = dbcount("(album_id)", DB_PHOTO_ALBUMS, multilang_table("PG") ? "album_language='" . LANGUAGE . "'" : ""); $photoRows = dbcount("(photo_id)", DB_PHOTOS, ""); $update = dbarray(dbquery("select max(photo_datestamp) 'last_updated' from " . DB_PHOTOS . "")); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $albumRows ? $_GET['rowstart'] : 0; if (!empty($albumRows)) { // get albums. $result = dbquery("\n\t\tSELECT album.album_id, album.album_title, album.album_image, album.album_thumb2, album.album_thumb1, album.album_order, album.album_user as user_id,\n\t\tu.user_name, u.user_status, u.user_avatar,\n\t\tcount(photo.photo_id) as photo_count\n\t\tFROM " . DB_PHOTO_ALBUMS . " album\n\t\tLEFT JOIN " . DB_PHOTOS . " photo on photo.album_id=album.album_id\n\t\tINNER JOIN " . DB_USERS . " u on u.user_id=album.album_user\n\t\t" . (multilang_table("PG") ? "where album_language='" . LANGUAGE . "' and" : "where") . "\n\t\t" . groupaccess('album.album_access') . "\n\t\tGROUP BY album.album_id\n\t\tORDER BY album.album_order ASC, album.album_datestamp DESC LIMIT " . intval($_GET['rowstart']) . ", " . intval($gll_settings['gallery_pagination']) . "\n\t\t"); $rows = dbrows($result); // Photo Album header echo "<aside class='text-left' style='border-bottom:1px solid #ddd; padding-bottom:15px;'>\n"; echo "<h2><strong>\n" . $locale['gallery_0022'] . "</strong></h2>\n"; echo "<div class='clearfix'>\n"; echo "<div class='pull-right text-right col-xs-6 col-sm-6'>" . sprintf($locale['gallery_0018'], $rows, $albumRows) . "</div>\n"; echo "<span class='m-r-15'>" . sprintf($locale['gallery_0023'], $albumRows, $photoRows, timer($update['last_updated'])) . "</span>"; if ($albumRows > $rows) { echo "<div class='display-inline-block m-b-10'>\n"; echo makepagenav($_GET['rowstart'], $gll_settings['gallery_pagination'], $albumRows, 3, FUSION_SELF . $aidlink . "&"); echo "</div>\n"; } echo "</div>\n"; echo "</aside>\n"; if ($rows > 0) { echo "<div class='row m-t-20'>\n"; $i = 1; while ($data = dbarray($result)) { //echo "<div class='col-xs-12 col-sm-2'>\n"; echo "<div style='width:" . ($gll_settings['thumb_w'] + 15) . "px; float:left; padding-left:10px; padding-right:10px;'>\n"; echo "<div class='panel panel-default'>\n"; echo "<div class='panel-heading'>\n"; if ($data['photo_count']) { echo "<a href='" . FUSION_SELF . $aidlink . "&album_id=" . $data['album_id'] . "'>\n<strong>" . trimlink($data['album_title'], 20) . "</strong>\n</a>\n"; } else { echo "<strong>" . trimlink($data['album_title'], 20) . "</strong>\n"; } echo "</div>\n"; echo "<div class='overflow-hide' style='height: " . ($gll_settings['thumb_h'] - 15) . "px'>\n"; if ($data['photo_count']) { $link = FUSION_SELF . $aidlink . "&album_id=" . $data['album_id']; echo displayAlbumImage($data['album_image'], $data['album_thumb1'], $data['album_thumb2'], $link); } else { echo displayAlbumImage($data['album_image'], $data['album_thumb1'], $data['album_thumb2'], ""); } echo "</div>\n"; echo "<div class='panel-body'>\n"; echo "<div class='dropdown'>\n"; echo "<button data-toggle='dropdown' class='btn btn-default dropdown-toggle btn-block' type='button'> " . $locale['album_0020'] . " <span class='caret'></span></button>\n"; echo "<ul class='dropdown-menu'>\n"; echo "<li><a href='" . FUSION_SELF . $aidlink . "&section=album_form&action=edit&cat_id=" . $data['album_id'] . "'><i class='fa fa-edit fa-fw'></i> " . $locale['album_0024'] . "</a></li>\n"; echo $i > 1 ? "<li><a href='" . FUSION_SELF . $aidlink . "&section=actions&action=mu&cat_id=" . $data['album_id'] . "&order=" . ($data['album_order'] - 1) . "'><i class='fa fa-arrow-left fa-fw'></i> " . $locale['album_0021'] . "</a></li>\n" : ""; echo $i !== $rows ? "<li><a href='" . FUSION_SELF . $aidlink . "&section=actions&action=md&cat_id=" . $data['album_id'] . "&order=" . ($data['album_order'] + 1) . "'><i class='fa fa-arrow-right fa-fw'></i> " . $locale['album_0022'] . "</a></li>\n" : ""; echo "<li class='divider'></li>\n"; echo "<li><a href='" . FUSION_SELF . $aidlink . "&section=actions&action=delete&cat_id=" . $data['album_id'] . "'><i class='fa fa-trash fa-fw'></i> " . $locale['album_0023'] . "</a></li>\n"; echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; echo "<div class='panel-footer'>\n"; echo format_word($data['photo_count'], $locale['fmt_photo']); echo "</div>\n</div>\n"; echo "</div>\n"; $i++; } echo "</div>\n"; } else { echo "<div class='well m-t-20 text-center'>\n"; echo $locale['gallery_0011']; echo "</div>\n"; } } else { echo "<div class='well m-t-20 text-center'>\n"; echo $locale['gallery_0011']; echo "</div>\n"; } }
echo form_text('download_homepage', $locale['download_0221'], $callback_data['download_homepage'], array('inline' => 1)); echo form_text('download_filesize', $locale['download_0211'], $callback_data['download_filesize'], array('inline' => 1)); closeside(); echo "</div>\n</div>\n"; // end row. echo form_button('publish', $locale['download_0061'], $locale['download_0061'], array('class' => 'btn-primary m-r-10')); echo form_button('delete', $locale['download_0060'], $locale['download_0060'], array('class' => 'btn-warning m-r-10')); echo closeform(); } } } } else { $result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='d' order by submit_datestamp desc\n\t\t\t"); $rows = dbrows($result); if ($rows > 0) { echo "<div class='well'>" . sprintf($locale['download_0051'], format_word($rows, $locale['fmt_submission'])) . "</div>\n"; echo "<table class='table table-striped'>\n"; echo "<tr>\n"; echo "<th>" . $locale['download_0052'] . "</th>\n<th>" . $locale['download_0053'] . "</th>\n\t\t<th>" . $locale['download_0054'] . "</th><th>" . $locale['download_0055'] . "</th>"; echo "</tr>\n"; echo "<tbody>\n"; while ($callback_data = dbarray($result)) { $submit_criteria = unserialize($callback_data['submit_criteria']); echo "<tr>\n"; echo "<td><a href='" . clean_request("submit_id=" . $callback_data['submit_id'], array("section", "aid"), TRUE) . "'>" . $submit_criteria['download_title'] . "</a></td>\n"; echo "<td>" . profile_link($callback_data['user_id'], $callback_data['user_name'], $callback_data['user_status']) . "</td>\n"; echo "<td>" . timer($callback_data['submit_datestamp']) . "</td>\n"; echo "<td>" . $callback_data['submit_id'] . "</td>\n"; echo "</tr>\n"; } echo "</tbody>\n</table>\n";
/** * Get the forum structure * * @param bool $forum_id * @param bool $branch_id * * @return array */ public static function get_forum($forum_id = FALSE, $branch_id = FALSE) { // only need to fetch child. $forum_settings = self::get_forum_settings(); $userdata = fusion_get_userdata(); $locale = fusion_get_locale("", FORUM_LOCALE); $index = array(); // define what a row is $row = array('forum_new_status' => '', 'last_post' => '', 'forum_icon' => '', 'forum_icon_lg' => '', 'forum_moderators' => '', 'forum_link' => array('link' => '', 'title' => ''), 'forum_description' => '', 'forum_postcount_word' => '', 'forum_threadcount_word' => ''); $query = dbquery("\n\t\t\t\tSELECT tf.forum_id, tf.forum_cat, tf.forum_branch, tf.forum_name, tf.forum_description, tf.forum_image,\n\t\t\t\ttf.forum_type, tf.forum_mods, tf.forum_threadcount, tf.forum_postcount, tf.forum_order, tf.forum_lastuser, tf.forum_access, tf.forum_lastpost, tf.forum_lastpostid,\n\t\t\t\tt.thread_id, t.thread_lastpost, t.thread_lastpostid, t.thread_subject, p.post_message,\n\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar\n\t\t\t\tFROM " . DB_FORUMS . " tf\n\t\t\t\tLEFT JOIN " . DB_FORUM_THREADS . " t ON tf.forum_lastpostid = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p ON p.thread_id = t.thread_id AND p.post_id = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON tf.forum_lastuser = u.user_id\n\t\t\t\t" . (multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('tf.forum_access') . "\n\t\t\t\t" . ($forum_id && $branch_id ? "AND tf.forum_id = '" . intval($forum_id) . "' or tf.forum_cat = '" . intval($forum_id) . "' OR tf.forum_branch = '" . intval($branch_id) . "'" : '') . "\n\t\t\t\tGROUP BY tf.forum_id ORDER BY tf.forum_cat ASC, tf.forum_order ASC, t.thread_lastpost DESC\n\t\t"); while ($data = dbarray($query) and checkgroup($data['forum_access'])) { // Calculate Forum New Status $newStatus = ""; $forum_match = "\\|" . $data['forum_lastpost'] . "\\|" . $data['forum_id']; $last_visited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(); if ($data['forum_lastpost'] > $last_visited) { if (iMEMBER && ($data['forum_lastuser'] !== $userdata['user_id'] || !preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) { $newStatus = "<span class='forum-new-icon'><i title='" . $locale['forum_0260'] . "' class='" . self::get_forumIcons('new') . "'></i></span>"; } } // Calculate lastpost information $lastPostInfo = array(); if ($data['forum_lastpostid']) { $last_post = array('avatar' => '', 'avatar_src' => $data['user_avatar'] && file_exists(IMAGES . 'avatars/' . $data['user_avatar']) && !is_dir(IMAGES . 'avatars/' . $data['user_avatar']) ? IMAGES . 'avatars/' . $data['user_avatar'] : '', 'message' => fusion_first_words(parseubb(parsesmileys($data['post_message'])), 10), 'profile_link' => profile_link($data['forum_lastuser'], $data['user_name'], $data['user_status']), 'time' => timer($data['forum_lastpost']), 'date' => showdate("forumdate", $data['forum_lastpost']), 'thread_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&thread_id=" . $data['thread_id'], 'post_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&thread_id=" . $data['thread_id'] . "&pid=" . $data['thread_lastpostid'] . "#post_" . $data['thread_lastpostid']); if ($forum_settings['forum_last_post_avatar']) { $last_post['avatar'] = display_avatar($data, '30px', '', '', 'img-rounded'); } $lastPostInfo = $last_post; } /** * Default system icons - why do i need this? Why not let themers decide? */ switch ($data['forum_type']) { case '1': $forum_icon = "<i class='" . self::get_forumIcons('forum') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('forum') . " fa-3x fa-fw m-r-10'></i>"; break; case '2': $forum_icon = "<i class='" . self::get_forumIcons('thread') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('thread') . " fa-3x fa-fw m-r-10'></i>"; break; case '3': $forum_icon = "<i class='" . self::get_forumIcons('link') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('link') . " fa-3x fa-fw m-r-10'></i>"; break; case '4': $forum_icon = "<i class='" . self::get_forumIcons('question') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . self::get_forumIcons('question') . " fa-3x fa-fw m-r-10'></i>"; break; default: $forum_icon = ""; $forum_icon_lg = ""; } $mod = new Moderator(); $row = array_merge($row, $data, array("forum_moderators" => $mod::parse_forum_mods($data['forum_mods']), "forum_new_status" => $newStatus, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&forum_id=" . $data['forum_id'] . "&parent_id=" . $data['forum_cat'], "title" => $data['forum_name']), "forum_description" => nl2br(parseubb($data['forum_description'])), "forum_postcount_word" => format_word($data['forum_postcount'], $locale['fmt_post']), "forum_threadcount_word" => format_word($data['forum_threadcount'], $locale['fmt_thread']), "last_post" => $lastPostInfo, "forum_icon" => $forum_icon, "forum_icon_lg" => $forum_icon_lg)); $data["forum_image"] = $data['forum_image'] && file_exists(FORUM . "images/" . $data['forum_image']) ? $data['forum_image'] : ""; $thisref =& $refs[$data['forum_id']]; $thisref = $row; if ($data['forum_cat'] == 0) { $index[0][$data['forum_id']] =& $thisref; } else { $refs[$data['forum_cat']]['child'][$data['forum_id']] =& $thisref; } } return (array) $index; }
function render_thread_item($data) { global $locale, $info, $userdata; echo "<div class='thread-item' id='thread_" . $data['thread_id'] . "'>\n"; echo "<div class='row m-0'>\n"; echo "<div class='col-xs-12 col-sm-9 col-md-6 p-l-0'>\n"; echo "<div class='pull-left m-r-10 m-t-5'>\n" . $data['thread_last']['avatar'] . "</div>\n"; $thead_icons = ''; foreach ($data['thread_icons'] as $icon) { $thead_icons .= $icon; } echo "<div class='overflow-hide'>\n"; echo "<a class='forum-link' href='" . $data['thread_link']['link'] . "'>" . $data['thread_link']['title'] . "</a>\n<span class='m-l-10 m-r-10 text-lighter'>" . $thead_icons . "</span>\n"; echo "<div class='text-smaller'>" . $data['thread_starter'] . "</div>\n"; echo $data['thread_pages']; echo isset($data['track_button']) ? "<div class='forum_track'><a onclick=\"return confirm('" . $locale['global_060'] . "');\" href='" . $data['track_button']['link'] . "'>" . $data['track_button']['name'] . "</a>\n</div>\n" : ''; echo "</div>\n"; echo "</div>\n"; // end grid echo "<div class='hidden-xs col-sm-3 col-md-3 p-l-0 p-r-0 text-center'>\n"; echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['thread_views']) . "</h4>\n"; echo "<span>" . format_word($data['thread_views'], $locale['fmt_views'], 0) . "</span>"; echo "</div>\n"; echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['thread_postcount']) . "</h4>\n"; echo "<span>" . format_word($data['thread_postcount'], $locale['fmt_post'], 0) . "</span>"; echo "</div>\n"; if ($data['forum_type'] == '4') { echo "<div class='display-inline-block forum-stats p-5 m-r-5 m-b-0'>\n"; echo "<h4 class='text-bigger strong text-dark m-0'>" . number_format($data['vote_count']) . "</h4>\n"; echo "<span>" . format_word($data['vote_count'], $locale['fmt_vote'], 0) . "</span>"; echo "</div>\n"; } echo "</div>\n"; // end grid echo "<div class='forum-lastuser hidden-xs hidden-sm col-md-3'>\n\t\t\t" . $data['thread_last']['profile_link'] . " " . timer($data['thread_last']['time']) . "<br/>\n\t\t\t" . fusion_first_words(strip_tags($data['thread_last']['post_message']), 10) . "\n\t\t</div>\n"; echo "</div>\n"; echo "</div>\n"; }
public static function display_theme_list() { global $locale, $aidlink, $settings; if (isset($_GET['action']) && $_GET['action'] == "set_active" && isset($_GET['theme']) && $_GET['theme'] !== "") { $theme_name = form_sanitizer($_GET['theme'], ''); if (self::theme_installable($theme_name)) { $result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . $theme_name . "' WHERE settings_name='theme'"); if ($result) { redirect(FUSION_SELF . $aidlink); } } } $data = array(); $_dir = makefilelist(THEMES, ".|..|templates|admin_templates", TRUE, "folders"); foreach ($_dir as $folder) { $theme_dbfile = '/theme_db.php'; $status = $settings['theme'] == $folder ? 1 : 0; if (file_exists(THEMES . $folder . $theme_dbfile)) { // 9.00 compatible theme. $theme_folder = ''; include_once THEMES . $folder . $theme_dbfile; $data[$status][$folder]['readme'] = isset($theme_readme) ? $theme_readme : ''; $data[$status][$folder]['folder'] = isset($theme_folder) && file_exists(THEMES . $theme_folder . '/theme.php') ? THEMES . $theme_folder : ''; $data[$status][$folder]['screenshot'] = isset($theme_screenshot) && file_exists(THEMES . $theme_folder . "/" . $theme_screenshot) ? THEMES . $theme_folder . "/" . $theme_screenshot : IMAGES . 'imagenotfound.jpg'; $data[$status][$folder]['title'] = isset($theme_title) ? $theme_title : ''; $data[$status][$folder]['web'] = isset($theme_web) ? $theme_web : ''; $data[$status][$folder]['author'] = isset($theme_author) ? $theme_author : ''; $data[$status][$folder]['license'] = isset($theme_license) ? $theme_license : ''; $data[$status][$folder]['version'] = isset($theme_version) ? $theme_version : ''; $data[$status][$folder]['description'] = isset($theme_description) ? $theme_description : ''; // Find widgets if (isset($theme_newtable) || isset($theme_insertdbrow)) { $data[$status][$folder]['widget'] = TRUE; // count how many widget components $data[$status][$folder]['widgets'] = isset($theme_newtable) ? count($theme_newtable) : 0; // check if widgets installed - @todo: how to handle theme that only have new table but no row. $data[$status][$folder]['widget_status'] = dbcount("(settings_name)", DB_SETTINGS_THEME, "settings_theme='" . $theme_folder . "'") > 0 ? TRUE : FALSE; } } else { // older legacy theme. if (file_exists(THEMES . $folder . '/theme.php')) { $theme_screenshot = '/screenshot.jpg'; $data[$status][$folder] = array('readme' => '', 'folder' => '', 'title' => '', 'screenshot' => '', 'author' => '', 'license' => '', 'version' => '', 'description' => 'No description available for this theme.'); $data[$status][$folder]['folder'] = THEMES . $folder; $data[$status][$folder]['title'] = $folder; $data[$status][$folder]['screenshot'] = file_exists(THEMES . $folder . $theme_screenshot) ? THEMES . $folder . $theme_screenshot : IMAGES . 'imagenotfound.jpg'; } } } krsort($data); foreach ($data as $status => $themes) { foreach ($themes as $theme_name => $theme_data) { echo "<div class='panel panel-default'>\n"; echo "<div class='panel-body'>\n"; // Links echo "<div class='pull-left m-r-10'>" . thumbnail($theme_data['screenshot'], '150px') . "</div>\n"; echo "<div class='btn-group pull-right m-l-20 m-t-20'>\n"; if ($status == TRUE) { echo "<a class='btn btn-primary btn-sm' href='" . FUSION_SELF . $aidlink . "&action=manage&theme=" . $theme_name . "'><i class='fa fa-cog fa-fw'></i> " . $locale['theme_1005'] . "</a>\n"; } else { echo "<a class='btn btn-default btn-sm' href='" . FUSION_SELF . $aidlink . "&action=set_active&theme=" . $theme_name . "'><i class='fa fa-diamond fa-fw'></i> " . $locale['theme_1012'] . "</a>"; } echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<h4 class='strong text-dark'>" . ($status == TRUE ? "<i class='fa fa-diamond fa-fw'></i>" : "") . $theme_data['title'] . "</h4>"; echo "<div>\n"; if (!empty($theme_data['description'])) { echo "<div class='display-block m-b-10'>" . $theme_data['description'] . "</div>"; } if (!empty($theme_data['license'])) { echo "<span class='badge display-inline-block m-r-10'><i class='fa fa-file fa-fw' title='" . $locale['theme_1013'] . "'></i> " . $theme_data['license'] . "</span>\n"; } if (!empty($theme_data['version'])) { echo "<span class='badge display-inline-block m-r-10'><i class='fa fa-code-fork fa-fw' title='" . $locale['theme_1014'] . "'></i> " . $theme_data['version'] . "</span>\n"; } if (!empty($theme_data['author'])) { echo "<span class='badge display-inline-block m-r-10'><i class='fa fa-user fa-fw'></i> " . $theme_data['author'] . "</span>"; } if (!empty($theme_data['web'])) { echo "<a class='badge text-normal' title='" . $locale['theme_1015'] . "' href='" . $theme_data['web'] . "'><i class='fa fa-globe fa-fw'></i> " . $locale['theme_1015'] . "</a>"; } echo "<div class='m-t-10'>\n"; if ($status == TRUE) { echo "<label class='label label-success m-r-5'>" . $locale['theme_1006'] . "</label>\n"; } if (isset($theme_data['widgets'])) { echo "<label class='label label-default'>" . format_word($theme_data['widgets'], $locale['theme_1021']) . "</label>\n"; } echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; echo "</div>\n</div>\n"; unset($theme_data); } } }
echo "<label><input type='checkbox' name='article_breaks' value='1'" . ($callback_data['article_breaks'] ? "checked='checked'" : "") . " /> " . $locale['articles_0206'] . "</label><br />\n"; } closeside(); echo "</div></div>\n"; echo form_button('preview', $locale['articles_0240'], $locale['articles_0240'], array('class' => 'btn-default m-r-10')); echo form_button('publish', $locale['articles_0242'], $locale['articles_0242'], array('class' => 'btn-primary m-r-10')); echo form_button('delete', $locale['articles_0243'], $locale['articles_0243'], array('class' => 'btn-warning m-r-10')); echo closeform(); } } } } else { $result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='a' order by submit_datestamp desc\n\t\t\t"); $rows = dbrows($result); if ($rows > 0) { echo "<div class='well'>" . sprintf($locale['articles_0044'], format_word($rows, $locale['fmt_submission'])) . "</div>\n"; echo "<table class='table table-striped'>\n"; echo "<tr>\n"; echo "<th>" . $locale['articles_0041'] . "</th>\n<th>" . $locale['articles_0046'] . "</th><th>" . $locale['articles_0047'] . "</th><th>" . $locale['articles_0048'] . "</th>"; echo "</tr>\n"; echo "<tbody>\n"; while ($data = dbarray($result)) { $submit_criteria = unserialize($data['submit_criteria']); echo "<tr>\n"; echo "<td><a href='" . clean_request("submit_id=" . $data['submit_id'], array("section", "aid"), TRUE) . "'>" . $submit_criteria['article_subject'] . "</a></td>\n"; echo "<td>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</td>\n"; echo "<td>" . timer($data['submit_datestamp']) . "</td>\n"; echo "<td>" . $data['submit_id'] . "</td>\n"; echo "</tr>\n"; } echo "</tbody>\n</table>\n";
public function set_ForumInfo() { global $forum_settings, $userdata, $locale; if (stristr($_SERVER['PHP_SELF'], 'forum_id')) { if ($_GET['section'] == 'latest') { redirect(INFUSIONS . 'forum/index.php?section=latest'); } if ($_GET['section'] == 'mypost') { redirect(INFUSIONS . 'forum/index.php?section=mypost'); } if ($_GET['section'] == 'tracked') { redirect(INFUSIONS . 'forum/index.php?section=tracked'); } } // security boot due to insufficient access level if (isset($_GET['viewforum']) && !verify_forum($_GET['forum_id'])) { redirect(INFUSIONS . 'forum/index.php'); } // Xss sanitization $this->forum_info = array('forum_id' => isset($_GET['forum_id']) ? $_GET['forum_id'] : 0, 'parent_id' => isset($_GET['parent_id']) && verify_forum($_GET['parent_id']) ? $_GET['parent_id'] : 0, 'forum_branch' => isset($_GET['forum_branch']) && verify_forum($_GET['forum_branch']) ? $_GET['forum_branch'] : 0, 'new_thread_link' => '', 'lastvisited' => isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(), 'posts_per_page' => $forum_settings['posts_per_page'], 'threads_per_page' => $forum_settings['threads_per_page'], 'forum_index' => dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), 'threads' => array(), 'section' => isset($_GET['section']) ? $_GET['section'] : 'thread'); // Set Max Rows -- XSS $this->forum_info['forum_max_rows'] = dbcount("('forum_id')", DB_FORUMS, (multilang_table("FO") ? "forum_language='" . LANGUAGE . "' AND" : '') . "\n\t\tforum_cat='" . $this->forum_info['parent_id'] . "' AND " . groupaccess('forum_access') . ""); // Sanitize Globals $_GET['forum_id'] = $this->forum_info['forum_id']; $_GET['rowstart'] = isset($_GET['rowstart']) && $_GET['rowstart'] <= $this->forum_info['forum_max_rows'] ? $_GET['rowstart'] : 0; $this->ext = isset($this->forum_info['parent_id']) && isnum($this->forum_info['parent_id']) ? "&parent_id=" . $this->forum_info['parent_id'] : ''; add_to_title($locale['global_200'] . $locale['forum_0000']); add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php', 'title' => $locale['forum_0000'])); forum_breadcrumbs($this->forum_info['forum_index']); // Set Meta data if ($this->forum_info['forum_id'] > 0) { $meta_result = dbquery("SELECT forum_meta, forum_description FROM " . DB_FORUMS . " WHERE forum_id='" . intval($this->forum_info['forum_id']) . "'"); if (dbrows($meta_result) > 0) { $meta_data = dbarray($meta_result); if ($meta_data['forum_description'] !== '') { set_meta('description', $meta_data['forum_description']); } if ($meta_data['forum_meta'] !== '') { set_meta('keywords', $meta_data['forum_meta']); } } } // Additional Sections in Index View if (isset($_GET['section'])) { switch ($_GET['section']) { case 'participated': include INFUSIONS . "forum/sections/participated.php"; add_to_title($locale['global_201'] . $locale['global_024']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=participated", 'title' => $locale['global_024'])); set_meta("description", $locale['global_024']); break; case 'latest': include INFUSIONS . "forum/sections/latest.php"; add_to_title($locale['global_201'] . $locale['global_021']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=latest", 'title' => $locale['global_021'])); set_meta("description", $locale['global_021']); break; case 'tracked': include INFUSIONS . "forum/sections/tracked.php"; add_to_title($locale['global_201'] . $locale['global_056']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=tracked", 'title' => $locale['global_056'])); set_meta("description", $locale['global_056']); break; case "unanswered": include INFUSIONS . "forum/sections/unanswered.php"; add_to_title($locale['global_201'] . $locale['global_027']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=unanswered", 'title' => $locale['global_027'])); set_meta("description", $locale['global_027']); break; case "unsolved": include INFUSIONS . "forum/sections/unsolved.php"; add_to_title($locale['global_201'] . $locale['global_028']); add_breadcrumb(array('link' => INFUSIONS . "forum/index.php?section=unsolved", 'title' => $locale['global_028'])); set_meta("description", $locale['global_028']); break; default: redirect(FUSION_SELF); } } else { // Switch between view forum or forum index -- required: $_GET['viewforum'] if ($this->forum_info['forum_id'] && isset($this->forum_info['parent_id']) && isset($_GET['viewforum'])) { /** * View Forum Additional Views - add Filter Initialization */ $time = isset($_GET['time']) ? $_GET['time'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $sort = isset($_GET['sort']) ? $_GET['sort'] : ''; $order = isset($_GET['order']) ? $_GET['order'] : ''; $timeCol = ''; $typeCol = ''; if ($time) { $time_array = array('today' => strtotime('today'), '2days' => strtotime('-2 day'), '1week' => strtotime('-1 week'), '2week' => strtotime('-2 week'), '1month' => strtotime('-2 month'), '2month' => strtotime('-2 month'), '3month' => strtotime('-2 month'), '6month' => strtotime('-6 month'), '1year' => strtotime('-1 year')); $time_stop = ''; foreach ($time_array as $key => $value) { if ($time == $key) { $time_stop = prev($time_array); break; } } if ($time !== 'today') { $timeCol = "AND ((post_datestamp >= '" . $time_array[$time] . "' OR t.thread_lastpost >= '" . $time_array[$time] . "') AND (post_datestamp <= '" . $time_stop . "' OR t.thread_lastpost <= '" . $time_stop . "')) "; } else { $timeCol = "AND (post_datestamp >= '" . $time_array[$time] . "' OR t.thread_lastpost >= '" . $time_array[$time] . "') "; } } if ($type) { $type_array = array('all' => '', 'discussions' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND (forum_poll_title IS NULL or forum_poll_title='')", 'attachments' => "AND a1.attach_name !='' OR a2.attach_name !='' AND (forum_poll_title IS NULL or forum_poll_title='')", 'poll' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND forum_poll_title !=''", 'solved' => "AND t.thread_answered = '1'", 'unsolved' => "AND t.thread_answered = '0'"); $typeCol = $type_array[$type]; } $sortCol = "ORDER BY t.thread_lastpost "; $orderCol = 'ASC'; if ($sort) { $sort_array = array('author' => 't.thread_author', 'time' => 't.thread_lastpost', 'subject' => 't.thread_subject', 'reply' => 't.thread_postcount', 'view' => 't.thread_views'); $sortCol = "ORDER BY " . $sort_array[$sort] . " "; } if ($order) { $order_array = array('ascending' => 'ASC', 'descending' => 'DESC'); $orderCol = $order_array[$order]; } $sql_condition = $timeCol . $typeCol; $sql_order = $sortCol . $orderCol; // Filter Links $timeExt = isset($_GET['time']) ? "&time=" . $_GET['time'] : ''; $typeExt = isset($_GET['type']) ? "&type=" . $_GET['type'] : ''; $sortExt = isset($_GET['sort']) ? "&sort=" . $_GET['sort'] : ''; $orderExt = isset($_GET['order']) ? "&order=" . $_GET['order'] : ''; $baseLink = INFUSIONS . 'forum/index.php?viewforum&forum_id=' . $_GET['forum_id'] . '' . (isset($_GET['parent_id']) ? '&parent_id=' . $_GET['parent_id'] . '' : ''); $timeLink = $baseLink . $typeExt . $sortExt . $orderExt; $this->forum_info['filter']['time'] = array($locale['forum_3006'] => INFUSIONS . 'forum/index.php?viewforum&forum_id=' . $_GET['forum_id'] . '' . (isset($_GET['parent_id']) ? '&parent_id=' . $_GET['parent_id'] . '' : ''), $locale['forum_3007'] => $timeLink . '&time=today', $locale['forum_3008'] => $timeLink . '&time=2days', $locale['forum_3009'] => $timeLink . '&time=1week', $locale['forum_3010'] => $timeLink . '&time=2week', $locale['forum_3011'] => $timeLink . '&time=1month', $locale['forum_3012'] => $timeLink . '&time=2month', $locale['forum_3013'] => $timeLink . '&time=3month', $locale['forum_3014'] => $timeLink . '&time=6month', $locale['forum_3015'] => $timeLink . '&time=1year'); $typeLink = $baseLink . $timeExt . $sortExt . $orderExt; $this->forum_info['filter']['type'] = array($locale['forum_3000'] => $typeLink . '&type=all', $locale['forum_3001'] => $typeLink . '&type=discussions', $locale['forum_3002'] => $typeLink . '&type=attachments', $locale['forum_3003'] => $typeLink . '&type=poll', $locale['forum_3004'] => $typeLink . '&type=solved', $locale['forum_3005'] => $typeLink . '&type=unsolved'); $sortLink = $baseLink . $timeExt . $typeExt . $orderExt; $this->forum_info['filter']['sort'] = array($locale['forum_3016'] => $sortLink . '&sort=author', $locale['forum_3017'] => $sortLink . '&sort=time', $locale['forum_3018'] => $sortLink . '&sort=subject', $locale['forum_3019'] => $sortLink . '&sort=reply', $locale['forum_3020'] => $sortLink . '&sort=view'); $orderLink = $baseLink . $timeExt . $typeExt . $sortExt; $this->forum_info['filter']['order'] = array($locale['forum_3021'] => $orderLink . '&order=descending', $locale['forum_3022'] => $orderLink . '&order=ascending'); // Forum SQL $result = dbquery("SELECT f.*, f2.forum_name AS forum_cat_name,\n\t\t\t\tt.thread_id, t.thread_lastpost, t.thread_lastpostid, t.thread_subject,\n\t\t\t\tcount(t.thread_id) as forum_threadcount, p.post_message,\n\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar\n\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat = f2.forum_id\n\t\t\t\tLEFT JOIN " . DB_FORUM_THREADS . " t ON t.forum_id = f.forum_id\n\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p on p.thread_id = t.thread_id and p.post_id = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON f.forum_lastuser=u.user_id ## -- redo this part -- ##\n\t\t\t\t" . (multilang_table("FO") ? "WHERE f.forum_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('f.forum_access') . "\n\t\t\t\tAND f.forum_id='" . intval($this->forum_info['forum_id']) . "' OR f.forum_cat='" . intval($this->forum_info['forum_id']) . "' OR f.forum_branch='" . intval($this->forum_info['forum_branch']) . "'\n\t\t\t\tgroup by f.forum_id ORDER BY forum_cat ASC\n\t\t\t\t"); $refs = array(); if (dbrows($result) > 0) { while ($row = dbarray($result) and checkgroup($row['forum_access'])) { // Calculate Forum New Status $newStatus = ""; $forum_match = "\\|" . $row['forum_lastpost'] . "\\|" . $row['forum_id']; $last_visited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(); if ($row['forum_lastpost'] > $last_visited) { if (iMEMBER && ($row['forum_lastuser'] !== $userdata['user_id'] || !preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) { $newStatus = "<span class='forum-new-icon'><i title='" . $locale['forum_0260'] . "' class='" . Functions::get_forumIcons('new') . "'></i></span>"; } } // Calculate lastpost information $lastPostInfo = array(); if ($row['forum_lastpostid']) { $last_post = array('avatar' => '', 'avatar_src' => $row['user_avatar'] && file_exists(IMAGES . 'avatars/' . $row['user_avatar']) && !is_dir(IMAGES . 'avatars/' . $row['user_avatar']) ? IMAGES . 'avatars/' . $row['user_avatar'] : '', 'message' => fusion_first_words(parseubb(parsesmileys($row['post_message'])), 10), 'profile_link' => profile_link($row['forum_lastuser'], $row['user_name'], $row['user_status']), 'time' => timer($row['forum_lastpost']), 'date' => showdate("forumdate", $row['forum_lastpost']), 'thread_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $row['forum_id'] . "&thread_id=" . $row['thread_id'], 'post_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $row['forum_id'] . "&thread_id=" . $row['thread_id'] . "&pid=" . $row['thread_lastpostid'] . "#post_" . $row['thread_lastpostid']); if ($forum_settings['forum_last_post_avatar']) { $last_post['avatar'] = display_avatar($row, '30px', '', '', 'img-rounded'); } $lastPostInfo = $last_post; } /** * Default system icons - why do i need this? Why not let themers decide? */ switch ($row['forum_type']) { case '1': $forum_icon = "<i class='" . Functions::get_forumIcons('forum') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('forum') . " fa-3x fa-fw m-r-10'></i>"; break; case '2': $forum_icon = "<i class='" . Functions::get_forumIcons('thread') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('thread') . " fa-3x fa-fw m-r-10'></i>"; break; case '3': $forum_icon = "<i class='" . Functions::get_forumIcons('link') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('link') . " fa-3x fa-fw m-r-10'></i>"; break; case '4': $forum_icon = "<i class='" . Functions::get_forumIcons('question') . " fa-fw m-r-10'></i>"; $forum_icon_lg = "<i class='" . Functions::get_forumIcons('question') . " fa-3x fa-fw m-r-10'></i>"; break; default: $forum_icon = ""; $forum_icon_lg = ""; } $row += array("forum_moderators" => Functions::parse_forumMods($row['forum_mods']), "forum_new_status" => $newStatus, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&forum_id=" . $row['forum_id'] . "&parent_id=" . $row['forum_cat'], "title" => $row['forum_name']), "forum_description" => nl2br(parseubb($row['forum_description'])), "forum_postcount_word" => format_word($row['forum_postcount'], $locale['fmt_post']), "forum_threadcount_word" => format_word($row['forum_threadcount'], $locale['fmt_thread']), "last_post" => $lastPostInfo, "forum_icon" => $forum_icon, "forum_icon_lg" => $forum_icon_lg, "forum_image" => $row['forum_image'] && file_exists(FORUM . "images/" . $row['forum_image']) ? $row['forum_image'] : ""); $this->forum_info['forum_moderators'] = $row['forum_moderators']; // child hierarchy data. $thisref =& $refs[$row['forum_id']]; $thisref = $row; if ($row['forum_cat'] == $this->forum_info['parent_id']) { $this->forum_info['item'][$row['forum_id']] =& $thisref; // will push main item out. } else { $refs[$row['forum_cat']]['child'][$row['forum_id']] =& $thisref; } /** * The current forum */ if ($row['forum_id'] == $this->forum_info['forum_id']) { require_once INCLUDES . "mimetypes_include.php"; define_forum_mods($row); // do the full string of checks for forums access $this->setForumPermission($row); // Generate Links if ($this->getForumPermission("can_post")) { $this->forum_info['new_thread_link'] = INFUSIONS . "forum/newthread.php?forum_id=" . $row['forum_id']; } /** * Get threads with filter conditions */ //xss $count = dbarray(dbquery("SELECT\n\t\t\t\t\t\t\t\tcount(t.thread_id) 'thread_max_rows',\n\t\t\t\t\t\t\t\tcount(a1.attach_id) 'attach_image',\n\t\t\t\t\t\t\t\tcount(a2.attach_id) 'attach_files'\n\n\t\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . " t\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id #issue 323\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tWHERE t.forum_id='" . $this->forum_info['forum_id'] . "' AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . " {$sql_condition}\n\t\t\t\t\t\t\t\t##GROUP BY t.thread_id {$sql_order}\n\t\t\t\t\t\t")); $this->forum_info['thread_max_rows'] = $count['thread_max_rows']; if ($this->forum_info['thread_max_rows'] > 0) { $this->forum_info['threads']['pagenav'] = ""; $this->forum_info['threads']['pagenav2'] = ""; // anti-XSS filtered rowstart $_GET['thread_rowstart'] = isset($_GET['thread_rowstart']) && isnum($_GET['thread_rowstart']) && $_GET['thread_rowstart'] <= $this->forum_info['thread_max_rows'] ? $_GET['thread_rowstart'] : 0; $t_result = dbquery("\n SELECT t.*, tu1.user_name AS author_name, tu1.user_status AS author_status, tu1.user_avatar as author_avatar,\n\t\t\t\t\t\t\t\ttu2.user_name AS last_user_name, tu2.user_status AS last_user_status, tu2.user_avatar AS last_user_avatar,\n\t\t\t\t\t\t\t\tp1.post_datestamp, p1.post_message,\n\t\t\t\t\t\t\t\tp.forum_poll_title,\n\t\t\t\t\t\t\t\tcount(v.post_id) AS vote_count,\n\t\t\t\t\t\t\t\ta1.attach_name, a1.attach_id,\n\t\t\t\t\t\t\t\ta2.attach_name, a2.attach_id,\n\t\t\t\t\t\t\t\tcount(a1.attach_mime) 'attach_image',\n\t\t\t\t\t\t\t\tcount(a2.attach_mime) 'attach_files'\n\t\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . " t\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = t.forum_id\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_USERS . " tu1 ON t.thread_author = tu1.user_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_USERS . " tu2 ON t.thread_lastuser = tu2.user_id #issue 323\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p1 ON p1.thread_id = t.thread_id and p1.post_id = t.thread_lastpostid\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_POLLS . " p ON p.thread_id = t.thread_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.thread_id = t.thread_id AND p1.post_id = v.post_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.thread_id = t.thread_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.thread_id = t.thread_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\t\t\t\tWHERE t.forum_id='" . $this->forum_info['forum_id'] . "' AND t.thread_hidden='0' AND " . groupaccess('tf.forum_access') . " {$sql_condition}\n\t\t\t\t\t\t\t\tGROUP BY t.thread_id {$sql_order} LIMIT " . intval($_GET['thread_rowstart']) . ", " . $this->forum_info['threads_per_page']); $thread_rows = dbrows($t_result); if ($thread_rows > 0) { while ($threads = dbarray($t_result)) { $icon = ""; $match_regex = $threads['thread_id'] . "\\|" . $threads['thread_lastpost'] . "\\|" . $threads['forum_id']; if ($threads['thread_lastpost'] > $this->forum_info['lastvisited']) { if (iMEMBER && ($threads['thread_lastuser'] == $userdata['user_id'] || preg_match("(^\\.{$match_regex}\$|\\.{$match_regex}\\.|\\.{$match_regex}\$)", $userdata['user_threads']))) { $icon = "<i class='" . get_forumIcons('thread') . "' title='" . $locale['forum_0261'] . "'></i>"; } else { $icon = "<i class='" . get_forumIcons('new') . "' title='" . $locale['forum_0260'] . "'></i>"; } } $author = array('user_id' => $threads['thread_author'], 'user_name' => $threads['author_name'], 'user_status' => $threads['author_status'], 'user_avatar' => $threads['author_avatar']); $lastuser = array('user_id' => $threads['thread_lastuser'], 'user_name' => $threads['last_user_name'], 'user_status' => $threads['last_user_status'], 'user_avatar' => $threads['last_user_avatar']); $threads += array("thread_link" => array("link" => INFUSIONS . "forum/viewthread.php?thread_id=" . $threads['thread_id'], "title" => $threads['thread_subject']), "forum_type" => $row['forum_type'], "thread_pages" => makepagenav(0, $forum_settings['posts_per_page'], $threads['thread_postcount'], 3, FORUM . "viewthread.php?thread_id=" . $threads['thread_id'] . "&"), "thread_icons" => array('lock' => $threads['thread_locked'] ? "<i class='" . get_forumIcons('lock') . "' title='" . $locale['forum_0263'] . "'></i>" : '', 'sticky' => $threads['thread_sticky'] ? "<i class='" . get_forumIcons('sticky') . "' title='" . $locale['forum_0103'] . "'></i>" : '', 'poll' => $threads['thread_poll'] ? "<i class='" . get_forumIcons('poll') . "' title='" . $locale['forum_0314'] . "'></i>" : '', 'hot' => $threads['thread_postcount'] >= 20 ? "<i class='" . get_forumIcons('hot') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'reads' => $threads['thread_views'] >= 20 ? "<i class='" . get_forumIcons('reads') . "' title='" . $locale['forum_0311'] . "'></i>" : '', 'image' => $threads['attach_image'] > 0 ? "<i class='" . get_forumIcons('image') . "' title='" . $locale['forum_0313'] . "'></i>" : '', 'file' => $threads['attach_files'] > 0 ? "<i class='" . get_forumIcons('file') . "' title='" . $locale['forum_0312'] . "'></i>" : '', 'icon' => $icon), "thread_starter" => $locale['forum_0006'] . timer($threads['post_datestamp']) . " " . $locale['by'] . " " . profile_link($author['user_id'], $author['user_name'], $author['user_status']) . "</span>", "thread_author" => $author, "thread_last" => array('avatar' => display_avatar($lastuser, '30px', '', '', ''), 'profile_link' => profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']), 'time' => $threads['post_datestamp'], 'post_message' => parseubb(parsesmileys($threads['post_message'])), "formatted" => "<div class='pull-left'>" . display_avatar($lastuser, '30px', '', '', '') . "</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='overflow-hide'>" . $locale['forum_0373'] . " <span class='forum_profile_link'>" . profile_link($lastuser['user_id'], $lastuser['user_name'], $lastuser['user_status']) . "</span><br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . timer($threads['post_datestamp']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>")); //if ($threads['thread_status']['reads']) $threads['thread_status']['icon'] = $threads['thread_status']['reads']; //if ($threads['thread_status']['hot']) $threads['thread_status']['icon'] = $threads['thread_status']['hot']; //if ($threads['thread_status']['sticky']) $threads['thread_status']['icon'] = $threads['thread_status']['sticky']; //if ($threads['thread_status']['lock']) $threads['thread_status']['icon'] = $threads['thread_status']['lock']; // Threads Customized Output /* $attach_image = 0; $attach_file = 0; $a_result = dbquery("SELECT attach_id, attach_mime FROM ".DB_FORUM_ATTACHMENTS." WHERE thread_id ='".$threads['thread_id']."'"); if (dbrows($a_result) > 0) { require_once INCLUDES."mimetypes_include.php"; while ($adata = dbarray($a_result)) { if (in_array($adata['attach_mime'], img_mimeTypes())) { $attach_image = $attach_image+1; } else { $attach_file = $attach_file+1; } } }*/ if ($threads['thread_sticky']) { $this->forum_info['threads']['sticky'][$threads['thread_id']] = $threads; } else { $this->forum_info['threads']['item'][$threads['thread_id']] = $threads; } } } if ($this->forum_info['thread_max_rows'] > $this->forum_info['threads_per_page']) { $this->forum_info['threads']['pagenav'] = makepagenav($_GET['thread_rowstart'], $this->forum_info['threads_per_page'], $this->forum_info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart"); $this->forum_info['threads']['pagenav2'] = makepagenav($_GET['thread_rowstart'], $this->forum_info['threads_per_page'], $this->forum_info['thread_max_rows'], 3, clean_request("", array("thread_rowstart"), FALSE) . "&", "thread_rowstart", TRUE); } } } } } else { redirect(INFUSIONS . 'forum/index.php'); } } else { $this->forum_info['forums'] = Functions::get_forum(); } } }
<?php sro('/PHP5/quiz/quiz_types.php'); global $quiz_types; $quiz_types = array_merge($quiz_types, ["modelsentences-12" => ["name" => "Stage 12 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => "auto", "options" => [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms1.jpg' style='width: 205px;'><br>"), format_word("1. Syphāx et Celer in portū stābant. amīcī montem spectābant.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Syphāx and Celer were standing in the harbor. The friends were watching the mountain.", '({*Syphāx and Celer} {were standing|stood} {(in|at) _a (port|harbo[u]r)}). ({*_a friends} {were (watching|looking at)} {_a mountain}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms2.jpg' style='width: 205px;'><br>"), format_word("2. Syphāx amīcō dīxit, “ego prope portum servōs vēndēbam. ego subitō sonōs audīvī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Syphāx said to his friend, “I was selling slaves near the harbor. Suddenly I heard sounds.”", '{_Said$(Syphāx)$(_his friend) _quot$(*I} {was selling} {_some slaves} {near the (port|harbo[u]r)) {} _quot2$(*suddenly} {I} {heard} {_some (sounds|noises)).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms3.jpg' style='width: 205px;'><br>"), format_word("3. Celer Syphācī respondit, “tū sonōs audīvistī. ego tremōrēs sēnsī. ego prope montem ambulābam.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Celer replied to Syphāx, “You heard sounds. I felt tremors. I was walking near the mountain.”", '_Replied$(Celer)$(Syphāx) _quot$(*you} {heard} {sounds|noises) {} _quot2$(*I} {felt|sensed} {_some (tremors|shak(es|ing)).) {} _quot2$(*I} {was walking} {near _a mountain).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms4.jpg' style='width: 205px;'><br>"), format_word("4. Poppæa et Lucriō in ātriō stābant. sollicitī erant.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Poppæa and Lucriō were standing in the atrium. They were worried.", '({*were standing} {Poppæa and Lucriō} {(in[side]|at) _a atrium}). ({*worried} {were} {they}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms5.jpg' style='width: 205px;'><br>"), format_word("5. Poppæa Lucriōnī dīxit, “ego in forō eram. ego tibi togam quærēbam. ego nūbem mīrābilem cōnspexī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Poppæa said to Lucriō, “I was in the forum. I was searching for a toga for you. I caught sight of a marvelous cloud.”", '_Said$(Poppæa)$(Lucriō) _quot$({*I} {was} {in _a forum}) {_quot$(_opts$(*I} {for you)$(was (look|search)ing} {for ${2})$(was seeking ${1}) $(_a toga).)} {_quot$({*I} {saw|caught sight of} {_a (wonderful|marvelous|strange|odd|weird) cloud}.)}.'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms6.jpg' style='width: 205px;'><br>"), format_word("6. Lucriō Poppææ respondit, “tū nūbem cōnspexistī. ego cinerem sēnsī. ego flammās vīdī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Lucriō replied to Poppæa, “You caught sight of a cloud. I felt ashes. I saw flames.”", '_Replied$(Lucriō)$(to Poppæa) _quot$(*you} {caught sight of|saw} {_a cloud) _quot2$(*I} {felt|sensed} {_some (ash[es])) _quot2$(*I} {saw} {_some flames).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms7.jpg' style='width: 205px;'><br>"), format_word("7. Marcus et Quārtus in forō erant. Sulla ad frātrēs contendit.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Marcus and Quārtus were in the forum. Sulla hurried to the brothers.", '({{Marcus} and {Quārtus}} {were} {(in[side]|at) _a forum}). ({Sulla} {hurried|rushed} {[up] to ([the] brothers|them)}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms8.jpg' style='width: 205px;'><br>"), format_word("8. Sulla frātribus dīxit, “ego ad theātrum contendēbam. ego sonōs audīvī et tremōrēs sēnsī. vōs sonōs audīvistis? vōs tremōrēs sēnsistis?”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Sulla said to the brothers, “I was hurrying to the theater. I heard sounds and felt tremors. Did you hear sounds? Did you feel tremors?”.", '_Said$(Sulla)$([the] brothers) _quot$(*I} {was (hurry|runn)ing} {to _a theater) _quot2$(*I} {heard} {_some (sounds|noises)} _AND {[I]} {felt} {tremors|shakes|shaking) _quest2$(*did you} {hear} {_some (sounds|noises)) _quest2$(*did you} {feel} {_some (tremors|shak(es|ing))).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms9.jpg' style='width: 205px;'><br>"), format_word("9. frātrēs Sullæ respondērunt, “nōs tremōrēs sēnsimus et sonōs audīvimus. nōs nūbem mīrābilem vīdimus. nōs sollicitī sumus.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("The brothers replied to Sulla, “We felt tremors and heard the sounds. We saw the marvelous cloud. We are worried.”", '_Replied$([the] brothers)$(Sulla) _quot$(*we} {felt} {_some (tremors|shakes|shaking)} _AND {[we]} {heard} {_some (sounds|noises)) _quot2$(*we} {saw} {_a (wonderful|marvelous|strange|odd|weird) cloud) _quot2$(*we} {are worried).'), "en", "English translation")]]]], "modelsentences-19" => ["name" => "Stage 19 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => "auto", "options" => [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_1_large.jpg' style='width: 205px;'><br>"), format_word("1. hic vir est Aristō. Aristō est amīcus Barbillī. in vīllā splendidā habitat, sed miserrimus est.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This man is Aristō. Aristō is a friend of Barbillus. He lives in a splendid house, but he is very miserable.", '({*this [man]} {is} {Aristō}). ({*Aristō|he} {is} {_a friend of Barbillus|Barbillus\' friend}). ({*he|Aristō} {(lives|dwells|resides|remains|lingers) in|inhabits} {_a (distinguished|noble|illustrious|bright|shining|glittering|brilliant|splendid|magnificent|sumptuous) (house|villa)}), but ({[he|Aristō]} {is} {(very|most) (miserable|unhappy|poor|wretched|pitiful|worthless|null|tragic|unfortunate|sick|tormenting)}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_2_large.jpg' style='width: 205px;'><br>"), format_word("2. haec fēmina est Galatēa. Galatēa est uxor Aristōnis. Galatēa marītum saepe castīgat, numquam laudat.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This woman is Galatēa. Galatēa is Aristō's wife. Galatēa often scolds her husband, she never praises him.", '({*this [woman]} {is} {Galatēa}). ({Galatēa|she} {is} {_a (wife of Aristō|Aristō\'s wife)}). ({Galatēa} {often} {scolds} {[her|a|the] husband}), [but|and] ({[she]} {never} {prases} {him}|{never} {praising} {him}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_3_large.jpg' style='width: 205px;'><br>"), format_word("3. haec puella est Helena. Helena est fīlia Aristōnis et Galatēae. multī iuvenēs hanc puellam amant, quod pulcherrima est.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This girl is Helena. Helena is Aristō and Galatēa's daughter. Many young men love this girl, because she is very beautiful.", '({*this [girl]} {is} {Helen[a]}). ({Helen[a]|she} {is} {_a (daughter of Aristō and Galatēa|Aristō and Galatēa\'s daughter)}). (Many (young men|boys) love (this girl|her|Helen[a])), because ({she} {is} {(very|[the] most) (beautiful|pretty)}).'), "en", "English translation")]]]], "modelsentences-25" => ["name" => "Stage 25 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => 4, "options" => function () { global $OP_USER_PARAGRAPH; return [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms1.jpg' style='width: 205px;'><br>"), format_word("1. mīles legiōnis secundæ per castra ambulābat. subitō iuvenem ignōtum prope horreum latentem cōnspexit.", "la"), format_word("“heus tū,” clāmāvit mīles, “quis es?”", "la"), format_word("iuvenis nihil respondit. mīles iuvenem iterum rogāvit quis esset. iuvenis fūgit.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["A soldier of the second legion was walking through the camp. Suddenly he caught sight of a strange young man hiding near the barn.\n“Hey you,” the soldier shouted, “Who are you?”\nThe young man said nothing. The soldier asked the young man again who he was. The young man fled."], "acceptable" => permute_sentence_choices(["A soldier", ["of", "with", "in"], "the second legion was walking through", ["the", ""], "camp. Suddenly he caught sight of a", ["strange", "unfamiliar", "unknown"], ["young man", "man", "boy"], "hiding near the barn.\n“Hey you,” the soldier shouted, “Who are you?”\nThe", ["young man", "man", "boy"], "said nothing. The soldier asked the", ["young man", "man", "boy"], "again who he was. The", ["young man", "man", "boy"], ["fled.", "escaped.", "ran."]])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms2.jpg' style='width: 205px;'><br>"), format_word("2. mīles iuvenem petīvit et facile superāvit. “furcifer!” exclāmāvit. “quid prope horreum facis?”\niuvenis dīcere nōlēbat quid prope horreum faceret. mīles eum ad centuriōnem dūxit.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The soldier followed the young man and easily overcame him. “Thief!” he shouted. “What are you doing near the barn?”\nThe young man did not want to say what he was doing near the barn. The soldier lead him to the centurion."], "acceptable" => permute_sentence_choices(["The soldier", ["followed", "chased"], "the", ["young man", "man", "boy"], "and", ["the soldier", "he", ""], "easily", ["reached", "caught up to", "overcame", "overpowered"], "him. “Thief!”", ["he", "the soldier"], "shouted. “What are you doing near the ", ["barn?”", "granary?”"], "The", ["young man", "man", "boy"], ["did not want", "was not wanting", "was not inclined"], "to say what he was doing near the", ["barn.", "granary."], "The soldier lead him to the centurion."])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms3.jpg' style='width: 205px;'><br>"), format_word("3. centuriō, iuvenem cōnspicātus, “hunc agnōscō!” inquit. “explōrātor Britannicus est, quem sæpe prope castra cōnspexī. quō modō eum cēpistī?”\ntum mīles explicāvit quō modō iuvenem cēpisset.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The centurion, having caught sight of the young man, said, “I recognize this man! He is a British explorer, whom I have often seen near the camp. How did you catch him?”\nThen the soldier explained how he had caught the young man."], "acceptable" => permute_sentence_choices(["The centurion, ", ["having", "after he had"], ["caught sight of", "seen", "saw"], "the", ["young man", "man", "boy"], "said, “I recognize this", ["man!", "person!", "!"], "He is a", ["British", "Britannic"], "explorer, whom I have often seen near the camp. How did you catch him?”\nThen the soldier explained how he had caught the", ["young man.", "man.", "boy."]])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms4.jpg' style='width: 205px;'><br>"), format_word("4. centuriō, ad iuvenem conversus, “cūr in castra vēnistī?” rogāvit. iuvenis tamen tacēbat.\n centuriō, ubi cognōscere nōn poterat cūr iuvenis in castra vēnisset, mīlitem iussit eum ad carcerem dūcere.\n iuvenis, postquam verba centuriōnis audīvit, “ego sum Vercobrix,” inquit, “fīlius prīncipis Deceanglōrum. vōbīs nōn decōrum est mē in carcere tenēre.”\n “fīlius prīncipis Deceanglōrum?” exclāmāvit centuriō. “libentissimē tē videō. nōs tē diū quærimus, cellamque optimam tibi in carcere parāvimus.”", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The centurion, having turned to the young man, asked, “Why have you come into the camp?” The young man however was silent.\nThe centurion, when he was unable to learn why the young man had come into the camp, ordered the soldier to lead him to the jail.\nThe young man, after he heard the centurion’s words, said, “I am Vercobrix, son of the chief of the Deceangli. It is not proper for you to hold me in prison.”\n“The son of the chief of the Deceangli?” shouted the centurion. “I see you very happily. We have sought you for a long time, and we will prepare the best room for you in jail.”"], "acceptable" => permute_sentence_choices(["The centurion,", ["having", "after he"], "turned to the", ["young man,", "man,", "boy,"], "asked, “Why have you", ["come into", "come to", "entered", "entered into"], "the camp?” The", ["young man", "man", "boy"], "however", ["was silent.", "remained silent.", "said nothing"], "\nThe centurion, when he was unable to learn why the young man had", ["come into", "come to", "entered", "entered into"], ["the", ""], "camp, ordered the soldier to lead him to the jail.\nThe", ["young man,", "man,", "boy,"], "after he heard the", ["centurion’s words,", "words of the centurion", "words spoken by the centurion"], "said, “I am Vercobrix, son of the chief of the Deceangli. It is not proper for you to hold me in prison.”\n“The son of the chief of the Deceangli?” shouted the centurion. “I see you very happily. We have sought you for a long time, and we will prepare the best room for you in jail.”"])], "answer0-tooltip" => "English translation", "answer0-language" => "en"]]; }]]);
<?php require_once '/var/www/config.php'; sro('/Includes/mysql.php'); sro('/Includes/session.php'); sro('/Includes/functions.php'); sro('/PHP5/lib/PHPLang/make_example.php'); sro('/PHP5/lib/PHPLang/display.php'); sro('/PHP5/dictionary/search.php'); $_start_t = microtime(true); $size = NULL; $list = search_GET(1000, $size); $result = []; foreach ($list as $w) { $result[$w->id()] = format_word($w->name()); } $result["sorted"] = array_keys($result); $result["changed"] = []; foreach ($list as $w) { $result["changed"][$w->id()] = $w->last_changed(); } if ($size !== NULL) { $result["max_length"] = $size; } else { $result["max_length"] = count($result["sorted"]); } echo json_encode($result); $time = microtime(true) - $_start_t; $time = round($time, 4); #error_log($time);