コード例 #1
0
 function operator($id)
 {
     $this->result = $GLOBALS['db']->query('SELECT * FROM `operators` WHERE `id`="' . $id . '"');
     $this->result[0]['onlinetime'] = secs_to_hms($this->result[0]['onlinetime']);
     $this->result2 = $GLOBALS['db']->query('SELECT * FROM `reviews` WHERE `operatorid`="' . $id . '"');
     $total = 0;
     if (isset($this->result2[0])) {
         foreach ($this->result2 as $key => $val) {
             $total += $this->result2[$key]['rating'];
         }
         $this->result[0]['rating'] = $total / count($this->result2);
     } else {
         $this->result[0]['rating'] = 0;
     }
     return $this->result[0];
 }
コード例 #2
0
 function info($chatid)
 {
     if ($this->result = $GLOBALS['db']->query('SELECT * FROM `traffic` WHERE `id`="' . $chatid . '"')) {
         if ($this->result2 = $GLOBALS['db']->query('SELECT * FROM `footprints` WHERE `chatid`="' . $chatid . '" AND `current`="1" ORDER BY `id` DESC')) {
             $this->result[0]['page'] = $this->result2[0]['page'];
             $this->result[0]['page_time'] = secs_to_hms(time() - $this->result2[0]['timestamp']);
             $this->result[0]['footprints'] = $this->result2;
         }
         $this->result[0]['site_time'] = secs_to_hms(time() - $this->result[0]['start']);
         if (isset($this->result[0]['footprints'][0])) {
             foreach ($this->result[0]['footprints'] as $key => $val) {
                 $this->result[0]['footprints'][$key]['time'] = gmdate('G:i:s D jS F Y', $this->result[0]['footprints'][$key]['timestamp'] + 3600 * $GLOBALS['conf']['offset']);
                 if ($GLOBALS['hotpage']->check($this->result[0]['footprints'][$key]['page'])) {
                     $this->result[0]['footprints'][$key]['hotpage'] = 'true';
                 } else {
                     $this->result[0]['footprints'][$key]['hotpage'] = 'false';
                 }
                 if (strlen($this->result[0]['footprints'][$key]['page']) > 60) {
                     $this->result[0]['footprints'][$key]['url'] = $this->result[0]['footprints'][$key]['page'];
                     $this->result[0]['footprints'][$key]['page'] = substr($this->result[0]['footprints'][$key]['url'], 0, 40) . '...' . substr($this->result[0]['footprints'][$key]['url'], -20, 20);
                 } else {
                     $this->result[0]['footprints'][$key]['url'] = $this->result[0]['footprints'][$key]['page'];
                 }
             }
         }
         if ($this->result[0]['history'] = $GLOBALS['db']->query('SELECT * FROM `footprints` WHERE `chatid`="' . $chatid . '" AND `current`="0" ORDER BY `id` DESC')) {
             if (isset($this->result[0]['history'][0])) {
                 foreach ($this->result[0]['history'] as $key => $val) {
                     $this->result[0]['history'][$key]['time'] = gmdate('G:i:s D jS F Y', $this->result[0]['history'][$key]['timestamp'] + 3600 * $GLOBALS['conf']['offset']);
                     if ($GLOBALS['hotpage']->check($this->result[0]['history'][$key]['page'])) {
                         $this->result[0]['history'][$key]['hotpage'] = 'true';
                     } else {
                         $this->result[0]['history'][$key]['hotpage'] = 'false';
                     }
                     if (strlen($this->result[0]['history'][$key]['page']) > 60) {
                         $this->result[0]['history'][$key]['url'] = $this->result[0]['history'][$key]['page'];
                         $this->result[0]['history'][$key]['page'] = substr($this->result[0]['history'][$key]['url'], 0, 40) . '...' . substr($this->result[0]['history'][$key]['url'], -20, 20);
                     } else {
                         $this->result[0]['history'][$key]['url'] = $this->result[0]['history'][$key]['page'];
                     }
                 }
             }
         }
         if (isset($this->result[0]['page'])) {
             if (strlen($this->result[0]['page']) > 60) {
                 $this->result[0]['url'] = $this->result[0]['page'];
                 $this->result[0]['page'] = substr($this->result[0]['url'], 0, 40) . '...' . substr($this->result[0]['url'], -20, 20);
             } else {
                 $this->result[0]['url'] = $this->result[0]['page'];
             }
         } else {
             $this->result[0]['page'] = '';
             $this->result[0]['url'] = '';
         }
         if (isset($this->result[0]['referrer'])) {
             if (strlen($this->result[0]['referrer']) > 60) {
                 $this->result[0]['refurl'] = $this->result[0]['referrer'];
                 $this->result[0]['referrer'] = substr($this->result[0]['refurl'], 0, 40) . '...' . substr($this->result[0]['refurl'], -20, 20);
             } else {
                 $this->result[0]['refurl'] = $this->result[0]['referrer'];
             }
         } else {
             $this->result[0]['referrer'] = '';
             $this->result[0]['refurl'] = '';
         }
     }
     return $this->result[0];
 }