/** * Draws album * @param $album_code * @param $draw */ public function DrawAlbum($album_code = '', $draw = true) { $lang = Application::Get('lang'); $output = ''; $icon_width = ModulesSettings::Get('gallery', 'album_icon_width'); $icon_height = ModulesSettings::Get('gallery', 'album_icon_height'); $albums_per_line = ModulesSettings::Get('gallery', 'albums_per_line'); $wrapper = ModulesSettings::Get('gallery', 'wrapper'); $image_gallery_type = ModulesSettings::Get('gallery', 'image_gallery_type'); $image_gallery_rel = $image_gallery_type == 'lytebox' ? 'lyteshow' : 'rokbox'; $video_gallery_type = ModulesSettings::Get('gallery', 'video_gallery_type'); $video_gallery_rel = $video_gallery_type == 'videobox' ? 'vidbox' : 'rokbox'; $show_items_count_in_album = ModulesSettings::Get('gallery', 'show_items_count_in_album'); $album_code_parts = explode(':', $album_code); $album_code = isset($album_code_parts[0]) ? $album_code_parts[0] : ''; $album_state = isset($album_code_parts[1]) ? $album_code_parts[1] : 'open'; $sql = 'SELECT gad.name as album_name, gad.description, IF(gai.item_file_thumb != \'\', gai.item_file_thumb, gai.item_file) as mod_item_file_thumb, ga.album_code, ga.album_type, gai.item_file, gai.item_file_thumb, gaid.name as item_name, gaid.description as item_description, IF(gaid.description != \'\', gaid.description, gaid.name) as item_title FROM ' . TABLE_GALLERY_ALBUMS . ' ga INNER JOIN ' . TABLE_GALLERY_ALBUM_ITEMS . ' gai ON ga.album_code = gai.album_code LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUMS_DESCRIPTION . ' gad ON ga.id = gad.gallery_album_id AND gad.language_id = \'' . $lang . '\' LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION . ' gaid ON gai.id = gaid.gallery_album_item_id AND gaid.language_id = \'' . $lang . '\' WHERE ga.album_code = \'' . $album_code . '\' AND ga.is_active = 1 AND gai.item_file != \'\' AND gai.is_active = 1 ORDER BY gai.priority_order ASC'; $result_items = database_query($sql, DATA_AND_ROWS); if ($result_items[1] > 0) { if ($album_state == 'open') { $output .= draw_title_bar(_ALBUM . ': ' . $result_items[0][0]['album_name'], '', false); } $output .= '<table border="0" cellspacing="5"><tr>' . ($wrapper == 'div' ? '<td>' : ''); for ($i = 0; $i < $result_items[1]; $i++) { $additional_params = preg_match('/youtube/i', $result_items[0][$i]['item_file']) ? '&hd=1&autoplay=1' : ''; $title_image = $album_state == 'open' ? $result_items[0][$i]['item_title'] : _CLICK_TO_VIEW; if ($wrapper == 'table') { if ($i != 0 && $i % $albums_per_line == 0) { $output .= '</tr><tr>'; } $output .= '<td valign="top" ' . ($album_state == 'closed' ? 'align="center"' : '') . '>'; if ($result_items[0][$i]['album_type'] == 'video') { if ($album_state == 'open' || $album_state == 'closed' && $i == 0) { $output .= ($album_state == 'open' ? $result_items[0][$i]['item_name'] : $result_items[0][0]['album_name']) . '<br>'; $output .= '<a href="' . $result_items[0][$i]['item_file'] . $additional_params . '" rel="' . $video_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $result_items[0][$i]['item_title'] . '">'; $output .= '<img src="' . APPHP_BASE . ($result_items[0][$i]['item_file_thumb'] != '' ? $result_items[0][$i]['item_file_thumb'] : 'images/modules_icons/gallery/video.png') . '" alt="" title="' . _CLICK_TO_VIEW . '" border="0" />'; $output .= '</a>'; } else { $output .= '<a href="' . APPHP_BASE . $result_items[0][$i]['item_file'] . $additional_params . '" rel="' . $video_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $result_items[0][$i]['item_title'] . '"></a>'; } } else { if ($album_state == 'open' || $album_state == 'closed' && $i == 0) { $output .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $title_image . '"><img src="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['mod_item_file_thumb'] . '" width="' . $icon_width . '" ' . ($icon_height != 'px' ? 'height="' . $icon_height . '"' : '') . ' style="margin:5px 2px;" alt="" title="' . $title_image . '" border="" /></a>'; if ($album_state == 'open') { $output .= '<div style="padding-left:3px;width:' . $icon_width . ';">' . ($i + 1) . '. ' . substr_by_word($result_items[0][$i]['item_name'], 40, true) . '</div>'; } else { $output .= '<br>' . prepare_permanent_link('index.php?page=gallery&acode=' . $result_items[0][$i]['album_code'], '<b>' . $result_items[0][$i]['album_name'] . ' ' . ($show_items_count_in_album == 'yes' ? '(' . $result_items[1] . ')' : '') . '</b>', '', '', $result_items[0][$i]['description']); } } else { $output .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $title_image . '"></a>'; } } $output .= '</td>'; } else { if ($album_state == 'open' && $i != 0 && $i % $albums_per_line == 0) { $output .= '<br>'; } $output .= '<div style="float:' . Application::Get('defined_alignment') . ';margin-right:5px;width:' . $icon_width . ';">'; if ($result_items[0][$i]['album_type'] == 'video') { if ($album_state == 'open' || $album_state == 'closed' && $i == 0) { $output .= ($album_state == 'open' ? $result_items[0][$i]['item_name'] : prepare_permanent_link('index.php?page=gallery&acode=' . $result_items[0][$i]['album_code'], $result_items[0][0]['album_name'], '', '', $result_items[0][$i]['description'])) . '<br>'; $output .= '<a href="' . $result_items[0][$i]['item_file'] . $additional_params . '" rel="' . $video_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . _CLICK_TO_VIEW . '"><img src="' . APPHP_BASE . ($result_items[0][$i]['item_file_thumb'] != '' ? $result_items[0][$i]['item_file_thumb'] : 'images/modules_icons/gallery/video.png') . '" alt="" title="" border="0" /></a>'; } else { $output .= '<a href="' . APPHP_BASE . $result_items[0][$i]['item_file'] . $additional_params . '" rel="' . $video_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $result_items[0][$i]['item_title'] . '"></a>'; } } else { if ($album_state == 'open' || $album_state == 'closed' && $i == 0) { $output .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $title_image . '"><img src="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['mod_item_file_thumb'] . '" width="' . $icon_width . '" ' . ($icon_height != 'px' ? 'height="' . $icon_height . '"' : '') . ' style="margin-bottom:5px;" alt="" title="' . $title_image . '" border="0" /></a><br />'; if ($album_state == 'open') { $output .= $i + 1 . '. ' . substr_by_word($result_items[0][$i]['item_name'], 40, true); } else { $output .= prepare_permanent_link('index.php?page=gallery&acode=' . $result_items[0][$i]['album_code'], '<b>' . $result_items[0][$i]['album_name'] . '</b> ' . ($show_items_count_in_album == 'yes' ? '(' . $result_items[1] . ')' : '')) . '</a>'; } } else { $output .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$i]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](album' . $result_items[0][$i]['album_code'] . ')" title="' . $title_image . '"></a>'; } } $output .= '</div>'; } } $output .= ($wrapper == 'div' ? '</td>' : '') . '</tr></table>'; } else { $output .= draw_title_bar(_ALBUM . ': ' . $album_code . ' (' . _EMPTY . ')', '', false) . '<br />'; } if ($draw) { echo $output; } else { return $output; } }
/** * Updates Feeds */ public static function UpdateFeeds() { global $objSettings, $objSiteDescription; $default_lang = Languages::GetDefaultLang(); $current_rss_ids = $objSettings->GetParameter('rss_last_ids'); $rss_ids = ''; self::SetType($objSettings->GetParameter('rss_feed_type')); self::SetChannel(APPHP_BASE . 'feeds/rss.xml', $objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('tag_description'), 'en-us', '(c) copyright', $objSettings->GetParameter('admin_email'), $objSiteDescription->GetParameter('tag_description')); self::SetImage(APPHP_BASE . 'images/icons/logo.png'); $all_news = News::GetAllNews('previous', $default_lang); for ($i = 0; $i < $all_news[1] && $i < 10; $i++) { $rss_ids .= ($i > 0 ? '-' : '') . $all_news[0][$i]['id']; } // check if there difference between RSS IDs, so we have to update RSS file if ($current_rss_ids != $rss_ids) { for ($i = 0; $i < $all_news[1] && $i < 10; $i++) { $rss_text = RSSFeed::CleanTextRss(strip_tags($all_news[0][$i]['body_text'])); if (strlen($rss_text) > 512) { $rss_text = substr_by_word($rss_text, 512) . '...'; } #$rss_text = htmlentities($post_text, ENT_COMPAT, 'UTF-8'); self::SetItem(APPHP_BASE . 'index.php?page=news&nid=' . $all_news[0][$i]['id'], $all_news[0][$i]['header_text'], $rss_text, $all_news[0][$i]['date_created']); } $objSettings->UpdateFields(array('rss_last_ids' => $rss_ids)); } return self::SaveFeed(); }
/** * Draws vocabulary * @param $key */ public function DrawVocabulary($key) { $align_left = Application::Get('lang_dir') == 'ltr' ? 'left' : 'right'; $align_right = Application::Get('lang_dir') == 'ltr' ? 'right' : 'left'; $this->GetVocabulary($this->whereClause); echo '<a name="top"></a>'; echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="2" class="main_text"> <tr> <td>' . _FILTER_BY . ': '; echo prepare_permanent_link('index.php?admin=vocabulary' . $this->langIdByUrl, _ALL) . ' - '; for ($i = 65; $i < 91; $i++) { if ($this->filterBy == chr($i)) { $chr_i = '<b><u>' . chr($i) . '</u></b>'; } else { $chr_i = chr($i); } echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . chr($i) . $this->langIdByUrl, $chr_i) . ' '; } echo ' - '; for ($i = 1; $i <= 5; $i++) { if ($this->filterBy == $i) { $chr_i = '<b><u>' . $i . '</u></b>'; } else { $chr_i = $i; } echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . $i . $this->langIdByUrl, $chr_i) . ' '; } echo '</td> <td width="7%" align="center" nowrap="nowrap"> ' . _TOTAL . ': ' . count($this->keys) . ' </td> </tr>'; echo '<tr align="center"><td colspan="2">' . draw_line('line_no_margin', IMAGE_DIRECTORY, false) . '</td></tr>'; echo '</table>'; if (!empty($this->keys)) { echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="3" class="main_text">'; echo '<tr> <th width="1%">#</th> <th width="25%" align="' . $align_left . '">' . _KEY . '</th> <th width="65%" align="' . $align_left . '">' . _VALUE . '</th> <th width="9%"></th>'; for ($i = 0; $i < $this->vocabularySize; $i++) { // Prepare key_text for displaying $decoded_text = strip_tags(decode_text($this->keys[$i]['key_text'])); if (strlen($decoded_text) > 90) { $key_text = '<span style="cursor:help;" title="' . $decoded_text . '">' . substr_by_word($decoded_text, 95, true) . '</span>'; } else { $key_text = $decoded_text; } // Display vocabulary row if ($this->keys[$i]['key_value'] == $this->currentKey) { echo '<tr>'; echo '<td align="' . $align_right . '" class="voc_row_edit_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>'; echo '<td align="' . $align_left . '" class="voc_row_edit_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>'; echo '<td align="' . $align_left . '" class="voc_row_edit_middle">' . $key_text . '</td> <td align="center" class="voc_row_edit_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td> </tr>'; } else { if ($this->keys[$i]['id'] == (int) $key) { echo '<tr>'; echo '<td align="' . $align_right . '" class="voc_row_update_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>'; echo '<td align="' . $align_left . '" class="voc_row_update_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>'; echo '<td align="' . $align_left . '" class="voc_row_update_middle">' . $key_text . '</td> <td align="center" class="voc_row_update_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td> </tr>'; } else { echo '<tr ' . highlight(0) . ' onmouseover="oldColor=this.style.backgroundColor;this.style.backgroundColor=\'#ededed\';" onmouseout="this.style.backgroundColor=oldColor">'; echo '<td align="' . $align_right . '" nowrap="nowrap">' . ($i + 1) . '.</td>'; echo '<td align="' . $align_left . '" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>'; echo '<td align="' . $align_left . '">' . $key_text . '</td> <td align="center">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td> </tr>'; } } } echo '<tr><td colspan="4" nowrap="nowrap" height="10px"></td></tr>'; if ($this->vocabularySize > 15) { echo '<tr valign="bottom"><td colspan="3"></td><td align="center">' . prepare_permanent_link('index.php?admin=vocabulary' . $this->filterByUrl . $this->langIdByUrl . '#top', _TOP . ' ^') . '</td></tr>'; } echo '</table>'; } else { draw_important_message(_VOC_NOT_FOUND); } }
/** * Draw recent listings side block with listings links * @param $draw */ public static function DrawRecentBlock($draw = true) { global $objLogin; $show_expired_listings = ModulesSettings::Get('listings', 'show_expired_listings'); $output = draw_block_top(_RECENT_LISTINGS, '', 'maximized', false); $listings_name_length = ModulesSettings::Get('listings', 'listings_name_length'); $max_listings = 5; $where_condition = ' 1=1 ' . (!$objLogin->IsLoggedIn() ? ' AND access_level="public"' : ''); $where_condition .= $show_expired_listings != 'yes' ? ' AND ((finish_publishing = \'0000-00-00 00:00:00\') OR (finish_publishing > \'' . date("Y-m-d H:i:s") . '\'))' : ''; $result = self::GetAllListings($where_condition, 'date_published DESC', $max_listings + 1); if ($result[1] > 0) { $output .= '<ul>'; for ($i = 0; $i < $result[1] && $i < $max_listings; $i++) { $output .= '<li>' . prepare_link('listing', 'lid', $result[0][$i]['id'], $result[0][$i]['business_name'], substr_by_word($result[0][$i]['business_name'], $listings_name_length, true, Application::Get('lang')), '', $result[0][$i]['business_name']) . '</li>'; } if ($result[1] > $max_listings) { $output .= '<li>' . prepare_link('listings', 'type', 'recent', 'all', _MORE . ' »', '', _MORE) . '</li>'; } $output .= '</ul>'; } else { $output .= _NO_LISTINGS_TO_DISPLAY; } $output .= draw_block_bottom(false); if ($draw) { echo $output; } else { return $output; } }
/** * Draws search result * @param $search_result - search result * @param $page * @param $keyword * @param $type */ public function DrawSearchResult($search_result, $page = 1, $keyword = '', $type = 'quick') { $total_pages = (int) ($this->totalSearchRecords / $this->pageSize); if (!is_numeric($total_pages) || (int) $total_pages <= 0) { $total_pages = 1; } if ($search_result != '' && $search_result[1] > 0) { echo '<div class="pages_contents">'; for ($i = 0; $i < $search_result[1]; $i++) { if ($search_result[0][$i]['content_type'] == 'article') { echo $i + 1 . '. ' . prepare_permanent_link('index.php?' . $search_result[0][$i]['url'], decode_text($search_result[0][$i]['title'])) . '<br />'; if (isset($search_result[0][$i]['image_file_thumb'])) { echo '<img src="images/listings/' . $search_result[0][$i]['image_file_thumb'] . '" style="width:42px;height:42px;margin:4px;" align="' . Application::Get('defined_left') . '" alt="" />'; } $page_text = $search_result[0][$i]['text']; $page_text = str_replace(array('\\r', '\\n'), '', $page_text); $page_text = preg_replace('/{module:(.*?)}/i', '', $page_text); $page_text = strip_tags($page_text); $page_text = decode_text($page_text); if (!empty($keyword)) { $page_text = $this->HighLight($page_text, array($keyword)); } echo substr_by_word($page_text, 512) . '...<br />'; } else { echo $i + 1 . '. <a href="' . $search_result[0][$i]['link_url'] . '">' . decode_text($search_result[0][$i]['title']) . '</a> <img src="images/external_link.gif" alt="" /><br />'; } echo '<br />'; draw_line(); echo '<br />'; } echo '<b>' . _PAGES . ':</b> '; for ($i = 1; $i <= $total_pages; $i++) { echo '<a class="paging_link" href="javascript:void(0);" onclick="javascript:appPerformSearch(' . $i . ', \'' . ($type == 'advanced' ? 'frmAdvSearch' : 'frmQuickSearch') . '\');">' . ($i == $page ? '<b>[' . $i . ']</b>' : $i) . '</a> '; } echo '</div>'; } else { draw_important_message(_NO_RECORDS_FOUND); } }