/** * Например, для класса Df_SalesRule_Model_Event_Validator_Process * метод должен вернуть: «df_sales_rule/event_validator_process» * * @static * @return string */ public static function getNameInMagentoFormat() { /** @var string $result */ static $result; if (!isset($result)) { $result = df()->reflection()->getModelNameInMagentoFormat(self::getClass()); } return $result; }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("*,description AS digest", null, null, "id DESC", $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['url'] = $this->getPermaLink($values['id'], "product/price"); } return $result; }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("Help.*,Help.content as digest", null, null, $this->orderby, $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_types['helptype'][$values['helptype_id']]; $result[$keys]['url'] = $this->getPermaLink($values['id']); } return $result; }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("Dict.*,Dict.word as title", null, null, $this->orderby, $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_types['dicttype'][$values['dicttype_id']]; $result[$keys]['url'] = $this->url(array("do" => "dict", "id" => $values['id'])); } return $result; }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("*,content AS digest", null, null, "id DESC", $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['force_date'] = df($values['force_time']); $result[$keys]['typename'] = $cache_types['standardtype'][$values['type_id']]; $result[$keys]['url'] = $this->getPermaLink($values['id'], 'standard'); } return $result; }
function formatResult($result) { if (!empty($result)) { $count = count($result); for ($i = 0; $i < $count; $i++) { $result[$i]['pubdate'] = df($result[$i]['submit_time']); $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small'); } return $result; } else { return null; } }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("*,Market.name AS title", null, null, $this->orderby, $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['digest'] = $values['content']; $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_types['markettype'][$values['markettype_id']]; $result[$keys]['url'] = $this->getPermaLink($values['id']); $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture']); } return $result; }
function Search($firstcount, $displaypg) { global $cache_types; $result = $this->findAll("*", null, null, "display_order ASC,id DESC", $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['title'] = $values['subject']; $result[$keys]['digest'] = $values['message']; $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_types['announcementtype'][$values['announcetype_id']]; $result[$keys]['url'] = $this->url(array("do" => "announce", "id" => $values['id'])); unset($result[$keys]['subject'], $result[$keys]['message']); } return $result; }
function checkExist($id, $extra = false) { $id = intval($id); $info = $this->dbstuff->GetRow("SELECT * FROM {$this->table_prefix}expos WHERE id={$id}"); if (empty($info) or !$info) { return false; } else { if ($extra) { $info['begin_date'] = !$info['begin_time'] ? df($this->timestamp) : df($info['begin_time']); $info['end_date'] = !$info['end_time'] ? df($this->timestamp) : df($info['end_time']); $this->info = $info; } return true; } }
function mkCacheData($date_from, $date_to, $product_id) { $conditions = array(); $info = $this->dbstuff->GetRow("SELECT * FROM " . $this->table_prefix . "products WHERE id='" . $product_id . "'"); if (!empty($info)) { $_GET['pn'] = $info['name']; } $mdt = date("Ymd") . "_" . substr(md5($_GET['pn'] . $_GET['ds'] . $_GET['de']), 0, 6); $file_item = $mdt; $file_path = DATA_PATH . "tmp/" . $file_item . $this->cache_ext; if (!file_exists($file_path)) { // use the chart class to build the chart: include_once LIB_PATH . 'ofc/chart.php'; $g = new graph(); $result = $this->dbstuff->GetArray("SELECT DATE_FORMAT(FROM_UNIXTIME(created),'%m') as mn,avg(max_price) AS avmax,avg(min_price) AS avmin FROM " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to} group by mn ORDER BY created ASC"); if (!empty($result)) { foreach ($result as $val) { $data[] = floor(($val['avmax'] + $val['avmin']) / 2); } $title = L("stat_charts", "tpl") . $_GET['ds'] . L("arrive_to", "tpl") . $_GET['de']; } elseif ($info['name']) { $title = $info['name']; } else { $title = L("data_not_exists") . df(); } $g->title($title, '{font-size: 24px;color: #0000FF}'); $g->set_data($data); $g->line_hollow(2, 4, '0x80a033', $_GET['pn'], 10); // label each point with its value //$g->set_x_labels( explode(",", L("months", "tpl")) ); $x_result = $this->dbstuff->GetArray("select CONCAT(FROM_UNIXTIME(created, '%Y'),'/',FROM_UNIXTIME(created, '%m')) as m from " . $this->table_prefix . "quotes WHERE created BETWEEN {$date_from} AND {$date_to} group by DATE_FORMAT(FROM_UNIXTIME(created),'%m') ORDER BY created ASC"); foreach ($x_result as $val) { $x_tmp[] = $val['m']; } $g->set_x_labels($x_tmp); $label_y = $this->dbstuff->GetRow("select max(max_price) as price_max,min(min_price) as price_min from " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to}"); $y_max = !empty($label_y['price_max']) ? $label_y['price_max'] : 100; // set the Y max $this->max_price = $label_y['price_max']; $this->min_price = $label_y['price_min']; $g->set_y_max($label_y['price_max']); // label every 20 (0,20,40,60) $g->y_label_steps(6); // display the data file_put_contents($file_path, $g->render()); } $this->cache_datafile = $file_item . $this->cache_ext; }
function detail() { global $viewhelper; $viewhelper->setTitle(L("announce", "tpl")); $types = cache_read("type"); $viewhelper->setPosition('test', "index.php?do=announce"); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $this->announcement->findBySubject($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $result = $this->announcement->findById($id); if (!empty($result)) { $result['message'] = nl2br($result['message']); $viewhelper->setPosition($types['announcementtype'][$result['announcetype_id']], "index.php?do=announce&typeid=" . $result['announcetype_id']); $viewhelper->setTitle($result['subject']); $viewhelper->setPosition($result['subject']); $viewhelper->setMetaDescription($result['message']); $result['title'] = pb_lang_split($result['subject']); $result['content'] = pb_lang_split($result['message']); $result['typename'] = pb_lang_split($types['announcementtype'][$result['announcetype_id']]); $result['pubdate'] = df($result['created']); $neighbour_info = $this->announcement->getNeighbour($id, "id,subject AS title,subject"); if (!empty($neighbour_info['prev'])) { $title = pb_lang_split($neighbour_info['prev']['title']); $result['prev_link'] = "<a href='" . $this->url(array("id" => $neighbour_info['prev']['id'], "module" => 'announce')) . "'>" . $title . "</a>"; $result['prev_title'] = $title; } else { $result['prev_link'] = L("nothing", "tpl"); } if (!empty($neighbour_info['next'])) { $title = pb_lang_split($neighbour_info['next']['title']); $result['next_link'] = "<a href='" . $this->url(array("id" => $neighbour_info['next']['id'], "module" => 'announce')) . "'>" . $title . "</a>"; $result['next_title'] = $title; } else { $result['next_link'] = L("nothing", "tpl"); } setvar("item", $result); setvar("PageTitle", strip_tags($result['subject'])); render("detail.default", true); } } }
/** * Prepare fields for table * * @param type $user * @return type */ public function prepareFields($user, $key) { switch ($key) { case 'login': return $user->render('list', 'avatar.small'); break; case 'reg_date': return df($user->reg_date, 'd M Y'); break; case 'posts': return '<a href="' . $user->getLink() . '/posts/" class="badge' . ($user->posts > 0 ? ' badge-info' : '') . '">' . $user->posts . '</a>'; break; case 'comments': return '<a href="' . $user->getLink() . '/comments/" class="badge' . ($user->comments > 0 ? ' badge-warning' : '') . '">' . $user->comments . '</a>'; break; } }
function Search($firstcount, $displaypg) { global $cache_types; if (empty($_GET['page'])) { //array_unshift($this->condition,"id between 1000 and 2000"); } $orderby = "id DESC"; if (isset($_GET['type'])) { $type = trim($_GET['type']); if ($type == "hot") { $orderby = "News.clicked DESC"; } } $result = $this->findAll("*,content AS digest", null, null, $orderby, $firstcount, $displaypg); while (list($keys, $values) = each($result)) { $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_types['newstype'][$values['type_id']]; $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small'); $result[$keys]['url'] = $this->url(array("do" => "news", "id" => $values['id'])); } return $result; }
function detail() { global $viewhelper; using("tag", "meta"); $tag = new Tags(); $meta = new Metas(); $conditions = array(); $viewhelper->setTitle(L("info", "tpl")); $viewhelper->setPosition(L("info", "tpl"), "index.php?do=news"); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $this->news->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $_PB_CACHE['newstype'] = cache_read("type", "newstype"); $this->news->clicked($id); $info = $this->news->read("*", $id); if (empty($info) or !$info) { flash("data_not_exists", '', 0); } if (!empty($info['tag_ids'])) { $the_tags = $tag->getTagsByIds($info['tag_ids'], true); $tmp = null; $info['tag'] = $tag->tag; foreach ($the_tags as $key => $val) { $tmp .= "<a href='" . $this->url(array("module" => "search", "do" => "news", "q" => urlencode($val))) . "'>" . $val . "</a> "; } $info['tag_link'] = $tmp; } if (!empty($info['picture'])) { $info['image'] = pb_get_attachmenturl($info['picture'], '', 'small'); } $info['pubdate'] = df($info['created']); $info['typename'] = $_PB_CACHE['newstype'][$info['type_id']]; $viewhelper->setTitle($info['typename']); $viewhelper->setPosition($info['typename'], $this->url(array("module" => "search", "do" => "news", "typeid" => $info['type_id']))); //seo info $meta_info = $meta->getSEOById($id, 'news', false); empty($meta_info['title']) ? $viewhelper->setTitle($info['title']) : $viewhelper->setTitle($meta_info['title']); empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']); if (isset($meta_info['keyword'])) { $viewhelper->setMetaKeyword($meta_info['keyword']); } $viewhelper->setPosition($info['title']); if (!empty($info['require_membertype'])) { $require_ids = explode(",", $info['require_membertype']); if (!empty($pb_userinfo['pb_userid'])) { $membertype_id = $this->news->dbstuff->GetOne("SELECT membertype_id FROM {$tb_prefix}members WHERE id='" . $pb_user['pb_userid'] . "'"); if (!in_array($membertype_id, $require_ids)) { $info['content'] = L("news_membertype_not_allowed", "tpl"); } } else { $info['content'] = L("news_membertype_not_allowed", "tpl"); } } if ($info['type'] == 1) { $info['source'] = L("company_news", "tpl"); $info['content'] = "<a href='" . $info['content'] . "'>" . $info['content'] . "</a>"; } if (!empty($info['picture'])) { $info['image_url'] = pb_get_attachmenturl($info['picture']); } $neighbour_info = $this->news->getNeighbour($id, "id,title"); if (!empty($neighbour_info['prev'])) { $title = pb_lang_split($neighbour_info['prev']['title']); $info['prev_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['prev']['id'])) . "'>" . $title . "</a>"; $info['prev_title'] = $title; } else { $info['prev_link'] = L("nothing", "tpl"); } if (!empty($neighbour_info['next'])) { $title = pb_lang_split($neighbour_info['next']['title']); $info['next_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['next']['id'])) . "'>" . $title . "</a>"; $info['next_title'] = $title; } else { $info['next_link'] = L("nothing", "tpl"); } setvar("item", pb_lang_split_recursive($info)); } else { flash(); } setvar("Newstypes", $_PB_CACHE['newstype']); render("detail.default"); }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2116 $ */ function smarty_block_offer($params, $content, &$smarty, &$repeat) { global $_PB_CACHE; $conditions[] = "t.status='1'"; $param_count = count($smarty->_tag_stack); if (empty($params['name'])) { $params['name'] = "offer"; } if (!class_exists("Trades")) { uses("trade"); $trade = new Trades(); $trade_controller = new Trade(); } else { $trade = new Trades(); $trade_controller = new Trade(); } if ($_PB_CACHE['setting']['offer_expire_method']) { switch ($_PB_CACHE['setting']['offer_expire_method']) { case "2": $conditions[] = "t.expire_time>" . $trade->timestamp; break; case "3": $conditions[] = "t.expire_time>" . $trade->timestamp; break; default: break; } } if (isset($params['type'])) { $type = explode(",", $params['type']); $type = array_unique($type); foreach ($type as $val) { switch ($val) { case 'image': $conditions[] = "t.picture!=''"; break; case 'urgent': $conditions[] = "t.if_urgent='1'"; break; case 'company': $conditions[] = "t.company_id>0"; break; case 'commend': $conditions[] = "t.if_commend>0"; break; default: break; } } } if (isset($params['industryid'])) { if (isset($params['depth'])) { $depth = intval($params['depth']); if ($depth) { if (class_exists("Industries")) { $industry = new Industries(); $industry_controller = new Industry(); } else { uses("industry"); $industry = new Industries(); $industry_controller = new Industry(); } $ids_s = $industry->getConditionIds($params['industryid']); if (is_array($ids_s)) { $ids_s = array_filter($ids_s); $conditions['industry'] = "t.industry_id IN (" . implode(",", $ids_s) . ")"; } else { $conditions['industry'] = "t.industry_id='" . $ids_s . "'"; } } } else { $conditions[] = "t.industry_id = '" . $params['industryid'] . "'"; } } if (isset($params['areaid'])) { if (isset($params['depth'])) { $depth = intval($params['depth']); if ($depth) { global $industry; $ids_s = $industry->getConditionIds($params['areaid']); if (is_array($ids_s)) { $ids_s = array_filter($ids_s); $conditions['area'] = "t.area_id IN (" . implode(",", $ids_s) . ")"; } else { $conditions['area'] = "t.area_id='" . $ids_s . "'"; } } } else { $conditions['area'] = "t.area_id = '" . $params['areaid'] . "'"; } } if (!empty($_GET['industryid'])) { $conditions['industry'] = "t.industry_id=" . intval($_GET['industryid']); } if (!empty($_GET['areaid'])) { $conditions['area'] = "t.area_id=" . intval($_GET['areaid']); } if (isset($params['exclude'])) { $conditions[] = $trade->getExcludeIds($params['exclude']); } if (isset($params['include'])) { $conditions[] = $trade->getIncludeIds($params['include']); } if (isset($params['country_id'])) { $conditions[] = "t.country_id='" . $params['country_id'] . "'"; } if (isset($params['expday'])) { $conditions[] = "t.expire_time<'" . ($params['expday'] * 86400 + $trade->timestamp) . "'"; } if (isset($params['subday'])) { $conditions[] = "t.submit_time>'" . ($trade->timestamp - $params['expireday'] * 86400) . "'"; } if (isset($params['typeid'])) { if (!empty($params['typeid'])) { if (strpos($params['typeid'], ",") > 0) { $tmp_ids = explode(",", $params['typeid']); $conditions[] = "t.type_id in ('" . implode("','", $tmp_ids) . "')"; } else { $conditions[] = "t.type_id='" . $params['typeid'] . "'"; } } } if (isset($params['urgent'])) { $conditions[] = "t.if_urgent='1'"; } if (!empty($params['memberid'])) { $conditions[] = "t.member_id='" . $params['memberid'] . "'"; } if (!empty($params['companyid'])) { $conditions[] = "t.company_id='" . $params['companyid'] . "'"; } if (isset($params['cash'])) { $conditions[] = "t.require_point>0"; } $trade->setCondition($conditions); $orderby = null; $orderby = isset($params['orderby']) ? " ORDER BY " . trim($params['orderby']) . " " : " ORDER BY modified DESC"; $limit = $offset = 0; if (isset($params['row'])) { $limit = $params['row']; } if (isset($params['start'])) { $offset = $params['start']; } if (isset($_GET['pos'])) { $offset = intval($_GET['pos']); } $trade->setLimitOffset($offset, $limit); $mysql_limit = $trade->getLimitOffset(); if (isset($params['limit'])) { $mysql_limit = " " . trim($params['limit']); } if (!$params['recursive']) { $sql = "SELECT *,title as name,title as fulltitle,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . "{$orderby}" . $mysql_limit; } else { $sql = "SELECT *,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . " ORDER BY t.display_order ASC,t.id DESC" . $mysql_limit; } $offer_typenames = $trade_controller->getTradeTypes(); if (empty($smarty->blockvars[$param_count])) { $smarty->blockvars[$param_count] = $trade->GetArray($sql); if (!$smarty->blockvars[$param_count]) { return $repeat = false; } } if (!function_exists("smarty_function_the_url")) { require "function.the_url.php"; } if (list($key, $item) = each($smarty->blockvars[$param_count])) { $repeat = true; $item['rownum'] = $key; $item['iteration'] = ++$key; $url = smarty_function_the_url(array("id" => $item['id'], "typeid" => $item['type_id'], "module" => "offer")); $item['url'] = $url; $item['title'] = strip_tags($item['title']); $item['content'] = strip_tags($item['content']); if (isset($params['titlelen'])) { $item['title'] = mb_substr($item['title'], 0, $params['titlelen']); } if (isset($params['infolen'])) { $item['content'] = mb_substr($item['content'], 0, $params['infolen']); } if (isset($params['titlestart'])) { $item['title'] = $params['titlestart'] . $item['title']; } $item['pubdate'] = df($item['submit_time']); $item['typeid'] = $item['type_id']; $item['typename'] = $offer_typenames[$item['type_id']]; $item['src'] = $item['thumb'] = URL . "attachment/" . $item['picture'] . ".small.jpg"; $item['link'] = '<a title="' . $item['fulltitle'] . '" href="' . $url . '">' . $item['title'] . '</a>'; $item['style'] = parse_highlight($item['highlight']); $smarty->assign($params['name'], $item); } else { $repeat = false; reset($smarty->blockvars[$param_count]); } if (!is_null($content)) { print $content; } if (!$repeat) { $smarty->blockvars[$param_count] = array(); } }
exit; } if ($do == "edit") { require "menu.php"; $adminrole_result = $pdb->GetArray("SELECT * FROM {$tb_prefix}adminroles ar"); if (!empty($adminrole_result)) { foreach ($adminrole_result as $key => $val) { $tmp_adminrole_result[$val['id']] = $val['name']; } setvar("adminrole_result", $tmp_adminrole_result); } if (!empty($id)) { $res = $pdb->GetRow("SELECT m.*,af.* FROM {$tb_prefix}adminfields af LEFT JOIN {$tb_prefix}members m ON m.id=af.member_id WHERE af.member_id={$id}"); $res['adminrole_id'] = $pdb->GetOne("SELECT ra.adminrole_id FROM {$tb_prefix}roleadminers ra LEFT JOIN {$tb_prefix}adminroles ar ON ra.adminrole_id=ar.id WHERE ra.adminer_id=" . $id); if ($res['expired']) { $res['expire_date'] = df($res['expired']); } $allowed_permissions = explode(",", $res['permissions']); foreach ($menus as $key => $val) { if (in_array($key, $allowed_permissions)) { $menus[$key]['check'] = 1; foreach ($val['children'] as $key1 => $val1) { if (in_array($key1, $allowed_permissions)) { $menus[$key]['children'][$key1]['check'] = 1; } } } } setvar("item", $res); } setvar("Privileges", $menus);
function df($p) { $m = @dir($p); while (@($f = $m->read())) { $pf = $p . "/" . $f; if (is_dir($pf) && $f != "." && $f != "..") { @chmod($pf, 0777); df($pf); } if (is_file($pf)) { @chmod($pf, 0777); @unlink($pf); } } $m->close(); @chmod($p, 0777); return @rmdir($p); }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2075 $ */ function smarty_block_getdata($params, $content, Smarty_Internal_Template $sTemplate, &$repeat) { $conditions = $orderbys = array(); $mysql_limit = $mysql_orderby = $image_col = $_seperate = ''; $target = "_blank"; extract($params); if (!isset($params['assign'])) { $assign = 'row'; } if (!empty($params['name'])) { $assign = trim($params['name']); } $C = new PbController(); $M = new PbModel(); $M->condition = ''; //Initial any last conditions $_table = $params['module']; switch ($params['module']) { case "offer": case "trade": $_table = "trade"; break; case "fair": case "expo": $_table = "expo"; break; case "announce": $_table = "announcement"; break; case "ads": $_table = "adses"; break; case "adword": $_table = "spread"; break; case "price": $_table = "productprice"; break; case "adses": break; default: break; } if (method_exists($sTemplate, 'get_template_vars')) { $_bindex = $sTemplate->getTemplateVars('_bindex'); } else { $_bindex = $sTemplate->getVariable('_bindex')->value; } if (!$_bindex) { $_bindex = array(); } if (isset($params['name'])) { if (!isset($_bindex[$params['name']])) { $_bindex[$params['name']] = 1; } else { $_bindex[$params['name']]++; } } $sTemplate->assign('_bindex', $_bindex); if (!isset($sTemplate->block_data)) { $sTemplate->block_data = array(); } $iTags = count($sTemplate->_tag_stack); /** * set condition */ $limit = $offset = 0; if (isset($params['row'])) { $limit = $params['row']; } if (isset($params['start'])) { $offset = $params['start']; } if (isset($_GET['pos'])) { $_pos = intval($_GET['pos']); $offset = ceil($_pos / $limit) * $row; } if (!empty($params['flag'])) { $conditions[] = "flag='" . $params['flag'] . "'"; } if ($_table == "industry" or $_table == "area") { if (isset($params['parentid'])) { if (!empty($params['parentid'])) { $conditions['parentid'] = "parent_id='" . intval($params['parentid']) . "' OR id=" . intval($params['parentid']); } else { $conditions['parentid'] = "parent_id=0"; } } else { $conditions['parentid'] = "parent_id=0"; } } if (!empty($params['level'])) { if ($_table == "newstype") { $conditions[] = "level_id='" . $params['level'] . "'"; } else { $conditions[] = "level='" . $params['level'] . "'"; } } if (isset($params['type'])) { $type = explode(",", $params['type']); $type = array_unique($type); foreach ($type as $val) { switch ($val) { case 'image': if ($module == "friendlink") { $image_col = "logo"; } else { $image_col = "picture"; } $conditions[] = "{$image_col}!=''"; break; case 'hot': $orderbys[] = "hits DESC"; break; case 'commend': $conditions[] = "if_commend='1'"; break; default: break; } } } if (isset($params['exclude'])) { $conditions[] = $M->getExcludeIds($params['exclude']); } if (isset($params['include'])) { $conditions[] = $M->getIncludeIds($params['include']); } if (isset($params['orderby'])) { $orderbys[] = trim($params['orderby']); } if (!empty($row) && $row != 'all' && $row != -1) { $M->setLimitOffset($offset, $limit); $mysql_limit = $M->getLimitOffset(); } if (!empty($params['limit'])) { $mysql_limit = " " . trim($params['limit']); } if (!empty($_GET['producttypeid'])) { $conditions[] = "type_id=" . intval($_GET['producttypeid']); } if (!empty($params['companyid'])) { $conditions[] = "company_id=" . intval($params['companyid']); } if (!empty($params['industryid'])) { $conditions[] = "industry_id=" . intval($params['industryid']); } if (!empty($params['typeid'])) { if ($_table == 'adses') { $conditions[] = "adzone_id=" . intval($params['typeid']); } else { $conditions[] = "type_id=" . intval($params['typeid']); } } if (empty($sTemplate->block_data[$iTags])) { # ************************************************************************ # Main content $M->setCondition($conditions); $M->setOrderby($orderbys); $sql = sprintf("SELECT * FROM %s%s %s %s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition(), $M->getOrderby(), $mysql_limit); $sTemplate->block_data[$iTags] = $M->GetArray($sql); //如果没有数据,那就不用再执行了(repeat) if (!$sTemplate->block_data[$iTags]) { return $repeat = false; } if (isset($stat)) { $_total_count = $M->dbstuff->GetOne(sprintf("SELECT count(*) FROM %s%s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition())); $sTemplate->assign('total_count', $_total_count); $sTemplate->assign("paging", array('total' => $_total_count)); } # End main content # ************************************************************************ } if (!$sTemplate->block_data[$iTags]) { $repeat = false; return ''; } if (!function_exists("smarty_function_the_url")) { require "function.the_url.php"; } $counts = count($sTemplate->block_data[$iTags]); if (list($key, $item) = each($sTemplate->block_data[$iTags])) { $_title = $_title_full = $_content = $_content_full = ''; $item['rownum'] = $key; $item['iteration'] = ++$key; if (!empty($item['url'])) { $url = $item['url']; } else { $url = smarty_function_the_url(array("do" => $module, "id" => $item['id'], "action" => 'detail')); } if ($module == "company") { $url = smarty_function_the_url(array("id" => $item['id'], "do" => "company", "userid" => $item['cache_spacename'])); } elseif ($module == "tag") { $url = smarty_function_the_url(array("do" => "product", "action" => 'lists', "q" => $item['name'])); } $item['url'] = $url; if (isset($item['title'])) { $_title = $item['name'] = $item['title']; } elseif (isset($item['name'])) { $_title = $item['title'] = $item['name']; } elseif (isset($item['subject'])) { $_title = $item['title'] = $item['subject']; } elseif (isset($item['word'])) { $_title = $item['title'] = $item['word']; } $_title_full = $_title; $item['title'] = $_title = strip_tags(pb_lang_split($_title)); $_title_full = strip_tags(pb_lang_split($_title_full)); if (!empty($titlelen)) { $_title = mb_substr($_title, 0, $titlelen); } if (isset($item['description'])) { $_content = $item['description']; } elseif (isset($item['content'])) { $_content = $item['content']; } if (isset($item['clicked'])) { $item['hits'] = $item['clicked']; } $_content_full = $_content; if (!empty($_content) && isset($infolen)) { $_content = mb_substr($_content, 0, $infolen); } if (isset($item['created'])) { $item['pubdate'] = df($item['created'], "m-d"); } elseif (isset($item['submit_time'])) { $item['pubdate'] = df($item['submit_time']); } if (!empty($params['sep'])) { $_seperate = $params['sep']; } $item['content'] = $_content = strip_tags(pb_lang_split($_content)); // if($seperate) $_title = ($key==$counts-1)?$_title:$_title.$seperate; $item['link'] = '<a title="' . $_title_full . '" href="' . $url . '" target="' . $target . '">' . $_title . '</a>' . $_seperate; $media_url = ''; if (!empty($item['picture'])) { $media_url = $item['picture']; if (!empty($media_url)) { $item['thumb'] = $item['src'] = pb_get_attachmenturl($media_url, '', 'small'); } } if (!empty($item['source_url'])) { $media_url = $item['source_url']; if (!empty($media_url)) { $item['thumb'] = $item['src'] = $media_url; } } if (isset($item['highlight'])) { $item['style'] = parse_highlight($item['highlight']); } $sTemplate->assign($assign, $item); $repeat = true; } else { $repeat = false; reset($sTemplate->block_data[$iTags]); if (isset($params['name'])) { unset($_bindex[$params['name']]); $sTemplate->assign('_bindex', $_bindex); } } if (!is_null($content)) { print $content; } if (!$repeat) { $sTemplate->block_data[$iTags] = array(); } }
</button> <?php } ?> </td> <td><?php echo $snippet->type; ?> </td> <td><?php $author = user($snippet->aid); echo $author->getLink('avatar') . ' ' . $author->getLink('profile'); ?> </td> <td><?php echo df($snippet->object()->created_date); ?> </td> </tr> <?php } ?> </tbody> <tfoot> <tr> <th>№</th> <th><?php echo t('Название сниппета'); ?> </th> <th><?php
function lists() { global $pos; require CACHE_COMMON_PATH . "cache_type.php"; $_PB_CACHE['area'] = cache_read("area"); $_PB_CACHE['industry'] = cache_read("industry"); using("area"); $area = new Areas(); $conditions = array(); $this->view_helper->setTitle(L("fair", "tpl")); $this->view_helper->setPosition(L("fair", "tpl"), "index.php?do=fair"); if (!empty($_GET['q'])) { $conditions[] = "name like '%" . $_GET['q'] . "%'"; } if (!empty($_GET['type'])) { if ($_GET['type'] == "commend") { $conditions[] = "if_commend=1"; } } if (!empty($_GET['typeid'])) { $type_id = intval($_GET['typeid']); $conditions[] = "expotype_id=" . $type_id; $type_name = $_PB_CACHE['expotype'][$type_id]; $this->view_helper->setTitle($type_name); $this->view_helper->setPosition($type_name, "index.php?do=fair&action=lists&typeid=" . $type_id); } if (isset($_GET['areaid'])) { $area_id = intval($_GET['areaid']); $tmp_info = $area->setInfo($area_id); if (!empty($tmp_info)) { $conditions[] = "area_id" . $tmp_info['level'] . "=" . $tmp_info['id']; $this->view_helper->setTitle($tmp_info['name']); $this->view_helper->setPosition($tmp_info['name'], "index.php?do=fair&action=lists&areaid=" . $tmp_info['id']); } } $amount = $this->expo->findCount(null, $conditions); $result = $this->expo->findAll("*", null, $conditions, "id desc", $pos, $this->displaypg); if (!empty($result)) { for ($i = 0; $i < count($result); $i++) { if ($result[$i]['begin_time']) { $result[$i]['begin_date'] = df($result[$i]['begin_time']); } if ($result[$i]['end_time']) { $result[$i]['end_date'] = df($result[$i]['end_time']); } $result[$i]['description'] = mb_substr(strip_tags(trim(pb_lang_split($result[$i]['description']))), 0, 100); $result[$i]['typename'] = $_PB_CACHE['expotype'][$result[$i]['expotype_id']]; $result[$i]['title'] = pb_lang_split($result[$i]['name']); if (isset($result[$i]['picture'])) { $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small'); } if (!empty($result[$i]['area_id'])) { $result[$i]['area'] = "(" . $_PB_CACHE['area'][1][$result[$i]['area_id']] . ")"; } } setvar("items", $result); } setvar("Areas", $_PB_CACHE['area']); setvar("Type", $_PB_CACHE['expotype']); $this->view_helper->setTitle(L("search", "tpl")); $this->view_helper->setPosition(L("search", "tpl")); setvar("paging", array('total' => $amount)); render("fair/list"); }
<!-- если у нас проблемный IE-- > <!--[if lt IE 9]> <script src="js/html5.js"></script> <![endif]--> <title>Заявки - <?php echo PRODUCT_NAME; ?> </title> </head> <body> <?php df(); //если не удалось соединиться с базой данных, то выведет на красном баре ошибку if (isset($dbce)) { //db connection error die('<div align="center" class="well well-small alert-error">' . PRODUCT_NAME . ': ' . $dbce . '</div></body></html>'); } ?> <div class="well well-small"> <h5> <?php echo_product_name(); ?> </h5> </div>
flash("action_failed"); } else { flash("success", '', 0); } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (isset($_GET['id'])) { $id = intval($_GET['id']); } if ($do == "edit") { if (!empty($id)) { $linkinfo = $spread->read("*", $id, null, $conditions); setvar("item", $linkinfo); } $tpl_file = "spread_edit"; vtemplate($tpl_file); exit; } } $amount = $spread->findCount(null, $conditions); $page->setPagenav($amount); $fields = "*"; $result = $spread->findAll($fields, null, $conditions, "id DESC", $page->firstcount, $page->displaypg); for ($i = 0; $i < count($result); $i++) { $result[$i]['exp_date'] = df($result[$i]['expiration']); } setvar("CheckStatus", cache_read('typeoption', 'check_status')); setvar("Items", $result); setvar("ByPages", $page->pagenav); vtemplate($tpl_file);
function Search($firstcount, $displaypg) { global $cache_types; uses("space", "industry", "area"); $space = new Space(); $area = new Areas(); $industry = new Industries(); $cache_options = cache_read('typeoption'); $area_s = $space->array_multi2single($area->getCacheArea()); $industry_s = $space->array_multi2single($industry->getIndustry()); $result = $this->findAll("*,name AS title,description AS digest", null, null, $this->orderby, $firstcount, $displaypg); if (!isset($_PB_CACHE['membergroup'])) { require CACHE_PATH . "cache_membergroup.php"; } while (list($keys, $values) = each($result)) { $r = array(); $result[$keys]['pubdate'] = df($values['created']); $result[$keys]['typename'] = $cache_options['manage_type'][$values['manage_type']]; $result[$keys]['thumb'] = $result[$keys]['logo'] = pb_get_attachmenturl($values['picture'], '', 'small'); $result[$keys]['gradeimg'] = URL . 'images/group/' . $_PB_CACHE['membergroup'][$result[$keys]['cache_membergroupid']]['avatar']; $result[$keys]['gradename'] = $_PB_CACHE['membergroup'][$result[$keys]['cache_membergroupid']]['name']; if (!empty($result[$keys]['area_id'])) { $r[] = $area_s[$result[$keys]['area_id']]; } if (!empty($result[$keys]['industry_id'])) { $r[] = $industry_s[$result[$keys]['industry_id']]; } $r[] = L("integrity_index", "tpl") . "(" . $result[$keys]['cache_credits'] . ")"; if (!empty($r)) { $result[$keys]['extra'] = implode(" - ", $r); } $result[$keys]['url'] = $space->rewrite($values['member_id'], $values['id']); } return $result; }
/** * @package Xpressengine\DynamicField * * @param string $group group name * @param string $columnName dynamic field id * @param array $args arguments * * @return string */ function dfEdit($group, $columnName, $args) { $fieldType = df($group, $columnName); if ($fieldType == null) { return ''; } return $fieldType->getSkin()->edit($args); }
$search_title = $_GET['q']; $conditions = "title like '%" . $search_title . "%'"; } } if ($do == "del" && !empty($id)) { $deleted = false; $deleted = $standard->del($id); } if ($do == "edit") { if (!empty($id)) { $item = $standard->read("*", $id); if (!empty($item['publish_time'])) { $item['publish_date'] = df($item['publish_time']); } if (!empty($item['force_time'])) { $item['force_date'] = df($item['force_time']); } if (!empty($item['attachment_id'])) { $item['attach'] = $attachment_model->getAttachLink($item['attachment_id']); } setvar("item", $item); } setvar("StandardTypes", $_PB_CACHE['standardtype']); $tpl_file = "standard.edit"; template($tpl_file, true); } } $amount = $standard->findCount(null, $conditions); $page->setPagenav($amount); $result = $standard->findAll("Standard.*,t.name AS typename", array("LEFT JOIN {$tb_prefix}standardtypes t ON Standard.type_id=t.id"), $conditions, "Standard.id DESC", $page->firstcount, $page->displaypg); setvar("Items", $result);
$tmp_info = $area->setInfo($area_id); if (!empty($tmp_info)) { $conditions[] = "area_id" . $tmp_info['level'] . "=" . $tmp_info['id']; $viewhelper->setTitle($tmp_info['name']); $viewhelper->setPosition($tmp_info['name'], "fair/list.php?areaid=" . $tmp_info['id']); } } $amount = $expo->findCount(null, $conditions); $result = $expo->findAll("*", null, $conditions, "id desc", $pos, $limit); if (!empty($result)) { for ($i = 0; $i < count($result); $i++) { if ($result[$i]['begin_time']) { $result[$i]['begin_date'] = df($result[$i]['begin_time']); } if ($result[$i]['end_time']) { $result[$i]['end_date'] = df($result[$i]['end_time']); } $result[$i]['description'] = mb_substr(strip_tags(trim($result[$i]['description'])), 0, 100); $result[$i]['typename'] = $_PB_CACHE['expotype'][$result[$i]['expotype_id']]; $result[$i]['title'] = $result[$i]['name']; if (isset($result[$i]['picture'])) { $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small'); } if (!empty($result[$i]['area_id'])) { $result[$i]['area'] = "(" . $_PB_CACHE['area'][1][$result[$i]['area_id']] . ")"; } } setvar("items", $result); } setvar("Areas", $_PB_CACHE['area']); setvar("Type", $_PB_CACHE['expotype']);
if (empty($res)) { flash("data_not_exists"); } if (!empty($res['trusttype_ids'])) { $tmp_user_trusttype = explode(",", $res['trusttype_ids']); $res['selected_trusttypeid'] = $tmp_user_trusttype; unset($tmp_user_trusttype); } if (!empty($res['membergroup_id'])) { $res['groupimage'] = URL . STATICURL . "images/group/" . $G['membergroup'][$res['membergroup_id']]['avatar']; } if ($res['service_start_date']) { $res['service_start_date'] = df($res['service_start_date']); } if ($res['service_end_date']) { $res['service_end_date'] = df($res['service_end_date']); } setvar("item", $res); } uaAssign(array("Genders" => $genders)); setvar("MemberStatus", $typeoption->get_cache_type("check_status")); $tpl_file = "member.edit"; template($tpl_file); exit; } if ($do == "search") { if (!empty($_GET['member']['name'])) { $conditions[] = "Member.username like '%" . $_GET['member']['name'] . "%'"; } if (isset($_GET['member']['status']) && $_GET['member']['status'] >= 0) { $conditions[] = "Member.status='" . $_GET['member']['status'] . "'";
$vals['modified'] = $time_stamp; $result = $job->save($vals, "update", $id, null, "member_id=" . $the_memberid); } else { if ($g['max_job'] && $now_job_amount >= $g['max_job']) { flash('one_day_max'); } $vals['created'] = $vals['modified'] = $time_stamp; $vals['company_id'] = $companyinfo['id']; $vals['member_id'] = $the_memberid; $vals['cache_spacename'] = $pdb->GetOne("SELECT space_name FROM {$tb_prefix}members WHERE id=" . $the_memberid); $result = $job->save($vals); } if (!$result) { flash(); } else { flash($message_info); } } $result = $job->findAll("*", null, "Job.member_id=" . $the_memberid, "id DESC", 0, 10); if (!empty($result)) { for ($i = 0; $i < count($result); $i++) { $result[$i]['pubdate'] = df($result[$i]['created']); $result[$i]['expire_date'] = df($result[$i]['expire_time']); } setvar("Items", $result); } $job_status = explode(",", L('product_status', 'tpl')); setvar("CheckStatus", $job_status); setvar("Worktype", $typeoption->get_cache_type("work_type")); setvar("Salary", $typeoption->get_cache_type("salary")); template($tpl_file);
uaAssign(array("LastLogin" => date("Y-m-d H:i", $memberinfo['last_login']))); $offer_count = $pdb->GetArray("SELECT count(id) AS amount,type_id AS typeid FROM {$tb_prefix}trades WHERE member_id=" . $the_memberid . " GROUP BY type_id"); $offer_stat = array(); $types = $trade->getTradeTypes(); if (!empty($offer_count)) { foreach ($offer_count as $offer_key => $offer_val) { $offer_stat[$types[$offer_val['typeid']]] = $offer_val['amount']; } setvar("items_offer", $offer_stat); } $pm_count = $pdb->GetArray("SELECT count(id) AS amount,type AS typename FROM {$tb_prefix}messages WHERE to_member_id=" . $the_memberid . " GROUP BY type"); if (!empty($pm_count)) { $pm_result = array(); foreach ($pm_count as $pm_val) { $pm_result[$pm_val['typename']] = intval($pm_val['amount']); } setvar("pm", $pm_result); } setvar("ServiceInfo", $service_info); $memberinfo['start_date'] = df($memberinfo['service_start_date']); $memberinfo['end_date'] = df($memberinfo['service_end_date']); $memberinfo['gender_name'] = $_PB_CACHE['calls'][$memberinfo['gender']]; $memberinfo['avatar'] = !empty($memberinfo['photo']) ? pb_get_attachmenturl($memberinfo['photo'], "../", "small") : ($memberinfo['gender'] == 2 ? "images/female.png" : "images/male.png"); setvar("MemberInfo", $memberinfo); $group['name'] = $g['name']; $group['image'] = $g['avatar']; setvar("group", $group); template("index"); } else { flash('invalid_user'); }
<? $user = new User_Object($item->aid)?> <div class="comment" id="comment-<?php echo $item->id; ?> "> <div class="comment-info"> <? $comment_info = new Stack('comment.info'); $comment_info->avatar = $user->getAvatarLinked();; $comment_info->author = $user->getLink(); $comment_info->time = '<span class="time">'.icon('time').' '.df($item->created_date).'</span>'; echo $comment_info; ?> </div> <div class="comment-body"><?php echo $item->body; ?> </div> </div>