protected function _contactUs()
 {
     $success = false;
     if ($this->isPost()) {
         if (!zbase_captcha_verify()) {
             return $this->buildFailedValidationResponse(zbase_request(), ['ReCAPTCHA Validation failed.']);
         }
         $validatorMessages = ['email.required' => _zt('Email Address is required.'), 'email.email' => _zt('Invalid email address.'), 'comment.required' => _zt('Message is required.'), 'name.required' => _zt('Name is required.')];
         $rules = ['email' => 'required|email', 'comment' => 'required', 'name' => 'required'];
         $valid = $this->validateInputs(zbase_request_inputs(), $rules, $validatorMessages);
         if (!empty($valid)) {
             $data = zbase_request_inputs();
             $success = zbase_messenger_email('contactus', zbase_request_input('email'), _zt(zbase_site_name() . ' - Contact Us Form - ' . zbase_request_input('name')), zbase_view_file_contents('email.contactus'), $data);
             if (!empty($success)) {
                 zbase_alert('success', _zt('Message sent!'));
                 zbase()->json()->setVariable('contact_success', 1);
                 if (!zbase_is_json()) {
                     return redirect(zbase_url_previous());
                 }
             } else {
                 zbase_alert('error', _zt('There was a problem sending your message. Kindly try again!'));
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Controller Action
  * 	This will be called validating the form
  * @param string $action
  */
 public function controller($action)
 {
     $this->setAction($action);
     $repoMethod = $this->_v('repo.method', 'count');
     if ($repoMethod == 'update') {
         $ret = $this->entity()->widgetController(zbase_request_method(), $this->getAction(), [], $this);
         $actionMessages = $this->entity()->getActionMessages($this->getAction());
         if (!empty($actionMessages)) {
             foreach ($actionMessages as $alertType => $alertMessages) {
                 if (is_array($alertMessages)) {
                     foreach ($alertMessages as $alertMessage) {
                         zbase_alert($alertType, $alertMessage);
                     }
                 }
             }
         }
         if (!empty($ret)) {
             $url = zbase_url_previous();
             return zbase_redirect()->to($url);
         }
     }
     if (!$this->checkUrlRequest()) {
         return zbase_abort(404);
     }
     $this->_rows();
 }
Beispiel #3
0
 /**
  * Event after Action
  * @param string $action
  * @param string $url The Default URL to redirect
  */
 protected function _postEvent($action)
 {
     if ($this->isPublic() && $this->isNode() && $this->isCreating()) {
         return zbase_redirect()->to($this->entity()->alphaUrl());
     }
     $isAjax = zbase_request_is_ajax();
     $requestMethod = strtolower(zbase_request_method());
     if ($isAjax) {
         if ($requestMethod == 'post') {
             $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json.post', $this->_v('event.' . $action . '.post-json'));
         } else {
             $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json', $this->_v('event.' . zbase_section() . '.' . $action . '.post'));
         }
     } else {
         if ($requestMethod == 'post') {
             $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post.post', $this->_v('event.' . $action . '.post.post', null));
         } else {
             $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post', $this->_v('event.' . $action . '.post', null));
         }
     }
     if (is_null($e)) {
         if (zbase_is_back()) {
             if ($this->isCreating()) {
                 $action = 'update';
             }
             $byAlphaId = $this->_v('entity.repo.byAlphaId.route', false);
             if ($this->entityIsPostInterface($this->entity())) {
                 if (!empty($byAlphaId)) {
                     $params = ['action' => $action, 'id' => $this->entity()->postAlphaId()];
                 } else {
                     $params = ['action' => $action, 'id' => $this->entity()->postId()];
                 }
             } else {
                 if (!empty($byAlphaId)) {
                     $params = ['action' => $action, 'id' => $this->entity()->alphaId()];
                 } else {
                     $params = ['action' => $action, 'id' => $this->entity()->id()];
                 }
             }
         } else {
             $params = ['action' => $action, 'id' => $this->entity()->alphaId()];
         }
         if ($action == 'delete') {
             $params = [];
         }
         $url = $this->getModule()->url(zbase_section(), $params);
         if ($action == 'restore' || $action == 'ddelete') {
             $url = zbase_url_previous();
         }
     }
     if (!empty($e)) {
         if (!empty($e['data'])) {
             if ($isAjax) {
                 zbase()->json()->addVariables($e['data']);
             }
         }
         if (!empty($e['route'])) {
             $params = zbase_route_inputs();
             if (!empty($e['route']['params'])) {
                 $params = array_merge($params, $e['route']['params']);
             }
             if (zbase_is_back()) {
                 $byAlphaId = $this->_v('entity.repo.byAlphaId.route', false);
                 if (!empty($byAlphaId)) {
                     $params['id'] = $this->entity()->alphaId();
                 } else {
                     $params['id'] = $this->entity()->id();
                 }
             }
             if ($action == 'ddelete') {
                 if (isset($params['id']) && isset($params['action'])) {
                     unset($params['id']);
                     unset($params['action']);
                 }
             }
             $e['route']['params'] = $params;
             $url = zbase_url_from_config($e);
         }
         $toUrl = zbase_value_get($e, 'url', false);
         if (!empty($toUrl)) {
             $url = $toUrl;
         }
     }
     $enableRedirect = $this->_v('event.' . zbase_section() . '.' . $action . '.post.redirect.enable', $this->_v('event.' . $action . '.post.redirect.enable', true));
     if (!empty($url) && !empty($enableRedirect)) {
         return zbase_redirect()->to($url);
     }
     return true;
 }
Beispiel #4
0
<?php

/**
 * Dx
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 5, 2016 11:51:42 PM
 * @file dsstore/module.php
 *
 */
return ['id' => 'system', 'enable' => true, 'access' => 'only::sudo', 'class' => null, 'backend' => true, 'frontend' => false, 'url' => ['backend' => 'system/{action?}/{id?}/{task?}'], 'navigation' => ['back' => ['enable' => true, 'nav' => ['order' => 9998, 'route' => ['name' => 'admin.dsorders'], 'icon' => 'fa fa-gears', 'label' => 'System', 'title' => 'System', 'children' => [['route' => ['name' => 'admin.system', 'params' => ['action' => 'maintenance']], 'icon' => 'fa fa-flash', 'label' => 'Maintenance', 'title' => 'Maintenance'], ['route' => ['name' => 'admin.system', 'params' => ['action' => 'telegram']], 'icon' => 'fa fa-flash', 'label' => 'Telegram', 'title' => 'Telegram']]]]], 'controller' => ['back' => ['action' => ['telegram' => ['page' => ['title' => 'Telegram Integration', 'headTitle' => 'Telegram Integration', 'subTitle' => '', 'breadcrumbs' => [['label' => 'Telegram Integration']]]], 'maintenance' => ['page' => ['title' => 'System Maintenance', 'headTitle' => 'System Maintenance', 'subTitle' => '', 'breadcrumbs' => [['label' => 'System Maintenance']]]], 'maintenance-mode-on' => ['page' => ['title' => 'System Maintenance - WEBSITE IN MAINTENANCE MODE!', 'headTitle' => 'System Maintenance', 'subTitle' => '', 'breadcrumbs' => [['label' => 'System Maintenance']]]], 'maintenance-mode-off' => ['page' => ['title' => 'System Maintenance', 'headTitle' => 'System Maintenance', 'subTitle' => '', 'breadcrumbs' => [['label' => 'System Maintenance']]]]]]], 'routes' => [], 'widgets' => ['back' => ['controller' => ['action' => ['maintenance' => ['system-maintenance-form' => null], 'telegram' => ['telegram-settings-form' => null], 'telegram-disable' => function () {
    zbase()->telegram()->disableUserTelegram(zbase_auth_user());
    return redirect()->to(zbase_url_previous());
}, 'post-telegram' => function () {
    zbase()->telegram()->saveSettings(zbase_request_inputs());
    return ['telegram-settings-form' => null];
}, 'post-maintenance' => function () {
    zbase()->system()->scheduleDowntime(zbase_request_inputs());
    return ['system-maintenance-form' => null];
}, 'maintenance-mode-on' => function () {
    zbase()->system()->startMaintenance();
    return redirect()->to(zbase_url_previous());
}, 'maintenance-mode-off' => function () {
    zbase()->system()->stopMaintenance();
    return redirect()->to(zbase_url_previous());
}]]]]];
Beispiel #5
0
    /**
     * SCripts when this content/view is displayed on innerContent via Ajax
     *
     * @param boolean $load Data is Loading else we are leaving the page, going back
     * @return void
     */
    public function postPageOnInnerContentScript($tag = null)
    {
        if (!empty(zbase_request_input('_innercontent'))) {
            if (method_exists($this, 'pageOnInnerContentScript')) {
                $this->pageOnInnerContentScript($tag);
            }
            $postHtmlId = $this->postHtmlId();
            $away = zbase_request_input('_innercontentaway', false);
            $tableRowId = zbase_request_input('_datatableRow', false);
            $innerContentId = zbase_request_input('_innerContentId', false);
            /**
             * Currently viewing the data
             */
            $innerContentView = zbase_request_input('_innerContentView', false);
            if (empty($away)) {
                if (!empty($innerContentView)) {
                    zbase()->json()->setVariable('_html_selector_replace', ['h3.page-title span.' . $this->postHtmlCommonId() => '<span class="' . $this->postHtmlCommonId() . '">' . zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small></span>'], true);
                } else {
                    if (!empty($tableRowId) && !empty($innerContentId)) {
                        zbase()->json()->setVariable('_html_selector_remove', ['.' . $this->postHtmlCommonId() => ''], true);
                        zbase()->json()->setVariable('_html_selector_append', ['.page-breadcrumb.breadcrumb' => '<li class="' . $this->postHtmlCommonId() . '"><i class="fa fa-angle-right"></i><a title="' . $this->postDisplayText() . '" href="#">' . $this->postDisplayText() . '</a></li>'], true);
                        zbase()->json()->setVariable('_html_selector_append', ['h3.page-title' => '<span class="' . $this->postHtmlCommonId() . '">' . zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small></span>'], true);
                        zbase()->json()->setVariable('_html_selector_hide', ['.zbase-page-title' => ''], true);
                        $script = 'jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').hide();jQuery(\'.breadcrumb li\').eq(2).find(\'a\').click(function(e){
								e.preventDefault();
								window.history.pushState(\'\',\'' . zbase()->view()->title() . '\',\'' . zbase_url_previous() . '\');
								jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').show();
								jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').siblings().remove();
								jQuery(\'h3.page-title span.' . $this->postHtmlCommonId() . '\').remove();
								jQuery(\'h3.page-title span.zbase-page-title\').show();
								jQuery(\'.breadcrumb li.' . $this->postHtmlCommonId() . '\').remove();
							})';
                        zbase()->json()->setVariable('_html_script', [$script], true);
                    }
                }
            } else {
                $script = 'jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').show();
						jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').siblings().remove();
						jQuery(\'h3.page-title span.' . $this->postHtmlCommonId() . '\').remove();
						jQuery(\'h3.page-title span.zbase-page-title\').show();
						jQuery(\'.breadcrumb li.' . $this->postHtmlCommonId() . '\').remove();';
                zbase()->json()->setVariable('_html_script', [$script], true);
            }
        } else {
            zbase()->json()->setVariable('_html_selector_replace', ['.page-breadcrumb.breadcrumb' => zbase_view_render(zbase_view_file('partial.breadcrumb', zbase_section()))], true);
            zbase()->json()->setVariable('_html_selector_html', ['.page-title' => zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small>'], true);
        }
    }
 /**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(Request $request)
 {
     // $this->validate($request, ['email' => 'required|email|exists:' . zbase_config_get('entity.user.table.name') . ',email']);
     $entity = zbase()->entity('user', [], true);
     $user = $entity->repo()->by('email', zbase_request_input('email'))->first();
     if (!empty($user)) {
         $broker = $this->getBroker();
         $response = \Password::broker($broker)->sendResetLink($this->getSendResetLinkEmailCredentials($request), $this->resetEmailBuilder());
         $user->lostPassword();
     }
     zbase()->json()->setVariable('password_success', 1);
     zbase()->json()->setVariable('_redirect', zbase_url_previous());
     if (!zbase_is_json()) {
         return redirect()->back()->with('status', trans(\Password::RESET_LINK_SENT));
     }
 }
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 8, 2016 10:37:59 AM
 * @file widget.php
 * @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 *
 */
return ['type' => 'form', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.username.enable', true);
}, 'config' => ['entity' => ['name' => 'user', 'method' => 'currentUser', 'repo' => ['method' => 'currentUser']], 'event' => ['username' => ['post-json' => ['url' => function () {
    return zbase_url_previous();
}], 'post' => ['redirect' => ['enable' => true]]]], 'submit' => ['button' => ['label' => 'Update Username']], 'form' => ['startTag' => ['action' => function () {
    if (zbase_is_back()) {
        return zbase_url_from_route('admin.account', ['action' => 'username']);
    }
    return zbase_url_from_route('account', ['action' => 'username']);
}, 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]], 'elements' => ['username' => ['type' => 'text', 'id' => 'username', 'enable' => function () {
    return zbase_config_get('auth.username.enable', false);
}, 'label' => 'Username', 'entity' => ['property' => 'username'], 'angular' => ['ngModel' => 'currentUser.username'], 'validations' => ['required' => ['enable' => true, 'message' => 'Username is required.'], 'unique' => ['enable' => true, 'text' => function () {
    return 'unique:' . zbase_entity('user')->getTable() . ',username,' . zbase_auth_user()->id() . ',user_id';
}, 'message' => 'Username already exists.'], 'regex' => ['enable' => true, 'text' => function () {
    return 'regex:/^[a-z][a-z0-9]{5,31}$/';
}, 'message' => 'Invalid username.'], 'min' => ['enable' => true, 'text' => function () {
    return 'min:5';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'max' => ['enable' => true, 'text' => function () {
    return 'max:32';