Пример #1
0
 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!'));
             }
         }
     }
 }
Пример #2
0
 public function createImage()
 {
     $name = str_replace(' ', '', $this->getRouteParameter('name', \Zbase\Models\Data\Column::f('string', 'personfirstname')));
     $font = $this->getRouteParameter('font', null);
     $material = $this->getRouteParameter('material', 'material');
     $options = zbase_request_inputs();
     $create = true;
     return $this->view(zbase_view_file_contents('customize.image'), compact('name', 'font', 'create', 'material', 'options'));
 }
Пример #3
0
 /**
  * Return all inputs
  * @return array
  */
 public function inputs()
 {
     return zbase_request_inputs();
 }
Пример #4
0
 public function controllerIndex()
 {
     if (!$this->getModule()->hasAccess()) {
         if (zbase_auth_has()) {
             return $this->unathorized(_zt('You don\'t have enough access to the resource.'));
         } else {
             return redirect()->to(zbase_url_from_route('login'));
         }
     }
     /**
      * Check for widgets
      */
     $widgetsAction = $action = str_replace('.', '-', $this->getRouteParameter('action', 'index'));
     $requestMethod = zbase_request_method();
     if (!empty($this->nodeName)) {
         $widgetsAction = $requestMethod . '-node-' . $this->nodeName . '-' . $action;
         $htmls = [];
     }
     $isAjax = zbase_request_is_ajax();
     if ($isAjax) {
         $widgetsAction = (!empty($this->nodeName) ? $requestMethod . '-node-' . $this->nodeName . '-' : '') . 'json-' . $action;
         $htmls = [];
     }
     if ($this->getModule()->hasAction($requestMethod . '-' . $action)) {
         $widgetsAction = $requestMethod . '-' . $action;
         $action = $widgetsAction;
         $htmls = [];
     }
     $widgets = $this->getModule()->pageProperties($action)->widgetsByControllerAction($widgetsAction);
     if (count($widgets) == 1) {
         $firstWidget = collect($widgets)->first();
         if ($firstWidget instanceof \Zbase\Widgets\WidgetInterface) {
             $firstWidget->pageProperties($widgetsAction);
         }
     }
     if (!is_array($widgets) && $widgets instanceof \Illuminate\Http\RedirectResponse) {
         return $widgets;
     }
     zbase()->json()->addVariable('_widget', $this->getModule()->id() . '_' . str_replace('-', '', $action));
     if (zbase_is_dev()) {
         zbase()->json()->addVariable(__METHOD__, $widgetsAction);
         if (zbase_request_is_post()) {
             zbase()->json()->addVariable('_POST_PARAMETERS', zbase_request_inputs());
         }
         zbase()->json()->addVariable('_ROUTE_PARAMETERS', zbase_route_inputs());
         zbase()->json()->addVariable('_GET_PARAMETERS', zbase_request_query_inputs());
     }
     // dd($this->getModule(), $widgetsAction, $widgets);
     if (empty($widgets)) {
         return zbase_abort(404);
     }
     foreach ($widgets as $widget) {
         if (!empty($this->nodeName)) {
             zbase()->json()->addVariable('node', ['prefix' => $this->getModule()->nodeNamespace(), 'name' => $this->nodeName, 'support' => 1]);
             $widget->setNodename($this->nodeName)->setNodeSupport(true);
         }
         if ($widget instanceof \Zbase\Widgets\ControllerInterface) {
             $v = $widget->validateWidget($action);
             if ($v instanceof \Illuminate\Contracts\Validation\Validator) {
                 if ($isAjax) {
                     zbase()->json()->addVariable('errors', $v->errors()->getMessages());
                     return new \Illuminate\Http\JsonResponse($v->errors()->getMessages(), 422);
                 } else {
                     return redirect()->to($this->getRedirectUrl())->withInput(zbase_request_inputs())->withErrors($v->errors()->getMessages());
                 }
             }
             $ret = $widget->controller($this->getRouteParameter('action', 'index'));
             if ($ret instanceof \Zbase\Exceptions\NotFoundHttpException) {
                 return $this->notFound();
             }
             if ($ret instanceof \Zbase\Exceptions\UnauthorizedException) {
                 return $this->unathorized();
             }
             if ($ret instanceof \Zbase\Exceptions\Exception) {
                 return $this->error();
             }
             if ($ret instanceof \Illuminate\Http\RedirectResponse) {
                 if ($isAjax) {
                     zbase()->json()->addVariable('redirect', $ret->getTargetUrl());
                 } else {
                     return $ret;
                 }
             }
             if (zbase_is_json()) {
                 zbase_response_format_set('json');
                 $jsonIndexName = $widget->getWidgetPrefix();
                 if (zbase_is_angular()) {
                     if ($widget instanceof \Zbase\Widgets\Type\Datatable) {
                         $angularTemplate = zbase_angular_widget_datatable($this->getModule(), $widget);
                         $jsonIndexName = $angularTemplate['serviceName'];
                     }
                 }
                 if (zbase_is_dev()) {
                     zbase()->json()->addVariable('$jsonIndexName', $jsonIndexName);
                 }
                 if (!$widget->isExporting()) {
                     zbase()->json()->addVariable($jsonIndexName, $widget->toArray());
                 }
             } else {
                 if ($isAjax) {
                     $htmls[str_replace('-', '_', $widget->id())] = $widget->render();
                 }
             }
             $widget->pageProperties($widgetsAction);
         }
     }
     if (!empty($isAjax)) {
         zbase()->json()->addVariable('_widgets', 1);
         zbase()->json()->addVariable('html', $htmls);
     } else {
         return $this->view(zbase_view_file('module.index'), array('module' => $this->getModule(), 'widgets' => $widgets));
     }
 }
Пример #5
0
 /**
  * Validate widget
  */
 public function validateWidget($action)
 {
     if ($this->_urlHasRequest) {
         if (empty($this->_entity)) {
             return zbase_abort(404);
         }
         if ($this->isAdmin() && $this->_entity instanceof \Zbase\Entity\Laravel\Node\Nested) {
             $children = $this->_entity->getImmediateDescendants();
             if ($children->count()) {
                 return zbase_abort(404);
             }
         }
     }
     $this->setAction($action);
     $this->prepare();
     if (zbase_request_method() == 'post') {
         $currentTab = zbase_request_input('tab', false);
         if (!empty($currentTab)) {
             zbase_session_flash('sessiontab', $currentTab);
         }
         if ($this->isDeleting()) {
             return;
         }
         $validationRules = $this->getValidationRules();
         if (!empty($validationRules)) {
             $v = \Validator::make(zbase_request_inputs(), $validationRules, $this->getValidationMessages());
             if ($v->fails()) {
                 zbase_session_flash('posted', true);
                 $this->setHasError($v->errors()->getMessages());
                 $messageBag = $v->getMessageBag();
                 zbase_alert(\Zbase\Zbase::ALERT_ERROR, $messageBag, ['formvalidation' => true]);
                 return $v;
             }
             $inputs = zbase_request_inputs();
             foreach ($inputs as $k => $v) {
                 $e = $this->element($k);
                 if ($e instanceof \Zbase\Ui\Form\ElementInterface) {
                     $e->setValue($v);
                 }
             }
         }
     }
 }
Пример #6
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());
}]]]]];
Пример #7
0
 protected function validateApi()
 {
     if (!empty($this->apiConfiguration['params'])) {
         $notParams = [];
         if (!empty($this->apiConfiguration['notParams'])) {
             $notParams = $this->apiConfiguration['notParams'];
         }
         $inputs = zbase_route_inputs();
         unset($inputs['username']);
         unset($inputs['key']);
         unset($inputs['format']);
         unset($inputs['module']);
         unset($inputs['object']);
         unset($inputs['method']);
         $rules = array();
         $messages = array();
         if (zbase_request_is_post()) {
             $inputs = zbase_request_inputs();
         }
         foreach ($this->apiConfiguration['params'] as $paramName => $param) {
             $pRules = array();
             if (!empty($param['validations'])) {
                 foreach ($param['validations'] as $ruleName => $ruleConfig) {
                     $enable = true;
                     $rule = $ruleName;
                     if (isset($ruleConfig['enable'])) {
                         $enable = $ruleConfig['enable'];
                     }
                     if (!empty($enable)) {
                         if (!empty($ruleConfig['text'])) {
                             $rule = zbase_data_get($ruleConfig, 'text');
                         }
                         $pRules[] = $rule;
                         if (!empty($ruleConfig['message'])) {
                             $messages[$paramName . '.' . $ruleName] = $ruleConfig['message'];
                         }
                     }
                 }
             }
             if (!empty($pRules)) {
                 $rules[$paramName] = implode('|', $pRules);
             }
             if (isset($inputs[$paramName])) {
                 if (!empty($param['varname'])) {
                     $this->params[$param['varname']] = $inputs[$paramName];
                 } else {
                     $this->params[$paramName] = $inputs[$paramName];
                 }
             }
         }
         if (!empty($notParams)) {
             foreach ($notParams as $nParam) {
                 if (isset($this->params[$nParam])) {
                     unset($this->params[$nParam]);
                 }
             }
         }
         $validator = \Validator::make($inputs, $rules, $messages);
         if ($validator->fails()) {
             foreach ($validator->errors()->all() as $msg) {
                 $this->apiErrors[] = $msg;
             }
             return false;
         }
     }
     return true;
 }
Пример #8
0
<br />
<br />
<br />
MESSAGE: -------------------
<br />
<?php 
    echo $message;
}
?>

<br />
<br />
<br />
--- DETAILS:
<?php 
$error = 'Date: ' . zbase_date_now()->format('Y-m-d h:i:s A') . "<br />";
$error .= 'URL: ' . zbase_url_uri() . "<br />";
$error .= 'Is Posting: ' . (zbase_request_is_post() ? 'Yes' : 'No') . "<br />";
$error .= 'Is AJAX: ' . (zbase_request_is_ajax() ? 'Yes' : 'No') . "<br />";
$error .= 'Data: ' . json_encode(zbase_request_inputs()) . "<br />";
$error .= 'Routes: ' . json_encode(zbase_route_inputs()) . "<br />";
$error .= 'IP Address: ' . zbase_ip() . "<br /><br /";
if (zbase_auth_has()) {
    $user = zbase_auth_user();
    $error .= 'User: '******' ' . $user->username() . '[' . $user->id() . ']' . "<br />";
}
echo $error;
?>

<?php 
echo zbase_view_render(zbase_view_file_contents('email.footer'));