PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/e107_admin/header.php

https://github.com/CasperGemini/e107
PHP | 637 lines | 301 code | 134 blank | 202 comment | 68 complexity | 04edb42283016475044e35066423857c MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. * e107 website system
  4. *
  5. * Copyright (C) 2008-2012 e107 Inc (e107.org)
  6. * Released under the terms and conditions of the
  7. * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
  8. *
  9. * Admin Header
  10. *
  11. * $URL:$
  12. * $Id:$
  13. */
  14. if (!defined('e107_INIT'))
  15. {
  16. exit;
  17. }
  18. if (!defined('ADMIN_AREA'))
  19. {
  20. //avoid PHP warning
  21. define("ADMIN_AREA", TRUE);
  22. }
  23. if(!defined('USER_AREA'))
  24. {
  25. define("USER_AREA", FALSE);
  26. }
  27. e107::getDb()->db_Mark_Time('(Header Top)');
  28. // Admin template
  29. if (defined('THEME') && file_exists(THEME.'admin_template.php'))
  30. {
  31. require_once (THEME.'admin_template.php');
  32. }
  33. else
  34. {
  35. require_once (e_CORE.'templates/admin_template.php');
  36. }
  37. function loadJSAddons()
  38. {
  39. if(e_PAGE == 'menus.php' && vartrue($_GET['configure'])) // Quick fix for Menu Manager inactive drop-down problem.
  40. {
  41. return;
  42. }
  43. // e107::js('core', 'bootstrap/js/bootstrap-modal.js', 'jquery', 2); // Special Version see: https://github.com/twitter/bootstrap/pull/4224
  44. e107::css('core', 'bootstrap-editable/css/bootstrap-editable.css', 'jquery');
  45. e107::js('core', 'bootstrap-editable/js/bootstrap-editable.min.js', 'jquery', 2);
  46. // e107::css('url', "//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap-editable/css/bootstrap-editable.css");
  47. // e107::js('url', "//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap-editable/js/bootstrap-editable.min.js");
  48. e107::css('core', 'bootstrap-select/bootstrap-select.min.css', 'jquery');
  49. e107::js('core', 'bootstrap-select/bootstrap-select.min.js', 'jquery', 2);
  50. e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
  51. e107::js('core', 'bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2);
  52. e107::js('core', 'bootstrap-jasny/js/jasny-bootstrap.js', 'jquery', 2);
  53. e107::css('core', 'bootstrap-datetimepicker/css/datetimepicker.css', 'jquery');
  54. e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 2);
  55. if(e_LAN != 'en')
  56. {
  57. e107::js('inline', buildDateLocale(),'jquery', 2);
  58. }
  59. e107::js('core', 'jquery.elastic.js', 'jquery', 2);
  60. e107::js('core', 'jquery.at.caret.min.js', 'jquery', 2);
  61. // e107::js('core', 'jquery-ui-timepicker-addon.js', 'jquery', 2);
  62. //e107::css('core', 'chosen/chosen.css', 'jquery');
  63. //e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
  64. e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2);
  65. // e107::css('core', 'bootstrap-tag/bootstrap-tag.css', 'jquery');
  66. e107::js('core', 'bootstrap-tag/bootstrap-tag.js', 'jquery', 2);
  67. // e107::js("core", "tags/jquery.tagit.js","jquery",3);
  68. // e107::css('core', 'tags/jquery.tagit.css', 'jquery');
  69. e107::css('core', 'core/admin.jquery.css', 'jquery');
  70. e107::js("core", "core/admin.jquery.js","jquery",4); // Load all default functions.
  71. e107::css('core', 'core/all.jquery.css', 'jquery');
  72. e107::js("core", "core/all.jquery.js","jquery",4); // Load all default functions.
  73. }
  74. loadJSAddons();
  75. /** Build the datetimepicker() locale, since it must match strftime() values for accurate conversion.
  76. *
  77. */
  78. function buildDateLocale()
  79. {
  80. $text = ';(function($){
  81. $.fn.datetimepicker.dates["'.e_LAN.'"] = {';
  82. $dates = array();
  83. for ($i=1; $i < 8; $i++)
  84. {
  85. $day = strftime('%A', mktime(1,1,1, 1, $i, 2012));
  86. $dates['days'][] = $day;
  87. $dates['daysShort'][] = strftime('%a', mktime(1,1,1, 1, $i, 2012));
  88. $dates['daysMin'][] = substr($day,0,2);
  89. }
  90. for ($i=1; $i < 13; $i++)
  91. {
  92. $dates['months'][] = strftime('%B', mktime(1,1,1, $i, 2, 2013));
  93. $dates['monthsShort'][] = strftime('%h', mktime(1,1,1, $i, 2, 2013));
  94. }
  95. foreach($dates as $key=>$type)
  96. {
  97. $d = array();
  98. $text .= "\n".$key.": [";
  99. foreach($type as $val)
  100. {
  101. $d[] = '"'.$val.'"';
  102. }
  103. $text .= implode(",",$d);
  104. $text .= "],";
  105. }
  106. $text .= '
  107. meridiem: ["am", "pm"]
  108. };
  109. }(jQuery));';
  110. return $text;
  111. }
  112. // e107::js("core", "core/admin.js","prototype",3); // Load all default functions.
  113. //
  114. // *** Code sequence for headers ***
  115. // IMPORTANT: These items are in a carefully constructed order. DO NOT REARRANGE
  116. // without checking with experienced devs! Various subtle things WILL break.
  117. //
  118. // We realize this is a bit (!) of a mess and hope to make further cleanups in a future release.
  119. // FIXME - outdated list
  120. // A: Admin Defines and Links
  121. // B: Send HTTP headers that come before any html
  122. // C: Send start of HTML
  123. // D: Send CSS
  124. // E: Send JS
  125. // F: Send Meta Tags and Icon links
  126. // G: Send final theme headers (theme_head() function)
  127. // H: Generate JS for image preloading (setup for onload)
  128. // I: Calculate onload() JS functions to be called
  129. // J: Send end of html <head> and start of <body>
  130. // K: (The rest is ignored for popups, which have no menus)
  131. // L: (optional) Body JS to disable right clicks
  132. // M: Send top of body for custom pages and for news
  133. // N: Send other top-of-body HTML
  134. //
  135. // Load order notes for devs
  136. // * Browsers wait until ALL HTML has loaded before executing ANY JS
  137. // * The last CSS tag downloaded supercedes earlier CSS tags
  138. // * Browsers don't care when Meta tags are loaded. We load last due to
  139. // a quirk of e107's log subsystem.
  140. // * Multiple external <link> file references slow down page load. Each one requires
  141. // browser-server interaction even when cached.
  142. //
  143. //
  144. // A: Admin Defines and Links
  145. //
  146. // FIXME - remove ASAP
  147. if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
  148. {
  149. $threshold = (time() - ($pref['del_unv'] * 60));
  150. e107::getDb()->db_Delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
  151. }
  152. //
  153. // B: Send HTTP headers (these come before ANY html)
  154. // moved to boot.php
  155. //
  156. // B.2: Include admin LAN and icon defines
  157. // Moved to boot.php
  158. //
  159. // C: Send start of HTML
  160. //
  161. // HTML 5 default.
  162. //if(!defined('XHTML4'))
  163. {
  164. echo "<!doctype html>\n";
  165. echo "<html".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " lang=\"".CORE_LC."\"" : "").">\n";
  166. echo "<head>\n";
  167. echo "<meta charset='utf-8' />\n";
  168. }
  169. /*
  170. else // XHTML
  171. {
  172. echo(defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='utf-8' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
  173. echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">\n";
  174. echo "
  175. <head>
  176. <meta http-equiv='content-style-type' content='text/css' />\n";
  177. echo(defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
  178. echo "<meta http-equiv='content-type' content='text/html; charset=utf-8' />\n";
  179. }
  180. *
  181. */
  182. echo "<meta name=\"viewport\" content=\"width=device-width; initial-scale=1; maximum-scale=1\" />\n"; // Works better for iOS but still has some issues.
  183. // echo (defined("VIEWPORT")) ? "<meta name=\"viewport\" content=\"".VIEWPORT."\" />\n" : "";
  184. echo "<title>".(defined("e_PAGETITLE") ? e_PAGETITLE." - " : (defined("PAGE_NAME") ? PAGE_NAME." - " : "")).LAN_head_4." :: ".SITENAME."</title>\n";
  185. //
  186. // D: Send CSS
  187. //
  188. echo "<!-- *CSS* -->\n";
  189. $e_js = e107::getJs();
  190. // Core CSS - XXX awaiting for path changes
  191. if (!isset($no_core_css) || !$no_core_css)
  192. {
  193. //echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
  194. $e_js->otherCSS('{e_WEB_CSS}e107.css');
  195. }
  196. // Register Plugin specific CSS
  197. // DEPRECATED, use $e_js->pluginCSS('myplug', 'style/myplug.css'[, $media = 'all|screen|...']);
  198. if (isset($eplug_css) && $eplug_css)
  199. {
  200. if(!is_array($eplug_css))
  201. {
  202. $eplug_css = array($eplug_css);
  203. }
  204. foreach($eplug_css as $kcss)
  205. {
  206. // echo ($kcss[0] == "<") ? $kcss : "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
  207. $e_js->otherCSS($kcss);
  208. }
  209. }
  210. if(e107::getPref('admincss') == "admin_dark.css" && !vartrue($_GET['configure']))
  211. {
  212. $e_js->coreCSS('bootstrap/css/darkstrap.css');
  213. }
  214. //NEW - Iframe mod
  215. if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'] && !vartrue($_GET['configure']))
  216. {
  217. $css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
  218. //echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
  219. $e_js->themeCSS($css_file);
  220. }
  221. elseif (isset($pref['themecss']) && $pref['themecss'])
  222. {
  223. $css_file = (file_exists(THEME.'admin_'.$pref['themecss']) && !vartrue($_GET['configure'])) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
  224. //echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
  225. // $e_js->themeCSS($css_file); // Test with superhero.css for frontend bootstrap and 'dark' for backend bootstrap.
  226. }
  227. else
  228. {
  229. $css_file = (file_exists(THEME.'admin_style.css') && !vartrue($_GET['configure'])) ? 'admin_style.css' : 'style.css';
  230. //echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
  231. $e_js->themeCSS($css_file);
  232. }
  233. if(e_PAGE == 'menus.php' && vartrue($_GET['configure'])) // Quick fix for Menu Manager inactive drop-down problem.
  234. {
  235. $css_file = $pref['themecss'];
  236. $e_js->themeCSS($css_file); // Test with superhero.css for frontend bootstrap and 'dark' for backend bootstrap.
  237. // return;
  238. }
  239. else
  240. {
  241. // $e_js->coreCSS('font-awesome/css/font-awesome.min.css');
  242. }
  243. // FIXME: TEXTDIRECTION compatibility CSS (marj?)
  244. // TODO: probably better to externalise along with some other things above
  245. // possibility to overwrite some CSS definition according to TEXTDIRECTION
  246. // especially usefull for rtl.css
  247. // see _blank theme for examples
  248. if(defined('TEXTDIRECTION') && file_exists(THEME.'/'.strtolower(TEXTDIRECTION).'.css'))
  249. {
  250. //echo '
  251. //<link rel="stylesheet" href="'.THEME_ABS.strtolower(TEXTDIRECTION).'.css" type="text/css" media="all" />';
  252. $e_js->themeCSS(strtolower(TEXTDIRECTION).'.css');
  253. }
  254. // ################### RENDER CSS
  255. // Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
  256. $e_js->renderJs('other_css', false, 'css', false);
  257. echo "\n<!-- footer_other_css -->\n";
  258. // Core CSS
  259. $e_js->renderJs('core_css', false, 'css', false);
  260. echo "\n<!-- footer_core_css -->\n";
  261. // Plugin CSS
  262. $e_js->renderJs('plugin_css', false, 'css', false);
  263. echo "\n<!-- footer_plugin_css -->\n";
  264. // Theme CSS
  265. //echo "<!-- Theme css -->\n";
  266. $e_js->renderJs('theme_css', false, 'css', false);
  267. echo "\n<!-- footer_theme_css -->\n";
  268. // Inline CSS - not sure if this should stay at all!
  269. $e_js->renderJs('inline_css', false, 'css', false);
  270. echo "\n<!-- footer_inline_css -->\n";
  271. //
  272. // Unobtrusive JS via CSS, prevent 3rd party code overload
  273. //
  274. // require_once(e_FILE."/e_css.php"); //moved to e107_web/css/e107.css
  275. //
  276. // E: Send JS
  277. //
  278. echo "<!-- *JS* -->\n";
  279. // Wysiwyg JS support on or off.
  280. // your code should run off e_WYSIWYG
  281. // Moved to boot.php
  282. // [JSManager] Load JS Includes - Zone 1 - Before Library
  283. e107::getJs()->renderJs('header', 1);
  284. e107::getJs()->renderJs('header_inline', 1);
  285. // Load Javascript Library consolidation script
  286. $jslib = e107::getObject('e_jslib', null, e_HANDLER.'jslib_handler.php');
  287. $jslib->renderHeader('admin', false);
  288. // [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
  289. e107::getJs()->renderJs('header', 2);
  290. e107::getJs()->renderJs('header_inline', 2);
  291. //DEPRECATED - use e107::getJs()->headerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
  292. if (isset($eplug_js) && $eplug_js)
  293. {
  294. echo "\n<!-- eplug_js -->\n";
  295. echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
  296. }
  297. //FIXME - theme.js/user.js should be registered/rendered through e_jsmanager
  298. if (file_exists(THEME.'theme.js'))
  299. {
  300. echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n";
  301. }
  302. if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js'))
  303. {
  304. echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n";
  305. }
  306. // [JSManager] Load JS Includes - Zone 3 - before e_meta and headerjs()
  307. e107::getJs()->renderJs('header', 3);
  308. e107::getJs()->renderJs('header_inline', 3);
  309. //
  310. // F: Send Meta Tags and Icon links
  311. //
  312. echo "<!-- *META* -->\n";
  313. // --- Load plugin Meta files and eplug_ before others --------
  314. if (vartrue($pref['e_meta_list']))
  315. {
  316. foreach ($pref['e_meta_list'] as $val)
  317. {
  318. if (is_readable(e_PLUGIN.$val."/e_meta.php"))
  319. {
  320. echo "<!-- $val meta -->\n";
  321. require_once (e_PLUGIN.$val."/e_meta.php");
  322. }
  323. }
  324. }
  325. // --- Load plugin Header files --------
  326. if (vartrue($pref['e_header_list']) && is_array($pref['e_header_list']))
  327. {
  328. foreach($pref['e_header_list'] as $val)
  329. {
  330. // no checks fore existing file - performance
  331. e107_include(e_PLUGIN.$val."/e_header.php");
  332. }
  333. }
  334. unset($e_headers);
  335. if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
  336. {
  337. if ($pref['password_CHAP'] == 2)
  338. {
  339. // *** Add in the code to swap the display tags
  340. // $js_body_onload[] = "expandit('loginmenuchap','nologinmenuchap');";
  341. $js_body_onload[] = "expandit('loginmenuchap');";
  342. $js_body_onload[] = "expandit('nologinmenuchap');";
  343. }
  344. echo "<script type='text/javascript' src='".e_JS."chap_script.js'></script>\n";
  345. $js_body_onload[] = "getChallenge();";
  346. }
  347. //XXX - do we still need it? Now we have better way of doing this - admin tools (see below)
  348. if (function_exists('headerjs'))
  349. {
  350. echo headerjs();
  351. }
  352. // Admin UI - send header content if any - headerjs() replacement
  353. $tmp = e107::getAdminUI();
  354. if($tmp)
  355. {
  356. // Note: normally you shouldn't send JS content here, former is (much better) handled by JS manager (both files and inline)
  357. echo $tmp->getHeader();
  358. }
  359. unset($tmp);
  360. // [JSManager] Load JS Includes - Zone 4 - After e_meta, headerjs, before Admin UI headers
  361. e107::getJs()->renderJs('header', 4);
  362. e107::getJs()->renderJs('header_inline', 4);
  363. // ---------- Favicon ---------
  364. $sitetheme = e107::getPref('sitetheme');
  365. if (file_exists(e_THEME.$sitetheme."/favicon.ico"))
  366. {
  367. echo "<link rel='icon' href='".e_THEME_ABS.$sitetheme."/favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".e_THEME_ABS.$sitetheme."/favicon.ico' type='image/xicon' />\n";
  368. }
  369. elseif (file_exists(e_BASE."favicon.ico"))
  370. {
  371. echo "<link rel='icon' href='".SITEURL."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".SITEURL."favicon.ico' type='image/xicon' />\n";
  372. }
  373. unset($sitetheme);
  374. //
  375. // G: Send Theme Headers
  376. //
  377. if (function_exists('theme_head'))
  378. {
  379. echo "\n<!-- *THEME HEAD* -->\n";
  380. echo theme_head();
  381. }
  382. //
  383. // H: Generate JS for image preloads [user mode only]
  384. //
  385. echo "\n<!-- *PRELOAD* -->\n";
  386. //
  387. // I: Calculate JS onload() functions for the BODY tag [user mode only]
  388. //
  389. // XXX DEPRECATED $body_onload and related functionality
  390. if (defined('THEME_ONLOAD')) $js_body_onload[] = THEME_ONLOAD;
  391. $body_onload='';
  392. if (count($js_body_onload)) $body_onload = " onload=\"".implode(" ",$js_body_onload)."\"";
  393. //
  394. // J: Send end of <head> and start of <body>
  395. //
  396. /*
  397. * Admin LAN
  398. * TODO - remove it from here
  399. */
  400. e107::js('inline',"
  401. (".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
  402. (".e_jshelper::toString(LAN_DELETE).").addModLan('core', 'delete');
  403. ",'prototype',5);
  404. // [JSManager] Load JS Includes - Zone 5 - After theme_head, before e107:loaded trigger
  405. // unobtrusive JS - moved here from external e_css.php
  406. e107::getJs()->renderJs('header', 5);
  407. /*
  408. * Fire Event e107:loaded - Prototype only
  409. */
  410. //\$('e-js-css').remove();
  411. /*
  412. e107::js('inline',"
  413. document.observe('dom:loaded', function () {
  414. e107Event.trigger('loaded', null, document);
  415. });
  416. ",'prototype',5);
  417. */
  418. e107::getJs()->renderJs('header_inline', 5);
  419. echo "</head>
  420. <body".$body_onload.">\n";
  421. echo getModal();
  422. // echo getAlert();
  423. function getModal($caption = '', $type='')
  424. {
  425. if(e_PAGE == 'menus.php' && vartrue($_GET['configure'])) // Menu Manager iFrame disable
  426. {
  427. return;
  428. }
  429. if(e_PAGE == "image.php")
  430. {
  431. // return;
  432. }
  433. return '
  434. <div id="uiModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
  435. <div class="modal-header">
  436. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  437. <h4 class="modal-caption">&nbsp;</h4>
  438. </div>
  439. <div class="modal-body">
  440. <p>Loading…</p>
  441. </div>
  442. <div class="modal-footer">
  443. <a href="#" data-dismiss="modal" class="btn btn-primary">Close</a>
  444. </div>
  445. </div>';
  446. }
  447. function getAlert($caption='')
  448. {
  449. return '<div id="uiAlert" class="alert alert-block alert-success hide fade in" style="box-shadow:0px 15px 8px #000;width:300px;position:absolute;left:40%;right:40%;top:15%;z-index:10000">
  450. <!-- rest of alert code goes here --> some
  451. Some text goes here and there and everywhere.
  452. </div>';
  453. }
  454. // Header included notification, from this point header includes are not possible
  455. define('HEADER_INIT', TRUE);
  456. e107::getDb()->db_Mark_Time("End Head, Start Body");
  457. //
  458. // K: (The rest is ignored for popups, which have no menus)
  459. //
  460. // require $e107_popup =1; to use it as header for popup without menus
  461. if (!isset($e107_popup))
  462. {
  463. $e107_popup = 0;
  464. }
  465. if ($e107_popup != 1)
  466. {
  467. //
  468. // L: (optional) Body JS to disable right clicks [reserved; user mode]
  469. //
  470. //
  471. // M: Send top of body for custom pages and for news [user mode only]
  472. //
  473. //
  474. // N: Send other top-of-body HTML
  475. //
  476. // moved to boot.php
  477. //$ns = new e107table;
  478. //$e107_var = array();
  479. // function e_admin_me/nu moved to boot.php (e107::getNav()->admin)
  480. // legacy function show_admin_menu moved to boot.php
  481. // include admin_template.php moved to boot.php
  482. // function parse_admin moved to boot.php
  483. // legacy function admin_updatXXe moved to boot.php
  484. // (legacy?) function admin_purge_related moved to boot.php
  485. e107::getDb()->db_Mark_Time('Parse Admin Header');
  486. //NEW - Iframe mod
  487. if (!deftrue('e_IFRAME'))
  488. {
  489. //removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
  490. parse_admin($ADMIN_HEADER);
  491. }
  492. elseif(!vartrue($_GET['configure']))
  493. {
  494. e107::css("inline","body { padding:0px } "); // default padding for iFrame-only.
  495. }
  496. e107::getDb()->db_Mark_Time('(End: Parse Admin Header)');
  497. }
  498. // XXX - we don't need this (use e107::getMessage()) - find out what's using it and remove it
  499. if (!varset($emessage) && !is_object($emessage))
  500. {
  501. $emessage = e107::getMessage();
  502. }