Example #1
0
 /**
  * HTML the ui
  * @return string
  */
 public function __toString()
 {
     $this->prepare();
     try {
         if (!is_null($this->_viewFile) && empty($this->_rendered)) {
             $this->_viewParams['ui'] = $this;
             $str = $this->htmlPreContent();
             $str .= zbase_view_render(zbase_view_file_contents($this->_viewFile), $this->getViewParams());
             $str .= $this->htmlPostContent();
             $this->_rendered = true;
             return $str;
         }
         return '';
     } catch (\Exception $e) {
         if (zbase_is_dev()) {
             dd($e);
         }
         zbase_abort(500);
     }
 }
Example #2
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' => 'commons', 'enable' => true, 'backend' => false, 'frontend' => false, 'url' => [], 'routes' => ['lib_geo_ph' => ['usernameRouteCheck' => false, 'url' => 'lib/geo/ph/cities.js', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.js', 'content' => function () {
    return zbase_view_render(zbase_view_file_module('commons.views.lib.geo.ph', 'commons', 'zbase'));
}]]]];
Example #3
0
<?php

$url = URL::to('password/reset', array($token));
echo zbase_view_render(zbase_view_file_contents('email.header'));
?>

We received a request to update your password.
<br />
If this is not you, disregard this email, else click on the link below.
<br /><br />
<?php 
echo $url;
?>
<br />
<br />
<a href="<?php 
echo $url;
?>
">Update your password</a>

<br />
<?php 
echo zbase_view_render(zbase_view_file_contents('email.footer'));
Example #4
0
            echo $navigation->getNavigation(zbase_section());
        }
    }
    ?>
				</ul>
			</div>
		<?php 
}
?>


		<!-- BEGIN TOP NAVIGATION MENU -->
		<ul class="nav navbar-nav pull-right">

			<?php 
echo zbase_view_render(zbase_view_file('partial.notification-bar'));
?>

			<!-- BEGIN USER LOGIN DROPDOWN -->
			<?php 
if (zbase_auth_has()) {
    ?>
				<li class="dropdown user">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
						<img style="width:28px;" alt="" src="<?php 
    echo zbase_auth_user()->avatarUrl(['w' => 30]);
    ?>
"/>
						<span class="username">
							<?php 
    echo zbase_auth_user()->displayName();
<?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 Aug 22, 2016 4:02:17 PM
 * @file maintenance.blade.php
 * @project Zbase
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
echo zbase_view_render(zbase_view_file_module('system.views.maintenance-button', 'system', 'zbase'));
?>

<hr />

<?php 
echo zbase_widget('system-maintenance-form');
Example #6
0
    $page['title'] = '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->roleTitle() . ' - ' . $selectedUser->id() . ': ' . $selectedUser->displayName() . '</span>' . $selectedUser->statusText();
    $page['headTitle'] = $selectedUser->displayName();
    $page['subTitle'] = $selectedUser->email() . '|' . $selectedUser->username() . '|' . $selectedUser->cityStateCountry();
    zbase_view_page_details(['page' => $page]);
    $breadcrumbs = [['label' => 'Users', 'route' => ['name' => 'admin.users']], ['label' => '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->displayName() . '</span>', 'link' => '#', 'title' => $selectedUser->displayName()]];
    zbase_view_breadcrumb($breadcrumbs);
} else {
    $selectedUser = zbase_auth_user();
}
$accountTabs = [];
$accountContents = [];
$accountContents[] = ['position' => 10, 'groupId' => 'information', 'content' => function () use($selectedUser) {
    return zbase_view_render(zbase_view_file_module('account.views.information', 'account', 'zbase'), ['user' => $selectedUser]);
}];
$accountContents[] = ['position' => 10, 'groupId' => 'notification', 'content' => function () use($selectedUser) {
    return zbase_view_render(zbase_view_file_module('account.views.notifications', 'account', 'zbase'), ['user' => $selectedUser]);
}];
$accountContents = zbase_module_widget_contents('account', 'account', zbase_section(), $adminView, null, $accountContents);
$accountTabs = zbase_module_widget_contents('account', 'account', zbase_section(), $adminView, 'tabs');
$widgetConfig = ['config' => ['entity' => ['entity' => $selectedUser]]];
?>
<div class="zbase-ui-wrapper zbase-ui-tabs" id="zbase-ui-tabs-accounttabs">
	<ul class="nav nav-tabs">
		<li class=""><a data-toggle="tab" href="#accounttabsaccountInformation">Account Information</a></li>
		<?php 
if (!empty($accountTabs)) {
    ?>
			<?php 
    foreach ($accountTabs as $accountTab) {
        ?>
				<?php 
Example #7
0
<?php 
} else {
    ?>
	<div role="toolbar" class="btn-toolbar">
		<div class="toolbar-wraper col-md-6 pull-left">
			<?php 
    echo zbase_view_render(zbase_view_file_contents('ui.datatable.pagination'), ['paginator' => $rows, 'ui' => $ui]);
    ?>
		</div>
		<div class="toolbar-wraper col-md-3">
			<?php 
    echo zbase_view_render(zbase_view_file_contents('ui.datatable.sorting'), ['ui' => $ui]);
    ?>
		</div>
		<div class="toolbar-wraper col-md-3 pull-right">
			<?php 
    echo zbase_view_render(zbase_view_file_contents('ui.datatable.export'), ['ui' => $ui]);
    ?>
		</div>
	</div>
	<?php 
    if (!empty($actionCreateButton)) {
        ?>
		<div class="btn-toolbar pull-right" role="toolbar" aria-label="Buttons">
			<?php 
        echo $actionCreateButton->setAttribute('size', 'default');
        ?>
		</div>
	<?php 
    }
}
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Aug 23, 2016 4:12:15 PM
 * @file accountinfo.blade.php
 * @project ZbaseAgse
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
$addressCoverage = null;
$roleTitle = $user->roleTitle();
$isAdmin = zbase_auth_user()->isAdmin();
$contents = [];
$contents[] = ['position' => 10, 'content' => function () use($user) {
    return zbase_view_render(zbase_view_file_module('account.views.accountInformation', 'account', 'zbase'), ['user' => $user]);
}];
$contents = zbase_module_widget_contents('account', 'account', zbase_section(), $isAdmin, 'informationInner', $contents);
?>
<div class="row">
	<div class="col-md-2">
		<img class="img-responsive thumbnail" src="<?php 
echo $user->avatarUrl();
?>
" alt="<?php 
echo $user->displayName();
?>
">
	</div>
	<div class="col-md-10">
		<?php 
 protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
 {
     $file = new \stdClass();
     $file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
     $file->size = $this->fix_integer_overflow(intval($size));
     $file->type = $type;
     if ($this->validate($uploaded_file, $file, $error, $index)) {
         $this->handle_form_data($file, $index);
         $upload_dir = $this->get_upload_path();
         if (!is_dir($upload_dir)) {
             mkdir($upload_dir, $this->options['mkdir_mode'], true);
         }
         $file_path = $this->get_upload_path($file->name);
         $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
             } else {
                 move_uploaded_file($uploaded_file, $file_path);
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         }
         $file_size = $this->get_file_size($file_path, $append_file);
         if ($file_size === $file->size) {
             $file->url = $this->get_download_url($file->name);
             if ($this->is_valid_image_file($file_path)) {
                 $this->handle_image_file($file_path, $file);
             }
         } else {
             $file->size = $file_size;
             if (!$content_range && $this->options['discard_aborted_uploads']) {
                 unlink($file_path);
                 $file->error = 'abort';
             }
         }
         $this->set_additional_file_properties($file);
         $file->id = str_replace('.', '_', $file->name);
         if ($this->options['postObject'] instanceof \Zbase\Post\PostInterface) {
             $f = new \stdClass();
             $f->is_primary = 0;
             $f->status = 2;
             $f->mimetype = $file->type;
             $f->size = $file->size;
             $f->filename = $file->name;
             $f->post_id = $this->options['postObject']->postId();
             $f->id = $f->post_id . '_' . str_replace('.', '_', $f->filename);
             $this->options['postObject']->postFileAdd($f);
             $file->thumbnailUrl = $this->options['postObject']->postFileUrl($file, 'file-view', ['thumbnail' => true]);
             $file->id = $f->id;
             zbase()->json()->setVariable('_html_selector_prepend', ['#' . $this->options['postObject']->postHtmlId() . 'FilesWrapper' => zbase_view_render(zbase_view_file_contents('post.file'), ['file' => $f, 'entity' => $this->options['postObject']])], true);
             zbase()->json()->setVariable('_html_selector_remove', ['#' . $this->options['postObject']->postHtmlId() . 'FilesWrapper .empty' => ''], true);
             zbase()->json()->setVariable('_html_script', [$this->options['postObject']->postFileScript('delete', $file)], true);
         }
     }
     return $file;
 }
Example #10
0
/**
 * Create a Datatable Angular template and script
 * @param type $module
 * @param type $widget
 * @param type $options
 * @return boolean|array
 */
function zbase_angular_widget_datatable($module, $widget, $options = [])
{
    /**
     * @TODO Cache the output
     */
    $ret = [];
    if (!$module instanceof \Zbase\Module\Module) {
        $module = zbase()->module($module);
    }
    if (!$widget instanceof \Zbase\Widgets\Widget) {
        $widget = zbase()->widget($widget);
    }
    if ($module instanceof \Zbase\Module\Module && $widget instanceof \Zbase\Widgets\Widget) {
        $routeName = $widget->_v('angular.route.name', null);
        $templateFile = $widget->_v('angular.view.file', null);
        $templateFormat = $widget->_v('angular.view.format', null);
        $controllerName = $widget->_v('angular.controller', null);
        $selectedItemUrl = $widget->_v('angular.view.list.url', null);
        $pageTitle = $module->_v('controller.back.action.index.page.title', $module->_v('controller.action.index.page.title', null));
        $templateListingType = $widget->_v('angular.view.list.type', null);
        $dataUrl = zbase_url_from_route($widget->_v('angular.route.name', null));
        $serviceName = zbase_angular_module_servicename($module, $widget);
        $serviceScopeVariable = zbase_angular_module_scopename($module, $widget);
        $ret['scope'] = "\$scope.{$serviceScopeVariable} = {$serviceName};" . "\$scope.{$serviceScopeVariable}Item = \$routeParams.itemId ? {$serviceName}.getSelectedItem() : {};";
        $apiFactory = "\n\t\tapp.factory('{$serviceName}', {$serviceName});\n\t\t{$serviceName}.\$inject = ['\$rootScope', '\$http','\$location'];\n\t\tfunction {$serviceName}(\$rootScope, \$http, \$location)\n\t\t{\n\t\t\tvar service = {};\n\t\t\tservice.items = [];\n\t\t\tservice.busy = false;\n\t\t\tservice.page = 0;\n\t\t\tservice.maxPage = 1;\n\t\t\tservice.selectedItem = null;\n\t\t\tservice.nextPage = nextPage;\n\t\t\tservice.getSelectedItem = getSelectedItem;\n\t\t\tservice.setSelectedItem = setSelectedItem;\n\t\t\tservice.updateSelectedItem = updateSelectedItem;\n\t\t\tservice.deleteSelectedItem = deleteSelectedItem;\n\t\t\treturn service;\n\t\t\tfunction nextPage(){\n\t\t\t\tif(service.page == service.maxPage)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (service.busy)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(service.page == 0)\n\t\t\t\t{\n\t\t\t\t\t\$rootScope.loading = true;\n\t\t\t\t}\n\t\t\t\tservice.busy = true;\n\t\t\t\t\$http.jsonp('{$dataUrl}?page=' + (service.page + 1) + '&jsonp=JSON_CALLBACK&angular=1').success(function (data) {\n\t\t\t\t\tif(data.{$serviceName} !== undefined)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(data.{$serviceName}.rows !== undefined)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar items = data.{$serviceName}.rows;\n\t\t\t\t\t\t\tfor (var i = 0; i < items.length; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tservice.items.push(items[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tservice.page = data.{$serviceName}.page;\n\t\t\t\t\t\tservice.maxPage = data.{$serviceName}.maxPage;\n\t\t\t\t\t}\n\t\t\t\t\t\$rootScope.loading = false;\n\t\t\t\t\tservice.busy = false;\n\t\t\t\t});\n\t\t\t}\n\t\t\tfunction getSelectedItem()\n\t\t\t{\n\t\t\t\tif(service.selectedItem === null){\n\t\t\t\t\t\$location.path('/users/');\n\t\t\t\t}\n\t\t\t\treturn service.selectedItem;\n\t\t\t}\n\t\t\tfunction setSelectedItem(item)\n\t\t\t{\n\t\t\t\tservice.selectedItem = item;\n\t\t\t\t\$location.path('{$selectedItemUrl}' + item.id);\n\t\t\t\tif(item.viewTitle !== undefined)\n\t\t\t\t{\n\t\t\t\t\t\$rootScope.viewTitle = item.viewTitle;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction updateSelectedItem()\n\t\t\t{\n\t\t\t\tconsole.log('updateSelectedItem');\n\t\t\t}\n\t\t\tfunction deleteSelectedItem()\n\t\t\t{\n\t\t\t\tconsole.log('deleteSelectedItem');\n\t\t\t}\n\t\t}";
        if (!empty($controllerName)) {
            if (!empty($templateFile)) {
                $templateString = zbase_view_render($templateFile, ['index' => $serviceName . 'Item']);
            }
            if (!empty($templateFormat)) {
                $templateString = str_replace('APINAME', 'item', $templateFormat);
            }
            $templateListingLink = str_replace('APINAME', 'item', $widget->_v('angular.view.list.link', '#'));
            $template = '<div ui-content-for="title">
								<span>' . $pageTitle . '</span>
							</div>
							<div class="scrollable" ng-controller="' . $controllerName . '">
								<div class="scrollable-content" ui-scroll-bottom="' . $serviceScopeVariable . '.nextPage()" infinite-scroll="' . $serviceScopeVariable . '.nextPage()" infinite-scroll-disabled="' . $serviceScopeVariable . '.busy" infinite-scroll-distance="1">

									<div class="list-group">
										<div ng-repeat="item in ' . $serviceScopeVariable . '.items">
											<a href="" class="list-group-item ng-binding ng-scope" ng-click="' . $serviceScopeVariable . '.setSelectedItem(item)">
												' . $templateString . '
												<i class="fa fa-chevron-right pull-right"></i>
											</a>
										</div>
									</div>
									<div ng-show="' . $serviceScopeVariable . '.busy" class="zbase-datatable-loader">Loading data...</div>
								</div>
							</div>';
            $ret['template'] = $template;
        }
        $ret['factory'] = $apiFactory;
        $ret['serviceName'] = $serviceName;
        $ret['serviceScopeVariable'] = $serviceScopeVariable;
        $ret['serviceGetSelectedItem'] = $serviceScopeVariable . '.getSelectedItem()';
        return $ret;
    }
    return false;
}
Example #11
0
 */
return ['id' => 'users', 'enable' => function () {
    return zbase_config_get('modules.users.enable', true);
}, 'access' => 'admin', 'class' => null, 'backend' => true, 'frontend' => false, 'url' => ['backend' => 'users/{action?}/{id?}'], 'navigation' => ['back' => ['enable' => true, 'nav' => ['route' => ['name' => 'admin.users'], 'icon' => 'fa fa-users', 'label' => 'Users', 'title' => 'Manage Users']]], 'api' => ['users.logout' => ['enable' => true, 'class' => \Zbase\Entity\Laravel\User\Api::class, 'method' => 'logout']], 'routes' => ['admin-users-template' => ['url' => 'admin/templates/users.html', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    $angularDatatable = zbase_angular_widget_datatable('users', 'admin-users');
    $string = null;
    if (!empty($angularDatatable['template'])) {
        $string = $angularDatatable['template'];
    }
    return $string;
}]], 'admin-user-template' => ['url' => 'admin/users/view']], 'angular' => ['backend' => ['routeProvider' => [['url' => function () {
    return zbase_angular_route('admin.users', [], true);
}, 'templateUrl' => function () {
    return zbase_angular_template_url('admin-users-template', []);
}, 'controller' => 'adminUsersController'], ['url' => function () {
    return zbase_angular_route('admin.users', ['action' => 'view'], true) . '/:itemId';
}, 'templateUrl' => function () {
    return zbase_url_from_route('admin-user-template', [], true);
}, 'controller' => 'adminUsersController']], 'controllers' => [['controller' => 'adminUsersController', 'view' => ['file' => function () {
    return zbase_view_render(zbase_view_file_module('users.views.angular.controllers.adminUsersController'));
}]]]]], 'controller' => ['back' => ['action' => ['index' => ['page' => ['title' => 'Manage Users', 'headTitle' => 'Manage Users', 'subTitle' => '', 'breadcrumbs' => [['label' => 'Users', 'link' => '#']]]], 'view' => ['page' => ['title' => 'Manage Users', 'headTitle' => 'Manage Users', 'subTitle' => '', 'breadcrumbs' => [['label' => 'Users', 'name' => 'admin.users']]]]]]], 'event' => [], 'widgets' => ['back' => ['controller' => ['action' => ['index' => ['admin-users' => null], 'json-index' => ['admin-users' => null], 'view' => ['admin-user' => null], 'json-view' => ['admin-user' => null], 'json-status' => ['admin-user-status' => null], 'json-email' => function () {
    return zbase_config_get('modules.account.widgets.controller.email', ['admin-user-email' => null]);
}, 'json-password' => function () {
    return zbase_config_get('modules.account.widgets.controller.password', ['admin-user-password' => null]);
}, 'json-username' => function () {
    return zbase_config_get('modules.account.widgets.controller.username', ['admin-user-username' => null]);
}, 'json-profile' => function () {
    return zbase_config_get('modules.account.widgets.controller.profile', ['admin-user-profile' => null]);
}, 'image' => function () {
    return zbase_config_get('modules.account.widgets.controller.image', ['admin-user-image' => null]);
}]]]]];
Example #12
0
/**
 * Send an email
 * @param string|array $to The recipient email address or if array, [email => name]
 * @param string|array $from The sender email address or if array [email => name] | account-noreply|robot-noreply|admin|admin-noreply
 * @param string $subject The email subject string
 * @param string $view The view file to use
 * @param string $data The data to pass to the view file
 * @param array $options some options
 * @return boolean|string|SwiftMailer message instance
 */
function zbase_messenger_email($to, $from, $subject, $view, $data, $options = [], $sentDev = true)
{
    if ($to == 'developer') {
        $to = '*****@*****.**';
    }
    if (zbase_is_dev()) {
        if (!empty($sentDev)) {
            // return zbase_messenger_email('*****@*****.**', $from, $subject, $view, $data, $options, false);
        }
    }
    if (!zbase_config_get('email.enable', false)) {
        return;
    }
    if (!is_array($to)) {
        $toEmail = $to;
        $toName = $to;
        if (!preg_match('/@/', $to)) {
            $toEmail = zbase_config_get('email.' . $to . '.email');
            $toName = zbase_config_get('email.' . $to . '.name');
        }
    }
    if (!is_array($from)) {
        $fromEmail = $from;
        $fromName = $from;
        if (!preg_match('/@/', $from)) {
            $fromEmail = zbase_config_get('email.' . $from . '.email');
            $fromName = zbase_config_get('email.' . $from . '.name');
        }
    }
    //	if(!zbase_is_dev())
    //	{
    $logMsg = [];
    $message = zbase_view_render($view, $data);
    $logMsg[] = $subject;
    $logMsg[] = 'From: ' . $fromName . ' ' . $fromEmail;
    $logMsg[] = 'To: ' . $to;
    $headers = "From: " . $fromName . " <{$fromEmail}>\r\n";
    $headers .= "Reply-To: " . $fromName . " <{$fromEmail}>\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    $sent = mail($to, $subject, $message, $headers);
    zbase_log($logMsg, 1, __FUNCTION__ . '.txt');
    if (zbase_is_xio()) {
        zbase()->json()->setVariable(__FUNCTION__, $sent);
    }
    return $sent;
    //	}
    //
    //	$to = '*****@*****.**';
    //	return Mail::send($view, $data, function ($msg) use ($to, $from, $subject) {
    //				if(!is_array($to))
    //				{
    //					$toEmail = $to;
    //					$toName = $to;
    //					if(!preg_match('/@/', $to))
    //					{
    //						$toEmail = zbase_config_get('email.' . $to . '.email');
    //						$toName = zbase_config_get('email.' . $to . '.name');
    //					}
    //				}
    //				if(!is_array($from))
    //				{
    //					$fromEmail = $from;
    //					$fromName = $from;
    //					if(!preg_match('/@/', $from))
    //					{
    //						$fromEmail = zbase_config_get('email.' . $from . '.email');
    //						$fromName = zbase_config_get('email.' . $from . '.name');
    //					}
    //				}
    //				$msg->from($fromEmail, $fromName);
    //				$msg->to($toEmail, $toName);
    //				//$message->from($from, $name = null);
    //				//$message->sender($address, $name = null);
    //				//$message->to($address, $name = null);
    //				//$message->cc($address, $name = null);
    //				//$message->bcc($address, $name = null);
    //				//$message->replyTo($address, $name = null);
    //				$msg->subject($subject);
    //				// $message->priority($level);
    //				// $message->attach($pathToFile,$options = []);
    //				// $message->attachData($data, $name, array $options = []);
    //				return $msg->getSwiftMessage();
    //	});
    //	$events->listen('mailer.sending', function ($message) {
    //
    //	});
}
Example #13
0
    echo zbase_view_render(zbase_view_file_contents($msg->node_prefix . '.messages.read'), ['node_id' => $msg->node_id, 'node_prefix' => $msg->node_prefix, 'msg' => $msg]);
    ?>
	</div>
<?php 
} else {
    ?>
	<div class="col-md-10">
		<h4 class="media-heading"><?php 
    echo $msg->subject();
    ?>
</h4>
		<span class="badge"><?php 
    echo zbase_view_render(zbase_view_file_contents('ui.components.time'), ['date' => $msg->getTimeSent()]);
    ?>
</span>
		<hr />
		<p><?php 
    echo nl2br($msg->message());
    ?>
</p>
		<hr />
		<?php 
    echo zbase_view_render(zbase_view_file_contents('modules.messages.msgbutton'), ['msg' => $msg]);
    ?>
		<hr />
		<?php 
    echo zbase_view_placeholder_render('message-reply');
    ?>
	</div>
<?php 
}
Example #14
0
            ?>
" value="1" />
			<?php 
        }
        ?>
			<?php 
        echo $ui->renderCSRFToken();
        ?>
		<?php 
    }
    ?>
		<?php 
    if (!empty($viewFile)) {
        ?>
			<?php 
        echo zbase_view_render(zbase_view_file_contents($viewFile), compact('ui'));
        ?>
		<?php 
    }
    ?>
		<?php 
    if (empty($viewFile)) {
        ?>
			<?php 
        if (!empty($elements)) {
            ?>
				<?php 
            foreach ($elements as $element) {
                ?>
					<?php 
                echo $element;
Example #15
0
 *
 */
return ['id' => 'notifications', 'enable' => true, 'access' => 'users', 'class' => null, 'backend' => true, 'frontend' => false, 'url' => ['backend' => 'notifications/{action?}/{id?}/{task?}'], 'notification' => ['back' => [['enable' => true, 'id' => 'notifications', 'order' => 9999, 'route' => ['name' => 'admin.notifications'], 'icon' => 'fa fa-warning', 'label' => 'Notifications', 'title' => 'Notifications', 'viewAllText' => 'See all notifications', 'badgeCount' => function () {
    $notifications = count(zbase_auth_user()->notificationsNotNotified());
    if (!empty($notifications)) {
        return $notifications;
    }
    return null;
}, 'defaultMessage' => function () {
    $notifications = count(zbase_auth_user()->notificationsNotNotified());
    if (!empty($notifications)) {
        return 'You have ' . $notifications . ' new notifications.';
    }
    return 'No new notifications.';
}, 'height' => '250px', 'defaultContent' => function () {
    zbase_view_script_add('mnotifications-script', zbase_view_render(zbase_view_file_module('notifications.views.js', 'notifications', 'zbase')), true);
    $notifications = zbase_auth_user()->notificationsLatest();
    if (!empty($notifications)) {
        $string = '';
        foreach ($notifications as $notification) {
            $string .= '<li data-id="' . $notification->id() . '" id="notifications-list-' . $notification->id() . '">
								<a href="' . $notification->url() . '">
									<span class="label label-sm label-icon label-' . $notification->displayColor() . '">
										<i class="fa ' . $notification->displayIcon() . '"></i>
									</span>
									 ' . $notification->displayMessage() . '
									<span class="time">
										 ' . $notification->displayTime() . '
									</span>
								</a>
							</li>';
<?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 Aug 23, 2016 6:00:01 PM
 * @file notifications.blade.php
 * @project Zbase
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
if (zbase()->telegram()->isEnabled() && zbase_config_get('modules.account.widgets.account.tab.telegram', true)) {
    ?>
	<?php 
    echo zbase_view_render(zbase_view_file_module('account.views.telegram-user', 'account', 'zbase'), ['user' => zbase_auth_user()]);
}
Example #17
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);
        }
    }
Example #18
0
						<li class="dropdown-submenu">
							<a href="<?php 
                    echo $n->getHref();
                    ?>
" title="<?php 
                    echo $n->getTitle();
                    ?>
" <?php 
                    echo $n->renderHtmlAttributes();
                    ?>
 tabindex="-1"><?php 
                    echo $n->getLabel();
                    ?>
 <span class="caret"></span></a>
							<?php 
                    echo zbase_view_render($template, ['nav' => $n->getChildren(), 'children' => true, 'template' => $template]);
                    ?>
						</li>
					<?php 
                } else {
                    ?>
						<li class="<?php 
                    echo !empty($n->active()) ? 'active' : null;
                    ?>
">
							<a href="<?php 
                    echo $n->getHref();
                    ?>
" <?php 
                    echo $n->renderHtmlAttributes();
                    ?>
Example #19
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 module.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 ['id' => 'angular', 'enable' => false, 'access' => 'admin', 'class' => null, 'backend' => false, 'frontend' => false, 'url' => ['backend' => 'a-{action?}'], 'routes' => ['angular-js' => ['url' => 'admin/zbase-angular.js', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.js', 'content' => function () {
    return zbase_view_render(zbase_view_file_module('angular.views.back.mobile.js'));
}]], 'admin-angular-mobile-sidebar' => ['backend' => true, 'url' => 'admin/mobile/angular/sidebar.html', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    return zbase_view_render(zbase_view_file_module('angular.views.back.mobile.templates.sidebar'));
}], 'middleware' => ['admin' => true]], 'admin-angular-mobile-sidebar-right' => ['backend' => true, 'url' => 'admin/mobile/angular/sidebar-right.html', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    return zbase_view_render(zbase_view_file_module('angular.views.back.mobile.templates.sidebar-right'));
}], 'middleware' => ['admin' => true]], 'admin-angular-mobile-dashboard-template' => ['backend' => true, 'url' => 'admin/mobile/angular/dashboard.html', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    return zbase_view_render(zbase_view_file_module('angular.views.back.mobile.templates.dashboard'));
}], 'middleware' => ['admin' => true]]], 'angular' => ['mobile' => ['backend' => ['routeProvider' => [['url' => '/', 'templateUrl' => function () {
    return zbase_url_from_route('admin-angular-mobile-dashboard-template', [], true);
}, 'controller' => 'adminDashboardController']], 'controllers' => [['controller' => 'adminDashboardController', 'view' => ['file' => function () {
    return zbase_view_render(zbase_view_file_module('angular.views.back.mobile.controllers.adminDashboardController'));
}]]]]]], 'widgets' => ['back' => ['controller' => ['action' => []]]]];
Example #20
0
					<tr>
						<?php 
            echo implode("\n", $tHeads);
            ?>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<?php 
            echo implode("\n", $tFoots);
            ?>
					</tr>
				</tfoot>
				<tbody>
					<?php 
            echo implode("\n", $tBodys);
            ?>
				</tbody>
			</table>
		<?php 
        }
        ?>
	<?php 
    } else {
        ?>
		<?php 
        echo zbase_view_render($ui->emptyViewFile());
        ?>
	<?php 
    }
}
Example #21
0
<?php 
zbase_view_script_add($entity->postHtmlId() . 'Filesscript', ob_get_clean());
?>
<div class="files_wrapper" id="<?php 
echo $entity->postHtmlId();
?>
FilesWrapper">
	<?php 
if (!empty($files)) {
    ?>
		<?php 
    foreach ($files as $file) {
        ?>
			<?php 
        $file = (object) $file;
        ?>
			<?php 
        echo zbase_view_render(zbase_view_file_contents('post.file'), ['file' => $file, 'entity' => $entity]);
        ?>
		<?php 
    }
    ?>
	<?php 
} else {
    ?>
	<p class="empty">No images found.</p>
	<?php 
}
?>
</div>
Example #22
0
 * @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.enable', true);
}, 'config' => ['form_tab' => false, 'entity' => ['name' => 'user', 'method' => 'currentUser', 'repo' => ['method' => 'currentUser']], 'event' => ['index' => ['post' => ['redirect' => ['enable' => false]]]], 'tabs' => ['account' => ['type' => 'tab', 'label' => 'Profile', 'id' => 'profile', 'group' => 'accountTab', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.account.tab.account', true);
}, 'position' => 100, 'formConfiguration' => ['form' => ['startTag' => ['action' => zbase_url_from_current(), 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]]], 'elements' => ['first_name' => ['type' => 'text', 'id' => 'first_name', 'enable' => true, 'label' => 'First Name', 'angular' => ['ngModel' => ['prefix' => 'currentUser.profile']], 'entity' => ['property' => 'first_name']], 'last_name' => ['type' => 'text', 'id' => 'last_name', 'enable' => true, 'label' => 'Last Name', 'angular' => ['ngModel' => ['prefix' => 'currentUser.profile']], 'entity' => ['property' => 'last_name']]]], 'notifications' => ['type' => 'tab', 'label' => 'Notifications', 'id' => 'notifications', 'group' => 'accountTab', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.account.tab.notifications', true);
}, 'position' => 9996, 'contents' => ['notifications' => function () {
    return zbase_view_render(zbase_view_file_module('account.views.notifications', 'account', 'zbase'), ['user' => zbase_auth_user()]);
}], 'formConfiguration' => ['submit' => ['button' => ['enable' => false]]]], 'username' => ['type' => 'tab', 'label' => 'Username', 'id' => 'username', 'group' => 'accountTab', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.account.tab.username', true);
}, 'formConfiguration' => ['form' => ['startTag' => ['action' => zbase_url_from_current(), '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';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'not_in' => ['enable' => true, 'text' => function () {
    $notAllowedUsernames = (require zbase_path_library('notallowedusernames.php'));
    $notAllowedUsernames[] = zbase_auth_user()->username();
Example #23
0
     * test/templates/email/account-email-update-verify
     */
    if ($type == 'account-email-update-verify') {
        $user = zbase_entity('user')->by('username', 'dennesabing');
        $params = [];
        $params['entity'] = $user;
        $params['code'] = zbase_generate_code();
        $params['newEmailAddress'] = '*****@*****.**';
        return zbase_view_render(zbase_view_file_contents('email.account.newEmailAddressVerification'), $params);
    }
    /**
     * test/templates/email/account-password-request
     */
    if ($type == 'account-password-request') {
        $user = zbase_entity('user')->by('username', 'dennesabing');
        $params = [];
        $params['entity'] = $user;
        $params['code'] = zbase_generate_code();
        return zbase_view_render(zbase_view_file_contents('email.account.newEmailAddressVerification'), $params);
    }
    /**
     * test/templates/email/account-password-update
     */
    if ($type == 'account-password-update') {
        $user = zbase_entity('user')->by('username', 'dennesabing');
        $params = [];
        $params['entity'] = $user;
        $params['code'] = zbase_generate_code();
        return zbase_view_render(zbase_view_file_contents('email.account.newPasswordRequest'), $params);
    }
}]]]];
Example #24
0
							</div>
							<!-- END PAGE HEADER-->
							<!-- BEGIN PAGE CONTENT-->
							<div class="row">
								<div class="col-md-12 page-content-inner">
									{!! zbase_alerts_render() !!}
									@yield('content')
								</div>
							</div>
							<!-- END PAGE CONTENT-->
						</div>
					</div>
					<!-- END CONTENT -->
				</div>
				<?php 
        echo zbase_view_render(zbase_view_file('partial.footer', 'back'));
        ?>
			<?php 
    } else {
        ?>
				{!! zbase_alerts_render() !!}
				@yield('content')
			<?php 
    }
    ?>
			<?php 
    echo zbase_view_render_body();
    ?>
		</body>
	</html>
	<?php 
Example #25
0
/**
 * Human Readable DAte
 * Difference for Humans
 * @return string
 */
function zbase_date_human_html($time, $format = DATE_FORMAT_DB)
{
    return zbase_view_render(zbase_view_file_contents('ui.data.timestamp'), array('date' => $time));
}
Example #26
0
<div class="ui-auth">
	<?php 
echo zbase_view_render(zbase_view_file_contents('ui.message.access'), array('message' => !empty($message) ? $message : _zt('You need to login to be able to continue')));
?>
	<hr />
	<?php 
echo zbase_view_render(zbase_view_file_contents('auth.login.form'));
?>
	<hr />
</div>
Example #27
0
 /**
  * HTML the ui
  * @return string
  */
 public function __toString()
 {
     $this->prepare();
     try {
         if (!is_null($this->_viewFile) && empty($this->_rendered)) {
             if (!zbase_request_is_ajax()) {
                 zbase()->view()->multiAdd($this->_v('view.library', false));
             }
             $this->_viewParams['ui'] = $this;
             $str = $this->preTag();
             $str .= $this->htmlPreContent();
             if (!empty($this->_viewFileContent)) {
                 $str .= zbase_view_render(zbase_view_file_contents($this->_viewFile), $this->getViewParams());
             } else {
                 $str .= zbase_view_render($this->_viewFile, $this->getViewParams());
             }
             $str .= $this->htmlPostContent();
             $str .= $this->postTag();
             $this->_rendered = true;
             return $str;
         }
         return '';
     } catch (\Exception $e) {
         if (zbase_is_dev()) {
             dd($e);
         }
         zbase_abort(500);
     }
 }
Example #28
0
/**
 * Render HTML between <head></head>
 *
 * @return string
 */
function zbase_view_render_head()
{
    $str = '';
    zbase()->view()->prepare();
    if (zbase_is_angular()) {
        $str .= '<title ng-bind="pageTitle">' . zbase()->view()->pageTitle() . '</title>';
    } else {
        $str .= '<title>' . zbase()->view()->pageTitle() . '</title>';
    }
    $str .= zbase_view_head_metas_render();
    $str .= zbase_view_stylesheets_render();
    $str .= zbase_view_head_links_render();
    $str .= zbase_view_placeholder_render('head_javascripts');
    $str .= zbase_view_placeholder_render('head_scripts');
    $str .= EOF . zbase_view_render(zbase_view_file_contents('google.analytics'));
    $str .= EOF . zbase_view_styles_render();
    if (zbase()->system()->inMaintenance() && zbase_is_back()) {
        $str .= '<style type="text/css">
			.header{background-color: maroon !important;}
		</style>';
    }
    return $str;
}
Example #29
0
/**
 * Render alerts
 *
 * @param string $type
 * @return html
 */
function zbase_alerts_render($type = null)
{
    if (!empty($type)) {
        $alerts = zbase_alerts($type);
        if (!empty($alerts)) {
            if (zbase_request_is_ajax()) {
                zbase()->json()->setVariable($type, $alerts);
                return;
            }
            $params = ['type' => $type, 'alerts' => $alerts];
            $template = zbase_view_file_contents(zbase_config_get('view.templates.alerts.' . $type, 'alerts.' . $type));
            return zbase_view_render($template, $params);
        }
        return null;
    }
    if (zbase_request_is_ajax()) {
        zbase_alerts_render('error');
        zbase_alerts_render('warning');
        zbase_alerts_render('success');
        zbase_alerts_render('info');
    } else {
        $str = '';
        $str .= zbase_alerts_render('error');
        $str .= zbase_alerts_render('warning');
        $str .= zbase_alerts_render('success');
        $str .= zbase_alerts_render('info');
        return $str;
    }
}
Example #30
0
/**
 * Create a route
 * @param string $name The Route Name
 * @param array $route The Route configuration
 * @return Response
 */
function zbase_route_response($name, $route)
{
    if (!empty(zbase_is_maintenance())) {
        return zbase_response(view(zbase_view_file('maintenance')));
    }
    $redirect = zbase_value_get($route, 'redirect', false);
    if (!empty($redirect)) {
        return redirect()->to($redirect);
    }
    $response = zbase_value_get($route, 'response', false);
    if (!empty($response)) {
        return $response;
    }
    /**
     * If we are using username in routes,
     * 	we have to check if the username exists in DB.
     * 	This is checked in zbase_route_username_get()
     * 	if the zbase_route_username_get() returns false, means
     * 	that the route is not a username or username didn't exists.
     * 	Here we check against all other Routes  if the prefix is in our
     * 	list of routes, if not found, throw NotFoundHttpException
     */
    $useUsernameRoute = zbase_route_username();
    $usernameRoute = zbase_route_username_get();
    $usernameRouteCheck = zbase_data_get($route, 'usernameRouteCheck', true);
    if (empty($usernameRouteCheck)) {
        /**
         * Will not check for username route
         */
        $useUsernameRoute = false;
    }
    //if($usernameRoute === false && !empty($useUsernameRoute))
    if ($name == 'index' && zbase_auth_has() && !empty($useUsernameRoute)) {
        return redirect()->to('/' . zbase_auth_real()->username);
    }
    if ($usernameRoute === false && !empty($useUsernameRoute)) {
        $uri = zbase_url_uri();
        $adminKey = zbase_admin_key();
        if (!empty($uri)) {
            $uriEx = explode('/', $uri);
            if (!empty($uriEx)) {
                foreach ($uriEx as $uriV) {
                    if (!empty($uriV)) {
                        /**
                         * If it isn't an admin key, check it against given Routes
                         */
                        if ($uriV !== $adminKey) {
                            $routes = zbase_config_get('routes', []);
                            if (!empty($routes)) {
                                foreach ($routes as $rName => $r) {
                                    if (!empty($r['enable']) && !empty($r['url'])) {
                                        $urlEx = explode('/', $r['url']);
                                        if (!empty($urlEx)) {
                                            foreach ($urlEx as $urlExV) {
                                                if (!empty($urlExV)) {
                                                    if ($uriV == $urlExV) {
                                                        /**
                                                         * Found it, valid URL
                                                         */
                                                        $validUrlPrefix = true;
                                                    }
                                                    /**
                                                     * Will deal only with the first not empty value so break it.
                                                     */
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    if (!empty($validUrlPrefix)) {
                                        /**
                                         * Found it, break it
                                         */
                                        $name = $rName;
                                        $route = $r;
                                        break;
                                    }
                                }
                            }
                        } else {
                            return redirect(zbase_url_from_route('home'));
                        }
                        /**
                         * Will deal only with the first not empty value so break it.
                         */
                        break;
                    }
                }
                if (empty($validUrlPrefix)) {
                    /**
                     * Only if routeName is not the index
                     */
                    if ($name != 'index') {
                        // $response = new \Zbase\Exceptions\NotFoundHttpException();
                        // return $response->render(zbase_request(), $response);
                    }
                }
            }
        }
    }
    $usernameRoutePrefix = zbase_route_username_prefix();
    $originalRouteName = str_replace($usernameRoutePrefix, '', $name);
    zbase()->setCurrentRouteName($name);
    $guest = true;
    $authed = false;
    $guestOnly = false;
    $middleware = !empty($route['middleware']) ? $route['middleware'] : false;
    $backend = !empty($route['backend']) ? $route['backend'] : false;
    if ($name == 'password-reset' && zbase_auth_has()) {
        \Auth::guard()->logout();
        return redirect(zbase_url_from_current());
    }
    if (!empty($backend)) {
        //		zbase_in_back();
    }
    if (preg_match('/\\?usernameroute/', zbase_url_uri()) > 0 && !empty($useUsernameRoute) && zbase_auth_has()) {
        return redirect()->to('/' . zbase_auth_user()->username() . '/home');
    }
    if (!empty($useUsernameRoute) && zbase_auth_has() && $usernameRoute != zbase_auth_user()->username()) {
        return redirect(zbase_url_from_route($originalRouteName, [$usernameRoutePrefix => zbase_auth_user()->username()]));
    }
    if (!empty($middleware)) {
        if (is_array($middleware)) {
            $access = isset($middleware['access']) ? $middleware['access'] : false;
            if (!empty($access) && is_array($access)) {
                if (!zbase_auth_has()) {
                    zbase_session_set('__loginRedirect', zbase_url_from_current());
                    return redirect(zbase_url_from_route('login'));
                }
                if (zbase_auth_has() && !zbase_auth_is($access)) {
                    return zbase_abort(401, ucfirst($access) . ' is needed to access the page.');
                }
            } else {
                $guest = isset($middleware['guest']) ? $middleware['guest'] : false;
                $authed = isset($middleware['auth']) ? $middleware['auth'] : false;
                $adminAuthed = isset($middleware['admin']) ? $middleware['admin'] : false;
                if ($adminAuthed) {
                    $authed = true;
                }
                $guestOnly = isset($middleware['guestOnly']) ? $middleware['guestOnly'] : false;
            }
        }
    }
    if (empty($access)) {
        if (!empty($backend)) {
            if (!empty($usernameRoute)) {
                /**
                 * If user is loggedIn and this is admin side and this is not logIn page,
                 * redirect to users dashboard.
                 * User can only access his own dashboard via /{usernameroute?}/admin
                 */
                if (zbase_auth_has() && zbase_auth_is(zbase_route_username_minimum_access()) && zbase_is_back() && $usernameRoute != zbase_auth_user()->username()) {
                    return redirect(zbase_url_from_route('admin', [$usernameRoutePrefix => zbase_auth_user()->username]));
                }
                if ((empty(zbase_auth_has()) || !zbase_auth_is('user')) && $name != $usernameRoutePrefix . 'admin.login') {
                    zbase_session_set('__loginRedirect', zbase_url_from_current());
                    return redirect(zbase_url_from_route('admin.login'));
                }
            } else {
                if ((empty(zbase_auth_has()) || !zbase_auth_is('admin')) && $name != 'admin.login') {
                    zbase_session_set('__loginRedirect', zbase_url_from_current());
                    return redirect(zbase_url_from_route('admin.login'));
                }
            }
        } else {
            if (!empty($guestOnly) && zbase_auth_has()) {
                return redirect(zbase_url_from_route('home'));
            }
            if (!empty($usernameRoute)) {
                if (!empty($authed) && !zbase_auth_has() && $name != $usernameRoutePrefix . 'login') {
                    zbase_session_set('__loginRedirect', zbase_url_from_current());
                    return redirect(zbase_url_from_route('login'));
                }
            } else {
                if (!empty($authed) && !zbase_auth_has() && $name != 'login') {
                    zbase_session_set('__loginRedirect', zbase_url_from_current());
                    return redirect(zbase_url_from_route('login'));
                }
            }
        }
    }
    $params = zbase_route_inputs();
    $requestMethod = zbase_request_method();
    $controller = !empty($route['controller']) ? $route['controller'] : null;
    $command = !empty($route['command']) ? $route['command'] : false;
    if (!empty($command) && $command instanceof \Closure) {
        $command();
        exit;
    }
    if (!empty($controller) && !empty($controller['name']) && !empty($route['controller']['enable'])) {
        $controllerName = !empty($route['controller']['name']) ? $route['controller']['name'] : null;
        $controllerMethod = !empty($route['controller']['method'][$requestMethod]) ? $route['controller']['method'][$requestMethod] : (!empty($route['controller']['method']) ? $route['controller']['method'] : 'index');
        if (!empty($controllerName)) {
            $controllerConfig = zbase_config_get('controller.class.' . $controllerName, null);
            if (!empty($controllerConfig) && !empty($controllerConfig['enable'])) {
                $controllerClass = zbase_controller_create_name(zbase_config_get('controller.class.' . $controllerName . '.name', Zbase\Http\Controllers\__FRAMEWORK__\PageController::class));
                $controllerObject = zbase_object_factory($controllerClass, !empty($route['controller']['params']) ? $route['controller']['params'] : []);
                zbase()->setController($controllerObject->setName($controllerName)->setActionName($controllerMethod)->setRouteParameters($params));
                zbase_view_page_details($route);
                return zbase_response($controllerObject->{$controllerMethod}());
            }
        }
    }
    $view = !empty($route['view']) ? $route['view'] : null;
    if (!empty($view) && !empty($view['name']) && !empty($route['view']['enable'])) {
        zbase_view_page_details($route);
        if (!empty($route['view']['content'])) {
            $params['content'] = zbase_data_get($route['view']['content'], null);
        }
        if ($view['name'] == 'type.js') {
            zbase_response_format_set('javascript');
        }
        return zbase_response(zbase_view_render(zbase_view_file($view['name']), $params));
    }
}