if ($advert->owner['user_id'] == 0) { ?> Добрый день! <?php } else { ?> Добрый день, <?php echo htmlspecialchars($advert->owner['full_name']); ?> ! <?php } ?> <p> Вы получили это письмо потому, что <b><?php echo cot_date('date_full', $advert->expire); ?> </b> истекает срок публикации Вашего объявления на сайте «<a href="<?php echo cot::$cfg['mainurl']; ?> " target="_blank"><?php echo htmlspecialchars(cot::$cfg["maintitle"]); ?> </a>».<br /> После этого оно будет закрыто и больше не будет видно другим пользователям сайта. </p> <p> <b>«<a href="<?php echo $this->advertUrl; ?>
// 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']]); $exfld_title = cot_extrafield_title($exfld, 'contact_'); $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']])); $tuman->parse('MAIN.DATA.EXTRAFLD'); } } $tuman->parse('MAIN.DATA'); } $sql->closeCursor(); if ($a == '' && !empty($id)) { $row = $db->query("SELECT * FROM " . cot::$db->contact . " WHERE contact_id = {$id}")->fetch(); $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_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id']), 'CONTACT_VAL' => $row['contact_val'] == 1 ? 'unval' : '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' => $row['contact_reply'], 'CONTACT_FORM_SEND' => cot_url("admin", 'm=other&p=contact&a=send&id=' . $row['contact_id']), 'CONTACT_FORM_TEXT' => cot_textarea('rtext', $rtext, 8, 64))); // 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']]); $exfld_title = cot_extrafield_title($exfld, 'contact_'); $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']])); $tuman->parse('MAIN.VIEW.EXTRAFLD'); } } $tuman->parse('MAIN.VIEW'); } cot_display_messages($tuman); $tuman->assign(array('CONTACT_PAGINATION' => $pagnav['main'], 'CONTACT_PREV' => $pagenav['prev'], 'CONTACT_NEXT' => $pagenav['next'])); $tuman->parse('MAIN');
include $pl; } /* ===== */ switch ($msg) { /* ======== Users ======== */ case '100': $rd = 2; $ru = cot_url('login', empty($redirect) ? '' : "redirect={$redirect}"); break; case '102': $r = 1; $rd = 2; break; case '153': if ($num > 0) { $body .= cot_rc('msg_code_153_date', array('date' => cot_date('datetime_medium', $num))); } break; /* ======== Error Pages ========= */ /* ======== Error Pages ========= */ case '400': case '401': case '403': case '404': case '500': $rd = 5; $ru = empty($redirect) ? '' : str_replace('&', '&', base64_decode($redirect)); break; /* ======== System messages ======== */ /* ======== System messages ======== */ case '916':
} /* ===== */ if ($usr['id'] == $item['item_userid'] && $choise_enabled) { $t_o->assign(array("OFFER_ROW_SETPERFORMER" => cot_url('projects', 'id=' . $id . '&a=setperformer&userid=' . $offer['user_id'] . '&' . cot_xg()), "OFFER_ROW_REFUSE" => cot_url('projects', 'id=' . $id . '&a=refuse&userid=' . $offer['user_id'] . '&' . cot_xg()))); /* === Hook - Part2 : Include === */ foreach ($extp2 as $pl) { include $pl; } /* ===== */ $t_o->parse("MAIN.ROWS.CHOISE"); } if ($usr['id'] == $offer['offer_userid'] || $usr['id'] == $item['item_userid'] || $usr['isadmin']) { $sql_prjposts = $db->query("SELECT * FROM {$db_projects_posts} as p LEFT JOIN {$db_users} as u ON u.user_id=p.post_userid\n\t\t\tWHERE post_pid=" . $id . " AND post_oid=" . $offer['offer_id'] . " ORDER BY post_date ASC"); while ($posts = $sql_prjposts->fetch()) { $t_o->assign(cot_generate_usertags($posts, 'POST_ROW_OWNER_')); $t_o->assign(array("POST_ROW_TEXT" => cot_parse($posts['post_text']), "POST_ROW_DATE" => cot_date('d.m.y H:i', $posts['post_date']), "POST_ROW_DATE_STAMP" => $posts['post_date'])); /* === Hook - Part3 : Include === */ foreach ($extp3 as $pl) { include $pl; } /* ===== */ $t_o->parse("MAIN.ROWS.POSTS.POSTS_ROWS"); } $t_o->assign(array("ADDPOST_ACTION_URL" => cot_url('projects', 'id=' . $id . '&oid=' . $offer['offer_id'] . '&a=addpost'), "ADDPOST_TEXT" => cot_textarea('posttext', $offer_post['post_text'], 3, 60), "ADDPOST_OFFERID" => $offer['offer_id'])); $t_o->parse("MAIN.ROWS.POSTS.POSTFORM"); $t_o->parse("MAIN.ROWS.POSTS"); } /* === Hook - Part4 : Include === */ foreach ($extp4 as $pl) { include $pl; }
} $sqllist = $db->query("SELECT SQL_CALC_FOUND_ROWS p.* {$search_join_columns}\n\t\tFROM {$db_projects} AS p {$search_join_condition}\n\t\tWHERE {$where}\n\t\tORDER BY item_" . $rs['prjsort'] . " " . $rs['prjsort2'] . "\n\t\tLIMIT {$d}, " . $cfg_maxitems . $search_union_query); $items = $sql->rowCount(); $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn(); $jj = 0; $sqllist_rowset = $sqllist->fetchAll(); $sqllist_idset = array(); foreach ($sqllist_rowset as $item) { $sqllist_idset[$item['item_id']] = $item['item_alias']; } /* === Hook - Part 1 === */ $extp = cot_getextplugins('projects.search.loop'); /* ===== */ foreach ($sqllist_rowset as $row) { $url_cat = cot_url('projects', 'c=' . $row['item_cat']); $url_prj = empty($row['item_alias']) ? cot_url('projects', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'] . '&highlight=' . $hl) : cot_url('projects', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'] . '&highlight=' . $hl); $t->assign(cot_generate_projecttags($row, 'PLUGIN_PROJECTSRES_')); $t->assign(array('PLUGIN_PROJECTSRES_CATEGORY' => cot_rc_link($url_cat, $structure['projects'][$row['item_cat']]['tpath']), 'PLUGIN_PROJECTSRES_CATEGORY_URL' => $url_cat, 'PLUGIN_PROJECTSRES_TITLE' => cot_rc_link($url_prj, htmlspecialchars($row['item_title'])), 'PLUGIN_PROJECTSRES_TEXT' => cot_clear_mark($row['item_text'], $words), 'PLUGIN_PROJECTSRES_TIME' => cot_date('datetime_medium', $row['item_date']), 'PLUGIN_PROJECTSRES_TIMESTAMP' => $row['item_date'], 'PLUGIN_PROJECTSRES_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PROJECTSRES_NUM' => $jj)); /* === Hook - Part 2 === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.RESULTS.PROJECTS.ITEM'); $jj++; } if ($jj > 0) { $t->parse('MAIN.RESULTS.PROJECTS'); } unset($where_and, $where_or, $where); }
/** * 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; }
echo cot_url('admin', array('m' => 'subscribe', 'n' => 'user', 'f[sid]' => $item->id, 'f[active]' => 1)); ?> "> <?php echo $this->activeSubscribers; ?> </a> </p> <p> <?php $lastEx = '<span class="fa fa-minus"></span>'; if (!empty($item->last_executed)) { $tmp = strtotime('1970-01-02 00:01:00'); $tmp2 = strtotime($item->last_executed); if ($tmp2 > $tmp) { $lastEx = cot_date($Ldt['datetime_full'], $tmp2); } } ?> <?php echo cot::$L['subscribe_last_executed']; ?> : <?php echo $lastEx; ?> <br /><?php echo cot::$L['subscribe_last_sent']; ?> : <?php echo $item->last_sent; ?>
$sql_pfs_update = $db->query("UPDATE {$db_pfs} SET\n\t\tpfs_desc='" . $db->prep($rdesc) . "',\n\t\tpfs_folderid={$folderid}\n\t\tWHERE pfs_userid={$userid} AND pfs_id={$id}"); cot_redirect(cot_url('pfs', "f={$pfs_folderid}&" . $more, '', true)); } /* ============= */ $out['subtitle'] = $L['pfs_title']; if (!$standalone) { require_once $cfg['system_dir'] . '/header.php'; } $t = new XTemplate(cot_tplfile('pfs.edit')); if ($standalone) { cot_sendheaders(); $html = Resources::render(); if ($html) { $out['head_head'] = $html . $out['head_head']; } $t->assign(array('PFS_HEAD' => $out['head_head'])); $t->parse('MAIN.STANDALONE_HEADER'); $t->parse('MAIN.STANDALONE_FOOTER'); } $t->assign(array('PFS_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PFS_ACTION' => cot_url('pfs', 'm=edit&a=update&id=' . $pfs_id . '&' . $more), 'PFS_FILE' => $pfs_file, 'PFS_DATE' => cot_date('datetime_medium', $pfs_date), 'PFS_DATE_STAMP' => $pfs_date, 'PFS_FOLDER' => cot_selectbox_folders($userid, '', $pfs_folderid), 'PFS_URL' => $ff, 'PFS_DESC' => cot_inputbox('text', 'rdesc', $pfs_desc, 'size="56" maxlength="255"'), 'PFS_SIZE' => cot_build_filesize($pfs_size_bytes, 1), 'PFS_SIZE_BYTES' => $pfs_size_bytes, 'PFS_SIZE_KB' => $pfs_size_bytes / 1024)); cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('pfs.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $t->out('MAIN'); if (!$standalone) { require_once $cfg['system_dir'] . '/footer.php'; }
if (!empty($c) && isset($structure['folio'][$c])) { $mtch = $structure['folio'][$c]['path'] . "."; $mtchlen = mb_strlen($mtch); $catsub = array(); $catsub[] = $c; foreach ($structure['folio'] as $i => $x) { if (mb_substr($x['path'], 0, $mtchlen) == $mtch) { $catsub[] = $i; } } $sqllist = $db->query("SELECT p.*, u.* FROM {$db_folio} AS p\n\t\t\t\tLEFT JOIN {$db_users} AS u ON p.item_userid = u.user_id\n\t\t\tWHERE item_state=0 AND item_cat IN ('" . implode("','", $catsub) . "') \n\t\t\tORDER BY item_date DESC LIMIT " . $cfg['rss']['rss_maxitems']); } else { $sqllist = $db->query("SELECT p.*, u.* FROM {$db_folio} AS p\n\t\t\t\tLEFT JOIN {$db_users} AS u ON p.item_userid = u.user_id\n\t\t\tWHERE item_state=0 \n\t\t\tORDER BY item_date DESC LIMIT " . $cfg['rss']['rss_maxitems']); } $i = 0; $sqllist_rowset = $sqllist->fetchAll(); $sqllist_idset = array(); foreach ($sqllist_rowset as $item) { $sqllist_idset[$item['item_id']] = $item['item_alias']; } foreach ($sqllist_rowset as $row) { $row['item_pageurl'] = empty($row['item_alias']) ? cot_url('folio', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'], '', true) : cot_url('folio', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'], '', true); $items[$i]['title'] = $row['item_title']; $items[$i]['link'] = COT_ABSOLUTE_URL . $row['item_pageurl']; $items[$i]['pubDate'] = cot_date('r', $row['item_date']); $items[$i]['description'] = cot_parse($row['item_text']); $items[$i]['fields'] = cot_generate_foliotags($row); $i++; } $sqllist->closeCursor(); }
*/ /** * Frelancers plugin * * @package freelancers * @version 2.2.2 * @author CMSWorks Team * @copyright Copyright (c) CMSWorks.ru, littledev.ru * @license BSD */ defined('COT_CODE') or die('Wrong URL'); if ($c == "users") { $defult_c = false; $groupid = cot_import('groupid', 'G', 'INT'); $query_string = !empty($groupid) ? "AND user_maingrp=" . $groupid : "AND user_maingrp=4"; if ($id != 'all') { $catsub = cot_fl_cat_children($id); $sql = $db->query("SELECT * FROM {$db_users} AS u\n\t\t\tWHERE user_cat IN ('" . implode("','", $catsub) . "') " . $query_string . "\n\t\t\tORDER BY user_regdate DESC LIMIT " . $cfg['rss']['rss_maxitems']); } else { $sql = $db->query("SELECT * FROM {$db_users} AS u\n\t\t\tWHERE " . $query_string . "\n\t\t\tORDER BY user_regdate DESC LIMIT " . $cfg['rss']['rss_maxitems']); } $i = 0; while ($row = $sql->fetch()) { $items[$i]['title'] = $row['user_name']; $items[$i]['link'] = COT_ABSOLUTE_URL . cot_url('users', 'm=details&id=' . $row['user_id'] . '&u=' . $row['user_name'], '', true); $items[$i]['pubDate'] = cot_date('r', $row['user_regdate']); $items[$i]['fields'] = cot_generate_usertags($row); $i++; } $sql->closeCursor(); }
$info['available'] = '?'; } $t->assign(array('ADMIN_CACHE_MEMORY_DRIVER' => str_replace('_driver', '', $cache->mem_driver), 'ADMIN_CACHE_MEMORY_PERCENTBAR' => ceil($info['occupied'] / $info['max'] * 100), 'ADMIN_CACHE_MEMORY_AVAILABLE' => $info['available'], 'ADMIN_CACHE_MEMORY_MAX' => $info['max'])); $t->parse('MAIN.ADMIN_CACHE_MEMORY'); } $sql = $db->query("SELECT * FROM {$db_cache} WHERE 1 ORDER by c_name ASC"); $cachesize = 0; $ii = 0; /* === Hook - Part1 : Set === */ $extp = cot_getextplugins('admin.cache.loop'); /* ===== */ foreach ($sql->fetchAll() as $row) { $row['c_value'] = htmlspecialchars($row['c_value']); $row['size'] = mb_strlen($row['c_value']); $cachesize += $row['size']; $t->assign(array('ADMIN_CACHE_ITEM_DEL_URL' => cot_url('admin', 'm=cache&a=delete&name=' . $row['c_name'] . '&' . cot_xg()), 'ADMIN_CACHE_ITEM_NAME' => $row['c_name'], 'ADMIN_CACHE_EXPIRE' => $row['c_expire'] > 0 ? cot_date('datetime_short', $row['c_expire']) : '-', 'ADMIN_CACHE_SIZE' => $row['size'], 'ADMIN_CACHE_VALUE' => $a == 'showall' ? $row['c_value'] : cot_cutstring($row['c_value'], 80), 'ADMIN_CACHE_ROW_ODDEVEN' => cot_build_oddeven($ii))); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.ADMIN_CACHE_ROW'); $ii++; } $t->assign(array('ADMIN_CACHE_URL_REFRESH' => cot_url('admin', 'm=cache'), 'ADMIN_CACHE_URL_PURGE' => cot_url('admin', 'm=cache&a=purge&' . cot_xg()), 'ADMIN_CACHE_URL_SHOWALL' => cot_url('admin', 'm=cache&a=showall'), 'ADMIN_CACHE_CACHESIZE' => $cachesize)); cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('admin.cache.tags') as $pl) { include $pl; } /* ===== */
$com_grp = $usr['isadmin'] ? 'adm' : 'usr'; cot_log('Edited comment #' . $id, $com_grp); cot_redirect(cot_url($url_area, $url_params, '#c' . $id, true)); } } $t->assign(array('COMMENTS_TITLE' => $plugin_title, 'COMMENTS_TITLE_URL' => cot_url('plug', 'e=comments'))); $t->parse('MAIN.COMMENTS_TITLE'); $sql = $db->query("SELECT * FROM {$db_com} WHERE com_id=? AND com_code=? AND com_area=?", array($id, $item, $area)); cot_die($sql->rowCount() != 1); $com = $sql->fetch(); $com_limit = $sys['now'] < $com['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE; $usr['isowner'] = $com_limit && ($usr['id'] > 0 && $com['com_authorid'] == $usr['id'] || $usr['id'] == 0 && isset($_SESSION['cot_comments_edit'][$id])); $usr['allow_write'] = $usr['isadmin'] || $usr['isowner']; cot_block($usr['allow_write']); $editor = $cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : ''; $t->assign(array('COMMENTS_FORM_POST' => cot_url('plug', 'e=comments&m=edit&a=update&area=' . $area . '&cat=' . $cat . '&item=' . $com['com_code'] . '&id=' . $com['com_id']), 'COMMENTS_POSTER_TITLE' => $L['Poster'], 'COMMENTS_POSTER' => $com['com_author'], 'COMMENTS_IP_TITLE' => $L['Ip'], 'COMMENTS_IP' => $com['com_authorip'], 'COMMENTS_DATE_TITLE' => $L['Date'], 'COMMENTS_DATE' => cot_date('datetime_medium', $com['com_date']), 'COMMENTS_DATE_STAMP' => $com['com_date'], 'COMMENTS_FORM_UPDATE_BUTTON' => $L['Update'], 'COMMENTS_FORM_TEXT' => cot_textarea('comtext', $com['com_text'], 8, 64, '', $editor))); // Extra fields foreach ($cot_extrafields[$db_com] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $com[$exfld['field_name']]); $exfld_title = isset($L['comments_' . $exfld['field_name'] . '_title']) ? $L['comments_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('COMMENTS.COMMENTS_FORM_EDIT.EXTRAFLD'); } /* == Hook == */ foreach (cot_getextplugins('comments.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.COMMENTS_FORM_EDIT'); }
$title_params = array('EDIT' => $L['Edit'], 'NAME' => $urr['user_name']); $out['subtitle'] = cot_title('{EDIT} - {NAME}', $title_params); $out['head'] .= $R['code_noindex']; $mskin = cot_tplfile(array('users', 'edit', $usr['maingrp']), 'module'); /* === Hook === */ foreach (cot_getextplugins('users.edit.main') as $pl) { include $pl; } /* ===== */ require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate($mskin); require_once cot_incfile('forms'); $protected = $sys['protecttopadmin'] ? array('disabled' => 'disabled') : array(); $editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : ''; $delete_pfs = cot_module_active('pfs') ? cot_checkbox(false, 'ruserdelpfs', $L['PFS']) : ''; $t->assign(array('USERS_EDIT_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name']), array(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit'])), $cfg['homebreadcrumb']), 'USERS_EDIT_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_EDIT_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_EDIT_SUBTITLE' => $L['useed_subtitle'], 'USERS_EDIT_SEND' => cot_url('users', 'm=edit&a=update&' . cot_xg() . '&id=' . $urr['user_id']), 'USERS_EDIT_ID' => $urr['user_id'], 'USERS_EDIT_NAME' => cot_inputbox('text', 'rusername', $urr['user_name'], array('size' => 32, 'maxlength' => 100) + $protected), 'USERS_EDIT_ACTIVE' => $user_form_active, 'USERS_EDIT_BANNED' => $user_form_banned, 'USERS_EDIT_THEME' => cot_inputbox('text', 'rusertheme', $urr['user_theme'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_LANG' => cot_inputbox('text', 'ruserlang', $urr['user_lang'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_NEWPASS' => cot_inputbox('password', 'rusernewpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off') + $protected), 'USERS_EDIT_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_EDIT_GROUPS' => cot_build_groupsms($urr['user_id'], $usr['isadmin'], $urr['user_maingrp']), 'USERS_EDIT_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_EDIT_EMAIL' => cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64)), 'USERS_EDIT_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_EDIT_TEXT' => cot_textarea('rusertext', $urr['user_text'], 4, 56, array('class' => $editor_class)), 'USERS_EDIT_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_EDIT_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_EDIT_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_EDIT_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_EDIT_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_EDIT_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_EDIT_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_EDIT_LOGCOUNT' => $urr['user_logcount'], 'USERS_EDIT_LASTIP' => cot_build_ipsearch($urr['user_lastip']), 'USERS_EDIT_DELETE' => $sys['user_istopadmin'] ? cot_radiobox(0, 'ruserdelete', array(1, 0), array($L['Yes'], $L['No'])) . $delete_pfs : $L['na'])); // Extra fields foreach ($cot_extrafields[$db_users] as $exfld) { $tag = strtoupper($exfld['field_name']); $t->assign(array('USERS_EDIT_' . $tag => cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]), 'USERS_EDIT_' . $tag . '_TITLE' => isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description'])); } // Error and message reporting cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('users.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $t->out('MAIN'); require_once $cfg['system_dir'] . '/footer.php';
<?php // Error and message handling $this->displayMessages(); if (!empty($userSubscribes)) { foreach ($userSubscribes as $itemRow) { $subRow = $subscribes[$itemRow->rawValue('subscribe')]; $nextRun = ''; $attrs = 'data-id="' . $itemRow->rawValue('subscribe') . '"'; if ($this->user['user_id'] != cot::$usr['id']) { $attrs .= ' data-uid="' . $this->user['user_id'] . '"'; } if (!empty($subRow->next_run)) { $tmp = cot::$sys['now']; $tmp2 = strtotime($subRow->next_run); if ($tmp2 > $tmp) { $nextRun = cot_date($Ldt['datetime_full'], $tmp2); } } ?> <div class="list-row subscribe"> <h2> <?php echo htmlspecialchars($subRow->title); ?> </h2> <div> <?php // Статус рассылки if (!$subRow->active) { echo cot::$L['subscribe_subscribe'] . ': '; ?>
/** * Returns all user tags for XTemplate * * @param mixed $user_data User Info Array * @param string $tag_prefix Prefix for tags * @param string $emptyname Name text if user is not exist * @param bool $allgroups Build info about all user groups * @param bool $cacheitem Cache tags * @return array * @global CotDB $db */ function cot_generate_usertags($user_data, $tag_prefix = '', $emptyname = '', $allgroups = false, $cacheitem = true) { global $db, $cot_extrafields, $cot_groups, $cfg, $L, $user_cache, $db_users; static $extp_first = null, $extp_main = null; $return_array = array(); if (is_null($extp_first)) { $extp_first = cot_getextplugins('usertags.first'); $extp_main = cot_getextplugins('usertags.main'); } /* === Hook === */ foreach ($extp_first as $pl) { include $pl; } /* ===== */ $user_id = is_array($user_data) ? (int) $user_data['user_id'] : (is_numeric($user_data) ? (int) $user_data : 0); if (isset($user_cache[$user_id])) { $temp_array = $user_cache[$user_id]; } else { if (!is_array($user_data) && $user_id > 0) { $sql = $db->query("SELECT * FROM {$db_users} WHERE user_id = {$user_id} LIMIT 1"); $user_data = $sql->fetch(); } else { if (!is_array($user_data)) { $user_data = array(); } } if (is_array($user_data) && $user_data['user_id'] > 0 && !empty($user_data['user_name'])) { $user_data['user_birthdate'] = cot_date2stamp($user_data['user_birthdate']); $user_data['user_text'] = cot_parse($user_data['user_text'], $cfg['users']['usertextimg']); $temp_array = array('ID' => $user_data['user_id'], 'NAME' => cot_build_user($user_data['user_id'], htmlspecialchars($user_data['user_name'])), 'NICKNAME' => htmlspecialchars($user_data['user_name']), 'DETAILSLINK' => cot_url('users', 'm=details&id=' . $user_data['user_id'] . '&u=' . htmlspecialchars($user_data['user_name'])), 'DETAILSLINKSHORT' => cot_url('users', 'm=details&id=' . $user_data['user_id']), 'FULL_NAME' => htmlspecialchars(cot_user_full_name($user_data)), 'TITLE' => $cot_groups[$user_data['user_maingrp']]['title'], 'MAINGRP' => cot_build_group($user_data['user_maingrp']), 'MAINGRPID' => $user_data['user_maingrp'], 'MAINGRPNAME' => $cot_groups[$user_data['user_maingrp']]['name'], 'MAINGRPTITLE' => cot_build_group($user_data['user_maingrp'], true), 'MAINGRPSTARS' => cot_build_stars($cot_groups[$user_data['user_maingrp']]['level']), 'MAINGRPICON' => cot_build_groupicon($cot_groups[$user_data['user_maingrp']]['icon']), 'COUNTRY' => cot_build_country($user_data['user_country']), 'COUNTRYFLAG' => cot_build_flag($user_data['user_country']), 'TEXT' => $user_data['user_text'], 'EMAIL' => cot_build_email($user_data['user_email'], $user_data['user_hideemail']), 'THEME' => $user_data['user_theme'], 'SCHEME' => $user_data['user_scheme'], 'LANG' => $user_data['user_lang'], 'GENDER' => $user_data['user_gender'] == '' || $user_data['user_gender'] == 'U' ? '' : $L['Gender_' . $user_data['user_gender']], 'BIRTHDATE' => is_null($user_data['user_birthdate']) ? '' : cot_date('date_full', $user_data['user_birthdate']), 'BIRTHDATE_STAMP' => is_null($user_data['user_birthdate']) ? '' : $user_data['user_birthdate'], 'AGE' => is_null($user_data['user_birthdate']) ? '' : cot_build_age($user_data['user_birthdate']), 'TIMEZONE' => cot_build_timezone(cot_timezone_offset($user_data['user_timezone'], false, false)) . ' ' . str_replace('_', ' ', $user_data['user_timezone']), 'REGDATE' => cot_date('datetime_medium', $user_data['user_regdate']), 'REGDATE_STAMP' => $user_data['user_regdate'], 'LASTLOG' => cot_date('datetime_medium', $user_data['user_lastlog']), 'LASTLOG_STAMP' => $user_data['user_lastlog'], 'LOGCOUNT' => $user_data['user_logcount'], 'POSTCOUNT' => $user_data['user_postcount'], 'LASTIP' => $user_data['user_lastip']); if ($allgroups) { $temp_array['GROUPS'] = cot_build_groupsms($user_data['user_id'], FALSE, $user_data['user_maingrp']); } // Extra fields if (isset($cot_extrafields[$db_users])) { foreach ($cot_extrafields[$db_users] as $exfld) { $temp_array[strtoupper($exfld['field_name'])] = cot_build_extrafields_data('user', $exfld, $user_data['user_' . $exfld['field_name']]); $temp_array[strtoupper($exfld['field_name']) . '_TITLE'] = isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $temp_array[strtoupper($exfld['field_name']) . '_VALUE'] = $user_data['user_' . $exfld['field_name']]; } } } else { $temp_array = array('ID' => 0, 'NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'NICKNAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'FULL_NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'MAINGRP' => cot_build_group(1), 'MAINGRPID' => 1, 'MAINGRPSTARS' => '', 'MAINGRPICON' => cot_build_groupicon($cot_groups[1]['icon']), 'COUNTRY' => cot_build_country(''), 'COUNTRYFLAG' => cot_build_flag(''), 'TEXT' => '', 'EMAIL' => '', 'GENDER' => '', 'BIRTHDATE' => '', 'BIRTHDATE_STAMP' => '', 'AGE' => '', 'REGDATE' => '', 'REGDATE_STAMP' => '', 'POSTCOUNT' => '', 'LASTIP' => ''); } /* === Hook === */ foreach ($extp_main as $pl) { include $pl; } /* ===== */ if (is_array($user_data) && isset($user_data['user_id'])) { $cacheitem && ($user_cache[$user_data['user_id']] = $temp_array); } } foreach ($temp_array as $key => $val) { $return_array[$tag_prefix . $key] = $val; } return $return_array; }
echo cot::$L['advboard_my_adv']; ?> </span> <?php } ?> <time datetime="<?php echo date('Y-m-d\\TH:i:s+00:00', $advRow->begin); ?> " class="desc"> <?php if (date('Y', $advRow->begin) == date('Y', cot::$sys['now'])) { echo cot_date('l, d F, G:i', $advRow->begin); } else { echo cot_date('datetime_fulltext', $advRow->begin); } ?> </time> <?php if ($this->allowComments) { $cnt = cot_comments_count('advboard', $advRow->id); ?> <span class="desc"> | <a href="<?php echo $advRow->url; ?> #comments"> Комментариев <?php echo $cnt > 0 ? $cnt : cot::$L['No'];
/** * Generates comments display for a given item * * @param string $ext_name Module or plugin code * @param string $code Item identifier * @param string $cat Item category code (optional) * @param bool $force_admin Enforces user to be administrator of comments for this item. * E.g. to moderate his wall even if he is not a moderator * @return string Rendered HTML output for comments * @global CotDB $db */ function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false) { global $db, $db_com, $db_users, $cfg, $usr, $L, $sys, $R, $env, $pg, $cot_extrafields, $cache, $structure; // Check permissions and enablement list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'comments'); if ($auth_read && $auth_write && $force_admin) { $auth_admin = true; $_SESSION['cot_comments_force_admin'][$ext_name][$code] = true; } $enabled = cot_comments_enabled($ext_name, $cat, $code); if (!$auth_read || !$enabled && !$auth_admin) { return ''; } $comments_join_columns = $comments_join_tables = $comments_join_where = ''; // Get the URL and parameters $link_area = $env['ext']; $link_params = $_GET; if (defined('COT_PLUG')) { $link_area = 'plug'; $link_params['e'] = $env['ext']; } if (isset($_GET['rwr'])) { unset($link_params['rwr'], $link_params['e']); } $cot_com_back = array($link_area, $link_params); $_SESSION['cot_com_back'][$ext_name][$cat][$code] = $cot_com_back; $d_var = 'dcm'; list($pg, $d, $durl) = cot_import_pagenav($d_var, $cfg['plugin']['comments']['maxcommentsperpage']); $d = empty($d) ? 0 : (int) $d; if ($auth_write && $enabled) { require_once cot_incfile('forms'); } $t = new XTemplate(cot_tplfile('comments', 'plug')); /* == Hook == */ foreach (cot_getextplugins('comments.main') as $pl) { include $pl; } /* ===== */ $editor = cot::$cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : ''; $t->assign(array('COMMENTS_CODE' => $code, 'COMMENTS_FORM_SEND' => cot_url('plug', "e=comments&a=send&area={$ext_name}&cat={$cat}&item={$code}"), 'COMMENTS_FORM_AUTHOR' => $usr['id'] > 0 ? $usr['name'] : cot_inputbox('text', 'rname'), 'COMMENTS_FORM_AUTHORID' => $usr['id'], 'COMMENTS_FORM_TEXT' => $auth_write && $enabled ? cot_textarea('rtext', $rtext, 7, 120, '', $editor) . cot_inputbox('hidden', 'cb', base64_encode(serialize($cot_com_back))) : '', 'COMMENTS_DISPLAY' => $cfg['plugin']['comments']['expand_comments'] ? '' : 'none')); if ($auth_write && $enabled) { // Extra fields if (!empty(cot::$extrafields[cot::$db->com])) { foreach (cot::$extrafields[cot::$db->com] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $rcomments[$exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'comments_'); $t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.EXTRAFLD'); } } $allowed_time = cot_build_timegap($sys['now'] - $cfg['plugin']['comments']['time'] * 60, $sys['now']); $com_hint = cot_rc('com_edithint', array('time' => $allowed_time)); /* == Hook == */ foreach (cot_getextplugins('comments.newcomment.tags') as $pl) { include $pl; } /* ===== */ $usr['id'] == 0 && $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.GUEST'); if ($usr['id'] == 0 && cot_check_messages() && $cache) { if ($ext_name == 'page' && $cfg['cache_page']) { $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$cat]['path'])); $cfg['cache_page'] = false; } } cot_display_messages($t, 'COMMENTS.COMMENTS_NEWCOMMENT'); $t->assign('COMMENTS_FORM_HINT', $com_hint); $t->parse('COMMENTS.COMMENTS_NEWCOMMENT'); } else { $warning = $enabled ? $L['com_regonly'] : $L['com_closed']; $t->assign('COMMENTS_CLOSED', $warning); $t->parse('COMMENTS.COMMENTS_CLOSED'); } $order = $cfg['plugin']['comments']['order'] == 'Chronological' ? 'ASC' : 'DESC'; $comments_order = "com_id {$order}"; /* == Hook == */ foreach (cot_getextplugins('comments.query') as $pl) { include $pl; } /* ===== */ $sql = $db->query("SELECT c.*, u.* {$comments_join_columns}\n\t\tFROM {$db_com} AS c LEFT JOIN {$db_users} AS u ON u.user_id = c.com_authorid {$comments_join_tables}\n\t\tWHERE com_area = ? AND com_code = ? {$comments_join_where} ORDER BY {$comments_order} LIMIT ?, ?", array($ext_name, $code, (int) $d, (int) $cfg['plugin']['comments']['maxcommentsperpage'])); if ($sql->rowCount() > 0 && $enabled) { $i = $d; $kk = 0; $totalitems = cot_comments_count($ext_name, $code); /* === Hook - Part1 : Set === */ $extp = cot_getextplugins('comments.loop'); /* ===== */ foreach ($sql->fetchAll() as $row) { $i++; $kk++; $com_admin = $auth_admin ? cot_rc('comments_code_admin', array('ipsearch' => cot_build_ipsearch($row['com_authorip']), 'delete_url' => cot_confirm_url(cot_url('plug', 'e=comments&a=delete&cat=' . $cat . '&id=' . $row['com_id'] . '&' . cot_xg()), 'comments', 'comments_confirm_delete'))) : ''; $com_text = cot_parse($row['com_text'], $cfg['plugin']['comments']['markup']); $time_limit = $sys['now'] < $row['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE; $usr['isowner_com'] = $time_limit && ($usr['id'] > 0 && $row['com_authorid'] == $usr['id'] || $usr['id'] == 0 && !empty($_SESSION['cot_comments_edit'][$row['com_id']]) && $usr['ip'] == $row['com_authorip']); $com_gup = $sys['now'] - ($row['com_date'] + $cfg['plugin']['comments']['time'] * 60); $allowed_time = $usr['isowner_com'] && !$usr['isadmin'] ? ' - ' . cot_build_timegap($sys['now'] + $com_gup, $sys['now']) . $L['plu_comgup'] : ''; $com_edit = $auth_admin || $usr['isowner_com'] ? cot_rc('comments_code_edit', array('edit_url' => cot_url('plug', 'e=comments&m=edit&cat=' . $cat . '&id=' . $row['com_id']), 'allowed_time' => $allowed_time)) : ''; if ($row['com_area'] == 'page') { if ($usr['id'] == 0 && $usr['isowner_com'] && $cfg['cache_page']) { $cfg['cache_page'] = $cfg['cache_index'] = false; } } $t->assign(array('COMMENTS_ROW_ID' => $row['com_id'], 'COMMENTS_ROW_ORDER' => $cfg['plugin']['comments']['order'] == 'Recent' ? $totalitems - $i + 1 : $i, 'COMMENTS_ROW_URL' => cot_url($link_area, $link_params, '#c' . $row['com_id']), 'COMMENTS_ROW_AUTHOR' => cot_build_user($row['com_authorid'], htmlspecialchars($row['com_author'])), 'COMMENTS_ROW_AUTHORID' => $row['com_authorid'], 'COMMENTS_ROW_TEXT' => $com_text, 'COMMENTS_ROW_DATE' => cot_date('datetime_medium', $row['com_date']), 'COMMENTS_ROW_DATE_STAMP' => $row['com_date'], 'COMMENTS_ROW_ADMIN' => $com_admin, 'COMMENTS_ROW_EDIT' => $com_edit, 'COMMENTS_ROW_ODDEVEN' => cot_build_oddeven($kk), 'COMMENTS_ROW_NUM' => $kk)); // Extrafields if (!empty(cot::$extrafields[cot::$db->com])) { foreach (cot::$extrafields[cot::$db->com] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $exfld_title = cot_extrafield_title($exfld, 'comments_'); $t->assign(array('COMMENTS_ROW_' . $tag . '_TITLE' => $exfld_title, 'COMMENTS_ROW_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'COMMENTS_ROW_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']])); } } $t->assign(cot_generate_usertags($row, 'COMMENTS_ROW_AUTHOR_', htmlspecialchars($row['com_author']))); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('COMMENTS.COMMENTS_ROW'); } $pagenav = cot_pagenav($link_area, $link_params, $d, $totalitems, $cfg['plugin']['comments']['maxcommentsperpage'], $d_var, '#comments', $cfg['jquery'] && $cfg['ajax_enabled'], 'comments', 'plug', "e=comments&area={$ext_name}&cat={$cat}&item={$code}"); $t->assign(array('COMMENTS_PAGES_INFO' => cot_rc('comments_code_pages_info', array('totalitems' => $totalitems, 'onpage' => $i - $d)), 'COMMENTS_PAGES_TOTALITEMS' => $totalitems, 'COMMENTS_PAGES_PAGESPREV' => $pagenav['prev'], 'COMMENTS_PAGES_PAGNAV' => $pagenav['main'], 'COMMENTS_PAGES_PAGESNEXT' => $pagenav['next'])); $t->parse('COMMENTS.PAGNAVIGATOR'); } elseif (!$sql->rowCount() && $enabled) { $t->assign(array('COMMENTS_EMPTYTEXT' => $L['com_nocommentsyet'])); $t->parse('COMMENTS.COMMENTS_EMPTY'); } /* == Hook == */ foreach (cot_getextplugins('comments.tags') as $pl) { include $pl; } /* ===== */ $t->parse('COMMENTS'); $res_display = $t->text('COMMENTS'); return $res_display; }
$mskin = cot_tplfile(array('forums', 'editpost', $structure['forums'][$s]['tpl'])); $t = new XTemplate($mskin); cot_display_messages($t); if ($db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) { $t->assign(array('FORUMS_EDITPOST_TOPICTITTLE' => cot_inputbox('text', 'rtopictitle', $rowt['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_EDITPOST_TOPICDESCRIPTION' => cot_inputbox('text', 'rtopicdesc', $rowt['ft_desc'], array('size' => 56, 'maxlength' => 255)))); // Extra fields foreach ($cot_extrafields[$db_forum_topics] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rowt['ft_' . $exfld['field_name']]); $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_EDITPOST_TOPIC_' . $uname => $exfld_val, 'FORUMS_EDITPOST_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST.TOPIC_EXTRAFLD'); } $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST'); } $t->assign(array('FORUMS_EDITPOST_PAGETITLE' => $toptitle, 'FORUMS_EDITPOST_SUBTITLE' => $L['forums_postedby'] . ": <a href=\"users.php?m=details&id=" . $rowpost['fp_posterid'] . "\">" . $rowpost['fp_postername'] . "</a> @ " . cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED' => cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED_STAMP' => $rowpost['fp_updated'], 'FORUMS_EDITPOST_SEND' => cot_url('forums', "m=editpost&a=update&s=" . $s . "&q=" . $q . "&p=" . $p . '&d=' . $durl . "&" . cot_xg()), 'FORUMS_EDITPOST_TEXT' => cot_textarea('rmsgtext', $rowpost['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_EDITPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600))); // Extra fields foreach ($cot_extrafields[$db_forum_posts] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rowpost['fp_' . $exfld['field_name']]); $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_EDITPOST_' . $uname => $exfld_val, 'FORUMS_EDITPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('forums.editpost.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $t->out('MAIN');
/** * Generates ratings display for a given item * * @param string $ext_name Module or plugin code * @param string $code Item identifier * @param string $cat Item category code (optional) * @param bool $readonly Display as read-only * @return array Rendered HTML output for ratings and average integer value as an array with 2 elements * @global CotDB $db */ function cot_ratings_display($ext_name, $code, $cat = '', $readonly = false) { global $db, $db_ratings, $db_rated, $db_users, $cfg, $usr, $sys, $L, $R; // Check permissions list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'ratings'); $enabled = cot_ratings_enabled($ext_name, $cat, $code); if (!$auth_read || !$enabled && !$auth_admin) { return array('', 0); } // Get current rating value $sql = $db->query("SELECT r.*, (SELECT COUNT(*) FROM {$db_rated} WHERE rated_area = ? AND rated_code = ?) AS `cnt` FROM {$db_ratings} AS r\n\t\tWHERE rating_area = ? AND rating_code = ? LIMIT 1", array($ext_name, $code, $ext_name, $code)); if ($row = $sql->fetch()) { $rating_average = $row['rating_average']; $item_has_rating = true; if ($rating_average < 1) { $rating_average = 1; } elseif ($rating_average > 10) { $rating_average = 10; } $rating_cntround = round($rating_average, 0); $rating_raters_count = $row['cnt']; } else { $item_has_rating = false; $rating_average = 0; $rating_cntround = 0; $rating_raters_count = 0; } // Render read-only image $rating_fancy = cot_rc('icon_rating_stars', array('val' => $rating_cntround)); if (!$auth_write || $readonly) { return array($rating_fancy, $rating_cntround, $rating_raters_count); } // Check if the user has voted already for this item $already_voted = false; if ($usr['id'] > 0) { $sql1 = $db->query("SELECT rated_value FROM {$db_rated}\n\t\t\tWHERE rated_area = ? AND rated_code = ? AND rated_userid = ?", array($ext_name, $code, $usr['id'])); if ($rated_value = $sql1->fetchColumn()) { $already_voted = true; $rating_uservote = $L['rat_alreadyvoted'] . ' (' . $rated_value . ')'; } } if ($already_voted && !$cfg['plugin']['ratings']['ratings_allowchange']) { return array($rating_fancy, $rating_cntround, $rating_raters_count); } $t = new XTemplate(cot_tplfile('ratings', 'plug')); /* == Hook for the plugins == */ foreach (cot_getextplugins('ratings.main') as $pl) { include $pl; } /* ===== */ // Get some extra information about votes if ($item_has_rating) { $sql = $db->query("SELECT COUNT(*) FROM {$db_rated}\n\t\t\tWHERE rated_area = ? AND rated_code = ?", array($ext_name, $code)); $rating_voters = $sql->fetchColumn(); $rating_since = $L['rat_since'] . ' ' . cot_date('datetime_medium', $row['rating_creationdate']); $rating_since_stamp = $row['rating_creationdate']; $rating_averageimg = cot_rc('icon_rating_stars', array('val' => $rating_cntround)); } else { $rating_voters = 0; $rating_since = ''; $rating_since_stamp = ''; $rating_averageimg = ''; } // Assign tags $t->assign(array('RATINGS_CODE' => $code, 'RATINGS_AVERAGE' => round($rating_average), 'RATINGS_AVERAGEIMG' => $rating_averageimg, 'RATINGS_VOTERS' => $rating_voters, 'RATINGS_SINCE' => $rating_since, 'RATINGS_SINCE_STAMP' => $rating_since_stamp, 'RATINGS_FANCYIMG' => $rating_fancy, 'RATINGS_USERVOTE' => $rating_uservote)); /* == Hook for the plugins == */ foreach (cot_getextplugins('ratings.tags') as $pl) { include $pl; } /* ===== */ // Render voting form $vote_block = $auth_write && (!$already_voted || $cfg['plugin']['ratings']['ratings_allowchange']) ? 'NOTVOTED.' : 'VOTED.'; for ($i = 1; $i <= 10; $i++) { $checked = $i <= $rating_cntround ? 'checked="checked"' : ''; $t->assign(array('RATINGS_ROW_VALUE' => $i, 'RATINGS_ROW_TITLE' => $L['rat_choice' . $i], 'RATINGS_ROW_CHECKED' => $checked)); $t->parse('RATINGS.' . $vote_block . 'RATINGS_ROW'); } if ($vote_block == 'NOTVOTED.') { // 'r=ratings&area=' . $ext_name . '&code=' . $code.'&inr=send' $t->assign('RATINGS_FORM_SEND', cot_url('plug', array('r' => 'ratings', 'inr' => 'send', 'area' => $ext_name, 'code' => $code, 'cat' => $cat))); $t->parse('RATINGS.NOTVOTED'); } else { $t->parse('RATINGS.VOTED'); } // Parse and return $t->parse('RATINGS'); $res = $t->text('RATINGS'); return array($res, round($rating_cntround), $rating_raters_count); }
/* === 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'); } if ($jj == 0) { $t->parse('MAIN.PM_ROW_EMPTY'); } if (!COT_AJAX) { $t->parse('MAIN.BEFORE_AJAX'); $t->parse('MAIN.AFTER_AJAX'); }
$payinfo['pay_code'] = $pid; $payinfo['pay_summ'] = $recipientsumm; $payinfo['pay_cdate'] = $sys['now']; $payinfo['pay_pdate'] = $sys['now']; $payinfo['pay_adate'] = $sys['now']; $payinfo['pay_status'] = 'done'; $payinfo['pay_desc'] = sprintf($L['payments_balance_transfer_desc'], $usr['name'], $recipient['user_name'], $comment); $db->insert($db_payments, $payinfo); $pid = $db->lastInsertId(); // Отправка уведомления админу о переводе между пользователями $subject = $L['payments_balance_transfer_admin_subject']; $body = sprintf($L['payments_balance_transfer_admin_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment); cot_mail($cfg['adminemail'], $subject, $body); // Отправка уведомления админу о переводе между пользователями $subject = $L['payments_balance_transfer_recipient_subject']; $body = sprintf($L['payments_balance_transfer_recipient_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment); cot_mail($recipient['user_email'], $subject, $body); cot_redirect(cot_url('payments', 'm=balance&n=history', '', true)); } cot_redirect(cot_url('payments', 'm=balance&n=transfer', '', true)); } cot_display_messages($t, 'MAIN.TRANSFERFORM'); $t->assign(array('TRANSFER_FORM_ACTION_URL' => cot_url('payments', 'm=balance&n=transfer&a=add'), 'TRANSFER_FORM_SUMM' => cot_inputbox('text', 'summ', $summ), 'TRANSFER_FORM_TAX' => $taxsumm, 'TRANSFER_FORM_TOTAL' => !empty($sendersumm) ? $sendersumm : 0, 'TRANSFER_FORM_COMMENT' => $comment, 'TRANSFER_FORM_USERNAME' => $username)); $t->parse('MAIN.TRANSFERFORM'); } if ($n == 'history') { $pays = $db->query("SELECT * FROM {$db_payments} \n\t\tWHERE pay_userid=" . $usr['id'] . " AND pay_status='done' AND pay_summ>0\n\t\tORDER BY pay_pdate DESC")->fetchAll(); foreach ($pays as $pay) { $t->assign(cot_generate_paytags($pay, 'HIST_ROW_')); $t->parse('MAIN.HISTORY.HIST_ROW'); }
cot_log("Wrong validation URL", 'sec'); cot_redirect(cot_url('message', 'msg=157', '', true)); } } $mskin = cot_tplfile('users.register', 'module'); /* === Hook === */ foreach (cot_getextplugins('users.register.main') as $pl) { include $pl; } /* ===== */ $out['subtitle'] = $L['aut_registertitle']; $out['head'] .= $R['code_noindex']; require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate($mskin); require_once cot_incfile('forms'); $t->assign(array('USERS_REGISTER_TITLE' => $L['aut_registertitle'], 'USERS_REGISTER_SUBTITLE' => $L['aut_registersubtitle'], 'USERS_REGISTER_ADMINEMAIL' => $cot_adminemail, 'USERS_REGISTER_SEND' => cot_url('users', 'm=register&a=add'), 'USERS_REGISTER_USER' => cot_inputbox('text', 'rusername', $ruser['user_name'], array('size' => 24, 'maxlength' => 100)), 'USERS_REGISTER_EMAIL' => cot_inputbox('text', 'ruseremail', $ruser['user_email'], array('size' => 24, 'maxlength' => 64)), 'USERS_REGISTER_PASSWORD' => cot_inputbox('password', 'rpassword1', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_PASSWORDREPEAT' => cot_inputbox('password', 'rpassword2', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_COUNTRY' => cot_selectbox_countries($ruser['user_country'], 'rcountry'), 'USERS_REGISTER_TIMEZONE' => cot_selectbox_timezone($ruser['user_timezone'], 'rusertimezone'), 'USERS_REGISTER_GENDER' => cot_selectbox_gender($ruser['user_gender'], 'rusergender'), 'USERS_REGISTER_BIRTHDATE' => cot_selectbox_date(0, 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false))); // Extra fields if (!empty(cot::$extrafields[cot::$db->users])) { foreach (cot::$extrafields[cot::$db->users] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $ruser['user_' . $exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'user_'); $t->assign(array('USERS_REGISTER_' . $uname => $exfld_val, 'USERS_REGISTER_' . $uname . '_TITLE' => $exfld_title, 'USERS_REGISTER_EXTRAFLD' => $exfld_val, 'USERS_REGISTER_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } } /* === Hook === */ foreach (cot_getextplugins('users.register.tags') as $pl) { include $pl; } /* ===== */
} if (!cot_error_found()) { $t->parse('MAIN.RESULTS'); } $rs_url_path = array(); foreach ($rs as $k => $v) { if (is_array($v)) { foreach ($v as $sk => $sv) { $rs_url_path['rs[' . $k . '][' . $sk . ']'] = $sv; } } else { $rs_url_path['rs[' . $k . ']'] = $v; } } $pagenav = cot_pagenav('plug', array('e' => 'search', 'sq' => $sq, 'tab' => $tab) + $rs_url_path, $d, array_sum($totalitems), $cfg_maxitems); } // Search title $crumbs = array(array(cot_url('plug', 'e=search'), $L['plu_search'])); if (!empty($tab)) { $crumbs[] = array(cot_url('plug', 'e=search&tab=' . $tab), $L['plu_tabs_' . $tab]); } $out['head'] .= $R['code_noindex']; $search_subtitle = empty($tab) ? $L['plu_search'] : $L['plu_tabs_' . $tab] . ' - ' . $L['plu_search']; $out['subtitle'] = empty($sq) ? $search_subtitle : htmlspecialchars(strip_tags($sq)) . ' - ' . $L['plu_result']; $t->assign(array('PLUGIN_TITLE' => cot_breadcrumbs($crumbs, $cfg['breadcrumb'], true), 'PLUGIN_SEARCH_ACTION' => cot_url('plug', 'e=search&tab=' . $tab), 'PLUGIN_SEARCH_TEXT' => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'size="32" maxlength="' . $cfg['plugin']['search']['maxsigns'] . '"'), 'PLUGIN_SEARCH_USER' => cot_inputbox('text', 'rs[setuser]', htmlspecialchars($rs['setuser']), 'class="userinput" size="32"'), 'PLUGIN_SEARCH_DATE_SELECT' => cot_selectbox($rs['setlimit'], 'rs[setlimit]', range(0, 5), array($L['plu_any_date'], $L['plu_last_2_weeks'], $L['plu_last_1_month'], $L['plu_last_3_month'], $L['plu_last_1_year'], $L['plu_need_datas']), false), 'PLUGIN_SEARCH_DATE_FROM' => cot_selectbox_date($rs['setfrom'], 'short', 'rfrom', cot_date('Y', $sys['now']) + 1), 'PLUGIN_SEARCH_DATE_TO' => cot_selectbox_date($rs['setto'], 'short', 'rto', cot_date('Y', $sys['now']) + 1), 'PLUGIN_SEARCH_FOUND' => array_sum($totalitems) > 0 ? array_sum($totalitems) : '', 'PLUGIN_PAGEPREV' => $pagenav['prev'], 'PLUGIN_PAGENEXT' => $pagenav['next'], 'PLUGIN_PAGENAV' => $pagenav['main'])); cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('search.tags') as $pl) { include $pl; } /* ===== */
/** * Generates Poll form * * @param int $id Poll ID or Poll Code if $type is not epmty * @param string $formlink Poll form url * @param string $theme Poll template name * @param string $type Poll type * @return array * @global CotDB $db */ function cot_poll_form($id, $formlink = '', $theme = '', $type = '') { global $db, $cfg, $db_polls, $db_polls_options, $db_polls_voters, $usr; $canvote = false; if (!is_array($id)) { $id = (int) $id; $where = !$type ? "poll_id = {$id}" : "poll_type = '" . $db->prep($type) . "' AND poll_code = '{$id}'"; $sql = $db->query("SELECT * FROM {$db_polls} WHERE {$where} LIMIT 1"); if (!($row = $sql->fetch())) { return false; } } else { $row = $id; } $id = $row['poll_id']; $alreadyvoted = 0; if ($cfg['polls']['ip_id_polls'] == 'id' && $usr['id'] > 0) { $where = "pv_userid = '" . $usr['id'] . "'"; $canvote = true; } else { $where = $usr['id'] > 0 ? "(pv_userid = '" . $usr['id'] . "' OR pv_userip = '" . $usr['ip'] . "')" : "pv_userip = '" . $usr['ip'] . "'"; $canvote = true; } $sql2 = $db->query("SELECT pv_id FROM {$db_polls_voters} WHERE pv_pollid = {$id} AND {$where} LIMIT 1"); $alreadyvoted = $sql2->rowCount() == 1 ? 1 : 0; $themefile = cot_tplfile(array('polls', $theme), 'module'); $t = new XTemplate($themefile); if ($alreadyvoted) { $poll_block = 'POLL_VIEW_VOTED'; } elseif (!$canvote) { $poll_block = 'POLL_VIEW_DISABLED'; } elseif ($row['poll_state']) { $poll_block = 'POLL_VIEW_LOCKED'; } else { $poll_block = 'POLL_VIEW'; } $sql2 = $db->query("SELECT SUM(po_count) FROM {$db_polls_options} WHERE po_pollid = {$id}"); $totalvotes = $sql2->fetchColumn(); $sql1 = $db->query("SELECT po_id, po_text, po_count FROM {$db_polls_options} WHERE po_pollid = {$id} ORDER by po_id ASC"); while ($row1 = $sql1->fetch()) { $po_id = $row1['po_id']; $po_count = $row1['po_count']; $percent = @round(100 * ($po_count / $totalvotes), 1); $input_type = $row['poll_multiple'] ? 'checkbox' : 'radio'; $polloptions_input = $alreadyvoted || !$canvote ? "" : '<input type="' . $input_type . '" name="vote[]" value="' . $po_id . '" /> '; // TODO - to resorses $polloptions = cot_parse($row1['po_text'], $cfg['polls']['markup']); $t->assign(array('POLL_OPTIONS' => $polloptions, 'POLL_PER' => $percent, 'POLL_COUNT' => $po_count, 'POLL_INPUT' => $polloptions_input)); $t->parse($poll_block . ".POLLTABLE"); } $sql1->closeCursor(); $t->assign(array('POLL_VOTERS' => $totalvotes, 'POLL_SINCE' => cot_date('datetime_medium', $row['poll_creationdate']), 'POLL_SINCE_STAMP' => $row['poll_creationdate'], 'POLL_SINCE_SHORT' => cot_date('date_short', $row['poll_creationdate']), 'POLL_TITLE' => cot_parse($row['poll_text'], $cfg['polls']['markup']), 'POLL_ID' => $id, 'POLL_FORM_URL' => empty($formlink) ? cot_url('polls', 'id=' . $id) : $formlink, 'POLL_FORM_BUTTON' => $pollbutton)); $t->parse($poll_block); $row['poll_alreadyvoted'] = $alreadyvoted; $row['poll_count'] = $totalvotes; $row['poll_block'] = $t->text($poll_block); return $row; }
if (empty($usr['icons'])) { $usr['icons'] = $cfg['defaulticons']; } if (file_exists($cfg['icons_dir'] . '/' . $usr['icons'] . '/resources.php')) { require_once $cfg['icons_dir'] . '/' . $usr['icons'] . '/resources.php'; } else { require_once './images/icons/' . $cfg['defaulticons'] . '/resources.php'; } $out['copyright'] = "<a href=\"http://www.cotonti.com\">" . $L['foo_poweredby'] . " Cotonti</a>"; /* ======== Various ======== */ $cot_yesno[0] = $L['No']; $cot_yesno[1] = $L['Yes']; /* ======== Local/GMT time ======== */ $usr['timetext'] = cot_build_timezone($usr['timezone']); $usr['gmttime'] = cot_date('datetime_medium', $sys['now'], false) . ' GMT'; $usr['localtime'] = cot_date('datetime_medium', $sys['now']); /* ======== Anti-XSS protection ======== */ $x = cot_import('x', 'P', 'ALP'); if (empty($x) && $_SERVER['REQUEST_METHOD'] == 'POST') { $x = cot_import('x', 'G', 'ALP'); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && !defined('COT_NO_ANTIXSS') && (!defined('COT_AUTH') && $x != $sys['xk'] && (empty($sys['xk_prev']) || $x != $sys['xk_prev']) || $cfg['referercheck'] && !preg_match('`https?://([^/]+\\.)?' . preg_quote($sys['domain']) . '(/|:|$)`i', $_SERVER['HTTP_REFERER']))) { $cot_error = true; cot_die_message(950, TRUE, '', '', $_SERVER['HTTP_REFERER']); } /* ============ Head Resources ===========*/ if (!COT_AJAX) { // May Be move it to header.php? if (!isset($cot_rc_html[$theme]) || !$cache || !$cfg['headrc_consolidate'] || defined('COT_ADMIN')) { // Load standard resources cot_rc_add_standard();
$icon = $R['admin_icon_page']; $typestr = $L['Page']; $enabled = cot_module_active('page') ? 1 : 0; break; case 'user': $icon = $R['admin_icon_user']; $typestr = $L['User']; $enabled = 1; break; default: $icon = $R['admin_icon_tools']; $typestr = $row['tr_type']; $enabled = 1; break; } $tr_t->assign(array('ADMIN_TRASHCAN_DATE' => cot_date('datetime_medium', $row['tr_date']), 'ADMIN_TRASHCAN_DATE_STAMP' => $row['tr_date'], 'ADMIN_TRASHCAN_TYPESTR_ICON' => $icon, 'ADMIN_TRASHCAN_TYPESTR' => $typestr, 'ADMIN_TRASHCAN_TITLE' => htmlspecialchars($row['tr_title']), 'ADMIN_TRASHCAN_TRASHEDBY' => $row['tr_trashedby'] == 0 ? $L['System'] : cot_build_user($row['tr_trashedby'], htmlspecialchars($row['user_name'])), 'ADMIN_TRASHCAN_ROW_WIPE_URL' => cot_url('admin', 'm=other&p=trashcan&a=wipe&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_RESTORE_URL' => cot_url('admin', 'm=other&p=trashcan&a=restore&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_INFO_URL' => cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $row['tr_id']), 'ADMIN_TRASHCAN_ROW_RESTORE_ENABLED' => $enabled)); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ if ($info) { $adminpath[] = array(cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $id), $row['tr_title']); $data = unserialize($row['tr_datas']); foreach ($data as $key => $val) { $tr_t->assign(array('ADMIN_TRASHCAN_INFO_ROW' => htmlspecialchars($key), 'ADMIN_TRASHCAN_INFO_VALUE' => $val)); $tr_t->parse('MAIN.TRASHCAN_ROW.TRASHCAN_INFOROW'); } } $tr_t->parse('MAIN.TRASHCAN_ROW'); }
/** * Strips all unsafe characters from file base name and converts it to latin * * @param string $name File base name * @param string $ext File extension * @param string $savedirectory File path * @param string $unique_name File path * @return string */ function safename($name, $ext, $savedirectory = '', $unique_name = true) { global $lang, $cot_translit, $sys; if (!$cot_translit && $lang != 'en' && file_exists(cot_langfile('translit', 'core'))) { require_once cot_langfile('translit', 'core'); } if ($lang != 'en' && is_array($cot_translit)) { $name = strtr($name, $cot_translit); } $name = str_replace(' ', '_', $name); $name = preg_replace('#[^a-zA-Z0-9\\-_\\.\\ \\+]#', '', $name); $name = str_replace('..', '.', $name); $name = mb_substr($name, 0, 200); if (empty($name)) { $name = cot_unique(); } if ($unique_name && file_exists($this->file_path($savedirectory, $name, $ext))) { $name .= "_" . cot_date('dmY_His', $sys['now']); } if ($unique_name && file_exists($this->file_path($savedirectory, $name, $ext))) { $name .= "_" . rand(1, 999); } return $name; }
/** * Administration panel - PHP Infos * * @package Cotonti * @copyright (c) Cotonti Team * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt */ defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.'); list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('admin', 'a'); cot_block($usr['auth_read']); $t = new XTemplate(cot_tplfile('admin.infos', 'core')); $adminpath[] = array(cot_url('admin', 'm=other'), $L['Other']); $adminpath[] = array(cot_url('admin', 'm=infos'), $L['adm_infos']); $adminhelp = $L['adm_help_versions']; $adminsubtitle = $L['adm_infos']; /* === Hook === */ foreach (cot_getextplugins('admin.infos.first') as $pl) { include $pl; } /* ===== */ @error_reporting(0); $t->assign(array('ADMIN_INFOS_PHPVER' => function_exists('phpversion') ? phpversion() : $L['adm_help_config'], 'ADMIN_INFOS_ZENDVER' => function_exists('zend_version') ? zend_version() : $L['adm_help_config'], 'ADMIN_INFOS_INTERFACE' => function_exists('php_sapi_name') ? php_sapi_name() : $L['adm_help_config'], 'ADMIN_INFOS_CACHEDRIVERS' => is_array($cot_cache_drivers) ? implode(', ', $cot_cache_drivers) : '', 'ADMIN_INFOS_OS' => function_exists('php_uname') ? php_uname() : $L['adm_help_config'], 'ADMIN_INFOS_DATE' => cot_date('datetime_medium', $sys['now'], false), 'ADMIN_INFOS_GMDATE' => gmdate('Y-m-d H:i'), 'ADMIN_INFOS_GMTTIME' => $usr['gmttime'], 'ADMIN_INFOS_USRTIME' => $usr['localtime'], 'ADMIN_INFOS_TIMETEXT' => $usr['timetext'])); /* === Hook === */ foreach (cot_getextplugins('admin.infos.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $adminmain = $t->text('MAIN'); @error_reporting(7);
$msg = ''; if ($a == 'request' && $email != '') { cot_shield_protect(); $sql = $db->query("SELECT user_id, user_name, user_lostpass FROM {$db_users} WHERE user_email='" . $db->prep($email) . "' ORDER BY user_id ASC"); $email_found = FALSE; while ($row = $sql->fetch()) { $rusername = $row['user_name']; $ruserid = $row['user_id']; $validationkey = $row['user_lostpass']; if (empty($validationkey) || $validationkey == "0") { $validationkey = md5(microtime()); $sql = $db->update($db_users, array('user_lostpass' => $validationkey, 'user_lastip' => $usr['ip']), "user_id={$ruserid}"); } $rsubject = $L['pasrec_title']; $ractivate = $cfg['mainurl'] . '/' . cot_url('users', 'm=passrecover&a=auth&v=' . $validationkey, '', true); $rbody = sprintf($L['pasrec_email1'], $rusername, $ractivate, $usr['ip'], cot_date('datetime_medium')); $rbody .= "\n\n " . $L['aut_contactadmin']; cot_mail($email, $rsubject, $rbody); $email_found = TRUE; if (!$cfg['useremailduplicate']) { break; } } if ($email_found) { cot_shield_update(60, "Password recovery email sent"); $msg = 'request'; } else { cot_shield_update(10, "Password recovery requested"); $env['status'] = '403 Forbidden'; cot_log("Pass recovery failed, user : " . $rusername); cot_redirect(cot_url('message', 'msg=154', '', true));