diff --git a/admin/admin_dbmodify.php b/admin/admin_dbmodify.php index 9b899e4..4780fb1 100755 --- a/admin/admin_dbmodify.php +++ b/admin/admin_dbmodify.php @@ -1,27 +1,40 @@ query("SELECT * FROM $default->owl_users_table WHERE id = '$id'"); $sql->next_record(); $newpass = $sql->f("password"); - if ($newpass == $password) { + + // update password + if ($newpass == $password) + { $sql->query("UPDATE $default->owl_users_table SET groupid='$groupid',username='$loginname',name='$name',password='$password',quota_max='$quota', email='$email',notify='$notify',email='$email',attachfile='$attachfile',disabled='$disabled',noprefaccess='$noprefaccess',language='$newlanguage',maxsessions='$maxsessions' where id = '$id'"); } else @@ -31,13 +44,14 @@ if($action == "user") { // Bozz Change BEGIN // Clean Up the member group table first - $sql->query("DELETE FROM $default->owl_users_grpmem_table WHERE userid = $id"); // Insert the new Choices the member group table with selected groups - for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) { + for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) + { $checkboxfields = 'group' . $i; - if($$checkboxfields != '') { + if($$checkboxfields != '') + { $checkboxvalue = $$checkboxfields; $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$id', '$checkboxvalue')"); } @@ -46,7 +60,10 @@ if($action == "user") { header("Location: index.php?sess=$sess&action=users&owluser=$id&change=1"); } -if($action == "group") { +// if action selected is group +if($action == "group") +{ + //update the group table global $default; $sql = new Owl_DB; $sql->query("UPDATE $default->owl_groups_table SET name='$name' where id = '$id'"); @@ -54,8 +71,13 @@ if($action == "group") { } // BEGIN BUG FIX: #448232 mistake in admin_dbmodify.php -if($action == $lang_deleteuser) { + +// if action is delete user +if($action == $lang_deleteuser) +{ // END BUG FIX: #448232 mistake in admin_dbmodify.php + + //delete the user $sql = new Owl_DB; $sql->query("DELETE FROM $default->owl_users_table WHERE id = '$id'"); // Bozz Change Begin @@ -65,7 +87,10 @@ if($action == $lang_deleteuser) { header("Location: index.php?sess=$sess&action=users"); } -if($action == "edhtml") { +// if action is edit html +if($action == "edhtml") +{ + //update html settings $sql = new Owl_DB; $sql->query("UPDATE $default->owl_html_table SET table_border='$border', table_header_bg='$header_bg', table_cell_bg='$cell_bg',table_cell_bg_alt='$cell_bg_alt',body_bgcolor='$body_bgcolor',body_textcolor='$body_textcolor',body_link='$body_link',body_vlink='$body_vlink',table_expand_width='$expand_width',table_collapse_width='$collapse_width', main_header_bgcolor='$main_header_bgcolor' "); @@ -73,9 +98,11 @@ if($action == "edhtml") { } +//if action is edit prefernces if($action == "edprefs") { $sql = new Owl_DB; + //update the preferences if ($lookAtHD != "false" ) $lookAtHD = "true"; if ($owl_expand != "1") @@ -89,42 +116,64 @@ if($action == "edprefs") { } // BEGIN BUG FIX: #448232 mistake in admin_dbmodify.php -if($action == $lang_deletegroup ) { +// if action is delete group +if($action == $lang_deletegroup ) +{ // END BUG FIX: #448232 mistake in admin_dbmodify.php + + //delete specified group global $default; $sql = new Owl_DB; $sql->query("DELETE FROM $default->owl_groups_table WHERE id = '$id'"); header("Location: index.php?sess=$sess&action=groups"); } -if($action == "add") { - if($type == "user") { +// if action selected is add +if($action == "add") +{ + // if user to be added insert user into db + if($type == "user") + { $maxsessions = $maxsessions - 1; // always is stored - 1 $sql = new Owl_DB; $sql->query("SELECT * FROM $default->owl_users_table WHERE username = '$loginname'"); - if($sql->num_rows($sql) > 0) die ("$lang_err_user_exists"); + + //check if user exists + if($sql->num_rows($sql) > 0) + { + die ("$lang_err_user_exists"); + } + $sql->query("INSERT INTO $default->owl_users_table (groupid,username,name,password,quota_max,quota_current,email,notify,attachfile,disabled,noprefaccess,language,maxsessions) VALUES ('$groupid', '$loginname', '$name', '" . md5($password) . "', '$quota', '0', '$email', '$notify','$attachfile', '$disabled', '$noprefaccess', '$newlanguage', '$maxsessions')"); // Bozz Change BEGIN // Populated the member group table with selected groups $sql->query("SELECT id FROM $default->owl_users_table WHERE username = '$loginname'"); $sql->next_record(); $newuid = $sql->f("id"); - for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) { - $checkboxfields = 'group' . $i; - if($$checkboxfields != '') { - $checkboxvalue = $$checkboxfields; - $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$newuid', '$checkboxvalue')"); - } + + for ( $i = 0 ; $i <= $no_groups_displayed; $i++ ) + { + $checkboxfields = 'group' . $i; + if($$checkboxfields != '') + { + $checkboxvalue = $$checkboxfields; + $sql->query("INSERT INTO $default->owl_users_grpmem_table (userid,groupid) VALUES ('$newuid', '$checkboxvalue')"); + } } /* Bozz Change END */ - if($home == "1") { + + // set home folder???? + if($home == "1") + { $sql->query("select * from $default->owl_users_table where username = '$loginname'"); while($sql->next_record()) $id = $sql->f("id"); $sql->query("insert into $default->owl_folders_table values (0, '$loginname', '2', '54', '$groupid', '$id')"); mkdir($default->owl_fs_root."/".fid_to_name("1")."/Home/$loginname", 0777); } header("Location: index.php?sess=$sess"); - } elseif($type == "group") { + } + elseif($type == "group") + { $sql = new Owl_DB; $sql->query("INSERT INTO $default->owl_groups_table (name) VALUES ('$name')"); header("Location: index.php?sess=$sess"); diff --git a/admin/index.php b/admin/index.php index d703b29..ef2c663 100755 --- a/admin/index.php +++ b/admin/index.php @@ -1,34 +1,62 @@ "); -if($usergroupid != "0") die("$lang_err_unauthorized"); +// if usergroupid invalid then unauthorised view and exit +if($usergroupid != "0") +{ + die("$lang_err_unauthorized"); +} -if(!isset($action)) $action = "users"; +// if not action set ..set action to users +if(!isset($action)) +{ + $action = "users"; +} -function printusers() { +//------------------------------------------------------------- +/** + * Function PrintUsers + * + * Prints the users out + * + */ +//------------------------------------------------------------- +// Semi-Usable - Interface based +function printusers() +{ global $sess, $default, $lang_users; + //create a new connection $sql = new Owl_DB; + // create a new active session $sql_active_sess = new Owl_DB; + $sql->query("select username,name,id,maxsessions from $default->owl_users_table order by name"); @@ -64,18 +92,21 @@ function printusers() { print("table_border>"); - + while($sql->next_record()) { + // loop through record getting user information $uid = $sql->f("id"); $username = $sql->f("username"); $name = $sql->f("name"); $maxsess = $sql->f("maxsessions") + 1; $numrows = 0; + // find active sessions $sql_active_sess->query("select * from $default->owl_sessions_table where uid = $uid"); $sql_active_sess->next_record(); $numrows = $sql_active_sess->num_rows($sql_active_sess); + // print out information ->not usable if ($name == "") print(""); else @@ -85,24 +116,53 @@ function printusers() { print("
table_header_bg>$lang_userstable_header_bg> 
".$username."
"); } -function printgroups() { +//------------------------------------------------------------- +/** + * Function PrintGroups + * + * Prints the Groups out + * + */ +//------------------------------------------------------------- +// Semi-Usable -> Interface Based +function printgroups() +{// print out all groups global $sess, $lang_groups, $default; $sql = new Owl_DB; $sql->query("select name,id from $default->owl_groups_table order by name"); print("table_border>"); - while($sql->next_record()) { + + while($sql->next_record()) + { print(""); } print("
table_header_bg>$lang_groups
".$sql->f("name")."
"); } -function printuser($id) { +//------------------------------------------------------------- +/** + * Function PrintUsr($id) + * + * Prints the User out + * + * @param $id + * The Id of the user who's info is to be printed + * + */ +//------------------------------------------------------------- +// Semi-Usable -> Interface Based +function printuser($id) +{ //declare globals global $sess,$change,$lang_saved,$lang_title,$lang_group,$lang_username,$lang_password,$lang_change,$lang_quota,$lang_groupmember,$lang_noprefaccess,$lang_disableuser, $lang_userlang, $lang_maxsessions, $lang_attach_file; global $lang_flush_sessions_alt, $lang_flushed, $lang_deleteuser, $lang_email, $lang_notification, $default, $flush; - if($change == 1) print("$lang_saved
"); + if($change == 1) + { + print("$lang_saved
"); + } - if ($flush == 1) { + if ($flush == 1) + { flushsessions($id, $sess); print($lang_flushed); } @@ -110,13 +170,19 @@ function printuser($id) { $sql = new Owl_DB; $sql->query("select id,name from $default->owl_groups_table order by name"); $i=0; - while($sql->next_record()) { + + // store groups in array + while($sql->next_record()) + { $groups[$i][0] = $sql->f("id"); $groups[$i][1] = $sql->f("name"); $i++; } $sql->query("select * from $default->owl_users_table where id = '$id'"); - while($sql->next_record()) { + + //post to dbmodify any changes and their values + while($sql->next_record()) + { print("
"); print(""); print(""); @@ -124,7 +190,8 @@ function printuser($id) { print("table_border>"); print(""); @@ -146,17 +213,22 @@ function printuser($id) { // Bozz Change begin //This is to allow a user to be part of more than one group + // assign a user to more than one group print(""); print(""); print(""); + $lang_flush_sessions_alt"); print(""); print(""); + + // if notify is on ..set its value to checked if ( $sql->f("notify") == 1) - print(""); + { + print(""); + } else + { print(""); + } + + // if attachfile is on ..set its value to checked if ( $sql->f("attachfile") == 1) + { print(""); + } else + { print(""); - if ($id != 1) { - if ( $sql->f("disabled") == 1) - print(""); - else - print(""); - if ( $sql->f("noprefaccess") == 1) - print(""); - else - print(""); + } + + + if ($id != 1) + { + // if disabled is on ..set its value to checked + if ( $sql->f("disabled") == 1) + { + print(""); + } + else + { + print(""); + } + + // if noprefaccess is on ..set its value to checked + if ( $sql->f("noprefaccess") == 1) + { + print(""); + } + else + { + print(""); + } } + print("
table_header_bg align=right>$lang_title
table_header_bg align=right>$lang_group
table_header_bg align=right>$lang_groupmember"); $i=0; $sqlmemgroup = new Owl_DB; - foreach($groups as $g) { + foreach($groups as $g) + { $is_set_gid = $g[0]; $sqlmemgroup->query("select userid from $default->owl_users_grpmem_table where userid = '$id' and groupid = '$is_set_gid'"); $sqlmemgroup->next_record(); - if ($sqlmemgroup->num_rows($sqlmemgroup) > 0) { + + if ($sqlmemgroup->num_rows($sqlmemgroup) > 0) + { print("$g[1]
"); } - else { + else + { print("$g[1]
"); } $i++; @@ -171,29 +243,59 @@ function printuser($id) { print("
table_header_bg ALIGN=RIGHT>$lang_username
table_header_bg align=right>$lang_quota".$sql->f("quota_current")." /
table_header_bg align=right>$lang_maxsessions".($sql->f("maxsessions") + 1)." / -$lang_flush_sessions_alt
table_header_bg align=right>$lang_password
table_header_bg align=right>$lang_email
table_header_bg align=right>$lang_notification
table_header_bg align=right>$lang_notification
table_header_bg align=right>$lang_notification
table_header_bg align=right>$lang_attach_file
table_header_bg align=right>$lang_attach_file
table_header_bg align=right>$lang_disableuser
table_header_bg align=right>$lang_disableuser
table_header_bg align=right>$lang_noprefaccess
table_header_bg align=right>$lang_noprefaccess
table_header_bg align=right>$lang_disableuser
table_header_bg align=right>$lang_disableuser
table_header_bg align=right>$lang_noprefaccess
table_header_bg align=right>$lang_noprefaccess

"); - if ($sql->f("id") != 1) { + + // delete user if id != 1 + if ($sql->f("id") != 1) + { print(""); } @@ -201,31 +303,83 @@ function printuser($id) { } } -function flushsessions($id, $sess) { +//------------------------------------------------------------- +/** + * Function flushsessions($id, $sess) + * + * Flushes the session variable form the db + * + * @param $id + * The Id of the user + * @param $sess + * The session variable +*/ +//------------------------------------------------------------- +// Usable +function flushsessions($id, $sess) +{ global $default; $sql= new Owl_DB; $sql->query("delete from $default->owl_sessions_table where uid='$id' AND sessid!='$sess'"); } -function printgroup($id) { +//------------------------------------------------------------- +/** + * Function printgroup($id) + * + * Prints out the group + * + * @param $id + * The Id of the user + * +*/ +//------------------------------------------------------------- +// Semi-Usable -> interface based + +function printgroup($id) +{ global $sess,$change,$lang_title,$lang_change,$lang_deletegroup,$lang_saved,$default; - if(isset($change)) print("$lang_saved
"); + + if(isset($change)) + { + print("$lang_saved
"); + } + $sql = new Owl_DB; $sql->query("select id,name from $default->owl_groups_table where id = '$id'"); - while($sql->next_record()) { + + // post to dbmodify with several values + while($sql->next_record()) + { print(""); print(""); print(""); print(""); print("table_border>
table_header_bg>$lang_title
"); print("
"); - if($sql->f("id") != 0) print(""); + + // delete the group + if($sql->f("id") != 0) + { + print(""); + } print("
"); } } -function printnewgroup() { +//------------------------------------------------------------- +/** + * Function printnewgroup() + * + * Prints out a new group + * + +*/ +//------------------------------------------------------------- +// NOT Usable +function printnewgroup() +{ global $default, $sess,$lang_title,$lang_add; print("
"); print(""); @@ -234,13 +388,24 @@ function printnewgroup() { print("table_border>
table_header_bg>$lang_title

"); } +//------------------------------------------------------------- +/** + * Function printnewuserr() + * + * Prints out a new user + * +*/ +//------------------------------------------------------------- +// Semi-Usable function printnewuser() { global $sess,$lang_title,$lang_username,$lang_group,$lang_password,$lang_add,$default, $lang_quota,$lang_groupmember; global $lang_email, $lang_notification, $lang_noprefaccess, $lang_disableuser, $lang_userlang, $lang_maxsessions, $lang_attach_file; $sql = new Owl_DB; $sql->query("select id,name from $default->owl_groups_table order by name"); $i=0; - while($sql->next_record()) { + // get all groups + while($sql->next_record()) + { $groups[$i][0] = $sql->f("id"); $groups[$i][1] = $sql->f("name"); $i++; @@ -252,30 +417,32 @@ function printnewuser() { print("table_border>"); print(""); print(""); //******************************* // Display the Language dropdown //******************************* - print(""); // Bozz Change begin @@ -283,7 +450,8 @@ function printnewuser() { print("
table_header_bg align=right>$lang_title
table_header_bg align=right>$lang_username
table_header_bg align=right>$lang_group
table_header_bg align=right>$lang_userlang
table_header_bg align=right>$lang_userlang
table_header_bg align=right>$lang_groupmember"); $i=0; - foreach($groups as $g) { + foreach($groups as $g) + { print("$g[1]
"); $i++; } @@ -302,6 +470,15 @@ function printnewuser() { print("

"); } +//------------------------------------------------------------- +/** + * Function printHTML() + * + * Prints out the required HTML + * + */ +//------------------------------------------------------------- +// NOT Usable function printhtml() { global $default, $sess, $lang_add, $lang_change, $change, $lang_saved; global $lang_ht_tbl_border_sz, $lang_ht_tbl_hd_bg, $lang_ht_tbl_cell_bg_cl, $lang_ht_tbl_cell_bg_al, $lang_ht_tbl_bg_cl, $lang_ht_expand_width, $lang_ht_collapse_width, $lang_ht_bd_bg_cl, $lang_ht_bd_txt_cl, $lang_ht_bd_lnk_cl, $lang_ht_bd_vlnk_cl, $lang_ht_bd_width; @@ -335,7 +512,15 @@ function printhtml() { "); print("
"); } - +//------------------------------------------------------------- +/** + * Function printPrefs() + * + * Prints out the preferences in a specific format + * + */ +//------------------------------------------------------------- +// NOT Usable function printprefs() { global $default, $sess, $lang_add, $lang_change, $change, $lang_saved; global $lang_owl_title_email, $lang_owl_email_from, $lang_owl_email_fromname, $lang_owl_email_replyto , $lang_owl_email_server, $lang_owl_title_HD, $lang_owl_lookAtHD, $lang_owl_def_file_security, $lang_owl_def_file_group_owner, $lang_owl_def_file_owner, $lang_owl_def_file_title, $lang_owl_def_file_meta , $lang_owl_def_fold_sec, $lang_owl_def_fold_group_owner, $lang_owl_def_fold_owner, $lang_owl_title_other, $lang_owl_max_filesize, $lang_owl_owl_timeout, $lang_owl_owl_expand, $lang_owl_version_control, $lang_owl_restrict_view ; @@ -358,7 +543,8 @@ function printprefs() { "); print("main_header_bgcolor align=CENTER colspan=2>$lang_owl_title_HD"); - if ( $default->owl_LookAtHD == "false" ){ + if ( $default->owl_LookAtHD == "false" ) + { print("table_header_bg align=right>$lang_owl_lookAtHD"); print(""); print(""); @@ -369,103 +555,138 @@ function printprefs() { print(""); print(""); } - else { + else + { print("table_header_bg align=right>$lang_owl_lookAtHD"); printfileperm($default->owl_def_file_security, "def_file_security", $lang_owl_def_file_security, "user"); - - $sql = new Owl_DB; $sql->query("select id,name from $default->owl_groups_table"); $i=0; - while($sql->next_record()) { + // get all groups + while($sql->next_record()) + { $groups[$i][0] = $sql->f("id"); $groups[$i][1] = $sql->f("name"); $i++; - } + } print("table_header_bg>$lang_owl_def_file_group_owner"); $sql = new Owl_DB; $sql->query("select id,name from $default->owl_users_table"); $i=0; - while($sql->next_record()) { + + // get all users + while($sql->next_record()) + { $users[$i][0] = $sql->f("id"); $users[$i][1] = $sql->f("name"); $i++; } print("table_header_bg>$lang_owl_def_file_owner"); + + loop through users + foreach($users as $g) + { + print("