Пример #1
0
 function Login($id, $username, $password)
 {
     $active = false;
     $user = new User();
     $user->SetDatabase($this->database);
     $user->SetUsername($username);
     $user->SetPassword($password);
     if ($id == "") {
         $user->Encrypt($password);
     } else {
         $user->SetEncryptedPassword($password);
     }
     $this->logged_in = false;
     if ($user->UserExists()) {
         if ($user->CheckPassword()) {
             $this->logged_in = true;
             $user->SelectByName();
         }
     }
     if ($this->logged_in) {
         if ($user->GetUsername() == "guest") {
             $this->logged_in = false;
         }
         if ($id != "") {
             $this->SetId($id);
             $this->SelectById();
             $this->SetUser($user->GetId());
             if ($this->Update()) {
                 $this->UnsetCookie();
                 $this->SetCookie($user->GetUsername());
             }
             if ($this->GetActive()) {
                 $active = true;
             }
         }
         if (!$active) {
             $this->SetDateStart(date('Y-m-d H:i:s'));
             $this->SetDateLast(date('Y-m-d H:i:s'));
             $this->SetActive(1);
             $this->SetIp($_SERVER['REMOTE_ADDR']);
             $this->SetUser($user->GetId());
             if ($this->Insert()) {
                 $this->UnsetCookie();
                 $this->SetCookie($user->GetUsername());
                 return $this->id;
             }
         } else {
             $this->SetDateLast(date('Y-m-d H:i:s', time()));
             $this->Update();
             return $this->id;
         }
     }
     $this->logged_in = false;
     return false;
 }
 /**
  * Checks if user is the founder
  *
  * @return boolean
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 protected function isFounder()
 {
     $this->app->wf->ProfileIn(__METHOD__);
     $wiki = F::build('WikiFactory', array($this->app->wg->CityId), 'getWikiById');
     if (intval($wiki->city_founding_user) === $this->user->GetId()) {
         // mech: BugId 18248
         $founder = $this->isUserInGroup(self::WIKIA_GROUP_SYSOP_NAME) || $this->isUserInGroup(self::WIKIA_GROUP_BUREAUCRAT_NAME);
         $this->app->wf->ProfileOut(__METHOD__);
         return $founder;
     }
     $this->app->wf->ProfileOut(__METHOD__);
     return false;
 }
Пример #3
0
     $usif_nick = $usif_first_name;
 }
 $user = new User();
 $user->SetDatabase($database);
 $user->SetUsername($user_username);
 $user->SetPassword($user_password1);
 $user->SetActive(0);
 $user->Insert();
 $user->SelectByName();
 $user_info = new UserInfo();
 $user_info->SetDatabase($database);
 $user_info->SetFirstName($usif_first_name);
 $user_info->SetLastName($usif_last_name);
 $user_info->SetNick($usif_nick);
 $user_info->SetEmail($usif_email);
 $user_info->SetUser($user->GetId());
 if ($user_info->Insert()) {
     $message_position = 8;
     $message = $screen_module_name . " incluídas com sucesso. Aguarde a ativação do usuário pelo administrador.";
     $usif_id = "";
     $usif_first_name = "";
     $usif_last_name = "";
     $usif_nick = "";
     $usif_email = "";
     $usif_user_id = "";
     $user_username = "";
     $user_password1 = "";
     $user_password2 = "";
 } else {
     $message_position = 8;
     $message = "Problemas na operação.";
Пример #4
0
 function GetUserId()
 {
     $user = new User();
     $user->SetDatabase($this->database);
     $user->SetUsername($this->username);
     $user->SetPassword($this->password);
     $user->Encrypt();
     if ($user->SelectByName()) {
         return $user->GetId();
     } else {
         return 0;
     }
 }
Пример #5
0
 * Last Updated: September 18, 2007
 */
$module_name = "shout_page";
require '../../schifers/constants/cdConstants.php';
require '../../' . $WEB_SITE . 'src/cdDatabase.php';
require '../../' . $WEB_SITE . 'src/cdDate.php';
require '../../' . $WEB_SITE . 'src/cdShout.php';
require '../../' . $WEB_SITE . 'src/cdUser.php';
require '../../' . $WEB_SITE . 'src/cdSession.php';
require '../../' . $WEB_SITE . 'src/cdGuardian.php';
$screen_module_name = "Grito da Galera";
$user_tmp = new User();
$user_tmp->SetDatabase($database);
$user_tmp->SetUsername($guardian->GetUsername());
$user_tmp->SelectByName();
$user_id_tmp = $user_tmp->GetId();
if (isset($_POST["p_action"])) {
    $action = $_POST["p_action"];
    $shou_id = $_POST["p_shou_id"];
    $shou_date = $_POST["p_shou_date"];
    $shou_text = $_POST["p_shou_text"];
    $shou_user_id = $_POST["p_shou_user_id"];
    $message = "";
    if ($action == 1) {
        $date = new Date();
        $date->SetConverted($shou_date);
        $date->ConvertToFullDate();
        $shout = new Shout();
        $shout->SetDatabase($database);
        $shout->SetDate($date->GetDate());
        $shout->SetText($shou_text);
Пример #6
0
require '../../' . $WEB_SITE . 'src/cdGuardian.php';
$screen_module_name = "Usuário";
if (isset($_POST["p_action"])) {
    $action = $_POST["p_action"];
    $user_id = $_POST["p_user_id"];
    $user_username = $_POST["p_user_username"];
    $user_password1 = $_POST["p_user_password1"];
    $user_password2 = $_POST["p_user_password2"];
    $user_active = $_POST["p_user_active"];
    $message = "";
    if ($action == 1) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetId($user_id);
        $user->SelectById();
        $user_id = $user->GetId();
        $user_username = $user->GetUsername();
        $user_active = $user->GetActive();
        if ($user_id == "") {
            $message = $screen_module_name . " não encontrado.";
            $user_id = "";
            $user_username = "";
            $user_password1 = "";
            $user_password2 = "";
            $user_active = "";
        }
    }
    if ($action == 2) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetUsername($user_username);
 /**
  * Saves personal information about a user
  * @param User $user
  * @return void
  */
 public function SavePersonalInfo(User $user)
 {
     # Prepare filter
     require_once 'text/bad-language-filter.class.php';
     $language = new BadLanguageFilter();
     $users = $this->GetSettings()->GetTable('User');
     $s_sql = 'UPDATE ' . $users . ' SET ' . 'date_changed = ' . gmdate('U') . ', ' . "gender = " . ($user->GetGender() ? $this->SqlString($user->GetGender()) : "NULL") . ", " . "occupation = " . $this->SqlString($language->Filter($user->GetOccupation())) . ", " . "interests = " . $this->SqlHtmlString($language->Filter($user->GetInterests())) . ", " . "location = " . $this->SqlString($language->Filter($user->GetLocation())) . " " . 'WHERE user_id = ' . Sql::ProtectNumeric($user->GetId(), false);
     $this->Lock(array($users));
     $this->GetDataConnection()->query($s_sql);
     $this->Unlock();
 }