public function indexAction() { global $structure; if (!cot_module_active('rss')) { cot_die_message(404, TRUE); } $c = cot_import('c', 'G', 'TXT'); if (!empty($c)) { if (!isset($structure['advboard'][$c])) { cot_die_message(404, TRUE); } list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c); cot_block(cot::$usr['auth_read']); } $rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle']; $rss_link = cot::$cfg['mainurl']; $rss_description = cot::$cfg['subtitle']; $domain = cot::$sys['domain']; $condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now'])); if (!empty($c)) { $rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle']; $condition[] = array('category', $c); } $advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc'))); $t = new XTemplate(cot_tplfile('rss')); $now = cot::$sys['now']; $now += cot::$usr['timezone'] * 3600; $t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now)))); if (!empty($advertisement)) { foreach ($advertisement as $advert) { $url = $advert->url; if (!cot_url_check($url)) { $url = COT_ABSOLUTE_URL . $url; } $date = ''; if (!empty($advert->created)) { $date = strtotime($advert->created); $date += cot::$usr['timezone'] * 3600; $date = date('r', $date); $date = $this->fixPubDate($date); } $text = $advert->text; $textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']); if ($textlength > 0 && mb_strlen($text) > $textlength) { $text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']); } $t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url)); $t->parse('MAIN.ITEM_ROW'); } } $t->parse('MAIN'); // ob_clean(); header('Content-type: text/xml; charset=UTF-8'); echo $t->text('MAIN'); exit; }
} elseif ($a == 'send' && $rtext != '') { $row = $db->query("SELECT contact_email FROM {$db_contact} WHERE contact_id = {$id}")->fetch(); cot_mail($row['contact_email'], $cfg['mainurl'], $rtext); $db->update($db_contact, array('contact_reply' => $rtext), "contact_id = {$id}"); cot_message('Done'); } $adminsubtitle = $L['contact_title']; $tuman = new XTemplate(cot_tplfile('contact.tools', 'plug', true)); $totallines = $db->query("SELECT COUNT(*) FROM {$db_contact}")->fetchColumn(); $sql = $db->query("SELECT * FROM {$db_contact} ORDER BY contact_val ASC, contact_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']); $pagnav = cot_pagenav('admin', 'm=other&p=contact', $d, $totallines, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']); $i = 0; foreach ($sql->fetchAll() as $row) { $i++; $shorttext = $row['contact_text']; $shorttext = cot_string_truncate($shorttext, 150); $shorttext .= '...'; $val = $row['contact_val'] == 1 ? 'unval' : 'val'; $urlParams = array('m' => 'other', 'p' => 'contact'); $tmp = $urlParams; $tmp['id'] = $row['contact_id']; if ($durl > 0) { $tmp['d'] = $durl; } $viewLink = cot_url('admin', $tmp, '#view'); $tuman->assign(array('CONTACT_DATE' => cot_date('date_full', $row['contact_date']), 'CONTACT_DATE_STAMP' => $row['contact_date'], 'CONTACT_USER' => $row['contact_authorid'] > 0 ? cot_build_user($row['contact_authorid'], $row['contact_author']) : $row['contact_author'], 'CONTACT_EMAIL' => $row['contact_email'], 'CONTACT_ID' => $row['contact_id'], 'CONTACT_DELLINK' => cot_confirm_url(cot_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id'])), 'CONTACT_VIEWLINK' => $viewLink, 'CONTACT_VAL' => $val, 'CONTACT_VALLINK' => cot_url('admin', 'm=other&p=contact&a=' . $val . '&id=' . $row['contact_id']), 'CONTACT_READLINK' => cot_url('admin', 'm=other&p=contact&a=val&id=' . $row['contact_id']), 'CONTACT_UNREADLINK' => cot_url('admin', 'm=other&p=contact&a=unval&id=' . $row['contact_id']), 'CONTACT_SUBJECT' => $row['contact_subject'], 'CONTACT_TEXT' => $row['contact_text'], 'CONTACT_REPLY' => !empty($row['contact_reply']), 'CONTACT_TEXTSHORT' => $shorttext, 'CONTACT_ODDEVEN' => cot_build_oddeven($i), 'CONTACT_I' => $i)); // Extrafields if (!empty(cot::$extrafields[cot::$db->contact])) { foreach (cot::$extrafields[cot::$db->contact] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
/* === Title === */ $totallines = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE {$sqlfilter}")->fetchColumn(); $elem = $f == 'sentbox' ? 'pm_touserid' : 'pm_fromuserid'; $pm_sql = $db->query("SELECT p.*, u.* FROM {$db_pm} AS p\n\t\tLEFT JOIN {$db_users} AS u\n\t\tON u.user_id = p.{$elem}\n\t\tWHERE {$sqlfilter}\n\t\tORDER BY pm_date DESC LIMIT {$d}," . $cfg['pm']['maxpmperpage']); $pagenav = cot_pagenav('pm', 'f=' . $f . '&filter=' . $filter, $d, $totallines, $cfg['pm']['maxpmperpage'], 'd', '', $cfg['pm']['turnajax']); require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate(cot_tplfile(array('pm', 'list', $pmalttpl))); $jj = 0; /* === Hook - Part1 : Set === */ $extp = cot_getextplugins('pm.list.loop'); /* ===== */ foreach ($pm_sql->fetchAll() as $row) { $jj++; $row['pm_icon_readstatus'] = $row['pm_tostate'] == '0' ? cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon_new'], array('title' => $L['pm_unread'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon'], array('title' => $L['pm_read'], 'class' => 'ajax')); $pm_data = cot_parse($row['pm_text'], $cfg['pm']['markup']); $pm_desc = cot_string_truncate($pm_data, 100, true, false, '...'); if ($f == 'sentbox') { $star_class = $row['pm_fromstate'] == 2 ? 1 : 0; } else { $star_class = $row['pm_tostate'] == 2 ? 1 : 0; } $url_edit = cot_url('pm', 'm=send&id=' . $row['pm_id']); $url_delete = cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f . '&d=' . $durl); $t->assign(array('PM_ROW_ID' => $row['pm_id'], 'PM_ROW_STATE' => $row['pm_tostate'], 'PM_ROW_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl))), 'PM_ROW_STAR_URL' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl), 'PM_ROW_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_ROW_DATE_STAMP' => $row['pm_date'], 'PM_ROW_TITLE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), htmlspecialchars($row['pm_title']), array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_URL' => cot_url('pm', 'm=message&id=' . $row['pm_id']), 'PM_ROW_TEXT' => $pm_data, 'PM_ROW_ICON_STATUS' => $row['pm_icon_readstatus'], 'PM_ROW_ICON_STARRED' => $row['pm_icon_starred'], 'PM_ROW_ICON_DELETE' => cot_rc_link($url_delete, $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_ICON_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete), $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_DELETE_URL' => $url_delete, 'PM_ROW_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete), 'PM_ROW_ICON_EDIT' => $row['pm_tostate'] == 0 ? cot_rc_link($url_edit, $R['pm_icon_edit'], array('title' => $L['Edit'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_ROW_EDIT_URL' => $row['pm_tostate'] == 0 ? $url_edit : '', 'PM_ROW_DESC' => $pm_desc, 'PM_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PM_ROW_NUM' => $jj)); $t->assign(cot_generate_usertags($row, 'PM_ROW_USER_')); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.PM_ROW');
/** * Returns all page tags for coTemplate * * @param mixed $page_data Page Info Array or ID * @param string $tag_prefix Prefix for tags * @param int $textlength Text truncate * @param bool $admin_rights Page Admin Rights * @param bool $pagepath_home Add home link for page path * @param string $emptytitle Page title text if page does not exist * @return array * @global CotDB $db */ function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '') { global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_pages, $usr, $sys, $cot_yesno, $structure, $db_structure; static $extp_first = null, $extp_main = null; static $pag_auth = array(); if (is_null($extp_first)) { $extp_first = cot_getextplugins('pagetags.first'); $extp_main = cot_getextplugins('pagetags.main'); } /* === Hook === */ foreach ($extp_first as $pl) { include $pl; } /* ===== */ if (!is_array($page_data)) { $sql = $db->query("SELECT * FROM {$db_pages} WHERE page_id = '" . (int) $page_data . "' LIMIT 1"); $page_data = $sql->fetch(); } if ($page_data['page_id'] > 0 && !empty($page_data['page_title'])) { if (is_null($admin_rights)) { if (!isset($pag_auth[$page_data['page_cat']])) { $pag_auth[$page_data['page_cat']] = cot_auth('page', $page_data['page_cat'], 'RWA1'); } $admin_rights = (bool) $pag_auth[$page_data['page_cat']][2]; } $pagepath = cot_structure_buildpath('page', $page_data['page_cat']); $catpath = cot_breadcrumbs($pagepath, $pagepath_home); $page_data['page_pageurl'] = empty($page_data['page_alias']) ? cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id']) : cot_url('page', 'c=' . $page_data['page_cat'] . '&al=' . $page_data['page_alias']); $page_link[] = array($page_data['page_pageurl'], $page_data['page_title']); $page_data['page_fulltitle'] = cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home); if (!empty($page_data['page_url']) && $page_data['page_file']) { $dotpos = mb_strrpos($page_data['page_url'], ".") + 1; $type = mb_strtolower(mb_substr($page_data['page_url'], $dotpos, 5)); $page_data['page_fileicon'] = cot_rc('page_icon_file_path', array('type' => $type)); if (!file_exists($page_data['page_fileicon'])) { $page_data['page_fileicon'] = cot_rc('page_icon_file_default'); } $page_data['page_fileicon'] = cot_rc('page_icon_file', array('icon' => $page_data['page_fileicon'])); } else { $page_data['page_fileicon'] = ''; } $date_format = 'datetime_medium'; $text = cot_parse($page_data['page_text'], $cfg['page']['markup'], $page_data['page_parser']); $text_cut = cot_cut_more($text); if ($textlength > 0 && mb_strlen($text_cut) > $textlength) { $text_cut = cot_string_truncate($text_cut, $textlength); } $cutted = mb_strlen($text) > mb_strlen($text_cut) ? true : false; $cat_url = cot_url('page', 'c=' . $page_data['page_cat']); $validate_url = cot_url('admin', "m=page&a=validate&id={$page_data['page_id']}&x={$sys['xk']}"); $unvalidate_url = cot_url('admin', "m=page&a=unvalidate&id={$page_data['page_id']}&x={$sys['xk']}"); $edit_url = cot_url('page', "m=edit&id={$page_data['page_id']}"); $delete_url = cot_url('page', "m=edit&a=update&delete=1&id={$page_data['page_id']}&x={$sys['xk']}"); $page_data['page_status'] = cot_page_status($page_data['page_state'], $page_data['page_begin'], $page_data['page_expire']); $temp_array = array('URL' => $page_data['page_pageurl'], 'ID' => $page_data['page_id'], 'TITLE' => $page_data['page_fulltitle'], 'ALIAS' => $page_data['page_alias'], 'STATE' => $page_data['page_state'], 'STATUS' => $page_data['page_status'], 'LOCALSTATUS' => $L['page_status_' . $page_data['page_status']], 'SHORTTITLE' => htmlspecialchars($page_data['page_title'], ENT_COMPAT, 'UTF-8', false), 'CAT' => $page_data['page_cat'], 'CATURL' => $cat_url, 'CATTITLE' => htmlspecialchars($structure['page'][$page_data['page_cat']]['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link($cat_url, htmlspecialchars($structure['page'][$page_data['page_cat']]['title'])), 'CATDESC' => htmlspecialchars($structure['page'][$page_data['page_cat']]['desc']), 'CATICON' => $structure['page'][$page_data['page_cat']]['icon'], 'KEYWORDS' => htmlspecialchars($page_data['page_keywords']), 'DESC' => htmlspecialchars($page_data['page_desc']), 'TEXT' => $text, 'TEXT_CUT' => $text_cut, 'TEXT_IS_CUT' => $cutted, 'DESC_OR_TEXT' => !empty($page_data['page_desc']) ? htmlspecialchars($page_data['page_desc']) : $text, 'MORE' => $cutted ? cot_rc('list_more', array('page_url' => $page_data['page_pageurl'])) : '', 'AUTHOR' => htmlspecialchars($page_data['page_author']), 'OWNERID' => $page_data['page_ownerid'], 'OWNERNAME' => htmlspecialchars($page_data['user_name']), 'DATE' => cot_date($date_format, $page_data['page_date']), 'BEGIN' => cot_date($date_format, $page_data['page_begin']), 'EXPIRE' => cot_date($date_format, $page_data['page_expire']), 'UPDATED' => cot_date($date_format, $page_data['page_updated']), 'DATE_STAMP' => $page_data['page_date'], 'BEGIN_STAMP' => $page_data['page_begin'], 'EXPIRE_STAMP' => $page_data['page_expire'], 'UPDATED_STAMP' => $page_data['page_updated'], 'FILE' => $cot_yesno[$page_data['page_file']], 'FILE_URL' => empty($page_data['page_url']) ? '' : cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id'] . '&a=dl'), 'FILE_SIZE' => $page_data['page_size'] / 1024, 'FILE_SIZE_BYTES' => $page_data['page_size'], 'FILE_SIZE_READABLE' => cot_build_filesize($page_data['page_size'], 1), 'FILE_ICON' => $page_data['page_fileicon'], 'FILE_COUNT' => $page_data['page_filecount'], 'FILE_COUNTTIMES' => cot_declension($page_data['page_filecount'], $Ls['Times']), 'FILE_NAME' => basename($page_data['page_url']), 'COUNT' => $page_data['page_count'], 'ADMIN' => $admin_rights ? cot_rc('list_row_admin', array('unvalidate_url' => $unvalidate_url, 'edit_url' => $edit_url)) : '', 'NOTAVAILABLE' => $page_data['page_begin'] > $sys['now'] ? $L['page_notavailable'] . cot_build_timegap($sys['now'], $pag['page_begin']) : ''); // Admin tags if ($admin_rights) { $validate_confirm_url = cot_confirm_url($validate_url, 'page', 'page_confirm_validate'); $unvalidate_confirm_url = cot_confirm_url($unvalidate_url, 'page', 'page_confirm_unvalidate'); $delete_confirm_url = cot_confirm_url($delete_url, 'page', 'page_confirm_delete'); $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']); $temp_array['ADMIN_EDIT_URL'] = $edit_url; $temp_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_confirm_url, $L['Validate'], 'class="confirmLink"') : cot_rc_link($unvalidate_confirm_url, $L['Putinvalidationqueue'], 'class="confirmLink"'); $temp_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_confirm_url : $unvalidate_confirm_url; $temp_array['ADMIN_DELETE'] = cot_rc_link($delete_confirm_url, $L['Delete'], 'class="confirmLink"'); $temp_array['ADMIN_DELETE_URL'] = $delete_confirm_url; } else { if ($usr['id'] == $page_data['page_ownerid']) { $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']); $temp_array['ADMIN_EDIT_URL'] = $edit_url; } } if (cot_auth('page', 'any', 'W')) { $clone_url = cot_url('page', "m=add&c={$page_data['page_cat']}&clone={$page_data['page_id']}"); $temp_array['ADMIN_CLONE'] = cot_rc_link($clone_url, $L['page_clone']); $temp_array['ADMIN_CLONE_URL'] = $clone_url; } // Extrafields if (isset($cot_extrafields[$db_pages])) { foreach ($cot_extrafields[$db_pages] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $temp_array[$tag . '_TITLE'] = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $temp_array[$tag] = cot_build_extrafields_data('page', $exfld, $page_data['page_' . $exfld['field_name']], $page_data['page_parser']); $temp_array[$tag . '_VALUE'] = $page_data['page_' . $exfld['field_name']]; } } // Extra fields for structure if (isset($cot_extrafields[$db_structure])) { foreach ($cot_extrafields[$db_structure] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['page'][$page_data['page_cat']][$exfld['field_name']]); $temp_array['CAT_' . $tag . '_VALUE'] = $structure['page'][$page_data['page_cat']][$exfld['field_name']]; } } /* === Hook === */ foreach ($extp_main as $pl) { include $pl; } /* ===== */ } else { $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']); } $return_array = array(); foreach ($temp_array as $key => $val) { $return_array[$tag_prefix . $key] = $val; } return $return_array; }
/** * Returns all product tags for coTemplate * * @param mixed $item_data product Info Array or ID * @param string $tag_prefix Prefix for tags * @param int $textlength Text truncate * @param bool $admin_rights product Admin Rights * @param bool $pagepath_home Add home link for page path * @param string $emptytitle Page title text if page does not exist * @return array * @global CotDB $db */ function cot_generate_markettags($item_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '') { global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_market, $usr, $sys, $cot_yesno, $structure, $db_structure; static $extp_first = null, $extp_main = null; if (is_null($extp_first)) { $extp_first = cot_getextplugins('markettags.first'); $extp_main = cot_getextplugins('markettags.main'); } /* === Hook === */ foreach ($extp_first as $pl) { include $pl; } /* ===== */ if (!is_array($item_data)) { $sql = $db->query("SELECT * FROM {$db_market} WHERE item_id = '" . (int) $item_data . "' LIMIT 1"); $item_data = $sql->fetch(); } if ($item_data['item_id'] > 0 && !empty($item_data['item_title'])) { if (is_null($admin_rights)) { $admin_rights = cot_auth('market', $item_data['item_cat'], 'A'); } $item_data['item_pageurl'] = empty($item_data['item_alias']) ? cot_url('market', 'c=' . $item_data['item_cat'] . '&id=' . $item_data['item_id']) : cot_url('market', 'c=' . $item_data['item_cat'] . '&al=' . $item_data['item_alias']); $catpatharray[] = array(cot_url('market'), $L['market']); $itempatharray[] = array($item_data['item_pageurl'], $item_data['item_title']); $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']), $itempatharray); $itempath = cot_breadcrumbs($patharray, $pagepath_home, true); $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat'])); $catpath = cot_breadcrumbs($patharray, $pagepath_home, true); $text = cot_parse($item_data['item_text'], $cfg['market']['markup'], $item_data['item_parser']); $text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : $text; $item_data['item_status'] = cot_market_status($item_data['item_state']); $temp_array = array('ID' => $item_data['item_id'], 'ALIAS' => $item_data['item_alias'], 'STATE' => $item_data['item_state'], 'STATUS' => $item_data['item_status'], 'LOCALSTATUS' => $L['market_status_' . $item_data['item_status']], 'URL' => $item_data['item_pageurl'], 'USER_PRDURL' => cot_url('users', 'm=details&id=' . $item_data['item_userid'] . '&u=' . $item_data['user_name'] . '&tab=market'), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['item_title'], 'CAT' => $item_data['item_cat'], 'CATTITLE' => htmlspecialchars($structure['market'][$item_data['item_cat']]['title']), 'CATURL' => cot_url('market', 'c=' . $item_data['item_cat']), 'CATPATH' => $catpath, 'TEXT' => $text, 'SHORTTEXT' => $text_cut, 'COST' => number_format($item_data['item_cost'], '0', '.', ' '), 'DATE' => cot_date('datetime_medium', $item_data['item_date']), 'DATE_STAMP' => $item_data['item_date'], 'SHOW_URL' => $item_data['item_pageurl'], 'COUNT' => $item_data['item_count'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']); if ($admin_rights || $usr['id'] == $item_data['item_userid']) { $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('market', 'm=edit&id=' . $item_data['item_id']), $L['Edit']); $temp_array['ADMIN_EDIT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id']); $temp_array['HIDEPRODUCT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id'] . ($item_data['item_state'] == 1 ? '&a=public' : '&a=hide')); $temp_array['HIDEPRODUCT_TITLE'] = $item_data['item_state'] == 1 ? $L['Publish'] : $L['Hide']; } // Extrafields if (isset($cot_extrafields[$db_market])) { foreach ($cot_extrafields[$db_market] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $temp_array[$tag . '_TITLE'] = isset($L['market_' . $exfld['field_name'] . '_title']) ? $L['market_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $temp_array[$tag] = cot_build_extrafields_data('market', $exfld, $item_data['item_' . $exfld['field_name']]); } } // Extra fields for structure if (isset($cot_extrafields[$db_structure])) { foreach ($cot_extrafields[$db_structure] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['market'][$item_data['item_cat']][$exfld['field_name']]); } } /* === Hook === */ foreach ($extp_main as $pl) { include $pl; } /* ===== */ } else { $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']); } $return_array = array(); foreach ($temp_array as $key => $val) { $return_array[$tag_prefix . $key] = $val; } return $return_array; }
if (cot_auth('page', $row['page_cat'], 'R')) { $rss_title = $row['page_title']; $rss_description = $L['rss_comments_item_desc']; $page_args = array('c' => $row['page_cat']); if (!empty($row['page_alias'])) { $page_args['al'] = $row['page_alias']; } else { $page_args['id'] = $row['page_id']; } $sql = $db->query("SELECT c.*, u.user_name\n\t\t\t\t\tFROM {$db_com} AS c\n\t\t\t\t\tLEFT JOIN {$db_users} AS u ON c.com_authorid = u.user_id\n\t\t\t\t\tWHERE com_area = 'page' AND com_code='{$page_id}'\n\t\t\t\t\tORDER BY com_date DESC LIMIT " . $cfg['rss']['rss_maxitems']); $i = 0; while ($row1 = $sql->fetch()) { $items[$i]['title'] = $L['rss_comment_of_user'] . " " . $row1['user_name']; $text = cot_parse($row1['com_text'], $cfg['plugin']['comments']['parsebbcodecom']); if ((int) $cfg['plugin']['comments']['rss_commentmaxsymbols'] > 0) { $text .= cot_string_truncate($text, $cfg['plugin']['comments']['rss_commentmaxsymbols']) ? '...' : ''; } $items[$i]['description'] = $text; $items[$i]['link'] = cot_url('page', $page_args, '#c' . $row1['com_id'], true); if (!cot_url_check($items[$i]['link'])) { $items[$i]['link'] = COT_ABSOLUTE_URL . $items[$i]['link']; } $items[$i]['pubDate'] = cot_date('r', $row1['com_date']); $i++; } // Attach original page text as last item $row['page_pageurl'] = cot_url('page', $page_args, '', true); $items[$i]['title'] = $L['rss_original']; $items[$i]['description'] = cot_parse_page_text($row['page_text'], $row['page_pageurl'], $row['page_parser']); $items[$i]['link'] = $row['page_pageurl']; if (!cot_url_check($items[$i]['link'])) {
cot_block($usr['auth_write']); if ($structure['forums'][$s]['locked']) { cot_die_message(602, true); } if ($a == 'newtopic') { cot_shield_protect(); /* === Hook === */ foreach (cot_getextplugins('forums.newtopic.newtopic.first') as $pl) { include $pl; } /* ===== */ $rmsg['fp_text'] = cot_import('rmsgtext', 'P', 'HTM'); $rtopic['ft_title'] = cot_import('rtopictitle', 'P', 'TXT', 255); $rtopic['ft_desc'] = cot_import('rtopicdesc', 'P', 'TXT', 255); $rtopic['ft_mode'] = (int) (cot_import('rtopicmode', 'P', 'BOL') && $cfg['forums']['cat_' . $s]['allowprvtopics']) ? 1 : 0; $rtopic['ft_preview'] = cot_string_truncate($rmsg['fp_text'], 120); if (mb_strlen($rtopic['ft_title']) < $cfg['forums']['mintitlelength']) { cot_error('forums_titletooshort', 'rtopictitle'); } if (mb_strlen($rmsg['fp_text']) < $cfg['forums']['minpostlength']) { cot_error('forums_messagetooshort', 'rmsgtext'); } if (!strpos($structure['forums'][$s]['path'], '.')) { // Attempting to create a topic in a root category include cot_langfile('message', 'core'); cot_error($L['msg602_body']); } foreach ($cot_extrafields[$db_forum_topics] as $exfld) { $rtopic['ft_' . $exfld['field_name']] = cot_import_extrafields('rtopic' . $exfld['field_name'], $exfld); } foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
$i18n_array = array_merge($i18n_array, array('TITLE' => cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home), 'CATTITLE' => htmlspecialchars($cat_i18n['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link(cot_url('page', 'c=' . $page_data['page_cat'] . $append_param), htmlspecialchars($cat_i18n['title'])), 'CATDESC' => htmlspecialchars($cat_i18n['desc']))); if ($admin_rights) { $i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']); $i18n_array['ADMIN_EDIT_URL'] = $edit_url; $i18n_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_url, $L['Validate']) : cot_rc_link($unvalidate_url, $L['Putinvalidationqueue']); $i18n_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_url : $unvalidate_url; } else { if ($usr['id'] == $page_data['page_ownerid']) { $i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']); $i18n_array['ADMIN_EDIT_URL'] = $edit_url; } } } else { $cat_i18n =& $structure['page'][$page_data['page_cat']]; } if (!empty($page_data['ipage_title'])) { $text = cot_parse($page_data['ipage_text'], $cfg['page']['markup']); $text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : cot_cut_more($text); $cutted = mb_strlen($text) > mb_strlen($text_cut) ? true : false; $page_link = array(array(cot_url('page', $urlparams), $page_data['ipage_title'])); $i18n_array = array_merge($i18n_array, array('URL' => cot_url('page', $urlparams), 'TITLE' => cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home), 'SHORTTITLE' => htmlspecialchars($page_data['ipage_title']), 'DESC' => htmlspecialchars($page_data['ipage_desc']), 'TEXT' => $text, 'TEXT_CUT' => $text_cut, 'TEXT_IS_CUT' => $cutted, 'DESC_OR_TEXT' => !empty($page_data['ipage_desc']) ? htmlspecialchars($page_data['page_desc']) : $text, 'MORE' => $cutted ? cot_rc_link($page_data['page_pageurl'], $L['ReadMore']) : '')); } //$i18n_array['ADMIN_EDIT'] = ''; if ($i18n_write) { if (!empty($page_data['ipage_id']) && ($i18n_admin || $pag_i18n['ipage_translatorid'] == $usr['id'])) { // Edit translation $i18n_array['ADMIN_EDIT'] = cot_rc_link(cot_url('plug', "e=i18n&m=page&a=edit&id=" . $page_data['page_id'] . "&l={$i18n_locale}"), $L['Edit']); } } $temp_array = array_merge($temp_array, $i18n_array); }
function cot_parse_post_text($post_text) { global $cfg; $post_text = cot_parse($post_text, $cfg['forums']['markup']); if ((int) $cfg['rss']['rss_postmaxsymbols'] > 0) { $post_text = cot_string_truncate($post_text, $cfg['rss']['rss_postmaxsymbols'], true, false, '...'); } return $post_text; }
<?php /* ==================== [BEGIN_COT_EXT] Hooks=recentitems.recentpages.tags [END_COT_EXT] ==================== */ /** * Modifies recentitems loop tags * * @package I18n * @copyright (c) Cotonti Team * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt */ defined('COT_CODE') or die('Wrong URL'); if ($i18n_notmain && !empty($pag['ipage_title'])) { // Overwrite some tags if ((int) $titlelength > 0 && mb_strlen($pag['ipage_title']) > $titlelength) { $pag['ipage_title'] = cot_string_truncate($pag['ipage_title'], $titlelength, false) . '...'; } $recentitems->assign(array('PAGE_ROW_SHORTTITLE' => htmlspecialchars($pag['ipage_title']))); }
function cot_build_recentpages($template, $mode = 'recent', $maxperpage = 5, $d = 0, $titlelength = 0, $textlength = 0, $rightprescan = true, $cat = '') { global $db, $structure, $db_pages, $db_users, $sys, $cfg, $L, $cot_extrafields, $usr; $recentitems = new XTemplate(cot_tplfile($template, 'plug')); // Load all cats and subcats in white list if set if (!empty($cfg['plugin']['recentitems']['whitelist'])) { $whitelist = array(); foreach (preg_split('#\\r?\\n#', $cfg['plugin']['recentitems']['whitelist']) as $c) { $whitelist = array_merge($whitelist, cot_structure_children('page', $c, true, true, $rightprescan)); } } else { $whitelist = false; } // Load all cats and subcats in black list if set if (!empty($cfg['plugin']['recentitems']['blacklist'])) { $blacklist = array(); foreach (preg_split('#\\r?\\n#', $cfg['plugin']['recentitems']['blacklist']) as $c) { $blacklist = array_merge($blacklist, cot_structure_children('page', $c, true, true, $rightprescan)); } } else { $blacklist = false; } if ($rightprescan || $cat) { // Get selected cats $catsub = cot_structure_children('page', $cat, true, true, $rightprescan); if ($whitelist) { // Must be both in selected and whitelist $catsub = array_intersect($catsub, $whitelist); } elseif ($blacklist) { // Must be in selected but not in blacklist $catsub = array_diff($catsub, $blacklist); } $incat = "AND page_cat IN ('" . implode("','", $catsub) . "')"; } elseif ($whitelist) { // Only cats from white list $incat = "AND page_cat IN ('" . implode("','", $whitelist) . "')"; } elseif ($blacklist) { // All cats but not in black list $incat = "AND page_cat NOT IN ('" . implode("','", $blacklist) . "')"; } if ($mode == 'recent') { $where = "WHERE page_state=0 AND page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']}) AND page_cat <> 'system' " . $incat; $totalrecent['pages'] = $cfg['plugin']['recentitems']['maxpages']; } else { $where = "WHERE page_date >= {$mode} AND page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']}) AND page_state=0 AND page_cat <> 'system' " . $incat; $totalrecent['pages'] = $db->query("SELECT COUNT(*) FROM {$db_pages} " . $where)->fetchColumn(); } $join_columns = ''; $join_tables = ''; /* === Hook === */ foreach (cot_getextplugins('recentitems.recentpages.first') as $pl) { include $pl; } /* ===== */ $sql = $db->query("SELECT p.*, u.* {$join_columns}\n\t\tFROM {$db_pages} AS p\n\t\t\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\t\t{$join_tables}\n\t\t{$where} ORDER by page_date desc LIMIT {$d}, {$maxperpage}"); $jj = 0; /* === Hook - Part1 === */ $extp = cot_getextplugins('recentitems.recentpages.tags'); /* ===== */ foreach ($sql->fetchAll() as $pag) { $jj++; if ((int) $titlelength > 0 && mb_strlen($pag['page_title']) > $titlelength) { $pag['page_title'] = cot_string_truncate($pag['page_title'], $titlelength, false) . "..."; } $recentitems->assign(cot_generate_pagetags($pag, 'PAGE_ROW_', $textlength)); $recentitems->assign(array('PAGE_ROW_SHORTTITLE' => htmlspecialchars($pag['page_title']), 'PAGE_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_NUM' => $jj)); $recentitems->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_')); /* === Hook - Part2 === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $recentitems->parse('MAIN.PAGE_ROW'); } if ($d == 0 && $jj == 0) { $recentitems->parse('MAIN.NO_PAGES_FOUND'); } $recentitems->parse('MAIN'); return $d == 0 || $jj > 0 ? $recentitems->text('MAIN') : ''; }
public function getTextCut() { global $structure; // Текст берется через геттер т.к. должет отработать cot_parse $textCut = cot_cut_more($this->text); $textlength = 0; if ($this->_data['category'] != '' && isset(cot::$cfg['advboard']['cat_' . $this->_data['category']])) { $textlength = cot::$cfg['advboard']['cat_' . $this->_data['category']]['truncatetext']; if ($textlength > 0 && mb_strlen($textCut) > $textlength) { $textCut = cot_string_truncate($textCut, $textlength, true, false, cot::$R['advboard_cuttext']); } } return $textCut; }