Exemplo n.º 1
0
     getResult("REPLACE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `ID`='" . $sId . "', `Nick`='" . $sNick . "', `Sex`='" . $sSex . "', `Age`='" . $sAge . "', `Desc`='" . $sDesc . "', `Photo`='" . $sPhoto . "', `Profile`='" . $sProfileUrl . "', `Start`='" . $iCurrentTime . "', `When`='" . $iCurrentTime . "', `Status`='" . USER_STATUS_NEW . "'");
     getResult("DELETE FROM `" . MODULE_DB_PREFIX . "RoomsUsers` WHERE `User`='" . $sId . "'");
     $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL);
     $sContents .= parseXml(array(2 => '<user photo="#1#" profile="#2#" />'), $sPhoto, $sProfileUrl);
     break;
     /**
      * Authorize user.
      */
 /**
  * Authorize user.
  */
 case 'userAuthorize':
     if (loginAdmin($sId, $sPassword) == TRUE_VAL) {
         $aUserInfo = getUserInfo($sId, true);
         $aUser = array('id' => $aUserInfo['id'], 'nick' => $aUserInfo['nick'], 'sex' => $aUserInfo['sex'], 'age' => $aUserInfo['age'], 'desc' => $aUserInfo['desc'], 'photo' => $aUserInfo['photo'], 'profile' => $aUserInfo['profile'], 'type' => CHAT_TYPE_ADMIN);
     } elseif (loginUser($sId, $sPassword) == TRUE_VAL && ($bBanned = doBan("check", $sId)) != TRUE) {
         $aUser = getUserInfo($sId);
         $aUser['id'] = $sId;
         $aUser['sex'] = $aUser['sex'] == 'female' ? "F" : "M";
         $aUser['type'] = isUserAdmin($sId) ? CHAT_TYPE_ADMIN : CHAT_TYPE_FULL;
     } else {
         $sContents = parseXml($aXmlTemplates['result'], $bBanned ? "msgBanned" : "msgUserAuthenticationFailure", FAILED_VAL);
         break;
     }
     $aUser = initUser($aUser);
     $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL);
     $sContents .= parseXml($aXmlTemplates['user'], $aUser['id'], USER_STATUS_NEW, $aUser['nick'], $aUser['sex'], $aUser['age'], $aUser['desc'], $aUser['photo'], $aUser['profile'], $aUser['type'], USER_STATUS_ONLINE);
     break;
 case 'banUser':
     $sBanned = isset($_REQUEST["banned"]) ? process_db_input($_REQUEST['banned']) : FALSE_VAL;
     $sUserId = getValue("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Profiles` WHERE `ID` = '" . $sId . "' LIMIT 1");
             $sType = getValue("SELECT `Type` FROM `" . MODULE_DB_PREFIX . "Profiles` WHERE `ID`='" . $sId . "'");
         }
         $sContents .= parseXml($aXmlTemplates['user'], $sId, $aUserInfo['nick'], $aUserInfo['sex'], $aUserInfo['age'], $aUserInfo['desc'], $aUserInfo['photo'], $aUserInfo['profile'], $sType, doBan('check', $sId));
     } else {
         $sContents .= parseXml($aXmlTemplates['result'], FALSE_VAL);
     }
     break;
     /**
      * Ban/unban user by specified ID.
      */
 /**
  * Ban/unban user by specified ID.
  */
 case 'banUser':
     if ($bAdmin && loginAdmin($sNick, $sPassword) || !$bAdmin && loginUser($sModeratorId, $sPassword) && getUserType($sModeratorId) == CHAT_TYPE_MODER) {
         doBan($sParamValue == TRUE_VAL ? 'ban' : 'unban', $sId);
         $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL);
     } else {
         $sContents = parseXml($aXmlTemplates['result'], FALSE_VAL);
     }
     break;
     /**
      * Changes user's type.
      */
 /**
  * Changes user's type.
  */
 case 'changeType':
     if (loginAdmin($sNick, $sPassword)) {
         getResult("UPDATE `" . MODULE_DB_PREFIX . "Profiles` SET `Type`='" . $sType . "' WHERE `ID`='" . $sId . "'");
         //--- For XML version only ---//