Example #1
0
 function handlePageData(&$page_data)
 {
     global $TDB;
     if (strpos($page_data['url'], 'sec_pic.php') || strpos($page_data['url'], 'image.php')) {
         return false;
     }
     if ($page_data['insite_status']) {
         $page_data['http_status_code'] = $page_data['insite_status'];
     }
     preg_match('/<title>(.*?)<\\/title>/', $page_data['source'], $result);
     $title = $result[1] && $page_data['http_status_code'] == 200 ? $result[1] : '';
     $pattern = '/<\\!--<index>-->(.+)<\\!--<\\/index>-->/is';
     if ($page_data['http_status_code'] == 200 && preg_match_all($pattern, $page_data['source'], $matches)) {
         list(, $body) = each($matches[1]);
         $body = iconv('UTF-8', 'windows-1251', $body);
         $body = mysql_escape_string(strip_tags(preg_replace(array('/\\s+/', '#<script[^>]*>.*?</script>#is'), array(' ', ''), $body)));
         $index = XTRcrawler::Words2BaseForm(preg_replace('/\\s+/', ' ', $body));
     }
     $TDB->insertIN('search_pages_index', array('id' => 'null', 'url' => $page_data['url'], 'title' => $title, 'body' => iconv('windows-1251', 'UTF-8', $body), 'index' => iconv('windows-1251', 'UTF-8', $index), 'status' => $page_data['http_status_code']));
     $this->pages[] = array('url' => $page_data['url'], 'bytes_recieved' => XFILES::format_size($page_data['bytes_received']), 'body' => $title, 'status' => $page_data['http_status_code']);
 }
Example #2
0
 function price_objects_render($cat_id, $level = 0, $hashed_links = 0, $show_counters = 0, $max_level = 0)
 {
     global $TMS, $_PATH, $TPA;
     $buff = '';
     $category = $this->_tree->getNodeInfo($cat_id);
     $items = $this->_tree->GetChildsParam($cat_id, array('file_name', 'basic', 'LastModified', 'description', 'image', 'hashed_link', 'hash', 'hidden', 'DisableAccess', 'counter'), true);
     Common::is_module_exists("fusers") ? $fusers_exists = true : ($fusers_exists = false);
     $session = ENHANCE::get_session('');
     $fusers = false;
     if ($category["params"]["DisableAccess"] && $fusers_exists) {
         Common::call_common_instance('fusers');
         $fusers = fusers_module_common::getInstance();
         $found = false;
         if ($session["siteuser"]["usergroup"]) {
             $found = $fusers->get_node_rights($cat_id, $this->_module_name, $session["siteuser"]["usergroup"]);
         }
         if (!$found) {
             return $TMS->parseSection('_doc_list_no_access');
         }
     }
     $TMS->AddReplace('_doc_list_level_' . $level, 'cat_name', $category["basic"]);
     if ($items != false) {
         foreach ($items as $item) {
             if ($item["params"]["hidden"]) {
                 continue;
             }
             if ($item["obj_type"] == '_PRICEGROUP') {
                 if ($level < $max_level - 1 || !$max_level) {
                     if ($hashed_links || $category["params"]["hashed_link"]) {
                         $buff .= $this->price_objects_render($item['id'], $level + 1, 1, $show_counters);
                     } else {
                         $buff .= $this->price_objects_render($item['id'], $level + 1, 0, $show_counters);
                     }
                 }
                 continue;
             }
             if (!file_exists($f = PATH_ . $item['params']['file_name'])) {
                 $buff .= $TMS->parseSection('_file_not_found');
                 continue;
             }
             if ($item['params']['DisableAccess'] && $fusers_exists) {
                 if (!$fusers) {
                     Common::call_common_instance('fusers');
                     $fusers = fusers_module_common::getInstance();
                 }
                 $found = false;
                 if ($session["siteuser"]["usergroup"]) {
                     $found = $fusers->get_node_rights($item['id'], $this->_module_name, $session["siteuser"]["usergroup"]);
                 }
                 if (!$found) {
                     $buff .= $TMS->parseSection('_file_no_access');
                 }
             }
             $stat = stat($f);
             if ($hashed_links || $item["params"]["hashed_link"] || $category["params"]["hashed_link"]) {
                 $alink = $TPA->page_link . '/~download/link/' . $item["params"]["hash"];
                 $item['params']['counter'] ? $acounter = $item['params']['counter'] : ($acounter = 0);
             } else {
                 $alink = $_PATH['WEBPATH_MEDIA'] . $item['params']['file_name'];
                 $acounter = '';
             }
             $TMS->AddMassReplace('_doc_list_item_level_' . $level, array("link" => $alink, "counter" => $acounter, "type" => pathinfo($item['params']['file_name'], PATHINFO_EXTENSION), "caption" => $item['params']['basic'], "image" => $a['image'] = $item['params']['image'], "description" => $item['params']['description'], "time" => date('d.m.Y', $item['params']['LastModified']), "show_counters" => $show_counters, "size" => XFILES::format_size($stat['size'])));
             $buff .= $TMS->parseSection('_doc_list_item_level_' . $level);
         }
     }
     $TMS->AddReplace("_doc_list_level_" . $level, "buff", $buff);
     $TMS->AddReplace("_doc_list_level_" . $level, "show_counters", $show_counters);
     $TMS->AddMassReplace('_doc_list_level_' . $level, $category['params']);
     $menu = $TMS->parseSection('_doc_list_level_' . $level);
     return $menu;
 }