public function getIDs() { global $glObj; $cat = ''; $page = ''; $catname = ''; $sidebar = ''; $breadcrumbs = ''; $breadcrumbs_link = 'index.php?type=base&mod=companies&cat='; if (preg_match('/^[0-9a-z:()\\/-]+$/i', strtolower($_REQUEST['cat']))) { $cat = $_REQUEST['cat']; } if (isset($_REQUEST['page']) && preg_match('/^[0-9a-z\\.\\-_\\(\\)]+$/i', $_REQUEST['page'])) { $page = $_REQUEST['page']; } if (!empty($cat)) { $cats = explode('/', $cat); $id_cat = 0; $id_company = 0; foreach ($cats as $k => $name) { $q = "SELECT id, name, sidebar FROM " . $this->mTbCat . " WHERE alias = '" . $name . "' AND parent = '" . $id_cat . "'"; $row = $this->mDb->getRow($q); $id_cat = $row['id']; $breadcrumbs_link .= $name; $t = $breadcrumbs_link; if ($k < count($cats) - 1) { $breadcrumbs_link .= '/'; } $breadcrumbs .= ' » '; if ($k == count($cats) - 1) { $catname = $row['name']; $sidebar = $row['sidebar']; } $breadcrumbs .= empty($page) && $k == count($cats) - 1 ? $row['name'] : '<a href="' . CPRoute::_($t) . '" rel="nofollow">' . $row['name'] . '</a>'; } if (!empty($page)) { $q = "SELECT id, title_breadcrumb FROM " . $this->mTbAds . " WHERE alias = '" . $page . "' AND id_cat = '" . $id_cat . "'"; $row = $this->mDb->getRow($q); $id_company = $row['id']; $breadcrumbs .= ' » ' . $row['title_breadcrumb']; } return array($id_cat, $id_company, $breadcrumbs, $catname, $sidebar); } return array(null, null, null, null); }
echo CPRoute::_('index.php?type=base&mod=companies&cat=' . $cat['alias']); ?> " title="<?php echo $cat['name']; ?> section"><?php echo $name; ?> </a></h4> <ul> <?php foreach ($this->pl[$cat['id']] as $subcat) { $name = $subcat['number_ads'] > 0 ? $subcat['name'] . ' (' . $subcat['number_ads'] . ')' : $subcat['name']; ?> <li><a href="<?php echo CPRoute::_('index.php?type=base&mod=companies&cat=' . $cat['alias'] . '/' . $subcat['alias']); ?> " title="<?php echo $subcat['name']; ?> "><?php echo $name; ?> </a></li> <?php } ?> </ul> </div></li> <?php }
?> </h3> <div style="color:#666;"><em><?php echo $this->results_description; ?> </em></div> <div style="clear:both;margin-bottom:20px;"></div> <?php foreach ($this->list as $i => $item) { list($cloakedURL, $realURL) = CPHelper::getCompanyURLs($item['id'], $item['displayurl'], $item['source']); //echo "cloakedURL=<pre>";print_r($cloakedURL);echo "</pre><hr>"; //echo "this->plist_c=<pre>";print_r($this->plist_c);echo "</pre><hr>"; $logo = !empty($item['logourl']) ? '<img src="' . $item['logourl'] . '" style="float:left; margin:5px;" />' : ''; $description = mb_str_replace('{logoleft}', '', strip_tags($item['content'])); $description = mb_strlen($description) > 250 ? mb_substr($description, 0, 250) . '..' : $description; $pageURL = CPRoute::_('index.php?type=base&mod=companies&what=page&cat=' . $item['path'] . '&page=' . $item['alias']); ?> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="width:100px;" valign="top"><a href="<?php echo $pageURL; ?> "><?php echo $logo; ?> </a></td> <td style="padding-left:10px;"><h4 style="margin:0"><a href="<?php echo $pageURL; ?> "><?php echo $item['title'];
public function Index() { define('API', 'PS'); require_once 'siteadmin/includes/config/affiliatewindow.php'; include_once 'View/Base/Companies.class.php'; $view = new View_Base_Companies($this->mlObj, $this->location); $type = $_REQUEST['ptype']; $mod = $_REQUEST['pmod']; $cid = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : 0; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : ''; $cat = isset($_REQUEST['cat']) ? $_REQUEST['cat'] : ''; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $catname = ''; $catsidebar = ''; $breadcrumbs = ''; $id_cat = 0; $id_company = 0; $cl = ''; if (!empty($cat)) { list($id_cat, $id_company, $breadcrumbs, $catname, $catsidebar) = $this->mCompanies->getIDs(); // get cats and subcats include_once 'Model/Base/Cats.class.php'; $mDict = new Model_Base_Cats($this->mDb); $cl = $mDict->GetCatsList($id_cat, 1, 'sortid, name ASC'); } $view->assign('breadcrumbs', $breadcrumbs); $view->assign('catname', $catname); $view->assign('meta_title', SITE_NAME . ': ' . $catname); $view->assign('meta_keywords', SITE_NAME . ',' . $catname); $view->assign('meta_description', SITE_NAME . ': ' . $catname); $view->assign('sidebar', $catsidebar); // pagging $limit = intval($_SESSION[$type . '.' . $mod . '.limit']); include_once 'View/Acc/Pagging.php'; if ($limit == 0) { $limit = 10; } if (!empty($type) && !empty($mod)) { $limit = intval($_SESSION[$type . '.' . $mod . '.limit']); } $view->assign('limit', $limit); $view->assign('view', !empty($type) && !empty($mod) ? $_SESSION[$type . '.' . $mod . '.view'] : ''); $pcnt = $limit; $rcnt = $this->mCompanies->GetPagesCount($id_cat, array('search' => $search, 'active' => 1)); $page = (int) (!empty($_REQUEST['p'])) ? $_REQUEST['p'] : 1; if ($page > 1 && $rcnt <= $limit * ($page - 1)) { $page--; } if ($page < 1) { $page = 1; } $view->assign('page', $page); $pg = new Pagging($this->mlObj, '', $limit, $rcnt, $page, CPRoute::_('index.php?type=base&mod=ads&cat=' . $cat)); $view->assign('rcnt', $rcnt); $range =& $pg->GetRange(); $numberOfListingsOnPage = $range[1] - $range[0]; $results_description = $numberOfListingsOnPage > 0 ? "Showing " . ($range[0] + 1) . " - " . $range[1] . " results out of total " . $rcnt . " listings" : "No results found"; $view->assign('plist_c', $range[1] - $range[0]); $view->assign('results_description', $results_description); $list = $this->mCompanies->GetList($id_cat, array('sort' => $sort, 'first' => count($range > 1) ? $range[0] : 0, 'cnt' => $limit, 'search' => $search, 'active' => 1)); $view->assign('cl', $cl); $view->assign('list', $list); $view->assign('paginator', $pg->Make()); if (!empty($search)) { $view->assign('title', 'Search results for "' . $search . '"'); $view->display('searchresults.php'); } else { if (isset($catname)) { $view->assign('title', ''); } $view->display('list.php'); } }