Exemplo n.º 1
0
 /**
  * Activate user account.
  *
  * @access     public
  * @return     View
  * @since      1.0.0
  * @version    1.1.0, 2015-02-12
  */
 public function actionActivation()
 {
     // if user is logged, redirect to main page
     if (UserModel::isLogged()) {
         Route::factory('home')->redirectTo();
     }
     // set page title
     $this->setTitle(__('Activate your new account'));
     // get code from URL
     $sCode = Router::getParam('code');
     $bActivated = FALSE;
     // get activation code from DB
     $oResult = DB::query("SELECT c FROM \\Model\\User\\ActivationCode c WHERE c.code = :code")->param('code', $sCode)->single();
     /* @var $oResult ActivationCodeModel */
     // activate user
     if ($oResult instanceof ActivationCodeModel) {
         // Set user as activated
         $bActivated = TRUE;
         $oUser = $oResult->getUser();
         $oUser->setActivation(TRUE);
         DB::flush();
         // Remove activation code from DB
         DB::remove($oResult);
         DB::flush();
     }
     // view
     return View::factory("user/frontend/register/activation")->bind('bActivated', $bActivated);
 }
Exemplo n.º 2
0
 /**
  * @access	public
  * @since	1.0.0-dev, 2015-04-19
  * @version	1.0.0-dev, 2015-04-19
  */
 public function actionDefault()
 {
     $this->setTitle(__('Sitemap'));
     $this->addBreadCrumb(__('Sitemap'));
     $aItems = [];
     $aItems[] = ['/', __('Front page')];
     $aPages = \Plethora\DB::query("SELECT p FROM \\Model\\Page p WHERE p.published = 1")->execute();
     foreach ($aPages as $oPage) {
         /* @var $oPage \Model\Page */
         $aItems[] = [Route::factory('page')->path(['rewrite' => $oPage->getRewrite()]), $oPage->getTitle()];
     }
     \Sitemap\SitemapGenerator::generate($aItems);
     return View::factory('sitemap/frontend/sitemap')->bind('aItems', $aItems);
 }
Exemplo n.º 3
0
 /**
  * Costructor.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function __construct()
 {
     // initialize theme
     Theme::initFrontend();
     // parent consturctor
     parent::__construct();
     // add CSS & JS files for all subpages
     $this->addCssByTheme('/packages/bootstrap/css/bootstrap.css', '_common');
     $this->addJsByTheme('/js/jquery-2.1.3.min.js', '_common');
     $this->addJsByTheme('/js/jquery-ui.min.js', '_common');
     $this->addJsByTheme('/packages/bootstrap/js/bootstrap.min.js', '_common');
     // add first breadcrumb
     $frontPageURL = Route::factory('home')->url();
     $this->addBreadCrumb(__('Front page'), $frontPageURL);
 }
Exemplo n.º 4
0
 /**
  * Action used to do multileveled sort on model entities.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionSortList()
 {
     // check access
     if (!\UserPermissions::hasPerm('backend_ajax_sort_list')) {
         Route::factory('home')->redirectTo();
     }
     // @TODO: check permissions
     $sObjects = filter_input(INPUT_POST, 'objects');
     $sModel = filter_input(INPUT_POST, 'model');
     $aObjectsTmp = [];
     $aOrderNumber = [];
     // if list of objects is empty
     if (empty($sObjects)) {
         $this->setStatus('error');
         return __('List of objects is empty.');
     }
     // parse objects array from query string
     parse_str($sObjects, $aObjectsTmp);
     $aObjects = $aObjectsTmp['object'];
     // rewrite each object
     foreach ($aObjects as $iID => $sParentID) {
         if ($sParentID === 'null') {
             $sParentID = 0;
         }
         $iParentID = (int) $sParentID;
         if (!isset($aOrderNumber[$iParentID])) {
             $aOrderNumber[$iParentID] = 0;
         }
         $aObjects[$iID] = ['order_parent' => $iParentID, 'order' => $aOrderNumber[$iParentID]];
         $aOrderNumber[$iParentID]++;
     }
     // check if particular model has `order` property
     if (!property_exists($sModel, 'order_number')) {
         $this->setStatus('error');
         return __('Wrong node type.');
     }
     // get all model instances
     $aEntities = DB::query('SELECT t FROM ' . $sModel . ' t WHERE t.id IN (:list)')->param('list', array_keys($aObjects))->execute();
     foreach ($aEntities as $oEntity) {
         /* @var $oEntity ModelCore|ModelCore\Traits\Sortable */
         $aObjData = $aObjects[$oEntity->getId()];
         $oEntity->setOrderNumber($aObjData['order']);
         $oEntity->setOrderParent($aObjData['order_parent']);
         $oEntity->save();
         DB::flush();
     }
     return 'saved';
 }
Exemplo n.º 5
0
 /**
  * Main action to run cron jobs.
  *
  * @access   public
  * @since    2.33.0-dev, 2015-06-07
  * @version  2.39.0-dev
  */
 public function actionDefault()
 {
     if (!class_exists('\\Cron\\CronExpression')) {
         throw new Exception\Fatal('Cannot run Cron jobs without proper Cron library.');
     }
     $sTokenFromURL = Router::getParam('token');
     $sTokenFromConfig = Config::get('base.cron_token');
     $iCronJobsCompleted = 0;
     // check Cron token
     if ($sTokenFromURL !== $sTokenFromConfig) {
         throw new Exception\Code404();
     }
     // get all Cron jobs
     $aAllJobs = CronJobsHelper::getCronJobs();
     // count amount of all CRON jobs
     $iCronJobs = count($aAllJobs);
     // run a single CRON job
     foreach ($aAllJobs as $aJobData) {
         $sModule = $aJobData['module'];
         $sJobKey = base64_encode($aJobData[1] . '.' . $aJobData[2]);
         $aCache = Cache::get($sModule . '.' . $sJobKey, 'cron');
         $iRunDate = isset($aCache['time']) ? $aCache['time'] : NULL;
         $oCron = CronExpression::factory($aJobData[0]);
         if ($iRunDate === NULL || $iRunDate < time()) {
             switch ($aJobData[1]) {
                 case 'route':
                     $sURL = Route::factory($aJobData[2])->url();
                     file_get_contents($sURL);
                     break;
                 case 'file':
                 case 'url':
                     file_get_contents($aJobData[2]);
                     break;
                 case 'function':
                     call_user_func($aJobData[2]);
                     break;
             }
             $iNextRun = $oCron->getNextRunDate()->format('U');
             $aCacheToSave = ['time' => $iNextRun, 'last_execution_time' => time(), 'type' => $aJobData[1], 'param' => $aJobData[2]];
             Cache::set($aCacheToSave, $sModule . '.' . $sJobKey, 'cron', 0);
         }
     }
     // log that cron jobs turning on action was completed
     Log::insert('Cron jobs (in amount of ' . $iCronJobs . ') were checked and ' . $iCronJobsCompleted . ' of them were turned on.');
     // end of functionality
     exit;
 }
Exemplo n.º 6
0
 /**
  * ACTION - User login.
  *
  * @access   public
  * @return   View
  * @since    1.0.2, 2013-12-07
  * @version  1.0.7-dev, 2015-05-04
  */
 public function actionLogin()
 {
     $this->setTitle(Core::getAppName() . ' - ' . __('Login form'));
     $this->addBreadCrumb(__('Login form'));
     $oLoggedUser = Model\User::getLoggedUser();
     if ($oLoggedUser instanceof Model\User) {
         Route::factory('user_profile')->redirectTo(['id' => $oLoggedUser->getId()]);
     }
     $failedLogins = \User\LoginFail::getCachedData();
     if ($failedLogins > 4) {
         return View::factory('base/alert')->set('sType', 'danger')->set('sMsg', __('to.many.incorrect.logins'));
     }
     $oLoginForm = Form::factory('login');
     $oLoginForm->addField(Form\Field\Text::factory('login', $oLoginForm));
     $oLoginForm->addField(Form\Field\Password::factory('password', $oLoginForm));
     if ($oLoginForm->isSubmittedAndValid()) {
         $sUsername = $oLoginForm->get('login');
         $sPassword = $oLoginForm->get('password');
         $sEncryptedPassword = Helper\Encrypter::factory()->encrypt($sUsername, $sPassword);
         $oUser = DB::query("SELECT u FROM \\Model\\User u WHERE u.login = :login AND u.password = :pass")->param('login', $sUsername)->param('pass', $sEncryptedPassword)->single();
         if ($oUser instanceof Model\User) {
             Session::set('username', $sUsername);
             Session::set('uid', (int) $oUser->getId());
             $oUser->setLoginDateNOW();
             DB::flush();
             # Get role permissions for particular user and set them in session
             \UserPermissions::reset();
             Route::factory(Router::getCurrentRouteName())->redirectTo();
         } else {
             $currentUrl = Router::currentUrl();
             $alert = __('You have entered wrong username or password. Try again.');
             \User\LoginFail::addLoginFail();
             Session::flash($currentUrl, $alert, 'danger');
         }
     }
     $oLoginForm->addToSuffix(View::factory('user/frontend/login_links')->render());
     return View::factory('base/form')->bind('oForm', $oLoginForm);
 }
Exemplo n.º 7
0
 /**
  * Constructor.
  *
  * @access   public
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function __construct()
 {
     # initialize theme
     Theme::initBackend();
     # call parent
     parent::__construct();
     if ($this->sModel !== NULL) {
         $this->setModel(new $this->sModel());
     }
     if (!User::isLogged() || !\UserPermissions::hasPerm(static::PERM_ADMIN_ACCESS)) {
         Route::factory('home')->redirectTo();
     }
     // set body classes
     $this->addBodyClass('skin-red');
     // add main breadcrumbs and title
     $this->alterBreadcrumbsTitleMain();
     // reset JavaScripts and CSS
     $this->resetCss();
     $this->resetJs();
     // add CSS and JavaScript files
     $this->addCss('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext');
     $this->addCss('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
     $this->addCss('https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css');
     $this->addCssByTheme('/bootstrap/css/bootstrap.min.css');
     $this->addCssByTheme('/css/backend.css');
     $this->addJsByTheme('/plugins/jQuery/jQuery-2.1.4.min.js');
     $this->addJsByTheme('/plugins/jQueryUI/jquery-ui.min.js');
     $this->addJsByTheme('/bootstrap/js/bootstrap.min.js');
     $this->addJsByTheme('/js/backend.js');
     $this->addJsByTheme('/js/jquery.mjs.nestedSortable.js');
     $this->addJsByTheme('/js/app.min.js');
     $this->addJsByTheme('/js/backend_after_theme_load.js');
     # add viewport
     $this->addMetaTagRegular('viewport', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
     // generate menu
     $menuView = $this->generateMenu();
     $this->oViewBody->bind('menu', $menuView);
 }
Exemplo n.º 8
0
 * @author  Krzysztof Trzos
 * @package base
 * @since   1.0.0-alpha
 * @version 1.0.0-alpha
 */
?>

<?php 
if (!isset($_COOKIE['cookieswarn'])) {
    ?>
    <div class="cookies_box">
        <div>
            <p>
                Ta strona używa cookie. Dowiedz się więcej o celu ich używania z naszej
                <a href="<?php 
    echo \Plethora\Route::factory('page')->url(['rewrite' => 'politykaprywatnosci']);
    ?>
" title="polityka prywatności">polityki prywatności</a>.
                Korzystając ze strony wyrażasz zgodę na używanie cookie, zgodnie z aktualnymi ustawieniami przeglądarki.
            </p>
            <span class="close">x</span>
        </div>
    </div>

    <script type="text/javascript">
        $(function() {
            $('div.cookies_box span.close').click(function() {
                $(this).closest('div.cookies_box').remove();

                var exdate = new Date();
                exdate.setDate(exdate.getDate() + 31);
Exemplo n.º 9
0
<?php

/* @version 1.0.1, 2014-11-27 */
/* @var $oUser \Model\User */
?>

<?php 
if (\Plethora\Router::getParam('id') == \Plethora\Session::get('uid')) {
    ?>
    <p style="text-align: center;">
        <a href="<?php 
    echo \Plethora\Route::factory('user_profile_edit')->url();
    ?>
" title="<?php 
    echo __('Edit profile');
    ?>
">
            [ <?php 
    echo __('Edit profile');
    ?>
 ]
        </a>
    </p>
<?php 
}
?>

<div class="user_profile">
    <table>
        <tbody>
        <tr>
Exemplo n.º 10
0
use Plethora\Exception;
use Plethora\Route;
use Plethora\Router;
?>

<?php 
# get logged user
$user = Model\User::getLoggedUser();
# register date
$registerDate = $user->getRegisterDate()->format('Y-m-d');
# avatar
$userImage = $user->getImageStyled();
# logout anchor
$logoutHelper = \Plethora\Helper\Link::factory();
$logoutHelper->getAttributes()->addToAttribute('class', 'btn btn-default btn-flat');
$logout = $logoutHelper->code(__('Logout'), Route::factory('logout')->url());
?>

<a href="<?php 
echo Route::backendUrl();
?>
" class="logo">
    <span class="logo-mini"><b>Pl</b></span>
    <span class="logo-lg"><b>Plethora</b></span>
</a>

<nav class="navbar navbar-static-top" role="navigation">
    <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only"><?php 
echo __('Toggle navigation');
?>
Exemplo n.º 11
0
if (\Model\User::isLogged()) {
    ?>
        <p><?php 
    echo __('You are logged! Go and see whats in your management panel ;).');
    ?>
</p>
        <p>
            <?php 
    $backend = Helper\Link::factory();
    $backend->getAttributes()->addToAttribute('class', 'btn btn-danger btn-lg');
    echo $backend->code(__('go to management panel'), Route::factory('backend')->url());
    ?>
            <?php 
    echo $loginLink->code(__('logout'), Route::factory('logout')->url());
    ?>
        </p>
    <?php 
} else {
    ?>
        <p><?php 
    echo __('Click the button below to login and start managing. Enjoy!');
    ?>
</p>
        <p><?php 
    echo $loginLink->code(__('login page'), Route::factory('login')->url());
    ?>
</p>
    <?php 
}
?>
</div>
Exemplo n.º 12
0
<script type="text/javascript">
	$(function() {
		$('#run_cron').click(function() {
			var $this = $(this);
			var oldLabel = $this.text();

			$('div#cron_result').html('');
			$this.text('<?php 
echo __('loading...');
?>
');

			$.ajax({
				url: '<?php 
echo \Plethora\Route::factory('cron')->url(['token' => \Plethora\Config::get('base.cron_token')]);
?>
'
			}).done(function(output) {
				$this.text(oldLabel);

				console.log(output);

				if(output === '') {
					output = 'All cron jobs have been executed.';
				}

				$('div#cron_result').html(output);
			});
		});
	});
Exemplo n.º 13
0
 /**
  * Method used to generate code redirecting to main subpage of this
  * module.
  *
  * @access   private
  * @throws   Exception\Router
  * @since    1.2.0-dev
  * @version  1.2.0-dev
  */
 private static function reloadToIndex()
 {
     Route::factory('backend')->redirectTo(['controller' => 'i18n', 'action' => 'index']);
 }
Exemplo n.º 14
0
<?php

/**
 * @author         Krzysztof Trzos
 * @package        base
 * @subpackage     views/backend/blocks/body
 * @since          1.0.0-alpha
 * @version        1.0.0-alpha
 */
use Plethora\Core;
use Plethora\Helper;
use Plethora\Route;
?>

<?php 
$sChangelogLink = Route::factory('framework_changelog')->url();
$changelogAnchor = Helper\Link::factory()->setTitle(__('changelog'))->code(Core::getVersion(), $sChangelogLink);
?>

<footer class="main-footer">
    <div class="pull-right hidden-xs">
        <b><?php 
echo __('Version');
?>
</b> <?php 
echo $changelogAnchor;
?>
    </div>
    <strong>Copyright &copy; 2016 <a href="http://plethorafw.com">Plethora Framework</a>.</strong> <?php 
echo __('All rights reserved.');
?>
Exemplo n.º 15
0
 /**
  * Generate local actions View.
  *
  * @static
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public static function generateActions()
 {
     $aActions = [];
     $sForRoute = Router::getCurrentRouteName();
     $aLocalActions = static::getLocalActions($sForRoute);
     // create local actions
     foreach ($aLocalActions as $oAction) {
         /* @var $oAction LocalActions\Action */
         // check conditions
         $aConditions = $oAction->getConditions();
         $oBuilder = $oAction->getBuilder();
         $aParams = $oAction->getParameters();
         if (!empty($aConditions)) {
             foreach ($oAction->getConditions() as $sParam => $sParamValue) {
                 if (Router::getParam($sParam) != $sParamValue) {
                     continue 2;
                 }
             }
         }
         // get route and check access to it
         $oRoute = Route::factory($oAction->getRoute());
         if ($oRoute->hasAccess($aParams) === FALSE) {
             continue 1;
         }
         // use builder, if set
         if ($oBuilder !== NULL) {
             $oBuilder($oAction);
         }
         // create new local action
         $sURL = $oRoute->url($oAction->getParameters());
         $aActions[] = ['url' => $sURL, 'title' => $oAction->getTitle(), 'icon' => $oAction->getIcon()];
     }
     return View::factory('base/local_actions')->bind('aActions', $aActions);
 }
Exemplo n.º 16
0
 /**
  * Find active route in particular menu.
  *
  * @access   private
  * @param    array   $routes
  * @param    integer $parentKey
  * @param    array   $parent
  * @since    1.0.0-dev
  * @version  1.3.0-dev
  */
 private function findActiveRoute(array &$routes, $parentKey = NULL, array $parent = [])
 {
     foreach ($routes as $i => &$route) {
         /* @var $route array */
         /* @var $routeName string */
         /* @var $routeParams array */
         /* @var $activeRoutes array */
         if (!isset($route['classes'])) {
             $route['classes'] = [];
         }
         $routeName = Helper\Arrays::get($route, 'route_name', NULL);
         $url = Helper\Arrays::get($route, 'url', NULL);
         $routeParams = Helper\Arrays::get($route, 'route_parameters', []);
         $activeRoutes = Helper\Arrays::get($route, 'active_routes', []);
         //            $path        = $url === NULL ? Route::factory($routeName)->path($routeParams) : $url;
         if ($routeName !== NULL) {
             $path = Route::factory($routeName)->path($routeParams);
         } else {
             $path = $url;
         }
         $path = str_replace(Router::getBase(), '', $path);
         $currentPath = Router::getCurrentUrl();
         if (in_array(Router::getCurrentRouteName(), $activeRoutes)) {
             $route['classes'][] = ['current ' . $this->activeTrailClass];
         }
         if ($parentKey !== NULL) {
             $route['parent_key'] = $parentKey;
             $route['parent'] = $parent;
         }
         if ($path === $currentPath) {
             $this->goBackAndSetActive($route);
         }
         if (isset($route['children']) && !empty($route['children'])) {
             $this->findActiveRoute($route['children'], $i, $routes);
             /* @var $oChildren View */
         }
     }
 }
Exemplo n.º 17
0
 /**
  * Format value.
  *
  * @access   public
  * @param    string $value
  * @return   string
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function format($value)
 {
     $oLink = Helper\Link::factory();
     // set title attribute
     $sTitle = '';
     $sURL = '';
     $oModel = $this->getField()->getEntity()->getModel();
     $oLocales = $oModel->getLocales();
     if ($oModel->hasField($this->getConfigTitle())) {
         $sTitle = $oModel->{$this->getConfigTitle()};
     } elseif ($oLocales !== NULL && $oLocales->hasField($this->getConfigTitle())) {
         $sTitle = $oLocales->{$this->getConfigTitle()};
     }
     $sTitle = $this->titlePrefix . $sTitle . $this->titleSuffix;
     if (!empty($sTitle)) {
         $oLink->setTitle($sTitle);
     }
     // set URL of the link
     if ($this->bValueAsURL) {
         $sURL = $value;
     } elseif (!empty($this->valueFromField)) {
         $sURL = $this->getField()->getEntity()->getModel()->getValue($this->valueFromField);
     } elseif ($this->getUrl() !== NULL) {
         $sURL = $this->getUrl();
     } elseif ($this->getRouteName() !== NULL) {
         $aArgs = $this->getRouteAttributes();
         foreach ($aArgs as $sAttrKey => $sField) {
             $sAttrValue = NULL;
             if ($oModel->hasField($sField)) {
                 $sAttrValue = $oModel->{$sField};
             } elseif ($oLocales !== NULL && $oLocales->hasField($sField)) {
                 $sAttrValue = $oLocales->{$sField};
             }
             $aArgs[$sAttrKey] = Helper\String::prepareToURL($sAttrValue);
         }
         $sURL = Route::factory($this->getRouteName())->url($aArgs);
     }
     // return newly generated link code
     return $this->sPrefix . $oLink->code($value, $sURL) . $this->sSuffix;
 }
Exemplo n.º 18
0
 /**
  * ACTION - Contents list.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionSort()
 {
     // check access
     if (!\UserPermissions::hasPerm($this->getPermissionPrefix() . static::PERM_CONTENT_SORT)) {
         Route::factory('home')->redirectTo();
     }
     // add title ad breadcrumb
     $this->alterBreadcrumbsTitleSort();
     // add local actions
     $this->alterSortLocalActions();
     // generate search engine and list query which is based on it
     $aResult = $this->alterSortQueryResult();
     // load list
     $aList = [];
     if (empty($aResult)) {
         $this->addSystemMessage(__('Entries list is empty.'), 'info');
     } else {
         foreach ($aResult as $oObject) {
             /* @var $oObject ModelCore\Traits\Sortable */
             if (!isset($aList[$oObject->getOrderParent()])) {
                 $aList[$oObject->getOrderParent()] = [];
             }
             $aList[$oObject->getOrderParent()][] = $oObject;
         }
     }
     // sort items
     $sortList = function ($aList, $iIndex) use(&$sortList) {
         $aOutput = [];
         if (isset($aList[$iIndex]) && is_array($aList[$iIndex])) {
             foreach ($aList[$iIndex] as $oObject) {
                 $aOutput[] = ['object' => $oObject, 'siblings' => $sortList($aList, $oObject->id)];
             }
         }
         return $aOutput;
     };
     $aListSorted = $sortList($aList, 0);
     // return View
     return View::factory($this->sViewSort)->set('oModel', $this->getModel())->bind('aList', $aListSorted)->bind('sColumn', $this->sColumnForSort);
 }
Exemplo n.º 19
0
 * @version        2.1.0-dev
 */
use Plethora\Core;
use Plethora\Helper;
use Plethora\Route;
$siteName = Core::getAppName();
$contactUrl = Helper\Html::a(Route::factory('contact')->url(), __('CONTACT'));
?>

<?php 
/* @var $sRecoveryCode string */
/* @var $sLogin string */
?>

<?php 
$passRecoveryLink = Route::factory('password_recovery_code')->url(['code' => $sRecoveryCode]);
?>

<p><?php 
echo __('Hello :login', ['login' => $sLogin]);
?>
,</p>
<p><?php 
echo __('We were asked to change password on your account ' . 'registered on :site_name site. To do this, click on ' . 'the link below:', ['site_name' => $siteName]);
?>
</p>
<p style="text-align: center;">
    <a href="<?php 
echo $passRecoveryLink;
?>
" title="<?php 
Exemplo n.º 20
0
<?php

/**
 * @author		Krzysztof Trzos
 * @package		user
 * @subpackage	views\frontend
 * @since		2.25.0, 2015-02-18
 * @version		1.0.0, 2015-02-18
 */
?>

<?php 
$sAnchor = \Plethora\Helper\Html::a(\Plethora\Route::factory('contact')->url(), __('contact'));
?>

<p class="act_txt"><?php 
echo __('An error occurred while recovering access to your account. The reason may be one of the following points');
?>
</p>
<ul class="func_list">
	<li><?php 
echo __('recovery operation has already been made under this link;');
?>
</li>
	<li><?php 
echo __('link from the e-mail was not fully copied into your browser\'s address field.');
?>
</li>
</ul>
<p class="act_txt"><?php 
echo __('If none of the above reasons does not solve the problem, please contact us via the :contact section.', array('contact' => $sAnchor));
Exemplo n.º 21
0
 /**
  * Action to set new password after e-mail validation.
  *
  * @access   public
  * @return   View
  * @since    1.0.0, 2015-02-17
  * @version  2.1.0-dev
  */
 public function actionNewPassword()
 {
     // fill up breadcrumbs title and other
     $this->addBreadCrumb(__('New password'));
     // get code from $_GET
     $sCode = Router::getParam('code');
     // get recovery code from DB
     $oRecoveryCode = DB::query("SELECT c FROM \\Model\\User\\RecoveryCode c WHERE c.code = :code")->param('code', $sCode)->single();
     /* @var $oResult User\RecoveryCode */
     // check if code exists
     if ($oRecoveryCode instanceof User\RecoveryCode) {
         $this->addToTitle(' - ' . __('New password'));
         // get user
         $oUser = $oRecoveryCode->getUser();
         // generate form for account access recovery
         $oConfig = ModelCore\ModelFormConfig::factory()->noReload()->setFieldsRestriction(['password'])->setMessage(__('Your password has been successfully changed to the new one.'))->setAction(Route::factory('password_recovery')->url());
         // get form
         $oModelForm = $oUser->form('new_password', $oConfig);
         $oForm = $oModelForm->generate();
         // check if form is valid
         if ($oForm->isSubmittedAndValid()) {
             $oRecoveryCode->remove();
             Session::flash(Route::factory('password_recovery')->url(), __('Password has been changed successfully.'));
         }
         $oForm->addToPrefix(View::factory('user/frontend/recovery/new_pass_prefix')->render());
         // return view
         return View::factory('base/form')->bind('oForm', $oForm);
     } else {
         $this->addToTitle(' - ' . __('Error occured'));
         return View::factory('user/frontend/recovery/wrong_code');
     }
 }
Exemplo n.º 22
0
<?php

/**
 * @author     Krzysztof Trzos <*****@*****.**>
 * @package    user
 * @subpackage views
 * @since      2.1.0-dev
 * @version    2.1.0-dev
 */
?>

<div class="login_links">
	<p><?php 
echo \Plethora\Helper\Html::a(\Plethora\Route::factory('password_recovery')->url(), __('I forgot password'));
?>
</p>
	<p><?php 
echo \Plethora\Helper\Html::a(\Plethora\Route::factory('register')->url(), __('I want to register an account'));
?>
</p>
</div>
Exemplo n.º 23
0
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <p class="navbar-text"><?php 
echo __('Hello :user', ['user' => $userAnchor]);
?>
</p>
                </li>

                <?php 
if ($oUser instanceof Model\User) {
    ?>
                    <li>
                        <a
                            href="<?php 
    echo Route::factory('logout')->url();
    ?>
"
                            title="<?php 
    echo __('Logout');
    ?>
"><?php 
    echo __('Logout');
    ?>
</a>
                    </li>
                <?php 
}
?>
            </ul>
        </div>
Exemplo n.º 24
0
 /**
  * ACTION - Contents list.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionList()
 {
     Route::factory('backend')->redirectTo();
 }
Exemplo n.º 25
0
 * @since      1.0.0
 * @version    2.1.0-dev
 */
?>

<?php 
/* @var $bActivated boolean */
?>

<?php 
if ($bActivated) {
    ?>
	<p class="correct_activation">Gratulacje! Twoje konto zostało w pełni aktywowane!</p>
	<p class="act_txt">Możesz się teraz zalogować.</p>
<?php 
} else {
    ?>
	<p class="incorrect_activation">Błąd!</p>
	<p class="act_txt">Konto nie zostało aktywowane. Powodem tego może być jeden z poniższych punktów:</p>
	<ul class="func_list">
		<li>konto zostało już wcześniej aktywowane;</li>
		<li>link aktywacyjny nie został w całości przekopiowany do pola adresu przeglądarki;</li>
	</ul>
	<p class="act_txt">Jeżeli żaden z powyższych powodów nie rozwiązuje problemu aktywacji konta, skontaktuj się z nami poprzez dział
		<a href="<?php 
    echo \Plethora\Route::factory('contact')->url();
    ?>
" title="Dział kontakt">KONTAKT</a>.
	</p>
<?php 
}
Exemplo n.º 26
0
 /**
  * Find active route in particular menu.
  *
  * @access	private
  * @param	array    $aRoutes
  * @param	integer  $iParentKey
  * @param	array    $aParent
  * @since	1.2.0-dev
  * @version	1.2.0-dev
  */
 private function findActiveRoute(array &$aRoutes, $iParentKey = NULL, array $aParent = [])
 {
     foreach ($aRoutes as $i => &$aRoute) {
         /* @var $aRoute array */
         $oItem = $aRoute['object'];
         /* @var $oItem \Model\Menu\Item */
         $sRouteName = $oItem->getRoute();
         /* @var $sRouteName string */
         $aRouteParams = $oItem->getRouteParams() !== NULL ? $oItem->getRouteParams() : [];
         /* @var $aRouteParams array */
         $aActiveRoutes = $oItem->getActiveRoutes() !== NULL ? $oItem->getActiveRoutes() : [];
         /* @var $aRouteParams array */
         $sPath = Route::factory($sRouteName)->path($aRouteParams);
         $sCurrentPath = Router::getCurrentUrl();
         if (in_array(Router::getCurrentRouteName(), $aActiveRoutes)) {
             $aRoute['classes'] = 'current active_trail';
         } elseif (!isset($aRoute['classes'])) {
             $aRoute['classes'] = NULL;
         }
         if ($iParentKey !== NULL) {
             $aRoute['parent_key'] = $iParentKey;
             $aRoute['parent'] = $aParent;
         }
         if ($sPath === $sCurrentPath) {
             $this->goBackAndSetActive($aRoute);
         }
         if (isset($aRoute['siblings']) && !empty($aRoute['siblings'])) {
             $this->findActiveRoute($aRoute['siblings'], $i, $aRoutes);
             /* @var $oChildren View */
         }
     }
 }
Exemplo n.º 27
0
 /**
  * Remove all data of this Model from database.
  *
  * @access   public
  * @return   boolean
  * @since    2.1.2-dev
  * @version  2.1.2-dev
  */
 public function remove()
 {
     if ((int) $this->id === 1) {
         Route::factory('home')->redirectTo();
     }
     parent::remove();
 }
Exemplo n.º 28
0
<?php

/**
 * @author         Krzysztof Trzos
 * @package        base
 * @subpackage     views/backend/blocks/body
 * @since          1.0.0-alpha
 * @version        1.0.0-alpha
 */
?>

<?php 
$sChangelogLink = \Plethora\Route::factory('framework_changelog')->url();
?>

<div class="container">
    <p class="text-muted text-right"><?php 
echo __('author');
?>
: <b>Krzysztof Trzos</b> with
        <a href="<?php 
echo $sChangelogLink;
?>
" title="<?php 
echo __('changelog');
?>
">Plethora v<?php 
echo \Plethora\Core::getVersion();
?>
</a></p>
</div>