コード例 #1
0
 /**
  * create the user
  */
 function createUser()
 {
     // all data is already correct
     $this->userName = $this->_request->getValue("userName");
     $this->userFullName = $this->_request->getValue("userFullName");
     $this->userPassword = $this->_request->getValue("userPassword");
     $this->userEmail = $this->_request->getValue("userEmail");
     $users = new Users();
     $user = new UserInfo($this->userName, $this->userPassword, $this->userEmail, "", $this->userFullName);
     // if user registration need email confirm, that is
     // user must active his account
     if ($this->need_confirm == true) {
         $user->setStatus(USER_STATUS_UNCONFIRMED);
     } else {
         $user->setStatus(USER_STATUS_ACTIVE);
     }
     $userId = $users->addUser($user);
     if (!$userId) {
         $this->_view = new SummaryView("registererror");
         $this->_view->setErrorMessage($this->_locale->tr("error_adding_user"));
         $this->setCommonData(true);
         return false;
     }
     return $userId;
 }
コード例 #2
0
ファイル: ControllerInfo.php プロジェクト: shurick31/mymvc
 /**
  * one action Index
  * for show and update userinfo
  */
 public function actionIndex()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         Module::getTable('UserInfo');
         $usersTable = new UserInfo();
         if (isset($_POST['firstname'])) {
             echo $_POST['surname'];
             // save user's additional info
             $userInfo['uid'] = $_SESSION['uid'];
             $userInfo['firstname'] = isset($_POST['firstname']) ? $_POST['firstname'] : ' ';
             $userInfo['surname'] = isset($_POST['surname']) ? $_POST['surname'] : ' ';
             $userInfo['website'] = isset($_POST['website']) ? $_POST['website'] : ' ';
             $userInfo['imageurl'] = isset($_POST['imageurl']) ? $_POST['imageurl'] : ' ';
             $usersTable->addUserInfo($userInfo);
             header("Location: " . $_SERVER['HTTP_REFERER']);
         }
     }
     Module::getTable('UserInfo');
     $usersTable = new UserInfo();
     $where = 'users.id = ' . $_SESSION['uid'];
     $translator = new translate();
     $data = $usersTable->fetchByCond($where);
     $data['lang'] = $translator->getVocab($_SESSION['lang']);
     $this->view->generate('InfoView.php', 'TemplateView.php', $data);
 }
コード例 #3
0
ファイル: TestUserInfo.php プロジェクト: hidetobara/voices
 function testCheckPassword()
 {
     $info = new UserInfo($this->data);
     $this->assertEquals("", $info->checkPassword());
     $info = new UserInfo(array('password' => 'ab'));
     $this->assertEquals(UserInfo::CODE_PASSWORD_LENGTH, $info->checkPassword());
 }
コード例 #4
0
 public function post($resourceVals, $data, $userId)
 {
     global $logger, $warnings_payload;
     $UserInfoId = $resourceVals['user'];
     if (isset($UserInfoId)) {
         $warnings_payload[] = 'POST call to /user must not have ' . '/user_ID appended i.e. POST /user';
         throw new UnsupportedResourceMethodException();
     }
     $userInfoObj = new UserInfo($data['firstName'], $data['lastName'], $data['email'], $data['phoneNo'], $data['password'], 0);
     $logger->debug("POSTed User Detail: " . $userInfoObj->toString());
     if ($data['phoneNo'] == '') {
         return array('code' => '6014');
     } else {
         if ($data['password'] == '') {
             return array('code' => '6015');
         } else {
             $this->mobacDAO->insert($userInfoObj);
             $userDetail = $userInfoObj->toArray();
             if (!isset($userDetail['id'])) {
                 return array('code' => '6011');
             }
             $this->userDetail[] = $userDetail;
             return array('code' => '6001', 'data' => array('userDetail' => $this->userDetail));
         }
     }
 }
コード例 #5
0
 /**
  * gets the image path for a users avatar
  * @param \UserInfo $uo
  * @param bool $withNoCacheStr
  * @return bool|string $src
  */
 public function getImagePath($uo, $withNoCacheStr = true)
 {
     if (!$uo->hasAvatar()) {
         return false;
     }
     $avatar = $uo->getUserAvatar();
     return $avatar->getPath();
 }
コード例 #6
0
 function DropTables()
 {
     $moderator = new Moderator();
     $moderator->SetDatabase($this);
     $moderator->Drop();
     $message = new Message();
     $message->SetDatabase($this);
     $message->Drop();
     $topic = new Topic();
     $topic->SetDatabase($this);
     $topic->Drop();
     $user_info = new UserInfo();
     $user_info->SetDatabase($this);
     $user_info->Drop();
     $session = new Session();
     $session->SetDatabase($this);
     $session->Drop();
     $new = new News();
     $new->SetDatabase($this);
     $new->Drop();
     $shout = new Shout();
     $shout->SetDatabase($this);
     $shout->Drop();
     $paragraph = new Paragraph();
     $paragraph->SetDatabase($this);
     $paragraph->Drop();
     $privilege = new Privilege();
     $privilege->SetDatabase($this);
     $privilege->Drop();
     $role = new Role();
     $role->SetDatabase($this);
     $role->Drop();
     $menu_item = new MenuItem();
     $menu_item->SetDatabase($this);
     $menu_item->Drop();
     $module = new Module();
     $module->SetDatabase($this);
     $module->Drop();
     $page = new Page();
     $page->SetDatabase($this);
     $page->Drop();
     $article = new Article();
     $article->SetDatabase($this);
     $article->Drop();
     $subject = new Subject();
     $subject->SetDatabase($this);
     $subject->Drop();
     $menu = new Menu();
     $menu->SetDatabase($this);
     $menu->Drop();
     $profile = new Profile();
     $profile->SetDatabase($this);
     $profile->Drop();
     $user = new User();
     $user->SetDatabase($this);
     $user->Drop();
 }
コード例 #7
0
 /**
  * Get user media from instagram
  *
  * @see constructQuery
  *
  * @param $user_name
  * @param null $cursor_after
  * @param null $limit
  * @return array
  */
 public function get($user_name, $cursor_after = NULL, $limit = NULL)
 {
     if (!$cursor_after) {
         $resultObj = new UserInfo($this->client);
         $result = $resultObj->get($user_name);
         $this->user_id = $result->id;
     } else {
         $post_params = $this->constructQuery($user_name, $cursor_after, $limit);
         $result = $this->asObject($this->client->webRequest('/query/', 'POST', [], $post_params));
     }
     $media = ['cursor_after' => !empty($result->media->page_info->end_cursor) && !empty($result->media->page_info->has_next_page) ? $result->media->page_info->end_cursor : NULL, 'data' => !empty($result->media->nodes) ? $result->media->nodes : NULL];
     return $media;
 }
コード例 #8
0
ファイル: Invite.php プロジェクト: nqzhang/MoeFQ-sspanel
 function AddAllCode()
 {
     $u = new UserInfo($this->uid);
     $num = $u->InviteNum();
     $sub = $this->uid;
     for ($a = 0; $a < $num; $a++) {
         $x = rand(10, 1000);
         $z = rand(10, 1000);
         $x = md5($x) . md5($z);
         $x = base64_encode($x);
         $code = $sub . substr($x, rand(1, 13), 24);
         $this->db->insert("moefq_invite", ["code" => $code, "user" => $this->uid]);
     }
 }
コード例 #9
0
ファイル: statistics.php プロジェクト: jianhua1982/wlight
 public function add($content)
 {
     $time = intval(RECORD_DAYS_MESSAGE) * 24;
     $time = '-' . strval($time) . ' hour';
     $time = date('Y-m-d', strtotime($time, time()));
     $sql = "DELETE FROM `wx_message` WHERE `time` <= '{$time}'";
     $this->delete($sql);
     $content = str_replace("'", "''", $content);
     $sql = "INSERT INTO `wx_message` (`openid`, `content`, `type`) VALUES ('{$this->fromUserName}','{$content}', 'rcv')";
     $this->insert($sql);
     include_once dirname(__FILE__) . '/user/info.php';
     $info = new UserInfo($this->fromUserName);
     $info->load();
 }
コード例 #10
0
ファイル: UserController.php プロジェクト: zywh/maplecity
 /**
  * 新用户注册
  *
  */
 public function actionRegister()
 {
     $this->layout = " ";
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-1.9.1.js');
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/login.css');
     $username = Yii::app()->request->getQuery('username', null);
     $phone = Yii::app()->request->getQuery('phone', null);
     $email = Yii::app()->request->getQuery('email', null);
     $model = new User('create');
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->validate()) {
             $code_model = Temp::model()->findByPk(trim($model->phone));
             if (!empty($code_model)) {
                 if (time() - $code_model->time <= 180) {
                     if ($model->sms_code == $code_model->code) {
                         if ($model->save()) {
                             $userInfo = new UserInfo();
                             $userInfo->userId = $model->id;
                             $userInfo->username = $model->username;
                             $userInfo->phone = $model->phone;
                             $userInfo->save();
                             $this->redirect(array('registerSuccess'));
                         }
                     } else {
                         $model->addError('sms_code', '验证码不正确');
                     }
                 } else {
                     $model->addError('sms_code', '验证码已失效,请重新获取');
                 }
             } else {
                 $model->addError('sms_code', '验证失败,请重新获取');
             }
         }
     }
     if (!empty($username) && trim($username) != '您的姓名') {
         $model->username = $username;
     }
     if (!empty($phone) && trim($phone) != '您的电话') {
         $model->phone = $phone;
     }
     if (!empty($email) && trim($email) != '您的邮箱') {
         $model->email = $email;
     }
     $sms_list = Sms::model()->findAll();
     $link_list = Link::model()->findAll();
     $this->render('create', array('model' => $model, 'sms_data' => $sms_list[0], 'link_list' => $link_list));
 }
コード例 #11
0
ファイル: UserTest.php プロジェクト: digideskio/concrete5
 public function testCreateSuperUserLegacy()
 {
     $ui = \UserInfo::addSuperUser('test', '*****@*****.**');
     $this->assertEquals(USER_SUPER_ID, $ui->getUserID());
     $this->assertEquals(USER_SUPER, $ui->getUserName());
     $this->assertEquals('*****@*****.**', $ui->getUserEmail());
 }
コード例 #12
0
ファイル: DeleteUserPage.php プロジェクト: rmurray1/RAPTOR
 /**
  * Actually removes the record IF there are no records referencing this user.
  * If records do reference it, then only marks it inactive.
  */
 function updateDatabase($myvalues)
 {
     $bHasReferences = UserInfo::userIsReferenced($this->m_nUID);
     $feedback = NULL;
     if ($bHasReferences) {
         $updated_dt = date("Y-m-d H:i", time());
         $nUpdated = db_update('raptor_user_profile')->fields(array('accountactive_yn' => 0, 'updated_dt' => $updated_dt))->condition('uid', $this->m_nUID, '=')->execute();
         if ($nUpdated !== 1) {
             error_log("Failed to edit user back to database!\n" . var_dump($myvalues));
             die("Failed to edit user back to database!\n" . var_dump($myvalues));
         }
         $feedback = 'Marked user as inactive instead of deleted because referenced by other records.';
     } else {
         //Delete all the child records first.
         $num_deleted = db_delete('raptor_user_modality')->condition('uid', $this->m_nUID, '=')->execute();
         $num_deleted = db_delete('raptor_user_anatomy')->condition('uid', $this->m_nUID, '=')->execute();
         $num_deleted = db_delete('raptor_user_group_membership')->condition('uid', $this->m_nUID, '=')->execute();
         //Now delete the profile.
         $num_deleted = db_delete('raptor_user_profile')->condition('uid', $this->m_nUID, '=')->execute();
         if ($this->m_nUID == 1) {
             //Do NOT delete this drupal user or will be very unhappy!
             error_log('Removed user 1 from RAPTOR but left it alone in Drupal users table.');
             $feedback = 'Removed user from RAPTOR system.';
         } else {
             //Now delete the Drupal user.
             $num_deleted = db_delete('users')->condition('uid', $this->m_nUID, '=')->execute();
             $feedback = 'Removed the ADMIN user from RAPTOR system.';
         }
     }
     drupal_set_message($feedback);
     return 1;
 }
コード例 #13
0
ファイル: controller.php プロジェクト: katzueno/forums
 public function on_start()
 {
     $ihm = Loader::helper('concrete/ui/menu');
     $p = new Permissions(Page::getByPath('/dashboard/forums/'));
     if ($p->canRead()) {
         $ihm->addPageHeaderMenuItem('forums', 'webli_forums', array('icon' => '', 'label' => t('Forums'), 'position' => 'right', 'href' => URL::to('/dashboard/forums'), 'linkAttributes' => array('style' => 'padding:0 5px;width:auto;')));
     }
     Events::addListener('on_page_add', function ($e) {
         $page = $e->getPageObject();
         if ($page->getCollectionTypeHandle() == 'forum_post') {
             $settings = $this->get_saved_settings($page->getCollectionParentID());
             if ($settings['notification']) {
                 if (Config::get('concrete.email.webli_forum.address') && strstr(Config::get('concrete.email.webli_forum.address'), '@')) {
                     $formFormEmailAddress = Config::get('concrete.email.webli_forum.address');
                 } else {
                     if (Config::get('concrete.email.default.address') && strstr(Config::get('concrete.email.default.address'), '@')) {
                         $formFormEmailAddress = Config::get('concrete.email.default.address');
                     } else {
                         $adminUserInfo = UserInfo::getByID(USER_SUPER_ID);
                         $formFormEmailAddress = $adminUserInfo->getUserEmail();
                     }
                 }
                 $mh = Core::make('helper/mail');
                 $mh->to($settings['email_addresses']);
                 $mh->from($formFormEmailAddress);
                 $parentPage = Page::getByID($page->getCollectionParentID());
                 $mh->addParameter('forumName', $parentPage->getCollectionName());
                 $mh->addParameter('forumPath', BASE_URL . DIR_REL . $parentPage->getCollectionPath());
                 $mh->load('forum_notification', 'webli_forums');
                 $mh->setSubject(t('New Forum Post to %s', $parentPage->getCollectionName()));
                 @$mh->sendMail();
             }
         }
     });
 }
コード例 #14
0
 protected function attemptAuthentication()
 {
     $user = parent::attemptAuthentication();
     $userInfo = \UserInfo::getByID($user->getUserID());
     $extractor = $this->getExtractor();
     $roles = $extractor->getExtra('roles');
     // sync groups with roles
     if (is_array($roles)) {
         $groupIds = array();
         foreach ($roles as $role) {
             $roleApplicationCode = $role['role_application']['application_code'];
             if ($roleApplicationCode == \Config::get('auth.worldskills.roles_application_code')) {
                 $roleName = $role['name'];
                 // check for entity role and append entity name
                 if (isset($role['ws_entity'])) {
                     $roleName = $roleName . ' - ' . $role['ws_entity']['name']['text'];
                 }
                 // check if group exists
                 $group = \Group::getByName($roleName);
                 if (!is_object($group)) {
                     // add missing groups
                     $group = \Group::add($roleName, '');
                 }
                 $groupIds[] = $group->getGroupID();
             }
         }
         // remove duplicate groups
         $groupIds = array_unique($groupIds);
         // update groups of user
         $userInfo->updateGroups($groupIds);
     }
     // login user again to make sure groups are reloaded
     return \User::loginByUserID($user->getUserID());
 }
コード例 #15
0
 public function save($post)
 {
     // clear all selected permissions
     $tps = array();
     foreach ($post['tpID'] as $tpID) {
         $tp = TaskPermission::getByID($tpID);
         $tps[] = $tp;
         $tp->clearPermissions();
     }
     foreach ($post['selectedEntity'] as $e) {
         if ($e != '') {
             $o1 = explode('_', $e);
             if ($o1[0] == 'uID') {
                 $obj = UserInfo::getByID($o1[1]);
             } else {
                 $obj = Group::getByID($o1[1]);
             }
             foreach ($tps as $tp) {
                 if ($post[$e . '_' . $tp->getTaskPermissionID()] == 1) {
                     $tp->addAccess($obj);
                 }
             }
         }
     }
 }
コード例 #16
0
ファイル: activity.php プロジェクト: VonUniGE/concrete5-1
 public function __construct()
 {
     Loader::model('user_statistics');
     Loader::model('page_statistics');
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $us = new UserStatistics($ui);
     $this->set('uLastActivity', $us->getPreviousSessionPageViews());
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
     $this->set('uName', $ui->getUserName());
     $this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u));
     $this->set('totalVersions', PageStatistics::getTotalPageVersions());
     $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
     $llu = UserStatistics::getLastLoggedInUser();
     if ($llu->getUserID() == $u->getUserID()) {
         $this->set('lastLoginSite', t('Your login is the most recent.'));
     } else {
         $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
     }
     $this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut());
     Loader::block('form');
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
コード例 #17
0
ファイル: settings.php プロジェクト: ppiedaderawnet/concrete5
 public function save()
 {
     $config = Core::make('config');
     if (Core::make('token')->validate('conversations.settings.save')) {
         $helper_file = Core::make('helper/concrete/file');
         $config->save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest')));
         $config->save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered')));
         $config->save('conversations.files.guest.max', intval($this->post('maxFilesGuest')));
         $config->save('conversations.files.registered.max', intval($this->post('maxFilesRegistered')));
         $config->save('conversations.attachments_enabled', (bool) $this->post('attachmentsEnabled'));
         $config->save('conversations.subscription_enabled', (bool) $this->post('subscriptionEnabled'));
         $users = array();
         if (is_array($this->post('defaultUsers'))) {
             foreach ($this->post('defaultUsers') as $uID) {
                 $ui = \UserInfo::getByID($uID);
                 if (is_object($ui)) {
                     $users[] = $ui;
                 }
             }
         }
         Conversation::setDefaultSubscribedUsers($users);
         if ($this->post('fileExtensions')) {
             $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY);
             $types = $helper_file->serializeUploadFileExtensions($types);
             $config->save('conversations.files.allowed_types', $types);
         }
         $this->saveEditors();
         $this->success();
     } else {
         $this->error->add('Invalid Token.');
         $this->view();
     }
 }
 public function view()
 {
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     Loader::model("page_statistics");
     Loader::model("user_statistics");
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     if (is_object($ui)) {
         $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
         $this->set('uName', $ui->getUserName());
         $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
         $llu = UserStatistics::getLastLoggedInUser();
         if ($llu->getUserID() == $u->getUserID()) {
             $this->set('lastLoginSite', t('Your login is the most recent.'));
         } else {
             $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
         }
         Loader::block('form');
     }
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
コード例 #19
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate($Oauth = false)
 {
     $user = User::model()->findByAttributes(array('email' => $this->username));
     if (!$user) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif (!$user->comparePassword($this->password) && !$Oauth) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->errorCode = self::ERROR_NONE;
         $userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
         $userInfo->upTime = time();
         $userInfo->save();
         if ($userInfo->status == 'frozened') {
             throw new CHttpException(404, '错误!你的账号已被冻结.');
             Yii::app()->end();
         }
         //动态设为超级用户
         if ($userInfo->isAdmin) {
             Yii::app()->user->setIsSuperuser(true);
         }
         //			elseif($userInfo->inRoles(array('superAdmin','admin'))) Yii::app()->user->setIsSuperuser(true);
         $this->_id = $userInfo->id;
         //用setState添加的变量会加入Yii::app()->user的属性中
         $this->setState('displayName', $userInfo->name);
     }
     return !$this->errorCode;
 }
コード例 #20
0
ファイル: UserIdentity.php プロジェクト: stan5621/eduwind
 public function getUserInfo()
 {
     if (!$this->_userInfo) {
         $this->_userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
     }
     return $this->_userInfo;
 }
コード例 #21
0
 public function getWorkflowProgressApprovalUsers(WorkflowProgress $wp)
 {
     $pk = Key::getByHandle('approve_basic_workflow_action');
     $pk->setPermissionObject($this);
     $access = $pk->getPermissionAssignmentObject()->getPermissionAccessObject();
     $users = array(\UserInfo::getByID(USER_SUPER_ID));
     $usersToRemove = array();
     if (is_object($access)) {
         // Loop through all items and get the relevant users.
         $items = $access->getAccessListItems(Key::ACCESS_TYPE_INCLUDE);
         foreach ($items as $item) {
             $entity = $item->getAccessEntityObject();
             $users = array_merge($entity->getAccessEntityUsers($access), $users);
         }
         // Now we loop through the array and remove
         $items = $access->getAccessListItems(Key::ACCESS_TYPE_EXCLUDE);
         foreach ($items as $item) {
             $entity = $item->getAccessEntityObject();
             foreach ($entity->getAccessEntityUsers($access) as $user) {
                 $usersToRemove[] = $user->getUserID();
             }
         }
         $users = array_unique($users);
         $usersToRemove = array_unique($usersToRemove);
         $users = array_filter($users, function ($element) use($usersToRemove) {
             if (in_array($element->getUserID(), $usersToRemove)) {
                 return false;
             }
             return true;
         });
     }
     return $users;
 }
コード例 #22
0
ファイル: settings.php プロジェクト: ngreimel/kovent
 public function save()
 {
     $helper_file = Loader::helper('concrete/file');
     Config::save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest')));
     Config::save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered')));
     Config::save('conversations.files.guest.max', intval($this->post('maxFilesGuest')));
     Config::save('conversations.files.registered.max', intval($this->post('maxFilesRegistered')));
     Config::save('conversations.attachments_enabled', !!$this->post('attachmentsEnabled'));
     Config::save('conversations.subscription_enabled', !!$this->post('subscriptionEnabled'));
     $users = array();
     if (is_array($this->post('defaultUsers'))) {
         foreach ($this->post('defaultUsers') as $uID) {
             $ui = \UserInfo::getByID($uID);
             if (is_object($ui)) {
                 $users[] = $ui;
             }
         }
     }
     Conversation::setDefaultSubscribedUsers($users);
     if ($this->post('fileExtensions')) {
         $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY);
         $types = $helper_file->serializeUploadFileExtensions($types);
         Config::save('conversations.files.allowed_types', $types);
     }
     $this->saveEditors();
     $this->success();
 }
コード例 #23
0
ファイル: friends.php プロジェクト: homer6/concrete5-mirror
 public function view($userID = 0)
 {
     if (!ENABLE_USER_PROFILES) {
         $this->render("/page_not_found");
     }
     $html = Loader::helper('html');
     $canEdit = false;
     $u = new User();
     if ($userID > 0) {
         $profile = UserInfo::getByID($userID);
         if (!is_object($profile)) {
             throw new Exception('Invalid User ID.');
         }
     } else {
         if ($u->isRegistered()) {
             $profile = UserInfo::getByID($u->getUserID());
             $canEdit = true;
         } else {
             $this->set('intro_msg', t('You must sign in order to access this page!'));
             $this->render('/login');
         }
     }
     $this->set('profile', $profile);
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->set('t', Loader::helper('text'));
     $this->set('canEdit', $canEdit);
 }
コード例 #24
0
 public function update($id, Request $request)
 {
     $userInfo = UserInfo::findOrFail($id);
     dd($userInfo);
     $userInfo->update($request->all());
     return redirect('user');
 }
コード例 #25
0
ファイル: AddQuestion.php プロジェクト: Alamast/pravoved
 static function fioById($id)
 {
     $model = UserInfo::model()->findByAttributes(['user_id' => $id]);
     if ($model) {
         return $model->surname . ' ' . $model->name . ' ' . $model->otchestvo;
     }
 }
コード例 #26
0
    private function send_notification_email($data)
    {
        $subject = '[' . SITE . '] New Contact Form Submission';
        $optInString = $data['optIn'] ? 'Yes' : 'No';
        $body = <<<EOB
A new submission has been made to the custom contact form:

Name: {$data['name']}
Email: {$data['email']}
Newsletter: {$optInString}

Message:
{$data['message']}

EOB;
        //Dev Note: The "EOB;" above must be at the far-left of the page (no whitespace before it),
        //          and cannot have anything after it (not even comments).
        //			See http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
        //Send email
        $mh = Loader::helper('mail');
        $mh->from(UserInfo::getByID(USER_SUPER_ID)->getUserEmail());
        $mh->to($this->notifyEmail);
        $mh->setSubject($subject);
        $mh->setBody($body);
        //Use $mh->setBodyHTML() if you want an HTML email instead of (or in addition to) plain-text
        $mh->sendMail();
    }
コード例 #27
0
 public function getAccessEntityUsers(PermissionAccess $pa)
 {
     $f = $pa->getPermissionObject();
     if (is_object($f) && $f instanceof File) {
         return UserInfo::getByID($f->getUserID());
     }
 }
コード例 #28
0
ファイル: Avatar.php プロジェクト: ceko/concrete5-1
 /**
  * gets the image path for a users avatar
  * @param \UserInfo $uo
  * @param bool $withNoCacheStr
  * @return bool|string $src
  */
 public function getImagePath($uo, $withNoCacheStr = true)
 {
     if (!$uo->hasAvatar()) {
         return false;
     }
     $fsl = StorageLocation::getDefault();
     $fs = $fsl->getFileSystemObject();
     if ($fs->has(REL_DIR_FILES_AVATARS . '/' . $uo->getUserID() . '.jpg')) {
         $configuration = $fsl->getConfigurationObject();
         $src = $configuration->getPublicURLToFile(REL_DIR_FILES_AVATARS . '/' . $uo->getUserID() . '.jpg');
         $cacheStr = "?" . time();
         if ($withNoCacheStr) {
             $src .= $cacheStr;
         }
         return $src;
     }
 }
コード例 #29
0
ファイル: UserInfo.php プロジェクト: ph7pal/wedding
 public static function getInfo($uid, $type)
 {
     if (!$uid || !$type) {
         return false;
     }
     $info = UserInfo::model()->find('uid=:uid AND `name`=:name', array(':uid' => $uid, ':name' => $type));
     return $info['value'];
 }
コード例 #30
0
 /**
  * 申请发布事件
  * @param unknown_type $event
  */
 public function handleOnApplied($event)
 {
     $owner = $this->getOwner();
     $admins = UserInfo::getAllAdmins();
     foreach ($admins as $user) {
         Notice::send($user->id, 'entity_applied', array('entityId' => $owner->entityId));
     }
 }