public function postCreate() { $validator = Validator::make(Input::all(), User::$rules); if ($validator->passes()) { //$validator true, save ke db $user = new User(); $user->username = Input::get('username'); $user->email = Input::get('email'); $user->password = Hash::make(Input::get('password')); $user->admin = false; if ($user->save()) { //kalau save sukses maka bikin profile ProfileController::save($user->id); } else { return Redirect::to('/register')->with('message', 'save gagal'); } return Redirect::to('/')->with('message', 'makasih udah register'); } else { //validator false, kirim notifikasi return Redirect::to('/register')->with('message', 'Hal Berikut Error')->withErrors($validator)->withInput; } }
public static function run() { $action = array_key_exists('action', $_SESSION) ? $_SESSION['action'] : ""; $arguments = array_key_exists('arguments', $_SESSION) ? $_SESSION['arguments'] : ""; switch ($action) { case "show": ProfileController::run(); break; case "update": // For an individual user, show their account edit page if (is_numeric($arguments)) { $targetUserId = $arguments; // Only allow updating if the user is logged in and the // loggedin user is the target user if (self::UserCanEditTargetAccount($targetUserId)) { self::updateUser($targetUserId); } else { HomeView::show(); } } break; default: } }
<?php /** * Created by PhpStorm. * User: Home * Date: 08.11.2015 * Time: 17:01 */ include_once $_SERVER['DOCUMENT_ROOT'] . '/Controllers/ProfileController.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/Model/ProfileModel.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/View/ProfileView.php'; //initiate the triad $model = new ProfileModel(); //It is important that the controller and the view share the model $controller = new ProfileController($model); $view = new ProfileView($model); $controller->actionGetUserData(); $view->getCartPage();
$_SESSION['authenticated'] = false; } switch ($control) { case "dataset": DatasetController::run(); break; case "login": LoginController::run(); break; case "logout": LogoutController::run(); break; case "measurement": MeasurementController::run(); break; case "profile": ProfileController::run(); break; case "sensor": SensorController::run(); break; case "signup": SignupController::run(); break; case "user": UserController::run(); break; default: HomeView::show(array(null)); } ob_end_flush();
/** * Profile settings * * @param ProfileController $Sender */ public function profileController_signature_create($Sender) { $Sender->Permission('Garden.SignIn.Allow'); $Sender->Title('Signature Settings'); $this->Dispatch($Sender); }
public function __construct(AccountOrderModel $model) { parent::__construct($model); $this->model = $model; }
$app->delete('/manage_users/:id', function ($id) { fAuthorization::requireLoggedIn(); $controller = new NameController(); $controller->delete($id); }); $app->post('/article/:id', function ($id) { fAuthorization::requireLoggedIn(); $controller = new ArticleController(); $controller->update($id); }); $app->delete('/article/:id', function ($id) { fAuthorization::requireLoggedIn(); $controller = new ArticleController(); $controller->delete($id); }); $app->post('/profiles', function () { fAuthorization::requireLoggedIn(); $controller = new ProfileController(); $controller->create(); }); $app->post('/profile/:id', function ($id) { fAuthorization::requireLoggedIn(); $controller = new ProfileController(); $controller->update($id); }); $app->post('/manage/sendmail', function () { fAuthorization::requireLoggedIn(); $controller = new AdminController(); $controller->sendmail(); }); $app->run();
/** * @param ProfileController $Sender * @param array $Args * @param array $Where * @param int $Limit * @return bool */ public function joinAttachmentsToUser($Sender, $Args, $Where = array(), $Limit = 20) { $User = $Sender->User; if (!is_object($User)) { return false; } $Where = array_merge(array('ForeignUserID' => $User->UserID), $Where); $Attachments = $this->getWhere($Where, '', 'desc', $Limit)->resultArray(); $Sender->setData('Attachments', $Attachments); return true; }
$logger->debug("router :: " . json_encode($route)); $logger->debug("post :: " . json_encode($_POST)); $logger->debug("get :: " . json_encode($_GET)); if (!isset($_SESSION['user_id']) && count($route) <= 1) { //langing page of collap $jobsHomeController = new JobsHomeController(); $jobHomeController->render(); } else { $page = $route[1]; //single page app switch ($page) { case "fileUpload": require_once "controllers/FilesController.class.php"; break; case "profile": $profileController = new ProfileController($route[2]); $where = $route[3]; switch ($where) { case 'forgetPassword': $homeController->forgetPassword(); break; default: $profileController->render(); break; } break; case "setting": $settingController = new SettingController(); $where = $route[2]; switch ($where) { case 'updateTechStrength':
/** Display the requested page. */ function displayPage($webPage) { setcookie("last-page", full_url($_SERVER)); if (isset($_SESSION["message"])) { $message = $_SESSION["message"]; $this->tpl->assign('message', $message); unset($_SESSION["message"]); } try { if (isset($this->pdo)) { $sth = $this->pdo->prepare("SELECT COUNT(alerts.id) AS c FROM alerts WHERE resolved = 0"); $sth->execute(); $countAlerts = $sth->fetch(PDO::FETCH_ASSOC); $countAlerts = $countAlerts["c"]; $this->tpl->assign('countAlerts', $countAlerts); } } catch (Exception $e) { Log::getLogger()->write(Log::LOG_ERROR, "Unable to request DB", $e); $this->tpl->assign('countAlerts', 0); } try { switch ($webPage) { case CONTROLLER_DASHBOARD: $c = new DashboardController($this->pdo); $c->buildTemplate($this->tpl); break; case CONTROLLER_ADMIN: $c = new AdminController($this->pdo); $c->buildTemplate($this->tpl); break; case CONTROLLER_PROFILE: $c = new ProfileController($this->pdo); $c->buildTemplate($this->tpl); break; case CONTROLLER_HELP: $c = new HelpController($this->pdo); $c->buildTemplate($this->tpl); break; case CONTROLLER_LOGIN: $c = new LoginController($this->pdo); $c->buildTemplate($this->tpl); break; case CONTROLLER_DEFAULT: default: $this->tpl->display('controller_blank.tpl'); break; } } catch (SecurityAccessException $sae) { if ($this->tpl->getTemplateVars('message') == null) { $_SESSION["message"] = array("type" => "danger", "title" => "Accès interdit", "descr" => "Cette page est protégée. Veuillez vous connecter avec un compte ayant accès à cette page."); $this->tpl->assign('message', $_SESSION["message"]); unset($_SESSION["message"]); } // A Security Access Exception occurs when the user cannot see the asked page. // So in this case let's redirect to login page. $c = new LoginController($this->pdo); $c->buildTemplate($this->tpl); } catch (SecurityException $se) { // A Security Exception is more generic so display a message. Log::getLogger()->write(Log::LOG_ALERT, "Security Exception dropped on dispatcher", $se); $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $se->getMessage()); $this->tpl->assign('message', $_SESSION["message"]); unset($_SESSION["message"]); $this->tpl->display('controller_error.tpl'); } catch (Exception $e) { Log::getLogger()->write(Log::LOG_ERROR, "Unknown Exception dropped on dispatcher", $e); // A very generic exception. $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $e->getMessage()); $this->tpl->assign('message', $_SESSION["message"]); unset($_SESSION["message"]); $this->tpl->display('controller_error.tpl'); } }
public function actionMotivationMesg() { //$this->actionRefreshwidget('hi'); if (isset(Yii::app()->session['login']['id'])) { $userid = Yii::app()->session['login']['id']; if (isset($_REQUEST['frndid'])) { $frndid = $_REQUEST['frndid']; if ($frndid != $userid) { $userid = $frndid; } } } else { if (isset($_REQUEST['frndid'])) { $frndid = $_REQUEST['frndid']; /*This code is added for making specific profiles public*/ $profiles = array(64, 124, 16, 101, 100, 99, 279, 280, 255, 115, 265, 449, 270, 371, 248, 241, 63, 246, 239, 106, 68, 193, 289, 67, 107, 597, 362, 303, 256, 333); //246,239,106,68,193,289,67 ///371,270,449,248,241,63 if (in_array($frndid, $profiles)) { $userid = $frndid; } else { $this->redirect(array('/home')); } } else { $this->redirect(array('/home')); } } //$this->redirect(array('/home')); /* Code added for retainging the finao status when images or video is uploaded */ $isuploadprocess = array(); if (isset($_REQUEST["finaoid"])) { $sourcetype = $_REQUEST["sourcetype"]; $finid = 0; $journalid = 0; if ($sourcetype == 'journal') { $finaojournal = UserFinaoJournal::model()->findByPK($_REQUEST["finaoid"]); if (isset($finaojournal) && !empty($finaojournal)) { $finid = $finaojournal->finao_id; } $journalid = $_REQUEST["finaoid"]; } else { $finid = $_REQUEST["finaoid"]; } $finao = UserFinaoTile::model()->find(array('condition' => 'finao_id = ' . $finid)); $tileid = ""; if (isset($finao) && count($finao) >= 1) { $tileid = $finao->tile_id; } $isuploadprocess = array('finao' => $finid, 'tile' => $tileid, 'journalid' => $journalid, 'upload' => $_REQUEST['upload'], 'menuselected' => isset($_REQUEST['menuselected']) ? $_REQUEST['menuselected'] : ""); } $user = User::model()->findByPk($userid); // $sql="SELECT * FROM `finao_tagnote` WHERE `user_id` = ".$user->mageid.""; $sql = "SELECT * FROM `finao_tagnote` as t1\n\n\t\tjoin catalog_product_entity_varchar as t2\n\n\t\ton t1.`product_id` = t2.`entity_id` and t2.`attribute_id`= 86\n\n\t\twhere t1.`user_id` = " . $user->mageid . " "; $connection = Yii::app()->db2; $tagnotes = $connection->createCommand($sql)->queryAll(); $pids = array(); foreach ($tagnotes as $tag) { $pids = $tag["product_id"]; } /*$sql2='SELECT * FROM catalog_product_entity_varchar where entity_id in '.implode(',',$pids).' and attribute_id=86'; $connection=Yii::app()->db2; $prodimg=$connection->createCommand($sql2)->queryAll(); */ //print_r($prodimg);exit; $userinfo = UserProfile::model()->findByAttributes(array('user_id' => $userid)); $Criteria = new CDbCriteria(); $Criteria->condition = "userid = '" . $userid . "' AND Iscompleted = 0 AND finao_activestatus = 1"; if (isset($_REQUEST['frndid'])) { $Criteria->addCondition("finao_status_Ispublic = 1", 'AND'); } $Criteria->order = "updateddate DESC"; //ORDER BY `fn_user_finao_tile`.`tile_name` ASC $finaos = UserFinao::model()->findAll($Criteria); if (!empty($finaos)) { $Criteria = new CDbCriteria(); $Criteria->group = 'tile_id'; $Criteria->condition = "userid = '" . $userid . "'"; if (!empty($finaos)) { foreach ($finaos as $finaoids) { $ids[] = $finaoids->user_finao_id; } } if (!empty($ids)) { $Criteria->addInCondition('finao_id', $ids); } $Criteria->order = 'updateddate DESC'; $tilesinfo = UserFinaoTile::model()->findAll($Criteria); } else { $tilesinfo = ""; } $tileslist = $tilesinfo; $totaltilecount = count($tilesinfo); $newfinao = new UserFinao(); $newtile = new UserFinaoTile(); $upload = new Uploaddetails(); if (!isset($_REQUEST['frndid'])) { if (empty($finaos)) { $AddNewfinao = "addnewfinao"; } } $prev = ""; $next = ""; $noofpages = ""; if ($AddNewfinao != "addnewfinao") { $tilesdetials = $this->gettilesinfo($userid, 0, isset($_REQUEST['frndid']) ? 1 : 0); $tilesinfo = $tilesdetials["tileinfo"]; $prev = $tilesdetials["prev"]; $next = $tilesdetials["next"]; $noofpages = $tilesdetials["noofpages"]; } if (isset($_REQUEST['share'])) { $share = "share"; } else { $share = "no"; } if (isset($_REQUEST['track']) && $_REQUEST['track'] == "track") { $track = "track"; } else { $track = ""; } if (isset($_REQUEST['search']) && $_REQUEST['search'] == "search") { $search = "search"; } else { $search = ""; } /********** Getting all the tile of the user including default tiles for populating tile band *****************/ $tiles = Lookups::model()->findAll(array('condition' => 'lookup_type = "tiles" AND lookup_status = 1 ')); //$tilesslider = $this->refreshtilewidget($userid,$share); // Added on 28-06-13 to display Tiles in work space $tilesslider = $this->refreshtilewidget($userid, $share, 0, 0, 1); // Ends here on 28-06-13 /************** User Profile details **********************/ //$Userprofarray = ProfileController::getUserProfile($userid); commented on 070713-1-45-pm $Userprofarray = ProfileController::getUserProfile($userid, $share); /************** Latest Finao & archive details **********************/ $latestfinaoarray = $this->getfinaoinfo($userid, "", $share, -1, 1, 0); $archivefinao = $this->getfinaoinfo($userid, "completed", $share, -1, 1, 0); /************** tracking you details **********************/ $trackingyoudet = TrackingController::displayYourTracking($userid, $share, "trackingyou", ""); /************** Activity of the ppl following details **********************/ $activityppl = $this->getmyheroesdata($userid, $share); /***************************************/ /****************** getting counts for menu ************************/ $menucount = array('tilescount' => $tilesslider['totaltilecount'], 'imagecount' => $tilesslider['imgcount'], 'videocount' => $tilesslider['videocount'], 'finaocount' => $this->getfinaoinfo($userid, "", $share, -1, 1, 1), 'followcount' => $this->getfollowersdetails($userid, -1, 0, 1)); /* Added on 19-03-2013 to display the total count of images and videos*/ $uploadtypeimage = Lookups::model()->findByAttributes(array('lookup_name' => 'Image', 'lookup_type' => 'uploadtype', 'lookup_status' => 1)); $uploadtypevideo = Lookups::model()->findByAttributes(array('lookup_name' => 'Video', 'lookup_type' => 'uploadtype', 'lookup_status' => 1)); /*$images = Uploaddetails::model()->findAllByAttributes(array('uploadtype'=>$uploadtypeimage->lookup_id,'uploadedby'=>$userid,'status'=>1)); $videos = Uploaddetails::model()->findAllByAttributes(array('uploadtype'=>$uploadtypevideo->lookup_id,'uploadedby'=>$userid,'status'=>1));*/ /* Added on 27-03-2013 for facebook invite friends in finaos tracking page*/ $logeduser = User::model()->findByPk(Yii::app()->session['login']['id']); if (isset($_REQUEST['url']) && $_REQUEST['url'] == "logedfbreg") { $userinfo = Yii::app()->facebook->api('/me'); if (isset($_REQUEST['error_reason']) && $_REQUEST['error_reason'] == 'user_denied') { Yii::app()->user->setFlash('fbusererror', 'You are NOT LOGGED IN.You must allow basic permission access to Login from facebook'); $this->redirect(array('/')); } $logeduser->socialnetworkid = $userinfo['id']; $logeduser->socialnetwork = "facebook"; $logeduser->save(false); $track = "track"; $invitefriends = "invitefriends"; } else { $invitefriends = ""; } /* Ends here*/ if (isset($_REQUEST['tileimageupload'])) { $usertileid = $_REQUEST['tileimageupload']; $tileimage = TilesInfo::model()->findByAttributes(array('tile_id' => $usertileid, 'createdby' => $userid)); } else { $tileimage = ""; } if (isset($_REQUEST['getusertileid']) || isset($_REQUEST['tileerrormesg'])) { if (isset($_REQUEST['tileerrormesg'])) { $getusertileid = $_REQUEST['tileerrormesg']; } else { if ($_REQUEST['getusertileid']) { $getusertileid = $_REQUEST['getusertileid']; } } //$tileid = UserFinaoTile::model()->findByPk($getusertileid); $tileid = $getusertileid; } else { $tileid = ""; $getusertileid = ""; } if (isset($_REQUEST['tileerrormesg']) && isset($_REQUEST['newtile'])) { if (isset($_REQUEST['tileerrormesg'])) { $gettileid = $_REQUEST['tileerrormesg']; } $tileinfo = TilesInfo::model()->findByAttributes(array('tile_id' => $gettileid)); $tileinfo->delete(); $userfinaotile = UserFinaoTile::model()->findByAttributes(array('tile_id' => $gettileid)); $finaoid = $userfinaotile->finao_id; $userfinaotile->delete(); $finao = UserFinao::model()->findByPk($finaoid); $finao->delete(); $newtileerror = "yes"; } else { $newtileerror = ""; } //print_r($tagnotes); exit; $this->render('default', array('tiles' => $tilesinfo, 'userid' => $userid, 'IsMotMsg' => 1, 'userinfo' => isset($userinfo) && !empty($userinfo) ? $userinfo : "", 'menucount' => $menucount, 'user' => $user, 'isuploadprocess' => $isuploadprocess, 'share' => $share, 'search' => $search, 'model' => $newfinao, 'tilesnewfinao' => $tiles, 'newtile' => $newtile, 'type' => 'tilefinao', 'prev' => $prev, 'next' => $next, 'noofpages' => $noofpages, 'totaltilecount' => $totaltilecount, 'logeduser' => $logeduser, 'invitefriends' => $invitefriends, 'Imgupload' => isset($_REQUEST['imgupload']) ? $_REQUEST['imgupload'] : 0, 'Tileimageupload' => isset($_REQUEST['tileimageupload']) ? $_REQUEST['tileimageupload'] : 0, 'tileimage' => $tileimage, 'getusertileid' => $getusertileid, 'tileid' => $tileid, 'tileimageerror' => isset($_REQUEST['tileerrormesg']) ? "Tileimageerror" : "", 'errormsg' => isset($_REQUEST['errormsg']) ? $_REQUEST['errormsg'] : "", 'newtileerror' => $newtileerror, 'tileslist' => $tileslist, 'tilesslider' => $tilesslider, 'profilelatestfinao' => $Userprofarray['finao'], 'profiletileinfo' => $Userprofarray['tilesinfo'], 'latestfinaoarray' => $latestfinaoarray, 'archivefinao' => $archivefinao, 'trackingyoudet' => $trackingyoudet, 'activityppl' => $activityppl, 'userid' => $userid, 'tagnotes' => $tagnotes)); }
<?php include "controllers/profile.controller.php"; login_check("index.php"); $pc = new ProfileController(); $profile = $pc->getProfile(); ?> <div class="container-fluid"> <?php include "views/loggedin.nav.frag.php"; ?> <div class="row"> <div class="span6"> <h2>Change Password</h2> <form id="updatepassword_form" action="#" method="post" class="form-horizontal" onsubmit="profile_update();return false;"> <div class="control-group"> <label class="control-label" for="user_email">Email</label> <div class="controls"> <input required id="user_email" type="text" disabled placeholder="My fabulous project" value="<?php echo $profile['user_email']; ?> "/> </div> </div> <div class="control-group"> <label class="control-label" for="user_password">Old password</label> <div class="controls"> <input required id="user_password" type="password" placeholder="Old password"/> </div>
$control = $urlPieces[2]; } ###(ENDSECTION) Parse URL ###(SECTION) Redirect switch ($control) { case "sign-up": SignUpController::run(null); break; case "log-in": LogInController::run(null); break; case "dashboard": DashboardController::run(null); break; case "profile": ProfileController::run(null); break; case "edit-profile": EditProfileController::run(null); break; case "build-map": MapController::run(null); break; case "log-out": LogOutController::run(null); break; default: if (array_key_exists("session", $_COOKIE)) { DashboardController::run(null); } else { LandingView::show(null);
case '': $controller_obj = new HomeController($path, $registry); $controller_obj->process($_POST); break; case 'admin': $controller_obj = new AdminController($path, $registry); $controller_obj->process($_POST); break; case 'categories': $controller_obj = new CategoriesController($path, $registry); $controller_obj->process($_POST); break; case 'contact': break; case 'profile': $controller_obj = new ProfileController($path, $registry); $controller_obj->process($_POST); break; case 'login': $controller_obj = new LoginController($path, $registry); $controller_obj->process($_POST); break; case 'logout': $controller_obj = new LogoutController($path, $registry); $controller_obj->process(); break; case 'signup': $controller_obj = new SignupController($path, $registry); $controller_obj->process($_POST); break; case 'search':
public function showProfile() { $this->loadTemplate(); $controller = new ProfileController(); $controller->showProfile(); }
<?php /** * Created by PhpStorm. * User: Haziq * Date: 12/28/2015 * Time: 5:53 PM */ require_once $_SERVER['DOCUMENT_ROOT'] . '/matrimonialweb/Controller/ProfileController.php'; $data = array(); if (isset($_POST['id'])) { $id = $_POST['id']; if (strlen($id) > 0) { $Object = new ProfileController(); $data = $Object->getUserInformation($id); } else { array_push($data, ["Status" => "error", "Message" => "user identification can't be empty"]); } } else { array_push($data, ["Status" => "error", "Message" => "Please provide user identification id"]); } echo json_encode($data);
/** * Profile settings * * @param ProfileController $Sender */ public function ProfileController_Ignore_Create($Sender) { $Sender->Permission('Garden.SignIn.Allow'); $Sender->Title(T('Ignore List')); $this->Dispatch($Sender); }
<?php include_once "controller/profileController.php"; $controller = new ProfileController(); $controller->invoke();
/** * Creates addons tab ProfileController. * * @since 2.0.0 * @package Vanilla * * @param ProfileController $Sender */ public function profileController_addons_create($Sender) { $UserReference = val(0, $Sender->RequestArgs, ''); $Username = val(1, $Sender->RequestArgs, ''); // Tell the ProfileController what tab to load $Sender->getUserInfo($UserReference, $Username); $Sender->setTabView('Addons', 'Profile', 'Addon', 'Addons'); $Offset = 0; $Limit = 100; $AddonModel = new AddonModel(); $ResultSet = $AddonModel->getWhere(array('UserID' => $Sender->User->UserID), 'DateUpdated', 'desc', $Limit, $Offset); $Sender->setData('Addons', $ResultSet); $NumResults = $AddonModel->getCount(array('InsertUserID' => $Sender->User->UserID)); // Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views $Sender->HandlerType = HANDLER_TYPE_NORMAL; // Render the ProfileController $Sender->render(); }
function _group_submit() { $this->_assert_may('administer'); $this->_import_profile_controller(); $group = $this->_get_group_from_id_or_die($_POST['group_id']); $this->_init_group_from_post_data($group); $this->_add_profile_breadcrumbs($group); $profile = new ProfileController($this->api); // Make sure that the data is complete and valid. $err = $group->check_complete(); if ($err) { $profile->add_hint(new \hint\Error($err)); return $profile->show_group_editor($group); } // Save the group. if (!$this->_get_groupdb()->save_group($group)) { $profile->add_hint(new \hint\Error(_('Failed to save the group.'))); return $profile->show_group_editor($group); } // Done. $profile->add_hint(new \hint\Ack(_('Your changes have been saved.'))); $profile->show_group_editor($group); }
/** * Add the roles to the profile body tag * * @param ProfileController $sender Sending controller instance. * @param array $args Event arguments. */ public function profileController_render_before($sender, $args) { $cssRoles = $sender->data('UserRoles'); if (!is_array($cssRoles)) { return; } foreach ($cssRoles as &$rawRole) { $rawRole = $this->formatRoleCss($rawRole); } $sender->CssClass = trim($sender->CssClass . ' ' . implode(' ', $cssRoles)); }
<?php /** * Created by PhpStorm. * User: Home * Date: 08.11.2015 * Time: 23:23 */ include_once $_SERVER['DOCUMENT_ROOT'] . '/Controllers/ProfileController.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/Model/ProfileModel.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/View/ProfileView.php'; //initiate the triad $model = new ProfileModel(); //It is important that the controller and the view share the model $controller = new ProfileController($model); $view = new ProfileView($model); $controller->actionRemoveData();
}); $routes->get('/logout', 'auth', function () { AuthController::logout(); }); // Profile $routes->get('/profile/edit', 'auth', function () { ProfileController::edit(); }); $routes->post('/profile/update', 'auth', function () { ProfileController::edit(); }); $routes->get('/profile/password', 'auth', function () { ProfileController::password(); }); $routes->post('/profile/password/update', 'auth', function () { ProfileController::updatePassword(); }); // Controlpanel $routes->get('/controlpanel', 'admin', function () { AuthController::controlpanel(); }); // Users $routes->get('/users', 'admin', function () { UsersController::index(); }); $routes->get('/users/create', 'admin', function () { UsersController::create(); }); $routes->post('/users/store', 'admin', function () { UsersController::store(); });
$activityController = new ActivityController($route[2]); $where = $route[2]; switch ($where) { case 'postComment': $activityController->postComment(); break; default: $activityController->render(); break; } break; case "fileUpload": require_once "controllers/FilesController.class.php"; break; case "profile": $profileController = new ProfileController($route[2]); $where = $route[3]; switch ($where) { case 'activities': $profileController->getNextActivities(); break; case 'ideas': $profileController->getNextIdeas(); break; case 'projects': $profileController->getNextProjects(); break; case 'forgetPassword': $homeController->forgetPassword(); break; case 'sendLinkRequest':
/** * * @param ProfileController $Sender * @param type $UserReference * @param type $Username * @param type $oauth_token * @param type $oauth_verifier */ public function ProfileController_TwitterConnect_Create($Sender, $UserReference = '', $Username = '', $oauth_token = '', $oauth_verifier = '') { $Sender->Permission('Garden.SignIn.Allow'); $Sender->GetUserInfo($UserReference, $Username, '', TRUE); $Sender->_SetBreadcrumbs(T('Connections'), '/profile/connections'); // Get the access token. Trace('GetAccessToken()'); $AccessToken = $this->GetAccessToken($oauth_token, $oauth_verifier); $this->AccessToken($AccessToken); // Get the profile. Trace('GetProfile()'); $Profile = $this->GetProfile(); // Save the authentication. Gdn::UserModel()->SaveAuthentication(array('UserID' => $Sender->User->UserID, 'Provider' => self::ProviderKey, 'UniqueID' => $Profile['id'])); // Save the information as attributes. $Attributes = array('AccessToken' => array($AccessToken->key, $AccessToken->secret), 'Profile' => $Profile); Gdn::UserModel()->SaveAttribute($Sender->User->UserID, self::ProviderKey, $Attributes); $this->EventArguments['Provider'] = self::ProviderKey; $this->EventArguments['User'] = $Sender->User; $this->FireEvent('AfterConnection'); Redirect(UserUrl($Sender->User, '', 'connections')); }
public static function post() { if (isset($_POST['edit'])) { $page = new Page(); $page->data['title'] = 'Profiel'; ProfileController::buildProfileTopView($page, true, false); $page->addView('profile/ProfileEnabledFormBottomView'); ProfileController::buildMembershipDetailsView($page); $page->showWithMenu(); } elseif (isset($_POST['save'])) { $page = new Page(); $page->data['title'] = 'Profiel'; $errMsgs = ProfileTopViewValidator::validate($_POST); if (empty($errMsgs)) { //If no error: create a new user from posted data and try to save it $newUser = ProfileController::createUserFromPost(); try { UserDB::updateUser($_SESSION['Stippers']['Profile']['user'], $newUser); $page->data['SuccessMessageNoDescriptionWithLinkView']['successTitle'] = 'Gegevens succesvol bijgewerkt'; $page->data['SuccessMessageNoDescriptionWithLinkView']['redirectUrl'] = $_SERVER['REQUEST_URI']; $page->addView('success/SuccessMessageNoDescriptionWithLinkView'); } catch (UserDBException $ex) { //Show correct error message for errors if ($ex->getCode() == UserDBException::USEROUTOFDATE) { $page->data['ErrorMessageWithDescriptionWithLinkView']['errorTitle'] = 'Gegevens niet bijgewerkt'; $page->data['ErrorMessageWithDescriptionWithLinkView']['errorDescription'] = 'Iemand anders heeft je gegevens in tussentijd al gewijzigd.'; $page->data['ErrorMessageWithDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI']; $page->addView('error/ErrorMessageWithDescriptionWithLinkView'); } else { ProfileController::buildProfileTopView($page, true, true); if ($ex->getCode() == UserDBException::EMAILALREADYEXISTS) { $page->data['ProfileTopView']['errMsgs']['global'] = '<h2 class="error_message" id="profile_form_error_message">Dit e-mailadres is al in gebruik.</h2>'; } else { $page->data['ProfileTopView']['errMsgs']['global'] = '<h2 class="error_message" id="profile_form_error_message">Kan gegevens niet bijwerken, probeer het opnieuw.</h2>'; } $page->addView('profile/ProfileEnabledFormBottomView'); } } } else { //If we had an error we show the views with enabled controls and take data from POST ProfileController::buildProfileTopView($page, true, true); $page->addView('profile/ProfileEnabledFormBottomView'); $page->data['ProfileTopView']['errMsgs'] = array_merge($page->data['ProfileTopView']['errMsgs'], $errMsgs); ProfileController::buildMembershipDetailsView($page); } $page->showWithMenu(); } else { ProfileController::get(); } }
/** * * * @param ProfileController $Sender * @param type $UserReference * @param type $Username * @param type $Code */ public function profileController_FacebookConnect_create($Sender, $UserReference, $Username, $Code = false) { $Sender->permission('Garden.SignIn.Allow'); $Sender->getUserInfo($UserReference, $Username, '', true); $Sender->_setBreadcrumbs(t('Connections'), '/profile/connections'); // Get the access token. $AccessToken = $this->getAccessToken($Code, self::profileConnecUrl()); // Get the profile. $Profile = $this->getProfile($AccessToken); // Save the authentication. Gdn::userModel()->saveAuthentication(array('UserID' => $Sender->User->UserID, 'Provider' => self::ProviderKey, 'UniqueID' => $Profile['id'])); // Save the information as attributes. $Attributes = array('AccessToken' => $AccessToken, 'Profile' => $Profile); Gdn::userModel()->saveAttribute($Sender->User->UserID, self::ProviderKey, $Attributes); $this->EventArguments['Provider'] = self::ProviderKey; $this->EventArguments['User'] = $Sender->User; $this->fireEvent('AfterConnection'); redirect(userUrl($Sender->User, '', 'connections')); }
/** * Add a best content tab on a user's profile * @param ProfileController $Sender */ public function ProfileController_AddProfileTabs_Handler($Sender) { if (is_object($Sender->User) && $Sender->User->UserID > 0) { $Sender->AddProfileTab(Sprite('SpBestOf') . ' ' . T('Yaga.BestContent'), 'profile/best/' . $Sender->User->UserID . '/' . urlencode($Sender->User->Name)); } }
/** * Creates virtual 'Discussions' method in ProfileController. * * @since 2.0.0 * @package Vanilla * * @param ProfileController $Sender ProfileController. */ public function ProfileController_Discussions_Create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '') { $Sender->EditMode(FALSE); // Tell the ProfileController what tab to load $Sender->GetUserInfo($UserReference, $Username, $UserID); $Sender->_SetBreadcrumbs(T('Discussions'), '/profile/discussions'); $Sender->SetTabView('Discussions', 'Profile', 'Discussions', 'Vanilla'); $Sender->CountCommentsPerPage = C('Vanilla.Comments.PerPage', 30); list($Offset, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30)); $DiscussionModel = new DiscussionModel(); $Discussions = $DiscussionModel->GetByUser($Sender->User->UserID, $Limit, $Offset, FALSE, Gdn::Session()->UserID); $CountDiscussions = $Offset + $DiscussionModel->LastDiscussionCount + 1; $Sender->DiscussionData = $Sender->SetData('Discussions', $Discussions); // Build a pager $PagerFactory = new Gdn_PagerFactory(); $Sender->Pager = $PagerFactory->GetPager('MorePager', $Sender); $Sender->Pager->MoreCode = 'More Discussions'; $Sender->Pager->LessCode = 'Newer Discussions'; $Sender->Pager->ClientID = 'Pager'; $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, UserUrl($Sender->User, '', 'discussions') . '/{Page}'); // Deliver JSON data if necessary if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) { $Sender->SetJson('LessRow', $Sender->Pager->ToString('less')); $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more')); $Sender->View = 'discussions'; } // Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views $Sender->HandlerType = HANDLER_TYPE_NORMAL; // Do not show discussion options $Sender->ShowOptions = FALSE; if ($Sender->Head) { // These pages offer only duplicate content to search engines and are a bit slow. $Sender->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive')); } // Render the ProfileController $Sender->Render(); }
$profile->set_about($_POST['about']); //for file if (isset($_POST['foto'])) { $filename = $_FILES['image']['name']; $path = ROOT_PATH . "/home/pictures/profile/"; move_uploaded_file($_FILES['image']['tmp_name'], $path . $filename); $profile->set_profile_photo($filename); } return $profile; } public function error_page() { include_once ROOT_PATH . 'profile/views/error_page.php'; } } $profile_controller = new ProfileController(); if (isset($_GET['id'])) { $user_profile_id = $_GET['id']; $user = NULL; if (isset($_SESSION['user_hash'])) { $user = $_SESSION['user_hash']; } switch ($user_profile_id) { case $user: if (isset($_GET['m'])) { $method = $_GET['m']; switch ($method) { case 'edit': $profile_controller->edit($_SESSION['user_id']); break; default: