예제 #1
0
 function get()
 {
     $profile_uid = intval($_GET['p']);
     if (!$profile_uid) {
         $profile_uid = -1;
     }
     $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
     header("Content-type: text/html");
     echo "<!DOCTYPE html><html><body>\r\n";
     echo $_GET['msie'] == 1 ? '<div>' : '<section>';
     $mod = new Display();
     $text = $mod->get($profile_uid, $load);
     $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
     $replace = "<img\${1} dst=\"\${2}\"";
     //	$text = preg_replace($pattern, $replace, $text);
     /*
     	if(! $load) {
     		$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
             $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
             $text = preg_replace($pattern, $replace, $text);
     	}
     */
     echo str_replace("\t", '       ', $text);
     echo $_GET['msie'] == 1 ? '</div>' : '</section>';
     echo "</body></html>\r\n";
     //	logger('update_display: ' . $text);
     killme();
 }
예제 #2
0
 function listAction()
 {
     //get category to display set by /site/category
     $parentCategoryId = Display::get("currentCategoryId", 0);
     $cache = Cacher::getInstance();
     $cacheItemName = "categoryMiddleHtml" . $parentCategoryId . Config::get("language") . "Template" . Config::get("templateName");
     //check that cached version exists
     if (($categoriesMiddleHtml = $cache->load($cacheItemName, false)) === null) {
         //retrieve all categories which have this $parentCategoryId alphabetically
         $c = new Criteria();
         $c->addOrder("position, name");
         $c->add("parentCategoryId", $parentCategoryId);
         //create assoctiation array with keys = categoryId and values category data
         $categoriesList = $this->category->getArray($c, "parentCategoryId, name, urlName, imageSrc, validatedSitesCount", null, true);
         //if exists some categories having this parent
         if (!empty($categoriesList)) {
             //get count of category subcategories
             $maxSubcategoriesCount = Config::get("countOfSubcategoriesUnderCategory");
             if ($maxSubcategoriesCount) {
                 //retrieve subcategories which have categories on this page
                 $c = new Criteria();
                 $c->addOrder("position, name");
                 $c->add("parentCategoryId", array_keys($categoriesList), "IN");
                 $subcategories = $this->category->findAll($c);
                 //foreach category create subcategories container
                 foreach ($categoriesList as $key => $category) {
                     $categoriesList[$key]['subcategories'] = array();
                 }
                 //foreach subcategories add it to parent category
                 foreach ($subcategories as $subcategory) {
                     $parentCategory =& $categoriesList[$subcategory['parentCategoryId']];
                     //check that $maxSubcategoriesCount isn't reached
                     if (count($parentCategory['subcategories']) < $maxSubcategoriesCount) {
                         $parentCategory['subcategories'][] = $subcategory;
                     }
                 }
             }
             //create standard array to be able create 2 columns table (much be indexed i, i+1)
             $categoriesList = array_values($categoriesList);
         }
         $this->set("categoriesList", $categoriesList);
         $categoriesMiddleHtml = $this->render();
         //store categories with subcategories on this page to cache
         $cache->save($categoriesMiddleHtml, $cacheItemName, false, array("category", "site"));
     }
     return $categoriesMiddleHtml;
 }
예제 #3
0
 /**
  * Display left menu categories
  */
 function displayCategoriesAction()
 {
     //get category to display set in /site/category
     $parentId = Display::get("currentCategoryId", 0);
     $cacheItemName = "categoryMenuHtml" . $parentId . Config::get("language") . "Template" . Config::get("templateName");
     //check is this menu was cached before
     $cache = Cacher::getInstance();
     if (($categoriesHtml = $cache->load($cacheItemName, false)) === null) {
         $c = new Criteria();
         $c->addOrder('position, name');
         $categories = $this->category->getChilds($parentId, false, $c);
         $this->set("categories", $categories);
         $this->viewFile = "menuleft/categories";
         $categoriesHtml = $this->render();
         $cache->save($categoriesHtml, $cacheItemName, false, array("category"));
     }
     return $categoriesHtml;
 }
예제 #4
0
 public static function displayTime($params, &$tpl)
 {
     $scriptEndTime = microtime(true);
     return "&nbsp; &nbsp; Generated in " . sprintf("%.3f", $scriptEndTime - $GLOBALS['scriptStartTime']) . " Queries: " . Display::get("queriesCount", 0);
 }