Commit b084efa27525c993c8f76c79cf01bee08d48f6f0

Authored by michael
1 parent b4f94f40

reformatted and moved non function code to the end of the page


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@40 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 114 additions and 125 deletions
lib/owl.lib.php
... ... @@ -12,97 +12,6 @@
12 12 * @package Owl
13 13 */
14 14  
15   -// Support for reg.globals off WES
16   -
17   -// check for phpversion
18   -if (substr(phpversion(),0,5) >= "4.1.0")
19   - {
20   - import_request_variables('pgc');
21   - }
22   - else
23   - {
24   - if (!EMPTY($_POST))
25   - {
26   - extract($_POST);
27   - }
28   - else
29   - {
30   - extract($HTTP_POST_VARS);
31   - }
32   - if (!EMPTY($_GET))
33   - {
34   - extract($_GET);
35   - }
36   - else
37   - {
38   - extract($HTTP_GET_VARS);
39   - }
40   -
41   - if (!EMPTY($_FILE))
42   - {
43   - extract($_FILE);
44   - }
45   - else
46   - {
47   - extract($HTTP_POST_FILES);
48   - }
49   -}
50   -
51   -
52   -//set initial session var
53   -if(!isset($sess))
54   -{
55   - $sess = 0;
56   -}
57   -
58   -// set initial loginname
59   -if(!isset($loginname))
60   -{
61   - $loginname = 0;
62   -}
63   -//set login var
64   -if(!isset($login))
65   -{
66   - $login = 0;
67   -}
68   -
69   -// set default language
70   -if(isset($default->owl_lang))
71   - {
72   - $langdir = "$default->owl_fs_root/locale/$default->owl_lang";
73   -
74   - if(is_dir("$langdir") != 1)
75   - {
76   - die("$lang_err_lang_1 $langdir $lang_err_lang_2");
77   - }
78   - else
79   - {
80   - $sql = new Owl_DB;
81   - $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'");
82   - $sql->next_record();
83   - $numrows = $sql->num_rows($sql);
84   - $getuid = $sql->f("uid");
85   - if($numrows == 1)
86   - {
87   - $sql->query("select * from $default->owl_users_table where id = $getuid");
88   - $sql->next_record();
89   - $language = $sql->f("language");
90   - // BEGIN wes fix
91   - if(!$language)
92   - {
93   - $language = $default->owl_lang;
94   - }
95   - // END wes fix
96   - require("$default->owl_fs_root/locale/$language/language.inc");
97   - $default->owl_lang = $language;
98   - }
99   - else
100   - require("$default->owl_fs_root/locale/$default->owl_lang/language.inc");
101   - }
102   -} else {
103   - die("$lang_err_lang_notfound");
104   -}
105   -
106 15 /**
107 16 * class Owl_DB extends DB_Sql
108 17 *
... ... @@ -1105,35 +1014,6 @@ function uploadCompat($varname) {
1105 1014 return $retfile;
1106 1015 }
1107 1016  
1108   -// why is this code here???????????????????????????? is it part of the function??????
1109   -if ($sess)
1110   -{
1111   - gethtmlprefs();
1112   - $ok = verify_session($sess);
1113   - $temporary_ok = $ok["bit"];
1114   - $userid = $ok["userid"];
1115   - $usergroupid = $ok["groupid"];
1116   - if ($ok["bit"] != "1") {
1117   - // Bozz Bug Fix begin
1118   - if (file_exists("./lib/header.inc")) {
1119   - include("./lib/header.inc");
1120   - } else {
1121   - include("../lib/header.inc");
1122   - }
1123   - // Bozz Bug Fix end
1124   - print("<BR><BR><CENTER>".$lang_invalidsess);
1125   - if ($parent == "" || $fileid == "")
1126   - print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
1127   - else
1128   - print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
1129   - exit;
1130   - } else {
1131   - $lastused = time();
1132   - $sql = new Owl_DB;
1133   - $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'");
1134   - }
1135   -}
1136   -
1137 1017 //------------------------------------------------------------
1138 1018 /**
1139 1019 * Function checkrequirements()
... ... @@ -1614,11 +1494,120 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) {
1614 1494  
1615 1495 };
1616 1496  
1617   -// why is this here?????????????????????????????????????????
1618   -if (!$sess && !$loginname && !$login)
1619   - if(!isset($fileid))
  1497 +// ----------------------
  1498 +// page start
  1499 +// ----------------------
  1500 +
  1501 +/**
  1502 + * Initialises the web application by making current
  1503 + * request parameters global, performing session checking
  1504 + * and loading the default language
  1505 + */
  1506 +// make request parameters global
  1507 +if (substr(phpversion(),0,5) >= "4.1.0") {
  1508 + // if supported by the installed version of PHP
  1509 + import_request_variables('pgc');
  1510 +} else {
  1511 + // do it manually
  1512 + if (!EMPTY($_POST)) {
  1513 + extract($_POST);
  1514 + } else {
  1515 + extract($HTTP_POST_VARS);
  1516 + }
  1517 +
  1518 + if (!EMPTY($_GET)) {
  1519 + extract($_GET);
  1520 + } else {
  1521 + extract($HTTP_GET_VARS);
  1522 + }
  1523 +
  1524 + if (!EMPTY($_FILE)) {
  1525 + extract($_FILE);
  1526 + } else {
  1527 + extract($HTTP_POST_FILES);
  1528 + }
  1529 +}
  1530 +
  1531 +// initialise session var
  1532 +if(!isset($sess)) {
  1533 + $sess = 0;
  1534 +}
  1535 +// initialise loginname
  1536 +if(!isset($loginname)) {
  1537 + $loginname = 0;
  1538 +}
  1539 +// initialise login var
  1540 +if(!isset($login)) {
  1541 + $login = 0;
  1542 +}
  1543 +
  1544 +// set default language
  1545 +if(isset($default->owl_lang)) {
  1546 +
  1547 + $langdir = "$default->owl_fs_root/locale/$default->owl_lang";
  1548 +
  1549 + if(is_dir("$langdir") != 1) {
  1550 + die("$lang_err_lang_1 $langdir $lang_err_lang_2");
  1551 + } else {
  1552 +
  1553 + $sql = new Owl_DB;
  1554 + $sql->query("select * from $default->owl_sessions_table where sessid = '$sess'");
  1555 + $sql->next_record();
  1556 + $numrows = $sql->num_rows($sql);
  1557 + $getuid = $sql->f("uid");
  1558 + if($numrows == 1) {
  1559 + $sql->query("select * from $default->owl_users_table where id = $getuid");
  1560 + $sql->next_record();
  1561 + $language = $sql->f("language");
  1562 + // BEGIN wes fix
  1563 + if(!$language) {
  1564 + $language = $default->owl_lang;
  1565 + }
  1566 + // END wes fix
  1567 + require("$default->owl_fs_root/locale/$language/language.inc");
  1568 + $default->owl_lang = $language;
  1569 + } else {
  1570 + require("$default->owl_fs_root/locale/$default->owl_lang/language.inc");
  1571 + }
  1572 + }
  1573 +} else {
  1574 + die("$lang_err_lang_notfound");
  1575 +}
  1576 +
  1577 +if ($sess) {
  1578 + gethtmlprefs();
  1579 + $ok = verify_session($sess);
  1580 + $temporary_ok = $ok["bit"];
  1581 + $userid = $ok["userid"];
  1582 + $usergroupid = $ok["groupid"];
  1583 +
  1584 + if ($ok["bit"] != "1") {
  1585 + // Bozz Bug Fix begin
  1586 + if (file_exists("./lib/header.inc")) {
  1587 + include("./lib/header.inc");
  1588 + } else {
  1589 + include("../lib/header.inc");
  1590 + }
  1591 + // Bozz Bug Fix end
  1592 + print("<BR><BR><CENTER>".$lang_invalidsess);
  1593 + if ($parent == "" || $fileid == "") {
  1594 + print("<A HREF='$default->owl_root_url/index.php'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
  1595 + } else {
  1596 + print("<A HREF='$default->owl_root_url/index.php?parent=$parent&fileid=$fileid'><IMG SRC='$default->owl_root_url/locale/$default->owl_lang/graphics/btn_login.gif' BORDER=0 ></A>");
  1597 + }
  1598 + exit;
  1599 + } else {
  1600 + $lastused = time();
  1601 + $sql = new Owl_DB;
  1602 + $sql->query("update $default->owl_sessions_table set lastused = '$lastused' where uid = '$userid'");
  1603 + }
  1604 +}
  1605 +
  1606 +if (!$sess && !$loginname && !$login) {
  1607 + if(!isset($fileid)) {
1620 1608 header("Location: " . $default->owl_root_url . "/index.php?login=1");
1621   - else
  1609 + } else {
1622 1610 header("Location: " . $default->owl_root_url . "/index.php?login=1&fileid=$fileid&parent=$parent");
1623   -
  1611 + }
  1612 +}
1624 1613 ?>
... ...