6 * - base application setup (variables etc to javascript)
8 * - authentication and permission info about user / application
9 * - json output methods.
10 * - file upload error checking - checkFileUploadError
11 * - logging to event table
12 * - sendTemplate code (normally use the Person version for sending to specific people..)
14 * - doc managment code?? - remarks and tracking??? - MOVEME
15 * - authentication link checking?? MOVEME?
16 * - authentication reset password ?? MOVEME?
17 * ?? arrayClean.. what's it doing here?!? ;)
21 * Pman['local_autoauth'] // who to login as when using localhost
22 * Pman['isDev'] // can the site show develpment info.?
23 * Pman['uiConfig'] // extra variable to export to front end..
24 * Pman['auth_comptype'] // -- if set to 'OWNER' then only users with company=OWNER can log in
25 * Pman['authTable'] // the authentication table (default 'person')
29 * DB_DataObject*:*toEventString (for logging - this is generically prefixed to all database operations.)
30 * - any data object where this method exists, the result will get prefixed to the log remarks
36 require_once 'Pman/Core/AssetTrait.php';
37 require_once 'Pman/Core/JsonOutputTrait.php';
40 class Pman extends HTML_FlexyFramework_Page
42 use Pman_Core_AssetTrait,
43 //outputJavascriptDir()
46 Pman_Core_JsonOutputTrait;
58 var $appShortName= "";
59 var $appVersion = "1.8";
66 var $appDisabled = array(); // array of disabled modules..
67 // (based on config option disable)
69 var $authUser; // always contains the authenticated user..
71 var $disable_jstemplate = false; /// disable inclusion of jstemplate code..
74 var $css_path = ''; // can inject a specific path into the base HTML page.
77 var $transObj = false; // used to rollback or commit in JOK/JERR
79 // these are used somewhere -
80 var $builderJs = false;//
81 var $serverName = false;
83 var $allowSignup = false;
90 * ------------- Standard getAuth/get/post methods of framework.
95 function getAuth() // everyone allowed in!!!!!
97 $this->loadOwnerCompany();
102 function init($base = false)
105 if (isset($this->_hasInit)) {
108 $this->_hasInit = true;
109 // move away from doing this ... you can access bootLoader.XXXXXX in the master template..
110 $boot = HTML_FlexyFramework::get();
111 // echo'<PRE>';print_R($boot);exit;
112 $this->appName = $boot->appName;
114 $this->appNameShort = $boot->appNameShort;
116 $this->appModules = $boot->enable;
118 // echo $this->arrayToJsInclude($files);
119 $this->isDev = empty($boot->Pman['isDev']) ? false : $boot->Pman['isDev'];
121 $this->css_path = empty($boot->Pman['css_path']) ? '' : $boot->Pman['css_path'];
123 $this->appDisable = $boot->disable;
124 $this->appDisabled = explode(',', $boot->disable);
125 $this->version = $boot->version;
126 $this->appVersion = $boot->version;
127 $this->uiConfig = empty($boot->Pman['uiConfig']) ? false : $boot->Pman['uiConfig'];
129 if (!empty($boot->Pman['local_autoauth']) &&
130 !empty($_SERVER['SERVER_ADDR']) &&
131 !empty($_SERVER['REMOTE_ADDR']) &&
132 ($_SERVER['SERVER_ADDR'] == '127.0.0.1') &&
133 ($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
139 !empty($_REQUEST['isDev'])
143 !empty($_SERVER['SERVER_ADDR']) &&
145 (($_SERVER['SERVER_ADDR'] == '127.0.0.1') && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1'))
147 (($_SERVER['SERVER_ADDR'] == '::1') && ($_SERVER['REMOTE_ADDR'] == '::1'))
149 (preg_match('/^192\.168/', $_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] == $_SERVER['HTTP_HOST'])
153 !empty($boot->Pman['enable_isdev_url'])
157 $boot->Pman['isDev'] = true;
161 // if a file Pman_{module}_Pman exists.. and it has an init function... - call that..
163 //var_dump($this->appModules);
169 * call a method on {module}/Pman.php
170 * * initially used on the main page load to call init();
171 * * also used for ccsIncludes??
173 * // usage: $this->callModules('init', $base)
177 function callModules($fn)
179 $args = func_get_args();
181 foreach(explode(',',$this->appModules) as $m) {
182 $cls = 'Pman_'. $m . '_Pman';
183 if (!file_exists($this->rootDir . '/'.str_replace('_','/', $cls). '.php')) {
186 require_once str_replace('_','/', $cls). '.php';
188 if (method_exists($c, $fn)) {
189 call_user_func_array(array($c,$fn),$args);
195 function get($base, $opts=array())
199 $this->callModules('init', $this, $base);
202 //$this->allowSignup= empty($opts['allowSignup']) ? 0 : 1;
203 $bits = explode('/', $base);
206 // should really be moved to Login...
208 if ($bits[0] == 'PasswordReset') {
209 $this->linkFail = $this->resetPassword(@$bits[1],@$bits[2],@$bits[3]);
210 header('Content-type: text/html; charset=utf-8');
215 $au = $this->getAuthUser();
217 $ff= HTML_FlexyFramework::get();
219 if (!empty($ff->Pman['auth_comptype']) && $au->id > 0 &&
220 ( !$au->company_id || ($ff->Pman['auth_comptype'] != $au->company()->comptype))) {
224 $this->jerr("Login not permited to outside companies - please reload");
226 $this->addEvent("RELOAD");
230 if (strlen($base) && $bits[0] != 'PasswordReset') {
231 $this->jerror("NOTICE-BADURL","invalid url: $base");
234 if (isset($_GET['onloadTrack'])) {
235 $this->onloadTrack = (int)$_GET['onloadTrack'];
237 // getting this to work with xhtml is a nightmare
238 // = nbsp / <img> issues screw everyting up.
239 //var_dump($this->isDev);
240 // force regeneration on load for development enviroments..
242 HTML_FlexyFramework::get()->generateDataobjectsCache($this->isDev && !empty($_REQUEST['isDev']));
244 //header('Content-type: application/xhtml+xml; charset=utf-8');
248 if ($this->company && $this->company->logo_id) {
249 $im = DB_DataObject::Factory('Images');
250 $im->get($this->company->logo_id);
251 $this->appLogo = $this->baseURL . '/Images/Thumb/x100/'. $this->company->logo_id .'/' . $im->filename;
254 header('Content-type: text/html; charset=utf-8');
257 function post($base) {
258 return $this->get($base);
262 // --------------- AUTHENTICATION or system information
265 * finds the compay with comptype=='OWNER'
266 * ?? what about comptype_id-name ?????
268 * @return {Pman_Core_DataObjects_Companies} the owner company
270 function loadOwnerCompany()
272 // only applies if authtable is person..
273 $ff = HTML_FlexyFramework::get();
274 if (!empty($ff->Pman['authTable']) && !in_array($ff->Pman['authTable'] , [ 'core_person', 'Person' ])) {
278 $this->company = DB_DataObject::Factory('core_company');
279 if (!is_a($this->company, 'DB_DataObject')) { // non-core pman projects
282 $e = DB_DataObject::Factory('core_enum')->lookupObject('COMPTYPE', 'OWNER');
284 $this->company->get('comptype_id', $e->id);
285 return $this->company;
289 static function staticGetAuthUser($t) {
290 if (!empty($t->authUser)) {
293 $ff = HTML_FlexyFramework::get();
294 $tbl = empty($ff->Pman['authTable']) ? 'core_person' : $ff->Pman['authTable'];
296 $u = DB_DataObject::factory( $tbl );
298 if (is_a($u,'PEAR_Error') || !$u->isAuth()) {
301 $t->authUser =$u->getAuthUser();
302 return $t->authUser ;
307 * getAuthUser: - get the authenticated user..
309 * @return {DB_DataObject} of type Pman[authTable] if authenticated.
312 function getAuthUser()
314 return self::staticGetAuthUser($this);
318 * wrapper arround authuser->hasPerm
319 * @see Pman_Core_DataObject_Core_person::hasPerm
321 * @param {String} $name The permission name (eg. Projects.List)
322 * @param {String} $lvl eg. (C)reate (E)dit (D)elete ... etc.
325 function hasPerm($name, $lvl) // do we have a permission
327 static $pcache = array();
328 $au = $this->getAuthUser();
329 return $au && $au->hasPerm($name,$lvl);
333 * modulesList: List the modules in the application
335 * @return {Array} list of modules
337 function modulesList()
339 $boot = HTML_FlexyFramework::get();
340 // echo'<PRE>';print_R($boot);exit;
343 $mods = explode(',', $boot->enable);
344 if (in_array('Core',$mods)) { // core has to be the first modules loaded as it contains Pman.js
345 array_unshift($mods, 'Core');
348 if (in_array($boot->appNameShort,$mods)) { // Project has to be the last modules loaded as it contains Pman.js
349 unset($mods[array_search($boot->appNameShort, $mods)]);
350 $mods[] = $boot->appNameShort;
353 $mods = array_unique($mods);
355 $disabled = explode(',', $boot->disable ? $boot->disable : '');
357 foreach($mods as $mod) {
358 // add the css file..
359 if (in_array($mod, $disabled)) {
370 function hasModule($name)
373 if (!strpos( $name,'.') ) {
374 // use enable / disable..
375 return in_array($name, $this->modules());
378 $x = DB_DataObject::factory('core_group_right');
379 $ar = $x->defaultPermData();
380 if (empty($ar[$name]) || empty($ar[$name][0])) {
390 * ---------------- Global Tools ---------------
392 function checkFileUploadError() // check for file upload errors.
395 empty($_FILES['File'])
396 || empty($_FILES['File']['name'])
397 || empty($_FILES['File']['tmp_name'])
398 || empty($_FILES['File']['type'])
399 || !empty($_FILES['File']['error'])
400 || empty($_FILES['File']['size'])
402 $this->jerr("File upload error: <PRE>" . print_r($_FILES,true) . print_r($_POST,true) . "</PRE>");
406 static $deleteOnExit = false;
408 * generate a tempory file with an extension (dont forget to delete it)
411 function deleteOnExitAdd($name)
413 if (self::$deleteOnExit === false) {
414 register_shutdown_function(array('Pman','deleteOnExit'));
415 self::$deleteOnExit = array();
417 self::$deleteOnExit[] = $name;
420 function tempName($ext, $deleteOnExit=false)
423 $x = tempnam(ini_get('session.save_path'), HTML_FlexyFramework::get()->appNameShort.'TMP');
425 $ret = $x .'.'. $ext;
427 $this->deleteOnExitAdd($ret);
433 static function deleteOnExit()
436 foreach(self::$deleteOnExit as $fn) {
437 if (file_exists($fn)) {
444 * ------------- Authentication password reset ------ ??? MOVEME?
457 * ---------------- OUTPUT
459 function hasBg($fn) // used on front page to check if logos exist..
461 return file_exists($this->rootDir.'/Pman/'.$this->appNameShort.'/templates/images/'. $fn);
464 * outputJavascriptIncludes:
466 * output <script....> for all the modules in the applcaiton
469 function outputJavascriptIncludes()
471 // BC support - currently 1 project still relies on this.. (MO portal)
472 $ff = HTML_FlexyFramework::get();
473 $o = isset($ff->Pman_Core) ? $ff->Pman_Core : array();
474 if (isset($o['packseed'])) {
475 return $this->outputJavascriptIncludesBC();
479 $mods = $this->modulesList();
482 $is_bootstrap = in_array('BAdmin', $mods);
484 foreach($mods as $mod) {
485 // add the css file..
488 if (!file_exists($this->rootDir."/Pman/$mod/is_bootstrap")) {
489 echo '<!-- missing '. $this->rootDir."/Pman/$mod/is_bootstrap - skipping -->";
495 $this->outputJavascriptDir("Pman/$mod/widgets", "*.js");
496 $this->outputJavascriptDir("Pman/$mod", "*.js");
500 if (empty($this->disable_jstemplate)) {
501 // and finally the JsTemplate...
502 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
505 $this->callModules('outputJavascriptIncludes', $this);
508 var $css_includes = array();
512 * output <link rel=stylesheet......> for all the modules in the applcaiton
515 * This could css minify as well.
517 function outputCSSIncludes() // includes on CSS links.
521 $mods = $this->modulesList();
522 $is_bootstrap = in_array('BAdmin', $mods);
524 $this->callModules('applyCSSIncludes', $this);
525 foreach($this->css_includes as $module => $ar) {
528 $this->assetArrayToHtml( $ar , 'css');
532 // old style... - probably remove this...
533 $this->callModules('outputCSSIncludes', $this);
535 foreach($mods as $mod) {
536 // add the css file..
537 if ($is_bootstrap && !file_exists($this->rootDir."/Pman/$mod/is_bootstrap")) {
538 echo '<!-- missing '. $this->rootDir."/Pman/$mod/is_bootstrap - skipping -->";
541 $this->outputCSSDir("Pman/$mod","*.css");
543 $this->outputSCSS($mod);
547 return ''; // needs to return something as we output it..
552 * while doing batch processes, the database sometimes get's locked up.
553 * if we are doing another batch process that can be avoided - we should just stop for a while..
556 function database_is_locked()
558 $cd = DB_DataObject::Factory('core_enum');
559 $cd->query("show processlist");
561 while ($cd->fetch()) {
562 if ($cd->State == 'Waiting for table metadata lock') {
577 // --- OLD CODE - in for BC on MO project.... - needs removing...
579 // used on old versions.....
580 function outputJavascriptIncludesBC()
583 $mods = $this->modulesList();
585 foreach($mods as $mod) {
586 // add the css file..
589 $files = $this->moduleJavascriptList($mod.'/widgets');
590 foreach($files as $f) {
591 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
594 $files = $this->moduleJavascriptList($mod);
595 foreach($files as $f) {
596 echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
600 if (empty($this->disable_jstemplate)) {
601 // and finally the JsTemplate...
602 echo '<script type="text/javascript" src="'. $this->baseURL. '/Core/JsTemplate"></script>'."\n";
607 * Gather infor for javascript files..
609 * @param {String} $mod the module to get info about.
610 * @return {StdClass} details about module.
612 function moduleJavascriptFilesInfo($mod)
615 static $cache = array();
617 if (isset($cache[$mod])) {
622 $ff = HTML_FlexyFramework::get();
624 $base = dirname($_SERVER['SCRIPT_FILENAME']);
625 $dir = $this->rootDir.'/Pman/'. $mod;
626 $path = $this->rootURL ."/Pman/$mod/";
628 $ar = glob($dir . '/*.js');
634 foreach($ar as $fn) {
636 // got the 'module file..'
637 $mtime = filemtime($dir . '/'. $f);
638 $maxtime = max($mtime, $maxtime);
639 $arfiles[$fn] = $mtime;
640 $files[] = $path . $f . '?ts='.$mtime;
643 ksort($arfiles); // just sort by name so it's consistant for serialize..
645 // The original idea of this was to serve the files direct from a publicly available 'cache' directory.
646 // but that doesnt really make sense - as we can just serve it from the session directory where we stick
647 // cached data anyway.
650 $compile = empty($ff->Pman['public_cache_dir']) ? 0 : 1;
651 $basedir = $compile ? $ff->Pman['public_cache_dir'] : false;
652 $baseurl = $compile ? $ff->Pman['public_cache_url'] : false;
656 $basedir = session_save_path(). '/translate-cache/';
657 if (!file_exists($basedir)) {
658 mkdir($basedir,0755);
660 $baseurl = $this->baseURL . '/Admin/Translations';
662 if (PHP_VERSION_ID < 70000 ) {
663 $lsort = create_function('$a,$b','return strlen($a) > strlen($b) ? 1 : -1;');
664 usort($files, $lsort);
666 usort($files, function($a,$b) { return strlen($a) > strlen($b) ? 1 : -1; });
669 $smod = str_replace('/','.',$mod);
671 $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize($arfiles)) .'.js';
674 // why are translations done like this - we just build them on the fly frmo the database..
675 $tmtime = file_exists($this->rootDir.'/_translations_/'. $smod.'.js')
676 ? filemtime($this->rootDir.'/_translations_/'. $smod.'.js') : 0;
678 $cache[$mod] = (object) array(
679 'smod' => $smod, // module name without '/'
680 'files' => $files, // list of all files.
681 'filesmtime' => $arfiles, // map of mtime=>file
682 'maxtime' => $maxtime, // max mtime
683 'compile' => $this->isDev ? false : $compile,
684 'translation_file' => $base .'/_translations_/' . $smod . '.js',
685 'translation_mtime' => $tmtime,
687 'translation_data' => preg_replace('/\.js$/', '.__translation__.js', $output),
688 'translation_base' => $dir .'/', //prefix of filename (without moudle name))
689 'basedir' => $basedir,
690 'baseurl' => $baseurl,
691 'module_dir' => $dir,
698 * moduleJavascriptList: list the javascript files in a module
700 * The original version of this.. still needs more thought...
702 * Compiled is in Pman/_compiled_/{$mod}/{LATEST...}.js
703 * Translations are in Pman/_translations_/{$mod}.js
705 * if that stuff does not exist just list files in Pman/{$mod}/*.js
707 * Compiled could be done on the fly..
711 * @param {String} $mod the module to look at - eg. Pman/{$mod}/*.js
712 * @return {Array} list of include paths (either compiled or raw)
718 function moduleJavascriptList($mod)
722 $dir = $this->rootDir.'/Pman/'. $mod;
725 if (!file_exists($dir)) {
726 echo '<!-- missing directory '. htmlspecialchars($dir) .' -->';
730 $info = $this->moduleJavascriptFilesInfo($mod);
734 if (empty($info->files)) {
737 // finally sort the files, so they are in the right order..
739 // only compile this stuff if public_cache is set..
743 // public_cache_dir = /var/www/myproject_cache
744 // public_cache_url = /myproject_cache (with Alias apache /myproject_cache/ /var/www/myproject_cache/)
747 if (!$info->compile) {
748 echo "<!-- Javascript compile turned off (isDev on, or public_cache_dir not set) -->\n";
752 // where are we going to write all of this..
753 // This has to be done via a
754 if (!file_exists($info->basedir.'/'.$info->output) || !filesize($info->basedir.'/'.$info->output)) {
755 require_once 'Pman/Core/JsCompile.php';
756 $x = new Pman_Core_JsCompile();
758 $x->pack($info->filesmtime,$info->basedir.'/'.$info->output, $info->translation_base);
760 echo "<!-- file exists not exist: {$info->basedir}/{$info->output} -->\n";
763 if (file_exists($info->basedir.'/'.$info->output) &&
764 filesize($info->basedir.'/'.$info->output)) {
767 $info->baseurl.'/'. $info->output,
770 // output all the ava
771 // fixme - this needs the max datetime for the translation file..
772 $ret[] = $this->baseURL."/Admin/InterfaceTranslations/".$mod.".js"; //?ts=".$info->translation_mtime;
774 //if ($info->translation_mtime) {
775 // $ret[] = $this->rootURL."/_translations_/". $info->smod.".js?ts=".$info->translation_mtime;
782 // give up and output original files...
792 * PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
794 function initErrorHandling()
796 if (!class_exists('HTML_FlexyFramework2')) {
797 // what about older code that still users PEAR?
798 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
800 set_exception_handler(array($this,'onException'));
805 static $permitError = false; // static why?
807 var $showErrorToUser = true;
809 function onPearError($err)
811 return $this->onException($err);
816 function onException($ex)
818 static $reported = false;
823 if (Pman::$permitError) {
830 $out = (is_a($ex,'Exception') || is_a($ex, 'Error') ? $ex->getMessage() : $ex->toString()) .
831 ' ' . (empty($_SERVER['REQUEST_METHOD']) ? 'cli' : $_SERVER['REQUEST_METHOD'] ) . ' ' .
832 (empty($_SERVER['REQUEST_URI']) ? 'No URL' : $_SERVER['REQUEST_URI']) .
833 ' ' . (empty($POST) ? '' : file_get_contents('php://input')) ;
836 //print_R($bt); exit;
839 $bt = is_a($ex,'Exception')|| is_a($ex, 'Error') ? $ex->getTrace() : $ex->backtrace;
840 if (is_a($ex,'Exception')|| is_a($ex, 'Error') ) {
841 $ret[] = $ex->getFile() . '('. $ex->getLine() . ')';
843 foreach( $bt as $b) {
844 $ret[] = @$b['file'] . '(' . @$b['line'] . ')@' . @$b['class'] . '::' . @$b['function'];
850 //convert the huge backtrace into something that is readable..
851 $out .= "\n" . implode("\n", $ret);
854 $this->addEvent("EXCEPTION", false, $out);
856 if ($this->showErrorToUser) {
859 // not sure why this is here... - perhaps doing a jerr() was actually caught by the UI, and hidden from the user..?
860 $this->jerror(false,"An error Occured, please contact the website owner");
869 * ---------------- Logging ---------------
874 * Log an action (only if it has not been logged already.
876 * @param {String} action - group/name of event
877 * @param {DataObject|false} obj - dataobject action occured on.
878 * @param {String} any remarks
879 * @return {false|DB_DataObject} Event object.,
882 function addEventOnce($act, $obj = false, $remarks = '')
884 if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) {
887 $e = DB_DataObject::factory('Events');
888 $e->init($act,$obj,$remarks);
889 if ($e->find(true)) {
892 return $this->addEvent($act, $obj, $remarks);
898 * @param {String} action - group/name of event
899 * @param {DataObject|false} obj - dataobject action occured on.
900 * @param {String} any remarks
901 * @return {DB_DataObject} Event object.,
904 function addEvent($act, $obj = false, $remarks = '')
907 $ff = HTML_FlexyFramework::get();
910 if (!empty($ff->Pman['disable_events'])
911 || !empty($ff->database_is_readonly)
912 || substr($act, 0, 7) === 'NOTICE-'
914 if (!preg_match('/^(ERROR|EXCEPTION)/', $act)) {
917 $str = $obj !== false ? "{$obj->tableName()}:{$obj->id} " : '';
918 $de = ini_set('display_errors', 0);
919 trigger_error("{$act} {$str} {$remarks}" , E_USER_NOTICE);
920 ini_set('display_errors', $de );
924 $au = $this->getAuthUser();
926 $e = DB_DataObject::factory('Events');
927 $e->init($act,$obj,$remarks);
929 $e->event_when = $e->sqlValue('NOW()');
933 // fixme - this should be in onInsert..
934 $wa = DB_DataObject::factory('core_watch');
935 if (method_exists($wa,'notifyEvent')) {
936 $wa->notifyEvent($e); // trigger any actions..
940 $e->onInsert(isset($_REQUEST) ? $_REQUEST : array() , $this);
941 if (!preg_match('/^(ERROR|EXCEPTION)/', $act)) {
944 $str = $obj !== false ? "{$obj->tableName()}:{$obj->id} " : '';
945 $de = ini_set('display_errors', 0);
946 trigger_error("{$act} [event_id={$e->id}] {$str} {$remarks}" , E_USER_NOTICE);
947 ini_set('display_errors', $de );
953 function addEventNotifyOnly($act, $obj = false, $remarks = '')
955 $au = $this->getAuthUser();
957 $e = DB_DataObject::factory('Events');
958 $e->init($act,$obj,$remarks);
960 $e->event_when = $e->sqlValue('NOW()');
961 $wa = DB_DataObject::factory('core_watch');
962 if (method_exists($wa,'notifyEvent')) {
963 $wa->notifyEvent($e); // trigger any actions..
968 // ------------------ DEPERCIATED ----------------------------
970 // DEPRECITAED - use moduleslist
971 function modules() { return $this->modulesList(); }
974 // DEPRICATED USE Pman_Core_Mailer
976 function emailTemplate($templateFile, $args)
979 require_once 'Pman/Core/Mailer.php';
980 $r = new Pman_Core_Mailer(array(
981 'template'=>$templateFile,
988 // DEPRICATED - USE Pman_Core_Mailer
989 // WHAT Part about DEPRICATED Does no one understand??
990 function sendTemplate($templateFile, $args)
992 require_once 'Pman/Core/Mailer.php';
993 $r = new Pman_Core_Mailer(array(
994 'template'=>$templateFile,
995 'contents' => array(),