Annotation of kcms/src/user.php, revision 1.1

1.1     ! kanaco      1: <?php
        !             2: /*
        !             3: +---------------------------------------------------------------+
        !             4: |        kCMS 0.1.4
        !             5: |        /user.php
        !             6: |
        !             7: |        kCMS.Kanaco.Com
        !             8: |        optiK@kcms.kanaco.com
        !             9: |
        !            10: |        
        !            11: |        
        !            12: |
        !            13: |   $Source: /cvsroot/kCMSuser.php,v $
        !            14: |   $Revision: 1.15 $
        !            15: |   $Date: 2004/09/07 12:30:55 $
        !            16: |   $Author: optiK_kCMS $
        !            17: +---------------------------------------------------------------+
        !            18: */
        !            19: require_once("set.php");
        !            20: 
        !            21: if(strstr(e_QUERY, "delp")){
        !            22:        $tmp = explode(".", e_QUERY);
        !            23:        if(USERID == $tmp[1] || (ADMIN && getperms("4"))){
        !            24:                $sql -> db_Select("user", "user_sess", "user_id='". USERID."'");
        !            25:                $row = $sql -> db_Fetch(); extract($row);
        !            26:                @unlink(e_FILE."public/avatars/".$user_sess);
        !            27:                $sql -> db_Update("user", "user_sess='' WHERE user_id=".$tmp[1]);
        !            28:                header("location:".e_SELF."?id.".$tmp[1]);
        !            29:                exit;
        !            30:        }
        !            31: }
        !            32: 
        !            33: require_once(HEADERF);
        !            34: 
        !            35: if(!USER){
        !            36:        $ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_416."</div>");
        !            37:        require_once(FOOTERF);
        !            38:        exit;
        !            39: }
        !            40: 
        !            41: if(IsSet($_POST['records'])){
        !            42:        $records = $_POST['records'];
        !            43:        $order = $_POST['order'];
        !            44:        $from = 0;
        !            45: }else if(!e_QUERY){
        !            46:        $records = 20;
        !            47:        $from = 0;
        !            48:        $order="DESC";
        !            49: }else{
        !            50: $qs = explode(".", e_QUERY);
        !            51: if($qs[0] == "id"){
        !            52:        $id = $qs[1];
        !            53: }else{
        !            54: $qs = explode(".", e_QUERY);
        !            55: $from = $qs[0];
        !            56: $records = $qs[1];
        !            57: $order = $qs[2];
        !            58: }
        !            59: }
        !            60: if($records >30){ $records = 30; }
        !            61: 
        !            62: 
        !            63: if(IsSet($id)){
        !            64: 
        !            65:        if($id == 0){
        !            66:                $text = "<div style='text-align:center'>".LAN_137." ".SITENAME."</div>";
        !            67:                $ns -> tablerender("<div style='text-align:center'>".LAN_20."</div>", $text);
        !            68:                require_once(FOOTERF);
        !            69:                exit;
        !            70:        }
        !            71: 
        !            72:        if(!$sql -> db_Select("user", "*", "user_id='".$id."' ")){
        !            73:                $text = "<div style='text-align:center'>".LAN_400."</div>";
        !            74:                $ns -> tablerender("<div style='text-align:center'>".LAN_20."</div>", $text);
        !            75:                require_once(FOOTERF);
        !            76:                exit;
        !            77:        }
        !            78: 
        !            79:        $text = renderuser($sql -> db_Fetch());
        !            80:        $ns -> tablerender("<div style='text-align:center'>".LAN_402."</div>", $text);
        !            81:        require_once(FOOTERF);
        !            82:        exit;
        !            83: }
        !            84: 
        !            85: $users_total = $sql -> db_Count("user");
        !            86: $text = "<div style='text-align:center'>
        !            87: ".LAN_138." ".$users_total."<br /><br />
        !            88: <form method='post' action='".e_SELF."'>
        !            89: <p>
        !            90: ".LAN_419.": ";
        !            91: 
        !            92: if($records == 10){
        !            93:        $text .= "<select name='records' class='tbox'>
        !            94:        <option value='10' selected='selected'>10</option>
        !            95:        <option value='20'>20</option>
        !            96:        <option value='30'>30</option>
        !            97:        </select>  ";
        !            98: }else if($records == 20){
        !            99:        $text .= "<select name='records' class='tbox'>
        !           100:        <option value='10'>10</option>
        !           101:        <option value='20' selected='selected'>20</option>
        !           102:        <option value='30'>30</option>
        !           103:        </select>  ";
        !           104: }else{
        !           105: $text .= "<select name='records' class='tbox'>
        !           106: <option value='10'>10</option>
        !           107: <option value='20'>20</option>
        !           108: <option value='30' selected='selected'>30</option>
        !           109: </select>  ";
        !           110: }
        !           111: $text .= LAN_139;
        !           112: 
        !           113: if($order == "ASC"){
        !           114:        $text .= "<select name='order' class='tbox'>
        !           115:        <option value='DESC'>".LAN_420."</option>
        !           116:        <option value='ASC' selected='selected'>".LAN_421."</option>
        !           117:        </select>";
        !           118: }else{
        !           119: $text .= "<select name='order' class='tbox'>
        !           120: <option value='DESC' selected='selected'>".LAN_420."</option>
        !           121: <option value='ASC'>".LAN_421."</option>
        !           122: </select>";
        !           123: }
        !           124: 
        !           125: $text .= " <input class='button' type='submit' name='submit' value='".LAN_422."' />
        !           126: <input type='hidden' name='from' value='$from' />
        !           127: </p>
        !           128: </form>\n\n<br /><br />";
        !           129: 
        !           130: 
        !           131: 
        !           132: if(!$sql -> db_Select("user", "*",  "ORDER BY user_id $order LIMIT $from,$records", $mode="no_where")){
        !           133:        echo "<div style='text-align:center'><b>".LAN_141."</b></div>";
        !           134: }else{
        !           135: $sql2 = new db;
        !           136: if($sql2 -> db_Select("core", " kCMS_value", " kCMS_name='user_entended'")){
        !           137:        $row = $sql2 -> db_Fetch();
        !           138:        $user_entended = unserialize($row[0]);
        !           139: }
        !           140: 
        !           141: $text .= "
        !           142: <table style='width:95%' class='fborder'>
        !           143: <tr>
        !           144: <td class='fcaption' style='width:2%'>&nbsp;</td>
        !           145: <td class='fcaption' style='width:20%'>".LAN_142."</td>
        !           146: <td class='fcaption' style='width:20%'>".LAN_112."</td>
        !           147: <td class='fcaption' style='width:20%'>".LAN_145."</td>
        !           148: </tr>";
        !           149: 
        !           150: while($row = $sql -> db_Fetch()){
        !           151:        $text .= renderuser($row, $user_entended, "short");
        !           152: }
        !           153: 
        !           154: $text .= "</table>\n</div>";
        !           155: 
        !           156: }
        !           157: 
        !           158: $ns -> tablerender("<div style='text-align:center'>".LAN_140."</div>", $text);
        !           159: 
        !           160: require_once(e_HANDLER."np_class.php");
        !           161: $ix = new nextprev("user.php", $from, $records, $users_total, LAN_138, $records.".".$order);
        !           162: 
        !           163: function renderuser($row, $user_entended, $mode="verbose"){
        !           164: 
        !           165:        global $sql, $id, $pref;
        !           166:        extract($row);
        !           167:        $aj = new textparse;
        !           168:        $gen = new convert;
        !           169:        $pm_installed = ($pref['pm_title'] ? TRUE : FALSE);
        !           170:        if($mode != "verbose"){
        !           171:                $datestamp = $gen->convert_date($user_join, "short");
        !           172:                return "
        !           173:                <tr>
        !           174:                <td class='forumheader3' style='width:2%'><a href='".e_SELF."?id.$user_id'><img src='".e_IMAGE."generic/user.png' alt='' style='border:0' /></a></td>
        !           175:                <td class='forumheader' style='width:20%'>".$user_id.": <a href='".e_SELF."?id.$user_id'>".$user_name."</a></td>
        !           176:                <td class='forumheader3' style='width:20%'>".($user_hideemail && !ADMIN ? "<i>".LAN_143."</i>" : "<a href='mailto:".$user_email."'>".$user_email."</a>")."</td>
        !           177:                <td class='forumheader3' style='width:20%'>$datestamp</td>
        !           178:                </tr>";
        !           179:        }else{
        !           180:        $user_data = $user_id.".".$user_name;
        !           181:        $chatposts = $sql -> db_Count("chatbox");
        !           182:        $commentposts = $sql -> db_Count("comments");
        !           183:        $forumposts = $sql -> db_Count("forum_t");
        !           184:        $actual_forums = $sql -> db_Count("forum_t", "(*)", "WHERE thread_user='$user_data'");
        !           185:        $actual_chats = $sql -> db_Count("chatbox", "(*)", "WHERE cb_nick='$user_data'");
        !           186:        $actual_comments = $sql -> db_Count("comments", "(*)", "WHERE comment_author='$user_data'");
        !           187:        $chatper = round(($actual_chats/$chatposts)*100,2);
        !           188:        $commentper = round(($actual_comments/$commentposts)*100,2);
        !           189:        $forumper = round(($actual_forums/$forumposts)*100,2);
        !           190:        require_once(e_HANDLER."level_handler.php");
        !           191: 
        !           192:        $ldata = get_level($user_id, $user_forums, $user_comments, $user_chats, $user_visits, $user_join, $user_admin, $user_perms, $pref);
        !           193: 
        !           194:        if(strstr($ldata[0], "IMAGE_rank_main_admin_image")){
        !           195:                $level = LAN_417;
        !           196:        }else if(strstr($ldata[0], "IMAGE")){
        !           197:                $level = LAN_418;
        !           198:        }else{
        !           199:        $level = $ldata[1];
        !           200: }
        !           201: 
        !           202: $datestamp = $gen->convert_date($user_join, "long");
        !           203: $lastvisit = ($user_currentvisit ? $gen->convert_date($user_currentvisit, "long") : "<i>".LAN_401."</i>");
        !           204: $daysregged = max(1, round((time() - $user_join)/86400))." ".LAN_405;
        !           205: $str = "
        !           206: <div style='text-align:center'>
        !           207: <table style='width:95%' class='fborder'>
        !           208: <tr><td colspan='2' class='fcaption' style='text-align:center'>".LAN_142." ".$user_id.": ".$user_name."</td></tr>
        !           209: <tr><td rowspan='".($pm_installed && $id != USERID ? 10 : 9)."' class='forumheader3' style='width:20%; vertical-align:middle; text-align:center'>";
        !           210: 
        !           211: if($user_sess && file_exists(e_FILE."public/avatars/".$user_sess)){
        !           212:        $str .= "<img src='".e_FILE."public/avatars/".$user_sess."' alt='' />";
        !           213: 
        !           214:        if(ADMIN && getperms("4")){
        !           215:                $str .= "<br /><span class='smalltext'>".$user_sess."</span>";
        !           216:        }
        !           217: 
        !           218:        if(USERID == $user_id || (ADMIN && getperms("4"))){
        !           219:                $str .= "<br /><br /><span class='smalltext'>[ <a href='".e_SELF."?delp.$user_id'>".LAN_413."</a> ]</span>";
        !           220:        }
        !           221: 
        !           222: }else{
        !           223: $str .= LAN_408;
        !           224: }
        !           225: 
        !           226: 
        !           227: $str .= "</td></tr>
        !           228: 
        !           229: <tr>
        !           230: <td style='width:80%' class='forumheader3'>
        !           231: <table style='width:100%'><tr><td style='width:30%'><img src='".e_IMAGE."generic/rname.png' alt='' style='vertical-align:middle' /> ".LAN_308."</td><td style='width:70%; text-align:right'>".($user_login ? $user_login : "<i>".LAN_401."</i>")."</td></tr></table>
        !           232: </td></tr>
        !           233: 
        !           234: <tr>
        !           235: <td style='width:80%' class='forumheader3'>
        !           236: <table style='width:100%'><tr><td style='width:30%'><img src='".e_IMAGE."generic/email.png' alt='' style='vertical-align:middle' /> ".LAN_112."</td><td style='width:70%; text-align:right'>".($user_hideemail && !ADMIN ? "<i>".LAN_143."</i>" : $user_email)."</td></tr></table>
        !           237: </td></tr>
        !           238: 
        !           239: <tr>
        !           240: <td style='width:80%' class='forumheader3'>
        !           241: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/icq.png' alt=''  style='vertical-align:middle' /> ".LAN_115."</td><td style='width:70%; text-align:right'>".($user_icq ? $user_icq : "<i>".LAN_401."</i>")."</td></tr></table>
        !           242: </td></tr>
        !           243: 
        !           244: <tr>
        !           245: <td style='width:80%' class='forumheader3'>
        !           246: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/aim.png' alt=''  style='vertical-align:middle' /> ".LAN_116."</td><td style='width:70%; text-align:right'>".($user_aim ? $aj -> tpa($user_aim) : "<i>".LAN_401."</i>")."</td></tr></table>
        !           247: </td></tr>
        !           248: 
        !           249: <tr>
        !           250: <td style='width:80%' class='forumheader3'>
        !           251: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/msn.png' alt=''  style='vertical-align:middle' /> ".LAN_117."</td><td style='width:70%; text-align:right'>".($user_msn ? $aj -> tpa($user_msn) : "<i>".LAN_401."</i>")."</td></tr></table>
        !           252: </td></tr>
        !           253: 
        !           254: <tr>
        !           255: <td style='width:80%' class='forumheader3'>
        !           256: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/hme.png' alt=''  style='vertical-align:middle' /> ".LAN_144."</td><td style='width:70%; text-align:right'>".($user_homepage ? "<a href='".$user_homepage."' rel='external'>$user_homepage</a>" : "<i>".LAN_401."</i>")."</td></tr></table>
        !           257: </td></tr>
        !           258: 
        !           259: <tr>
        !           260: <td style='width:80%' class='forumheader3'>
        !           261: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/location.png' alt=''  style='vertical-align:middle' /> ".LAN_119."</td><td style='width:70%; text-align:right'>".($user_location ? $aj -> tpa($user_location) : "<i>".LAN_401."</i>")."</td></tr></table>
        !           262: </td></tr>";
        !           263: 
        !           264: if($user_birthday != "" && $user_birthday != "0000-00-00" && ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $user_birthday, $regs)){
        !           265:        $user_birthday = "$regs[3].$regs[2].$regs[1]";
        !           266: }else{
        !           267: $user_birthday = "<i>".LAN_401."</i>";
        !           268: }
        !           269: 
        !           270: $str .= "<tr><td style='width:80%' class='forumheader3'>
        !           271: <table style='width:100%'><tr><td style='width:30%'> <img src='".e_IMAGE."generic/bday.png' alt=''  style='vertical-align:middle' /> ".LAN_118."</td><td style='width:70%; text-align:right'>$user_birthday</td></tr></table>
        !           272: </td></tr>";
        !           273: 
        !           274: if($pm_installed && $id != USERID){
        !           275:        $str .= "
        !           276:        <tr>
        !           277:        <td style='width:80%' class='forumheader3' colspan='2'>
        !           278:        <table style='width:100%'><tr><td style='width:30%'> ".kCMS_parse("{CODE=pm_menu.sendpm.{$id}}")." ".LAN_425."</td></tr></table>
        !           279:        </td></tr>";
        !           280: }
        !           281: 
        !           282: $str .= ($user_signature ? "<tr><td colspan='2' class='forumheader3' style='text-align:center'><i>".$aj -> tpa($user_signature)."</i></td></tr>" : "");
        !           283: 
        !           284: 
        !           285: 
        !           286: //        extended fields ...
        !           287: 
        !           288: if($sql -> db_Select("core", " kCMS_value", " kCMS_name='user_entended'")){
        !           289: 
        !           290:        // added by cam
        !           291:        require_once(e_HANDLER."user_extended.php");
        !           292: 
        !           293:        $row = $sql -> db_Fetch();
        !           294:        $user_entended = unserialize($row[0]);
        !           295: 
        !           296:        $str .= "<tr><td colspan='2' class='forumheader'>".LAN_410."</td></tr>";
        !           297: 
        !           298:        $user_prefs = unserialize($user_prefs);
        !           299: 
        !           300:        while(list($key, $u_entended) = each($user_entended)){
        !           301:                $ut = explode("|", $u_entended);
        !           302:                if(!$ut[5] || check_class($ut[5])==TRUE){
        !           303:                        $str .= "<tr><td style='width:40%' class='forumheader3'>".user_extended_name($u_entended)."</td>
        !           304:                        <td style='width:60%' class='forumheader3'>".($user_prefs["ue_{$key}"] ? $user_prefs["ue_{$key}"] : "<i>".LAN_401."</i>")."</td></tr>";
        !           305:                }
        !           306:        }
        !           307: }
        !           308: 
        !           309: 
        !           310: 
        !           311: 
        !           312: //        end extended fields
        !           313: 
        !           314: $str .= "<tr><td colspan='2' class='forumheader'>".LAN_403."</td></tr>
        !           315: 
        !           316: <tr>
        !           317: <td style='width:30%' class='forumheader3'>".LAN_145."</td>
        !           318: <td style='width:70%' class='forumheader3'>$datestamp ( $daysregged )</td>
        !           319: </tr>
        !           320: 
        !           321: <tr>
        !           322: <td style='width:30%' class='forumheader3'>".LAN_147."</td>
        !           323: <td style='width:70%' class='forumheader3'>$user_chats ( ".$chatper."% )</td>
        !           324: </tr>
        !           325: 
        !           326: <tr>
        !           327: <td style='width:30%' class='forumheader3'>".LAN_148."</td>
        !           328: <td style='width:70%' class='forumheader3'>$user_comments ( ".$commentper."% )</td>
        !           329: </tr>";
        !           330: 
        !           331: if($user_comments){
        !           332:        $str .= "
        !           333:        <tr>
        !           334:        <td colspan='2' class='forumheader3'><a href='".e_BASE."userposts.php?0.comments.".$user_id."'>".LAN_423."</a></td>
        !           335:        </tr>";
        !           336: }
        !           337: $str .= "
        !           338: 
        !           339: <tr>
        !           340: <td style='width:30%' class='forumheader3'>".LAN_149."</td>
        !           341: <td style='width:70%' class='forumheader3'>$user_forums ( ".$forumper."% )</td>
        !           342: </tr>";
        !           343: 
        !           344: if($user_forums){
        !           345:        $str .= "
        !           346:        <tr>
        !           347:        <td colspan='2' class='forumheader3'><a href='".e_BASE."userposts.php?0.forums.".$user_id."'>".LAN_424."</a></td>
        !           348:        </tr>";
        !           349: }
        !           350: $str .= "
        !           351: 
        !           352: <tr>
        !           353: <td style='width:30%' class='forumheader3'>".LAN_146."</td>
        !           354: <td style='width:70%' class='forumheader3'>$user_visits</td>
        !           355: </tr>
        !           356: 
        !           357: <tr>
        !           358: <td style='width:30%' class='forumheader3'>".LAN_404."</td>
        !           359: <td style='width:70%' class='forumheader3'>$lastvisit</td>
        !           360: </tr>
        !           361: 
        !           362: <tr>
        !           363: <td style='width:30%' class='forumheader3'>".LAN_406."</td>
        !           364: <td style='width:70%' class='forumheader3'>$level</td>
        !           365: </tr>";
        !           366: 
        !           367: if(USERID == $user_id){
        !           368:        $str .= "<tr><td colspan='2' class='forumheader3' style='text-align:center'><a href='".e_BASE."usersettings.php'>".LAN_411."</a></td></tr>";
        !           369: }else if(ADMIN && getperms("4") && !$user_admin){
        !           370:        $str .= "<tr><td colspan='2' class='forumheader3' style='text-align:center'><a href='".e_BASE."usersettings.php?".$user_id."'>".LAN_412."</a></td></tr>";
        !           371: }
        !           372: 
        !           373: $sql -> db_Select("user", "user_id, user_name",  "ORDER BY user_id ASC", "no-where");
        !           374: $c = 0;
        !           375: while($row = $sql -> db_Fetch()){
        !           376:        $array[$c]['id'] = $row['user_id'];
        !           377:        $array[$c]['name'] = $row['user_name'];
        !           378:        if($row['user_id'] == $id){
        !           379:                $prevuser['id'] = $array[$c-1]['id'];
        !           380:                $prevuser['name'] = $array[$c-1]['name'];
        !           381:                $row = $sql -> db_Fetch();
        !           382:                $nextuser['id'] = $row['user_id'];
        !           383:                $nextuser['name'] = $row['user_name'];
        !           384:                break;
        !           385:        }
        !           386:        $c++;
        !           387: }
        !           388: 
        !           389: $str .= "<tr><td colspan='2' class='forumheader3' style='text-align:center'>
        !           390: <table style='width:95%'>
        !           391: <tr>
        !           392: <td style='width:50%'>".($prevuser['id'] ? "&lt;&lt; ".LAN_414." [ <a href='".e_SELF."?id.".$prevuser['id']."'>".$prevuser['name']."</a> ]" : "&nbsp;")."</td>
        !           393: <td style='width:50%; text-align:right'>".($nextuser['id'] ? "[ <a href='".e_SELF."?id.".$nextuser['id']."'>".$nextuser['name']."</a> ] ".LAN_415." &gt;&gt;" : "&nbsp;")."</td>
        !           394: </tr>
        !           395: </table>
        !           396: </td>
        !           397: </tr>";
        !           398: $str .= "</table></div>";
        !           399: return $str;
        !           400: }
        !           401: }
        !           402: 
        !           403: require_once(FOOTERF);
        !           404: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>