home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / oss / cvs-2004 / bahasa / web / online.php,v < prev    next >
Text File  |  2003-10-20  |  8KB  |  415 lines

  1. head    1.6;
  2. access;
  3. symbols
  4.     Initial:1.1.1.1 bule:1.1.1;
  5. locks; strict;
  6. comment    @# @;
  7.  
  8.  
  9. 1.6
  10. date    2003.10.20.00.21.45;    author bule;    state Exp;
  11. branches;
  12. next    1.5;
  13.  
  14. 1.5
  15. date    2003.10.18.00.33.42;    author bule;    state Exp;
  16. branches;
  17. next    1.4;
  18.  
  19. 1.4
  20. date    2003.10.06.00.39.27;    author bule;    state Exp;
  21. branches;
  22. next    1.3;
  23.  
  24. 1.3
  25. date    2003.10.01.06.51.29;    author bule;    state Exp;
  26. branches;
  27. next    1.2;
  28.  
  29. 1.2
  30. date    2003.08.19.19.05.16;    author bule;    state Exp;
  31. branches;
  32. next    1.1;
  33.  
  34. 1.1
  35. date    2003.08.12.19.18.23;    author bule;    state Exp;
  36. branches
  37.     1.1.1.1;
  38. next    ;
  39.  
  40. 1.1.1.1
  41. date    2003.08.12.19.18.23;    author bule;    state Exp;
  42. branches;
  43. next    ;
  44.  
  45.  
  46. desc
  47. @@
  48.  
  49.  
  50. 1.6
  51. log
  52. @*** empty log message ***
  53. @
  54. text
  55. @<?
  56. session_start();
  57. require_once("../php/Indonesia.php");
  58. require_once("../php/Web.php");
  59. //////////////////////////////////////////////////////////////////////////////
  60. //////////////////////////////////////////////////////////////////////////////
  61. // Project Name: Bahasa Indonesia Dictionary
  62. // Directory:    bahasa/web
  63. // File Name:    online.php
  64. // Author(s):    John L. Whiteman
  65. // Created:      June 23, 2003  
  66. // Modified:     October 19, 2003
  67. // Description:  The purpose of this restricted access PHP web 
  68. //               client page is to allow the administrator to manually
  69. //               set the web site to offline or online.  The client
  70. //               will be redirected of offline.php if offline is set on.
  71. // 
  72. // Copyright (c) 2003 John L. Whiteman
  73. //
  74. // Permission is herby granted, free of charge, to any person obtaining a 
  75. // copy of this software, data, and associated documentation files 
  76. // (the "Software"), to deal in the Software without restriction, 
  77. // including without limitation the rights to use, copy, modify, merge, 
  78. // publish, distribute, sublicense, and/or sell copies of Software, and to
  79. // permit persons to whom the Software is furnished to do so, subject to 
  80. // the following conditions:
  81. //
  82. // The above copyright notice and this permission notice shall be 
  83. // included in all copies or substantial portions of the Software.
  84. //
  85. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  86. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
  87. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  88. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 
  89. // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
  90. // TORT OR OTHERWISE, ARISING IN THE SOFTWARE.  
  91. //////////////////////////////////////////////////////////////////////////////
  92. //////////////////////////////////////////////////////////////////////////////
  93. $web = new Web();
  94.  
  95. if (!$_SESSION['ADMIN']) {
  96.  
  97.     $web->redirect("login.php");
  98.  
  99.     exit;
  100.  
  101. $indonesia = new Indonesia();
  102.  
  103. $status = $indonesia->get_dictionary_status();
  104.  
  105. if ($status["status"] == 1 || $status["status"] == 2) {
  106.  
  107.     $web->redirect("admin.php");
  108.  
  109.     exit;
  110.  
  111. if ($_SESSION['NODUP_OFFLINE_STATUS']) {
  112.  
  113.     unset($_SESSION['NODUP_OFFLINE_STATUS']);
  114.  
  115.     $web->redirect("admin.php");
  116.  
  117.     exit;
  118. }
  119.  
  120. ?>
  121. <html>
  122. <head>
  123. <title>Bahasa Indonesia Dictionary: Online/Offline</title>
  124.  
  125. <link href="bahasa.css" rel="stylesheet" type="text/css">
  126.  
  127. <script type="text/javascript" src="bahasa.js"></script>
  128.  
  129. <script language="Javascript" type="text/javascript">
  130. <!--
  131. //////////////////////////////////////////////////////////////////////////////
  132. function verify() {
  133.  
  134.     password = document.status.password.value;
  135.  
  136.     if (is_white_space(password)) {
  137.  
  138.         alert(
  139.         "You must give a password value!");
  140.  
  141.         document.status.password.focus();
  142.  
  143.         return(false);
  144.     }
  145.  
  146.     return(true);
  147. }
  148. //////////////////////////////////////////////////////////////////////////////
  149. // -->
  150. </script>
  151. </head>
  152. <body>
  153. <?
  154. $web->show_logo("Online/Offline");
  155. ?>
  156. <a href="admin.php">Administration</a>
  157.  
  158. <?
  159. if (
  160. (isset($_POST['password'])) &&
  161. (isset($_POST['action']))) { 
  162.  
  163.     $errstr = $indonesia->login($_SESSION['ADMIN'], $_POST['password']);
  164.  
  165.     if ($errstr != "") {
  166.  
  167.         print "<br><hr><b>Permission denied!</b><hr><br>\n";
  168.  
  169.     } else {
  170.  
  171.         if ($_POST['action'] == "offline") {
  172.  
  173.             $errstr = $indonesia->set_offline();
  174.  
  175.             if ($errstr != "") {
  176.  
  177.                 print "<br><hr><b>${errstr}</b><hr><br>\n";
  178.  
  179.             } else {
  180.  
  181.                 print 
  182.                 "<br><hr><b>Dictionary is now offline!" .
  183.                 "</b><br><hr>\n";
  184.  
  185.                 $_SESSION['NODUP_OFFLINE_STATUS'] = 1;
  186.             }
  187.  
  188.         } else if ($_POST['action'] == "online") {
  189.  
  190.             $errstr = $indonesia->set_online();
  191.  
  192.             if ($errstr != "") {
  193.  
  194.                 print "<br><hr><b>${errstr}</b><hr><br>\n";
  195.  
  196.             } else {
  197.  
  198.                 print 
  199.                 "<br><hr><b>Dictionary is now online!" .
  200.                 "</b><br><hr>\n";
  201.  
  202.                 $_SESSION['NODUP_OFFLINE_STATUS'] = 1;
  203.             }
  204.         } 
  205.     }
  206.  
  207. } else {
  208.  
  209.     show_status_form($web, $indonesia);
  210. }
  211. ?>
  212.  
  213. </body>
  214. </html>
  215.  
  216. <?
  217. //////////////////////////////////////////////////////////////////////////////
  218. function show_status_form($web, $indonesia) { 
  219.  
  220.     $offline_status = "";
  221.  
  222.     $errstr = $indonesia->get_offline_status($offline_status);
  223.  
  224.     if ($errstr != "") {
  225.  
  226.         print "<br><hr><b>${errstr}</b><hr><br>\n";
  227.  
  228.         return;
  229.     }
  230.  
  231.     if ($offline_status == 0) {
  232.  
  233.         print <<<EOFSSFA
  234. <form name="status" method="post" onsubmit='return verify()'>
  235. <table cellpadding="3" cellspacing="3" border="0">
  236. <tr>
  237. <td>
  238. Password:
  239. </td>
  240. <td>
  241. <input type="password" name="password">
  242. </td>
  243. <td>
  244. <input type="submit" value="Set OFFLINE!">
  245. </td>
  246. </tr>
  247. </table>
  248. <input type="hidden" name="action" value="offline">
  249. </form>
  250. <script language="Javascript" type="text/javascript">
  251. document.status.password.focus();
  252. </script>
  253. EOFSSFA;
  254.  
  255.     } else {
  256.  
  257.         print <<<EOFSSFB
  258. <form name="status" method="post" onsubmit='return verify()'>
  259. <table cellpadding="3" cellspacing="3" border="0">
  260. <tr>
  261. <td>
  262. Password:
  263. </td>
  264. <td>
  265. <input type="password" name="password">
  266. </td>
  267. <td>
  268. <input type="submit" value="Set ONLINE!">
  269. </td>
  270. </tr>
  271. </table>
  272. <input type="hidden" name="action" value="online">
  273. </form>
  274. <script language="Javascript" type="text/javascript">
  275. document.status.password.focus();
  276. </script>
  277. EOFSSFB;
  278.  
  279.     }
  280.  
  281.     return;
  282. }
  283. //////////////////////////////////////////////////////////////////////////////
  284. //////////////////////////////////////////////////////////////////////////////
  285. ?>
  286. @
  287.  
  288.  
  289. 1.5
  290. log
  291. @*** empty log message ***
  292. @
  293. text
  294. @d12 1
  295. a12 1
  296. // Modified:     October 17, 2003
  297. d72 2
  298. @
  299.  
  300.  
  301. 1.4
  302. log
  303. @*** empty log message ***
  304. @
  305. text
  306. @d12 1
  307. a12 1
  308. // Modified:     October 05, 2003
  309. d71 1
  310. a71 6
  311. <title>
  312. Bahasa Indonesia Dictionary: Online/Offline 
  313. </title>
  314. <script language="Javascript" type="text/javascript">
  315. //////////////////////////////////////////////////////////////////////////////
  316. function is_white_space(stoken) {
  317. d73 1
  318. a73 1
  319.     if (stoken == null) return(true);
  320. d75 2
  321. a76 20
  322.     if (stoken == '') return(true);
  323.  
  324.     if (stoken == "") return(true);
  325.  
  326.     return(false);
  327. }
  328. //////////////////////////////////////////////////////////////////////////////
  329. function trim(stoken) {
  330.  
  331.     if (is_white_space(stoken)) {
  332.  
  333.         return(stoken);
  334.     }
  335.  
  336.     stoken = stoken.replace(/^\s*/, "");
  337.  
  338.     stoken = stoken.replace(/\s*$/, "");
  339.  
  340.     return(stoken);
  341. }
  342. d94 2
  343. @
  344.  
  345.  
  346. 1.3
  347. log
  348. @*** empty log message ***
  349. @
  350. text
  351. @d12 1
  352. a12 1
  353. // Modified:     September 30, 2003
  354. d120 3
  355. a122 2
  356. <h2>Bahasa Indonesia Dictionary: Online/Offline</h2> 
  357.  
  358. @
  359.  
  360.  
  361. 1.2
  362. log
  363. @*** empty log message ***
  364. @
  365. text
  366. @d12 1
  367. a12 1
  368. // Modified:     August 19, 2003
  369. d41 1
  370. a41 1
  371. if (!session_is_registered("ADMIN")) {
  372. d59 1
  373. a59 1
  374. if (session_is_registered("NODUP_OFFLINE_STATUS")) {
  375. d61 1
  376. a61 1
  377.     session_unregister("NODUP_OFFLINE_STATUS");
  378. d151 1
  379. a151 3
  380.                 $NODUP_OFFLINE_STATUS = 1;
  381.  
  382.                 session_register("NODUP_OFFLINE_STATUS");
  383. a153 1
  384.  
  385. d168 1
  386. a168 3
  387.                 $NODUP_OFFLINE_STATUS = 1;
  388.  
  389.                 session_register("NODUP_OFFLINE_STATUS");
  390. @
  391.  
  392.  
  393. 1.1
  394. log
  395. @Initial revision
  396. @
  397. text
  398. @d5 34
  399. a38 1
  400.  
  401. a256 2
  402.  
  403.  
  404. @
  405.  
  406.  
  407. 1.1.1.1
  408. log
  409. @Bahasa Indonesia Dictionary
  410. @
  411. text
  412. @@
  413.