You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(19) |
Feb
(6) |
Mar
(7) |
Apr
(20) |
May
(24) |
Jun
(18) |
Jul
(6) |
Aug
|
Sep
(1) |
Oct
|
Nov
(8) |
Dec
(9) |
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <aku...@sh...> - 2004-08-20 03:27:08
|
11'th Annual Tcl/Tk Conference October 11 - 15, 2004 New Orleans, Louisiana, USA Email Contact tc...@tc... We are pleased to announce the 11'th Annual Tcl/Tk conference (Tcl'2004), sponsored by Noumena Corporation, in cooperation with ActiveState and ExpoTech. Come to New Orleans to: * Learn about the power of Tcl/Tk. * Present exciting new work involving Tcl/Tk. * See the latest developments in Tcl/Tk. * Meet Tcl/Tk researchers and users from academia, government and industry. * Plan for future Tcl/Tk related developments. The conference program will include paper presentations, tutorials, Birds of a Feather (BOF) sessions and invited key-note talks. Registration Online registration is ready now. <http://www.tcl.tk/community/tcl2004/reg.html> Tutorials Come learn about Tcl from the experts. This year's Tcl/Tk Conference includes one of the best sets of Tutorials ever offered including tutorials on Jacl, TclHttpd, Starkit, Advanced GUI construction, and the API. <http://www.tcl.tk/community/tcl2004/tut2004.html> Schedule More details will be added to the schedule as they become available. <http://www.tcl.tk/community/tcl2004/schedule.html> Those attending the conference will be interested in the conference info page. <http://www.tcl.tk/community/tcl2004/info.html> To keep in touch with news regarding the conference and Tcl events in general, subscribe to the tcl-announce list. <http://listserv.activestate.com/mailman/mysubs?show=announce> Other Forms of Participation For those who are not presenting a paper at the conference, but would like to present their work in some form, we do provide several other forms of participation. Slots for Works-in-Progress (WIP) presentations and Birds-of-a-Feather sessions (BOFs) are available on a first-come, first-served basis by sending email to tc...@tc.... Some WIP and BOF time slots will be held open for on-site reservation, so we encourage all attendees with interesting work in progress to consider presenting that work at the conference. Conference Committee Gerald Lester HMS Software General Chair Andreas Kupries ActiveState Corp Clif Flynt Noumena Corp Website Admin Jeffrey Hobbs ActiveState Corp Kevin Kenny GE Global Research Center Ken Jones Avia Training Mac Cody Raytheon Company Kim Richerts Steve Landers Digital Smarties Sheila Miguez Motorola Larry Virden Tcl FAQ Maintainer Contact Information tc...@tc... |
From: Frederik V. <ge...@us...> - 2004-01-28 19:32:43
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2004-01-28 19:31:30 UTC Modified files: eggbase.stats.tcl eggbase.tcl Log message: Author: Frederik Vervaet Log message: Abusers beware! Commands are now logged. Commands done sofar : LOGIN ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.13 EggBase/eggbase.stats.tcl:1.14 --- EggBase/eggbase.stats.tcl:1.13 Sat Jan 24 16:17:09 2004 +++ EggBase/eggbase.stats.tcl Wed Jan 28 11:31:18 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.13 2004/01/25 00:17:09 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.14 2004/01/28 19:31:18 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -56,7 +56,7 @@ ## ##DATA ##) ) -##FROM log_table +##FROM chanlog_table ###WHERE user_id = 2 ##GROUP BY user_id LIMIT 0 , 30 @@ -66,8 +66,12 @@ bind pub - .stats cmds:pub:stats bind pub - .notestats cmds:pub:notestats -bind pub - .charcount cmds:pub:charcount -bind pub - .top10 cmds:pub:top10 +# replaced by new commands +#bind pub - .charcount cmds:pub:charcount +bind pub - .charcount cmds:pub:charcount2 +# replaced by new commands +#bind pub - .top10 cmds:pub:top10 +bind pub - .top10 cmds:pub:top010 # msg binds @@ -219,22 +223,106 @@ Average line length : $ratio." } - -proc cmds:pub:top10 { nick host handle channel args } { +proc cmds:pub:charcount2 { nick host handle channel args } { global settings if { ![channel get $channel stats_charcount] } { + putnotc $nick "Command Disabled in this channel." + return 0 + } + if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 charcount] } { + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + return 0 + } + set chanid [sql:getchanid [charfilter $channel]] + set userid [login:base:nick2userid2 $nick $host] - putnotc $nick "Command Disabled in this channel." + # A user will always exist if they have spoken. If they haven't spoken set count to 0 - return 0 + ##SELECT SUM( CHAR_LENGTH( + ## + ##DATA + ##) ) + ##FROM chanlog_table + ###WHERE user_id = 2 + ##GROUP BY user_id LIMIT 0 , 30 + + #charcount. + set timestamp [expr [unixtime] - 2592000] + set charcount [sql "SELECT SUM(CHAR_LENGTH(data)) FROM chanlog_table WHERE user_id='$userid' + AND type='1' + AND timestamp >= '$timestamp' + AND chan_id='$chanid';"] + + set linecount [sql "SELECT count(id) FROM chanlog_table WHERE user_id='$userid'\ + AND type='1'\ + AND timestamp >= '$timestamp' + AND chan_id='$chanid';"] + + # No split is required here since we are certain both vars will be integers. + set ratio [expr $charcount/$linecount] + + putmsg $channel "$nick : 30 days summary : Characters : $charcount ** Lines $linecount ** Avg length $ratio." + +} + +proc cmds:pub:top010 { nick host handle channel args } { + + global settings + if { ![channel get $channel stats_charcount] } { + putnotc $nick "Command Disabled in this channel." + return 0 + } + if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 top10] } { + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + return 0 + } + set chanid [sql:getchanid [charfilter $channel]] + #set userid [login:base:nick2userid2 $nick $host] + set timestamp [expr [unixtime] - 2592000] + + set charcount_userid [sql "SELECT SUM(CHAR_LENGTH(data)),user_id FROM chanlog_table WHERE type='1' + AND timestamp >= '$timestamp' + AND user_id != '-1' + AND chan_id='$chanid' + GROUP BY user_id + ORDER BY 1 DESC + LIMIT 10;"] + set linecount_userid [sql "SELECT count(id),user_id FROM chanlog_table WHERE type='1' + AND timestamp >= '$timestamp' + AND user_id != '-1' + AND chan_id='$chanid' + GROUP BY user_id + ORDER BY 1 DESC + LIMIT 10;"] + set chartop10 "Characters \:" + set linetop10 "Linecount \:" + + # id -1 is allready excluded in the query so no need to ignore it here. + foreach entry $charcount_userid entry2 $linecount_userid { + set count [lindex $entry 0] + set userid [lindex $entry 1] + append chartop10 " [sql "SELECT handle FROM user_table WHERE userid='$userid';"]\($count\)" + set count [lindex $entry2 0] + set userid [lindex $entry2 1] + append linetop10 " [sql "SELECT handle FROM user_table WHERE userid='$userid';"]\($count\)" } + putmsg $channel "$nick : $chartop10 ***** $linetop10" +} +proc cmds:pub:top10 { nick host handle channel args } { + + global settings + + if { ![channel get $channel stats_charcount] } { + putnotc $nick "Command Disabled in this channel." + return 0 + } if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 top10] } { - putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 - return 0 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + return 0 } set chanid [sql:getchanid [charfilter $channel]] @@ -243,7 +331,7 @@ set chartop10 "Charcount \:" set linetop10 "Linecount \:" -foreach userid1 [sql "SELECT userid FROM stats_table WHERE chanid='$chanid' AND type='charcount' ORDER BY value DESC limit 0,10;"]\ + foreach userid1 [sql "SELECT userid FROM stats_table WHERE chanid='$chanid' AND type='charcount' ORDER BY value DESC limit 0,10;"]\ value1 [sql "SELECT value FROM stats_table WHERE chanid='$chanid' AND type='charcount' ORDER BY value DESC limit 0,10;"]\ userid2 [sql "SELECT userid FROM stats_table WHERE chanid='$chanid' AND type='linecount' ORDER BY value DESC limit 0,10;"]\ value2 [sql "SELECT value FROM stats_table WHERE chanid='$chanid' AND type='linecount' ORDER BY value DESC limit 0,10;"]\ @@ -333,6 +421,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.13 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.14 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.35 EggBase/eggbase.tcl:1.36 --- EggBase/eggbase.tcl:1.35 Sat Jan 24 16:17:09 2004 +++ EggBase/eggbase.tcl Wed Jan 28 11:31:18 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.35 2004/01/25 00:17:09 genesis Exp $ +## $Id: eggbase.tcl,v 1.36 2004/01/28 19:31:18 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -38,6 +38,11 @@ ## functions.tcl ## ## ## ########################################################################## +## ## +## LOG TABLE ## +## ## + + ## ---------------------------------------------------------------------------- @@ -276,7 +281,7 @@ # If an if statement were positive, there would be 2 queries. So, in ALL # cases there is 1 sql query. Therefore, using the DEL syntax without a if will # not generate an error and is better than first checking if nick is in nextdb. - + # SF BUG reported by nex innext system! sql "DELETE FROM next WHERE UserNick='[charfilter $nick]';" sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='authenticating with me \[$nick![getchanhost $nick]\]' WHERE userid='$userid';" @@ -315,7 +320,7 @@ # The above proc needs revision. During testing we manually connect. set nick [lindex [charfilter $data] 1] - + # Mc services does a regular whois on the bot. Ignore those. if { [string tolower $nick] == [string tolower $botnick] } { return 0 } @@ -363,6 +368,7 @@ # We do not check to see if usernick is in next db since that would required minimum 1 query if not # and 2 queries if the user is inthere. So either way we have to do 1 query so might aswell do it now :p + # SF bug reported by nex. sql "DELETE FROM next WHERE UserNick='[charfilter $nick]';" putdebug "Deleted [charfilter $nick] from .next db after login." 1 @@ -1003,7 +1009,7 @@ ##add log_stats if { $tempcache != 1 } { set userid "-1" } ##replaced by log:sql - ## sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',nick='$nick',hostmask='$host',data='[sqlfilter $text]',timestamp='[unixtime]';" + ## sql "INSERT INTO chanlog_table SET chan_id='$chanid',user_id='$userid',type='1',nick='$nick',hostmask='$host',data='[sqlfilter $text]',timestamp='[unixtime]';" ##putdebug "Recorded pubm \: $nick@$host on $channel" 1 log:sql $chanid $userid 1 $nick $host $text } @@ -1065,6 +1071,7 @@ # Eggdrop native /who's have a querytype which is autotranslated to a channel. # the query type is always displayed first so ... + putdebug $data 1 set data [split $data] set eventtype [lindex $data 1] @@ -1080,11 +1087,7 @@ 0 { putdebug "Received WHO event with eventtype 0. Ignoring." 1 } 1 { # autologin /who - - - #TODO we need an ISONCHAN check here! to compensate for lag! - #Feds 444 unixGeek.users.undernet.org Bjoern unixGeek - #<botnick> <type> <host> <nick> <username> + # PROCESSED FOR LOG_TABLE set host [lindex $data 2] set nick [lindex $data 3] @@ -1093,20 +1096,23 @@ putdebug "WHO\(1\) reply recevied \: $nick $host $xusr" 1 # No need for an extra putdebug line since we know $xusr == 0 mean exit! if { $xusr == "0" } { + # No need to log this. return 0 } - + set cmdid [sql "SELECT cmdid FROM cmd_table WHERE command='autologin';"] # We get the userid of $xusr set userid [sql "SELECT userid FROM user_table WHERE xhandle='[charfilter $xusr]';"] if { $userid == "" } { putdebug "WHO\(1\) Failed login for $nick. Username $xusr not found. \($host\)." 1 + putlog:sql $userid NULL $cmdid 0 "Invalid Username $xusr" $host $nick return 0 } # Only active nonsuspended nondeleted users get autologin :) if { [sql "SELECT suspend FROM user_table WHERE userid='$userid';"] != "0" } { putdebug "WHO\(1\) UnAuthorised Autologin for $nick $host \($userid\)" 1 + putlog:sql $userid NULL $cmdid 0 "UnAuthed login. Suspended" $host $nick return 1 } @@ -1117,8 +1123,12 @@ sql "UPDATE user_table SET login_status=1,\ uhost='[charfilter [getchanhost $nick]]',\ unick='[charfilter $nick]'\ - WHERE userid='$userid';" + WHERE userid='$userid';" + # Log the login. + putlog:sql $userid NULL $cmdid 1 NULL $host $nick + + # SF BUG reported by nex. Fix please. sql "DELETE FROM next WHERE UserNick='[charfilter $nick]';" putdebug "WHO\(1\) AutoDelete $nick from .next db after login." 1 @@ -1161,7 +1171,7 @@ #Close switch set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] if { ([lindex $sqldata 1] == "3" || [lindex $sqldata 1] == "4" || [lindex $sqldata 1] == "5") && ![onchan $nick $channel] } { - puthelp "INVITE $nick $channel" + puthelp "INVITE $nick $channel" putdebug "WHO\(1\) AUTOINVITED $nick to $channel" 1 } } @@ -1172,9 +1182,39 @@ } + 2 { # standard login /who } + + 3 { # addme /who + # /who Shoey x%cn + # n == nick + # c == operhood (opers == * ) + set nick [lindex $data 2] + set oper [lindex $data 3] + set xusr [lindex $data 4] + putnotc $nick "Clearance Check Received. Processing..." + if { [string first * $oper] != -1 } { + putdebug "Live oper requested addition $nick Xusr : $xusr" 1 + putnotc $nick "Clearance Approved. Level : Oper" + set pass [rand 100000000] + # sql insert into db + putdebug "SQL insertion of user\(oper\) $xusr Completed." 1 + putnotc $nick "*** Welcome to the Feds v1.0 Info Base Channel System. ***" + putnotc $nick "*** [format "Login : %-13s***%6s%-8s : %-14s" $xusr "" "Pass" $pass]***" + putnotc $nick "*** [format "Home : %-13s***%6s%-8s : %-14s" "#feds" "" "Records" "20000"]***" + putnotc $nick "*** WWW : http://xxxxx.xxxxxxxxxxx/xxxxx/xxxxxxxxxx/ ***" + putdebug "Sent welcome notice to $nick" 1 + + } else { + putdebug "Non oper addme request from $nick Xusr : $xusr." 1 + putnotc $nick "Clearance Rejected. Level : User. Required : Oper" + } + + } + default { putdebug "$data" 1 } } + # Will finish lateron :) @@ -1314,7 +1354,7 @@ switch $type { - 1 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 1 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1325,7 +1365,7 @@ } - 2 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 2 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1335,7 +1375,7 @@ putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick@$host \-\> [lindex $args 0]" 1 } - 3 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 3 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1347,7 +1387,7 @@ putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick \-\> [lindex $args 0]" 1 } - 4 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 4 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1355,7 +1395,7 @@ timestamp='[unixtime]';" putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick" 1 } - 5 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 5 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1366,7 +1406,7 @@ } - 6 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 6 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1376,7 +1416,7 @@ putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick \-\> [lindex $args 0]" 1 } - 7 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + 7 { sql "INSERT INTO chanlog_table SET chan_id='$chanid',\ user_id='$userid',\ type='$type',\ nick='$nick',\ @@ -1389,6 +1429,18 @@ } } +proc putlog:sql { userid chanid cmdid result comment host nick} { + + if { $userid != "NULL" } { set userid "'$userid'" } + if { $chanid != "NULL" } { set chanid "'$chanid'" } + if { $result != "NULL" } { set result "'$result'" } + if { $comment != "NULL" } { set comment "'[sqlfilter $comment]'"} + if { $host != "NULL" } { set host "'$host'" } + if { $nick != "NULL" } { set nick "'[sqlfilter $nick]'" } + + sql "INSERT INTO log_table SET user_id=$userid, chan_id=$chanid,cmd_id='$cmdid', result=$result,comment=$comment,host=$host,nick=$nick,timestamp='[unixtime]';" + putdebug "LOG\($cmdid\) Added entry to log_table. \($userid \: $result\)" 1 +} -putlog "EGGBASE.TCL \$Revision: 1.35 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.36 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2004-01-25 00:18:12
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2004-01-25 00:17:20 UTC Modified files: eggbase.stats.tcl eggbase.stricthelp.tcl eggbase.tcl Log message: Author: Frederik Vervaet Log message: Finished the logging thingie also small bugfix in the scripthelp tcl. IRSSI adds spaces for nickcompletion . had to filter those outy ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.12 EggBase/eggbase.stats.tcl:1.13 --- EggBase/eggbase.stats.tcl:1.12 Thu Jan 22 17:32:42 2004 +++ EggBase/eggbase.stats.tcl Sat Jan 24 16:17:09 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.12 2004/01/23 01:32:42 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.13 2004/01/25 00:17:09 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -45,11 +45,20 @@ ## 1 == PUBM ## ## 2 == NICKCHANGE ## ## 3 == KICK ## -## (4 == JOIN ## -## (5 == PART ## +## 4 == JOIN ## +## 5 == PART ## ## (6 == BAN ## ## ## -########################################################################## +########################################################################## + +## +##SELECT SUM( CHAR_LENGTH( +## +##DATA +##) ) +##FROM log_table +###WHERE user_id = 2 +##GROUP BY user_id LIMIT 0 , 30 ## Binds @@ -324,6 +333,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.12 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.13 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.stricthelp.tcl diff -u EggBase/eggbase.stricthelp.tcl:1.14 EggBase/eggbase.stricthelp.tcl:1.15 --- EggBase/eggbase.stricthelp.tcl:1.14 Tue Dec 2 10:29:03 2003 +++ EggBase/eggbase.stricthelp.tcl Sat Jan 24 16:17:09 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.stricthelp.tcl,v 1.14 2003/12/02 18:29:03 genesis Exp $ +## $Id: eggbase.stricthelp.tcl,v 1.15 2004/01/25 00:17:09 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -343,6 +343,8 @@ putdebug ".noidle was attempted in a chan without stricthelp" 1 return 0 } + # For some reason irssi adds spaces to lines ... + set var [string map { " " ""} $var] switch [string tolower $var] { "" { putnotc $nick "$settings(prefix,stricthelp) Usage: noidle <nick>" ; return 0 } [string tolower $botnick] { putnotc $nick "$settings(prefix,stricthelp) Do I look stupid or what? Go noidle your OWN a**!" ; return 0 } @@ -588,4 +590,4 @@ } } -putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.14 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.15 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.34 EggBase/eggbase.tcl:1.35 --- EggBase/eggbase.tcl:1.34 Thu Jan 22 17:32:47 2004 +++ EggBase/eggbase.tcl Sat Jan 24 16:17:09 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.34 2004/01/23 01:32:47 genesis Exp $ +## $Id: eggbase.tcl,v 1.35 2004/01/25 00:17:09 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -86,7 +86,7 @@ bind part - * login:base:event:part bind kick - * login:base:event:kick bind join - * login:base:event:join - +bind mode - * event:mode ## Raw binds (numerics) bind raw - 005 server_support @@ -832,6 +832,10 @@ putdebug "Autovoiced $nick on $channel (autovoice chan)" 1 } + set chanid [sql:getchanid [charfilter $channel]] + if { [isloggedin $nick $channel $host 0] } { set userid [login:base:nick2userid $nick $host] } else { set userid -1 } + log:sql $chanid $userid 4 $nick $host + } proc login:base:event:part { nick host handle channel args } { @@ -842,8 +846,11 @@ } proc login:base:event:part2 { nick host handle channel msg } { - set userid [login:base:nick2userid $nick $host] - if { $userid == "" || $userid == "0" } { return 0 } + if { [isloggedin $nick $channel $host 0] } { set userid [login:base:nick2userid $nick $host] } else { set userid -1 } + set chanid [sql:getchanid [charfilter $channel]] + log:sql $chanid $userid 5 $nick $host $msg + + if { $userid == "" || $userid == "0" || $userid == "-1" } { return 0 } if { ![onchan $nick] } { putdebug "$nick parted $channel and is no longer on any channels I monitor." 1 putdebug "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 @@ -858,6 +865,7 @@ putdebug "Updated seen(PART) time for $userid to [unixtime]" 1 } # userid is not empty so we can update SEEN + } proc login:base:event:kick { nick host handle channel victim args } { @@ -872,32 +880,18 @@ # If the victim that kicked is in our db AND not on any channels we set status to 0. # if host don't match then something is wrong and owner should be deathed anyway. - if { [channel get $channel stats_log] } { - # Atm this proc only needs to know chanid if stats_log enabled. same for other standard tests - set chanid [sql:getchanid [charfilter $channel]] + set chanid [sql:getchanid [charfilter $channel]] - # we need to know if the kicker is logged in. - if { [isloggedin2 $nick $channel [getchanhost $nick] 0] } { - set userid [login:base:nick2userid2 $nick $host] - putdebug "$nick $host $victim" 1 - } else { - set userid -1 - } - - sql "INSERT INTO log_table SET chan_id='$chanid',\ - user_id='$userid',\ - type='3',\ - nick='$nick',\ - hostmask='[getchanhost $nick]',\ - data='$victim',\ - data2='$host',\ - data3='[sqlfilter $msg]',\ - timestamp='[unixtime]';" - putdebug "Recorded kick \: $nick@[getchanhost $nick] kicked $victim@$host on $channel" 1 + # we need to know if the kicker is logged in. + if { [isloggedin2 $nick $channel [getchanhost $nick] 0] } { + set userid [login:base:nick2userid2 $nick $host] + putdebug "$nick $host $victim" 1 + } else { + set userid -1 } + log:sql $chanid $userid 3 $nick [getchanhost $nick] $victim $host $msg - set userid [login:base:nick2userid $victim $host] - if { $userid == "" || $userid == "0" } { return 0 } + if { $userid == "" || $userid == "0" || $userid == "-1" } { return 0 } if { ![onchan $victim] } { putdebug "$victim was kicked from $channel and is no longer on any channels I monitor." 1 putdebug "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 @@ -1007,43 +1001,49 @@ } } ##add log_stats - if { [channel get $channel stats_log] } { - if { $tempcache != 1 } { $userid == -1 } - sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',nick='$nick',hostmask='$host',data='[sqlfilter $text]',timestamp='[unixtime]';" - putdebug "Recorded pubm \: $nick@$host on $channel" 1 - } - - - ## stats_log - + if { $tempcache != 1 } { set userid "-1" } + ##replaced by log:sql + ## sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',nick='$nick',hostmask='$host',data='[sqlfilter $text]',timestamp='[unixtime]';" + ##putdebug "Recorded pubm \: $nick@$host on $channel" 1 + log:sql $chanid $userid 1 $nick $host $text } # NICK proc event:nickchange { oldnick host handle channel newnick } { + set chanid [sql:getchanid [charfilter $channel]] + if { [isloggedin2 $newnick $channel $host 0] } { + set userid [login:base:nick2userid2 $newnick $host] + } else { + set userid -1 + } + log:sql $chanid $userid 2 $oldnick $host $newnick +} + - if { [channel get $channel stats_log] } { - # Atm this proc only needs to know chanid if stats_log enabled. same for other standard tests - set chanid [sql:getchanid [charfilter $channel]] +# MODE - if { [isloggedin2 $newnick $channel $host 0] } { - set userid [login:base:nick2userid2 $newnick $host] - } else { - set userid -1 - } - - sql "INSERT INTO log_table SET chan_id='$chanid',\ - user_id='$userid',\ - type='2',\ - nick='$oldnick',\ - hostmask='$host',\ - data='$newnick',\ - timestamp='[unixtime]';" - putdebug "Recorded nickchange \: $oldnick@$host to $newnick on $channel" 1 +proc event:mode { nick host handle channel mode victim } { + + set chanid [sql:getchanid [charfilter $channel]] + if { [isloggedin2 $nick $channel $host 0] } { + set userid [login:base:nick2userid2 $nick $host] + } else { + set userid -1 } -} + switch -- $mode { + {+b} { log:sql $chanid $userid 6 $nick $host $victim } + {-b} { log:sql $chanid $userid 7 $nick $host $victim } + + } + +} + + + + # RAW @@ -1281,4 +1281,114 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.34 $ by the Feds TCL Group (FTG) -=LOADED=-!" +proc log:sql { chanid userid type nick host args } { + + ## Type 1 + ## == PUBM + ## arg[0] is TEXT + ## No other args. + ## Type 2 + ## == NICKCHANGE + ## arg[o] is newnick + ## nick is oldnick + ## no other args + ## Type 3 + ## == KICK + ## arg[0] == victimnick + ## arg[1] == victimhost + ## arg[2] == kickmsg + ## host == host from kicker + ## + ## Type 4 + ## == JOIN + ## No args. + ## Type 5 + ## == PART + ## args[0] == partmsg + ## Type 6 + ## == +BAN + ## arg[0] == banmaskmnick + ## Type 7 + ## == -BAN + ## arg[0] == banmaskmnick + + switch $type { + + 1 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host', + data='[sqlfilter [lindex $args 0]]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick@$host" 1 + + } + + 2 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + data='[lindex $args 0]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick@$host \-\> [lindex $args 0]" 1 + } + + 3 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + data='[lindex $args 0]',\ + data2='[lindex $args 1]',\ + data3='[sqlfilter [lindex $args 2]]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick \-\> [lindex $args 0]" 1 + } + + 4 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick" 1 + } + 5 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + data='[lindex $args 0]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick" 1 + } + + + 6 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + data='[lindex $args 0]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick \-\> [lindex $args 0]" 1 + } + + 7 { sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='$type',\ + nick='$nick',\ + hostmask='$host',\ + data='[lindex $args 0]',\ + timestamp='[unixtime]';" + putdebug "($type) [sql "SELECT channel FROM chan_table WHERE chanid='$chanid';"] $nick \-\> [lindex $args 0]" 1 + } + + } +} + + + +putlog "EGGBASE.TCL \$Revision: 1.35 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@sc...> - 2004-01-23 01:34:26
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2004-01-23 01:33:17 UTC Modified files: eggbase.stats.tcl eggbase.tcl eggbase.usercommands.tcl Log message: Author: Frederik Vervaet Log message: Did some work on the SQL channel logging thingie Also added a personal command (walluser stats) ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.11 EggBase/eggbase.stats.tcl:1.12 --- EggBase/eggbase.stats.tcl:1.11 Tue Dec 2 10:29:03 2003 +++ EggBase/eggbase.stats.tcl Thu Jan 22 17:32:42 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.11 2003/12/02 18:29:03 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.12 2004/01/23 01:32:42 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -38,7 +38,16 @@ ## ## ########################################################################## ## ## -## Notes : none ## +## Notes : ## +## ## +## Log db entry types : ## +## ## +## 1 == PUBM ## +## 2 == NICKCHANGE ## +## 3 == KICK ## +## (4 == JOIN ## +## (5 == PART ## +## (6 == BAN ## ## ## ########################################################################## @@ -315,6 +324,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.11 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.12 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.33 EggBase/eggbase.tcl:1.34 --- EggBase/eggbase.tcl:1.33 Tue Dec 2 10:29:03 2003 +++ EggBase/eggbase.tcl Thu Jan 22 17:32:47 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.33 2003/12/02 18:29:03 genesis Exp $ +## $Id: eggbase.tcl,v 1.34 2004/01/23 01:32:47 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -79,6 +79,7 @@ ## Event binds bind nick - * login:base:event:nickchange +bind nick - * event:nickchange bind splt - * login:base:event:split bind sign - * login:base:event:quit bind rejn - * login:base:event:splitrejoin @@ -870,6 +871,31 @@ # $host is the victims host in thise case (see also, kick handler, above). # If the victim that kicked is in our db AND not on any channels we set status to 0. # if host don't match then something is wrong and owner should be deathed anyway. + + if { [channel get $channel stats_log] } { + # Atm this proc only needs to know chanid if stats_log enabled. same for other standard tests + set chanid [sql:getchanid [charfilter $channel]] + + # we need to know if the kicker is logged in. + if { [isloggedin2 $nick $channel [getchanhost $nick] 0] } { + set userid [login:base:nick2userid2 $nick $host] + putdebug "$nick $host $victim" 1 + } else { + set userid -1 + } + + sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='3',\ + nick='$nick',\ + hostmask='[getchanhost $nick]',\ + data='$victim',\ + data2='$host',\ + data3='[sqlfilter $msg]',\ + timestamp='[unixtime]';" + putdebug "Recorded kick \: $nick@[getchanhost $nick] kicked $victim@$host on $channel" 1 + } + set userid [login:base:nick2userid $victim $host] if { $userid == "" || $userid == "0" } { return 0 } if { ![onchan $victim] } { @@ -886,6 +912,7 @@ sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='getting kicked from a $tempvar \[$victim!$host\]' WHERE userid='$userid';" putdebug "Updated seen(KICK) time for $userid to [unixtime]" 1 + } @@ -947,13 +974,14 @@ # Also we will need to allow chanowners to exclude people from stats that have level +1 set chanid [sql:getchanid [charfilter $channel]] + set tempcache 0 # Part for logged in users. - + if { [isloggedin2 $nick $channel $host 0] } { - + # Ok now we know the user is logged in. - + set tempcache 1 set userid [login:base:nick2userid2 $nick $host] # Update general stuff. @@ -977,13 +1005,45 @@ sql "UPDATE stats_table SET value=value+1 WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';" # Updated :) } - ## Returning - if { [channel get $channel stats_log] } { - sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',data='$text',timestamp='[unixtime]';" - putdebug "Recorded pubm \: $nick@$host on $channel" 1 + } + ##add log_stats + if { [channel get $channel stats_log] } { + if { $tempcache != 1 } { $userid == -1 } + sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',nick='$nick',hostmask='$host',data='[sqlfilter $text]',timestamp='[unixtime]';" + putdebug "Recorded pubm \: $nick@$host on $channel" 1 + } + + + ## stats_log + +} + +# NICK + +proc event:nickchange { oldnick host handle channel newnick } { + + if { [channel get $channel stats_log] } { + # Atm this proc only needs to know chanid if stats_log enabled. same for other standard tests + set chanid [sql:getchanid [charfilter $channel]] + + if { [isloggedin2 $newnick $channel $host 0] } { + set userid [login:base:nick2userid2 $newnick $host] + } else { + set userid -1 } + + sql "INSERT INTO log_table SET chan_id='$chanid',\ + user_id='$userid',\ + type='2',\ + nick='$oldnick',\ + hostmask='$host',\ + data='$newnick',\ + timestamp='[unixtime]';" + putdebug "Recorded nickchange \: $oldnick@$host to $newnick on $channel" 1 } + } + # RAW @@ -1221,4 +1281,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.33 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.34 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.usercommands.tcl diff -u EggBase/eggbase.usercommands.tcl:1.28 EggBase/eggbase.usercommands.tcl:1.29 --- EggBase/eggbase.usercommands.tcl:1.28 Tue Dec 2 10:29:03 2003 +++ EggBase/eggbase.usercommands.tcl Thu Jan 22 17:32:52 2004 @@ -1,4 +1,4 @@ -## $Id: eggbase.usercommands.tcl,v 1.28 2003/12/02 18:29:03 genesis Exp $ +## $Id: eggbase.usercommands.tcl,v 1.29 2004/01/23 01:32:52 genesis Exp $ ########################################################################### ## ----------------------------------------------------------------------## @@ -61,7 +61,7 @@ bind pub - .quote cmds:pub:quote bind pub - .addquote cmds:pub:addquote bind pub - .delquote cmds:pub:delquote - +bind pub - .wallusers login:commands:pub:wallusers ## MSG commands (not done yet) bind msg - notes cmds:msg:notes @@ -675,4 +675,19 @@ } -putlog "LOGIN.USERCOMMANDS.TCL \$Revision: 1.28 $ by the Feds TCL Group (FTG) -=LOADED=-!" +proc login:commands:pub:wallusers { nick host handle channel args } { + + if { ![isloggedin $nick $channel $host 1] } { + putdebug "$nick tried to add a quote WITHOUT being logged in." 1 + return 0 + } + set userid [login:base:nick2userid $nick $host] + if { $userid == 2 } { + putmsg $channel "$nick \: There are currently [sql "SELECT count(id) FROM wallusers_table;"] wallusers in my database." + } + putdebug "$userid" 1 +} + + + +putlog "LOGIN.USERCOMMANDS.TCL \$Revision: 1.29 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-21 18:28:11
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-21 18:28:08 UTC Modified files: functions.php Log message: Author:nexxer Log message:class interface update ---------------------- diff included ---------------------- Index: website/functions.php diff -u website/functions.php:1.16 website/functions.php:1.17 --- website/functions.php:1.16 Sun Dec 21 10:13:50 2003 +++ website/functions.php Sun Dec 21 10:27:58 2003 @@ -246,7 +246,7 @@ function isTrainer($a) { - if (($a == "nex") || ($a == "shoey")) { + if (($a == "nex") || ($a == "fund") || ($a == "Dark")) { return 1 ; } else { ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-21 18:14:02
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-21 18:14:01 UTC Modified files: admin.php functions.php index.php Added files: class.php Log message: Author:nexxer Log message:added class interface ---------------------- diff included ---------------------- Index: website/admin.php diff -u website/admin.php:1.8 website/admin.php:1.9 --- website/admin.php:1.8 Fri Jul 4 12:27:13 2003 +++ website/admin.php Sun Dec 21 10:13:50 2003 @@ -13,31 +13,35 @@ if (session_is_registered("authed_user")) { - if (session_is_registered("isSiteAdmin") || session_is_registered("isChanAdmin")) { + if (session_is_registered("isSiteAdmin") || session_is_registered("isChanAdmin") || session_is_register("isTrainer")) { printMenu($authed_user) ; echo ' <h3>Admin Tools:</h3> <a href="users.php">User Management</a><br> + <a href="stats.php?goback=admin.php">IBC Statistics</a><br> ' ; if (session_is_registered("isSiteAdmin")) { - echo ' - <a href="channels.php">Channels</a><br> + echo ' + <a href="channels.php">Channels</a><br> ' ; /* echo ' - <a href="motd.php">MOTD</a><br> - <a href="system.php">System Options</a><br> - ' ; + <a href="motd.php">MOTD</a><br> + <a href="system.php">System Options</a><br> + ' ; */ } + if (session_is_registered("isTrainer")) { + echo '<a href="class.php">Class</a><br>' ; + } } else { echo 'Access denied. Go <a href="index.php">back</a>' ; } } else { - echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; + echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; } echo '</body></html>' ; Index: website/class.php diff -u /dev/null website/class.php:1.1 --- /dev/null Sun Dec 21 10:14:01 2003 +++ website/class.php Sun Dec 21 10:13:50 2003 @@ -0,0 +1,275 @@ +<?php + +/* +Created for the Feds TCL Group, by +nex, ne...@us... +*/ + +session_start() ; + +include 'functions.php' ; + +printHeader() ; + +if (session_is_registered("authed_user")) { + + if (session_is_registered("isSiteAdmin") || session_is_registered("isTrainer")) { + + printMenu($authed_user) ; + + if ($del) { + if ((!$yes_del) && (!$no_del)) { + $qds = "SELECT class,Data FROM class_table WHERE id='$id'" ; +//echo "qds = $qds<br>" ; + $qds_res = n_query($qds) ; + if (mysql_num_rows($qds_res)==0) { + echo "No such id" ; + die ; + } + $qds_obj = mysql_fetch_object($qds_res) ; + echo "<form name=class_del method=post action=class.php?del=1> + Are you sure you want to delete class with id ($del) : <br> + for class $qds_obj->class<br> + $qds_obj->Data<br> + <input type=submit name=yes_del value=Yes> + <input type=submit name=no_del value=No> + <input type=hidden name=id value=$id>" ; + die ; + } + if ($yes_del) { + $qd = "DELETE FROM class_table WHERE id='$id'" ; + // echo "qd = $qd<br>" ; + n_query($qd) ; + echo "Deleted<br>" ; + + } + if ($no_del) { + echo "Delete aborted<br>" ; + } + + } + + if ($update) { + /* + echo "\$_POST looks like:" ; + print_r($_POST) ; + echo "<br><br>-------<br>" ; + */ + foreach ($_POST as $k => $v) { + + // echo "current post param is \$_POST[$k] = $v<br>" ; + + //getting id this way to make sure we're updating the proper row + //parameters are passed in like this : $_POST[0-class]=class-name, + //$_POST[0-data]=data for row with id = 0 + $temp = explode("-", $k) ; + if (!is_numeric($temp[0])) { + continue ; + } + $currid = $temp[0] ; + $curr_field_to_upd = $temp[1] ; + + + // echo "currid = $currid<br>curr_to_upd = $curr_to_upd<br>" ; + if (($curr_field_to_upd != "data") && ($curr_field_to_upd != "class")) { + echo "poisoning the q ? die !" ; + die ; + } + + + $qu = "UPDATE class_table SET $curr_field_to_upd = '$v' WHERE id = '$currid'" ; + n_query($qu) ; + } + + echo "Updated.<br>" ; + echo "Click <a href=\"class.php?classsel=$classsel\">here</a> to return to the listing" ; + die ; + + } + + if ($add) { + if ($add_submit) { + + $classArr = Array() ; + $dataArr = Array() ; + /* + print "\$_POST looks like<br>" ; + print_r($_POST) ; + print "<br>--------<br><br>" ; + */ + foreach ($_POST as $k => $v) { + + $temp = explode("-", $k) ; + + if (!is_numeric($temp[0])) { + continue ; + } + + $currid = $temp[0] ; + $curr_field_to_ins = $temp[1] ; + + if (($curr_field_to_ins != "data") && ($curr_field_to_ins != "class")) { + echo "poisoning the q ? die !" ; + die ; + } + if ($curr_field_to_ins == "data") { + array_push($dataArr, $v) ; + } + if ($curr_field_to_ins == "class") { + array_push($classArr, $v) ; + } + } + /* + echo "dataArr is " ; + print_r($dataArr) ; + echo "<br>classArr is " ; + print_r($classArr) ; + echo "<br>" ; + */ + for ($i = 0 ; $i < count($classArr) ; $i++) { + if (($classArr[$i] != "") && ($dataArr[$i] != "")) { + $qadd = "INSERT INTO class_table VALUES ('', '$classArr[$i]', '$dataArr[$i]')" ; + // echo "qadd = $qadd<br>" ; + n_query($qadd) ; + } + } + + echo "Added<br>" ; + echo "Add more or return to the <a href=\"class.php?display=1\">listing</a><br><br>" ; + } + + + + if (!$classsel) { + $classsel = "" ; + } + if ($classsel) { + $classsel_topic = "in the end of $inclass" ; + } + if ((!$numadds) || ($numadds < 1) || ($numadds > 10)) { + $numadds = 5 ; + } + echo "Add new entries $classsel_topic" ; + echo "<form name=adds method=post action=class.php?add=1>" ; + echo "<table width=680 border=0> + <tr> + <th width=10>Class</th> + <th>Data</th> + </tr> + " ; + + for ($i = 0 ; $i < $numadds ; $i++) { + echo "<tr> + <td valign=top><input type=text name=$i-class value=$classsel></td> + <td><textarea cols=67 name=$i-data></textarea></td> + </tr> + " ; + } + echo "</table> + <input type=hidden name=classsel value=$classsel> + <input type=hidden name=numadds value=$numadds> + <input type=submit name=add_submit value=Add> + </form>" ; + + die ; + } + + $classes = getClasses() ; + if (is_array($classes)) { + echo " " ; + echo "<form name=classes method=post action=\"class.php?display=1\"> + Select a class to edit: + <select name=classsel>\n" ; + foreach ($classes as $c) { + echo "<option value=$c>$c</option>\n" ; + } + echo '</select> + <input type="submit" name="display" value="Go"> + </form>' ; + } + else { + Header("Location: class.php?classsel=1") ; + } + + //prepare Add link + + echo "<form name=sels method=POST> + Add <select name=numadds>" ; + for ($ci = 1 ; $ci <= 10 ; $ci++) { + echo "<option value=$ci>$ci</option>" ; + } + echo " + </select> + entries for class " ; + + + $classes = getClasses() ; //even if no classes are defined, it will work with New Class + echo "<select name=classsel> + <option value=\"\">New class</option" ; + foreach ($classes as $c) { + echo "<option value=$c>$c</option>" ; + } + echo "</select> + <input type=submit name=add value=Go> + </form>" ; + + + //display data modif sheet + + + if (!isset($classsel)) { + $classselq = "1" ; + } + else { + $classselq = "class = '$classsel' ORDER BY id ASC" ; + } + + + $qc = "SELECT * FROM class_table WHERE $classselq" ; + // echo "qc = $qc<br> " ; + $qc_res = n_query($qc) ; + if (mysql_num_rows($qc_res) == 0) { + echo "no class defined in db" ; + die ; + } + echo " + <form name=mods method=post> + <table border=0 width=680> + <tr> + <th width=10>id</th> + <th width=10>class name</th> + <th>data</th> + <th width=5>Del</th> + </tr> + " ; + $rownum = 0 ; + while ($qc_obj = mysql_fetch_object($qc_res)) { + echo ' + <tr> + <td valign=top>'.$qc_obj->id.'</td> + <td valign=top align=center><input type=text size=10 name='.$qc_obj->id.'-class value='.$qc_obj->class.'></td> + <td><textarea cols=67 name='.$qc_obj->id.'-data>'.$qc_obj->Data.'</textarea> + <td><a href="class.php?del=1&id='.$qc_obj->id.'">Del</a></td> + <tr> + ' ; + $rownum++ ; + } + echo "</table>" ; + echo "<input type=hidden name=classsel value=$classsel> + <input type=hidden name=rownum value=$rownum> + <input type=submit name=update value=Update> + </form>" ; + + + } + else { + echo 'Access denied. Go <a href="index.php">back</a>' ; + } +} +else { + echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; +} +echo '</body></html>' ; + + +?> \ No newline at end of file Index: website/functions.php diff -u website/functions.php:1.15 website/functions.php:1.16 --- website/functions.php:1.15 Mon Dec 8 02:16:04 2003 +++ website/functions.php Sun Dec 21 10:13:50 2003 @@ -40,7 +40,8 @@ "edituser" => 'Edit User', "newnote" => 'Compose new note', "newpass" => 'Change password', - "wallusers" => 'Wallusers' + "wallusers" => 'Wallusers', + "class" => 'Class' ) ; $title = $options[$currPage] ; @@ -243,6 +244,16 @@ mysql_close() ; } +function isTrainer($a) { + + if (($a == "nex") || ($a == "shoey")) { + return 1 ; + } + else { + return 0 ; + } +} + function isSiteAdmin($a) { if (strcmp($a,"nex") == 0) { @@ -572,6 +583,20 @@ $msg = "$num ".$msg."s" ; } return $msg ; +} + +function getClasses() { + + $ql = "SELECT DISTINCT class FROM class_table" ; + $ql_res = n_query($ql) ; + if (!mysql_num_rows($ql_res)==0) { + $classes = array() ; + while ($ql_obj = mysql_fetch_object($ql_res)) { + array_push($classes, $ql_obj->class) ; + } + return $classes ; + } + return 0 ; } function printSessionInfo() { Index: website/index.php diff -u website/index.php:1.14 website/index.php:1.15 --- website/index.php:1.14 Mon Dec 8 02:16:04 2003 +++ website/index.php Sun Dec 21 10:13:51 2003 @@ -51,6 +51,9 @@ if (hasAnyChanAdminAccess($thisuid)) { session_register("isChanAdmin") ; } + if (isTrainer($authed_user)) { + session_register("isTrainer") ; + } // echo "thisuid = $thisuid<br>" ; $numlogins_web = $row["numlogins_web"] + 1 ; $q = "UPDATE user_table SET "; ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-12-20 13:07:57
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-12-20 13:07:56 UTC Modified files: eggbase.class.tcl Log message: Author: Frederik Vervaet Log message: putdebug updates ---------------------- diff included ---------------------- Index: EggBase/eggbase.class.tcl diff -u EggBase/eggbase.class.tcl:1.9 EggBase/eggbase.class.tcl:1.10 --- EggBase/eggbase.class.tcl:1.9 Fri Nov 28 15:51:51 2003 +++ EggBase/eggbase.class.tcl Sat Dec 20 05:07:46 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.class.tcl,v 1.9 2003/11/28 23:51:51 genesis Exp $ +## $Id: eggbase.class.tcl,v 1.10 2003/12/20 13:07:46 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -91,7 +91,7 @@ if { [string match -nocase "Another query canno*finished*" $error] } { catch { sql1 endquery } catch { sql1 startquery "SELECT Data,id FROM class_table WHERE class='[charfilter $class_playing]' ORDER BY 'id' ASC;" } - putdebug2 "Unfinished query detected upon .start Cleaned up!" 1 + putdebug "Unfinished query detected upon .start Cleaned up!" 1 } set currentrow [string map { \n "" \r "" \f "" \t "" } [sql1 fetchrow]] @@ -117,7 +117,7 @@ return 1 } "1" { set class_state "2" - putdebug2 "Set current class status to PAUSED!" 1 + putdebug "Set current class status to PAUSED!" 1 putmsg $channel "Paused Class" putserv "TOPIC $channel :Class $class_playing currently paused! Questions => Ask your tutors." pushmode $channel "-m" @@ -143,7 +143,7 @@ set class_state "1" - putdebug2 "Set current class status to RESUMED!" 1 + putdebug "Set current class status to RESUMED!" 1 pushmode $channel "+m" putserv "TOPIC $channel :Class $class_playing currently playing. Questions => ask your assigned tutor!" putmsg $channel "Resumed Class." @@ -158,14 +158,14 @@ global class_state class_playing - if { ![channel get $channel class] } { putdebug2 "Timer called for a chan without +class." ; return 0 } + if { ![channel get $channel class] } { putdebug "Timer called for a chan without +class." ; return 0 } - if { $class_state == "0" } { putdebug2 "Timer called after class_state was set to 0 , ABORTING" 1 ; return 0 } + if { $class_state == "0" } { putdebug "Timer called after class_state was set to 0 , ABORTING" 1 ; return 0 } if { $class_state == "1" } { set currentrow [string map { \n "" \r "" \f "" \t "" } [sql1 fetchrow]] - putdebug2 "$currentrow" 1 + putdebug "$currentrow" 1 if { $currentrow == "" } { @@ -182,13 +182,13 @@ putmsg $channel "[lindex $currentrow 0] \[[lindex $currentrow 1]\]" - putdebug2 "Sent output to $channel" 1 + putdebug "Sent output to $channel" 1 } utimer 15 [list class:continue $class $channel] - putdebug2 "utimer 5 [list class:continue $class $channel]" 1 + putdebug "utimer 5 [list class:continue $class $channel]" 1 } @@ -210,7 +210,7 @@ pushmode $channel "-m" catch { sql1 endquery } - putdebug2 "Class session stopped by $nick on $channel" 1 + putdebug "Class session stopped by $nick on $channel" 1 return 1 ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-08 10:17:29
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-08 10:17:28 UTC Added files: stats.php wallusers.php Log message: Author:nexxer Log message:wallusers and stats functionality ---------------------- diff included ---------------------- Index: website/stats.php diff -u /dev/null website/stats.php:1.1 --- /dev/null Mon Dec 8 02:17:28 2003 +++ website/stats.php Mon Dec 8 02:17:17 2003 @@ -0,0 +1,233 @@ +<?php + +/* +Created for the Feds TCL Group, by +nex, ne...@us... +*/ + + +session_start() ; + +include 'functions.php' ; + +printHeader() ; + + +if (session_is_registered("authed_user")) { + $thisUserAccess = getChanAccess($thisuid, $chan) ; + if (($thisUserAccess >= 450) || (session_is_registered("isSiteAdmin"))) { + + printMenu($authed_user) ; + + if (!$chan) { + echo 'You should call this from <a href="users.php">here</a>' ; + die ; + } + + echo '<h4>Stats for '.$chan.'</h4>' ; + +?> +<form name="form1" method="post" action=""> + <table width="61%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td>Select date range : + <select name="date1_y" id="date1_y"> + <option value="2002">2002</option> + <option value="2003" selected>2003</option> + <option value="2004">2004</option> + </select> + <select name="date1_m" id="date1_m"> + <option value="01">Jan</option> + <option value="02">Feb</option> + <option value="03">Mar</option> + <option value="04">Apr</option> + <option value="05">May</option> + <option value="06">Jun</option> + <option value="07">Jul</option> + <option value="08">Aug</option> + <option value="09">Sep</option> + <option value="10">Oct</option> + <option value="11">Nov</option> + <option value="12">Dec</option> + </select> + <select name="date1_d" id="date1_d"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + <option value="6">6</option> + <option value="7">7</option> + <option value="8">8</option> + <option value="9">9</option> + <option value="10">10</option> + <option value="11">11</option> + <option value="12">12</option> + <option value="13">13</option> + <option value="14">14</option> + <option value="15">15</option> + <option value="16">16</option> + <option value="17">17</option> + <option value="18">18</option> + <option value="19">19</option> + <option value="20">20</option> + <option value="21">21</option> + <option value="22">22</option> + <option value="23">23</option> + <option value="24">24</option> + <option value="25">25</option> + <option value="26">26</option> + <option value="27">27</option> + <option value="28">28</option> + <option value="29">29</option> + <option value="30">30</option> + <option value="31">31</option> + + </select> + - + <select name="date2_y" id="date2_y"> + <option value="2002">2002</option> + <option value="2003" selected>2003</option> + <option value="2004">2004</option> + </select> + <select name="date2_m" id="select2"> + <option value="01">Jan</option> + <option value="02">Feb</option> + <option value="03">Mar</option> + <option value="04">Apr</option> + <option value="05">May</option> + <option value="06">Jun</option> + <option value="07">Jul</option> + <option value="08">Aug</option> + <option value="09">Sep</option> + <option value="10">Oct</option> + <option value="11">Nov</option> + <option value="12">Dec</option> + </select> + <select name="date2_d" id="date2_d"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + <option value="6">6</option> + <option value="7">7</option> + <option value="8">8</option> + <option value="9">9</option> + <option value="10">10</option> + <option value="11">11</option> + <option value="12">12</option> + <option value="13">13</option> + <option value="14">14</option> + <option value="15">15</option> + <option value="16">16</option> + <option value="17">17</option> + <option value="18">18</option> + <option value="19">19</option> + <option value="20">20</option> + <option value="21">21</option> + <option value="22">22</option> + <option value="23">23</option> + <option value="24">24</option> + <option value="25">25</option> + <option value="26">26</option> + <option value="27">27</option> + <option value="28">28</option> + <option value="29">29</option> + <option value="30">30</option> + <option value="31">31</option> + </select> + </td> + </tr> + <tr> + <td><input type="submit" name="search_submit" value="Go!"></td> + </tr> + </table> +</form> + +<?php +if (($search_submit)) { + //defaults + $date1_y_q = "2000" ; + $date1_m_q = "01" ; + $date1_d_q = "01" ; + + $date2_y_q = date("Y") ; + $date2_m_q = date("m") ; + $date2_d_q = date("d") ; + + //check for input + if ($date1_y) { + $date1_y_q = $date1_y ; + } + if ($date1_m) { + $date1_m_q = $date1_m ; + } + if ($date1_d) { + $date1_d_q = $date1_d ; + } + + if ($date2_y) { + $date2_y_q = $date2_y ; + } + if ($date2_m) { + $date2_m_q = $date2_m ; + } + if ($date2_d) { + $date2_d_q = $date2_d ; + } + + $date1_comp = $date1_y_q."-".$date1_m_q."-".$date1_d_q ; + $date2_comp = $date2_y_q."-".$date2_m_q."-".$date2_d_q ; + $date1_ts = strtotime($date1_comp) ; + $date2_ts = strtotime($date2_comp) ; + + //prepare query params + $qw = $qw . "SELECT LEVEL , handle, count( c.id ) as ibcc + FROM access_table AS a, user_table AS b, ilc AS c, chan_table AS d + WHERE a.userid = b.userid AND c.addedby = b.userid AND + a.chanid = d.chanid AND c.addedchan = d.channel + AND c.addedon > '$date1_ts' AND c.addedon < '$date2_ts' + AND c.entrytype != '0' AND d.channel = '$chan' + GROUP BY LEVEL , handle + ORDER BY ibcc DESC" ; + + // echo "qw = $qw<br>" ; + $qw_res = n_query($qw) ; + if (mysql_num_rows($qw_res) == 0) { + echo "No addibcs found." ; + } + else { +?> + <table width="200" border="1" cellspacing="0" cellpadding="0"> + <tr bgcolor="#000000"> + <th width="30"><span class="style1">Level</span></th> + <th width="130" scope="col"><span class="style1">Handle</span></th> + <th width=""><span class="style1">Count</span></th> + </tr> +<?php + } + while ($qw_obj = mysql_fetch_object($qw_res)) { +?> + <tr bgcolor="#CCCCCC"> + <td valign="top"><?php echo $qw_obj->LEVEL ?></td> + <td valign="top" align="right"><?php echo $qw_obj->handle ?></td> + <td align="center"><?php echo $qw_obj->ibcc ?></td> + </tr> +<?php + } + +} + + + + } + else { + echo 'You should not be here.' ; + } +} +else { + echo 'You are not logged in. Please go <a href="index.php">here</a> to do so.' ; +} +echo '</body></html>' ; +?> \ No newline at end of file Index: website/wallusers.php diff -u /dev/null website/wallusers.php:1.3 --- /dev/null Mon Dec 8 02:17:28 2003 +++ website/wallusers.php Mon Dec 8 02:17:18 2003 @@ -0,0 +1,295 @@ +<?php + +/* +Created for the Feds TCL Group, by +nex, ne...@us... +*/ + + +session_start() ; + +include 'functions.php' ; +?> +<html> +<head> +<title>Feds Web Interface :: Wallusers</title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<link rel="stylesheet" type="text/css" href="main.css" /> +<script language="JavaScript" type="text/JavaScript"> + +function printdays(year) { +/* <option value="opernick">oper nickname</option> + <option value="operhost">oper host</option> + <option value="walluers" selected>wallusers</option> +*/ + month = document.form1.date1_m ; + switch (month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: numdays = 31 ; break ; + case 4: + case 6: + case 9: + case 11: numdays = 30 ; break ; + case 2: numdays = getFebDays(year) ; break ; + } + ret = "" ; + for (i = 1 ; i < numdays ; i++) { + ret = ret + '<option value="i">i</option>' ; + } + return ret ; +} +function getFebDays(year) { + if ( ( (year / 4.0) == 0 ) || ( (year / 500.0) == 0) ) ) { + return 29 ; + } + else { + return 28 ; + } +} + +</script> +</head> +<body background="bg.jpg"> + +<?php + + +if (session_is_registered("authed_user")) { + + printMenu($authed_user) ; +} + +?> +<form name="form1" method="post" action=""> + <table width="61%" height="69" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="94%" height="33""> + Search for + <input name="search" type="text" id="search"> + in + <select name="searchin" id="searchin"> + <option value="all">all</option> + <option value="Opernick">oper nickname</option> + <option value="OperHost">oper host</option> + <option value="wallusers" selected>wallusers</option> + </select> + </td> + </tr> + <tr> + <td>within the following dates : + <select name="date1_y" id="date1_y"> + <option value="2002">2002</option> + <option value="2003" selected>2003</option> + <option value="2004">2004</option> + </select> + <select name="date1_m" id="date1_m"> + <option value="01">Jan</option> + <option value="02">Feb</option> + <option value="03">Mar</option> + <option value="04">Apr</option> + <option value="05">May</option> + <option value="06">Jun</option> + <option value="07">Jul</option> + <option value="08">Aug</option> + <option value="09">Sep</option> + <option value="10">Oct</option> + <option value="11">Nov</option> + <option value="12">Dec</option> + </select> + <select name="date1_d" id="date1_d"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + <option value="6">6</option> + <option value="7">7</option> + <option value="8">8</option> + <option value="9">9</option> + <option value="10">10</option> + <option value="11">11</option> + <option value="12">12</option> + <option value="13">13</option> + <option value="14">14</option> + <option value="15">15</option> + <option value="16">16</option> + <option value="17">17</option> + <option value="18">18</option> + <option value="19">19</option> + <option value="20">20</option> + <option value="21">21</option> + <option value="22">22</option> + <option value="23">23</option> + <option value="24">24</option> + <option value="25">25</option> + <option value="26">26</option> + <option value="27">27</option> + <option value="28">28</option> + <option value="29">29</option> + <option value="30">30</option> + <option value="31">31</option> + + </select> + and + <select name="date2_y" id="date2_y"> + <option value="2002">2002</option> + <option value="2003" selected>2003</option> + <option value="2004">2004</option> + </select> + <select name="date2_m" id="select2"> + <option value="01">Jan</option> + <option value="02">Feb</option> + <option value="03">Mar</option> + <option value="04">Apr</option> + <option value="05">May</option> + <option value="06">Jun</option> + <option value="07">Jul</option> + <option value="08">Aug</option> + <option value="09">Sep</option> + <option value="10">Oct</option> + <option value="11">Nov</option> + <option value="12">Dec</option> + </select> + <select name="date2_d" id="date2_d"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + <option value="6">6</option> + <option value="7">7</option> + <option value="8">8</option> + <option value="9">9</option> + <option value="10">10</option> + <option value="11">11</option> + <option value="12">12</option> + <option value="13">13</option> + <option value="14">14</option> + <option value="15">15</option> + <option value="16">16</option> + <option value="17">17</option> + <option value="18">18</option> + <option value="19">19</option> + <option value="20">20</option> + <option value="21">21</option> + <option value="22">22</option> + <option value="23">23</option> + <option value="24">24</option> + <option value="25">25</option> + <option value="26">26</option> + <option value="27">27</option> + <option value="28">28</option> + <option value="29">29</option> + <option value="30">30</option> + <option value="31">31</option> + + </select> + + </td> + </tr> + <tr> + <td><input type="submit" name="search_submit" value="Go!"></td> + </tr> + </table> +</form> + +<?php + +if (($search_submit)) { + if ((!$date1_y) && (!date1_m) && (!$date1_d) && (!$search)) { + $showing_what = "Browsing all entries from beginning to" ; + $qw_params = "DESC TimeStamp" ; + } + else { + + //defaults + $date1_y_q = "2000" ; + $date1_m_q = "01" ; + $date1_d_q = "01" ; + + $date2_y_q = date("Y") ; + $date2_m_q = date("m") ; + $date2_d_q = date("d") ; + + //check for input + if ($date1_y) { + $date1_y_q = $date1_y ; + } + if ($date1_m) { + $date1_m_q = $date1_m ; + } + if ($date1_d) { + $date1_d_q = $date1_d ; + } + + if ($date2_y) { + $date2_y_q = $date2_y ; + } + if ($date2_m) { + $date2_m_q = $date2_m ; + } + if ($date2_d) { + $date2_d_q = $date2_d ; + } + + $date1_comp = $date1_y_q."-".$date1_m_q."-".$date1_d_q ; + $date2_comp = $date2_y_q."-".$date2_m_q."-".$date2_d_q ; + $date1_ts = strtotime($date1_comp) ; + $date2_ts = strtotime($date2_comp) ; + + $qw_params = "WHERE 1" ; + if (($search) && ($searchin)) { + //to do : validate searchin against allowed values + $search2 = str_replace("*", "%", $search) ; + + if ($searchin == "all") { + $qw_params = "WHERE (wallusers LIKE '%$search2%') OR (Opernick LIKE '%$search2%') OR (OperHost LIKE '%$search2%')" ; + } + else { + $qw_params = "WHERE ($searchin LIKE '%$search2%')" ; + } + } + + //prepare query params + $qw_params = $qw_params . " " . "AND ( (timestamp >= '$date1_ts') AND (timestamp <= '$date2_ts') ) ORDER BY TimeStamp ASC" ; + + } + + + $qw = "SELECT * FROM wallusers_table ".$qw_params ; + // echo "qw = $qw<br>" ; + $qw_res = n_query($qw) ; + if (mysql_num_rows($qw_res) == 0) { + echo "No wallusers found." ; + } + else { +?> + <table width="800" border="1" cellspacing="0" cellpadding="0"> + <tr bgcolor="#000000"> + <th width="150"><span class="style1">time</span></th> + <th width="130" scope="col"><span class="style1">oper</span></th> + <th width="3">|</th> + <th width=""><span class="style1">wallusers</span></th> + </tr> +<?php + } + while ($qw_obj = mysql_fetch_object($qw_res)) { +?> + <tr bgcolor="#CCCCCC"> + <td valign="top"><?php echo date("Y-m-d H:i:s",$qw_obj->TimeStamp) ?></td> + <td valign="top" align="right"><?php echo "$qw_obj->Opernick!$qw_obj->OperHost" ?></td> + <td valign="top" align="center"></td> + <td><?php echo $qw_obj->wallusers ?></td> + </tr> +<?php + } + +} + +echo '</body></html>' ; +?> \ No newline at end of file ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-08 10:16:16
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-08 10:16:14 UTC Modified files: functions.php index.php users.php Log message: Author:nexxer Log message:new wallusers and stats functionality ---------------------- diff included ---------------------- Index: website/functions.php diff -u website/functions.php:1.14 website/functions.php:1.15 --- website/functions.php:1.14 Mon Dec 1 08:31:04 2003 +++ website/functions.php Mon Dec 8 02:16:04 2003 @@ -39,7 +39,8 @@ "editchannel" => 'Edit Channel', "edituser" => 'Edit User', "newnote" => 'Compose new note', - "newpass" => 'Change password' + "newpass" => 'Change password', + "wallusers" => 'Wallusers' ) ; $title = $options[$currPage] ; @@ -85,9 +86,10 @@ ) ; $options = array( - "index" => '<td width="34"><a href="index.php"><font color="white">Main</font></a></td>', + "index" => '<td width="34"><a href="index.php"><font color="white">Main</font></a></td>', "ibc" => '<td width="26"><a href="ibc.php"><font color="white">IBC</font></a></td>', "notes" => '<td width="37"><a href="notes.php"><font color="white">Notes</font></a></td>', + "wallusers" => '<td width="37"><a href="wallusers.php"><font color="white">Wallusers</font></a></td>', "prefs" => '<td width="71"><a href="prefs.php"><font color="white">Preferences</font></a></td>', "admin" => '<td width="40"><a href="admin.php"><font color="white">Admin</font></a></td>', "logout" => '<td><div align="right"><font color="white">Logged in as '.$u.'</font> @@ -119,7 +121,7 @@ <tr><td><img src="menua.jpg"></td></tr> </table> <table width="680" bgcolor='.$usualColor.' border="0" cellspacing="0" cellpadding="3"> - '.$options["index"].$options["ibc"].$options["notes"].$options["prefs"]. + '.$options["index"].$options["ibc"].$options["notes"].$options["wallusers"].$options["prefs"]. $showAdmin.'<td width=*> </td>'.$options["logout"].'</table><br><br> '; Index: website/index.php diff -u website/index.php:1.13 website/index.php:1.14 --- website/index.php:1.13 Mon Dec 1 08:31:04 2003 +++ website/index.php Mon Dec 8 02:16:04 2003 @@ -17,12 +17,12 @@ <title>Feds Web Interface :: Index</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="main.css" /> - <script language="javascript"> - self.onload = function() { - self.focus(); - document.login.username.focus(); - } - </script> + <script language="javascript"> + self.onload = function() { + self.focus(); + document.login.username.focus(); + } + </script> </head> <body> ' ; @@ -33,53 +33,53 @@ n_connect() ; $qauth = "SELECT * FROM user_table WHERE (Handle='$username') AND (PASSWORD=md5('$password'))" ; - // echo "qauth = $qauth<br>" ; + // echo "qauth = $qauth<br>" ; $rauth = n_query($qauth) ; if (mysql_num_rows($rauth) == 1) { - $row = mysql_fetch_array($rauth) ; + $row = mysql_fetch_array($rauth) ; if ($row["suspended"] == 0) { - if ($row["site"] == 1) { - $authed_user = $row["Handle"] ; - session_register("authed_user") ; -// $flags = $row["flags"] ; -// session_register("flags") ; - $thisuid = $row["userid"] ; - session_register("thisuid") ; + if ($row["site"] == 1) { + $authed_user = $row["Handle"] ; + session_register("authed_user") ; +// $flags = $row["flags"] ; +// session_register("flags") ; + $thisuid = $row["userid"] ; + session_register("thisuid") ; if (isSiteAdmin($authed_user)) { - session_register("isSiteAdmin") ; + session_register("isSiteAdmin") ; } if (hasAnyChanAdminAccess($thisuid)) { - session_register("isChanAdmin") ; + session_register("isChanAdmin") ; } // echo "thisuid = $thisuid<br>" ; - $numlogins_web = $row["numlogins_web"] + 1 ; - $q = "UPDATE user_table SET "; - $q = $q."login_web='1', " ; + $numlogins_web = $row["numlogins_web"] + 1 ; + $q = "UPDATE user_table SET "; + $q = $q."login_web='1', " ; $q = $q."lastip_web='".$HTTP_SERVER_VARS['REMOTE_ADDR']."', " ; - $q = $q."numlogins_web='".$numlogins_web."' " ; + $q = $q."numlogins_web='".$numlogins_web."' " ; // $q = $q."logged_in='1' " ; - $q = $q."WHERE userid='".$thisuid."'" ; + $q = $q."WHERE userid='".$thisuid."'" ; // echo $q ; // mysql_query($q) or die ("couldnt execute query : $q - ".mysql_error()) ; n_query($q) ; - } + } else { - errdie("no_site", 0, 0) ; + errdie("no_site", 0, 0) ; } } else { - errdie("suspended", 0, 1) ; - } + errdie("suspended", 0, 1) ; + } } else { - errdie("invalid_pass", 0, 0) ; + errdie("invalid_pass", 0, 0) ; } } if (session_is_registered("authed_user")) { - printMenu($authed_user) ; + printMenu($authed_user) ; n_connect() ; $qnotes = "SELECT note_id FROM notes_table WHERE (target_user='".$thisuid."') AND (status!='2')" ; $qnotes_num = numRowsFromQuery($qnotes) ; @@ -89,7 +89,7 @@ //display a random quote from the public stack (or the prv stack if the user has access) - //construct the query - want to get quotes from all chans where the user has access in + //construct the query - want to get quotes from all chans where the user has access in $accChans = getAllChansWithAccess($thisuid, "chanid") ; // echo "accChans = " ; // print_r($accChans) ; @@ -101,13 +101,13 @@ while ($i < sizeof($accChans)) { if ($i == 0) { - $temp = "" ; + $temp = "" ; } else { - $temp = "OR " ; + $temp = "OR " ; } $chanWhere = $chanWhere."$temp channel_id='".$accChans[$i]."' " ; - $i++ ; + $i++ ; } // echo "chanwhere = $chanWhere<br>" ; @@ -123,7 +123,7 @@ echo '<br><br><br><br><br> <table width="600"> <tr> - <td><div align="right"><u>Random quote</u><br><br><i>'.$qquote_obj->quote.'</i></div></td> + <td><div align="right"><u>Random quote</u><br><br><i>'.htmlspecialchars($qquote_obj->quote).'</i></div></td> </tr> <tr> <td><div align="right">-- '.getUserHandleFromId($qquote_obj->user_id).'</div></td> @@ -134,37 +134,37 @@ } else { - if (isset($username) && (isset($password)) ) { - echo '<center>Failed to log you in.</center>' ; - } -/* else { - echo '<h3>Welcome to the Feds Web Interface.</h3>' ; - } + if (isset($username) && (isset($password)) ) { + echo '<center>Failed to log you in.</center>' ; + } +/* else { + echo '<h3>Welcome to the Feds Web Interface.</h3>' ; + } */ - echo ' + echo ' <br><br> - <form name="login" method="post" action="index.php"> + <form name="login" method="post" action="index.php"> <center> - <table bgcolor="#6C709E" border="0"> + <table bgcolor="#6C709E" border="0"> <tr><td colspan="2"><font color="white">Welcome to the Feds Web Interface</font></td></tr> - <tr> - <td><font color="white">Username :</font></td> - <td><input name="username" type="text" size="20"></td> - </tr> - <tr> - <td><font color="white">Password :</font></td> - <td><input name="password" type="password"></td> - </tr> - <tr> + <tr> + <td><font color="white">Username :</font></td> + <td><input name="username" type="text" size="20"></td> + </tr> + <tr> + <td><font color="white">Password :</font></td> + <td><input name="password" type="password"></td> + </tr> + <tr> <td> </td> - <td> - <input type="submit" name="submit" value="Login"> - </td> + <td> + <input type="submit" name="submit" value="Login"> + </td> </tr> - </table> + </table> </center> - </form> - ' ; + </form> + ' ; } echo '</body></html>' ; ?> Index: website/users.php diff -u website/users.php:1.11 website/users.php:1.12 --- website/users.php:1.11 Tue Dec 2 01:58:20 2003 +++ website/users.php Mon Dec 8 02:16:04 2003 @@ -295,7 +295,7 @@ $qu_res = n_query($qu) ; $num = mysql_num_rows($qu_res) ; - if (session_is_registered("isSiteAdmin")) { + if (session_is_registered("isSiteAdmin")) { $lastIpTh = '<th width="50">Last IP (web)</th>' ; $editUser = '<th width="20">Edit User</th>' ; } @@ -304,8 +304,21 @@ $editUser = "" ; } + $thisUserAccess = getChanAccess($thisuid, $chansel) ; + + if (($thisUserAccess >= 450) || (session_is_registered("isSiteAdmin"))) { + $ibcCountTh = '<th width="50">IBC Count</th>"' ; + } + else { + $ibcCountTh = "" ; + } + + + echo ' <h4>Userlist for '.$chansel.'</h4> + + <a href="stats.php?chan='.fixChan($chansel).'">Stats for '.$chansel.'</a><br> <table border="1"> '.$editUser.' <th width="80">Edit Access</th> @@ -316,12 +329,11 @@ <th width="50">Is Logged in now</th> '.$lastIpTh.' <th width="50">Web logins #</th> + '.$ibcCountTh.' <th width="50">Access</th> ' ; - $thisUserAccess = getChanAccess($thisuid, $chansel) ; - while ($qu_obj = mysql_fetch_object($qu_res)) { @@ -342,9 +354,28 @@ $editUserLnk = "" ; } - $lastIp = showLastIp($qu_obj->lastip_web) ; + if (($thisUserAccess >= 450) || (session_is_registered("isSiteAdmin"))) { + $ibcq = "SELECT count(c.id) as ibcc FROM access_table as a, user_table as b, ilc as c, chan_table as d + WHERE a.userid = b.userid AND c.addedby = b.userid AND c.addedchan = d.channel + AND a.chanid = d.chanid AND b.userid = '".$qu_obj->userid."' + AND c.entrytype!='0' AND d.channel='".$chansel."'" ; + // echo "ibcq = $ibcq<br>" ; + $ibcq_res = n_query($ibcq) ; + if (mysql_num_rows($ibcq_res) == 0) { + $ibcCount = '<td>nada</td>' ; + } + else { + $ibcq_obj = mysql_fetch_object($ibcq_res) ; + $ibcCount = "<td>$ibcq_obj->ibcc</td>" ; + } + + } + else { + $ibcCount = "" ; + } + echo '<tr> '.$editUserLnk.' '.$editAccLnk.' @@ -355,6 +386,7 @@ <td> '.$qu_obj->login_web.'</td> '.$lastIp.' <td>'.$qu_obj->numlogins_web.'</td> + '.$ibcCount.' <td>'.$qu_obj->LEVEL.'</td> </tr> ' ; ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-12-02 18:29:14
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-12-02 18:29:13 UTC Modified files: eggbase.stats.tcl eggbase.stricthelp.tcl eggbase.tcl eggbase.usercommands.tcl Log message: Author: Frederik Vervaet Log message: wallulsers bug fix ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.10 EggBase/eggbase.stats.tcl:1.11 --- EggBase/eggbase.stats.tcl:1.10 Sat Nov 29 08:06:41 2003 +++ EggBase/eggbase.stats.tcl Tue Dec 2 10:29:03 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.10 2003/11/29 16:06:41 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.11 2003/12/02 18:29:03 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -145,7 +145,7 @@ Operhost='[charfilter $operhost]',\ Wallusers='[charfilter $msg]';" - putdebug base:wallusers "Wallusers by $opernick \($operhost\) added to db." 1 + putdebug "Wallusers by $opernick \($operhost\) added to db." 1 } @@ -164,7 +164,7 @@ } if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 charcount] } { - putdebug2 "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } @@ -176,7 +176,7 @@ sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='charcount';" - putdebug2 "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 + putdebug "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 } @@ -186,7 +186,7 @@ sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='linecount';" - putdebug2 "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 + putdebug "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 } @@ -215,7 +215,7 @@ } if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 top10] } { - putdebug2 "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } @@ -315,6 +315,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.10 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.11 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.stricthelp.tcl diff -u EggBase/eggbase.stricthelp.tcl:1.13 EggBase/eggbase.stricthelp.tcl:1.14 --- EggBase/eggbase.stricthelp.tcl:1.13 Fri Nov 28 15:51:51 2003 +++ EggBase/eggbase.stricthelp.tcl Tue Dec 2 10:29:03 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stricthelp.tcl,v 1.13 2003/11/28 23:51:51 genesis Exp $ +## $Id: eggbase.stricthelp.tcl,v 1.14 2003/12/02 18:29:03 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -293,7 +293,7 @@ set helper [sql "SELECT Handle FROM user_table WHERE userid='$helperid';"] } set usernick [join [join [charfilter $usernick] ]] - putdebug 0 "$usernick [onchan $usernick $channel] $channel" 1 + putdebug "$usernick [onchan $usernick $channel] $channel" 1 if { ![onchan $usernick $channel] } { sql "DELETE FROM next WHERE usernick='[charfilter $usernick]' AND chanid='$chanid';" putdebug "Deleted $usernick from next db for \($channel\/$chanid\) (not on $channel)" 1 @@ -588,4 +588,4 @@ } } -putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.13 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.14 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.32 EggBase/eggbase.tcl:1.33 --- EggBase/eggbase.tcl:1.32 Sun Nov 30 05:11:28 2003 +++ EggBase/eggbase.tcl Tue Dec 2 10:29:03 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.32 2003/11/30 13:11:28 genesis Exp $ +## $Id: eggbase.tcl,v 1.33 2003/12/02 18:29:03 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -1021,6 +1021,8 @@ 1 { # autologin /who + + #TODO we need an ISONCHAN check here! to compensate for lag! #Feds 444 unixGeek.users.undernet.org Bjoern unixGeek #<botnick> <type> <host> <nick> <username> @@ -1045,6 +1047,7 @@ # Only active nonsuspended nondeleted users get autologin :) if { [sql "SELECT suspend FROM user_table WHERE userid='$userid';"] != "0" } { putdebug "WHO\(1\) UnAuthorised Autologin for $nick $host \($userid\)" 1 + return 1 } # The userid we have atm is of an ACTIVE users WITH an Xhandle in our DB == $xusr. @@ -1218,4 +1221,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.32 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.33 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.usercommands.tcl diff -u EggBase/eggbase.usercommands.tcl:1.27 EggBase/eggbase.usercommands.tcl:1.28 --- EggBase/eggbase.usercommands.tcl:1.27 Fri Nov 28 15:51:51 2003 +++ EggBase/eggbase.usercommands.tcl Tue Dec 2 10:29:03 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.usercommands.tcl,v 1.27 2003/11/28 23:51:51 genesis Exp $ +## $Id: eggbase.usercommands.tcl,v 1.28 2003/12/02 18:29:03 genesis Exp $ ########################################################################### ## ----------------------------------------------------------------------## @@ -380,17 +380,17 @@ if { ![botisop $channel] } { putnotc $nick "$settings(commands,prefix) Unable to comply \: I am not opped in $channel" - putdebug2 "NOT OPPED in $channel!" 1 + putdebug "NOT OPPED in $channel!" 1 return 0 } ## Auth checks. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "Unauthorised Access : $channel M $nick :$var." 1 + putdebug "Unauthorised Access : $channel M $nick :$var." 1 return 0 } if { ![login:base:checkaccess:user:cmd $nick $channel $host 1 mode] } { - putdebug2 "Insufficient Acces : $channel M $nick :$var" 1 + putdebug "Insufficient Acces : $channel M $nick :$var" 1 return 0 } @@ -403,7 +403,7 @@ # Atm we don't do any error checking. pushmode $channel $var - putdebug2 "Approved Action : $channel M $nick :$var" 1 + putdebug "Approved Action : $channel M $nick :$var" 1 # This implementation is broken on purpose. You cannot give secondary args with mode (ie nick) # This way +o $nick is not allowed :) @@ -418,7 +418,7 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to send a note to [lindex [split $var] 0] WITHOUT being logged in. (PUB)" 1 + putdebug "$nick tried to send a note to [lindex [split $var] 0] WITHOUT being logged in. (PUB)" 1 return 0 } @@ -451,9 +451,9 @@ set login_status [lindex $query 0] set unick [lindex $query 1] - putdebug2 "login_status $login_status" 1 - putdebug2 "unick $unick" 1 - putdebug2 "onchan [onchan $unick]" 1 + putdebug "login_status $login_status" 1 + putdebug "unick $unick" 1 + putdebug "onchan [onchan $unick]" 1 if { $login_status && $unick != "" && [onchan $unick] } { putnotc $unick "You have received a note from [sql "SELECT handle FROM user_table WHERE userid='[sqlfilter $source_user]';"]. Type /MSG $botnick notes read" @@ -470,7 +470,7 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to read notes WITHOUT being logged in." 1 + putdebug "$nick tried to read notes WITHOUT being logged in." 1 return 0 } @@ -505,7 +505,7 @@ set note [lindex $query 7] putnotc $nick "\[$noteid\]\[$date\]\[$sourcehandle\] $note" sql "UPDATE notes_table SET status='2',readon='[unixtime]',lastmodif='[unixtime]' WHERE note_id='[lindex $query 0]';" - putdebug2 "Set status to 2 for note [lindex $query 0] sent to $targethandle FROM $sourcehandle " 1 + putdebug "Set status to 2 for note [lindex $query 0] sent to $targethandle FROM $sourcehandle " 1 } putnotc $nick "End of Notes." @@ -543,22 +543,22 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to lookup a tld WITHOUT being logged in." 1 + putdebug "$nick tried to lookup a tld WITHOUT being logged in." 1 return 0 } if { ![login:base:checkaccess:user:cmd $nick $channel $host 1 tld] } { return 0 } - putdebug2 "1. $var ." 1 + putdebug "1. $var ." 1 set tld [string map { . "" } $var] - putdebug2 "2. $tld ." 1 + putdebug "2. $tld ." 1 if { ![string is alpha $tld] } { putnotc $nick "Invalid TLD. Syntax .tld <tld>" ; return 0 } set description [sql "SELECT description FROM tld_table WHERE tld='$tld';"] if { $description == "" } { putmsg $channel "$nick \: No such tld found. \($tld\)" ; return 0 } putmsg $channel "$nick \: $tld \-\> [join [join $description]]" - putdebug2 "Sent TLD output to $channel on request of $nick//$host" 1 + putdebug "Sent TLD output to $channel on request of $nick//$host" 1 } @@ -572,7 +572,7 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to lookup a quote WITHOUT being logged in." 1 + putdebug "$nick tried to lookup a quote WITHOUT being logged in." 1 return 0 } @@ -583,7 +583,7 @@ set limit [sql "SELECT count(id) FROM quotes_table WHERE( entrytype='0' AND channel_id='$channel_id' ) OR entrytype='1';"] if { $limit == "0" } { putnotc $nick "No entries in the quotedb." ; return 0 } - putdebug2 "Quotelimit is at $limit" 1 + putdebug "Quotelimit is at $limit" 1 # randomid can be 0! You do not select quotes by id, you sort them by id and you take the x'th quote. # Selecting by id will give problems when you delete a quote ... @@ -611,7 +611,7 @@ putmsg $channel "\[$randid/$limit\]\[$addedby\] [join [join $quote]]" - putdebug2 "Sent Quote output to $channel on request of $nick//$host" 1 + putdebug "Sent Quote output to $channel on request of $nick//$host" 1 } @@ -625,7 +625,7 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to add a quote WITHOUT being logged in." 1 + putdebug "$nick tried to add a quote WITHOUT being logged in." 1 return 0 } @@ -644,7 +644,7 @@ sql "INSERT INTO quotes_table SET channel_id='$channel_id',user_id='$user_id',timestamp='[unixtime]',quote='[mirc_strip [sqlfilter $var]]';" } putmsg $channel "Successfully added Quote nr [sql "SELECT count(id) FROM quotes_table WHERE channel_id='$channel_id';"] with id [sql "SELECT id FROM quotes_table WHERE user_id='$user_id' ORDER BY id DESC LIMIT 1;"]" - putdebug2 "Added a quote to db on request of $nick in $channel" 1 + putdebug "Added a quote to db on request of $nick in $channel" 1 } proc cmds:pub:delquote { nick host handle channel var } { @@ -657,7 +657,7 @@ # check if the user is logged in. if { ![isloggedin $nick $channel $host 1] } { - putdebug2 "$nick tried to delete a quote WITHOUT being logged in." 1 + putdebug "$nick tried to delete a quote WITHOUT being logged in." 1 return 0 } @@ -671,8 +671,8 @@ if {$var>$limit} { putnotc $nick "there are only $limit quotes in the quotedb."; return 0 } sql "DELETE FROM quotes_table WHERE `id`='[sql "SELECT id FROM quotes_table WHERE( entrytype='0' AND channel_id='$channel_id' ) OR entrytype='1' ORDER BY id ASC LIMIT [expr $var - 1],1;"]'" putmsg $channel "Successfully removed Quote nr $var" - putdebug2 "Removed a quote from db on request of $nick in $channel" 1 + putdebug "Removed a quote from db on request of $nick in $channel" 1 } -putlog "LOGIN.USERCOMMANDS.TCL \$Revision: 1.27 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "LOGIN.USERCOMMANDS.TCL \$Revision: 1.28 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-02 09:58:35
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-02 09:58:31 UTC Modified files: edituser.php prefs.php users.php Log message: Author:nexxer Log message:users and siteadmins can now update XHandle ---------------------- diff included ---------------------- Index: website/edituser.php diff -u website/edituser.php:1.11 website/edituser.php:1.12 --- website/edituser.php:1.11 Sun Jul 13 13:24:00 2003 +++ website/edituser.php Tue Dec 2 01:58:20 2003 @@ -12,11 +12,11 @@ printHeader() ; if (session_is_registered("authed_user")) { - if (session_is_registered("isSiteAdmin")) { //admin + if (session_is_registered("isSiteAdmin")) { //admin - printMenu($authed_user) ; + printMenu($authed_user) ; - // printSessionInfo() ; + // printSessionInfo() ; n_connect() ; @@ -25,47 +25,47 @@ $qun_obj = mysql_fetch_object($qun_res) ; - if (!$uid) { - echo '<html><body>' ; - echo "You shouldn't call this page directly, but only from <a href=\"users.php\"> - User Management</a>" ; + if (!$uid) { + echo '<html><body>' ; + echo "You shouldn't call this page directly, but only from <a href=\"users.php\"> + User Management</a>" ; exit ; } if ($del) { /* - if ($row["flags"] == 3) { - echo "You can't delete an admin." ; + if ($row["flags"] == 3) { + echo "You can't delete an admin." ; exit ; } */ - if ((!$yes) && (!$no)) { - echo ' - Are you sure you want to delete user '.$qun_obj->Handle.' ?<br> ; - <form name="delyesno" method="post" action="edituser.php?del=1&uid='.$uid.'"> - <input type="submit" name="yes" value="Yes"> - <input type="submit" name="no" value="No"> - </form> - ' ; - exit ; - } + if ((!$yes) && (!$no)) { + echo ' + Are you sure you want to delete user '.$qun_obj->Handle.' ?<br> ; + <form name="delyesno" method="post" action="edituser.php?del=1&uid='.$uid.'"> + <input type="submit" name="yes" value="Yes"> + <input type="submit" name="no" value="No"> + </form> + ' ; + exit ; + } else { - if ($yes) { - $qdel = "DELETE FROM user_table WHERE userid=$uid" ; + if ($yes) { + $qdel = "DELETE FROM user_table WHERE userid=$uid" ; //echo $qdel ; n_query($qdel) ; echo ' - <html><body> + <html><body> User deleted successfully<br><br> - Go <a href="users.php">back</a><br> - ' ; - exit ; + Go <a href="users.php">back</a><br> + ' ; + exit ; } if ($no) { - echo 'Click <a href="edituser.php?uid=$uid">here</a> to continue editing the user, or wait a second.' ; - echo '<meta http-equiv="refresh" content="0;url=edituser.php?uid=$uid">' ; - die ; + echo 'Click <a href="edituser.php?uid=$uid">here</a> to continue editing the user, or wait a second.' ; + echo '<meta http-equiv="refresh" content="0;url=edituser.php?uid=$uid">' ; + die ; } @@ -74,17 +74,41 @@ } + if ($editxuser) { + + if (!$Submit_xuser) { + echo ' + Enter new XHandle for user '.$qun_obj->Handle.'('.$qun_obj->userid.')<br> + <form method=post action=edituser.php?uid='.$uid.'&editxuser=1> + <input type=text name=new_xuser value='.$qun_obj->XHandle.'> + <input type=submit name=Submit_xuser value=Update XHandle> + </form> + <br> + <a href="edituser.php?uid='.$uid.'">Continue editing user</a><br> + <a href="users.php">User Management</a><br> + ' ; + exit ; + } + else { + n_query("UPDATE user_table SET XHandle='$new_xuser' WHERE userid='$uid'") ; + echo 'Updated<br> + <a href="edituser.php?uid='.$uid.'">Continue editing user</a><br> + <a href="users.php">User Management</a><br>' ; + exit ; + } + } + if ($suspend) { - if (strcmp($suspend, "yes") == 0) { - $qsusp = "UPDATE user_table SET suspend='1' WHERE userid='$uid'" ; + if (strcmp($suspend, "yes") == 0) { + $qsusp = "UPDATE user_table SET suspend='1' WHERE userid='$uid'" ; $t = "suspended" ; } else { - if (strcmp($suspend, "no") == 0) { - $qsusp = "UPDATE user_table SET suspend='0' WHERE userid='$uid'" ; + if (strcmp($suspend, "no") == 0) { + $qsusp = "UPDATE user_table SET suspend='0' WHERE userid='$uid'" ; $t = "unsuspended" ; - } - } + } + } n_query($qsusp) ; echo ' <html><body> @@ -94,51 +118,51 @@ exit ; } - if ($newpass) { - if ($Submit_newpass) { - if (strcmp($newpass1, $newpass2) == 0) { - $qch = "UPDATE user_table SET password=md5('$newpass1') WHERE (userid='$uid')" ; - // echo $qch ; - mysql_query($qch) or die ("error executing query : mysql_error()") ; - echo ' + if ($newpass) { + if ($Submit_newpass) { + if (strcmp($newpass1, $newpass2) == 0) { + $qch = "UPDATE user_table SET password=md5('$newpass1') WHERE (userid='$uid')" ; + // echo $qch ; + mysql_query($qch) or die ("error executing query : mysql_error()") ; + echo ' <html><body> - Successfully changed.<br><br> - <a href="edituser.php?uid='.$uid.'">Continue editing user</a><br> - <a href="users.php">User Management</a><br> - ' ; - exit ; - } - else { - echo "Passwords don't match: '$newpass1', '$newpass2' Please try again." ; - } - } - // $uobj = getUserObjectFromID($uid) ; no need for second time - $uobj = $qun_obj ; + Successfully changed.<br><br> + <a href="edituser.php?uid='.$uid.'">Continue editing user</a><br> + <a href="users.php">User Management</a><br> + ' ; + exit ; + } + else { + echo "Passwords don't match: '$newpass1', '$newpass2' Please try again." ; + } + } + // $uobj = getUserObjectFromID($uid) ; no need for second time + $uobj = $qun_obj ; echo $uobj->Handle ; - echo ' - <h3>Password change for user <u>'.$uid.'</u> - '.$uobj->Handle.' :</h3> - <form name="chpass" method="post" action="edituser.php?newpass=1&uid='.$uid.'"> - <table width="600"> - <tr> - <td width="200">Enter new password:</td> - <td><input type="password" name="newpass1"></td> - </tr> - <tr> - <td>Re-enter new password:</td> - <td><input type="password" name="newpass2"></td> - </tr> - <tr> - <td colspan="2"> - <input type="submit" name="Submit_newpass" value="Process"> - <input type="reset" name="reset" value="Clear"> - </td> - </tr> - </table> - </form> - <br><br> + echo ' + <h3>Password change for user <u>'.$uid.'</u> - '.$uobj->Handle.' :</h3> + <form name="chpass" method="post" action="edituser.php?newpass=1&uid='.$uid.'"> + <table width="600"> + <tr> + <td width="200">Enter new password:</td> + <td><input type="password" name="newpass1"></td> + </tr> + <tr> + <td>Re-enter new password:</td> + <td><input type="password" name="newpass2"></td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" name="Submit_newpass" value="Process"> + <input type="reset" name="reset" value="Clear"> + </td> + </tr> + </table> + </form> + <br><br> <a href="edituser.php?uid='.$uid.'">Continue editing user</a><br> <a href="users.php">User Management</a><br> - ' ; + ' ; exit ; } @@ -150,11 +174,15 @@ <td width="409"><?php echo $qun_obj->Handle ?></td> </tr> <tr> + <td width="81">X-Username:</td> + <td width="409"><?php echo "$qun_obj->XHandle <a href=\"edituser.php?uid=$uid&editxuser=1\">(edit)</a>" ?></td> + </tr> + <tr> <td>Password:</td> <td><a href=<?php echo "\"edituser.php?newpass=1&uid=$uid\"" ; ?>>Change password</a></td> </tr> <? - /* echo '<tr> + /* echo '<tr> <td>Flags:</td> <td><select name="new_flags"> writeopts($qun_obj->flags) ; @@ -168,15 +196,15 @@ <td>Suspension:</td> <td><?php if ($qun_obj->suspend == 0) { - $a = '<a href="edituser.php?suspend=yes&uid='.$uid.'">' ; + $a = '<a href="edituser.php?suspend=yes&uid='.$uid.'">' ; $b = "No" ; - $t = "Suspend" ; + $t = "Suspend" ; } else { - if ($qun_obj->suspend == 1) { - $a = '<a href="edituser.php?suspend=no&uid='.$uid.'">' ; + if ($qun_obj->suspend == 1) { + $a = '<a href="edituser.php?suspend=no&uid='.$uid.'">' ; $b = "Yes" ; - $t = "Unsuspend" ; + $t = "Unsuspend" ; } } echo "$b - $a$t" ; ?> @@ -191,7 +219,7 @@ </tr> <tr> <td colspan="2"> - <a href=<?php echo "\"edituser.php?del=1&uid=$uid\"" ; ?>>Delete user</a> + <a href=<?php echo "\"edituser.php?del=1&uid=$uid\"" ; ?>>Delete user</a> </td> </tr> </table> @@ -209,7 +237,7 @@ } } else { - echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; + echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; } echo '</body></html>' ; Index: website/prefs.php diff -u website/prefs.php:1.7 website/prefs.php:1.8 --- website/prefs.php:1.7 Mon Dec 1 08:31:04 2003 +++ website/prefs.php Tue Dec 2 01:58:20 2003 @@ -39,6 +39,15 @@ die ; } + if ($action=="editxuser") { + + $qupdxu = "UPDATE user_table SET XHandle='$new_xuser' WHERE userid='$thisuid'" ; + // echo $qupdxu ; + n_query($qupdxu) ; + echo 'X-Handle updated. Go <a href="prefs.php">back</a>' ; + exit ; + } + if ($qu_obj->ibctype == 0) { $showIbcRadio = '<input type="radio" name="newIbcType" value="0" checked>Private @@ -60,6 +69,10 @@ <form method="post" action="prefs.php?action=editIbcType"> '.$showIbcRadio.' <input type="submit" name="newibc" value="Update default IBC Type"> + </form> + <form method=post action=prefs.php?action=editxuser> + <input type=text name=new_xuser value='.$qu_obj->XHandle.'> + <input type=submit name=Submit_xuser value="Update XHandle"> </form> ' ; } Index: website/users.php diff -u website/users.php:1.10 website/users.php:1.11 --- website/users.php:1.10 Sun Jul 13 13:24:00 2003 +++ website/users.php Tue Dec 2 01:58:20 2003 @@ -158,6 +158,9 @@ exit ; } + if ($xhandle=="") { + echo 'You need to enter an X username. Go <a href=javascript:history.back(1)>back</a> and try again' ; + } $qadd = "INSERT INTO user_table (`userid`,`Handle`,`XHandle`,`PASSWORD`,`login_status`,`login_web`, `suspend`,`langid`,`ibctype`,`site`,`unick`,`uhost`,`seen`,`last_spoke`, @@ -222,6 +225,7 @@ <table border="1"> <th width="50">Userid</th> <th width="100">Handle</th> + <th width="100">X-User</th> <th width="50">Suspended (globally)</th> <th width="50">Web access</th> <th width="50">Is Logged in now</th> @@ -234,6 +238,7 @@ echo '<tr> <td><a href="edituser.php?uid='.$qu_obj->userid.'">'.$qu_obj->userid.'</a></td> <td>'.$qu_obj->Handle.'</td> + <td>'.$qu_obj->XHandle.'</td> <td>'.$qu_obj->suspend.'</td> <td>'.$qu_obj->site.'</td> <td> '.$qu_obj->login_web.'</td> @@ -305,6 +310,7 @@ '.$editUser.' <th width="80">Edit Access</th> <th width="100">Handle</th> + <th width="100">X-Handle</th> <th width="50">Suspended (globally)</th> <th width="50">Web access</th> <th width="50">Is Logged in now</th> @@ -343,6 +349,7 @@ '.$editUserLnk.' '.$editAccLnk.' <td>'.$qu_obj->Handle.'</td> + <td>'.$qu_obj->XHandle.'</td> <td>'.$qu_obj->suspend.'</td> <td>'.$qu_obj->site.'</td> <td> '.$qu_obj->login_web.'</td> ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-01 16:31:17
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-01 16:31:15 UTC Modified files: functions.php ibc.php index.php prefs.php Log message: Author:nexxer Log message:minor tweeks and fixes. should be ready to publish now in beta ---------------------- diff included ---------------------- Index: website/functions.php diff -u website/functions.php:1.13 website/functions.php:1.14 --- website/functions.php:1.13 Sun Jul 13 13:23:42 2003 +++ website/functions.php Mon Dec 1 08:31:04 2003 @@ -11,11 +11,13 @@ // or even anything that we pass as a parameter to an sql query +include ('config.php') ; + function getThisPage() { - $temp = explode("/", $_SERVER['PHP_SELF']) ; + $temp = explode("/", $_SERVER['PHP_SELF']) ; $file = $temp[sizeof($temp)-1] ; - return $file ; + return $file ; } @@ -25,8 +27,8 @@ $currPage = str_replace(".php", "", $self) ; // echo "$currPage<br>" ; - $options = array( - "index" => 'Index', + $options = array( + "index" => 'Index', "ibc" => 'IBC', "notes" => 'Notes', "prefs" => 'Preferences', @@ -65,41 +67,41 @@ $currPage = str_replace(".php", "", $self) ; // echo "$currPage<br>" ; -// $currentColor = '"#99CCFF"' ; -// $currentColor = "#6FB9FD" ; +// $currentColor = '"#99CCFF"' ; +// $currentColor = "#6FB9FD" ; // $currentColor = "#73ACD9" ; // $currentColor = "#6EA1CB" ; - $currentColor = "#6FB9FD" ; -// $currentColor = "#A1D4FF" ; + $currentColor = "#6FB9FD" ; +// $currentColor = "#A1D4FF" ; $usualColor = '"black"' ; $parents = array( - "newpass" => 'prefs', + "newpass" => 'prefs', "edituser" => 'admin', "editaccess" => 'users', ) ; - $options = array( - "index" => '<td width="34"><a href="index.php"><font color="white">Main</font></a></td>', + $options = array( + "index" => '<td width="34"><a href="index.php"><font color="white">Main</font></a></td>', "ibc" => '<td width="26"><a href="ibc.php"><font color="white">IBC</font></a></td>', "notes" => '<td width="37"><a href="notes.php"><font color="white">Notes</font></a></td>', "prefs" => '<td width="71"><a href="prefs.php"><font color="white">Preferences</font></a></td>', "admin" => '<td width="40"><a href="admin.php"><font color="white">Admin</font></a></td>', "logout" => '<td><div align="right"><font color="white">Logged in as '.$u.'</font> - <a href="logout.php"><font color="gray">[Logout]</font></a></div></td>', + <a href="logout.php"><font color="gray">[Logout]</font></a></div></td>', ) ; $options[$currPage] = str_replace('<font color="white">', - '<font color="black">', $options[$currPage]) ; + '<font color="black">', $options[$currPage]) ; $options[$currPage] = str_replace('><a href', - 'bgcolor='.$currentColor.'><a href',$options[$currPage]) ; + 'bgcolor='.$currentColor.'><a href',$options[$currPage]) ; -// echo "now it is $options[$currPage]" ; +// echo "now it is $options[$currPage]" ; // echo 'options[index] = '.$options["index"] ; @@ -107,16 +109,16 @@ session_start() ; if (session_is_registered("isSiteAdmin") || session_is_registered("isChanAdmin")) { - $showAdmin = $options["admin"] ; + $showAdmin = $options["admin"] ; } else { - $showAdmin = '<td width="40"> </td>' ; + $showAdmin = '<td width="40"> </td>' ; } $menu = ' - <table bgcolor="'.$currentColor.'" border="0" cellspacing="0" cellpadding="0"> + <table bgcolor="'.$currentColor.'" border="0" cellspacing="0" cellpadding="0"> <tr><td><img src="menua.jpg"></td></tr> </table> - <table width="680" bgcolor='.$usualColor.' border="0" cellspacing="0" cellpadding="3"> + <table width="680" bgcolor='.$usualColor.' border="0" cellspacing="0" cellpadding="3"> '.$options["index"].$options["ibc"].$options["notes"].$options["prefs"]. $showAdmin.'<td width=*> </td>'.$options["logout"].'</table><br><br> '; @@ -169,13 +171,13 @@ // echo "it's $u->ibctype<br>" ; if ($u->ibctype == 1) { - return "$pubchk" ; + return "$pubchk" ; } if ($u->ibctype == 2) { - return "$prvchk" ; + return "$prvchk" ; } else { - echo 'something\'s wrong with your ibctype' ; + echo 'something\'s wrong with your ibctype' ; die ; } @@ -185,19 +187,19 @@ function errdie($errstr,$retpage,$doDie) { if (strcmp($errstr,"no_such_user") == 0) { - $str = "User was not found in the system." ; + $str = "User was not found in the system." ; } if (strcmp($errstr,"generic") == 0) { - $str = "Generic error." ; + $str = "Generic error." ; } if (strcmp($errstr,"invalid_pass") == 0) { - $str = "Invalid username or password. Please try again." ; + $str = "Invalid username or password. Please try again." ; } if (strcmp($errstr,"no_site") == 0) { - $str = "Sorry, you have no access to the web interface." ; + $str = "Sorry, you have no access to the web interface." ; } if (strcmp($errstr,"suspended") == 0) { - $str = "Your account is suspended. Please contact the administrator." ; + $str = "Your account is suspended. Please contact the administrator." ; } @@ -206,34 +208,35 @@ $str = $str.'<br><br>' ; if ($retpage != 0) { - $str = $str.'Go <a href="'.$retpage.'">back</a><br>' ; + $str = $str.'Go <a href="'.$retpage.'">back</a><br>' ; } echo '<b>An error has occured:</b> '.$str ; if ($doDie == 1) { - die ; + die ; } } function openPage($p) { - header("Location: $p") ; + header("Location: $p") ; exit ; } function n_connect() { -$pw = "somepass" ; -mysql_connect("localhost", "feds", $pw) or die ("couldnt connect to db") ; +global $dbuser, $dbpw ; + +mysql_connect("localhost", $dbuser, $dbpw) or die ("couldnt connect to db") ; mysql_select_db("feds") or die ("couldnt select db") ; } function n_query($a) { -// echo "a = $a<br>" ; - n_connect() ; - $a_res = mysql_query($a) or die("bad query : $a <br> ".mysql_error()) ; +// echo "a = $a<br>" ; + n_connect() ; + $a_res = mysql_query($a) or die("bad query : $a <br> ".mysql_error()) ; return ($a_res) ; mysql_close() ; } @@ -241,50 +244,50 @@ function isSiteAdmin($a) { if (strcmp($a,"nex") == 0) { - return 1 ; + return 1 ; } else { - return 0 ; + return 0 ; } } function showLastIp($ip) { - if (session_is_registered("isSiteAdmin")) { - return "<td>$ip</td>" ; + if (session_is_registered("isSiteAdmin")) { + return "<td>$ip</td>" ; } else { - return "" ; + return "" ; } } function getUserHandleFromID($id) { - $uobj = getUserObjectFromID($id) ; + $uobj = getUserObjectFromID($id) ; return $uobj->Handle ; } function getUserIdFromHandle($h) { - $uobj = getUserObjectFromHandle($h) ; + $uobj = getUserObjectFromHandle($h) ; return $uobj->userid ; } function getChanIdFromChanName($c) { - $ch = getChanObjFromChanName($c) ; + $ch = getChanObjFromChanName($c) ; return $ch->chanid ; } function getUserObjectFromID($i) { n_connect() ; - $qh = "SELECT * FROM user_table WHERE userid='".$i."'" ; + $qh = "SELECT * FROM user_table WHERE userid='".$i."'" ; $qh_res = n_query($qh) ; if (mysql_num_rows($qh_res) != 1) { echo 'No such user(id) exists on the system. (userid = '.$i.') <a href="javascript:history.go(-1)">Go back</a>' ; - die ; + die ; } $qh_obj = mysql_fetch_object($qh_res) ; return $qh_obj ; @@ -293,33 +296,33 @@ function getUserObjectFromHandle($h) { n_connect() ; - $qh = "SELECT * FROM user_table WHERE Handle='".$h."'" ; + $qh = "SELECT * FROM user_table WHERE Handle='".$h."'" ; $qh_res = n_query($qh) ; if (mysql_num_rows($qh_res) != 1) { echo 'No such user(handle) exists on the system. <a href="javascript:history.go(-1)">Go back</a>' ; - die ; + die ; } $qh_obj = mysql_fetch_object($qh_res) ; return $qh_obj ; } function isPrivateChan($chanid) { - $ch = getChanObjFromChanId($chanid) ; + $ch = getChanObjFromChanId($chanid) ; return ($ch->private == 1) ; } function isSelfishChan($chanid) { - $ch = getChanObjFromChanId($chanid) ; + $ch = getChanObjFromChanId($chanid) ; return ($ch->selfish == 1) ; } function getChanObjFromChanId($id) { - $qch = "SELECT * FROM chan_table WHERE chanid='".$id."' " ; + $qch = "SELECT * FROM chan_table WHERE chanid='".$id."' " ; $qch_res = n_query($qch) ; if (mysql_num_rows($qch_res) == 0) { - echo 'No such channel. Go <a href=javascript:history.go(-1)>back</a>' ; + echo 'No such channel. Go <a href=javascript:history.go(-1)>back</a>' ; die ; } $qch_obj = mysql_fetch_object($qch_res) ; @@ -327,10 +330,10 @@ } function getChanObjFromChanName($c) { - $qch = "SELECT * FROM chan_table WHERE channel='".$c."' " ; + $qch = "SELECT * FROM chan_table WHERE channel='".$c."' " ; $qch_res = n_query($qch) ; if (mysql_num_rows($qch_res) == 0) { - echo 'No such channel. Go <a href=javascript:history.go(-1)>back</a>' ; + echo 'No such channel. Go <a href=javascript:history.go(-1)>back</a>' ; die ; } $qch_obj = mysql_fetch_object($qch_res) ; @@ -341,54 +344,54 @@ function fixChan($s) { - return (ereg_replace("#", "%23", $s)) ; + return (ereg_replace("#", "%23", $s)) ; } -// usage, for authed_user : if (hasAccess(#idle) .. + function getChanAccess($uid, $chan) { - $qchk = "SELECT LEVEL FROM access_table INNER JOIN chan_table + $qchk = "SELECT LEVEL FROM access_table INNER JOIN chan_table ON access_table.chanid=chan_table.chanid WHERE (access_table.userid='".$uid."') AND (chan_table.channel='".$chan."') AND (access_table.LEVEL>0)" ; - //echo "qchk = $qchk<br>" ; + //echo "qchk = $qchk<br>" ; $qchk_res = n_query($qchk) ; if (mysql_num_rows($qchk_res) != 1) { - return 0 ; + return 0 ; } else { - $qchk_obj = mysql_fetch_object($qchk_res) ; + $qchk_obj = mysql_fetch_object($qchk_res) ; return $qchk_obj->LEVEL ; } } function array_search_r($needle, $haystack){ - foreach($haystack as $value){ - if(is_array($value)) - $match=array_search_r($needle, $value); - if($value==$needle) - $match=1; - if($match) - return 1; - } - return 0; + foreach($haystack as $value){ + if(is_array($value)) + $match=array_search_r($needle, $value); + if($value==$needle) + $match=1; + if($match) + return 1; + } + return 0; } //returns an array of objects of all the channels from chan_table function getAllChannels() { - $qch = "SELECT * FROM chan_table" ; + $qch = "SELECT * FROM chan_table" ; $qch_res = n_query($qch) ; if (mysql_num_rows($qch_res) == 0) { - return 0 ; + return 0 ; } $chanObjArr = array() ; while ($qch_obj = mysql_fetch_object($qch_res)) { - array_push($chanObjArr, $qch_obj) ; + array_push($chanObjArr, $qch_obj) ; } return $chanObjArr ; @@ -396,57 +399,57 @@ function getAllChansWithAdminAccess($uid, $mode) { - //if user is site admin we want to be able to show him + //if user is site admin we want to be able to show him //all channel userlists. if ((strcmp($mode, "chanid") != 0) && (strcmp($mode, "channel") != 0)) { - echo 'mode should be chanid or channel.' ; + echo 'mode should be chanid or channel.' ; die ; } $adminAccessArr = array() ; - if (session_is_registered("isSiteAdmin")) { - //$qchk = "SELECT channel FROM chan_table" ; + if (session_is_registered("isSiteAdmin")) { + //$qchk = "SELECT channel FROM chan_table" ; $chans_obj = getAllChannels() ; if ($chans_obj == 0) { - return -1 ; + return -1 ; } if (strcmp($mode, "chanid") == 0) { - foreach ($chans_obj as $c) { - array_push($adminAccessArr, $c->chanid) ; - } + foreach ($chans_obj as $c) { + array_push($adminAccessArr, $c->chanid) ; + } } elseif (strcmp($mode, "channel") == 0) { - foreach ($chans_obj as $c) { - array_push($adminAccessArr, $c->channel) ; - } - } + foreach ($chans_obj as $c) { + array_push($adminAccessArr, $c->channel) ; + } + } } else { - $qchk = "SELECT chan_table.channel, chan_table.chanid FROM access_table - INNER JOIN chan_table - ON access_table.chanid=chan_table.chanid - WHERE (access_table.userid='".$uid."') - AND (access_table.LEVEL>=400)" ; - - $qchk_res = n_query($qchk) ; - if (mysql_num_rows($qchk_res) == 0) { - return 0 ; - } + $qchk = "SELECT chan_table.channel, chan_table.chanid FROM access_table + INNER JOIN chan_table + ON access_table.chanid=chan_table.chanid + WHERE (access_table.userid='".$uid."') + AND (access_table.LEVEL>=400)" ; + + $qchk_res = n_query($qchk) ; + if (mysql_num_rows($qchk_res) == 0) { + return 0 ; + } if (strcmp($mode, "chanid") == 0) { - while ($qchk_obj = mysql_fetch_object($qchk_res)) { - array_push($adminAccessArr, $qchk_obj->chanid) ; - } + while ($qchk_obj = mysql_fetch_object($qchk_res)) { + array_push($adminAccessArr, $qchk_obj->chanid) ; + } } elseif (strcmp($mode, "channel") == 0) { - while ($qchk_obj = mysql_fetch_object($qchk_res)) { - array_push($adminAccessArr, $qchk_obj->channel) ; - } + while ($qchk_obj = mysql_fetch_object($qchk_res)) { + array_push($adminAccessArr, $qchk_obj->channel) ; + } - } + } } return $adminAccessArr ; @@ -455,7 +458,7 @@ function getAllChansWithAccess($uid, $mode) { // mode = "chanid" or "channel" defines return type if ((strcmp($mode, "chanid") != 0) && (strcmp($mode, "channel") != 0)) { - echo 'mode should be chanid or channel.' ; + echo 'mode should be chanid or channel.' ; die ; } @@ -463,54 +466,54 @@ $accessArr = array() ; - if (session_is_registered("isSiteAdmin")) { - //$qchk = "SELECT channel FROM chan_table" ; + if (session_is_registered("isSiteAdmin")) { + //$qchk = "SELECT channel FROM chan_table" ; $chans_obj = getAllChannels() ; if ($chans_obj == 0) { - return -1 ; + return -1 ; } if (strcmp($mode, "chanid") == 0) { - foreach ($chans_obj as $c) { - array_push($accessArr, $c->chanid) ; - } + foreach ($chans_obj as $c) { + array_push($accessArr, $c->chanid) ; + } } elseif (strcmp($mode, "channel") == 0) { - foreach ($chans_obj as $c) { - array_push($accessArr, $c->channel) ; - } - } + foreach ($chans_obj as $c) { + array_push($accessArr, $c->channel) ; + } + } } else { - $qchk = "SELECT chan_table.channel, chan_table.chanid FROM access_table - INNER JOIN chan_table - ON access_table.chanid=chan_table.chanid - WHERE (access_table.userid='".$uid."') - AND (access_table.LEVEL>0)" ; - $qchk_res = n_query($qchk) ; - if (mysql_num_rows($qchk_res) == 0) { - return 0 ; - } + $qchk = "SELECT chan_table.channel, chan_table.chanid FROM access_table + INNER JOIN chan_table + ON access_table.chanid=chan_table.chanid + WHERE (access_table.userid='".$uid."') + AND (access_table.LEVEL>0)" ; + $qchk_res = n_query($qchk) ; + if (mysql_num_rows($qchk_res) == 0) { + return 0 ; + } if (strcmp($mode, "chanid") == 0) { - while ($qchk_obj = mysql_fetch_object($qchk_res)) { - array_push($accessArr, $qchk_obj->chanid) ; - } + while ($qchk_obj = mysql_fetch_object($qchk_res)) { + array_push($accessArr, $qchk_obj->chanid) ; + } } elseif (strcmp($mode, "channel") == 0) { - while ($qchk_obj = mysql_fetch_object($qchk_res)) { - array_push($accessArr, $qchk_obj->channel) ; - } + while ($qchk_obj = mysql_fetch_object($qchk_res)) { + array_push($accessArr, $qchk_obj->channel) ; + } - } + } } return $accessArr ; } function hasAnyChanAdminAccess($uid) { - $qchk = "SELECT * FROM access_table INNER JOIN chan_table + $qchk = "SELECT * FROM access_table INNER JOIN chan_table ON access_table.chanid=chan_table.chanid WHERE (access_table.userid='".$uid."') AND (access_table.LEVEL>400)" ; @@ -522,7 +525,7 @@ function isUser($handle) { - $qu = "SELECT userid FROM user_table WHERE Handle='".$handle."'" ; + $qu = "SELECT userid FROM user_table WHERE Handle='".$handle."'" ; //echo $qu ; return (numRowsFromQuery($qu) == 1) ; @@ -543,7 +546,7 @@ function numRowsFromQuery($s) { - $s_res = n_query($s) ; + $s_res = n_query($s) ; $s_num = mysql_num_rows($s_res) ; // echo "s_num = $s_num<br>" ; return $s_num ; @@ -558,13 +561,13 @@ function properNumberOfNotes($msg, $num) { if ($num == 0) { - $msg = "No ".$msg."s" ; + $msg = "No ".$msg."s" ; } if ($num == 1) { - $msg = "1 ".$msg ; + $msg = "1 ".$msg ; } if ($num > 1) { - $msg = "$num ".$msg."s" ; + $msg = "$num ".$msg."s" ; } return $msg ; } Index: website/ibc.php diff -u website/ibc.php:1.14 website/ibc.php:1.15 --- website/ibc.php:1.14 Sun Jul 13 13:23:42 2003 +++ website/ibc.php Mon Dec 1 08:31:04 2003 @@ -19,7 +19,7 @@ if (session_is_registered("authed_user")) { -// createMenu() ; +// createMenu() ; // n_connect() ; @@ -28,30 +28,30 @@ //DELETE IBC if ($del) { - if (session_is_registered("ibc_checked")) { + if (session_is_registered("ibc_checked")) { session_unregister("ibc_checked") ; if ($yes) { $qdel = "UPDATE ilc SET EntryType='0' WHERE (addedby='".$thisuid."') AND (id='".$ibc_checked."')" ; -// echo "$qdel" ; - n_query($qdel) ; - echo 'Deleted.<br><br>' ; - echo 'Click <a href="ibc.php'.$searchString.'">here</a> to return to the listing, or wait a second.' ; - echo '<meta http-equiv="refresh" content="0;url=ibc.php'.$searchString.'">' ; - die ; +// echo "$qdel" ; + n_query($qdel) ; + echo 'Deleted.<br><br>' ; + echo 'Click <a href="ibc.php'.$searchString.'">here</a> to return to the listing, or wait a second.' ; + echo '<meta http-equiv="refresh" content="0;url=ibc.php'.$searchString.'">' ; + die ; } else { - if ($no) { -// Header ("Location : notes.php") ; -// echo '<meta http-equiv="refresh" content="2;url=notes.php">' ; - //do nothing + if ($no) { +// Header ("Location : notes.php") ; +// echo '<meta http-equiv="refresh" content="2;url=notes.php">' ; + //do nothing // errdie("generic",getThisPage().$searchString,1) ; echo 'Don\'t want to delete ? Very well, go <a href="ibc.php'.$searchString.'">back</a>' ; die ; } else { errdie("generic",getThisPage().$searchString,1) ; -// echo 'Something went wrong. Go <a href="ibc.php'.$searchString.'">back</a>'; +// echo 'Something went wrong. Go <a href="ibc.php'.$searchString.'">back</a>'; // die ; } } @@ -59,45 +59,45 @@ else { - $qchk = "SELECT * FROM ilc WHERE (addedby='".$thisuid."') + $qchk = "SELECT * FROM ilc WHERE (addedby='".$thisuid."') AND (id='".$del."')" ; - $qchk_res = n_query($qchk) ; - if (mysql_num_rows($qchk_res) == 0) { - echo 'IBC not found. Note that you can only delete ibcs that + $qchk_res = n_query($qchk) ; + if (mysql_num_rows($qchk_res) == 0) { + echo 'IBC not found. Note that you can only delete ibc that you added. Go <a href="javascript:history.go(-1)">back</a>' ; - die ; - } - $qchk_row = mysql_fetch_object($qchk_res) ; + die ; + } + $qchk_row = mysql_fetch_object($qchk_res) ; - $ibc_checked = $del ; - session_register("ibc_checked") ; + $ibc_checked = $del ; + session_register("ibc_checked") ; echo ' - <form name="ibc_del_confirm" method="post" action="ibc.php?del='.$del.'"> - Delete note from "'.getUserHandleFromId($qchk_row->addedby).'" for channel "'.$qchk_row->ilctopic.'" ? - <input type="submit" name="yes" value="Yes"> - <input type="submit" name="no" value="No"> - </form> - ' ; + <form name="ibc_del_confirm" method="post" action="ibc.php?del='.$del.'"> + Delete note from "'.getUserHandleFromId($qchk_row->addedby).'" for channel "'.$qchk_row->ilctopic.'" ? + <input type="submit" name="yes" value="Yes"> + <input type="submit" name="no" value="No"> + </form> + ' ; exit ; - } + } } if ($post) { - if (!session_is_registered("shownAddIBCForm")) { - echo 'You should only add IBC from <a href="ibc.php">here</a>' ; + if (!session_is_registered("shownAddIBCForm")) { + echo 'You should only add IBC from <a href="ibc.php">here</a>' ; die ; } session_unregister("shownAddIBCForm") ; if (strcmp($msg,"") == 0) { - echo 'What\'s the point in adding an empty ibc ? Go <a href="ibc.php'.$searchString.'">back</a><br>' ; + echo 'What\'s the point in adding an empty ibc ? Go <a href="ibc.php'.$searchString.'">back</a><br>' ; die ; } if (strcmp($channel,"") == 0) { - echo 'What\'s the point in adding an ibc for no channel ? Go <a href="ibc.php'.$searchString.'">back</a><br>' ; + echo 'What\'s the point in adding an ibc for no channel ? Go <a href="ibc.php'.$searchString.'">back</a><br>' ; die ; } // echo "channel = $channel<br>" ; @@ -105,13 +105,13 @@ // print_r ($backchans) ; if (!array_search_r($backchan, $backchans)) { - echo 'Trying to poison the backchan selection ? Go <a href="ibc.php">back</a>' ; + echo 'Trying to poison the backchan selection ? Go <a href="ibc.php">back</a>' ; die ; } // session_unregister("backchans") ; // $dt = date("Y-m-d H:i:s") ; - $dt = time() ; //unixstamp + $dt = time() ; //unixstamp //echo "$dt" ; //echo "valid user is $valid_user<br>" ; $channel = str_replace("<", "<", $channel) ; @@ -132,13 +132,13 @@ //if there's invalid (anything but 1,2) data in $private, set it to 1 (public) if (($private != '1') && ($private != '2')) { - $private = 1 ; + $private = 1 ; } $entrytype = $private ; if (isSelfishChan($backchanid)) { - $entrytype = 2 ; + $entrytype = 2 ; } $addedon = $dt ; @@ -151,7 +151,7 @@ $qchan_res = n_query($qchan) ; if (mysql_num_rows($qchan_res) == 0) { - echo 'You don\'t have access in any backchans in order to add an ibc + echo 'You don\'t have access in any backchans in order to add an ibc Go <a href="ibc.php">back</a>' ; die ; } @@ -165,10 +165,10 @@ $qchan2 = "SELECT * FROM chan_table WHERE id='".$addedchanid."'" ; $qchan2_res = n_query($qchan2) ; if (mysql_num_rows($qchan2_res) == 0) { - echo 'The channel that you were added on doesn\'t exist. + echo 'The channel that you were added on doesn\'t exist. Go <a href="ibc.php">back</a>' ; //is this possible ? die ; - } + } */ // $qchan2_row = mysql_fetch_object($qchan2_res) or die ("couldnt fetch object : ".mysql_error()) ; $addedchan = $backchan ; @@ -187,13 +187,13 @@ } if (!isset($lim_range) || ($lim_range < 1) ) { - $lim_range_frm = 10 ; + $lim_range_frm = 10 ; } else { - $lim_range_frm = $lim_range ; + $lim_range_frm = $lim_range ; } if (!isset($mask)) { - $mask_frm = "*" ; + $mask_frm = "*" ; } else { $mask_frm = ereg_replace("\%", "*" , $mask) ; @@ -204,7 +204,7 @@ echo ' <h4>Search in IBC Database :</h4> -(wildcard * may be used) +(wildcard * may be used / note : dont search for *, pagination is still being developed) <form name="search" method="post" action="ibc.php"> Search for <input type="text" name="mask" value="'.$mask_frm.'"> in <select name="field"> @@ -225,14 +225,14 @@ if ($Search) { // echo "lim_range = $lim_range" ; - // echo "_GET is :" ; + // echo "_GET is :" ; // print_r($_GET) ; - //we want a new searchstring everytime + //we want a new searchstring everytime if (session_is_registered("searchString")) { - session_unregister("searchString") ; + session_unregister("searchString") ; } @@ -241,19 +241,19 @@ - switch ($field) { - case 0: $selfield = 1 ; - break ; + switch ($field) { + case 0: $selfield = 1 ; + break ; case 1: $selfield = "ilctopic" ; - break ; + break ; // case 2: -// $searchuid = getUserIdFromHandle( +// $searchuid = getUserIdFromHandle( // $selfield = "addedby" ; - break ; + break ; case 3: $selfield = "ilcdata" ; - break ; + break ; case 4: $selfield = "addedchan" ; - break ; + break ; default: echo 'Don\'t poison the selection list ! Go <a href="ibc.php">back</a>' ; } @@ -264,7 +264,7 @@ OR (ilcdata LIKE '%".$mask."%')) " ; } else { - $crit2 = "$selfield LIKE '".$mask."'" ; + $crit2 = "$selfield LIKE '".$mask."'" ; } // echo "crit2 = $crit2<br>" ; // echo "mask is $mask<br>" ; @@ -272,19 +272,20 @@ if (!isset($lim_offset)) { - $lim_offset = 0 ; //begin at the beginning + $lim_offset = 0 ; //begin at the beginning } if (!isset($lim_range) || ($lim_range < 1) || ($lim_range > 100 )) { - $lim_range = 10 ; //10 ibcs should be enough per page + $lim_range = 10 ; //10 ibcs should be enough per page } - $searchString = "?Search=1&mask=$mask&field=$field&lim_offset=$lim_offset&lim_range=$lim_range" ; + $urlmask = fixchan($mask) ; + $searchString = "?Search=1&mask=$urlmask&field=$field&lim_offset=$lim_offset&lim_range=$lim_range" ; session_register("searchString") ; $prvq = "SELECT id FROM ilc - WHERE EntryType='2' AND $crit2 - ORDER BY addedon DESC" ; + WHERE EntryType='2' AND $crit2 + ORDER BY addedon ASC" ; // echo "prvq = $prvq<br>" ; $prvr = n_query($prvq) or die ("couldn't exec query") ; $prvn = mysql_num_rows($prvr) ; @@ -293,29 +294,29 @@ $totalq_num = numRowsFromQuery($totalq) ; if ($totalq_num == 0) { - echo "No results.<br>" ; + echo "No results.<br>" ; } else { - $qs = "SELECT * FROM ilc - WHERE EntryType!='0' AND $crit2 - ORDER BY ilctopic, addedon DESC LIMIT ".$lim_offset.", ".$lim_range ; - // echo "qs = $qs<br>" ; - $qs_res = n_query($qs) ; - $qs_num = mysql_num_rows($qs_res) ; + $qs = "SELECT * FROM ilc + WHERE EntryType!='0' AND $crit2 + ORDER BY ilctopic, addedon ASC LIMIT ".$lim_offset.", ".$lim_range ; + // echo "qs = $qs<br>" ; + $qs_res = n_query($qs) ; + $qs_num = mysql_num_rows($qs_res) ; - $fontColor = "white" ; + $fontColor = "white" ; // echo "plevel = $plevel<br>" ; - if ($qs_num >= $totalq_num) { - $all = "all" ; + if ($qs_num >= $totalq_num) { + $all = "all" ; $perpage = "" ; } else { - $all = "" ; + $all = "" ; $perpage = "per page" ; } - echo "Found $totalq_num results, with $prvn PRIVATES. Showing $all $qs_num of them $perpage: <br><br>" ; + echo "Found $totalq_num results, with $prvn PRIVATES. Showing $all $qs_num of them $perpage: <br><br>" ; - //create next/prev links and page navigation + //create next/prev links and page navigation $numPages = $totalq_num / $lim_range ; if ($numPages > 1) { @@ -323,15 +324,15 @@ $pages = array() ; $currPage = $lim_offset / $lim_range ; - $currPageIndex = $currPage + 1 ; + $currPageIndex = $currPage + 1 ; for ($i = 1 ; $i < $numPages + 1 ; $i++) { - if ($i != $currPageIndex) { - array_push($pages, '<a href="ibc.php'.$searchString.'&lim_offset='.($i-1)*$lim_range.'">'.$i.'</a>') ; + if ($i != $currPageIndex) { + array_push($pages, '<a href="ibc.php?Search=1&mask='.$urlmask.'&field='.$field.'&lim_range='.$lim_range.'&lim_offset='.($i-1)*$lim_range.'">'.$i.'</a>') ; } else { - array_push($pages, "<b>$i</b>") ; - } + array_push($pages, "<b>$i</b>") ; + } } /* echo 'pages is:' ; @@ -339,37 +340,61 @@ echo '<br>' ; */ if ($lim_offset == 0) { - $prev = "START" ; + $prev = "START" ; } else { - $prevlim_offset = $lim_offset - $lim_range ; - $prev = '<a href="ibc.php'.$searchString.'&lim_offset='.$prevlim_offset.'">Previous</a>' ; + $prevlim_offset = $lim_offset - $lim_range ; + $prev = '<a href="ibc.php'.$searchString.'&lim_offset='.$prevlim_offset.'">Previous</a>' ; } if ($lim_offset > $totalq_num - $lim_range) { - $next = "END" ; + $next = "END" ; } else { - $nextlim_offset = $lim_offset + $lim_range ; - $next = '<a href="ibc.php'.$searchString.'&lim_offset='.$nextlim_offset.'">Next</a>' ; + $nextlim_offset = $lim_offset + $lim_range ; + $next = '<a href="ibc.php'.$searchString.'&lim_offset='.$nextlim_offset.'">Next</a>' ; } // print_r($pages) ; $navigPages = "Jump to page : " ; $j = 0 ; - while ($j < count ($pages)) { - if ($j == count ($pages) - 1 ) { - $trail = "" ; + $totalPages = count($pages) ; + + $mustHidePages = false ; + if ($totalPages > 15) { + $mustHidePages = true ; + $middlePage = floor($totalPages / 2) ; + } + //manage which pages to display + $startPage = ( ( $lim_offset + $lim_range ) / $lim_range ) - 1 ; + + $endPage = min($startPage + 15, $totalPages) ; + + $j = $startPage ; + + while ($j <= $endPage) { + // echo "j = $j , middlePage = $middlePage<br>" ; +/* if (($mustHidePages) && ($j > 3) && ($j < $totalPages - 3) && ($j != $middlePage)) { + $navigPages = $navigPages."." ; } else { - $trail = " - " ; - } + */ + if ($j == count ($pages) - 1 ) { + $trail = "" ; + } + else { + $trail = " - " ; + } + + $navigPages = $navigPages."[$pages[$j]]$trail" ; + + // } + $j++ ; - $navigPages = $navigPages."[$pages[$j]]$trail" ; - $j++ ; } echo "$navigPages" ; echo "<br>$prev | $next<br>" ; + echo "<b>NOTE: please ignore the broken page links, it's being worked on. Prev/Next work</b><br>" ; } // echo "lim_offset = $lim_offset, totalq_num = $totalq_num, lim_range = $lim_range<br>" ; @@ -377,19 +402,19 @@ //now display actual ibc // echo '<table width="680" border="1" cellspacing="0" cellpadding="0" bordercolor="#6FB9FD"> - // <tr><td>' ; + // <tr><td>' ; echo ' - <table width="680" border="1" cellspacing="0" cellpadding="0" bordercolor="#6FB9FD"> - <tr bgcolor="black" bordercolor="black"> - <td width=235><center><b><font color='.$fontColor.'>id / channel</font></center><b></td> - <td width=160><center><b><font color='.$fontColor.'>Date Posted</font></center><b></td> - <td width=210><center><b><font color='.$fontColor.'>Poster</font></center><b></td> - <td width=50><center><b><font color='.$fontColor.'>CSApp</font></center><b></td> - <td width=25><center><b><font color='.$fontColor.'>Del</font></center><b></td> - </tr> + <table width="680" border="1" cellspacing="0" cellpadding="0" bordercolor="#6FB9FD"> + <tr bgcolor="black" bordercolor="black"> + <td width=235><center><b><font color='.$fontColor.'>id / channel</font></center><b></td> + <td width=160><center><b><font color='.$fontColor.'>Date Posted</font></center><b></td> + <td width=210><center><b><font color='.$fontColor.'>Poster</font></center><b></td> + <td width=50><center><b><font color='.$fontColor.'>CSApp</font></center><b></td> + <td width=25><center><b><font color='.$fontColor.'>Del</font></center><b></td> + </tr> <tr><td colspan="5"> - <table width="680" border="0" cellspacing="0" cellpadding="1" bgcolor="white">' ; + <table width="680" border="0" cellspacing="0" cellpadding="1" bgcolor="white">' ; // echo '<table width="680" border="1" bgcolor="#99CCFF" cellpadding="1" cellspacing="0"> '; @@ -397,18 +422,18 @@ $previousIlcTopic = "" ; //to be used to "group up" channel entries $counter = 0 ; //counts through the results. Used mainly for deciding whether - //to display the result separator <tr>, as well as some coloring + //to display the result separator <tr>, as well as some coloring while ($qs_row = mysql_fetch_object($qs_res)) { //find level of poster on addedchan if (($counter % 2) == 0) { - $ilcDataBg = "#ECECEE" ; + $ilcDataBg = "#ECECEE" ; } else { $ilcDataBg = "#ECECEE" ; - //$ilcDataBg = "#F8F8F8" ; + //$ilcDataBg = "#F8F8F8" ; } $thisChanid = getChanIdFromChanName($qs_row->addedchan) ; @@ -437,7 +462,7 @@ } //if the authed_user is the poster, or the site admin, allow him to delete. if ((strcmp(getUserHandleFromId($qs_row->addedby),$authed_user) == 0) || - (session_is_registered("isSiteAdmin")) ) { + (session_is_registered("isSiteAdmin")) ) { $linkDel = '<a href="ibc.php?del='.$qs_row->id.'">Del</a>' ; } else { @@ -474,31 +499,31 @@ // echo "formatPrv = $formatPrv<br>" ; // $count = $count + 1 ; - //if we're not at the beginning, display the separator (blue) row - if ($counter != 0) { - $ilcSeparator = '<tr bordercolor="white"><td colspan="6" bgcolor="#6FB9FD"> </td></tr>' ; + //if we're not at the beginning, display the separator (blue) row + if ($counter != 0) { + $ilcSeparator = '<tr bordercolor="white"><td colspan="6" bgcolor="#6FB9FD"> </td></tr>' ; } else { - $ilcSeparator = '' ; + $ilcSeparator = '' ; } $ilcTopic = stripslashes($qs_row->ilctopic) ; $csappchk = '<a href="http://users.ircplanet.org/check_app.php?name='. - ereg_replace("#", "%23", $ilcTopic).'" target=_blank>CSApp</a>' ; + ereg_replace("#", "%23", $ilcTopic).'" target=_blank>CSApp</a>' ; if ($ilcTopic == $previousIlcTopic) { //group them together - $showSlash = "" ;//no need to show the '/' between id and ilctopic - $ilcTopicDisplay = "" ; //no need to show it again + $showSlash = "" ;//no need to show the '/' between id and ilctopic + $ilcTopicDisplay = "" ; //no need to show it again $csappchk = " " ; // same as above $ilcSeparator = '' ; //<tr><td colspan="6" bgcolor="#C1CBFF"></td></tr>' ; } else { - $showSlash = " / " ; - $ilcTopicDisplay = $ilcTopic ; //add some formatting maybe ? + $showSlash = " / " ; + $ilcTopicDisplay = $ilcTopic ; //add some formatting maybe ? //$csappchk stays unchanged, so does $ilcSeparator @@ -517,7 +542,7 @@ </tr> ' ; - $counter++ ; + $counter++ ; $previousIlcTopic = $ilcTopic ; //to compare with the next row } //end while echo '</table>' ; @@ -525,11 +550,11 @@ echo '</td></tr></table>' ; if ($numPages > 1) { - echo "<br>$navigPages" ; - echo "<br>$prev | $next<br>" ; + echo "<br>$navigPages" ; + echo "<br>$prev | $next<br>" ; } - } + } } /* echo '<br><br> @@ -555,26 +580,26 @@ // echo "qchan = $qchan<br>" ; $qchan_res = n_query($qchan) ; if (mysql_num_rows($qchan_res) == 0) { - echo 'You don\'t have access in any backchans in order to add an ibc' ; + echo 'You don\'t have access in any backchans in order to add an ibc' ; die ; } $backchans = array() ; while ($qchan_row = mysql_fetch_object($qchan_res)) { - array_push($backchans, $qchan_row->channel) ; + array_push($backchans, $qchan_row->channel) ; } // print_r($backchans) ; - if (session_is_registered("backchans")) { - session_unregister("backchans") ; + if (session_is_registered("backchans")) { + session_unregister("backchans") ; } session_register("backchans") ; //to check against while posting $backchan_select = '<select name="backchan">' ; foreach($backchans as $bccurrent) { - $backchan_select = $backchan_select.'<option value='.$bccurrent.'>'.$bccurrent ; + $backchan_select = $backchan_select.'<option value='.$bccurrent.'>'.$bccurrent ; } $backchan_select = $backchan_select.'</select>' ; @@ -593,17 +618,17 @@ <td>Note:</td> <td><textarea cols="65" rows="5" name="msg"></textarea></td> </tr> - <tr> - <td>Backchan:</td> + <tr> + <td>Backchan:</td> <td>'.$backchan_select.'</td> - </tr> + </tr> <tr> <td>Type:</td> <td>'.$pubprv.'</td> <tr> <td colspan="2"> - <input type="reset" name="reset" value="Clear"> - <input type="submit" name="post" value="Post IBC"> + <input type="reset" name="reset" value="Clear"> + <input type="submit" name="post" value="Post IBC"> </td> </tr> @@ -616,7 +641,7 @@ } else { - echo 'You are not logged in. Please go <a href="index.php">here</a> to do so.' ; + echo 'You are not logged in. Please go <a href="index.php">here</a> to do so.' ; } -?> \ No newline at end of file +?> Index: website/index.php diff -u website/index.php:1.12 website/index.php:1.13 --- website/index.php:1.12 Fri Jul 4 12:27:14 2003 +++ website/index.php Mon Dec 1 08:31:04 2003 @@ -100,7 +100,7 @@ // echo "sizeof accchans = ".sizeof($accChans)."<br>" ; while ($i < sizeof($accChans)) { - if ($i == 0) { + if ($i == 0) { $temp = "" ; } else { Index: website/prefs.php diff -u website/prefs.php:1.6 website/prefs.php:1.7 --- website/prefs.php:1.6 Fri Jul 4 12:27:14 2003 +++ website/prefs.php Mon Dec 1 08:31:04 2003 @@ -17,20 +17,20 @@ printMenu($authed_user) ; - echo ' + echo ' <h4>Account Preferences for <b>'.$authed_user.'</b></h4> - ' ; - $qu = "SELECT * from user_table WHERE userid='".$thisuid."' " ; + ' ; + $qu = "SELECT * from user_table WHERE userid='".$thisuid."' " ; $qu_res = n_query($qu) ; if (mysql_num_rows($qu_res) == 0) { - echo 'Impossible. User does not exist? Maybe you were just deleted by the site admin.' ; + echo 'Impossible. User does not exist? Maybe you were just deleted by the site admin.' ; die ; } $qu_obj = mysql_fetch_object($qu_res) ; if (strcmp($action, "editIbcType") == 0) { - if ((newIbcType != 0) && ($newIbcType != 1)) { - echo 'Trying to poison the ibc type ? Go <a href="prefs.php">back</a>' ; + if ((newIbcType != 0) && ($newIbcType != 1)) { + echo 'Trying to poison the ibc type ? Go <a href="prefs.php">back</a>' ; die ; } $qupdibc = "UPDATE user_table SET ibctype='".$newIbcType."' WHERE userid='".$thisuid."' " ; @@ -40,33 +40,31 @@ } if ($qu_obj->ibctype == 0) { - $showIbcRadio = - '<input type="radio" name="newIbcType" value="0" checked>Private - <input type="radio" name="newIbcType" value="1">Public - ' ; - } - elseif ($qu_obj->ibctype == 1) { - $showIbcRadio = - '<input type="radio" name="newIbcType" value="0">Private - <input type="radio" name="newIbcType" value="1" checked>Public - ' ; - } + $showIbcRadio = + '<input type="radio" name="newIbcType" value="0" checked>Private + <input type="radio" name="newIbcType" value="1">Public' ; + } + elseif ($qu_obj->ibctype == 1) { + $showIbcRadio = + '<input type="radio" name="newIbcType" value="0">Private + <input type="radio" name="newIbcType" value="1" checked>Public' ; + } else { - echo 'Your ibctype is something other than 0,1. Strange.' ; + echo 'Your ibctype is something other than 0,1. Strange.' ; $showIbcRadio = "" ; } echo ' <a href="newpass.php">Change your password</a><br><br> - <form method="post" action="prefs.php?action=editIbcType" - '.$showIbcRadio.' + <form method="post" action="prefs.php?action=editIbcType"> + '.$showIbcRadio.' <input type="submit" name="newibc" value="Update default IBC Type"> </form> ' ; } else { - echo 'You are not logged in. Please go <a href="index.php">here</a> to do so.' ; + echo 'You are not logged in. Please go <a href="index.php">here</a> to do so.' ; } echo '</body></html>' ; ?> ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-12-01 16:21:29
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-12-01 16:21:28 UTC Added files: .cvsignore Log message: Updated by TortoiseCVS ---------------------- diff included ---------------------- Index: website/.cvsignore diff -u /dev/null website/.cvsignore:1.1 --- /dev/null Mon Dec 1 08:21:28 2003 +++ website/.cvsignore Mon Dec 1 08:21:17 2003 @@ -0,0 +1 @@ +config.php ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-30 13:11:39
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-30 13:11:38 UTC Modified files: eggbase.tcl Log message: Author: Frederik Vervaet Log message: Part 1 of the renewed login system. (autologin is done). Part 2 .login and manual msg login are for next week. Hopefully once this is done it'll stop the scripts from interacting with other script which do whois'es for god knows what ... ---------------------- diff included ---------------------- Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.31 EggBase/eggbase.tcl:1.32 --- EggBase/eggbase.tcl:1.31 Sat Nov 29 08:06:41 2003 +++ EggBase/eggbase.tcl Sun Nov 30 05:11:28 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.31 2003/11/29 16:06:41 genesis Exp $ +## $Id: eggbase.tcl,v 1.32 2003/11/30 13:11:28 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -94,7 +94,7 @@ ## Our new RAW handler. -bind raw - 354 base:event:raw +bind raw - 354 event:raw ## flags. @@ -300,44 +300,6 @@ } -proc base:event:raw { from numeric data } { - - global settings botnick - - switch $numeric { - - # Here we handle all /who returns which involve %switches. - 354 { - - set eventtype [lindex [split $data] 1] - - # The only value which can be a number 3 digits big is the realname field. Nick and ident require the first digit to be a - # character and not a "number". Realname always has a ":" in front. The other 2 fields which can be a number - # are hopcount and smth else i can't remember ( i think %a which is x username). Either of those should never have 3 digits. - - # Checks : - # 1. Check if it's a realname. - # 2. Check if it's an integer. - # 3. Check if it has 3 digits. - # If all of this chekcs out it should be ok :) - - if { [string index $eventtype 0] == ":" || ![string is integer $eventtype] || [string length $eventtype] != 3 } { - putdebug "Error Invalid Enventtype or Eggdrop native. \($numeric@$eventtype\)" 1 - # Eggdrop does /who's with switches aswell. Since those will be picked up here and will NOT pass the tests. - # Afaik eggdrop does not use %t so we should be safe :). - return 0 - } - - # switch $eventtype - - # Will finish lateron :) - - } - - } - -} - proc login:base:event:numeric { from numeric data } { global settings botnick @@ -860,11 +822,11 @@ putdebug "Updated seen(JOIN) time for $userid to [unixtime]" 1 return 1 } - putdebug "Non logged in user joined $nick $channel" 1 + putdebug "UnAuthed user joined $channel \($nick\) Performing \/WHO\(1\)" 1 if { [ischanset $channel onjoinlogin] } { - putserv "WHOIS $nick" + putserv "WHO $nick %thna,1" } - if { [channel get $channel autovoice] && ![isvoice $nick $channel] } { + if { [channel get $channel autovoice] } { pushmode $channel +v $nick putdebug "Autovoiced $nick on $channel (autovoice chan)" 1 } @@ -1023,6 +985,144 @@ } } +# RAW + +# Raw table : + +# 0 : Not needing any processing. Ignored +# 1 : Autologin /who +# 2 : .login /who + +proc event:raw { from numeric data } { + + global settings botnick + + switch $numeric { + + # Here we handle all /who returns which involve %switches. + 354 { + + + # Eggdrop native /who's have a querytype which is autotranslated to a channel. + # the query type is always displayed first so ... + set data [split $data] + set eventtype [lindex $data 1] + + if { ![string is integer $eventtype] } { + # an invalid eventtype is impossible. If it is not an integer it's a eggdrop native. + # ircu only allows integers and only natives get translated into a channel by eggdrop. + putdebug "Error Eggdrop native WHO. \($numeric@$eventtype\)" 1 + return 0 + } + + switch $eventtype { + + 0 { putdebug "Received WHO event with eventtype 0. Ignoring." 1 } + + 1 { # autologin /who + + #Feds 444 unixGeek.users.undernet.org Bjoern unixGeek + #<botnick> <type> <host> <nick> <username> + + set host [lindex $data 2] + set nick [lindex $data 3] + set xusr [lindex $data 4] + + putdebug "WHO\(1\) reply recevied \: $nick $host $xusr" 1 + # No need for an extra putdebug line since we know $xusr == 0 mean exit! + if { $xusr == "0" } { + return 0 + } + + + # We get the userid of $xusr + set userid [sql "SELECT userid FROM user_table WHERE xhandle='[charfilter $xusr]';"] + if { $userid == "" } { + putdebug "WHO\(1\) Failed login for $nick. Username $xusr not found. \($host\)." 1 + return 0 + } + + # Only active nonsuspended nondeleted users get autologin :) + if { [sql "SELECT suspend FROM user_table WHERE userid='$userid';"] != "0" } { + putdebug "WHO\(1\) UnAuthorised Autologin for $nick $host \($userid\)" 1 + } + + # The userid we have atm is of an ACTIVE users WITH an Xhandle in our DB == $xusr. + + putdebug "WHO\(1\) Successfull login for $nick \( $xusr \)." 1 + + sql "UPDATE user_table SET login_status=1,\ + uhost='[charfilter [getchanhost $nick]]',\ + unick='[charfilter $nick]'\ + WHERE userid='$userid';" + + sql "DELETE FROM next WHERE UserNick='[charfilter $nick]';" + putdebug "WHO\(1\) AutoDelete $nick from .next db after login." 1 + + putnotc $nick "[login:base:getreply:userid $userid AUTH_SUCC] [sql "SELECT handle FROM user_table WHERE userid='$userid';"]" + + set notecount [sql "SELECT count(note_id) FROM notes_table WHERE target_user='$userid' AND status<'2';"] + if { $notecount != 0 } { + putnotc $nick "You have $notecount new note\(s\). Type /MSG feds notes read to read them or .notes read in a channel." + putdebug "WHO\(1\) Sent notecount to $nick on login \($userid\)" 1 + sql "UPDATE notes_table SET status='1' WHERE target_user='$userid' AND status='0';" + putdebug "WHO\(1\) Set status to 1 on all note for $nick \($userid\)" 1 + } + # chanid 1 and 2 are exlucded for admin stuff. + foreach sqldata [sql "SELECT chanid,automode FROM access_table WHERE userid='$userid' AND chanid!='1' AND chanid!='2';"] { + switch -glob -- [lindex $sqldata 1] { + 0 { continue } + {[14]} { + set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] + if { $channel != "" } { + if { [onchan $nick $channel] && ![isvoice $nick $channel] } { + pushmode $channel +v $nick + putdebug "WHO\(1\) AUTOMODED $channel +v $nick" 1 + } + } else { + putnotc $nick "An error has occured. Please contact gen <Ge...@eu...> \( WHO\(1\) illegal channel. \)" + } + } + {[25]} { + set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] + if { $channel != "" } { + if { [onchan $nick $channel] && ![isop $nick $channel] } { + pushmode $channel +o $nick + putdebug "WHO\(1\) AUTOMODED $channel +o $nick" 1 + } + } else { + putnotc $nick "An error has occured. Please contact gen <Ge...@eu...> \( WHO\(1\) illegal channel. \)" + } + } + } + #Close switch + set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] + if { ([lindex $sqldata 1] == "3" || [lindex $sqldata 1] == "4" || [lindex $sqldata 1] == "5") && ![onchan $nick $channel] } { + puthelp "INVITE $nick $channel" + putdebug "WHO\(1\) AUTOINVITED $nick to $channel" 1 + } + } + # Close foreach + sql "UPDATE user_table SET seen='[unixtime]', seen_data='authenticating with me \[$nick![getchanhost $nick]\]' WHERE userid='$userid';" + putdebug "WHO\(1\) Updated seen(LOGIN) time for $userid to [unixtime]" 1 + return 1 + + } + + default { putdebug "$data" 1 } + + } + + # Will finish lateron :) + + } + + + + } + +} + # replace == moretools stuff (made by MC_8) proc replace {{args ""}} { @@ -1118,4 +1218,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.31 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.32 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-29 16:06:52
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-29 16:06:51 UTC Modified files: eggbase.stats.tcl eggbase.tcl Log message: Author: Frederik Vervaet Log message: Moved event:pubm to eggbase.tcl where all general event handlers belong. ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.9 EggBase/eggbase.stats.tcl:1.10 --- EggBase/eggbase.stats.tcl:1.9 Fri Nov 28 17:28:58 2003 +++ EggBase/eggbase.stats.tcl Sat Nov 29 08:06:41 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.9 2003/11/29 01:28:58 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.10 2003/11/29 16:06:41 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -149,63 +149,7 @@ } - -## Charcount / Linecount stuff. - - -# REDONE -proc event:pubm { nick host handle channel text } { - - global settings - - # Check if the channel has stats_charcount enabled and if user is logged in. - # We also do not report errors in the following few checks to putdebug. (Flood issues) - # Minimal access to be included in the stats is 1. - # We do this to allow chanowners to exclude people from stats. - # Also we will need to allow chanowners to exclude people from stats that have level +1 - - if { ![isloggedin2 $nick $channel $host 0] } { return 0 } - - # Ok now we know the user is logged in. - - set chanid [sql:getchanid [charfilter $channel]] - set userid [login:base:nick2userid2 $nick $host] - - # Update general stuff. - sql "UPDATE user_table SET last_spoke='[unixtime]' WHERE userid='$userid';" - - # Update charcount. - if { [channel get $channel stats_charcount] } { - # Check if the user is allready in the db. - - if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';"] == "0" } { - # User does not exist for type charcount. - sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='charcount';" - putdebug "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 - } - - if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';"] == "0" } { - # User does not exist for type linecount. - sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='linecount';" - putdebug "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 - } - - # User exists :) - sql "UPDATE stats_table SET value=value+[string length $text] WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';" - sql "UPDATE stats_table SET value=value+1 WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';" - # Updated :) - - } - ## Returning - - if { [channel get $channel stats_log] } { - - sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',data='$text',timestamp='[unixtime]';" - putdebug "Recorded pubm \: $nick@$host on $channel" 1 - - } - -} +# event:pubm moved to eggbase.tcl proc cmds:pub:charcount { nick host handle channel args } { @@ -371,6 +315,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.9 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.10 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.30 EggBase/eggbase.tcl:1.31 --- EggBase/eggbase.tcl:1.30 Sat Nov 29 07:09:06 2003 +++ EggBase/eggbase.tcl Sat Nov 29 08:06:41 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.30 2003/11/29 15:09:06 genesis Exp $ +## $Id: eggbase.tcl,v 1.31 2003/11/29 16:06:41 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -967,6 +967,63 @@ ## Various stuff. + + +## event handlers. + + +# PUBM + +proc event:pubm { nick host handle channel text } { + + global settings + + # Check if the channel has stats_charcount enabled and if user is logged in. + # We also do not report errors in the following few checks to putdebug. (Flood issues) + # Minimal access to be included in the stats is 1. + # We do this to allow chanowners to exclude people from stats. + # Also we will need to allow chanowners to exclude people from stats that have level +1 + + set chanid [sql:getchanid [charfilter $channel]] + + # Part for logged in users. + + if { [isloggedin2 $nick $channel $host 0] } { + + # Ok now we know the user is logged in. + + set userid [login:base:nick2userid2 $nick $host] + + # Update general stuff. + sql "UPDATE user_table SET last_spoke='[unixtime]' WHERE userid='$userid';" + + # Update charcount. + if { [channel get $channel stats_charcount] } { + # Check if the user is allready in the db. + if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';"] == "0" } { + # User does not exist for type charcount. + sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='charcount';" + putdebug "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 + } + if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';"] == "0" } { + # User does not exist for type linecount. + sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='linecount';" + putdebug "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 + } + # User exists :) + sql "UPDATE stats_table SET value=value+[string length $text] WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';" + sql "UPDATE stats_table SET value=value+1 WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';" + # Updated :) + } + ## Returning + if { [channel get $channel stats_log] } { + sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',data='$text',timestamp='[unixtime]';" + putdebug "Recorded pubm \: $nick@$host on $channel" 1 + } + } +} + + # replace == moretools stuff (made by MC_8) proc replace {{args ""}} { set switches "" @@ -1061,4 +1118,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.30 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.31 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-29 15:09:17
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-29 15:09:16 UTC Modified files: eggbase.tcl Log message: Author: Frederik Vervaet Log message: Corrected some logic faults in nickchange proc. Also redid islogged in and made it a bit more secure ---------------------- diff included ---------------------- Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.29 EggBase/eggbase.tcl:1.30 --- EggBase/eggbase.tcl:1.29 Sat Nov 29 06:35:18 2003 +++ EggBase/eggbase.tcl Sat Nov 29 07:09:06 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.29 2003/11/29 14:35:18 genesis Exp $ +## $Id: eggbase.tcl,v 1.30 2003/11/29 15:09:06 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -490,25 +490,28 @@ # The following proc keeps the db updated with the nickchanges of users proc login:base:event:nickchange { oldnick host handle chan newnick } { - # get userid - set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $oldnick]';"] - - # First we set to 0 whoever HAD that nick cause they obviously don't have it anymore - # which means they aren't logged in anymore cause someone else has the last nick the bot - # saw them with. This will not logout the user doing the nickchange cause he still has - # $oldnick as his unick. - if { $userid == "" } { return 0 } - - ## User is not logged in so no need to update. if {![isloggedin $oldnick $chan $host 0] } { putdebug "NON auth user changed nick. No update needed" 1 return 0 } - sql "UPDATE user_table SET unick='[charfilter $newnick]' WHERE userid='$userid';" - sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" - sql "UPDATE user_table SET seen_data='changing nick to \[$newnick!$host\]' WHERE userid='$userid';" + # If there is still anyone in the DB with unick $newnick then we need to clear the info from that user. + # Normally this happens upon logout but you never know :) + # We also do this before we get the userid. if there is an error with that, + # whoever has newnick as unick still needs to be cleared. + if { [sql "SELECT * FROM user_table WHERE unick='[charfilter $newnick]';"] != "" } { + sql "UPDATE user_table SET unick='0',uhost='0',login_status='0' WHERE unick='[charfilter $newnick]';" + putlog "Error 11145 Occurred." + putdebug "WARNING WARNING Error 11145! Reset all accounts with unick $newnick" 1 + } + + # get userid + set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $oldnick]' AND uhost='[charfilter $host]';"] + # This should not happen. + if { $userid == "" } { putlog "Error 11146" 1 ; return 0 } + + sql "UPDATE user_table SET unick='[charfilter $newnick]', seen='[unixtime]', seen_data='changing nick to \[$newnick!$host\]' WHERE userid='$userid';" putdebug "DB update \: Nick change $oldnick \=\> $newnick" 1 putdebug "Updated seen(NICKCHANGE) time for $userid to [unixtime]" 1 @@ -522,33 +525,24 @@ ## IRC for this proc to have any meaning. proc isloggedin { nick channel host sendnotice } { - global settings - ## This counters the multiple username problem :) + global settings - ## Once we are sure part/kick/quit also set all unick/uhost values to NULL this can be removed. + # Log out everyone using the bogus unick/uhost if { [sql "SELECT count(userid) FROM user_table WHERE unick='[charfilter $nick]' AND uhost='[charfilter $host]' ;"] > 1 } { - putdebug "SAME USERNAME FOUND TWICE!" 1 - putlog "SAME USERNAME FOUND TWICE!" - - foreach userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]';"] { - sql "UPDATE user_table SET unick='' WHERE userid='$userid';" - sql "UPDATE user_table SET login_status='0' WHERE userid='$userid';" - putdebug "SET Unick loginstatus to 0 for $userid \(double unicks\)" 1 + putdebug "SAME USERNAME FOUND TWICE!!" 1 + # Everyone using the bogus nick and host get logged out! + foreach userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]' OR uhost='[charfilter $host]';"] { + sql "UPDATE user_table SET unick='0' , login_status='0' WHERE userid='$userid';" + putdebug "SET Unick loginstatus to 0 for $userid \(double unicks/uhosts\)" 1 } - putnotc $nick "An internal database error has occured and you have been logged out as a result. Please contact f.v...@da..." + putnotc $nick "An internal database error has occured and your settings have been reset as a result. If you are unable to login again please contact f.v...@da..." return 0 } - set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]'\ - AND uhost='[charfilter $host]'\ - AND login_status='1';"] - - # We need to add a check here so it return 0 if it gets multiple ids - # Add something to log. GRAVE ERROR. - # We do not need to check if the channel is in the database. Cause if it is not - # it will be created. This check used to be done here. + set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]' AND uhost='[charfilter $host]' AND login_status='1';"] + # Userid is always unique thx to the bogus unick/uhost check. if { $userid == "" } { if { $sendnotice == "1" } { putdebug "Sent NOT_LOGGEDIN notice to $nick $host $sendnotice" 1 @@ -878,7 +872,7 @@ } proc login:base:event:part { nick host handle channel args } { - # We call the timer and extra proc + # We call the timer and extra proc otherwise onchan always returns YES. # No need to call charfilter for $args (since eggdrop makes it a list and escaped when necessary) set tempvar [utimer 2 [list login:base:event:part2 $nick $host * $channel $args]] putdebug "Timer $tempvar : $nick $host * $channel $args" 1 @@ -1067,4 +1061,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.29 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.30 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-29 14:35:31
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-29 14:35:29 UTC Modified files: eggbase.tcl Log message: Author: Frederik Vervaet Log message: No use in doing onjoin checks if it's ME who's doing the joining. ---------------------- diff included ---------------------- Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.28 EggBase/eggbase.tcl:1.29 --- EggBase/eggbase.tcl:1.28 Sat Nov 29 05:36:38 2003 +++ EggBase/eggbase.tcl Sat Nov 29 06:35:18 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.28 2003/11/29 13:36:38 genesis Exp $ +## $Id: eggbase.tcl,v 1.29 2003/11/29 14:35:18 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -322,7 +322,7 @@ # If all of this chekcs out it should be ok :) if { [string index $eventtype 0] == ":" || ![string is integer $eventtype] || [string length $eventtype] != 3 } { - putdebug "Error Invalid Enventtype or Eggdrop native. \($eventtype\)" 1 + putdebug "Error Invalid Enventtype or Eggdrop native. \($numeric@$eventtype\)" 1 # Eggdrop does /who's with switches aswell. Since those will be picked up here and will NOT pass the tests. # Afaik eggdrop does not use %t so we should be safe :). return 0 @@ -833,7 +833,12 @@ } proc login:base:event:join { nick host handle channel } { + global botnick putdebug "JOIN $nick $host $handle $channel" 1 + if { [string tolower $nick] == [string tolower $botnick] } { + putdebug "I joined a channel. Skipping all join tests." 1 + return 1 + } if { [isloggedin $nick $channel $host 0] } { set chanid [sql:getchanid [charfilter $channel]] set userid [login:base:nick2userid $nick $host] @@ -1062,4 +1067,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.28 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.29 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-29 13:36:50
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-29 13:36:49 UTC Modified files: eggbase.tcl Log message: Author: Frederik Vervaet Log message: Removed duplicate set home ---------------------- diff included ---------------------- Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.27 EggBase/eggbase.tcl:1.28 --- EggBase/eggbase.tcl:1.27 Fri Nov 28 17:28:58 2003 +++ EggBase/eggbase.tcl Sat Nov 29 05:36:38 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.27 2003/11/29 01:28:58 genesis Exp $ +## $Id: eggbase.tcl,v 1.28 2003/11/29 13:36:38 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -943,8 +943,6 @@ bind pub - .verify login:base:pub:verify -set home "#feds" - proc login:base:pub:verify { nick host handle channel var } { global settings if { ![isloggedin $nick $channel $host 1] } { @@ -1064,4 +1062,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.27 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.28 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-29 01:29:10
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-29 01:29:08 UTC Modified files: eggbase.stats.tcl eggbase.tcl Log message: Author: Frederik Vervaet Log message: Various bugfixes Also updated credits on previous commit (forgot to mention that) Started on "wishlist". CLogging is almost done. Left to do : all non text events such as kicks/quits/ etc proc event:pubm redone. ---------------------- diff included ---------------------- Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.8 EggBase/eggbase.stats.tcl:1.9 --- EggBase/eggbase.stats.tcl:1.8 Fri Nov 28 15:51:51 2003 +++ EggBase/eggbase.stats.tcl Fri Nov 28 17:28:58 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.8 2003/11/28 23:51:51 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.9 2003/11/29 01:28:58 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -55,12 +55,13 @@ # Event binds -bind pubm - * event:pubm:charcount +bind pubm - * event:pubm bind wall - * event:wall:wallusers ## Channel flags setudef flag stats_charcount +setudef flag stats_log ## Code (do not touch unless you know what you are doing!) @@ -152,64 +153,57 @@ ## Charcount / Linecount stuff. +# REDONE +proc event:pubm { nick host handle channel text } { -proc event:pubm:charcount { nick host handle channel text } { - - global settings - - ## Check if the channel has stats_charcount enabled and if user is logged in. - ## We also do not report errors in the following few checks to putdebug. (Flood issues) - ## Minimal access to be included in the stats is 1. - ## We do this to allow chanowners to exclude people from stats. - ## Also we will need to allow chanowners to exclude people from stats that have level +1 - - if { ![isloggedin2 $nick $channel $host 0] } { return 0 } - - ## Ok now we know the user is logged in. + global settings - set chanid [sql:getchanid [charfilter $channel]] - set userid [login:base:nick2userid2 $nick $host] + # Check if the channel has stats_charcount enabled and if user is logged in. + # We also do not report errors in the following few checks to putdebug. (Flood issues) + # Minimal access to be included in the stats is 1. + # We do this to allow chanowners to exclude people from stats. + # Also we will need to allow chanowners to exclude people from stats that have level +1 - sql "UPDATE user_table SET last_spoke='[unixtime]' WHERE userid='$userid';" + if { ![isloggedin2 $nick $channel $host 0] } { return 0 } - if { ![channel get $channel stats_charcount] } { return 0 } + # Ok now we know the user is logged in. - ## Commented out untill we find a way to prevent it flooding. - ##![login:base:checkaccess:user:cmd $nick $channel $host 0 CHARCOUNT] - + set chanid [sql:getchanid [charfilter $channel]] + set userid [login:base:nick2userid2 $nick $host] - ## Check if the user is allready in the db. + # Update general stuff. + sql "UPDATE user_table SET last_spoke='[unixtime]' WHERE userid='$userid';" - if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';"] == "0" } { + # Update charcount. + if { [channel get $channel stats_charcount] } { + # Check if the user is allready in the db. - ## User does not exist for type charcount. - + if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';"] == "0" } { + # User does not exist for type charcount. sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='charcount';" + putdebug "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 + } - putdebug2 "Inserted $nick\($userid\) into charcount db for $channel\($chanid\)" 1 - - } - - if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';"] == "0" } { - - ## User does not exist for type linecount. - + if { [sql "SELECT count(*) FROM stats_table WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';"] == "0" } { + # User does not exist for type linecount. sql "INSERT INTO stats_table SET chanid='$chanid',userid='$userid',starttime='[unixtime]',type='linecount';" + putdebug "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 + } - putdebug2 "Inserted $nick\($userid\) into linecount db for $channel\($chanid\)" 1 - - } + # User exists :) + sql "UPDATE stats_table SET value=value+[string length $text] WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';" + sql "UPDATE stats_table SET value=value+1 WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';" + # Updated :) + } + ## Returning + if { [channel get $channel stats_log] } { + + sql "INSERT INTO log_table SET chan_id='$chanid',user_id='$userid',type='1',data='$text',timestamp='[unixtime]';" + putdebug "Recorded pubm \: $nick@$host on $channel" 1 - - ## User exists :) - - sql "UPDATE stats_table SET value=value+[string length $text] WHERE chanid='$chanid' AND userid='$userid' AND type='charcount';" - sql "UPDATE stats_table SET value=value+1 WHERE chanid='$chanid' AND userid='$userid' AND type='linecount';" - ## Updated :) - - ## Returning + } } @@ -217,10 +211,6 @@ global settings - ## We allow people present in our db to be included in the counting but they cannot check their status. - ## UNLESS they have chanaccess. People without chanaccess 1 should not be counted. - ## Will fix that soon. - if { ![channel get $channel stats_charcount] } { putnotc $nick "Command Disabled in this channel." @@ -381,6 +371,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.8 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.9 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.26 EggBase/eggbase.tcl:1.27 --- EggBase/eggbase.tcl:1.26 Fri Nov 28 15:51:51 2003 +++ EggBase/eggbase.tcl Fri Nov 28 17:28:58 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.26 2003/11/28 23:51:51 genesis Exp $ +## $Id: eggbase.tcl,v 1.27 2003/11/29 01:28:58 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -560,7 +560,7 @@ return 1 } - + proc login:base:checkaccess:user:cmd { nick channel host sendnotice cmd } { global settings @@ -617,6 +617,61 @@ } return 0 } +proc login:base:checkaccess:userid:cmd { userid channel host sendnotice cmd } { + global settings + + set chanid [sql:getchanid [charfilter $channel]] + + if { $chanid == "" } { + putnotc $nick "Illegal channel \:$channel. $settings(admin)" + return 0 + } + if { $userid == "" } { + if { $sendnotice == "1" } { + putnotc $nick "$nick is not in my DB. $settings(admin)" + } + putdebug "A nick not in the db got called here. Possible join ?" 1 + return 0 + } + + ## GLOBAL suspend CHECK. + ## we use != 0 for the remote chance the lock command "forgot" to set status to 0 or incase I forgot manually. + + if { [sql "SELECT suspend FROM user_table WHERE userid='$userid';"] != "0" } { + if { $sendnotice == "1" } { + putnotc $nick "Your BotHandle has been suspended. Contact $settings(admin)" + } + putdebug "FAILIURE \: BotHandle suspended $nick $userid" 1 + return 0 + } + + ## Channel suspend check. (todo) + set cmdlevel [join [sql "SELECT user,oper,admin FROM cmd_table WHERE command='$cmd';"]] + if { $cmdlevel == "" } { + putnotc $nick "Illegal command \: $cmd. $settings(admin)" + return 0 + } + set usrlevel [sql "SELECT level FROM access_table WHERE userid='$userid' AND chanid='$chanid';"] + if { ([lindex $cmdlevel 0] != "0" ) && ($usrlevel != "" ) && ($usrlevel >= [lindex $cmdlevel 0]) } { + return 1 + } + + set usrlevel [sql "SELECT level FROM access_table WHERE userid='$userid' AND chanid='2';"] + if { ([lindex $cmdlevel 1] != "0" ) && ($usrlevel != "" ) && ( $usrlevel >= [lindex $cmdlevel 1] )} { + return 2 + } + + set usrlevel [sql "SELECT level FROM access_table WHERE userid='$userid' AND chanid='1';"] + if { ([lindex $cmdlevel 2] != "0" ) && ($usrlevel != "" ) && ($usrlevel >= [lindex $cmdlevel 2]) } { + return 3 + } + + if { $sendnotice == "1" } { + putnotc $nick "[login:base:getreply:userid $userid NO_ACCESS]" + putdebug "SENT No_ACCESS notice to $nick $channel $host" 1 + } + return 0 +} proc login:base:dcc:whois { handle idx dbhandle } { # <Feds> HANDLE PASS NOTES FLAGS LAST @@ -1009,4 +1064,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.26 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.27 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-11-28 23:52:04
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-28 23:52:01 UTC Modified files: eggbase.admincommands.tcl eggbase.class.tcl eggbase.install.tcl eggbase.language.tcl eggbase.stats.tcl eggbase.stricthelp.tcl eggbase.tcl eggbase.usercommands.tcl functions.tcl Log message: Author: Frederik Vervaet Log message: Finally got around to switching debug procs. This one determines the calling proc on it's own. Therefor we no longer need to start each proc by defining it's name. Also allows us to eliminate 1 of "calling vars" ie : $procname. ---------------------- diff included ---------------------- Index: EggBase/eggbase.admincommands.tcl diff -u EggBase/eggbase.admincommands.tcl:1.5 EggBase/eggbase.admincommands.tcl:1.6 --- EggBase/eggbase.admincommands.tcl:1.5 Fri May 9 00:51:47 2003 +++ EggBase/eggbase.admincommands.tcl Fri Nov 28 15:51:51 2003 @@ -16,11 +16,9 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## +## ## ########################################################################## ## ## ## This tcl does the following : ## @@ -174,7 +172,7 @@ proc login:commands:pub:wordcount { nick host handle channel var } { - if { ![isloggedin $nick $channel $host 1] } { putdebug $procname "nick tried to access wordcount stats being logged in." 1 + if { ![isloggedin $nick $channel $host 1] } { putdebug "nick tried to access wordcount stats being logged in." 1 return 0 } if { ![login:base:checkaccess:user:cmd $nick $channel $host 1 wordcount] } { return 0 } @@ -189,4 +187,4 @@ } -putlog "LOGIN.ADMINOMMANDS.TCL \$Revision: 1.5 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "LOGIN.ADMINOMMANDS.TCL \$Revision: 1.6 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.class.tcl diff -u EggBase/eggbase.class.tcl:1.8 EggBase/eggbase.class.tcl:1.9 --- EggBase/eggbase.class.tcl:1.8 Fri May 9 00:51:47 2003 +++ EggBase/eggbase.class.tcl Fri Nov 28 15:51:51 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.class.tcl,v 1.8 2003/05/09 07:51:47 genesis Exp $ +## $Id: eggbase.class.tcl,v 1.9 2003/11/28 23:51:51 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -18,11 +18,9 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## +## ## ########################################################################## ## ## ## This tcl does the following : ## Index: EggBase/eggbase.install.tcl diff -u EggBase/eggbase.install.tcl:1.2 EggBase/eggbase.install.tcl:1.3 --- EggBase/eggbase.install.tcl:1.2 Mon Mar 3 10:36:03 2003 +++ EggBase/eggbase.install.tcl Fri Nov 28 15:51:51 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.install.tcl,v 1.2 2003/03/03 18:36:03 genesis Exp $ +## $Id: eggbase.install.tcl,v 1.3 2003/11/28 23:51:51 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -18,10 +18,8 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## ## ## ########################################################################## ## ## Index: EggBase/eggbase.language.tcl diff -u EggBase/eggbase.language.tcl:1.2 EggBase/eggbase.language.tcl:1.3 --- EggBase/eggbase.language.tcl:1.2 Thu Nov 28 12:12:13 2002 +++ EggBase/eggbase.language.tcl Fri Nov 28 15:51:51 2003 @@ -16,7 +16,6 @@ proc install_english { } { - set procname "install_english" ## First we cleanout the db. sql "DELETE FROM language_table" @@ -76,7 +75,7 @@ - putdebug $procname "Installed the English Note Pack." 1 + putdebug "Installed the English Note Pack." 1 ## Dutch set @@ -131,7 +130,7 @@ sql "INSERT INTO language_table SET langid='$langid', replytype='KICKED_BY2',\ data='gekicked door';" - putdebug $procname "Installed the Dutch Note Pack." 1 + putdebug "Installed the Dutch Note Pack." 1 ## Norwegian set @@ -162,7 +161,7 @@ sql "INSERT INTO language_table SET langid='$langid', replytype='NOT_LOGGEDIN',\ data='';" - putdebug $procname "Installed the Norwegian Note Pack. " 1 + putdebug "Installed the Norwegian Note Pack. " 1 ## French set @@ -193,7 +192,7 @@ sql "INSERT INTO language_table SET langid='$langid', replytype='NOT_LOGGEDIN',\ data='';" - putdebug $procname "Installed the French Note Pack." 1 + putdebug "Installed the French Note Pack." 1 ## Greek set @@ -224,7 +223,7 @@ sql "INSERT INTO language_table SET langid='$langid', replytype='NOT_LOGGEDIN',\ data='Den ise anagnorismenos. Parakalo kane login.';" - putdebug $procname "Installed the Greek Note Pack." 1 + putdebug "Installed the Greek Note Pack." 1 ## Danish set @@ -255,7 +254,7 @@ sql "INSERT INTO language_table SET langid='$langid', replytype='NOT_LOGGEDIN',\ data='Du er ikke logget ind. Log venligst ind.';" - putdebug $procname "Installed the Danish Note Pack." 1 + putdebug "Installed the Danish Note Pack." 1 } Index: EggBase/eggbase.stats.tcl diff -u EggBase/eggbase.stats.tcl:1.7 EggBase/eggbase.stats.tcl:1.8 --- EggBase/eggbase.stats.tcl:1.7 Thu May 8 05:00:33 2003 +++ EggBase/eggbase.stats.tcl Fri Nov 28 15:51:51 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stats.tcl,v 1.7 2003/05/08 12:00:33 genesis Exp $ +## $Id: eggbase.stats.tcl,v 1.8 2003/11/28 23:51:51 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -18,11 +18,9 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## +## ## ########################################################################## ## ## ## This tcl does the following : ## @@ -70,15 +68,13 @@ global stats - set procname "sql:add_history" - if { $stats != "1" } { return 0 } set userid [sql:getuserid $user] set chanid [sql:getchanid $channel] set cmdid [sql:getcmdid $command] - putdebug $procname "Added chanid='$chanid', userid='$userid', cmdid='$cmdid',date='[unixtime]'" 1 + putdebug "Added chanid='$chanid', userid='$userid', cmdid='$cmdid',date='[unixtime]'" 1 sql "INSERT INTO history SET chanid='$chanid', userid='$userid', cmdid='$cmdid',date='[unixtime]'" unset cmdid userid chanid @@ -88,10 +84,9 @@ proc cmds:pub:stats { nick host handle channel args } { global uptime server-online - set procname "login:st:cmd:stats" if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick ADMIN $host 1 stats] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } @@ -118,7 +113,7 @@ proc cmds:pub:notestats { nick host handle channel args } { if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick ADMIN $host 1 notestats] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } set unread [sql "SELECT count(note_id) FROM notes_table WHERE status='0';"] @@ -318,22 +313,19 @@ proc isloggedin2 { nick channel host sendnotice } { global settings - set procname "isloggedin" ## This counters the multiple username problem :) ## Once we are sure part/kick/quit also set all unick/uhost values to NULL this can be removed. if { [sql "SELECT count(userid) FROM user_table WHERE unick='[charfilter $nick]' AND uhost='[charfilter $host]' ;"] > 1 } { - #putdebug $procname "SAME USERNAME FOUND TWICE!" 1 - putlog "$procname SAME USERNAME FOUND TWICE!" + #putdebug "SAME USERNAME FOUND TWICE!" 1 foreach userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]';"] { sql "UPDATE user_table SET unick='' WHERE userid='$userid';" sql "UPDATE user_table SET login_status='0' WHERE userid='$userid';" - #putdebug $procname "SET Unick loginstatus to 0 for $userid \(double unicks\)" 1 - putlog "$procname SET Unick loginstatus to 0 for $userid \(double unicks\)" + #putdebug "SET Unick loginstatus to 0 for $userid \(double unicks\)" 1 } putnotc $nick "An internal database error has occured. Please type .login to reauth." @@ -355,14 +347,14 @@ if { $userid == "" } { if { $sendnotice == "1" } { - #putdebug $procname "Sent NOT_LOGGEDIN notice to $nick $host $sendnotice" 1 + #putdebug "Sent NOT_LOGGEDIN notice to $nick $host $sendnotice" 1 putnotc $nick "[login:base:getreply:userid 0 NOT_LOGGEDIN]" } return 0 } - #putdebug $procname "$nick on \( $host \) IS LOGGED IN. Sendnotice \: $sendnotice" 1 + #putdebug "$nick on \( $host \) IS LOGGED IN. Sendnotice \: $sendnotice" 1 return 1 } @@ -370,20 +362,18 @@ proc login:base:nick2userid2 { nick host } { - set procname "nick2userid" - set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]'\ AND uhost='[charfilter $host]'\ AND login_status='1';"] if { $userid != "" } { - #putdebug $procname "[charfilter $nick] \-\> $userid" 1 + #putdebug "[charfilter $nick] \-\> $userid" 1 return $userid } else { - #putdebug $procname "Nick2userid failed on $nick $host" 1 + #putdebug "Nick2userid failed on $nick $host" 1 } @@ -391,6 +381,6 @@ } -putlog "EGGBASE.STATS.TCL \$Revision: 1.7 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STATS.TCL \$Revision: 1.8 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.stricthelp.tcl diff -u EggBase/eggbase.stricthelp.tcl:1.12 EggBase/eggbase.stricthelp.tcl:1.13 --- EggBase/eggbase.stricthelp.tcl:1.12 Fri May 9 00:51:47 2003 +++ EggBase/eggbase.stricthelp.tcl Fri Nov 28 15:51:51 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.stricthelp.tcl,v 1.12 2003/05/09 07:51:47 genesis Exp $ +## $Id: eggbase.stricthelp.tcl,v 1.13 2003/11/28 23:51:51 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -18,10 +18,8 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## ## ## ########################################################################## ## ## @@ -104,27 +102,26 @@ proc login:stricthelp:event:join {nick host handle channel} { global botnick home shortnick owner settings sh_botjoin - set procname "cmd:event:join" if { [ischanset $channel stricthelp] } { set chanid [sql:getchanid [charfilter $channel]] if { $chanid == "0" } { putlog "An error has occured \: Illegal chan given to getchanid \(SH-JOIN\)" ; return 0 } if { [string tolower $nick] == [string tolower $botnick] } { set sh_botjoin([string tolower $channel]) "1" - putdebug $procname "I have joined a channel with stricthelp and set botjoin to 1." 1 + putdebug "I have joined a channel with stricthelp and set botjoin to 1." 1 # Since this is me (bot) joining no need to go through the rest return 0 } if { ![botisop $channel] && ( [string tolower $nick] != [string tolower $botnick] ) } { - putdebug $procname "I am NOT opped in $channel" 1 + putdebug "I am NOT opped in $channel" 1 return 0 } if { [isloggedin $nick $channel $host 0] && [login:base:checkaccess:user:cmd $nick $channel $host 0 VOID] } { - putdebug $procname "Authed user WITH channel access \( 25+ \) has joined." 1 + putdebug "Authed user WITH channel access \( 25+ \) has joined." 1 ## IF in silencelist REMOVE! ((todo)) return 1 } - putdebug $procname "Normal user joined $channel with SH. \( $nick \)" 1 + putdebug "Normal user joined $channel with SH. \( $nick \)" 1 # We are now sure this person is not a STAFF member so we commence the normal checks. # Silence checks. @@ -139,12 +136,12 @@ # We add the user even if he is silenced for the NICKCHANGE proc. if { [sql "select UserNick from next where UserNick='[charfilter $nick]';"] == "" } { sql "INSERT INTO next SET chanid='$chanid', Helperid='0',TimeStamp='[unixtime]', UserNick='[charfilter $nick]',Status='2';" - putdebug $procname "SILENCED USER JOINED. Created next db entry for $nick with status 2" 1 + putdebug "SILENCED USER JOINED. Created next db entry for $nick with status 2" 1 return 1 } else { sql "UPDATE next SET chanid='[sql:getchanid [charfilter $channel]]', Helperid='0',TimeStamp='[unixtime]',\ UserNick='[charfilter $nick]',Status='2' WHERE UserNick='[charfilter $nick]';" - putdebug $procname "SILENCED USER JOINED. Updated next db entry for $nick with status 2" 1 + putdebug "SILENCED USER JOINED. Updated next db entry for $nick with status 2" 1 return 1 } } @@ -165,7 +162,7 @@ # This should never be 0. People get added ABOVE this part so it should always be 1 putnotc $nick "Please wait for your turn as we are busy right now. You will be NOTICED automatically by me when we finish\ with the current guests. Please do \002NOT\002 msg +v\/+o. You are number $counter in line. Thank You." - putdebug $procname "Sent Stricthelp notice to $nick on $channel" 1 + putdebug "Sent Stricthelp notice to $nick on $channel" 1 # Stats. } } @@ -173,9 +170,8 @@ proc login:stricthelp:event:nick_change {nick host hand chan rest} { global botnick owner settings # check:sql 0 - set procname "cmd:event:nick_chng" if {[string tolower $nick] == [string tolower $botnick] } { - putdebug $procname "I have changed nick on $chan. This should not happen" 1 + putdebug "I have changed nick on $chan. This should not happen" 1 } # First we check if the old nick is present. IF not we sprout an error. @@ -184,10 +180,10 @@ # we first need to delete the existing entry. if { [sql "select usernick from next where usernick='[charfilter $rest]';"] != "" } { sql "DELETE FROM next WHERE usernick='[charfilter $rest]';" - putdebug $procname "Nickcollision from $nick \=\> $rest. Removed $rest" 1 + putdebug "Nickcollision from $nick \=\> $rest. Removed $rest" 1 } sql "UPDATE next SET usernick='[charfilter $rest]' WHERE usernick='[charfilter $nick]'"; - putdebug $procname "Nick Change $nick \=\> $rest" 1 + putdebug "Nick Change $nick \=\> $rest" 1 return 1 } } @@ -196,23 +192,22 @@ proc login:stricthelp:commands:next { nick host handle channel args } { global sh_botjoin settings - set procname "sh:cmd:next" set chanid [sql:getchanid $channel] if { [ischanset $channel stricthelp] } { if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 next] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } if { [info exists sh_botjoin([string tolower $channel])] } { - putdebug $procname "$nick did .next with botjoin set to 1. Proceeding with foreach." 1 + putdebug "$nick did .next with botjoin set to 1. Proceeding with foreach." 1 foreach victim [chanlist $channel] { # Exclude people that are voiced , opped , ( Logged in AND HAVE access ). if { [isvoice $victim $channel] || [isop $victim $channel] || ( [isloggedin $victim $channel [getchanhost $victim] 0]\ && [login:base:checkaccess:user:cmd $victim $channel [getchanhost $victim] 0 VOID] ) } { - putdebug $procname "I did NOT add $victim into sh db for $channel \(After botjoin\) +v+o+AC." 1 + putdebug "I did NOT add $victim into sh db for $channel \(After botjoin\) +v+o+AC." 1 } else { sql:addusertonext $victim $channel - putdebug $procname "Added $victim into sh db for $channel \(AFTER botjoin\) \(not voiced,opped,NO ACCESS\)." 1 + putdebug "Added $victim into sh db for $channel \(AFTER botjoin\) \(not voiced,opped,NO ACCESS\)." 1 } } unset sh_botjoin([string tolower $channel]) @@ -228,16 +223,16 @@ } if { ![onchan $target $channel] } { incr counter - if { $counter > 100 } { putdebug $procname "COUNTER error" 1 ; return 0 } - putdebug $procname "$target is NOT in $channel. Removing" 1 + if { $counter > 100 } { putdebug "COUNTER error" 1 ; return 0 } + putdebug "$target is NOT in $channel. Removing" 1 sql "DELETE FROM next WHERE usernick='[charfilter $target]' AND chanid='$chanid';" continue } if { [isop $target $channel] } { incr counter - if { $counter > 100 } { putdebug $procname "COUNTER error" 1; return 0 } + if { $counter > 100 } { putdebug "COUNTER error" 1; return 0 } sql "DELETE FROM next WHERE usernick='[charfilter $target]' AND chanid='$chanid';" - putdebug $procname "Deleted $target from next db because he is OPPED" 1 + putdebug "Deleted $target from next db because he is OPPED" 1 continue } @@ -245,9 +240,9 @@ # In either case the .next code should have updated it to 1 when they got voiced. Since this did NOT ## happen we DELETE if { [isvoice $target $channel] } { incr counter - if { $counter > 100 } { putdebug $procname "COUNTER error" 1; return 0 } + if { $counter > 100 } { putdebug "COUNTER error" 1; return 0 } sql "DELETE FROM next WHERE usernick='[charfilter $target]' AND chanid='$chanid';" - putdebug $procname "Deleted $target from next because he is VOICED" 1 + putdebug "Deleted $target from next because he is VOICED" 1 continue } @@ -256,21 +251,21 @@ [login:base:checkaccess:user:cmd $target $channel [getchanhost $target] 0 VOID] } { incr counter - if { $counter > 100 } { putdebug $procname "COUNTER error" 1 ; return 0 } + if { $counter > 100 } { putdebug "COUNTER error" 1 ; return 0 } sql "DELETE FROM next WHERE usernick='[charfilter $target]' AND chanid='$chanid';" pushmode $channel +v $target - putdebug $procname "Deleted and voiced $target from next db because he is loggedin and has access on $channel." 1 + putdebug "Deleted and voiced $target from next db because he is loggedin and has access on $channel." 1 continue } set found 1 incr counter - if { $counter > 100 } { putdebug $procname "COUNTER error" 1 ; return 0 } + if { $counter > 100 } { putdebug "COUNTER error" 1 ; return 0 } } unset found sql "UPDATE next SET status='1', HelperID='[sql:getuserid [charfilter $nick]]'\ WHERE usernick='[charfilter $target]';" - putdebug $procname "Updated status/helperid for $target to 1/[sql:getuserid [charfilter $nick]]" 1 + putdebug "Updated status/helperid for $target to 1/[sql:getuserid [charfilter $nick]]" 1 # Send Stricthelp Notices putnotc $nick "$settings(stricthelp,prefix) $target is next after being idle [getchanidle $target $channel] minutes. Joined [ctime [getchanjoin $target $channel]]" @@ -285,11 +280,10 @@ proc login:stricthelp:commands:helped { nick host handle channel args } { global settings - set procname "sh:cmd:helped" if {[ischanset $channel stricthelp] } { set chanid [sql:getchanid $channel] if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 helped] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } set found_helper "0" @@ -302,7 +296,7 @@ putdebug 0 "$usernick [onchan $usernick $channel] $channel" 1 if { ![onchan $usernick $channel] } { sql "DELETE FROM next WHERE usernick='[charfilter $usernick]' AND chanid='$chanid';" - putdebug $procname "Deleted $usernick from next db for \($channel\/$chanid\) (not on $channel)" 1 + putdebug "Deleted $usernick from next db for \($channel\/$chanid\) (not on $channel)" 1 continue } @@ -312,12 +306,12 @@ if { [isloggedin $usernick $channel [getchanhost $usernick] 0] && [login:base:checkaccess:user:cmd $usernick $channel [getchanhost $usernick] 0 VOID] } { sql "DELETE FROM next WHERE usernick='[charfilter $usernick]' AND chanid='$chanid';" - putdebug $procname "Deleted $usernick from next db for \($channel\/$chanid\) (Logged in / Channel access 25+)" 1 + putdebug "Deleted $usernick from next db for \($channel\/$chanid\) (Logged in / Channel access 25+)" 1 continue } if { [isop $usernick $channel] } { sql "DELETE FROM next WHERE usernick='[charfilter $usernick]' AND chanid='$chanid';" - putdebug $procname "Deleted $usernick from next db for \($channel\/$chanid\) (opped on $channel)" 1 + putdebug "Deleted $usernick from next db for \($channel\/$chanid\) (opped on $channel)" 1 continue } @@ -341,13 +335,12 @@ proc login:stricthelp:commands:noidle { nick host handle channel var } { global botnick settings helpflags - set procname "sh:cmd:noidle" if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 noidle] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } if { ![ischanset $channel stricthelp] } { - putdebug $procname ".noidle was attempted in a chan without stricthelp" 1 + putdebug ".noidle was attempted in a chan without stricthelp" 1 return 0 } switch [string tolower $var] { @@ -356,14 +349,14 @@ default { if { ![onchan $var $channel] } { putnotc $nick "$var is NOT on $channel." ; return 0 } } } if { [isloggedin $var $channel [getchanhost $var] 0] && [login:base:checkaccess:user:cmd $nick $channel $host 0 VOID] } { - putdebug $procname "$nick attempted a noidle on $var on $channel. $var has MIN ACCESS" 1 + putdebug "$nick attempted a noidle on $var on $channel. $var has MIN ACCESS" 1 putnotc $nick "$settings(prefix,stricthelp) Unable to noidle $var. \(Has ACCESS 25 or more\)" return 0 } set ban [getchanhost $var [charfilter $channel]] - putdebug $procname "1. [getchanhost [charfilter $var] [charfilter $channel]]" 1 + putdebug "1. [getchanhost [charfilter $var] [charfilter $channel]]" 1 set ban "*!*[string range $ban [string first "@" $ban] end]" - putdebug $procname "2. *!*[string range $ban [string first "@" $ban] end]" 1 + putdebug "2. *!*[string range $ban [string first "@" $ban] end]" 1 #Reenable this when we have finished login:base:checkaccess:user:level @@ -372,14 +365,14 @@ # return 0 #} - #if { [matchattr [nick2hand $nick] O] } { putdebug $procname "OPER OVERRIDE on $channel" 1 } + #if { [matchattr [nick2hand $nick] O] } { putdebug "OPER OVERRIDE on $channel" 1 } set why "Please do NOT idle in $channel. Return when you are alive. \(1 minute ban\)" - putdebug $procname "DEBUG DEBUG newchanban $channel $ban $nick $why " 1 + putdebug "DEBUG DEBUG newchanban $channel $ban $nick $why " 1 newchanban $channel $ban $nick $why 1 putkick $channel $var "$why" putnotc $nick "Idlebanned $var on $channel" - putdebug $procname "Idlebanned $var on $channel on $nick 's request" 1 + putdebug "Idlebanned $var on $channel on $nick 's request" 1 return 1 } @@ -388,15 +381,13 @@ global settings - set procname "sh:cmd:topic" - if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 noidle] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } if { ![ischanset $channel stricthelp] } { - putdebug $procname ".topic was attempted in a chan without stricthelp" 1 + putdebug ".topic was attempted in a chan without stricthelp" 1 return 0 } @@ -444,65 +435,61 @@ # TODOTODO: Contain .apply information in an external file. proc login:stricthelp:commands:apply { nick host handle channel args } { - set procname "sh:cmd:apply" if { ![isloggedin $nick $channel $host 1] || ![login:base:checkaccess:user:cmd $nick $channel $host 1 apply] } { - putdebug $procname "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 + putdebug "Failed AUTH/ACCESS CHECK in $channel $nick \($host\)" 1 return 0 } if { ![channel get $channel stricthelp] } { putnotc $nick "This command\(.apply\) is not available in $channel." ; return 0 } if { [llength [split $args]] != "1" } { putnotc $nick "SYNTAX \: .apply <target nick>" ; return 0 } if { ![onchan $args $channel] } { putnotc $nick "$args is NOT on $channel. Unable to proceed." ; return 0 } - putdebug $procname "Passed checks. +stricthelp , llength 1 , onchan target." 1 + putdebug "Passed checks. +stricthelp , llength 1 , onchan target." 1 putmsg $channel "\002$args\002 \: Information regarding \"Team membership\" is being sent to you via \/notice." putnotc $args "Thank you for your interest in joining our team. Our staff is currently full, but to get on our waiting list,\ please complete the form at http://www.nastrand.net/application.php" putnotc $nick "\"Team Membership\" information has been sent to $args." - putdebug $procname "Sent \"Team membership\" info to $args on $channel \(per request $nick\)." 1 + putdebug "Sent \"Team membership\" info to $args on $channel \(per request $nick\)." 1 } proc login:stricthelp:event:part { nick userhost handle channel partreason } { global settings botnick - set procname "sh:event:part" # the next db only exists for chans with stricthelp. - putdebug $procname "nick : $nick" 1 - putdebug $procname "userhost : $userhost" 1 - putdebug $procname "handle : $handle" 1 - putdebug $procname "channel : $channel" 1 - putdebug $procname "reason : $partreason" 1 + putdebug "nick : $nick" 1 + putdebug "userhost : $userhost" 1 + putdebug "handle : $handle" 1 + putdebug "channel : $channel" 1 + putdebug "reason : $partreason" 1 if { ![ischanset $channel stricthelp] } { return 0 } set chanid [sql:getchanid [charfilter $channel]] if { [sql "SELECT timestamp FROM next WHERE usernick='[charfilter $nick]' AND chanid='$chanid';"] != "" } { sql "DELETE FROM next WHERE usernick='[charfilter $nick]';" - putdebug $procname "Deleted from next $nick \(PART\)" 1 + putdebug "Deleted from next $nick \(PART\)" 1 } } proc login:stricthelp:event:kick { nick host handle channel target reason } { global settings - set procname "sh:event:kick" # the next db only exists for chans with stricthelp. - putdebug $procname "nick : $nick" 1 - putdebug $procname "userhost : $host" 1 - putdebug $procname "handle : $handle" 1 - putdebug $procname "channel : $channel" 1 - putdebug $procname "target : $target" 1 - putdebug $procname "reason : $reason" 1 + putdebug "nick : $nick" 1 + putdebug "userhost : $host" 1 + putdebug "handle : $handle" 1 + putdebug "channel : $channel" 1 + putdebug "target : $target" 1 + putdebug "reason : $reason" 1 if { ![ischanset $channel stricthelp] } { return 0 } set chanid [sql:getchanid [charfilter $channel]] if { [sql "SELECT timestamp FROM next WHERE usernick='[charfilter $target]' AND chanid='$chanid';"] != "" } { sql "DELETE FROM next WHERE usernick='[charfilter $target]';" - putdebug $procname "DELETED $target from next cause he got kicked." 1 + putdebug "DELETED $target from next cause he got kicked." 1 } } proc login:stricthelp:event:quit { nick host handle channel reason } { global settings - set procname "sh:event:quit" # the next db only exists for chans with stricthelp. if { ![ischanset $channel stricthelp] } { return 0 } @@ -510,14 +497,13 @@ if { [sql "SELECT timestamp FROM next WHERE usernick='[charfilter $nick]' AND chanid='$chanid';"] != "" } { sql "DELETE FROM next WHERE usernick='[charfilter $nick]';" - putdebug $procname "DELETED $nick from next cause he QUIT" 1 + putdebug "DELETED $nick from next cause he QUIT" 1 } } proc login:stricthelp:event:split { nick host handle channel } { - set procname "sh:event:split" if { ![isloggedin $nick $channel $host 0] && ![login:base:checkaccess:user:cmd $nick $channel $host 0 VOID] } { - putdebug $procname "NETSPLIT CALLED QUIT $nick" 1 + putdebug "NETSPLIT CALLED QUIT $nick" 1 login:stricthelp:event:quit $nick $host $handle $channel NETSPLIT } } @@ -525,13 +511,12 @@ ## The devoice handler. proc login:stricthelp:mode:devoice { nick host handle channel modechange victim } { global settings - set procname "sh:cmd:devoice" if { ![ischanset $channel stricthelp] } { return 0 } set chanid [sql:getchanid $channel] # When someone gets devoiced we check if he is in the NEXT db AND !logged AND !access. if { [isloggedin $victim $channel [getchanhost $victim] 1] && [login:base:checkaccess:user:cmd $victim $channel [getchanhost $victim] 0 VOID] } { - putdebug $procname "A logged in user \($victim\) with access got devoiced in $channel by $nick" 1 + putdebug "A logged in user \($victim\) with access got devoiced in $channel by $nick" 1 return 0 } @@ -545,7 +530,7 @@ UserId='[sql:getuserid [charfilter $nick]]',\ Comment='Added automatically per devoice from [charfilter $nick]';" - putdebug $procname "Added silence entry for $userhost per devoice from [charfilter $nick] on [charfilter $channel]." 1 + putdebug "Added silence entry for $userhost per devoice from [charfilter $nick] on [charfilter $channel]." 1 # User has been added , Send notices now. putnotc $nick "( Silencelist ) I have successfully added $userhost to the list for $channel" @@ -554,7 +539,7 @@ # Done :p } - putdebug $procname "A user got devoiced which did not meet the silencelist conditions." 1 + putdebug "A user got devoiced which did not meet the silencelist conditions." 1 } proc login:stricthelp:mode:voice { nick host handle channel modechange victim } { @@ -594,14 +579,13 @@ proc sql:addusertonext { nick channel } { global settings - set procname "addusertonext" if { [sql "select UserNick from next where UserNick='[charfilter $nick]';"] == "" } { sql "INSERT INTO next SET chanid='[sql:getchanid [charfilter $channel]]', Helperid='0',TimeStamp='[unixtime]',UserNick='[charfilter $nick]',Status='0';" - putdebug $procname "Created next db entry for $nick" 1 + putdebug "Created next db entry for $nick" 1 } else { sql "UPDATE next SET chanid='[sql:getchanid [charfilter $channel]]', Helperid='0',TimeStamp='[unixtime]', UserNick='[charfilter $nick]',Status='0' WHERE UserNick='[charfilter $nick]';" - putdebug $procname "Updated next db entry for $nick" 1 + putdebug "Updated next db entry for $nick" 1 } } -putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.12 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.STRICTHELP.TCL \$Revision: 1.13 $ by the Feds TCL Group (FTG) -=LOADED=-!" Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.25 EggBase/eggbase.tcl:1.26 --- EggBase/eggbase.tcl:1.25 Fri Nov 28 15:23:22 2003 +++ EggBase/eggbase.tcl Fri Nov 28 15:51:51 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.25 2003/11/28 23:23:22 genesis Exp $ +## $Id: eggbase.tcl,v 1.26 2003/11/28 23:51:51 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -18,10 +18,8 @@ ## ## ## PHP crew : ## ## ## -## Valcor @ Undernet (Coordinator) <jan...@us...>## -## Empus @ Undernet (Main coder) <em...@un...> ## -## Travis_ @ UnderNet (Web Interface) <xxx@xxx> ## -## ## +## nex @ Undernet (Main php Monkey) <ne...@us...> ## +## Shoey @ Undernet (Silly php Monkey) <sh...@us...> ## ## ## ########################################################################## ## ## @@ -125,25 +123,7 @@ # The following procedure outputs debug data to DCC channel 5478 for problem detection. -## Once we are done with renaming all our procs we will use info for getting the procname. -## info level -1 should do the trick. - -proc putdebug { procname message flag} { - global home - if {![ischanset $home debug] || ![botonchan $home] || ( $flag == "1" && ![ischanset $home extdebug]) } { return 0 } - if { $flag == "1" && [ischanset $home extdebug]} { - # set procname [lindex [split [info level -1]]] - dccputchan 5478 "[format "( %-20s ) %s" $procname $message]" - return 1 - } - dccputchan 5478 $message - puthelp "PRIVMSG $home :$message" -} - -# the above proc will soon be replaced by the below one. -# syntax : putdebug message flag - -proc putdebug2 { message flag } { +proc putdebug { message flag } { global home # This well soon be moved to SQL. if { ![channel get $home debug] || ( $flag == "1" && ![ischanset $home extdebug]) } { return 0 } @@ -250,13 +230,12 @@ # Proc lets a user .login to the bot in a channel proc login:base:pub:login { nick host handle channel args } { global settings - set procname "base:pub:login" if { ![onchan $nick] } { putnotc $nick "[login:base:getreply:userid 0 NOT_IN_CHAN]" return 0 } if {[isloggedin $nick $channel $host 0] } { - putdebug $procname "Logged in user asked for .login $nick $channel" 1 + putdebug "Logged in user asked for .login $nick $channel" 1 putnotc $nick "\[\002COMMANDS\002\] You are already logged in." return 0 } @@ -268,7 +247,6 @@ # Proc lets a user login to the bot via message proc login:base:msg:login { nick host handle rest } { global settings - set procname "base:msg:login" if { ![onchan $nick] } { putnotc $nick "[login:base:getreply:userid 0 NOT_IN_CHAN]" return 0 @@ -287,7 +265,7 @@ } ## We use md5 since our webcoders can use that on their webpages. if { [sql "SELECT password FROM user_table WHERE Handle='[charfilter $handle]';"] == [md5 $passwd] } { - putdebug $procname "Logged in $nick \([getchanhost $nick]\) with botHandle $handle via manual login." 1 + putdebug "Logged in $nick \([getchanhost $nick]\) with botHandle $handle via manual login." 1 set userid [sql:getuserid [charfilter $handle]] sql "UPDATE user_table SET login_status=1 WHERE userid='$userid'" sql "UPDATE user_table SET uhost='[charfilter [getchanhost $nick]]' WHERE userid='$userid'" @@ -308,15 +286,15 @@ if { $notecount != 0 } { putnotc $nick "You have $notecount new note\(s\). Type /MSG feds notes read to read them or .notes read in a channel." - putdebug2 "Sent notecount to $nick on login" 1 + putdebug "Sent notecount to $nick on login" 1 sql "UPDATE notes_table SET status='1' WHERE target_user='$userid' AND status='0';" - putdebug2 "Set status to 1 on all note for $userid \($handle\)" 1 + putdebug "Set status to 1 on all note for $userid \($handle\)" 1 } - putdebug $procname "Deleted [charfilter $nick] from .next db after login." 1 - putdebug $procname "Updated seen(LOGIN) time for $userid to [unixtime]" 1 + putdebug "Deleted [charfilter $nick] from .next db after login." 1 + putdebug "Updated seen(LOGIN) time for $userid to [unixtime]" 1 } else { - putdebug $procname "LOGIN FAILED FOR $nick \([getchanhost $nick]\) with botHandle $handle via manual login." 1 + putdebug "LOGIN FAILED FOR $nick \([getchanhost $nick]\) with botHandle $handle via manual login." 1 putnotc $nick "Manual login as $handle Failed." } } @@ -326,8 +304,6 @@ global settings botnick - set procname "base:event:raw" - switch $numeric { # Here we handle all /who returns which involve %switches. @@ -346,7 +322,7 @@ # If all of this chekcs out it should be ok :) if { [string index $eventtype 0] == ":" || ![string is integer $eventtype] || [string length $eventtype] != 3 } { - putdebug $procname "Error Invalid Enventtype or Eggdrop native. \($eventtype\)" 1 + putdebug "Error Invalid Enventtype or Eggdrop native. \($eventtype\)" 1 # Eggdrop does /who's with switches aswell. Since those will be picked up here and will NOT pass the tests. # Afaik eggdrop does not use %t so we should be safe :). return 0 @@ -367,7 +343,6 @@ global settings botnick switch $numeric { 330 { - set procname "base:event:num330" # We don't add an isloggedin check since we usually only receive a 330 when # a non-loggedin user types .login OR a non-loggedin user joins. # Reconsider this! @@ -386,13 +361,13 @@ if { [info exists settings(login,temp,[string tolower $nick])] } { unset settings(login,temp,[string tolower $nick]) set sendnotice "1" - putdebug $procname "330 Token received \002with\002 Login request from $nick" 1 + putdebug "330 Token received \002with\002 Login request from $nick" 1 } else { set sendnotice "0" - putdebug $procname "330 Token received \002without\002 Login request from $nick" 1 + putdebug "330 Token received \002without\002 Login request from $nick" 1 } - putdebug $procname "numeric \: $numeric" 1 - putdebug $procname "data \: $data" 1 + putdebug "numeric \: $numeric" 1 + putdebug "data \: $data" 1 # We get the userid of the person with this X handle. set userid [sql "SELECT userid from user_table WHERE Xhandle='[charfilter $330_username]';"] @@ -400,7 +375,7 @@ if { $sendnotice == "1" } { putnotc $nick "[login:base:getreply:userid 0 NO_USERNAME] $settings(admin)" } - putdebug $procname "FAILED ACLOGIN from $nick [getchanhost $nick]. (no such username in DB)" 1 + putdebug "FAILED ACLOGIN from $nick [getchanhost $nick]. (no such username in DB)" 1 return 0 } @@ -414,10 +389,10 @@ if { $sendnotice == "1" } { putnotc $nick "Your bothandle has been locked. Unable to log you in. Contact $settings(admin)" } - putdebug $procname "FAILIURE \: Access \002LOCKED\002 $nick $userid" 1 + putdebug "FAILIURE \: Access \002LOCKED\002 $nick $userid" 1 return 0 } - putdebug $procname "Logged in $nick using $330_username." 1 + putdebug "Logged in $nick using $330_username." 1 sql "UPDATE user_table SET login_status=1 WHERE userid='$userid';" sql "UPDATE user_table SET uhost='[charfilter [getchanhost $nick]]' WHERE userid='$userid';" @@ -426,7 +401,7 @@ # We do not check to see if usernick is in next db since that would required minimum 1 query if not # and 2 queries if the user is inthere. So either way we have to do 1 query so might aswell do it now :p sql "DELETE FROM next WHERE UserNick='[charfilter $nick]';" - putdebug $procname "Deleted [charfilter $nick] from .next db after login." 1 + putdebug "Deleted [charfilter $nick] from .next db after login." 1 putnotc $nick "[login:base:getreply:userid $userid AUTH_SUCC] [sql "SELECT handle FROM user_table WHERE userid='$userid';"]" @@ -437,7 +412,7 @@ # So always send them a notice onjoin and on .login if { [sql "SELECT suspend FROM user_table WHERE userid='$userid';"] == "1" } { putnotc $nick "Your bothandle has been suspended. Contact $settings(admin)" - putdebug $procname "LOGIN \: Access \002SUSPENDED\002 $nick $userid" 1 + putdebug "LOGIN \: Access \002SUSPENDED\002 $nick $userid" 1 } # We don't want suspended users to get automoded or to receive the new notes notice @@ -446,9 +421,9 @@ set notecount [sql "SELECT count(note_id) FROM notes_table WHERE target_user='$userid' AND status<'2';"] if { $notecount != 0 } { putnotc $nick "You have $notecount new note\(s\). Type /MSG feds notes read to read them or .notes read in a channel." - putdebug2 "Sent notecount to $nick on login" 1 + putdebug "Sent notecount to $nick on login" 1 sql "UPDATE notes_table SET status='1' WHERE target_user='$userid' AND status='0';" - putdebug2 "Set status to 1 on all note for $nick \($userid\)" 1 + putdebug "Set status to 1 on all note for $nick \($userid\)" 1 } foreach sqldata [sql "SELECT chanid,automode FROM access_table WHERE userid='$userid' AND chanid!='1' AND chanid!='2';"] { @@ -459,7 +434,7 @@ if { $channel != "" } { if { [onchan $nick $channel] && ![isvoice $nick $channel] } { pushmode $channel +v $nick - putdebug $procname "AUTOMODED $channel +v $nick" 1 + putdebug "AUTOMODED $channel +v $nick" 1 } } else { putnotc $nick "An error has occured. Please contact gen <Ge...@eu...> \( 330 numeric , illegal channel. \)" @@ -470,7 +445,7 @@ set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] if { $channel != "" } { if { [onchan $nick $channel] && ![isop $nick $channel] } { - pushmode $channel +o $nick ; putdebug $procname "AUTOMODED $channel +o $nick" 1 + pushmode $channel +o $nick ; putdebug "AUTOMODED $channel +o $nick" 1 } } else { putnotc $nick "An error has occured. Please contact gen <Ge...@eu...> \( 330 numeric , illegal channel. \)" @@ -482,32 +457,31 @@ set channel [sql "SELECT channel FROM chan_table WHERE chanid='[lindex $sqldata 0]';"] if { ([lindex $sqldata 1] == "3" || [lindex $sqldata 1] == "4" || [lindex $sqldata 1] == "5") && ![onchan $nick $channel] } { puthelp "INVITE $nick $channel" - putdebug $procname "AUTOINVITED $nick to $channel" 1 + putdebug "AUTOINVITED $nick to $channel" 1 } } # (the above line closes the foreach) } else { # User suspended. - putdebug $procname "skipped automodes for $nick on login \(suspend\)" 1 + putdebug "skipped automodes for $nick on login \(suspend\)" 1 } sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='authenticating with me \[$nick![getchanhost $nick]\]' WHERE userid='$userid';" - putdebug $procname "Updated seen(LOGIN) time for $userid to [unixtime]" 1 + putdebug "Updated seen(LOGIN) time for $userid to [unixtime]" 1 return 1 # End of 330 } 318 { set nick [lindex [charfilter $data] 1] - set procname "base:event:num318" ## Only send error msg's if person did a .login if { [info exists settings(login,temp,[string tolower $nick])]} { putnotc $nick "[login:base:getreply:userid 0 NO_ACCOUNT_TOKEN]" unset settings(login,temp,[string tolower $nick]) - putdebug $procname "numeric \: $numeric" 1 - putdebug $procname "data \: $data" 1 + putdebug "numeric \: $numeric" 1 + putdebug "data \: $data" 1 } # End of 318 } @@ -516,7 +490,6 @@ # The following proc keeps the db updated with the nickchanges of users proc login:base:event:nickchange { oldnick host handle chan newnick } { - set procname "base:event:nickchange" # get userid set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $oldnick]';"] @@ -529,7 +502,7 @@ ## User is not logged in so no need to update. if {![isloggedin $oldnick $chan $host 0] } { - putdebug $procname "NON auth user changed nick. No update needed" 1 + putdebug "NON auth user changed nick. No update needed" 1 return 0 } @@ -537,8 +510,8 @@ sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='changing nick to \[$newnick!$host\]' WHERE userid='$userid';" - putdebug $procname "DB update \: Nick change $oldnick \=\> $newnick" 1 - putdebug $procname "Updated seen(NICKCHANGE) time for $userid to [unixtime]" 1 + putdebug "DB update \: Nick change $oldnick \=\> $newnick" 1 + putdebug "Updated seen(NICKCHANGE) time for $userid to [unixtime]" 1 } @@ -550,20 +523,18 @@ proc isloggedin { nick channel host sendnotice } { global settings - set procname "base:isloggedin" ## This counters the multiple username problem :) ## Once we are sure part/kick/quit also set all unick/uhost values to NULL this can be removed. if { [sql "SELECT count(userid) FROM user_table WHERE unick='[charfilter $nick]' AND uhost='[charfilter $host]' ;"] > 1 } { - putdebug $procname "SAME USERNAME FOUND TWICE!" 1 - putlog "$procname SAME USERNAME FOUND TWICE!" + putdebug "SAME USERNAME FOUND TWICE!" 1 + putlog "SAME USERNAME FOUND TWICE!" foreach userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]';"] { sql "UPDATE user_table SET unick='' WHERE userid='$userid';" sql "UPDATE user_table SET login_status='0' WHERE userid='$userid';" - putdebug $procname "SET Unick loginstatus to 0 for $userid \(double unicks\)" 1 - putlog "$procname SET Unick loginstatus to 0 for $userid \(double unicks\)" + putdebug "SET Unick loginstatus to 0 for $userid \(double unicks\)" 1 } putnotc $nick "An internal database error has occured and you have been logged out as a result. Please contact f.v...@da..." return 0 @@ -580,19 +551,18 @@ if { $userid == "" } { if { $sendnotice == "1" } { - putdebug $procname "Sent NOT_LOGGEDIN notice to $nick $host $sendnotice" 1 + putdebug "Sent NOT_LOGGEDIN notice to $nick $host $sendnotice" 1 putnotc $nick "[login:base:getreply:userid 0 NOT_LOGGEDIN]" } return 0 } - putdebug $procname "$nick on \( $host \) IS LOGGED IN. Sendnotice \: $sendnotice" 1 + putdebug "$nick on \( $host \) IS LOGGED IN. Sendnotice \: $sendnotice" 1 return 1 } proc login:base:checkaccess:user:cmd { nick channel host sendnotice cmd } { global settings - set procname "base:checkacc:user:cmd" set chanid [sql:getchanid [charfilter $channel]] set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]' AND login_status='1';"] @@ -605,8 +575,7 @@ if { $sendnotice == "1" } { putnotc $nick "$nick is not in my DB. $settings(admin)" } - putdebug $procname "A nick not in the db got called here. Possible join ?" 1 - putlog "ERROR $procname A nick not in the db got called here. Possible join ?" + putdebug "A nick not in the db got called here. Possible join ?" 1 return 0 } @@ -617,7 +586,7 @@ if { $sendnotice == "1" } { putnotc $nick "Your BotHandle has been suspended. Contact $settings(admin)" } - putdebug $procname "FAILIURE \: BotHandle suspended $nick $userid" 1 + putdebug "FAILIURE \: BotHandle suspended $nick $userid" 1 return 0 } @@ -644,7 +613,7 @@ if { $sendnotice == "1" } { putnotc $nick "[login:base:getreply:userid $userid NO_ACCESS]" - putdebug $procname "SENT No_ACCESS notice to $nick $channel $host" 1 + putdebug "SENT No_ACCESS notice to $nick $channel $host" 1 } return 0 } @@ -760,26 +729,24 @@ proc login:base:event:split { nick host handle channel } { global settings - set procname "base:event:split" if { ![isloggedin $nick $channel $host 0] } { - putdebug $procname "A user NOT in the database quit. $nick $channel" 1 + putdebug "A user NOT in the database quit. $nick $channel" 1 return 0 } # We don't need a AND HOST == and STATUS == because of the above isloggedin check set userid [sql "SELECT userid FROM user_table WHERE unick='[charfilter $nick]';"] if { $userid != "" } { sql "UPDATE user_table SET login_status='0',uhost='0',unick='0' WHERE userid='$userid';" - putdebug $procname "Loggedout\/Cleared $userid \($channel $nick $host\)" 1 + putdebug "Loggedout\/Cleared $userid \($channel $nick $host\)" 1 return 1 } - putdebug $procname "Someone NOT in the DB quit $nick $host $channel" 1 + putdebug "Someone NOT in the DB quit $nick $host $channel" 1 } proc login:base:event:quit { nick host handle channel args } { global settings - set procname "base:event:quit" if { ![isloggedin $nick $channel $host 0] } { - putdebug $procname "A user NOT logged in quit. $nick $host $channel" 1 + putdebug "A user NOT logged in quit. $nick $host $channel" 1 return 0 } @@ -789,17 +756,17 @@ # If args == registered we can ignore the quit. # BUT ! we still need to update the host. Do this later. if { $args == "Registered" } { - putdebug $procname "Undernet Mode +x quit detected $nick $host $channel" 1 + putdebug "Undernet Mode +x quit detected $nick $host $channel" 1 } if { $userid != "" } { sql "UPDATE user_table SET login_status='0' WHERE userid='$userid';" - putdebug $procname "Loggedout\/Cleared $userid \($channel $nick $host\)" 1 + putdebug "Loggedout\/Cleared $userid \($channel $nick $host\)" 1 sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='quit irc with quitmsg \: [charfilter $args] \[[charfilter $nick]![charfilter $host]\]' WHERE userid='$userid';" - putdebug $procname "Updated seen(QUIT) time for $userid to [unixtime]" 1 + putdebug "Updated seen(QUIT) time for $userid to [unixtime]" 1 return 1 } - putdebug $procname "Someone NOT in the DB quit $nick $host $channel" 1 + putdebug "Someone NOT in the DB quit $nick $host $channel" 1 } proc login:base:event:splitrejoin { nick host handle channel } { @@ -811,8 +778,7 @@ } proc login:base:event:join { nick host handle channel } { - set procname "base:event:join" - putdebug $procname "JOIN $nick $host $handle $channel" 1 + putdebug "JOIN $nick $host $handle $channel" 1 if { [isloggedin $nick $channel $host 0] } { set chanid [sql:getchanid [charfilter $channel]] set userid [login:base:nick2userid $nick $host] @@ -822,31 +788,31 @@ {[14]} { if { [onchan $nick $channel] && ![isvoice $nick $channel] } { - pushmode $channel +v $nick ; putdebug $procname "AUTOMODED $channel +v $nick" 1 + pushmode $channel +v $nick ; putdebug "AUTOMODED $channel +v $nick" 1 } } {[25]} { if { [onchan $nick $channel] && ![isop $nick $channel] } { - pushmode $channel +o $nick ; putdebug $procname "AUTOMODED $channel +o $nick" 1 + pushmode $channel +o $nick ; putdebug "AUTOMODED $channel +o $nick" 1 } } - 3 { putdebug $procname "$nick joined $channel and has an AUTOINVITE set on this chan" 1 } + 3 { putdebug "$nick joined $channel and has an AUTOINVITE set on this chan" 1 } } } else { - putdebug $procname "skipped automodes for $nick on $channel \(JOIN\) \(suspend)" 1 + putdebug "skipped automodes for $nick on $channel \(JOIN\) \(suspend)" 1 } sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='joining a channel \[$nick!$host\]' WHERE userid='$userid';" - putdebug $procname "Updated seen(JOIN) time for $userid to [unixtime]" 1 + putdebug "Updated seen(JOIN) time for $userid to [unixtime]" 1 return 1 } - putdebug $procname "Non logged in user joined $nick $channel" 1 + putdebug "Non logged in user joined $nick $channel" 1 if { [ischanset $channel onjoinlogin] } { putserv "WHOIS $nick" } if { [channel get $channel autovoice] && ![isvoice $nick $channel] } { pushmode $channel +v $nick - putdebug2 "Autovoiced $nick on $channel (autovoice chan)" 1 + putdebug "Autovoiced $nick on $channel (autovoice chan)" 1 } } @@ -855,16 +821,15 @@ # We call the timer and extra proc # No need to call charfilter for $args (since eggdrop makes it a list and escaped when necessary) set tempvar [utimer 2 [list login:base:event:part2 $nick $host * $channel $args]] - putdebug2 "Timer $tempvar : $nick $host * $channel $args" 1 + putdebug "Timer $tempvar : $nick $host * $channel $args" 1 } proc login:base:event:part2 { nick host handle channel msg } { - set procname "base:event:part2" set userid [login:base:nick2userid $nick $host] if { $userid == "" || $userid == "0" } { return 0 } if { ![onchan $nick] } { - putdebug $procname "$nick parted $channel and is no longer on any channels I monitor." 1 - putdebug $procname "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 + putdebug "$nick parted $channel and is no longer on any channels I monitor." 1 + putdebug "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 sql "UPDATE user_table SET login_status=0 WHERE userid='$userid'" if { $msg == "" } { set tempvar "channel" @@ -873,7 +838,7 @@ } sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='parting a $tempvar \[$nick!$host\]' WHERE userid='$userid';" - putdebug $procname "Updated seen(PART) time for $userid to [unixtime]" 1 + putdebug "Updated seen(PART) time for $userid to [unixtime]" 1 } # userid is not empty so we can update SEEN } @@ -881,7 +846,7 @@ proc login:base:event:kick { nick host handle channel victim args } { # We call the timer and extra proc set tempvar [utimer 2 [list login:base:event:kick2 $nick [getchanhost $victim] * $channel $victim $args]] - putdebug2 "Timer $tempvar : $nick [getchanhost $victim] * $channel $victim $args" 1 + putdebug "Timer $tempvar : $nick [getchanhost $victim] * $channel $victim $args" 1 } @@ -889,12 +854,11 @@ # $host is the victims host in thise case (see also, kick handler, above). # If the victim that kicked is in our db AND not on any channels we set status to 0. # if host don't match then something is wrong and owner should be deathed anyway. - set procname "base:event:part2" set userid [login:base:nick2userid $victim $host] if { $userid == "" || $userid == "0" } { return 0 } if { ![onchan $victim] } { - putdebug $procname "$victim was kicked from $channel and is no longer on any channels I monitor." 1 - putdebug $procname "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 + putdebug "$victim was kicked from $channel and is no longer on any channels I monitor." 1 + putdebug "Set status to 0 for userid $userid. Reason \: Not in any of my channels." 1 sql "UPDATE user_table SET login_status='0' WHERE userid='$userid'" } # userid is not empty so we can update SEEN @@ -905,20 +869,19 @@ } sql "UPDATE user_table SET seen='[unixtime]' WHERE userid='$userid';" sql "UPDATE user_table SET seen_data='getting kicked from a $tempvar \[$victim!$host\]' WHERE userid='$userid';" - putdebug $procname "Updated seen(KICK) time for $userid to [unixtime]" 1 + putdebug "Updated seen(KICK) time for $userid to [unixtime]" 1 }... [truncated message content] |
From: Frederik V. <ge...@us...> - 2003-11-28 23:23:34
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : EggBase Commit time: 2003-11-28 23:23:33 UTC Modified files: eggbase.tcl Log message: Author: Frederik Vervaet Log message: Minor bugfixes :) ---------------------- diff included ---------------------- Index: EggBase/eggbase.tcl diff -u EggBase/eggbase.tcl:1.24 EggBase/eggbase.tcl:1.25 --- EggBase/eggbase.tcl:1.24 Thu May 8 04:41:07 2003 +++ EggBase/eggbase.tcl Fri Nov 28 15:23:22 2003 @@ -1,4 +1,4 @@ -## $Id: eggbase.tcl,v 1.24 2003/05/08 11:41:07 genesis Exp $ +## $Id: eggbase.tcl,v 1.25 2003/11/28 23:23:22 genesis Exp $ ########################################################################## ## ---------------------------------------------------------------------## @@ -96,7 +96,7 @@ ## Our new RAW handler. -bind raw - 354 base:event:numeric +bind raw - 354 base:event:raw ## flags. @@ -345,8 +345,8 @@ # 3. Check if it has 3 digits. # If all of this chekcs out it should be ok :) - if { [string index $eventtype 0] == ":" || ![string is integer $eventtype] || [string length $test] != 3 } { - putdebug $procname "Error Invalid Entrytype or Eggdrop native. \($entrytype\)" 1 + if { [string index $eventtype 0] == ":" || ![string is integer $eventtype] || [string length $eventtype] != 3 } { + putdebug $procname "Error Invalid Enventtype or Eggdrop native. \($eventtype\)" 1 # Eggdrop does /who's with switches aswell. Since those will be picked up here and will NOT pass the tests. # Afaik eggdrop does not use %t so we should be safe :). return 0 @@ -1048,4 +1048,4 @@ return $data } -putlog "EGGBASE.TCL \$Revision: 1.24 $ by the Feds TCL Group (FTG) -=LOADED=-!" +putlog "EGGBASE.TCL \$Revision: 1.25 $ by the Feds TCL Group (FTG) -=LOADED=-!" ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-09-02 21:00:58
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : other Commit time: 2003-09-02 21:00:56 UTC Added files: hostprotect.tcl Log message: Initial entry for seggy's tcl ---------------------- diff included ---------------------- Index: other/hostprotect.tcl diff -u /dev/null other/hostprotect.tcl:1.1 --- /dev/null Tue Sep 2 14:00:56 2003 +++ other/hostprotect.tcl Tue Sep 2 14:00:45 2003 @@ -0,0 +1,4 @@ +# This tcl protects Undernet channels from being abused by multiple CSC usernames abusers. +# Made on request of : Segfault. + +# Todo : Everything. ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-07-19 12:22:15
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : other Commit time: 2003-07-19 12:22:15 UTC Modified files: mailadmin.tcl Log message: Bugfix. When you enter 0 on the "delete ip from access_client" listing it should EXIT. ---------------------- diff included ---------------------- Index: other/mailadmin.tcl diff -u other/mailadmin.tcl:1.1 other/mailadmin.tcl:1.2 --- other/mailadmin.tcl:1.1 Sat Jul 19 05:13:16 2003 +++ other/mailadmin.tcl Sat Jul 19 05:22:04 2003 @@ -340,8 +340,8 @@ while { $tempvar == 0 } { puts "Enter the IP you wish to remove or press enter to continue listing. 0 to cancel." gets stdin temp - if { $temp == "0" } { break } - if { $temp == "" } { set counter 0 ; set tempvar 1 ; continue } + if { $temp == "0" } { set tempvar 1 ; continue } + if { $temp == "" } { set counter 0 ; set tempvar 2 ; continue } if { [ipcheck $temp 2] } { puts "Would have removed $temp" set tempvar 1 @@ -349,7 +349,8 @@ puts "BAD IP" } after 2000 - } + } + if { $tempvar == "1" } { break } } } } ----------------------- End of diff ----------------------- |
From: Frederik V. <ge...@us...> - 2003-07-19 12:13:27
|
Committer : Frederik Vervaet <ge...@us...> CVSROOT : /cvsroot/feds Module : other Commit time: 2003-07-19 12:13:26 UTC Added files: mailadmin.tcl Removed files: courieradmin.tcl Log message: Removed the old courieradmin tcl and added the new mailadmin one :) ---------------------- diff included ---------------------- Index: other/courieradmin.tcl diff -u other/courieradmin.tcl:1.2 other/courieradmin.tcl:removed --- other/courieradmin.tcl:1.2 Fri Mar 28 01:37:45 2003 +++ other/courieradmin.tcl Sat Jul 19 05:13:26 2003 @@ -1,224 +0,0 @@ -#!/usr/bin/tcl - -## Init SQL db interface -load /usr/local/lib/fbsql.so - -## Main defines. - -set company "Dato" -set dbname "courier" - -## main procs. - -proc displaymenu { } { - - global company - puts "" - puts "$company Mail Management Console" - puts "" - puts "" - puts "Please select an option :" - puts "" - puts "0. Exit." - puts "1. Add a mailuser." - puts "2. Modify a user password." - puts "3. Suspend user mailaccess." - puts "4. Remove a mailuser." - puts " Other : (these require root)" - puts "5. Add a system user." - puts "6. Remove a system user." - puts "" - -} - -proc addmailuser { } { - - set username "" - while { $username == "" } { - puts "" - puts "Enter Username to add or press 0 to abort :" - puts "" - gets stdin username - if { $username == "0" } { - return 0 - } - } - set uid [lindex [split [exec grep $username:x: /etc/passwd ] ":" ] 2 ] - set gid [lindex [split [exec grep $username:x: /etc/passwd ] ":" ] 3 ] - puts "" - set home [lindex [split [exec grep $username:x: /etc/passwd] ":" ] 5 ] - puts "Press Y to use $home as homedir or press N to enter a custom home :" - puts "" - gets stdin temp - if { [string tolower $temp] == "n" || [string tolower $temp] == "no"} { - puts "" - puts "Enter custom homedir (format : /xxx/yyy/ :" - puts "" - gets stdin home - } - set maildir [join "$home Maildir/" ""] - puts "" - puts "Please specify password :" - puts "" - set encpasswd [lindex [split [exec mkpasswd]] 1] - puts "" - puts "Do you want to add the following info :" - puts "Username : $username" - puts "UserID : $uid" - puts "GroupID : $gid" - puts "EncPass : $encpasswd" - puts "Home : $home" - puts "Maildir : $maildir" - puts "" - gets stdin temp - if { [string tolower $temp] == "n" || [string tolower $temp] == "no"} { - puts "" - puts "You have chosen NOT to add the above info. Terminating to main menu." - puts "" - after 2000 - return - } - puts "" - sql "INSERT INTO passwd SET id='$username',uid='$uid',gid='$gid',crypt='$encpasswd',home='$home',maildir='$maildir';" - puts "USER $username ADDED" - after 2000 - return -} - -proc moduserpass { } { - - puts "" - puts "Enter Username to modify :" - puts "" - gets stdin username - if { [sql "SELECT id FROM passwd WHERE id='$username';"] == "" } { - puts "Username not found in db." - puts "Press enter to continue." - gets stdin smth - return - } - puts "" - set encpasswd [lindex [split [exec mkpasswd]] 1] - sql "UPDATE passwd SET crypt='$encpasswd' WHERE id='$username';" - puts "" - puts "Updated password for $username." - puts "" - puts "Press enter to continue." - gets stdin smth - return - -} - -proc isroot { } { - - if { [catch { set temp [exec /usr/local/bin/isroot] }] } { - puts "" - puts "An error occured while checking if you are root." - puts "Returning 0 for isroot check." - puts "" - return 0 - } - switch $temp { - - TRUE { return 1 } - FALSE { return 0 } - - } - - return 0 - -} - - - -## Main command loop. -## This is where we actually start :) - -puts "Enter the MAIL DB PASS:" - -gets stdin mailpass - -if { [catch { sql connect localhost $dbname $mailpass }] == 1 } { - - puts "Incorrect Mail db pass. Unable to connect" - return 0 - -} - -sql selectdb courier - -while { 1 < 2 } { - - displaymenu - - gets stdin choice - - if { $choice == "" || ![string is integer $choice] } { - puts "" - puts "Wrong input. Please retry." - puts "Press enter to continue." - puts "" - gets stdin smth - puts "" - continue - } - - switch $choice { - - 0 { break } - - 1 { addmailuser } - - 2 { puts "" - puts "Enter Username to modify :" - puts "" - gets stdin username - if { [sql "SELECT id FROM passwd WHERE id='$username';"] == "" } { - - puts "Username not found in db." - puts "Press enter to continue." - gets stdin smth - continue - - } - puts "" - set encpasswd [lindex [split [exec mkpasswd]] 1] - sql "UPDATE passwd SET crypt='$encpasswd' WHERE id='$username';" - puts "" - puts "Updated password for $username." - puts "" - puts "Press enter to continue." - gets stdin smth - continue - - } - - 3 { } - - 6 { puts "" - if { ![isroot] } { - puts "You are NOT ROOT. You require root for this option." - puts "" - after 2000 - continue - } - } - - default { puts "This choice has not been implemented yet." - puts "Press enter to continue." - gets stdin smth - puts "" - continue } - - } - - continue - -} - -catch { sql disconnect } - -puts "DISCONNECTED DB." - -return 1 - Index: other/mailadmin.tcl diff -u /dev/null other/mailadmin.tcl:1.1 --- /dev/null Sat Jul 19 05:13:26 2003 +++ other/mailadmin.tcl Sat Jul 19 05:13:16 2003 @@ -0,0 +1,392 @@ +#!/usr/bin/tcl + +## Init SQL db interface +load /usr/local/lib/fbsql.so + +## Main defines. + +set company "XXX" +set dbhost "localhost" +set dbname "XXX" +set dbuser "XXX" +set dbpass "XXX" + +## main procs. + +proc displaymenu { } { + + global company + puts "" + puts "$company Mail Management Console" + puts "" + puts "" + puts "Please select an option :" + puts "" + puts "0. Exit." + puts "User control." + puts "1. Add a mailuser. (NOT USED)" + puts "2. Modify a user password. (NOT USED)" + puts "3. Suspend user mailaccess. (NOT USED)" + puts "4. Remove a mailuser. (NOT USED)" + puts "Access control." + puts "5. Add an ip to access_client." + puts "6. Add a spammer to access_client." + puts "7. Remove an ip from access_client. (NOT USED)" + puts "9. List all blocked ips." + +# puts "10. Search an IP." +# puts " Other : (these require root)" +# puts "6. Add a system user." +# puts "7. Remove a system user." + puts "" + +} + +proc ipcheck { ip mask } { + + # we remove spaces before/after and replace . with a space for segmentation. + set ip [string map { " " "" . " " } $ip] + set counter 0 + foreach segment $ip { + if { ![string is integer $segment] } { return 0 } + incr counter + } + if { $counter >= $mask } { return 1 } else { return 0 } + +} + + +proc addmailuser { } { + + set username "" + while { $username == "" } { + puts "" + puts "Enter Username to add or press 0 to abort :" + puts "" + gets stdin username + if { $username == "0" } { + return 0 + } + } + set uid [lindex [split [exec grep $username:x: /etc/passwd ] ":" ] 2 ] + set gid [lindex [split [exec grep $username:x: /etc/passwd ] ":" ] 3 ] + puts "" + set home [lindex [split [exec grep $username:x: /etc/passwd] ":" ] 5 ] + puts "Press Y to use $home as homedir or press N to enter a custom home :" + puts "" + gets stdin temp + if { [string tolower $temp] == "n" || [string tolower $temp] == "no"} { + puts "" + puts "Enter custom homedir (format : /xxx/yyy/ :" + puts "" + gets stdin home + } + set maildir [join "$home Maildir/" ""] + puts "" + puts "Please specify password :" + puts "" + set encpasswd [lindex [split [exec mkpasswd]] 1] + puts "" + puts "Do you want to add the following info :" + puts "Username : $username" + puts "UserID : $uid" + puts "GroupID : $gid" + puts "EncPass : $encpasswd" + puts "Home : $home" + puts "Maildir : $maildir" + puts "" + gets stdin temp + if { [string tolower $temp] == "n" || [string tolower $temp] == "no"} { + puts "" + puts "You have chosen NOT to add the above info. Terminating to main menu." + puts "" + after 2000 + return + } + puts "" + sql "INSERT INTO passwd SET id='$username',uid='$uid',gid='$gid',crypt='$encpasswd',home='$home',maildir='$maildir';" + puts "USER $username ADDED" + after 2000 + return +} + +proc moduserpass { } { + + puts "" + puts "Enter Username to modify :" + puts "" + gets stdin username + if { [sql "SELECT id FROM passwd WHERE id='$username';"] == "" } { + puts "Username not found in db." + puts "Press enter to continue." + gets stdin smth + return + } + puts "" + set encpasswd [lindex [split [exec mkpasswd]] 1] + sql "UPDATE passwd SET crypt='$encpasswd' WHERE id='$username';" + puts "" + puts "Updated password for $username." + puts "" + puts "Press enter to continue." + gets stdin smth + return + +} + +proc isroot { } { + + if { [catch { set temp [exec /usr/local/bin/isroot] }] } { + puts "" + puts "An error occured while checking if you are root." + puts "Returning 0 for isroot check." + puts "" + return 0 + } + switch $temp { + + TRUE { return 1 } + FALSE { return 0 } + + } + + return 0 + +} + + + +## Main command loop. +## This is where we actually start :) + +puts "Enter the MAIL DB PASS:" + +if { [catch { sql connect $dbhost $dbuser $dbpass }] == 1 } { + + puts "Incorrect Mail db pass. Unable to connect" + return 0 + +} + +sql selectdb mail + +while { 1 < 2 } { + + displaymenu + + gets stdin choice + + if { $choice == "" || ![string is integer $choice] } { + puts "" + puts "Wrong input. Please retry." + puts "Press enter to continue." + puts "" + gets stdin smth + puts "" + continue + } + + switch $choice { + + 0 { break } + + 1 { continue ; addmailuser } + + 2 { continue + puts "" + puts "Enter Username to modify :" + puts "" + gets stdin username + if { [sql "SELECT id FROM passwd WHERE id='$username';"] == "" } { + + puts "Username not found in db." + puts "Press enter to continue." + gets stdin smth + continue + + } + puts "" + set encpasswd [lindex [split [exec mkpasswd]] 1] + sql "UPDATE passwd SET crypt='$encpasswd' WHERE id='$username';" + puts "" + puts "Updated password for $username." + puts "" + puts "Press enter to continue." + gets stdin smth + continue + + } + + 3 { continue } + + 5 { puts "" + puts "Enter Ip to block :" + puts "" + gets stdin ip + set ip [string map { " " "" } $ip] + puts "\n" + if { [sql "SELECT pattern FROM access_client WHERE pattern='$ip';"] != "" } { + puts "Sorry but this IP is allready in the db." + puts "" + puts "IP : [sql "SELECT pattern FROM access_client WHERE pattern='$ip';"]" + puts "Reason : [sql "SELECT action FROM access_client WHERE pattern='$ip';"]" + after 2000 + continue + } + foreach number [string map { "." " "} $ip] { + if { ![string is integer $number] } { + puts "Malformatted IP!" + puts "Aborting!" + after 2000 + continue + } + } + set temp "0" + puts "Choose what to do :\n" + puts "0. Exit this menu." + puts "1. REJECT" + puts "2. ACCEPT\n" + while { $temp == "0" } { + gets stdin action + if { ![string is integer $action] } { + puts "\nWrong input. Try again :\n" + puts "Choose what to do :\n" + puts "0. Exit this menu." + puts "1. REJECT" + puts "2. ACCEPT\n" + } else { set temp "1" } + + } + switch $action { + 0 { continue } + 1 { set action "REJECT" } + 2 { set action "OK" } + } + puts "\nReason :\n" + gets stdin reason + append reason " \[$ip.*\]" + if { [catch {sql "INSERT INTO access_client SET pattern='$ip',action='$action $reason';"}] } { + puts "An error occured adding the requested data." + puts "Aborting" + after 2000 + continue + } else { + puts "IP : $ip" + puts "Action : $action" + puts "Reason : $reason" + puts "Status : Added!" + after 4000 + continue + } + + } + 8 { puts "" + puts "Enter Ip to block :" + puts "" + gets stdin ip + puts "\n" + if { [sql "SELECT pattern FROM access_client WHERE pattern='$ip';"] != "" } { + puts "Sorry but this IP is allready in the db." + puts "" + puts "[sql "SELECT pattern FROM access_client WHERE pattern='$ip';"]" + puts "[sql "SELECT action FROM access_client WHERE pattern='$ip';"]" + after 2000 + continue + } + foreach number [string map { "." " "} $ip] { + if { ![string is integer $number] } { + puts "Malformatted IP!" + puts "Aborting!" + after 2000 + continue + } + } + set action "REJECT" + set reason "Spam is NOT welcome here. \[$ip.*\]" + if { [catch {sql "INSERT INTO access_client SET pattern='$ip',action='$action $reason';"}] } { + puts "An error occured adding the requested data." + puts "Aborting" + after 2000 + continue + } else { + puts "IP : $ip" + puts "Action : $action" + puts "Reason : $reason" + puts "Status : Added!" + after 4000 + continue + } + + } + + 6 { continue + puts "" + if { ![isroot] } { + puts "You are NOT ROOT. You require root for this option." + puts "" + after 2000 + continue + } + } + + + 7 { set data [sql "SELECT * FROM access_client ORDER BY pattern ASC;"] + set counter 0 + foreach entry $data { + puts "[format "%-20s : %s" "[lindex $entry 0]" "[lindex $entry 1]"]" + incr counter + if { $counter > 10 } { + set tempvar 0 + while { $tempvar == 0 } { + puts "Enter the IP you wish to remove or press enter to continue listing. 0 to cancel." + gets stdin temp + if { $temp == "0" } { break } + if { $temp == "" } { set counter 0 ; set tempvar 1 ; continue } + if { [ipcheck $temp 2] } { + puts "Would have removed $temp" + set tempvar 1 + } else { + puts "BAD IP" + } + after 2000 + } + } + } + } + + 9 { set data [sql "SELECT * FROM access_client ORDER BY pattern ASC;"] + set counter 0 + foreach entry $data { + puts "[format "%-20s : %s" "[lindex $entry 0]" "[lindex $entry 1]"]" + incr counter + if { $counter > 10 } { puts "Press enter to continue or 0 to stop" + gets stdin temp + if { $temp == "" } { set counter 0 } else { break } + } + + } + } + + + default { puts "This choice has not been implemented yet." + puts "Press enter to continue." + gets stdin smth + puts "" + continue } + + } + + continue + +} + + + + +catch { sql disconnect } + +puts "DISCONNECTED DB." + +return 1 + + ----------------------- End of diff ----------------------- |
From: Nex N. <ne...@us...> - 2003-07-13 20:24:21
|
Committer : nexxer CVSROOT : /cvsroot/feds Module : website Commit time: 2003-07-13 20:24:10 UTC Modified files: editaccess.php edituser.php users.php Log message: Author: Log message: ---------------------- diff included ---------------------- Index: website/editaccess.php diff -u website/editaccess.php:1.1 website/editaccess.php:1.2 --- website/editaccess.php:1.1 Fri Jul 4 12:27:14 2003 +++ website/editaccess.php Sun Jul 13 13:24:00 2003 @@ -16,13 +16,28 @@ printMenu($authed_user) ; + // printSessionInfo() ; + + // make $uid and $chan 'read-only' during our editaccess.php stay + // don't want users to play with the GET params. + if (session_is_registered("uid")) { + session_unregister("uid") ; //need to think about this + } + session_register("uid") ; + + if (session_is_registered("chan")) { + session_unregister("chan") ; + } + session_register("chan") ; + + if (!isset($uid) && !isset($chan)) { echo 'You should only call this from <a href="users.php">here</a>' ; die ; } $thisUserAccess = getChanAccess($thisuid, $chan) ; - if ($thisUserAccess < 400) { + if ($thisUserAccess < 400 && !session_is_registered("isSiteAdmin")) { echo 'You don\'t have admin access in '.$chan.'. Go to <a href="users.php"> Userlist Management</a>' ; die ; @@ -40,14 +55,14 @@ ORDER BY LEVEL desc" ; $quc_res = n_query($quc) ; if (mysql_num_rows($quc_res) == 0) { - echo 'Username '.getUserNameFromId($uid).' has no access in '.$chan ; + echo 'Username '.getUserHandleFromId($uid).' has no access in '.$chan ; die ; } $quc_obj = mysql_fetch_object($quc_res) ; $editingUserAccess = $quc_obj->LEVEL ; - if ($thisUserAccess <= $editingUserAccess) { + if ($thisUserAccess <= $editingUserAccess && !session_is_registered("isSiteAdmin")) { echo 'You should not be editing '.$quc_res->Handle.'\'s access in '.$chan.' since you have less than or equal access with him. Go <a href="users.php?submit_channel=1&chansel='.$chan.'">back</a>' ; @@ -55,17 +70,7 @@ } - // make $uid and $chan 'read-only' during our editaccess.php stay - // don't want users to play with the GET params. - if (session_is_registered("uid")) { - session_unregister("uid") ; //need to think about this - } - session_register("uid") ; - if (session_is_registered("chan")) { - session_unregister("chan") ; - } - session_register("chan") ; /* $qun = "SELECT * FROM user_table WHERE userid='".$uid."'" ; $qun_res = n_query($qun) ; @@ -82,7 +87,7 @@ echo 'You should only call this from <a href="editaccess.php?chan='.fixChan($chan).'&uid='.$uid.'">here</a>' ; die ; } - if ($newacc >= $thisUserAccess) { + if ($newacc >= $thisUserAccess && !session_is_registered("isSiteAdmin") ) { echo 'You cannot modify their access to something higher than or equal to yours. Go <a href="editaccess.php?chan='.fixChan($chan).'&uid='.$uid.'">back</a>' ; die ; @@ -143,7 +148,7 @@ ' ; //determine if we can edit the user's access level - if ($thisUserAccess > $editingUserAccess) { + if ( ($thisUserAccess > $editingUserAccess) || (session_is_registered("isSiteAdmin")) ) { $toLevel = '<tr> <td>Access:</td> <td><input type="text" name="newacc" value="'.$quc_obj->LEVEL.'" size="2"</td> Index: website/edituser.php diff -u website/edituser.php:1.10 website/edituser.php:1.11 --- website/edituser.php:1.10 Fri Jul 4 12:27:13 2003 +++ website/edituser.php Sun Jul 13 13:24:00 2003 @@ -16,6 +16,8 @@ printMenu($authed_user) ; + // printSessionInfo() ; + n_connect() ; $qun = "SELECT * FROM user_table WHERE userid='".$uid."'" ; Index: website/users.php diff -u website/users.php:1.9 website/users.php:1.10 --- website/users.php:1.9 Fri Jul 4 12:27:14 2003 +++ website/users.php Sun Jul 13 13:24:00 2003 @@ -13,39 +13,55 @@ if (session_is_registered("authed_user")) { - if (session_is_registered("isSiteAdmin") || session_is_registered("isChanAdmin")) { //admin - printMenu($authed_user) ; + if (session_is_registered("isSiteAdmin") || session_is_registered("isChanAdmin")) { //admin + printMenu($authed_user) ; + + if (session_is_registered("username")) { + session_unregister("username") ; + } + + if (session_is_registered("channel")) { + session_unregister("channel") ; + } + + if (session_is_registered("level")) { + session_unregister("level") ; + } + + if (session_is_registered("uid")) { + session_unregister("uid") ; //need to think about this + } + + // printSessionInfo() ; + + // session_register("uid") ; + + if (session_is_registered("chan")) { + session_unregister("chan") ; + } + // session_register("chan") ; + + if ($adduser) { - if (!$Submit) { + if (!$Submit) { + - if (session_is_registered("username")) { - session_unregister("username") ; - } - - if (session_is_registered("channel")) { - session_unregister("channel") ; - } - - if (session_is_registered("level")) { - session_unregister("level") ; - } - -// print_r ($_GET) ; - echo ' - <form name="form1" method="post" action="users.php?adduser=1&channel='.fixChan($_GET['channel']).'"> - <table width="500" border="0"> - <tr> - <td width="92">Username:</td> - <td width="398"><input type="text" name="username"></td> - </tr> +// print_r ($_GET) ; + echo ' + <form name="form1" method="post" action="users.php?adduser=1&channel='.fixChan($_GET['channel']).'"> + <table width="500" border="0"> + <tr> + <td width="92">Username:</td> + <td width="398"><input type="text" name="username"></td> + </tr> ' ; -/* echo '<tr> - <td>Password:</td> - <td><input type="password" name="new_pw1"> - Re-enter : - <input type="password" name="new_pw2"> - </td> - </tr> +/* echo '<tr> + <td>Password:</td> + <td><input type="password" name="new_pw1"> + Re-enter : + <input type="password" name="new_pw2"> + </td> + </tr> '; */ echo '<tr> @@ -54,93 +70,93 @@ </tr> ' ; - echo ' - <tr> - <td colspan="2"> - <input type="reset" name="reset" value="Clear"> - <input type="submit" name="Submit" value="Add user"> - </td> - </tr> - </table> - </form> + echo ' + <tr> + <td colspan="2"> + <input type="reset" name="reset" value="Clear"> + <input type="submit" name="Submit" value="Add user"> + </td> + </tr> + </table> + </form> <br><br> - <a href="users.php">User Management</a><br> + <a href="users.php">User Management</a><br> ' ; exit ; - } + } else { - if (strcmp($username, "") == 0) { - echo 'You can\'t enter an empty username. Please go - <a href=javascript:history.back(1)>back</a> and try again' ; + if (strcmp($username, "") == 0) { + echo 'You can\'t enter an empty username. Please go + <a href=javascript:history.back(1)>back</a> and try again' ; exit ; } - if (!isset($channel)) { - echo 'You need to specify a channel. Please go - <a href=javascript:history.back(1)>back</a> and try again' ; - die ; + if (!isset($channel)) { + echo 'You need to specify a channel. Please go + <a href=javascript:history.back(1)>back</a> and try again' ; + die ; } if (!isset($level)) { - echo 'You need to specify the level. Please go - <a href=javascript:history.back(1)>back</a> and try again' ; + echo 'You need to specify the level. Please go + <a href=javascript:history.back(1)>back</a> and try again' ; die ; } session_register("channel") ; session_register("level") ; - if (!isUser($username)) { - session_register("username") ; - if (!$addnewuser) { - echo 'User does not exist in the user database.<br> - Specify their CS Username, a password and the default ibc setting so they can be added: <br> - <form name="addnewuser" method="post" action="users.php?adduser=1&Submit=1"> - <table width="500" border="0"> - <tr> - <td>Password:</td> - <td><input type="password" name="new_pw1"> - Re-enter : - <input type="password" name="new_pw2"> - </td> - </tr> - <tr> - <td>IBC Default Type:</td> - <td> + if (!isUser($username)) { + session_register("username") ; + if (!$addnewuser) { + echo 'User does not exist in the user database.<br> + Specify their CS Username, a password and the default ibc setting so they can be added: <br> + <form name="addnewuser" method="post" action="users.php?adduser=1&Submit=1"> + <table width="500" border="0"> + <tr> + <td>Password:</td> + <td><input type="password" name="new_pw1"> + Re-enter : + <input type="password" name="new_pw2"> + </td> + </tr> + <tr> + <td>IBC Default Type:</td> + <td> <input type="radio" name="ibctype" value="2">Private - <input type="radio" name="ibctype" value="1" checked>Public + <input type="radio" name="ibctype" value="1" checked>Public </td> - </tr> - <tr> - <td>CS Username:</td> - <td><input type="text" name="xhandle"></td> - </tr> - - <tr> - <td> </td> - <td><input type="submit" name="addnewuser" value="Add the user"></td> - </tr> - </table> - </form> - Otherwise, if you don\'t want to add him to the database, go - <a href="users.php">back</a> - ' ; + </tr> + <tr> + <td>CS Username:</td> + <td><input type="text" name="xhandle"></td> + </tr> + + <tr> + <td> </td> + <td><input type="submit" name="addnewuser" value="Add the user"></td> + </tr> + </table> + </form> + Otherwise, if you don\'t want to add him to the database, go + <a href="users.php">back</a> + ' ; die ; } else { - if (strcmp($new_pw1, $new_pw2) != 0) { - echo 'The passwords don\'t match. Please go - <a href=javascript:history.back(1)>back</a> and try again' ; - exit ; - } - - if ( ((strcmp($new_pw1, "") == 0) || (strcmp($new_pw2, "") == 0)) && (isset($newuser)) ) { - echo 'You can\'t enter empty passwords. Please go - <a href=javascript:history.back(1)>back</a> and try again' ; - exit ; - } + if (strcmp($new_pw1, $new_pw2) != 0) { + echo 'The passwords don\'t match. Please go + <a href=javascript:history.back(1)>back</a> and try again' ; + exit ; + } + + if ( ((strcmp($new_pw1, "") == 0) || (strcmp($new_pw2, "") == 0)) && (isset($newuser)) ) { + echo 'You can\'t enter empty passwords. Please go + <a href=javascript:history.back(1)>back</a> and try again' ; + exit ; + } $qadd = "INSERT INTO user_table (`userid`,`Handle`,`XHandle`,`PASSWORD`,`login_status`,`login_web`, @@ -182,51 +198,51 @@ $qs_obj = mysql_fetch_ */ echo 'Successfully added.<br> - <a href="users.php?adduser=1&channel='.fixChan($channel).'">Add another user in '.$channel.'</a><br><br> - <a href="users.php">User Management</a><br> - ' ; - exit ; + <a href="users.php?adduser=1&channel='.fixChan($channel).'">Add another user in '.$channel.'</a><br><br> + <a href="users.php">User Management</a><br> + ' ; + exit ; } } //end adduser if ($getallusers == 1) { - if (!session_is_registered("isSiteAdmin")) { - echo 'For site admins only. Go <a href="users.php">back</a>' ; + if (!session_is_registered("isSiteAdmin")) { + echo 'For site admins only. Go <a href="users.php">back</a>' ; die ; } $qu = "SELECT * FROM user_table" ; $qu_res = n_query($qu) ; if (mysql_num_rows($qu_res) == 0) { - echo 'No users. Go <a href="users.php">back</a>' ; + echo 'No users. Go <a href="users.php">back</a>' ; die ; } echo ' - <table border="1"> - <th width="50">Userid</th> - <th width="100">Handle</th> - <th width="50">Suspended (globally)</th> - <th width="50">Web access</th> - <th width="50">Is Logged in now</th> - <th width="50">Last IP</th> - <th width="50">Web logins #</th> + <table border="1"> + <th width="50">Userid</th> + <th width="100">Handle</th> + <th width="50">Suspended (globally)</th> + <th width="50">Web access</th> + <th width="50">Is Logged in now</th> + <th width="50">Last IP</th> + <th width="50">Web logins #</th> <th width="50">IBCType</th> <th width="50">Lang ID</th> ' ; while ($qu_obj = mysql_fetch_object($qu_res)) { - echo '<tr> - <td><a href="edituser.php?uid='.$qu_obj->userid.'">'.$qu_obj->userid.'</a></td> - <td>'.$qu_obj->Handle.'</td> - <td>'.$qu_obj->suspend.'</td> - <td>'.$qu_obj->site.'</td> - <td> '.$qu_obj->login_web.'</td> - <td>'.$qu_obj->lastip_web.'</td> - <td>'.$qu_obj->numlogins_web.'</td> + echo '<tr> + <td><a href="edituser.php?uid='.$qu_obj->userid.'">'.$qu_obj->userid.'</a></td> + <td>'.$qu_obj->Handle.'</td> + <td>'.$qu_obj->suspend.'</td> + <td>'.$qu_obj->site.'</td> + <td> '.$qu_obj->login_web.'</td> + <td>'.$qu_obj->lastip_web.'</td> + <td>'.$qu_obj->numlogins_web.'</td> <td>'.$qu_obj->ibctype.'</td> <td>'.$qu_obj->langid.'</td> - </tr> - ' ; + </tr> + ' ; } echo '</table>' ; die ; @@ -248,146 +264,146 @@ if (!array_search_r($chansel, $caccesses)) { - echo 'Trying to poison the channel selection?.' ; + echo 'Trying to poison the channel selection?.' ; die ; } - if (session_is_registered("chansel")) { - session_unregister("chansel") ; + if (session_is_registered("chansel")) { + session_unregister("chansel") ; } - session_register("chansel") ; + session_register("chansel") ; $currChanId = getChanIdFromChanName($chansel) ; -// $qu = "SELECT * FROM user_table ORDER BY userid ASC" ; -/* $qu = "SELECT * - FROM ( access_table - INNER JOIN chan_table ON access_table.chanid = chan_table.chanid ) - INNER JOIN user_table ON user_table.userid = access_table.userid - WHERE chan_table.channel = '".$chansel."' ORDER BY LEVEL desc" ; +// $qu = "SELECT * FROM user_table ORDER BY userid ASC" ; +/* $qu = "SELECT * + FROM ( access_table + INNER JOIN chan_table ON access_table.chanid = chan_table.chanid ) + INNER JOIN user_table ON user_table.userid = access_table.userid + WHERE chan_table.channel = '".$chansel."' ORDER BY LEVEL desc" ; */ - $qu = "SELECT * - FROM ( access_table - INNER JOIN user_table ON user_table.userid = access_table.userid ) - WHERE access_table.chanid = '".$currChanId."' ORDER BY LEVEL desc" ; + $qu = "SELECT * + FROM ( access_table + INNER JOIN user_table ON user_table.userid = access_table.userid ) + WHERE access_table.chanid = '".$currChanId."' ORDER BY LEVEL desc" ; - $qu_res = n_query($qu) ; - $num = mysql_num_rows($qu_res) ; + $qu_res = n_query($qu) ; + $num = mysql_num_rows($qu_res) ; - if (session_is_registered("isSiteAdmin")) { + if (session_is_registered("isSiteAdmin")) { $lastIpTh = '<th width="50">Last IP (web)</th>' ; $editUser = '<th width="20">Edit User</th>' ; } else { - $lastIpTh = "" ; + $lastIpTh = "" ; $editUser = "" ; } - echo ' + echo ' <h4>Userlist for '.$chansel.'</h4> - <table border="1"> - '.$editUser.' - <th width="100">Edit Access</th> - <th width="100">Handle</th> - <th width="50">Suspended (globally)</th> - <th width="50">Web access</th> - <th width="50">Is Logged in now</th> + <table border="1"> + '.$editUser.' + <th width="80">Edit Access</th> + <th width="100">Handle</th> + <th width="50">Suspended (globally)</th> + <th width="50">Web access</th> + <th width="50">Is Logged in now</th> '.$lastIpTh.' - <th width="50">Web logins #</th> + <th width="50">Web logins #</th> <th width="50">Access</th> - ' ; + ' ; $thisUserAccess = getChanAccess($thisuid, $chansel) ; - while ($qu_obj = mysql_fetch_object($qu_res)) { + while ($qu_obj = mysql_fetch_object($qu_res)) { - if ($thisUserAccess > $qu_obj->LEVEL) { - $editAccLnk = '<td><a href="editaccess.php?chan='.fixChan($chansel). - '&uid='.$qu_obj->userid.'">'.$qu_obj->userid.'</a></td>' ; + if ($thisUserAccess > $qu_obj->LEVEL || session_is_registered("isSiteAdmin") ) { + $editAccLnk = '<td><a href="editaccess.php?chan='.fixChan($chansel). + '&uid='.$qu_obj->userid.'">Edit</a></td>' ; } else { - $editAccLnk = "<td> </td>" ; + $editAccLnk = "<td> </td>" ; } //isSiteAdmin is set per session, so no need to check on each row. need to //rethink this if (session_is_registered("isSiteAdmin")) { - $editUserLnk = '<td><a href="edituser.php?uid='.$qu_obj->userid.'">'.$qu_obj->userid.'</a></td>' ; + $editUserLnk = '<td><a href="edituser.php?uid='.$qu_obj->userid.'">Edit</a></td>' ; } else { - $editUserLnk = "" ; + $editUserLnk = "" ; } - $lastIp = showLastIp($qu_obj->lastip_web) ; + $lastIp = showLastIp($qu_obj->lastip_web) ; - echo '<tr> - '.$editUserLnk.' - '.$editAccLnk.' - <td>'.$qu_obj->Handle.'</td> - <td>'.$qu_obj->suspend.'</td> - <td>'.$qu_obj->site.'</td> - <td> '.$qu_obj->login_web.'</td> - '.$lastIp.' - <td>'.$qu_obj->numlogins_web.'</td> + echo '<tr> + '.$editUserLnk.' + '.$editAccLnk.' + <td>'.$qu_obj->Handle.'</td> + <td>'.$qu_obj->suspend.'</td> + <td>'.$qu_obj->site.'</td> + <td> '.$qu_obj->login_web.'</td> + '.$lastIp.' + <td>'.$qu_obj->numlogins_web.'</td> <td>'.$qu_obj->LEVEL.'</td> - </tr> - ' ; - } - echo "</table>" ; + </tr> + ' ; + } + echo "</table>" ; $channelchk = fixChan($chansel) ; - echo '<br><br> - <a href="users.php?adduser=1&channel='.$channelchk.'">Add a user in '.$chansel.'</a><br><br> - ' ; + echo '<br><br> + <a href="users.php?adduser=1&channel='.$channelchk.'">Add a user in '.$chansel.'</a><br><br> + ' ; session_unregister("chansel") ; } //channel selection - else { //show available channels to edit userlist - $caccesses = getAllChansWithAdminAccess($thisuid, "channel") ; +// else { } //show available channels to edit userlist + $caccesses = getAllChansWithAdminAccess($thisuid, "channel") ; - // print_r($caccesses) ; +// print_r($caccesses) ; - if ($caccesses == -1) { - echo 'No channels defined.' ; - die ; - } - if ($caccesses == 0) { - echo 'You don\'t have admin access in any channel.' ; - die ; - } - session_register("caccesses") ; //to verify the selection against. - - echo 'Edit the userlist for ' ; - echo '<form name="chanselect" method="post" action="users.php"> - <select name="chansel">' ; - - foreach ($caccesses as $e) { - echo '<option value="'.$e.'">'.$e ; - } - - echo '</select> - <input type="submit" value="Get Userlist" name="submit_channel"> - </form> - ' ; - - - if (session_is_registered("isSiteAdmin")) { - echo '<a href="users.php?getallusers=1">Edit complete membership</a>' ; - } + if ($caccesses == -1) { + echo 'No channels defined.' ; + die ; } - } //is admin ? + if ($caccesses == 0) { + echo 'You don\'t have admin access in any channel.' ; + die ; + } + session_register("caccesses") ; //to verify the selection against. + + echo 'Edit the userlist for ' ; + echo '<form name="chanselect" method="post" action="users.php"> + <select name="chansel">' ; + + foreach ($caccesses as $e) { + echo '<option value="'.$e.'">'.$e ; + } + + echo '</select> + <input type="submit" value="Get Userlist" name="submit_channel"> + </form> + ' ; + + + if (session_is_registered("isSiteAdmin")) { + echo '<a href="users.php?getallusers=1">Edit complete membership</a>' ; + } + + } //is admin ? else { echo 'Access denied.' ; } } else { - echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; + echo 'You\'re not logged in. Please login <a href="index.php">here</a>' ; } echo '</body></html>' ; ----------------------- End of diff ----------------------- |