PageRenderTime 70ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/index.php

https://gitlab.com/tutaalexandr/bot_local
PHP | 528 lines | 433 code | 36 blank | 59 comment | 33 complexity | c740f0f922c843ad77e052d114ceca9e MD5 | raw file
  1. <?PHP
  2. /***************************************
  3. * http://www.program-o.com
  4. * PROGRAM O
  5. * Version: 2.4.8
  6. * FILE: index.php
  7. * AUTHOR: Elizabeth Perreau and Dave Morton
  8. * DATE: FEB 01 2016
  9. * DETAILS: Gateway to the admin functions for the script
  10. ***************************************/
  11. $thisFile = __FILE__;
  12. if (!file_exists('../config/global_config.php')) header('location: ../install/install_programo.php');
  13. require_once('../config/global_config.php');
  14. // set up error logging and display
  15. ini_set('log_errors', true);
  16. ini_set('error_log', _LOG_PATH_ . 'admin.error.log');
  17. ini_set('html_errors', false);
  18. ini_set('display_errors', false);
  19. set_exception_handler("handle_exceptions");
  20. //load shared files
  21. require_once(_LIB_PATH_ . 'PDO_functions.php');
  22. require_once(_LIB_PATH_ . 'error_functions.php');
  23. require_once(_LIB_PATH_ . 'misc_functions.php');
  24. require_once(_LIB_PATH_ . 'template.class.php');
  25. require_once(_ADMIN_PATH_ . 'allowedPages.php');
  26. // Set session parameters
  27. $session_name = 'PGO_Admin';
  28. session_name($session_name);
  29. session_start();
  30. $msg = '';
  31. // Get form inputs
  32. $pc = print_r($_GET, true) . "\n" . print_r($_POST, true);
  33. $page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING);
  34. $page = ($page === false || $page === null) ? 'main' : $page;
  35. if (!array_key_exists($page, $allowed_pages))
  36. {
  37. $msg = 'Invalid argument!';
  38. }
  39. $filters = $allowed_pages[$page];
  40. $post_vars = filter_input_array(INPUT_POST, $filters);
  41. $get_vars = filter_input_array(INPUT_GET, $filters);
  42. $input_vars = array_merge((array) $get_vars, (array) $post_vars);
  43. // Set default values
  44. $bot_name = '<b class="red">not selected</b>';
  45. $hide_logo = '';
  46. $curPage = '';
  47. // Begin script execution
  48. $thisPath = dirname(__FILE__);
  49. $template = new Template("$thisPath/default.page.htm");
  50. $githubVersion = getCurrentVersion();
  51. $version = ($githubVersion == VERSION) ? 'Program O version ' . VERSION : 'Program O ' . $githubVersion . ' is now available. <a href="https://github.com/Program-O/Program-O/archive/master.zip">Click here</a> to download it.';
  52. $dbConn = db_open();
  53. if ($get_vars['page'] == 'logout') logout();
  54. $logged_in = getLoginStatus();
  55. $curPage = 'logout';
  56. switch ($logged_in)
  57. {
  58. case true:
  59. $curPage = (isset($get_vars['page'])) ? $get_vars['page'] : 'main';
  60. break;
  61. default:
  62. $curPage = ($get_vars['page'] == 'login') ? login() : 'logout';
  63. }
  64. $name = (isset($_SESSION['poadmin']['name'])) ? $_SESSION['poadmin']['name'] : '';
  65. $ip = (isset($_SESSION['poadmin']['ip'])) ? $_SESSION['poadmin']['ip'] : '';
  66. $last = (isset($_SESSION['poadmin']['last_login'])) ? $_SESSION['poadmin']['last_login'] : '';
  67. $lip = (isset($_SESSION['poadmin']['lip'])) ? $_SESSION['poadmin']['lip'] : '';
  68. $llast = (isset($_SESSION['poadmin']['prior_login'])) ? $_SESSION['poadmin']['prior_login'] : '';
  69. $bot_name = (isset($_SESSION['poadmin']['bot_name'])) ? $_SESSION['poadmin']['bot_name'] : $bot_name;
  70. $bot_id = (isset($_SESSION['poadmin']['bot_id'])) ? $_SESSION['poadmin']['bot_id'] : 1;
  71. $hide_logo = (isset($_SESSION['display'])) ? $_SESSION['display'] : '';
  72. $bot_format = (isset($_SESSION['poadmin']['bot_format'])) ? $_SESSION['poadmin']['bot_format'] : '';
  73. # Build page sections
  74. # ordered here in the order that the page is constructed
  75. $logo = $template->getSection('Logo');
  76. $titleSpan = $template->getSection('TitleSpan');
  77. $main = $template->getSection('Main');
  78. $divDecoration = '';
  79. $mainContent = $template->getSection('LoginForm');
  80. $noLeftNav = $template->getSection('NoLeftNav');
  81. $noRightNav = $template->getSection('NoRightNav');
  82. $navHeader = $template->getSection('NavHeader');
  83. $footer = $template->getSection('Footer');
  84. $topNav = '';
  85. $leftNav = '';
  86. $rightNav = '';
  87. $rightNavLinks = '';
  88. $lowerScripts = $template->getSection('LogoLinkScript');
  89. $pageTitleInfo = '';
  90. $topNavLinks = makeLinks('top', makeTopLinks());
  91. $leftNavLinks = makeLinks('left', makeLeftLinks());
  92. $mediaType = ' media="screen"';
  93. $mainTitle = 'Program O Login';
  94. $FooterInfo = '<p>&copy; 2011-2014 My Program-O<br /><a href="http://www.program-o.com">www.program-o.com</a></p>';
  95. $headerTitle = '';
  96. $pageTitle = 'My-Program O - Login';
  97. $upperScripts = '';
  98. $extraCSS = '';
  99. //if we get to the login page and we are still actually logged in
  100. //just destroy the session to prevent weirdness
  101. if($curPage == 'login' && !empty($_SESSION['poadmin']['logged_in'])){
  102. $_SESSION = array();
  103. }
  104. $_SESSION['poadmin']['curPage'] = $curPage;
  105. ($curPage != 'logout' || $curPage == 'login') ? include ("$curPage.php") : false;
  106. $bot_format_link = (!empty($bot_format)) ? "&amp;format=$bot_format" : '';
  107. $curPage = (isset($curPage)) ? $curPage : 'main';
  108. $upperScripts .= ($hide_logo == 'HideLogoCSS') ? $template->getSection('HideLogoCSS') : '';
  109. # Build page content from the template
  110. $content = $template->getSection('Header');
  111. #$content .= "hide_logo = $hide_logo";
  112. $content .= $template->getSection('PageBody');
  113. # Replace template labels with real data
  114. $styleSheet = 'style.css';
  115. $errMsgClass = (!empty($msg)) ? "ShowError" : "HideError";
  116. $errMsgStyle = $template->getSection($errMsgClass);
  117. $bot_id = ($bot_id == 'new') ? 0 : $bot_id;
  118. $searches = array(
  119. '[charset]' => $charset,
  120. '[myPage]' => $curPage,
  121. '[pageTitle]' => $pageTitle,
  122. '[styleSheet]' => $styleSheet,
  123. '[mediaType]' => $mediaType,
  124. '[extraCSS]' => $extraCSS,
  125. '[upperScripts]' => $upperScripts,
  126. '[logo]' => $logo,
  127. '[pageTitleInfo]' => $pageTitleInfo,
  128. '[topNav]' => $topNav,
  129. '[leftNav]' => $leftNav,
  130. '[rightNav]' => $rightNav,
  131. '[main]' => $main,
  132. '[footer]' => $footer,
  133. '[lowerScripts]' => $lowerScripts,
  134. '[titleSpan]' => $titleSpan,
  135. '[divDecoration]' => $divDecoration,
  136. '[topNavLinks]' => $topNavLinks,
  137. '[navHeader]' => $navHeader,
  138. '[leftNavLinks]' => $leftNavLinks,
  139. '[mainTitle]' => $mainTitle,
  140. '[mainContent]' => $mainContent,
  141. '[rightNavLinks]' => $rightNavLinks,
  142. '[FooterInfo]' => $FooterInfo,
  143. '[headerTitle]' => $headerTitle,
  144. '[errMsg]' => $msg,
  145. '[bot_id]' => $bot_id,
  146. '[bot_name]' => $bot_name,
  147. '[errMsgStyle]' => $errMsgStyle,
  148. '[noRightNav]' => $noRightNav,
  149. '[noLeftNav]' => $noLeftNav,
  150. '[version]' => $version,
  151. '[bot_format_link]' => $bot_format_link,
  152. );
  153. foreach ($searches as $search => $replace) {
  154. $content = str_replace($search, $replace, $content);
  155. }
  156. $content = str_replace('[myPage]', $curPage, $content);
  157. $content = str_replace('[divDecoration]', $divDecoration, $content);
  158. $content = str_replace('[blank]', '', $content);
  159. session_gc();
  160. exit($content);
  161. /**
  162. * Function makeLinks
  163. *
  164. * * @param $section
  165. * @param $linkArray
  166. * @return string
  167. */
  168. function makeLinks($section, $linkArray) {
  169. $out = "<!-- making links for section $section -->\n";
  170. global $template, $curPage;
  171. $curPage = (empty($curPage)) ? 'main' : $curPage;
  172. $botName = (isset($_SESSION['poadmin']['bot_name'])) ? $_SESSION['poadmin']['bot_name'] : '<b class="red">not selected</b>';
  173. $botId = (isset($_SESSION['poadmin']['bot_id'])) ? $_SESSION['poadmin']['bot_id'] : 1;
  174. $botId = ($botId == 'new') ? 1 : $botId;
  175. # [linkClass][linkHref][linkOnclick][linkAlt][linkTitle]>[linkLabel]
  176. $linkText = $template->getSection('NavLink');
  177. foreach ($linkArray as $needle) {
  178. $tmp = $linkText;
  179. foreach ($needle as $search => $replace) {
  180. $tmp = str_replace($search, $replace, $tmp);
  181. }
  182. $linkClass = $needle['[linkHref]'];
  183. $linkClass = str_replace(' href="index.php?page=', '', $linkClass);
  184. $linkClass = str_replace('"', '', $linkClass);
  185. $curClass = ($linkClass == $curPage) ? 'selected' : 'noClass';
  186. if ($curPage == 'main') $curClass = (stripos($linkClass,'main') !== false) ? 'selected' : 'noClass';
  187. $tmp = str_replace('[curClass]', $curClass, $tmp);
  188. $out .= "$tmp\n";
  189. }
  190. #print "<!-- returning links for section $section:\n\n out = $out\n\n -->\n";
  191. $strippedBotName = preg_replace('~\<b class="red"\>(.*?)\</b\>~', '$1', $botName);
  192. $out = str_replace('[botId]', $botId, $out);
  193. $out = str_replace('[curBot]', $botName, $out);
  194. $out = str_replace('[curBot2]', $strippedBotName, $out);
  195. return trim($out);
  196. }
  197. /**
  198. * Function makeTopLinks
  199. *
  200. *
  201. * @return array
  202. */
  203. function makeTopLinks() {
  204. $out = array(
  205. array(
  206. '[linkClass]' => ' class="[curClass]"',
  207. '[linkHref]' => ' href="'.DOCS_URL.'"',
  208. '[linkOnclick]' => '',
  209. '[linkAlt]' => ' alt="The Program O User\'s Guide"',
  210. '[linkTitle]' => ' title="The Program O User\'s Guide"',
  211. '[linkLabel]' => 'Documentation'
  212. ),
  213. array(
  214. '[linkClass]' => ' class="[curClass]"',
  215. '[linkHref]' => ' href="https://github.com/Program-O/Program-O/issues"',
  216. '[linkOnclick]' => '',
  217. '[linkAlt]' => ' alt="Bug reporting"',
  218. '[linkTitle]' => ' title="Bug reporting"',
  219. '[linkLabel]' => 'Bug Reporting'
  220. ),
  221. array(
  222. '[linkClass]' => ' class="[curClass]"',
  223. '[linkHref]' => ' href="index.php?page=stats"',
  224. '[linkOnclick]' => '',
  225. '[linkAlt]' => ' alt="Get bot statistics"',
  226. '[linkTitle]' => ' title="Get bot statistics"',
  227. '[linkLabel]' => 'Stats'
  228. ),
  229. array(
  230. '[linkClass]' => '',
  231. '[linkHref]' => ' href="index.php?page=logout"',
  232. '[linkOnclick]' => '',
  233. '[linkAlt]' => ' alt="Log out"',
  234. '[linkTitle]' => ' title="Log out"',
  235. '[linkLabel]' => 'Log Out'
  236. )
  237. );
  238. return $out;
  239. }
  240. /**
  241. * Function makeLeftLinks
  242. *
  243. *
  244. * @return array
  245. */
  246. function makeLeftLinks() {
  247. $out = array(
  248. array( # Change bot
  249. '[linkClass]' => ' class="[curClass]"',
  250. '[linkHref]' => ' href="index.php?page=select_bots"',
  251. '[linkOnclick]' => '',
  252. '[linkAlt]' => ' alt="Change or edit the current bot"',
  253. '[linkTitle]' => ' title="Change or edit the current bot"',
  254. '[linkLabel]' => 'Current Bot: ([curBot])'
  255. ),
  256. array(
  257. '[linkClass]' => ' class="[curClass]"',
  258. '[linkHref]' => ' href="index.php?page=botpersonality"',
  259. '[linkOnclick]' => '',
  260. '[linkAlt]' => ' alt="Edit your bot\'s personality"',
  261. '[linkTitle]' => ' title="Edit your bot\'s personality"',
  262. '[linkLabel]' => 'Bot Personality'
  263. ),
  264. array(
  265. '[linkClass]' => ' class="[curClass]"',
  266. '[linkHref]' => ' href="index.php?page=logs"',
  267. '[linkOnclick]' => '',
  268. '[linkAlt]' => ' alt="View the log files"',
  269. '[linkTitle]' => ' title="View the log files"',
  270. '[linkLabel]' => 'Logs'
  271. ),
  272. array(
  273. '[linkClass]' => ' class="[curClass]"',
  274. '[linkHref]' => ' href="index.php?page=teach"',
  275. '[linkOnclick]' => '',
  276. '[linkAlt]' => ' alt="Train your bot"',
  277. '[linkTitle]' => ' title="Train your bot"',
  278. '[linkLabel]' => 'Teach'
  279. ),
  280. array(
  281. '[linkClass]' => ' class="[curClass]"',
  282. '[linkHref]' => ' href="index.php?page=upload"',
  283. '[linkOnclick]' => '',
  284. '[linkAlt]' => ' alt="Upload AIML files"',
  285. '[linkTitle]' => ' title="Upload AIML files"',
  286. '[linkLabel]' => 'Upload AIML'
  287. ),
  288. array(
  289. '[linkClass]' => ' class="[curClass]"',
  290. '[linkHref]' => ' href="index.php?page=download"',
  291. '[linkOnclick]' => '',
  292. '[linkAlt]' => ' alt="Download AIML files"',
  293. '[linkTitle]' => ' title="Download AIML files"',
  294. '[linkLabel]' => 'Download AIML'
  295. ),
  296. array(
  297. '[linkClass]' => ' class="[curClass]"',
  298. '[linkHref]' => ' href="index.php?page=clear"',
  299. '[linkOnclick]' => '',
  300. '[linkAlt]' => ' alt="Clear AIML Categories"',
  301. '[linkTitle]' => ' title="Clear AIML Categories"',
  302. '[linkLabel]' => 'Clear AIML Categories'
  303. ),
  304. array(
  305. '[linkClass]' => ' class="[curClass]"',
  306. '[linkHref]' => ' href="index.php?page=spellcheck"',
  307. '[linkOnclick]' => '',
  308. '[linkAlt]' => ' alt="Edit the SpellCheck entries"',
  309. '[linkTitle]' => ' title="Edit the SpellCheck entries"',
  310. '[linkLabel]' => 'Spell Check'
  311. ),
  312. array(
  313. '[linkClass]' => ' class="[curClass]"',
  314. '[linkHref]' => ' href="index.php?page=wordcensor"',
  315. '[linkOnclick]' => '',
  316. '[linkAlt]' => ' alt="Edit the Word Censor entries"',
  317. '[linkTitle]' => ' title="Edit the Word Censor entries"',
  318. '[linkLabel]' => 'Word Censor'
  319. ),
  320. array(
  321. '[linkClass]' => ' class="[curClass]"',
  322. '[linkHref]' => ' href="index.php?page=editAiml"',
  323. '[linkOnclick]' => '',
  324. '[linkAlt]' => ' alt="Search and edit specific AIML categories"',
  325. '[linkTitle]' => ' title="Search and edit specific AIML categories"',
  326. '[linkLabel]' => 'Search/Edit AIML'
  327. ),
  328. array(
  329. '[linkClass]' => ' class="[curClass]"',
  330. '[linkHref]' => ' href="index.php?page=srai_lookup"',
  331. '[linkOnclick]' => '',
  332. '[linkAlt]' => ' alt="Search and edit entries in the srai_lookup table"',
  333. '[linkTitle]' => ' title="Search and edit entries in the srai_lookup table"',
  334. '[linkLabel]' => 'SRAI Lookup'
  335. ),
  336. array(
  337. '[linkClass]' => ' class="[curClass]"',
  338. '[linkHref]' => ' href="index.php?page=demochat"',
  339. '[linkOnclick]' => '',
  340. '[linkAlt]' => ' alt="Run a demo version of your bot"',
  341. '[linkTitle]' => ' title="Run a demo version of your bot"',
  342. '[linkLabel]' => 'Test Your Bot'
  343. ),
  344. array(
  345. '[linkClass]' => '',
  346. '[linkHref]' => ' href="index.php?page=members"',
  347. '[linkOnclick]' => '',
  348. '[linkAlt]' => ' alt="Edit Admin Accounts"',
  349. '[linkTitle]' => ' title="Edit Admin Accounts"',
  350. '[linkLabel]' => 'Edit Admin Accounts'
  351. ),
  352. array(
  353. '[linkClass]' => '',
  354. '[linkHref]' => ' href="index.php?page=logout"',
  355. '[linkOnclick]' => '',
  356. '[linkAlt]' => ' alt="Log out"',
  357. '[linkTitle]' => ' title="Log out"',
  358. '[linkLabel]' => 'Log Out'
  359. ),
  360. array(
  361. '[linkClass]' => '',
  362. '[linkHref]' => ' href="#"',
  363. '[linkOnclick]' => ' onclick="toggleLogo(); return false;"',
  364. '[linkAlt]' => ' alt="Toggle the Logo"',
  365. '[linkTitle]' => ' title="Toggle the Logo"',
  366. '[linkLabel]' => 'Toggle the Logo'
  367. ),
  368. array(
  369. '[linkClass]' => '',
  370. '[linkHref]' => ' href="' . _BASE_URL_ . '?bot_id=[botId][bot_format_link]"',
  371. '[linkOnclick]' => ' target="_blank"',
  372. '[linkAlt]' => ' alt="open the page for [curBot] in a new tab/window"',
  373. '[linkTitle]' => ' title="open the page for [curBot2] in a new tab/window"',
  374. '[linkLabel]' => 'Talk to [curBot]'
  375. )
  376. );
  377. return $out;
  378. }
  379. /**
  380. * Function getCurrentVersion
  381. *
  382. *
  383. * @return bool|mixed|string
  384. */
  385. function getCurrentVersion()
  386. {
  387. if(isset($_SESSION['GitHubVersion'])) return $_SESSION['GitHubVersion'];
  388. $url = 'https://api.github.com/repos/Program-O/Program-O/contents/version.txt';
  389. $out = false;
  390. if (function_exists('curl_init'))
  391. {
  392. $ch = curl_init();
  393. curl_setopt($ch, CURLOPT_URL, $url);
  394. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  395. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  396. curl_setopt($ch, CURLOPT_USERAGENT, 'Program-O/Program-O');
  397. $out = curl_exec($ch);
  398. //if (false === $out) trigger_error('Not sure what it is, but there\'s a problem with checking the current version on GitHub. Maybe this will help: "' . curl_error($ch) . '"');
  399. curl_close($ch);
  400. if (false === $out) return VERSION;
  401. $repoArray = json_decode($out, true);
  402. //save_file(_LOG_PATH_ . 'repoArray.txt', print_r($repoArray, true));
  403. if (!isset($repoArray['content'])) return VERSION;
  404. $versionB64 = $repoArray['content'];
  405. $version = base64_decode($versionB64);
  406. #save_file(_DEBUG_PATH_ . 'version.txt', "out = " . print_r($out, true) . "\r\nVersion = $versionB64 = $version");
  407. $out = $version;
  408. }
  409. $_SESSION['GitHubVersion'] = $out;
  410. return ($out !== false) ? $out : VERSION;
  411. }
  412. /**
  413. * Function handle_exceptions
  414. *
  415. * * @param exception $e
  416. * @return void
  417. */
  418. function handle_exceptions(exception $e)
  419. {
  420. global $msg;
  421. $trace = $e->getTrace();
  422. file_put_contents(_LOG_PATH_ . 'admin.exception.log', print_r($trace, true), FILE_APPEND);
  423. $msg .= $e->getMessage();
  424. return 'logout';
  425. }
  426. function login ()
  427. {
  428. global $post_vars, $get_vars, $dbConn, $msg;
  429. if((!isset($post_vars['user_name'])) ||(!isset($post_vars['pw']))) return 'logout';
  430. //$_SESSION['poadmin']['display'] = $hide_logo;
  431. $user_name = $post_vars['user_name'];
  432. $pw_hash = md5($post_vars['pw']);
  433. $sql = "SELECT * FROM `myprogramo` WHERE user_name = :user_name AND password = :pw_hash";
  434. $params = array(':user_name' => $user_name, ':pw_hash' => $pw_hash);
  435. $row = db_fetch($sql, $params, __FILE__, __FUNCTION__, __LINE__);
  436. if(!empty($row)) {
  437. $_SESSION['poadmin']['uid'] = $row['id'];
  438. $_SESSION['poadmin']['name'] = $row['user_name'];
  439. $_SESSION['poadmin']['lip']=$row['last_ip'];
  440. $_SESSION['poadmin']['prior_login']=date('l jS \of F Y h:i:s A', strtotime($row['last_login']));
  441. switch (true)
  442. {
  443. case (!empty($_SERVER['HTTP_CLIENT_IP'])):
  444. $ip = $_SERVER['HTTP_CLIENT_IP'];
  445. break;
  446. case (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])):
  447. $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  448. break;
  449. default:
  450. $ip = $_SERVER['REMOTE_ADDR'];
  451. }
  452. $sql = "UPDATE `myprogramo` SET `last_ip` = :ip, `last_login` = CURRENT_TIMESTAMP WHERE user_name = :user_name limit 1";
  453. $params = array(':ip' => $ip, ':user_name' => $user_name);
  454. $transact = db_write($sql, $params, false, __FILE__, __FUNCTION__, __LINE__);
  455. $_SESSION['poadmin']['ip'] = $ip;
  456. $_SESSION['poadmin']['last_login'] = date('l jS \of F Y h:i:s A');
  457. $sql = "SELECT * FROM `bots` WHERE bot_active = '1' ORDER BY bot_id ASC LIMIT 1";
  458. $row = db_fetch($sql, null, __FILE__, __FUNCTION__, __LINE__);
  459. $count = count($row);
  460. if($count > 0) {
  461. $_SESSION['poadmin']['bot_id'] = $row['bot_id'];
  462. $_SESSION['poadmin']['bot_name'] = $row['bot_name'];
  463. }
  464. else {
  465. $_SESSION['poadmin']['bot_id'] = -1;
  466. $_SESSION['poadmin']['bot_name'] = "unknown";
  467. }
  468. }
  469. else {
  470. $msg .= "incorrect username/password<br>\n";
  471. }
  472. if (empty($msg))
  473. {
  474. $_SESSION['poadmin']['logged_in'] = true;
  475. header('Location: index.php');
  476. return 'main';
  477. }
  478. return 'logout';
  479. }
  480. function logout()
  481. {
  482. global $session_name, $session_cookie_domain, $session_cookie_path;
  483. $_SESSION = array();
  484. session_destroy();
  485. setcookie($session_name, '', time()-3600, $session_cookie_path, $session_cookie_domain, false, false);
  486. header('Location: ./');
  487. exit();
  488. }
  489. function getLoginStatus()
  490. {
  491. return (isset($_SESSION['poadmin']['logged_in']) && $_SESSION['poadmin']['logged_in'] === true) ? true : false;
  492. }