92 public static function init() {
93 if (!empty(self::$requestArray))
99 $outs =
'(\.('.implode(
'|', array_keys(self::$cfg->outCfg)).
'))';
100 foreach(self::$cfg->
alias as $k=>$v) {
102 $alias[
'(/.{2})?/?'] =
'\1'.$v;
103 $alias[
'(/.{2})?'.$outs] =
'\1'.$v.
'\2';
106 $tmp = explode(
'\\', $v);
110 foreach($tmp as $tt) {
111 $t.=
'\\'.(intval(substr($tt, 0, 1))+1).substr($tt, 1);
114 if (!preg_match($outs, $k))
115 $alias[$k.
'(.*)'] = $t.
'\\'.$i;
119 $alias = array_reverse($alias,
true);
120 self::$cfg->alias = $alias;
123 $avlLangsTmp = self::$cfg->avlLang;
125 foreach($avlLangsTmp as $k=>$v) {
126 if ($k == self::$cfg->lang) {
128 unset($avlLangsTmp[$k]);
131 self::$cfg->avlLang = array_merge($avlLangs, $avlLangsTmp);
133 $secure = (array_key_exists(
'HTTPS', $_SERVER) && $_SERVER[
'HTTPS'] ==
'on');
135 $protocol = $secure?
'https' :
'http';
137 $controller = basename($_SERVER[
'SCRIPT_FILENAME']);
139 $serverName = array_key_exists(
'HTTP_HOST', $_SERVER) ? $_SERVER[
'HTTP_HOST'] : (array_key_exists(
'SERVER_NAME', $_SERVER) ? $_SERVER[
'SERVER_NAME'] : self::$cfg->defaultServerName);
140 $stdPort = $secure ?
'443' :
'80';
141 $port = (array_key_exists(
'SERVER_PORT', $_SERVER) && $_SERVER[
'SERVER_PORT'] != $stdPort && $_SERVER[
'SERVER_PORT'])?
':'.$_SERVER[
'SERVER_PORT'] :
'';
142 $domain = $protocol.
'://'.$serverName.$port;
144 $scriptName = $_SERVER[
'SCRIPT_NAME'];
145 $requestUri = urldecode(array_key_exists(
'REQUEST_URI', $_SERVER) ? $_SERVER[
'REQUEST_URI'] : (
'/'.$scriptName.(array_key_exists(1, $_SERVER[
'argv']) ? $_SERVER[
'argv'][1] :
'')));
148 $forceServerName = null;
149 if (self::$cfg->forceServerName
150 && strpos($serverName,
'localhost') ===
false 151 && strtolower(self::$cfg->forceServerName) != strtolower($serverName)) {
152 $forceServerName = self::$cfg->forceServerName;
153 $redir = $protocol.
'://'.$forceServerName.$port.$requestUri;
155 if (self::$cfg->forceNoOut
157 && ($pos = strpos($requestUri, self::$cfg->noOut))
158 && $pos + strlen(self::$cfg->noOut) == strlen($requestUri)
161 $redir = substr($redir, 0, -1*(strlen(self::$cfg->noOut)+1));
163 $redir = $domain.substr($requestUri, 0, $pos-1);
165 if (self::$cfg->noController && strpos($requestUri, self::$cfg->noController) !==
false) {
167 $redir = $domain.$requestUri;
168 $redir = str_replace(self::$cfg->noController.
'/',
'', $redir);
169 if ($pos = strpos($redir, self::$cfg->noController))
170 $redir = substr($redir, 0, $pos);
174 $requestUriTmp = explode(
'/', substr($requestUri, 1));
175 $scriptNameTmp = explode(
'/', substr($scriptName, 1));
176 $min = min(count($requestUriTmp), count($scriptNameTmp));
178 while ($i < $min && $requestUriTmp[$i] == $scriptNameTmp[$i]) {
179 $path.= $requestUriTmp[$i].
'/';
183 $pathWithController = (strpos($requestUri, $controller) !==
false);
185 if ($pathWithController) {
186 if (strpos($path, $controller) !==
false)
187 $path = substr($path, 0, -strlen($controller)-1);
188 $len = strlen($path.$controller);
189 $request = (isset($requestUri[$len]) && $requestUri[$len] ==
'?') ?
'' : substr($requestUri, $len+1);
191 $request = substr($requestUri, strlen($path));
193 if (self::$cfg->forceNoLang) {
194 $forceNoLang = self::$cfg->forceNoLang ===
true ? self::$cfg->lang : self::$cfg->forceNoLang;
195 if ($requestUri != $path && strpos($requestUri,
'/'.$forceNoLang.
'/') !==
false && $request) {
196 $redir = str_replace(
'/'.$forceNoLang.
'/',
'/', $redir ? $redir : $domain.$requestUri);
198 }
else if (self::$cfg->forceLang) {
199 $forceLang = self::$cfg->forceLang ===
true ? self::$cfg->lang : self::$cfg->forceLang;
200 if ($requestUri != $path && strpos($requestUri,
'/'.$forceLang.
'/') ===
false 204 $cpt = count(self::$cfg->noForceLang);
205 while($continue && $i < $cpt) {
206 if (strpos($request, self::$cfg->noForceLang[$i]) === 0)
212 $redirWork = $redir ? $redir : $domain.$requestUri;
213 $search = ($forceServerName ? $forceServerName : $domain).$path.($pathWithController? $controller.
'/' : null);
214 $pos = strpos($redirWork, $search) + strlen($search);
215 $end = $pos < strlen($redirWork) ? strpos($redirWork,
'/', $pos+1) :
false;
216 $end = $end ? $end-$pos : strlen($redirWork);
217 $curLang = substr($redirWork, $pos, $end);
218 if (!self::isLang($curLang))
219 $redir = substr($redirWork, 0, $pos).$forceLang.
'/'.substr($redirWork, $pos);
225 header(
'HTTP/1.0 301 Moved Permanently');
226 header(
'Location: '.$redir);
230 self::extractGet($request,
true);
232 self::$requestedUriInfo = self::analyseRequest($request);
234 self::$uriInfo = array_merge(array(
236 'protocol'=>$protocol,
237 'controller'=>$controller,
238 'serverName'=>$serverName,
241 'pathWithController'=>$pathWithController,
243 'lang'=>self::$cfg->lang,
244 'module'=>self::$cfg->module,
245 'moduleScaffold'=>null,
246 'action'=>self::$cfg->action,
247 'param'=>self::$cfg->param,
248 'text'=>self::$cfg->text,
249 'out'=>self::$cfg->out
250 ), self::$requestedUriInfo);
262 if (!empty($_FILES)) {
264 foreach($_FILES as $k=>$p) {
265 if (is_array($p[
'name'])) {
266 if (is_array(current($p[
'name']))) {
269 foreach($p[
'name'] as $i=>$v) {
270 foreach($v as $kk=>$vv) {
271 $tmp[$k][$i][$kk] = array(
273 'type'=>$_FILES[$k][
'type'][$i][$kk],
274 'tmp_name'=>$_FILES[$k][
'tmp_name'][$i][$kk],
275 'error'=>$_FILES[$k][
'error'][$i][$kk],
276 'size'=>$_FILES[$k][
'size'][$i][$kk],
283 foreach($p[
'name'] as $i=>$v) {
284 $tmp[$k][$i] = array(
286 'type'=>$_FILES[$k][
'type'][$i],
287 'tmp_name'=>$_FILES[$k][
'tmp_name'][$i],
288 'error'=>$_FILES[$k][
'error'][$i],
289 'size'=>$_FILES[$k][
'size'][$i],
308 $tmp = explode(self::$cfg->sepParam, $param);
309 foreach($tmp as $t) {
310 if (strpos($t, self::$cfg->sepParamSub)) {
311 list($key, $val) = explode(self::$cfg->sepParamSub, $t);
327 if (is_array($param)) {
329 foreach($param as $key=>$val) {
332 if (!is_numeric($key))
333 $tmp[] = $key.self::$cfg->sepParamSub.$val;
337 $ret = implode(self::$cfg->sepParam, $tmp);
351 self::$uriInfo = array_merge(self::$uriInfo, self::analyseRequest($request));
353 return self::execModule();
360 if (!self::get(
'secure'))
361 response::getInstance()->redirect(str_replace(
'http://',
'https://', self::uriDef(array(
'absolute'=>1))));
387 public static function get($get = null) {
389 return self::get(
'domain').self::getPathControllerUri().self::get(
'request');
390 if ($get ==
'localUri')
391 return self::getPathControllerUri().self::get(
'request');
392 if ($get ==
'pathUri')
393 return self::getPathControllerUri().self::get(
'request');
394 if ($get ==
'rootUri')
395 return self::get(
'domain').self::get(
'path');
396 else if ($get == null)
397 return self::$uriInfo;
399 return self::$uriInfo[$get];
414 }
else if (array_key_exists($get, self::$requestedUriInfo))
415 return self::$requestedUriInfo[$get];
426 public static function getCfg($key = null) {
428 return self::$cfg->getVars();
430 return self::$cfg->get($key);
440 return array_key_exists($key, self::get(
'paramA'));
450 public static function getPrm($key, $default = null) {
451 $prmA = self::get(
'paramA');
452 return array_key_exists($key, $prmA)? $prmA[$key] : $default;
462 $controller = ($forceController || self::get(
'pathWithController'))? self::get(
'controller').
'/': null;
463 return self::get(
'path').$controller;
483 public static function uri($prm = array()) {
485 $prm = self::uriString($prm);
487 if (self::isAbsolutizeAllUris() && !isset($prm[
'absolute']))
488 $prm[
'absolute'] =
true;
490 $sep = array_key_exists(
'sep', $prm)? $prm[
'sep'] : self::$cfg->sep;
492 $tmp = array_fill(0, 4, self::$cfg->empty);
494 if (array_key_exists(
'moduleScaffold', $prm) && !empty($prm[
'moduleScaffold']))
496 else if (array_key_exists(
'module', $prm) && !empty($prm[
'module']))
499 if (array_key_exists(
'action', $prm) && !empty($prm[
'action']))
500 $tmp[1] = $prm[
'action'];
502 if (array_key_exists(
'paramA', $prm) && is_array($prm[
'paramA']))
503 $tmp[2] = self::createParam($prm[
'paramA'],
false);
504 else if (array_key_exists(
'param', $prm) && !empty($prm[
'param']))
505 $tmp[2] = $prm[
'param'];
507 if (array_key_exists(
'text', $prm) && !empty($prm[
'text']))
510 while(count($tmp) > 0 && (empty($tmp[count($tmp) - 1]) || $tmp[count($tmp) - 1] == self::$cfg->empty))
513 $out = (array_key_exists(
'out', $prm) ?
514 (self::isOut($prm[
'out'])? $prm[
'out'] : null)
515 : self::getRequested(
'out'));
516 if (is_null($out) && (!isset($prm[
'out']) || is_null($prm[
'out'])))
517 $out = self::$cfg->defaultOut;
519 if (
false && empty($tmp))
520 $tmp[] = self::$cfg->empty.
'.'.$out;
521 else if (!empty($tmp) && $out != self::$cfg->noOut)
522 $tmp[count($tmp) - 1] .=
'.'.$out;
525 $forceLang = self::$cfg->forceLang ? (self::$cfg->forceLang ===
true ? self::$cfg->lang : self::$cfg->forceLang) : null;
526 if (array_key_exists(
'lang', $prm)) {
527 if (self::isLang($prm[
'lang']))
528 array_unshift($tmp, $prm[
'lang']);
530 array_unshift($tmp, $forceLang);
531 }
else if (self::getRequested(
'lang'))
532 array_unshift($tmp, self::getRequested(
'lang'));
533 else if (self::$cfg->lang != self::get(
'lang'))
534 array_unshift($tmp, self::get(
'lang'));
535 else if ($forceLang && count($tmp))
536 array_unshift($tmp, $forceLang);
537 if ($forceLang && count($tmp) == 1 && $tmp[0] == $forceLang)
540 $prefix = array_key_exists(
'absolute', $prm) && $prm[
'absolute']?
request::get(
'domain') : null;
541 $prefix.= self::get(
'path');
542 if (array_key_exists(
'controller', $prm)) {
543 if ($prm[
'controller'])
544 array_unshift($tmp, $prm[
'controller']);
545 }
else if (self::get(
'pathWithController'))
549 $t = str_replace(array(
' ',
'/'), self::$cfg->empty, $t);
551 return $prefix.implode($sep, $tmp);
562 return self::uri(array_merge(array(
564 'module'=>
'nyroUtils',
565 'action'=>
'uploadedFiles',
579 public static function uriDef(array $prm = array(), array $use = array(
'lang',
'module',
'action',
'param',
'out')) {
583 $tmp[$u] = self::getRequested($u);
585 return self::uri(array_merge($tmp, $prm));
597 $uriA = array_values(array_filter(explode(self::$cfg->sep, $uri)));
601 return array(
'controller'=>
false);
603 return array('absolute
'=>true, 'controller
'=>false); 609 if (strpos($uriA[0], '.php
')) 610 $tmp['controller
'] = array_shift($uriA); 613 if (self::isLang($uriA[0])) 614 $tmp['lang
'] = array_shift($uriA); 616 $last = $uriA[count($uriA)-1]; 617 if ((($pos = strrpos($last, '.
')) !== false) && self::isOut($out = substr($last, $pos+1))) { 619 $uriA[count($uriA)-1] = substr($last, 0, $pos); 621 $keys = array('module
', 'action
', 'param
', 'text
'); 622 $min = min(count($keys), count($uriA)); 623 $keys = array_slice($keys, 0, $min); 624 $uriA = array_slice($uriA, 0, $min); 625 $tmp = array_merge($tmp, array_combine($keys, $uriA)); 629 if (substr($uri, 0, 2) == ' 630 $tmp[
'controller'] =
false;
631 if (substr($uri, 0, 3) ==
' 632 $tmp['absolute
'] = true; 644 public static function webUri($uri, $absolute = false) { 645 return ($absolute || self::isAbsolutizeAllUris() ? self::get('domain
') : null).self::get('path
').$uri; 653 public static function isAbsolutizeAllUris() { 654 return self::$cfg->absolutizeAllUris; 662 public static function getIp() { 663 return $_SERVER['REMOTE_ADDR
']; 671 public static function isPost() { 672 return !empty($_POST); 680 public static function isLocal() { 681 return !self::get('serverName
') || self::get('serverName
') == 'localhost
'; 689 public static function isAjax() { 690 return isset($_SERVER['HTTP_X_REQUESTED_WITH
']) && $_SERVER['HTTP_X_REQUESTED_WITH
'] == 'XMLHttpRequest
'; 702 public static function isMobile($test = null) { 703 if (self::$mobileStatus === false) { 704 // code from http://detectmobilebrowsers.mobi/ 705 // Modified to be simpler and suite the nyroFwk need 706 // many comments removed 708 $user_agent = $_SERVER['HTTP_USER_AGENT
']; 709 $accept = $_SERVER['HTTP_ACCEPT
']; 710 self::$mobileStatus = null; 713 case (preg_match('/ipad/i
',$user_agent)); 714 self::$mobileStatus = 'ipad
'; 716 case (preg_match('/ipod/i
',$user_agent)||preg_match('/iphone/i
',$user_agent)); 717 self::$mobileStatus = 'iphone
'; 719 case (preg_match('/android/i
',$user_agent)); 720 self::$mobileStatus = 'android
'; 722 case (preg_match('/opera mini/i
',$user_agent)); 723 self::$mobileStatus = 'opera
'; 725 case (preg_match('/blackberry/i
',$user_agent)); 726 self::$mobileStatus = 'blackberry
'; 728 case (preg_match('/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i
',$user_agent)); 729 self::$mobileStatus = 'palm
'; 731 case (preg_match('/(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i
',$user_agent)); 732 self::$mobileStatus = 'windows
'; 734 case (preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i
',$user_agent)); 735 case ((strpos($accept,'text/vnd.wap.wml
')>0)||(strpos($accept,'application/vnd.wap.xhtml+xml
')>0)); 736 case (isset($_SERVER['HTTP_X_WAP_PROFILE
'])||isset($_SERVER['HTTP_PROFILE
'])); 737 case (in_array(strtolower(substr($user_agent,0,4)),array('1207
'=>'1207
','3gso
'=>'3gso
','4thp
'=>'4thp
','501i
'=>'501i
','502i
'=>'502i
','503i
'=>'503i
','504i
'=>'504i
','505i
'=>'505i
','506i
'=>'506i
','6310
'=>'6310
','6590
'=>'6590
','770s
'=>'770s
','802s
'=>'802s
','a wa
'=>'a wa
','acer
'=>'acer
','acs-
'=>'acs-
','airn
'=>'airn
','alav
'=>'alav
','asus
'=>'asus
','attw
'=>'attw
','au-m
'=>'au-m
','aur
'=>'aur
','aus
'=>'aus
','abac
'=>'abac
','acoo
'=>'acoo
','aiko
'=>'aiko
','alco
'=>'alco
','alca
'=>'alca
','amoi
'=>'amoi
','anex
'=>'anex
','anny
'=>'anny
','anyw
'=>'anyw
','aptu
'=>'aptu
','arch
'=>'arch
','argo
'=>'argo
','bell
'=>'bell
','bird
'=>'bird
','bw-n
'=>'bw-n
','bw-u
'=>'bw-u
','beck
'=>'beck
','benq
'=>'benq
','bilb
'=>'bilb
','blac
'=>'blac
','c55/
'=>'c55/
','cdm-
'=>'cdm-
','chtm
'=>'chtm
','capi
'=>'capi
','cond
'=>'cond
','craw
'=>'craw
','dall
'=>'dall
','dbte
'=>'dbte
','dc-s
'=>'dc-s
','dica
'=>'dica
','ds-d
'=>'ds-d
','ds12
'=>'ds12
','dait
'=>'dait
','devi
'=>'devi
','dmob
'=>'dmob
','doco
'=>'doco
','dopo
'=>'dopo
','el49
'=>'el49
','erk0
'=>'erk0
','esl8
'=>'esl8
','ez40
'=>'ez40
','ez60
'=>'ez60
','ez70
'=>'ez70
','ezos
'=>'ezos
','ezze
'=>'ezze
','elai
'=>'elai
','emul
'=>'emul
','eric
'=>'eric
','ezwa
'=>'ezwa
','fake
'=>'fake
','fly-
'=>'fly-
','fly_
'=>'fly_
','g-mo
'=>'g-mo
','g1 u
'=>'g1 u
','g560
'=>'g560
','gf-5
'=>'gf-5
','grun
'=>'grun
','gene
'=>'gene
','go.w
'=>'go.w
','good
'=>'good
','grad
'=>'grad
','hcit
'=>'hcit
','hd-m
'=>'hd-m
','hd-p
'=>'hd-p
','hd-t
'=>'hd-t
','hei-
'=>'hei-
','hp i
'=>'hp i
','hpip
'=>'hpip
','hs-c
'=>'hs-c
','htc
'=>'htc
','htc-
'=>'htc-
','htca
'=>'htca
','htcg
'=>'htcg
','htcp
'=>'htcp
','htcs
'=>'htcs
','htct
'=>'htct
','htc_
'=>'htc_
','haie
'=>'haie
','hita
'=>'hita
','huaw
'=>'huaw
','hutc
'=>'hutc
','i-20
'=>'i-20
','i-go
'=>'i-go
','i-ma
'=>'i-ma
','i230
'=>'i230
','iac
'=>'iac
','iac-
'=>'iac-
','iac/
'=>'iac/
','ig01
'=>'ig01
','im1k
'=>'im1k
','inno
'=>'inno
','iris
'=>'iris
','jata
'=>'jata
','java
'=>'java
','kddi
'=>'kddi
','kgt
'=>'kgt
','kgt/
'=>'kgt/
','kpt
'=>'kpt
','kwc-
'=>'kwc-
','klon
'=>'klon
','lexi
'=>'lexi
','lg g
'=>'lg g
','lg-a
'=>'lg-a
','lg-b
'=>'lg-b
','lg-c
'=>'lg-c
','lg-d
'=>'lg-d
','lg-f
'=>'lg-f
','lg-g
'=>'lg-g
','lg-k
'=>'lg-k
','lg-l
'=>'lg-l
','lg-m
'=>'lg-m
','lg-o
'=>'lg-o
','lg-p
'=>'lg-p
','lg-s
'=>'lg-s
','lg-t
'=>'lg-t
','lg-u
'=>'lg-u
','lg-w
'=>'lg-w
','lg/k
'=>'lg/k
','lg/l
'=>'lg/l
','lg/u
'=>'lg/u
','lg50
'=>'lg50
','lg54
'=>'lg54
','lge-
'=>'lge-
','lge/
'=>'lge/
','lynx
'=>'lynx
','leno
'=>'leno
','m1-w
'=>'m1-w
','m3ga
'=>'m3ga
','m50/
'=>'m50/
','maui
'=>'maui
','mc01
'=>'mc01
','mc21
'=>'mc21
','mcca
'=>'mcca
','medi
'=>'medi
','meri
'=>'meri
','mio8
'=>'mio8
','mioa
'=>'mioa
','mo01
'=>'mo01
','mo02
'=>'mo02
','mode
'=>'mode
','modo
'=>'modo
','mot
'=>'mot
','mot-
'=>'mot-
','mt50
'=>'mt50
','mtp1
'=>'mtp1
','mtv
'=>'mtv
','mate
'=>'mate
','maxo
'=>'maxo
','merc
'=>'merc
','mits
'=>'mits
','mobi
'=>'mobi
','motv
'=>'motv
','mozz
'=>'mozz
','n100
'=>'n100
','n101
'=>'n101
','n102
'=>'n102
','n202
'=>'n202
','n203
'=>'n203
','n300
'=>'n300
','n302
'=>'n302
','n500
'=>'n500
','n502
'=>'n502
','n505
'=>'n505
','n700
'=>'n700
','n701
'=>'n701
','n710
'=>'n710
','nec-
'=>'nec-
','nem-
'=>'nem-
','newg
'=>'newg
','neon
'=>'neon
','netf
'=>'netf
','noki
'=>'noki
','nzph
'=>'nzph
','o2 x
'=>'o2 x
','o2-x
'=>'o2-x
','opwv
'=>'opwv
','owg1
'=>'owg1
','opti
'=>'opti
','oran
'=>'oran
','p800
'=>'p800
','pand
'=>'pand
','pg-1
'=>'pg-1
','pg-2
'=>'pg-2
','pg-3
'=>'pg-3
','pg-6
'=>'pg-6
','pg-8
'=>'pg-8
','pg-c
'=>'pg-c
','pg13
'=>'pg13
','phil
'=>'phil
','pn-2
'=>'pn-2
','pt-g
'=>'pt-g
','palm
'=>'palm
','pana
'=>'pana
','pire
'=>'pire
','pock
'=>'pock
','pose
'=>'pose
','psio
'=>'psio
','qa-a
'=>'qa-a
','qc-2
'=>'qc-2
','qc-3
'=>'qc-3
','qc-5
'=>'qc-5
','qc-7
'=>'qc-7
','qc07
'=>'qc07
','qc12
'=>'qc12
','qc21
'=>'qc21
','qc32
'=>'qc32
','qc60
'=>'qc60
','qci-
'=>'qci-
','qwap
'=>'qwap
','qtek
'=>'qtek
','r380
'=>'r380
','r600
'=>'r600
','raks
'=>'raks
','rim9
'=>'rim9
','rove
'=>'rove
','s55/
'=>'s55/
','sage
'=>'sage
','sams
'=>'sams
','sc01
'=>'sc01
','sch-
'=>'sch-
','scp-
'=>'scp-
','sdk/
'=>'sdk/
','se47
'=>'se47
','sec-
'=>'sec-
','sec0
'=>'sec0
','sec1
'=>'sec1
','semc
'=>'semc
','sgh-
'=>'sgh-
','shar
'=>'shar
','sie-
'=>'sie-
','sk-0
'=>'sk-0
','sl45
'=>'sl45
','slid
'=>'slid
','smb3
'=>'smb3
','smt5
'=>'smt5
','sp01
'=>'sp01
','sph-
'=>'sph-
','spv
'=>'spv
','spv-
'=>'spv-
','sy01
'=>'sy01
','samm
'=>'samm
','sany
'=>'sany
','sava
'=>'sava
','scoo
'=>'scoo
','send
'=>'send
','siem
'=>'siem
','smar
'=>'smar
','smit
'=>'smit
','soft
'=>'soft
','sony
'=>'sony
','t-mo
'=>'t-mo
','t218
'=>'t218
','t250
'=>'t250
','t600
'=>'t600
','t610
'=>'t610
','t618
'=>'t618
','tcl-
'=>'tcl-
','tdg-
'=>'tdg-
','telm
'=>'telm
','tim-
'=>'tim-
','ts70
'=>'ts70
','tsm-
'=>'tsm-
','tsm3
'=>'tsm3
','tsm5
'=>'tsm5
','tx-9
'=>'tx-9
','tagt
'=>'tagt
','talk
'=>'talk
','teli
'=>'teli
','topl
'=>'topl
','hiba
'=>'hiba
','up.b
'=>'up.b
','upg1
'=>'upg1
','utst
'=>'utst
','v400
'=>'v400
','v750
'=>'v750
','veri
'=>'veri
','vk-v
'=>'vk-v
','vk40
'=>'vk40
','vk50
'=>'vk50
','vk52
'=>'vk52
','vk53
'=>'vk53
','vm40
'=>'vm40
','vx98
'=>'vx98
','virg
'=>'virg
','vite
'=>'vite
','voda
'=>'voda
','vulc
'=>'vulc
','w3c
'=>'w3c
','w3c-
'=>'w3c-
','wapj
'=>'wapj
','wapp
'=>'wapp
','wapu
'=>'wapu
','wapm
'=>'wapm
','wig
'=>'wig
','wapi
'=>'wapi
','wapr
'=>'wapr
','wapv
'=>'wapv
','wapy
'=>'wapy
','wapa
'=>'wapa
','waps
'=>'waps
','wapt
'=>'wapt
','winc
'=>'winc
','winw
'=>'winw
','wonu
'=>'wonu
','x700
'=>'x700
','xda2
'=>'xda2
','xdag
'=>'xdag
','yas-
'=>'yas-
','your
'=>'your
','zte-
'=>'zte-
','zeto
'=>'zeto
','acs-
'=>'acs-
','alav
'=>'alav
','alca
'=>'alca
','amoi
'=>'amoi
','aste
'=>'aste
','audi
'=>'audi
','avan
'=>'avan
','benq
'=>'benq
','bird
'=>'bird
','blac
'=>'blac
','blaz
'=>'blaz
','brew
'=>'brew
','brvw
'=>'brvw
','bumb
'=>'bumb
','ccwa
'=>'ccwa
','cell
'=>'cell
','cldc
'=>'cldc
','cmd-
'=>'cmd-
','dang
'=>'dang
','doco
'=>'doco
','eml2
'=>'eml2
','eric
'=>'eric
','fetc
'=>'fetc
','hipt
'=>'hipt
','http
'=>'http
','ibro
'=>'ibro
','idea
'=>'idea
','ikom
'=>'ikom
','inno
'=>'inno
','ipaq
'=>'ipaq
','jbro
'=>'jbro
','jemu
'=>'jemu
','java
'=>'java
','jigs
'=>'jigs
','kddi
'=>'kddi
','keji
'=>'keji
','kyoc
'=>'kyoc
','kyok
'=>'kyok
','leno
'=>'leno
','lg-c
'=>'lg-c
','lg-d
'=>'lg-d
','lg-g
'=>'lg-g
','lge-
'=>'lge-
','libw
'=>'libw
','m-cr
'=>'m-cr
','maui
'=>'maui
','maxo
'=>'maxo
','midp
'=>'midp
','mits
'=>'mits
','mmef
'=>'mmef
','mobi
'=>'mobi
','mot-
'=>'mot-
','moto
'=>'moto
','mwbp
'=>'mwbp
','mywa
'=>'mywa
','nec-
'=>'nec-
','newt
'=>'newt
','nok6
'=>'nok6
','noki
'=>'noki
','o2im
'=>'o2im
','opwv
'=>'opwv
','palm
'=>'palm
','pana
'=>'pana
','pant
'=>'pant
','pdxg
'=>'pdxg
','phil
'=>'phil
','play
'=>'play
','pluc
'=>'pluc
','port
'=>'port
','prox
'=>'prox
','qtek
'=>'qtek
','qwap
'=>'qwap
','rozo
'=>'rozo
','sage
'=>'sage
','sama
'=>'sama
','sams
'=>'sams
','sany
'=>'sany
','sch-
'=>'sch-
','sec-
'=>'sec-
','send
'=>'send
','seri
'=>'seri
','sgh-
'=>'sgh-
','shar
'=>'shar
','sie-
'=>'sie-
','siem
'=>'siem
','smal
'=>'smal
','smar
'=>'smar
','sony
'=>'sony
','sph-
'=>'sph-
','symb
'=>'symb
','t-mo
'=>'t-mo
','teli
'=>'teli
','tim-
'=>'tim-
','tosh
'=>'tosh
','treo
'=>'treo
','tsm-
'=>'tsm-
','upg1
'=>'upg1
','upsi
'=>'upsi
','vk-v
'=>'vk-v
','voda
'=>'voda
','vx52
'=>'vx52
','vx53
'=>'vx53
','vx60
'=>'vx60
','vx61
'=>'vx61
','vx70
'=>'vx70
','vx80
'=>'vx80
','vx81
'=>'vx81
','vx83
'=>'vx83
','vx85
'=>'vx85
','wap-
'=>'wap-
','wapa
'=>'wapa
','wapi
'=>'wapi
','wapp
'=>'wapp
','wapr
'=>'wapr
','webc
'=>'webc
','whit
'=>'whit
','winw
'=>'winw
','wmlb
'=>'wmlb
','xda-
'=>'xda-
',))); 738 self::$mobileStatus = 'other
'; 743 if (!is_null(self::$mobileStatus)) { 744 if (!is_null($test)) { 745 if (is_array($test)) { 746 $test = array_map('strtolower
', $test); 747 return in_array(self::$mobileStatus, $test); 749 return self::$mobileStatus == strtolower($test); 762 public static function isScaffolded() { 763 return self::$scaffold; 774 public static function extractGet(&$request, $affectGet = false) { 775 $req = explode('?
', $request); 777 $get = array_key_exists(1, $req) ? $req[1] : null; 780 $tmp = array_filter(explode('&
', $get)); 781 foreach($tmp as $elm) { 782 if (strpos($elm, '=
')) { 783 list($name, $val) = explode('=
', $elm); 800 public static function analyseRequest($request, $alias = true) { 802 $request = self::alias($request); 804 $request = trim($request, self::$cfg->sep); 808 $out = strtolower(file::getExt($request)); 809 if ($out && self::isOut($out)) { 811 $request = substr($request, 0, strlen($request) - (strlen($out) + 1)); 814 $tmp = explode(self::$cfg->sep, $request); 815 if (self::isLang($tmp[0])) 816 $ret['lang
'] = array_shift($tmp); 818 if (($t = array_shift($tmp)) && $t != self::$cfg->empty) 821 if (($t = array_shift($tmp)) && $t != self::$cfg->empty) 824 $ret['paramA
'] = array(); 825 if (($t = array_shift($tmp)) && $t != self::$cfg->empty) { 827 $ret['paramA
'] = self::parseParam($ret['param
']); 830 if (($t = array_shift($tmp)) && $t != self::$cfg->empty) 842 public static function alias($request) { 843 if (substr($request, 0, 1) != '/
') 844 $request = '/
'.$request; 845 foreach(self::$cfg->alias as $k=>$v) { 846 $req = preg_replace('`^
'.$k.'$`
', $v, $request); 847 if ($req != $request) 848 return substr($req, 1); 850 return substr($request, 1); 859 public static function removeLangOutUrl($request) { 860 return preg_replace('`(.*)(\.
'.implode('|\.
', array_keys(self::$cfg->outCfg)).')`
', '$1
', 861 preg_replace('`(/
'.implode('|/
', self::avlLang()).')?(/.*)`
', '$2
', $request)); 867 private static function initModule() { 868 if (!self::$module) { 869 self::$module = factory::getModule(self::$uriInfo['module
'], array(), self::$scaffold, self::$cfg->allowScaffold); 870 if (self::$module instanceof module_scaffold_controller && !self::$cfg->allowScaffold) { 871 // Need to test if the action was expressly defined 872 $ref = new nReflection(); 873 $className = 'module_
'.self::$uriInfo['module
'].'_controller
'; 876 $action = self::$uriInfo['action
']; 877 if (array_key_exists(NYROENV, self::$module->getCfg()->basicPrefixExec) && 878 in_array($action, self::$module->getCfg()->getInArray('basicPrefixExec
', NYROENV))) 879 $prefix = ucfirst(NYROENV); 880 else if (self::$module->getCfg()->prefixExec && !in_array($action, self::$module->getCfg()->noPrefixExec)) 881 $prefix = self::$module->getCfg()->prefixExec; 883 $exec = 'exec
'.$prefix.ucFirst($action); 884 if ($ref->rebuild($className)) { 885 if ($ref->getMethod($exec)->getDeclaringClass()->name != $className) 886 throw new module_exception('Request -
initModule:
'.self::$uriInfo['module
'].'.
'.$exec.' not found.
'); 889 if (self::$scaffold) { 890 self::$uriInfo['moduleScaffold
'] = self::$uriInfo['module
']; 891 self::$uriInfo['module
'] = 'scaffold
'; 901 public static function getModule() { 903 return self::$module; 911 public static function execModule() { 913 return self::$module->exec(self::$uriInfo); 921 public static function publishModule() { 923 return self::$module->publish(); 932 public static function isLang($lang) { 933 return in_array($lang, self::avlLang()); 942 public static function avlLang($withName = false) { 944 return self::$cfg->avlLang; 945 return array_keys(self::$cfg->avlLang); 953 public static function getDefaultLang() { 954 return self::$cfg->defaultLang ? self::$cfg->defaultLang : self::$cfg->lang; 963 public static function isOut($out) { 964 return $out && array_key_exists($out, self::$cfg->outCfg); 972 public static function getResponseName() { 973 return self::get('out
') ? self::$cfg->outCfg[self::get('out
')] : 'http
';
static getModule($name, array $cfg=array(), &$scaffold=false, $allowScaffold=true)
static urlify($text, $ignore=null)
static parseParam($param)
static createParam($param, $urlify=true)
static getPathControllerUri($forceController=false)
static getPrm($key, $default=null)
static loadCfg($className, $searchParent=true)
static uploadedUri($file, array $prm=array())
static getRequested($get=null)
static uriDef(array $prm=array(), array $use=array('lang', 'module', 'action', 'param', 'out'))