Example #1
0
<?php

defined('SYSPATH') or die('No direct script access.');
echo Alert::show();
echo Form::errors();
?>

<table class="table table-bordered">
	<tr>
		
		<th><?php 
echo __('Category');
?>
</th>
		<th><?php 
echo __('Location');
?>
</th>
		<th><?php 
echo __('Min Price');
?>
</th>
		<th><?php 
echo __('Max Price');
?>
</th>
		<th><?php 
echo __('Created');
?>
</th>
		<th>
Example #2
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     $user =& $request->_user;
     if (isa($request, 'MockRequest')) {
         return '';
     }
     if (!$request->isActionPage($request->getArg('pagename')) and (!isset($user->_prefs->_method) or !in_array($user->_prefs->_method, array('ADODB', 'SQL'))) or in_array($request->getArg('action'), array('zip', 'ziphtml', 'dumphtml')) or isa($user, '_ForbiddenUser')) {
         $no_args = $this->getDefaultArguments();
         // ?
         //            foreach ($no_args as $key => $value) {
         //                $no_args[$value] = false;
         //            }
         $no_args['errmsg'] = HTML(HTML::h2(_("Error: The user HomePage must be a valid WikiWord. Sorry, UserPreferences cannot be saved."), HTML::hr()));
         $no_args['isForm'] = false;
         return Template('userprefs', $no_args);
     }
     $userid = $user->UserName();
     if ($user->isAuthenticated() and !empty($userid)) {
         $pref =& $request->_prefs;
         $args['isForm'] = true;
         //trigger_error("DEBUG: reading prefs from getPreferences".print_r($pref));
         if ($request->isPost()) {
             $errmsg = '';
             $delete = $request->getArg('delete');
             if ($delete and $request->getArg('verify')) {
                 // deleting prefs, verified
                 $default_prefs = $pref->defaultPreferences();
                 $default_prefs['userid'] = $user->UserName();
                 $user->setPreferences($default_prefs);
                 $request->_setUser($user);
                 $request->setArg("verify", false);
                 $request->setArg("delete", false);
                 $alert = new Alert(_("Message"), _("Your UserPreferences have been successfully deleted."));
                 $alert->show();
                 return;
             } elseif ($delete and !$request->getArg('verify')) {
                 return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs()), HTML::p(_("Do you really want to delete all your UserPreferences?")), HTML::p(Button('submit:delete', _("Yes"), 'delete'), HTML::Raw('&nbsp;'), Button('cancel', _("Cancel"))));
             } elseif ($rp = $request->getArg('pref')) {
                 // replace only changed prefs in $pref with those from request
                 if (!empty($rp['passwd']) and $rp['passwd2'] != $rp['passwd']) {
                     $errmsg = _("Wrong password. Try again.");
                 } else {
                     //trigger_error("DEBUG: reading prefs from request".print_r($rp));
                     //trigger_error("DEBUG: writing prefs with setPreferences".print_r($pref));
                     if (empty($rp['passwd'])) {
                         unset($rp['passwd']);
                     }
                     // fix to set system pulldown's. empty values don't get posted
                     if (empty($rp['theme'])) {
                         $rp['theme'] = '';
                     }
                     if (empty($rp['lang'])) {
                         $rp['lang'] = '';
                     }
                     $num = $user->setPreferences($rp);
                     if (!empty($rp['passwd'])) {
                         $passchanged = false;
                         if ($user->mayChangePass()) {
                             if (method_exists($user, 'storePass')) {
                                 $passchanged = $user->storePass($rp['passwd']);
                             }
                             if (!$passchanged and method_exists($user, 'changePass')) {
                                 $passchanged = $user->changePass($rp['passwd']);
                             }
                             if ($passchanged) {
                                 $errmsg = _("Password updated.");
                             } else {
                                 $errmsg = _("Password was not changed.");
                             }
                         } else {
                             $errmsg = _("Password cannot be changed.");
                         }
                     }
                     if (!$num) {
                         $errmsg .= " " . _("No changes.");
                     } else {
                         $request->_setUser($user);
                         $pref = $user->_prefs;
                         $errmsg .= sprintf(_("%d UserPreferences fields successfully updated."), $num);
                     }
                 }
                 $args['errmsg'] = HTML(HTML::h2($errmsg), HTML::hr());
             }
         }
         $args['available_themes'] = listAvailableThemes();
         $args['available_languages'] = listAvailableLanguages();
         return Template('userprefs', $args);
     } else {
         // wrong or unauthenticated user
         return $request->_notAuthorized(WIKIAUTH_BOGO);
         //return $user->PrintLoginForm ($request, $args, false, false);
     }
 }
@layout('layouts.main')
@section('content')
<?php 
//echo __('user.user_not_activated');
if ($errors->has('user_alert')) {
    $alert_message = $errors->first('user_alert');
    $alert_type = $errors->has('alert_type') ? $errors->first('alert_type') : Alert::INFO;
    echo Alert::show($alert_type, $alert_message)->block();
}
echo Former::horizontal_open()->id('resetPasswordForm')->secure()->rules(array('password' => 'required', 'repeat_password' => 'required|same:password'))->method('POST');
?>
{{Former::token();}}
{{Former::hidden("hash64", $hash64)}}
{{Former::password("password", "Password")->appendIcon('aw_key')}}
{{Former::password("repeat_password", "Repeat Password")->appendIcon('aw_key')}}
<?php 
echo \Former::actions(Former::primary_submit('Reset Password'));
?>
{{Former::close()}}
@endsection
Example #4
0
 function do_action(&$request, $args)
 {
     $method = strtolower('_do_' . str_replace('-', '_', $args['action']));
     if (!method_exists($this, $method)) {
         return $this->error("Bad action");
     }
     $message = call_user_func(array(&$this, $method), $request, $args);
     // display as seperate page or as alert?
     $alert = new Alert(_("WikiAdminUtils says:"), $message, array(_("Okay") => $args['return_url']));
     $alert->show();
     // noreturn
 }
Example #5
0
<?php

/**
 * Created by PhpStorm.
 * User: Julien
 * Date: 29/01/16
 * Time: 12:40
 */
?>



<div class="container">

    <?php 
//If user connects for the first time
if ($user->getUserStatus() == 2) {
    $message = new Alert("success", false);
    $message->addText('<p>Welcome ' . $user->getFirstName() . '!</p><p>Before your registration is fully completed, we need few more details...</p>');
    $message->show();
}
?>



</div>
Example #6
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (isa($request, 'MockRequest')) {
         return '';
     }
     $user =& $request->_user;
     $post_args = $request->getArg('admin_reset');
     $userid = $request->getArg('user');
     $isadmin = $user->isAdmin();
     if ($request->isPost()) {
         if (!$userid) {
             $alert = new Alert(_("Warning:"), _("You need to specify the userid!"));
             $alert->show();
             return $this->doForm($request);
         }
         @($reset = $post_args['reset']);
         if ($reset and $userid and !empty($post_args['verify'])) {
             if ($user->isAdmin()) {
                 return $this->doReset($userid);
             } else {
                 return $this->doEmail($request, $userid);
             }
         } elseif ($reset and empty($post_args['verify'])) {
             $buttons = HTML::p(Button('submit:admin_reset[reset]', $isadmin ? _("Yes") : _("Send email"), $isadmin ? 'wikiadmin' : 'button'), HTML::Raw('&nbsp;'), Button('submit:admin_reset[cancel]', _("Cancel"), 'button'));
             $header = HTML::strong("Verify");
             if (!$user->isAdmin()) {
                 // check for email
                 if ($userid == $user->UserName() and $user->isAuthenticated()) {
                     $alert = new Alert(_("Already logged in"), HTML(fmt("Changing passwords is done at "), WikiLink(_("UserPreferences"))));
                     $alert->show();
                     return;
                 }
                 $thisuser = WikiUser($userid);
                 $prefs = $thisuser->getPreferences();
                 $email = $prefs->get('email');
                 if (!$email) {
                     $alert = new Alert(_("Error"), HTML(fmt("No email stored for user %s.", $userid), HTML::br(), fmt("You need to ask an Administrator to reset this password. See below: "), HTML::br(), WikiLink(ADMIN_USER)));
                     $alert->show();
                     return;
                 }
                 $verified = $thisuser->_prefs->_prefs['email']->getraw('emailVerified');
                 if (!$verified) {
                     $header->pushContent(HTML::br(), "Warning: This users email address is unverified!");
                 }
             }
             return $this->doForm($request, $header, HTML(HTML::hr(), fmt("Do you really want to reset the password of user %s?", $userid), $isadmin ? '' : _("An email will be sent."), HiddenInputs(array('admin_reset[verify]' => 1, 'user' => $userid)), $buttons));
         } else {
             return $this->doForm($request);
         }
     } else {
         return $this->doForm($request);
     }
 }