public function postAdminAccount() { $data = Input::all(); //return View::make('install.done'); try { $user = Sentry::createUser(array('email' => $data['email'], 'password' => $data['password'], 'activated' => true, 'first_name' => $data['first_name'], 'last_name' => $data['last_name'])); $group = Sentry::findGroupByName('admin'); $user->addGroup($group); $quicknote = new \Quicknote(); $quicknote->user_id = $user->id; $quicknote->save(); $userProfile = new \UserProfile(); $userProfile->id = $user->id; $userProfile->save(); $imageResult = App::make('AuthController')->{'createUserImage'}($user->id, $data['first_name'][0], $data['last_name'][0]); $installationDate = date('Y-m-d H:i:s'); $installationHost = Request::server('PATH_INFO'); $new92fiveConfig = new NewConfig(); $new92fiveConfig->toFile(app_path() . '/config/92five.php', ['install' => true, 'version' => '1.0', 'installationDate' => $installationDate, 'installationHost' => $installationHost]); return View::make('install.done'); } catch (Exception $e) { Log::error('Something Went Wrong in Install Controller Repository - addUserWithDetails():' . $e->getMessage()); throw new Exception('Something Went Wrong in Install Controller Repository - addUserWithDetails()'); } }
/** * Creates account for new users */ public function actionRegister() { if (!Yii::app()->user->isGuest) { Yii::app()->request->redirect('/'); } $user = new User('register'); $profile = new UserProfile(); if (Yii::app()->request->isPostRequest && isset($_POST['User'], $_POST['UserProfile'])) { $user->attributes = $_POST['User']; $profile->attributes = $_POST['UserProfile']; $valid = $user->validate(); $valid = $profile->validate() && $valid; if ($valid) { $user->save(); $profile->save(); $profile->setUser($user); // Add user to authenticated group Yii::app()->authManager->assign('Authenticated', $user->id); $this->addFlashMessage(Yii::t('UsersModule.core', 'Спасибо за регистрацию на нашем сайте.')); // Authenticate user $identity = new UserIdentity($user->username, $_POST['User']['password']); if ($identity->authenticate()) { Yii::app()->user->login($identity, Yii::app()->user->rememberTime); Yii::app()->request->redirect($this->createUrl('/users/profile/index')); } } } $this->render('register', array('user' => $user, 'profile' => $profile)); }
public function save($username, $email, $password, $passwordConfirmation) { $user = new User($username, $email); $user->password = $password; $user->passwordConfirmation = $passwordConfirmation; try { $key = $user->save(); $profile = new UserProfile; $profile->user = $user; $profile->save(); $mail = $this->mail(); $mail->username = $username; $mail->activationURL = CoOrg::createFullURL(array('user/activate', $username, $key)); $mail->site = CoOrg::config()->get('site/title'); $mail->to($email)->subject(t('Complete your registration')) ->send('mails/registration'); $this->notice(t('We have sent an email to confirm your registration')); $this->redirect('/'); } catch (ValidationException $e) { $this->error(t('We could not complete your registration')); $this->user = $user; $this->render('create'); } }
public function actionAddcompany() { $companyModel = new Company(); $userLoginModel = new UserLogin(); $userProfileModel = new UserProfile(); if (isset($_POST['Company'])) { $companyModel->attributes = $_POST['Company']; $userLoginModel->attributes = $_POST['UserLogin']; $userProfileModel->attributes = $_POST['UserProfile']; if ($companyModel->validate()) { if ($companyModel->save()) { $userLoginModel->UserRoleID = 2; // $userLoginModel->LoginEmail = '*****@*****.**'; $userLoginModel->UserPassword = md5($userLoginModel->UserPassword); $userLoginModel->IsPasswordReset = 1; $userLoginModel->IsActive = 1; $userLoginModel->save(); $userProfileModel->UserLoginID = $userLoginModel->UserLoginID; $userProfileModel->CompanyID = $companyModel->CompanyID; // $userProfileModel->FirstName = 'Test'; // $userProfileModel->LastName = 'test'; $userProfileModel->AgreeToTerms = 0; $userProfileModel->IsFacilitator = 0; $userProfileModel->save(); $this->redirect(Yii::app()->createUrl('admin/setup', array('id' => $companyModel->CompanyID))); } } } $this->render('add-company', array('companyModel' => $companyModel, 'userLoginModel' => $userLoginModel, 'userProfileModel' => $userProfileModel)); }
public function getAllFriends(User $user) { $con = Connection::createConnection(); $result = mysql_query("SELECT u1.id as user_id, u1.username as user_name, u2.* FROM user u1, userprofile u2 where u1.id = u2.id AND u1.id != {$user->id}"); $friendList = array(); while ($row = mysql_fetch_array($result)) { $userProfile = new UserProfile(); $tempUser = new User(); //setting user $tempUser->id = $row['user_id']; $tempUser->username = $row['user_name']; $userProfile->setUser($tempUser); //Setting user profile $userProfile->id = $row['id']; $userProfile->age = $row['age']; $userProfile->country = $row['country']; $userProfile->favgame = $row['favgame']; $userProfile->humour = $row['humour']; $userProfile->imgurl = $row['imgurl']; $userProfile->job = $row['job']; $userProfile->language = $row['language']; $userProfile->politicalview = $row['politicalview']; $userProfile->religion = $row['religion']; $userProfile->school = $row['school']; array_push($friendList, $userProfile); } return $friendList; }
/** * Called by ArticleFromTitle hook * Calls UserProfilePage instead of standard article * * @param &$title Title object * @param &$article Article object * @return true */ function wfUserProfileFromTitle( &$title, &$article ) { global $wgRequest, $wgOut, $wgHooks, $wgUserPageChoice, $wgUserProfileScripts; if ( strpos( $title->getText(), '/' ) === false && ( NS_USER == $title->getNamespace() || NS_USER_PROFILE == $title->getNamespace() ) ) { $show_user_page = false; if ( $wgUserPageChoice ) { $profile = new UserProfile( $title->getText() ); $profile_data = $profile->getProfile(); // If they want regular page, ignore this hook if ( isset( $profile_data['user_id'] ) && $profile_data['user_id'] && $profile_data['user_page_type'] == 0 ) { $show_user_page = true; } } if ( !$show_user_page ) { // Prevents editing of userpage if ( $wgRequest->getVal( 'action' ) == 'edit' ) { $wgOut->redirect( $title->getFullURL() ); } } else { $wgOut->enableClientCache( false ); $wgHooks['ParserLimitReport'][] = 'wfUserProfileMarkUncacheable'; } $wgOut->addExtensionStyle( $wgUserProfileScripts . '/UserProfile.css' ); $article = new UserProfilePage( $title ); } return true; }
public function configure() { //get profile object $user = $this->getObject(); if (!$user->getUserProfile()) { $profile = UserProfilePeer::retrieveByPK($user->getUserId()); if (!$profile) { $profile = new UserProfile(); $profile->setUserId($user->getUserId()); } $user->setUserProfile($profile); } // build state criteria // echo $profile->getCountry().'&'; $stateC = new Criteria(); $stateC->add(CpStatesPeer::COUNTRY_ID, $user->getUserProfile()->getCountry()); // build city criteria $cityC = new Criteria(); $cityC->add(CpCitiesPeer::STATE_ID, $user->getUserProfile()->getState()); $this->setWidgets(array('country_id' => new sfWidgetFormPropelSelect(array('model' => 'CpCountries', 'add_empty' => '-- Country --', 'order_by' => array('Name', 'asc'))), 'state_id' => new sfWidgetFormPropelSelect(array('model' => 'CpStates', 'add_empty' => '-- State/Province --', 'order_by' => array('Name', 'asc'), 'criteria' => $stateC)), 'city_id' => new sfWidgetFormPropelSelect(array('model' => 'CpCities', 'add_empty' => '-- City --', 'order_by' => array('Name', 'asc'), 'criteria' => $cityC)), 'id' => new sfWidgetFormInputHidden())); $this->setValidators(array('country_id' => new sfValidatorPropelChoice(array('model' => 'CpCountries', 'column' => 'id'), array('required' => '- Please choose country', 'invalid' => '- Invalid country')), 'state_id' => new sfValidatorPropelChoice(array('model' => 'CpStates', 'column' => 'id', 'criteria' => clone $stateC), array('required' => '- Please choose state', 'invalid' => '- Invalid state')), 'city_id' => new sfValidatorPropelChoice(array('model' => 'CpCities', 'column' => 'id', 'criteria' => clone $cityC), array('required' => '- Please choose city', 'invalid' => '- Invalid city')), 'id' => new sfValidatorNumber(array('required' => false)))); //$this->widgetSchema->setLabels(array( // 'name' => 'Name', //)); $this->widgetSchema->setNameFormat('user[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); }
public function getSpyQuestion($user, $gameProgress) { $con = Connection::createConnection(); //first we need to check weather that person has spied him already or not $spy = ServerConstants::SPY; if ($this->canSpy($gameProgress)) { $friendUser = $gameProgress->friend->user; $result = mysql_query("select * from userprofile where userprofile.userid !={$friendUser->id} order by rand() limit 2"); $dataArray = array(); while ($row = mysql_fetch_array($result)) { $userprofile = new UserProfile(); $userprofile->id = $row['id']; $userprofile->setUser($user); $userprofile->age = $row['age']; $userprofile->country = $row['country']; $userprofile->favgame = $row['favgame']; $userprofile->humour = $row['humour']; $userprofile->imgurl = $row['imgurl']; $userprofile->job = $row['job']; $userprofile->language = $row['language']; $userprofile->politicalview = $row['politicalview']; $userprofile->religion = $row['religion']; $userprofile->school = $row['school']; array_push($dataArray, $userprofile); } /* Getting data of friend whom we want to spy i.e. the right options */ $friendProfile = $gameProgress->friend; array_push($dataArray, $friendProfile); Connection::closeConnection($con); return $dataArray; } else { Connection::closeConnection($con); return null; } }
public function callback() { if (!$this->fb->generateSessionFromRedirect()) { return Redirect::route('home')->with('flash_error', 'Failed to connect on Facebook.')->with('flash_color', '#c0392b'); } $user_fb = $this->fb->getGraph(); if (empty($user_fb)) { return Redirect::route('home')->with('flash_error', 'Failed to get data on Facebook.')->with('flash_color', '#c0392b'); } $user = User::whereUidFb($user_fb->getProperty('id'))->first(); if (empty($user)) { $user_profile = new UserProfile(); $user_profile->name = $user_fb->getProperty('name'); $user_profile->birthday = date(strtotime($user_fb->getProperty('birthday'))); $user_profile->photo = 'http://graph.facebook.com/' . $user_fb->getProperty('id') . '/picture?type=large'; $user_profile->save(); $user = new User(); $user->user_profile_id = $user_profile->id; $user->privilage = 1; $user->email = $user_fb->getProperty('email'); $user->uid_fb = $user_fb->getProperty('id'); $user->save(); } $user->access_token_fb = $this->fb->getToken(); $user->save(); Auth::login($user); return Redirect::route('home')->with('flash_error', 'Successfully logged in using Facebook.')->with('flash_color', '#27ae60'); }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (!USERGUESTBOOK_SHOWINSIDEBAR) { return; } if (!WCF::getUser()->getPermission('user.guestbook.canRead')) { return; } if (empty($eventObj->postList->posts)) { return; } $seen = $ret = array(); $ret = WCF::getTPL()->get('additionalSidebarUserContacts'); $link = '<a href="index.php?page=UserGuestbook&userID=%1$d' . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/guestbookS.png" alt="" title="%2$s" /></a>'; $curUserID = WCF::getUser()->userID; $curUserCanUse = WCF::getUser()->getPermission('user.guestbook.canUseOwn'); $gbEnableOption = 'userOption' . User::getUserOptionID('userGuestbook_enable'); require_once WCF_DIR . 'lib/data/user/UserProfile.class.php'; foreach ($eventObj->postList->posts as $post) { if ($post->userID) { if ($curUserID == $post->userID && !$curUserCanUse) { continue; } else { if (!$post->{$gbEnableOption}) { continue; } else { if (array_key_exists($post->userID, $seen)) { if (!empty($seen[$post->userID])) { if (isset($ret[$post->postID])) { $ret[$post->postID] .= ' ' . $seen[$post->userID]; } else { $ret[$post->postID] = $seen[$post->userID]; } } } else { $add = ''; $user = new UserProfile($post->userID, null, null, null); if ($user->getPermission('user.guestbook.canUseOwn')) { $username = StringUtil::encodeHTML($user->username); $title = WCF::getLanguage()->get('wcf.user.guestbook.title', array('$user->username' => $username)); $add = sprintf($link, $post->userID, $title); if (isset($ret[$post->postID])) { $ret[$post->postID] .= ' ' . $add; } else { $ret[$post->postID] = $add; } } $seen[$post->userID] = $add; } } } } } if (count($ret)) { WCF::getTPL()->assign('additionalSidebarUserContacts', $ret); } }
public function __construct($data, $boxname = "") { if (!defined('BUDDIESBOX_SBCOLOR_ACP')) { define('BUDDIESBOX_SBCOLOR_ACP', 2); } if (!defined('BUDDIESBOX_SHOWDEL_ACP')) { define('BUDDIESBOX_SHOWDEL_ACP', false); } if (!defined('BUDDIESBOX_SHOWUSERMARKING_ACP')) { define('BUDDIESBOX_SHOWUSERMARKING_ACP', false); } if (!defined('BUDDIESBOX_SHOWONLYONLINE_ACP')) { define('BUDDIESBOX_SHOWONLYONLINE_ACP', true); } if (!defined('BUDDIESBOX_HIDEIFEMPTY_ACP')) { define('BUDDIESBOX_HIDEIFEMPTY_ACP', true); } $this->BuddiesData['templatename'] = "buddiesbox"; $this->getBoxStatus($data); $this->BuddiesData['boxID'] = $data['boxID']; $this->BuddiesData['showBuddiesBox'] = false; // $buddies = WCF::getUser()->buddies; if (WCF::getUser()->userID != 0) { require_once WCF_DIR . 'lib/data/user/UserProfile.class.php'; $cnt = 0; $sql = "SELECT u.*, uo.*, wcg.*" . "\n FROM wcf" . WCF_N . "_user_whitelist wcu" . "\n JOIN wcf" . WCF_N . "_user u ON (u.userID = wcu.whiteUserID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = u.userOnlineGroupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID . "\n ORDER BY u.username"; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $user = new UserProfile(null, $row); if (BUDDIESBOX_SHOWONLYONLINE_ACP && !$user->isOnline()) { continue; } if ($user->isOnline()) { $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.online', array('$username' => $row['username']))); $this->BuddiesData['buddies'][$cnt]['img'] = 'onlineS.png'; } else { $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.offline', array('$username' => $row['username']))); $this->BuddiesData['buddies'][$cnt]['img'] = 'offlineS.png'; } if ($user->acceptPm) { $this->BuddiesData['buddies'][$cnt]['pm'] = '1'; } else { $this->BuddiesData['buddies'][$cnt]['pm'] = ''; } $this->BuddiesData['buddies'][$cnt]['userID'] = $row['userID']; $this->BuddiesData['buddies'][$cnt]['username'] = StringUtil::encodeHTML($row['username']); // userOnlineMarking... if (BUDDIESBOX_SHOWUSERMARKING_ACP && !empty($row['userOnlineMarking']) && $row['userOnlineMarking'] != '%s') { $this->BuddiesData['buddies'][$cnt]['username'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML($row['username'])); } $cnt++; } if ($cnt > 0 || !BUDDIESBOX_HIDEIFEMPTY_ACP) { $this->BuddiesData['showBuddiesBox'] = true; } } }
public function run() { $model = new UserProfile('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['UserProfile'])) { $model->attributes = $_GET['UserProfile']; } $this->render('admin', array('model' => $model)); }
public function syncWithDB() { //check if socprof is installed if (class_exists('UserProfile')) { $socprof = new UserProfile($this->User); $info = $socprof->getProfile(); $this->setName($info['real_name']); $this->setEmail($info['email']); $this->setCity($info['location_city']); $this->setState($info['location_state']); $this->setCountry($info['location_country']); $this->setHomeCity($info['hometown_city']); $this->setHomeState($info['hometown_state']); $this->setHomeCountry($info['hometown_country']); $this->setBirthday($info['birthday']); $this->setAboutMe($info['about']); $this->setOccupation($info['occupation']); $this->setSchools($info['schools']); $this->setPlaces($info['places_lived']); $this->setWebsites($info['websites']); $this->updateAvatar(); //setting interests $interests = array(); if (!empty($info['companies'])) { $interests[] = $info['companies']; } if (!empty($info['movies'])) { $interests[] = $info['movies']; } if (!empty($info['music'])) { $interests[] = $info['music']; } if (!empty($info['tv'])) { $interests[] = $info['tv']; } if (!empty($info['books'])) { $interests[] = $info['books']; } if (!empty($info['magazines'])) { $interests[] = $info['magazines']; } if (!empty($info['video_games'])) { $interests[] = $info['video_games']; } if (!empty($info['snacks'])) { $interests[] = $info['snacks']; } if (!empty($info['drinks'])) { $interests[] = $info['drinks']; } $this->setInterests($interests); } else { throw new SocProfException(); } }
public function display() { $iae8c74e5273dec25096dbae362493a9f609ecfc8 = parent::display(); $i15f0440429ef770fbaf8bd58ae6bab5bcc2e123c = new UserProfile($this->getDb()); $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e = $i15f0440429ef770fbaf8bd58ae6bab5bcc2e123c->getProfile(); $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= '<h2>' . v_paypal_credit . '</h2>'; $i30c1f0035204897cb8aff2b0300f928f53458359 = array("Czech Republic", "Slovakia", "Slovenia", "Bulgaria", "Romania", "Spain", "Sweden", "United Kingdom", "Austria", "Belgium", "Cyprus", "Denmark", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Netherlands", "Poland", "Portugal", "Estonia", "Malta", "Finland", "Croatia"); $ic89f6ee1fce286859ae8d93f4093a075a9f3f428 = $_SERVER['SERVER_NAME']; $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f = in_array($iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"], $i30c1f0035204897cb8aff2b0300f928f53458359) && strlen($iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["companyvat"]) < 4 ? 1 : 0; $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= ' <p> ' . v_paypal_clickhereif . ' <a style="text-decoration:underline;" href="http://pay.topefekt.com/pay.php?user='******'&passwd=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["passwd"] . '&vat=' . $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f . '&country=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"] . '" onclick="window.open(this.href);return false;">' . v_paypal_credit . '</a> </p> <br /> <iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:460px" src="https://pay.topefekt.com/pay.php?parentUrl=' . $ic89f6ee1fce286859ae8d93f4093a075a9f3f428 . '&user='******'&passwd=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["passwd"] . '&vat=' . $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f . '&country=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"] . '"></iframe> '; return $iae8c74e5273dec25096dbae362493a9f609ecfc8; }
public function display() { $i02fcabda2448d40bdb76bd10f9e95950039649ee = parent::display(); $i8095598e75aa0d17622b51f9b7beb10357fca949 = new UserProfile($this->getDb()); $i82b0989d971c0abe32c9c0bdb380130c4cb90af2 = $i8095598e75aa0d17622b51f9b7beb10357fca949->getProfile(); $i02fcabda2448d40bdb76bd10f9e95950039649ee .= '<h2>' . v_paypal_credit . '</h2>'; $i6f22d8e7415523653f4ab7e8aea177f3aa168425 = array("Czech Republic", "Slovakia", "Slovenia", "Bulgaria", "Romania", "Spain", "Sweden", "United Kingdom", "Austria", "Belgium", "Cyprus", "Denmark", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Netherlands", "Poland", "Portugal", "Estonia", "Malta", "Finland", "Croatia"); $i8d8dd00a3e8afebc7c40263e5a4efa3b353b5c90 = $_SERVER['SERVER_NAME']; $i4cfaa132e787f1824f59093b2651e99b3608580b = in_array($i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"], $i6f22d8e7415523653f4ab7e8aea177f3aa168425) && strlen($i82b0989d971c0abe32c9c0bdb380130c4cb90af2["companyvat"]) < 4 ? 1 : 0; $i02fcabda2448d40bdb76bd10f9e95950039649ee .= ' <p> ' . v_paypal_clickhereif . ' <a style="text-decoration:underline;" href="http://pay.topefekt.com/pay.php?user='******'&passwd=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["passwd"] . '&vat=' . $i4cfaa132e787f1824f59093b2651e99b3608580b . '&country=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"] . '" onclick="window.open(this.href);return false;">' . v_paypal_credit . '</a> </p> <br /> <iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:460px" src="https://pay.topefekt.com/pay.php?parentUrl=' . $i8d8dd00a3e8afebc7c40263e5a4efa3b353b5c90 . '&user='******'&passwd=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["passwd"] . '&vat=' . $i4cfaa132e787f1824f59093b2651e99b3608580b . '&country=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"] . '"></iframe> '; return $i02fcabda2448d40bdb76bd10f9e95950039649ee; }
public function run() { $model = new UserProfile(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['UserProfile'])) { $model->attributes = $_POST['UserProfile']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); // check permission WCF::getUser()->checkPermission('user.profile.canView'); // get user if (isset($_REQUEST['userID'])) { $this->userID = intval($_REQUEST['userID']); } $this->user = new UserProfile($this->userID); if (!$this->user->userID || !$this->user->canViewProfile()) { throw new IllegalLinkException(); } }
/** * @return bool */ public function install() { if ($this->hasErrors()) { return false; } $config = (require Yii::getPathOfAlias('application.config') . DIRECTORY_SEPARATOR . 'main.php'); $conn = new CDbConnection($config['components']['db']['connectionString'], $config['components']['db']['username'], $config['components']['db']['password']); $conn->charset = 'utf8'; Yii::app()->setComponent('db', $conn); $model = User::model()->findByPk(1); if (!$model) { $model = new User(); } // Set user data $model->username = $this->adminLogin; $model->email = $this->adminEmail; $model->password = $this->adminPassword; $model->created_at = date('Y-m-d H:i:s'); $model->last_login = date('Y-m-d H:i:s'); $model->save(false); // Create user profile $profile = new UserProfile(); $profile->user_id = $model->id; $profile->full_name = $model->username; $profile->save(); // Translate attributes $attrsData = array('Rms power' => 'Суммарная мощность', 'Monitor dimension' => 'Разрешение', 'Corpus material' => 'Материал', 'View angle' => 'Угол обзора', 'Sound type' => 'Тип', 'Manufacturer' => 'Производитель', 'Processor manufacturer' => 'Тип процессора', 'Phone platform' => 'Платформа', 'Freq' => 'Частота процессора', 'Phone weight' => 'Вес', 'Memmory' => 'Объем памяти', 'Phone display' => 'Диагональ', 'Memmory type' => 'Тип памяти', 'Phone camera' => 'Камера', 'Screen' => 'Диагональ', 'Tablet screen size' => 'Диагональ', 'Video' => 'Видео', 'Memmory size' => 'Объем памяти', 'Screen dimension' => 'Разрешение', 'Monitor diagonal' => 'Диагональ', 'Weight' => 'Вес'); foreach ($attrsData as $key => $val) { Yii::app()->db->createCommand("UPDATE StoreAttributeTranslate SET title='{$val}' WHERE title='{$key}'")->execute(); } // Translate product types $typesData = array('laptop' => 'Ноутбук', 'computer_sound' => 'Акустика', 'monitor' => 'Монитор', 'phone' => 'Телефон', 'tablet' => 'Планшет'); foreach ($typesData as $key => $val) { Yii::app()->db->createCommand("UPDATE StoreProductType SET name='{$val}' WHERE name='{$key}'")->execute(); } // Display all attributes on compare page Yii::app()->db->createCommand("UPDATE StoreAttribute SET use_in_compare=1")->execute(); $filters = array('processor_manufacturer', 'screen', 'corpus_material', 'sound_type', 'monitor_diagonal', 'phone_platform'); foreach ($filters as $name) { Yii::app()->db->createCommand("UPDATE StoreAttribute SET use_in_filter=1 WHERE name='{$name}'")->execute(); } // Update site settings $siteName = Yii::app()->db->quoteValue($this->siteName); Yii::app()->db->createCommand("UPDATE SystemSettings t SET t.value={$siteName} WHERE t.key='siteName'")->execute(); Yii::app()->db->createCommand("UPDATE SystemSettings t SET t.value='12,18,24' WHERE t.key='productsPerPage'")->execute(); Yii::app()->db->createCommand("UPDATE SystemSettings t SET t.value='30' WHERE t.key='productsPerPageAdmin'")->execute(); $this->createDiscount(); $this->createPopularProducts(); return true; }
public function __construct() { session_start(); $this->index(); if (method_exists($this, "createFilter") && defined("SMS_FILTER_ON")) { $this->createFilter(); } $i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc = new UserProfile($this->getDb()); if (!($i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc->getUsername() && $i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc->getPassword()) && !strpos($_SERVER["REQUEST_URI"], 'admin.php?page=woosms_profile_page')) { $this->displayError(v_smshistory_usernotactive); header('Location: ' . "admin.php?page=woosms_profile_page"); } $this->startup(); }
public function actionShowPosts($id, $mid, $sid) { $posts = Posts::model()->findByPk($sid); $multimedia = json_decode($posts->multimedia); $count = count($multimedia); foreach ($multimedia as $ind => $file) { if ($file->nomber == $mid) { $num = $ind + 1; if ($ind == 0) { $prev = $multimedia[$count - 1]->nomber . '/' . $sid; } else { $prev = $multimedia[$ind - 1]->nomber . '/' . $sid; } if ($ind == $count - 1) { $next = $multimedia[0]->nomber . '/' . $sid; } else { $next = $multimedia[$ind + 1]->nomber . '/' . $sid; } $current_photo = $file; } } $myPage = $id == Yii::app()->user->id; $myProfile = UserProfile::model()->getUserProfile(Yii::app()->user->id); $ext = Files::model()->findByPk($current_photo->id)->extension; $aroundInfo = array('num' => $num, 'count' => $count, 'prev' => $prev, 'next' => $next); $comments = Comments::model()->getLast('posts_' . $sid, $mid, 10); $comments = array_reverse($comments); $file = array('id' => $current_photo->id, 'file' => $current_photo->id, 'image' => array('extension' => $ext), 'description' => '', 'upload_date' => $current_photo->upload_date); $this->renderPartial('show_photo', array('photo' => $file, 'nav_link' => 'showposts', 'user_id' => $id, 'aroundInfo' => $aroundInfo, 'myProfile' => $myProfile, 'myPage' => $myPage, 'comments' => $comments, 'comments_tbl' => 'posts_' . $sid, 'comments_item_id' => $mid)); }
public function testProfileChange() { Yii::import('application.modules.users.models.*'); $this->adminLogin(); // Set empty profile data $this->open('users/profile'); $this->type('UserProfile[full_name]', ''); $this->type('User[email]', ''); $this->clickAtAndWait("//input[@type='submit' and @value='Сохранить']"); $this->assertTrue($this->isTextPresent('Необходимо заполнить поле «Полное Имя»')); $this->assertTrue($this->isTextPresent('Необходимо заполнить поле «Email»')); // Set normal random data $time = time(); $this->type('UserProfile[full_name]', 'fullname' . $time); $this->type('User[email]', 'admin.' . $time . '@localhost.loc'); $this->clickAtAndWait("//input[@type='submit' and @value='Сохранить']"); $this->assertTrue($this->isTextPresent('Изменения успешно сохранены.')); // Check if data really saved $profile = UserProfile::model()->findByAttributes(array('user_id' => 1)); $user = User::model()->findByAttributes(array('id' => 1)); $this->assertTrue($profile->full_name == 'fullname' . $time); $this->assertTrue($user->email == 'admin.' . $time . '@localhost.loc'); // Change password $this->type('ChangePasswordForm[current_password]', 'admin'); $this->type('ChangePasswordForm[new_password]', 'admin'); $this->clickAtAndWait("//input[@type='submit' and @value='Изменить']"); $this->assertTrue($this->isTextPresent('Пароль успешно изменен.')); // Try to set wrong password $this->type('ChangePasswordForm[current_password]', mt_rand(1, 10)); $this->clickAtAndWait("//input[@type='submit' and @value='Изменить']"); $this->assertTrue($this->isTextPresent('Ошибка проверки текущего пароля')); }
public function actionShow($id, $mid) { //$photos = Photos::model(); //$photo = $photos->findByPk($mid); $ap = Bookmarks::model()->findAll(array('select' => 'content_id', 'condition' => 'owner_id = :id AND type = 1', 'params' => array(':id' => $id))); $count = count($ap); foreach ($ap as $ind => $ph) { if ($ph['content_id'] == $mid) { $num = $ind + 1; if ($ind == 0) { $prev = $ap[$count - 1]['content_id']; } else { $prev = $ap[$ind - 1]['content_id']; } if ($ind == $count - 1) { $next = $ap[0]['content_id']; } else { $next = $ap[$ind + 1]['content_id']; } } } $aroundInfo = array('num' => $num, 'count' => $count, 'prev' => $prev, 'next' => $next); $myProfile = UserProfile::model()->getUserProfile(Yii::app()->user->id); $myPage = $id == Yii::app()->user->id; $comments = Comments::model()->getLast('photos', $mid, 10); $comments = array_reverse($comments); $photo = Photos::model()->findByPk($mid); $this->renderPartial('_show_photo', array('photo' => $photo, 'nav_link' => 'show', 'user_id' => $id, 'aroundInfo' => $aroundInfo, 'myProfile' => $myProfile, 'myPage' => $myPage, 'comments' => $comments, 'comments_tbl' => 'photos')); }
public function testUserDeletesProfile() { $user = User::getUserByName('qwerty'); $user->delete(); $this->assertNull(UserProfile::get('qwerty')); }
public function getProfile($user_id) { $userProfile = UserProfile::where('id', '=', $user_id)->first(); $userid = $userProfile->id; $userfname = $userProfile->fname; $userlname = $userProfile->lname; $userstreetno = $userProfile->streetno; $userstreet = $userProfile->street; $usersuburb = $userProfile->suburb; $userstate = $userProfile->state; $userpostcode = $userProfile->postcode; $userdobday = $userProfile->day_dob; $userdobmonth = $userProfile->month_dob; $userdobyear = $userProfile->year_dob; $userphone = $userProfile->phone; $usertfn = $userProfile->tfn; $userpidtype = $userProfile->pidtype; $userpidnum = $userProfile->pidnum; $usersidtype = $userProfile->sidtype; $usersidnum = $userProfile->sidnum; $userdes = $userProfile->description; $usergender = $userProfile->gender; $useroccupation = $userProfile->occupation; $data = array('userid' => $userid, 'userfname' => $userfname, 'userlname' => $userlname, 'userstreetno' => $userstreetno, 'userstreet' => $userstreet, 'usersuburb' => $usersuburb, 'userstate' => $userstate, 'userpostcode' => $userpostcode, 'day_dob' => $userdobday, 'month_dob' => $userdobmonth, 'year_dob' => $userdobyear, 'userphone' => $userphone, 'usertfn' => $usertfn, 'userpidtype' => $userpidtype, 'userpidnum' => $userpidnum, 'usersidtype' => $usersidtype, 'usersidnum' => $usersidnum, 'userdes' => $userdes, 'usergender' => $usergender, 'useroccupation' => $useroccupation); return $data; }
public function actionProfile() { $id = Yii::app()->user->id; if (!isset($_SESSION['filemanager'])) { $_SESSION['filemanager'] = true; } $_SESSION['currentFolder'] = 'user/'; $model = $this->loadModel($id); $modelProfile = UserProfile::model()->exists('userid=' . $id) ? UserProfile::model()->findByPk($id) : new UserProfile(); $role = Yii::app()->request->getPost('role'); $postUser = Yii::app()->request->getPost('User'); $postProfile = Yii::app()->request->getPost('UserProfile'); if (isset($postUser) && isset($postProfile)) { Yii::import('application.modules.backend.controllers.UserController'); //do hàm contruct của UserController(extends controllers) lỗi ko cho phép null iduser nên thêm vào để ko xảy ra lỗi này //mục đích là dùng dc hàm saveUserInfo trong UserController nên ko ảnh hưởng gì $UserControllerTemp = new UserController(2); if ($UserControllerTemp->saveUserInfo($model, $modelProfile, $postUser, $postProfile, $role, false)) { Yii::app()->user->setFlash('success', Yii::t('user', 'Update user\'s info successfully.')); } else { Yii::app()->user->setFlash('error', Yii::t('user', 'Update user\'s info fail. Please try it later.')); } } $this->render('profile', array('model' => $model, 'modelProfile' => $modelProfile, 'role' => User::model()->getRoleUser($model->id))); }
/** * Initializes the user status symbols. */ protected function initUserSymbols() { // gender icon if ($this->user->getUserOption('gender')) { $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.gender.' . ($this->user->getUserOption('gender') == 1 ? 'male' : 'female'), array('username' => $this->user->username)); $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('gender' . ($this->user->getUserOption('gender') == 1 ? 'Male' : 'Female') . 'S.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>'; } // birthday icon if ($this->user->birthday) { if (substr($this->user->birthday, 5) == DateUtil::formatDate('%m-%d', TIME_NOW, false, true)) { $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.birthday', array('username' => $this->user->username, 'age' => $this->user->getAge())); $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('birthdayS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>'; } } // friend icon if ($this->user->buddy) { $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->user->username)); $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('friendsS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>'; } // banned icon if ($this->user->banned) { $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->user->username)); $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('bannedS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>'; } }
function actionDeleteuser($id) { $user = User::model()->findByPk($id); $userProfile = UserProfile::model()->find('user_id=:id', array(':id' => $id)); $userProfile->delete(); $user->delete(); $this->redirect(array('admin/index')); }
/** * For a given user, fetch all NOEs (Excel friendly) * @param int $faculty_user_id The faculty user ID * @param string $start The start of the date range * @param string $end The end of the date range * @return array */ public function fetchNoticeDetailsForExport($faculty_user_id, $start, $end) { if (!ctype_digit($faculty_user_id) && !is_int($faculty_user_id)) { throw new \InvalidArgumentException('Invalid user ID'); } $exams = parent::fetchNoticeDetailsForExport($start, $end); return $this->facultyUserModel->filterByPermissions($faculty_user_id, $exams, 'column0', 'column1'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = UserProfile::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function readEntries($sortField = 'updateDate', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20) { $ret = array(); $i = 0; if (preg_match('/(userID|avatarID)/', $sortField)) { $sortField = 'u.' . $sortField; } require_once WCF_DIR . 'lib/data/user/UserProfile.class.php'; require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php'; $sql = "SELECT uwp.*, IFNULL(SUM(attachmentSize),0) + LENGTH(uwp.text) AS size, COUNT(attachmentID) AS aCnt, u.*, a.*, rank.*, uo.*" . "\n FROM wcf" . WCF_N . "_user_wanted_poster uwp" . "\n JOIN wcf" . WCF_N . "_user u ON u.userID = uwp.userID" . "\n LEFT JOIN wcf" . WCF_N . "_attachment wat ON (wat.userID = uwp.userID AND wat.messageType = 'wantedPoster')" . "\n LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)"; if (!WCF::getUser()->getPermission('mod.wantedPoster.canLockEntries')) { $sql .= "\n WHERE uwp.locked != 1"; } $sql .= "\n GROUP BY uwp.userID, uwp.insertDate, uwp.updateDate, uwp.text, uwp.views, uwp.enableSmilies, uwp.enableHtml, uwp.enableBBCodes, uwp.locked, uwp.lockDate, uwp.lockUser" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $ret[$i]['userID'] = $row['userID']; $ret[$i]['insertDate'] = $row['insertDate']; $ret[$i]['updateDate'] = $row['updateDate']; $ret[$i]['views'] = $row['views']; $ret[$i]['locked'] = $row['locked']; $ret[$i]['size'] = StringUtil::formatInteger($row['size']); $ret[$i]['aCnt'] = StringUtil::formatInteger($row['aCnt']); // username $user = new UserProfile(null, $row); $username = StringUtil::encodeHTML($row['username']); $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID; $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile); $userData['username'] = '******'; if ($user->isOnline()) { $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username)); $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />'; } else { $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username)); $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/offlineS.png" alt="' . $title . '" title="' . $title . '" />'; } $userData['username'] .= '</div><div class="containerContentSmall">'; $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username)); $userData['username'] .= '<p><a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>'; if ($user->getUserTitle()) { $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>'; } $userData['username'] .= '</div>'; $ret[$i]['username'] = $userData['username']; // avatar if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) { $avatar = new Avatar(null, $row); $avatar->setMaxHeight(50); $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username'])); $ret[$i]['avatar'] = '<a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>'; } else { $ret[$i]['avatar'] = ' '; } $i++; } return $ret; }