コード例 #1
0
ファイル: main.php プロジェクト: phannack/GCMS
     $search_result[$i]['category_id'] = gcms::getVars($item, 'category_id', 0);
     $search_result[$i]['topic'] = $item['topic'];
     $search_result[$i]['alias'] = $item['alias'];
     $search_result[$i]['index'] = $item['index'];
     if ($item['description'] == '') {
         $search_result[$i]['detail'] = gcms::cutstring(gcms::html2txt($item['detail']), 149);
     } else {
         $search_result[$i]['detail'] = $item['description'];
     }
     $search_result[$i]['module'] = $item['module'];
     $search_result[$i]['owner'] = $item['owner'];
     $search_result[$i]['value'] = $v * ($item['level'] + $item['index']);
 }
 if (sizeof($search_result) > 0) {
     // เรียงลำดับผลลัพท์ตาม score
     gcms::sortby($search_result, 'value', false);
     // จัดรูปแบบข้อความ
     $searchitem = gcms::loadtemplate('search', 'search', 'searchitem');
     $match = array('/{URL}/', '/{TOPIC}/', '/{DETAIL}/', '/{LINK}/');
     foreach ($search_result as $item) {
         unset($data);
         if ($item['owner'] == 'index' || $item['index'] == 1) {
             $url1 = gcms::getURL($item['module']);
             $url2 = gcms::getURL($item['module'], '', 0, 0, '', false);
         } elseif ($item['owner'] == 'board') {
             $url1 = gcms::getURL($item['module'], '', 0, 0, "wbid={$item['id']}");
             $url2 = $url1;
         } elseif ($item['owner'] == 'document') {
             if ($config['module_url'] == 1) {
                 $url1 = gcms::getURL($item['module'], $item['alias'], 0, 0, 'q=' . urlencode($search), true);
                 $url2 = gcms::getURL($item['module'], $item['alias'], 0, 0, '', false);
コード例 #2
0
         } else {
             $datas[$k]['total'] = empty($datas[$k]['total']) ? 1 : $datas[$k]['total'] + 1;
         }
     }
 }
 if ($ip == '') {
     if ($type == 'ip') {
         // เรียงลำดับตาม ip
         gcms::sortby($datas, 'ip');
     } else {
         // เรียงลำดับตาม referer
         gcms::sortby($datas, 'referer');
     }
 } else {
     // เรียงลำดับตาม time
     gcms::sortby($datas, 'time');
 }
 $graphs['Google Search'] = 0;
 $graphs['Google Cached'] = 0;
 $graphs['Inbound'] = 0;
 $graphs['Direct'] = 0;
 $graphs['Direct'] = 0;
 $graphs['other'] = 0;
 $list = array();
 $total = 0;
 $i = 0;
 $bg = 'bg2';
 foreach ($datas as $item) {
     $i++;
     if (isset($item['total'])) {
         $total = $total + $item['total'];