Exemplo n.º 1
0
 private function server_side_sort($sort, $reverse, $filter, $forceAscii = false)
 {
     \GO::debug("server_side_sort({$sort}, {$reverse}, {$filter})");
     $this->clean($sort, 'keyword');
     //$this->clean($filter, 'keyword');
     $charset = $forceAscii || !\GO\Base\Util\String::isUtf8($filter) ? 'US-ASCII' : 'UTF-8';
     $command = 'UID SORT (' . $sort . ') ' . $charset . ' ' . trim($filter) . "\r\n";
     $this->send_command($command);
     /*if ($this->disable_sort_speedup) {
     			$speedup = false;
     		}
     		else {*/
     $speedup = true;
     //}
     $res = $this->get_response(false, true, 8192, $speedup);
     $status = $this->check_response($res, true);
     if (!$status && stripos($this->last_error(), 'utf')) {
         return $this->server_side_sort($sort, $reverse, $filter, true);
     }
     $uids = array();
     foreach ($res as $vals) {
         if ($vals[0] == '*' && strtoupper($vals[1]) == 'SORT') {
             array_shift($vals);
             array_shift($vals);
             $uids = array_merge($uids, $vals);
         } else {
             if (preg_match("/^(\\d)+\$/", $vals[0])) {
                 $uids = array_merge($uids, $vals);
             }
         }
     }
     unset($res);
     if ($reverse) {
         $uids = array_reverse($uids);
     }
     return $status ? $uids : false;
 }
Exemplo n.º 2
0
 private function _convertZipEncoding(\GO\Base\Fs\Folder $folder, $charset = 'CP850')
 {
     $items = $folder->ls();
     foreach ($items as $item) {
         if (!\GO\Base\Util\String::isUtf8($item->name())) {
             $item->rename(\GO\Base\Util\String::clean_utf8($item->name(), $charset));
         }
         if ($item->isFolder()) {
             $this->_convertZipEncoding($item, $charset);
         }
     }
 }