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!')); } } } }
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')); }
/** * Error Messenger * Send error to developer * * @param array $options * * @retur null */ function zbase_messenger_error($options = []) { $viewOptions = []; if (!empty($options['title'])) { $viewOptions['title'] = 'ErrorLog: ' . zbase_site_name() . ' - ' . $options['title']; } if (!empty($options['error'])) { $viewOptions['error'] = $options['error']; } if (!empty($options['message'])) { $viewOptions['message'] = $options['message']; } zbase_messenger_email('developer', 'noreply', !empty($title) ? $title : zbase_site_name() . ' Error', zbase_view_file_contents('email.exceptions'), $viewOptions); }
/** * 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); } }
/** * 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; }
/** * Return the entity * @return Zbase\Widget\EntityInterface */ public function entity() { if (empty($this->hasEntity())) { return false; } if (is_null($this->_entity)) { $entityName = $this->_v('entity.name', null); if (!empty($this->_nodeSupport)) { $entityName = $this->getNodeNamespace() . '_' . strtolower($this->_nodeName); } if (!is_null($entityName)) { $entity = $this->_v('entity.entity', null); if ($entity instanceof \Zbase\Entity\Laravel\Entity) { $this->_entityObject = zbase()->entity($entityName, [], true); $this->_entity = $entity; return $this->_entity; } if ($entity instanceof \Zbase\Post\PostInterface) { $this->_entityObject = $entity; $this->_entity = $entity; return $this->_entity; } $this->_entity = $this->_entityObject = $entity = zbase()->entity($entityName, [], true); $repoById = $this->_v('entity.repo.byId', null); $repoByFilter = $this->_v('entity.repo.byFilter', null); if (is_null($repoById)) { $repoById = $this->_v('entity.repo.byAlphaId', null); if (!empty($repoById)) { $byAlpha = true; } else { $repoById = $this->_v('entity.repo.bySlug', null); if (!empty($repoById)) { $bySlug = true; } } } if (is_array($repoById)) { if (!empty($repoById['route'])) { $id = zbase_route_input($repoById['route']); } if ($this->isNodeCategoryBrowsing()) { $repoItemBySlug = $this->_v('entity.repo.item.bySlug', null); $repoItemByAlpha = $this->_v('entity.repo.item.byAlpha', null); $repoItemById = $this->_v('entity.repo.item.byId', null); /** * Browse by category * /CategorySlug/ - should show all category items * /CategorySlug/ItemName - show item * * Module should have a "default" entry as the wildcard catchAll action */ if (!empty($repoItemByAlpha)) { $itemRouteParameterName = $this->_v('entity.repo.item.byAlpha.route', null); $childAlphaId = zbase_route_input($itemRouteParameterName); if (!empty($childAlphaId)) { $this->_childEntity = zbase()->entity($this->nodePrefix(), [], true)->repository()->byAlphaId($childAlphaId); if (!$this->_childEntity instanceof \Zbase\Entity\Laravel\Node\Node) { $this->setViewFile(zbase_view_file_contents('errors.404')); return zbase_abort(404); } } } if (!empty($repoItemBySlug)) { $itemRouteParameterName = $this->_v('entity.repo.item.bySlug.route', null); $childAlphaId = zbase_route_input($itemRouteParameterName); if (!empty($childAlphaId)) { $this->_childEntity = zbase()->entity($this->nodePrefix(), [], true)->repository()->bySlug($childAlphaId); if (!$this->_childEntity instanceof \Zbase\Entity\Laravel\Node\Node) { $this->setViewFile(zbase_view_file_contents('errors.404')); return zbase_abort(404); } } } if (!empty($repoItemById)) { $itemRouteParameterName = $this->_v('entity.repo.item.byId.route', null); $childAlphaId = zbase_route_input($itemRouteParameterName); if (!empty($childAlphaId)) { $this->_childEntity = zbase()->entity($this->nodePrefix(), [], true)->repository()->byId($childAlphaId); if (!$this->_childEntity instanceof \Zbase\Entity\Laravel\Node\Node) { $this->setViewFile(zbase_view_file_contents('errors.404')); return zbase_abort(404); } } } } if (!empty($repoById['request']) && zbase_is_post() == 'post') { $id = zbase_request_input($repoById['request']); } if (!empty($id)) { $filters = $this->_v('entity.filter.query', []); $sorting = $this->_v('entity.sorting.query', []); $selects = ['*']; $joins = []; $this->_urlHasRequest = true; if ($this->isNode()) { zbase()->json()->addVariable('id', $id); if (!empty($repoById) && !empty($id) && empty($byAlpha) && empty($bySlug)) { $filters['id'] = ['eq' => ['field' => $entity->getKeyName(), 'value' => $id]]; } if ($this->isCurrentUser()) { $filters['user'] = ['eq' => ['field' => 'user_id', 'value' => zbase_auth_user()->id()]]; } if ($this->isPublic()) { $filters['status'] = ['eq' => ['field' => 'status', 'value' => 2]]; } if (!empty($byAlpha)) { $filters['alpha'] = ['eq' => ['field' => 'alpha_id', 'value' => $id]]; } if (!empty($bySlug)) { $filters['slug'] = ['eq' => ['field' => 'slug', 'value' => $id]]; } if (method_exists($entity, 'querySelects')) { $selects = $entity->querySelects($filters, ['widget' => $this]); } if (method_exists($entity, 'queryJoins')) { $joins = $entity->queryJoins($filters, $this->getRequestSorting(), ['widget' => $this]); } if (method_exists($entity, 'querySorting')) { $sorting = $entity->querySorting($sorting, $filters, ['widget' => $this]); } if (method_exists($entity, 'queryFilters')) { $filters = $entity->queryFilters($filters, $sorting, ['widget' => $this]); } /** * Merge filters from widget configuration * entity.filter.query */ $filters = array_merge($filters, $this->_v('entity.filter.query', [])); $sorting = array_merge($sorting, $this->_v('entity.sorting.query', [])); $action = $this->getAction(); $debug = zbase_request_query_input('__widgetEntityDebug', false); if ($this->isAdmin()) { if ($action == 'restore' || $action == 'ddelete') { return $this->_entity = $entity->repository()->onlyTrashed()->all($selects, $filters, $sorting, $joins)->first(); } } else { if ($entity->hasSoftDelete() && $this->isCurrentUser()) { if ($action == 'restore' || $action == 'ddelete') { return $this->_entity = $entity->repository()->onlyTrashed()->all($selects, $filters, $sorting, $joins)->first(); } return $this->_entity = $entity->repository()->setDebug($debug)->withTrashed()->all($selects, $filters, $sorting, $joins)->first(); } } return $this->_entity = $entity->repository()->setDebug($debug)->all($selects, $filters, $sorting, $joins)->first(); } } } else { if (!empty($repoByFilter)) { $filters = []; $sorting = []; $selects = ['*']; $joins = []; $singleRow = $this->_v('entity.singlerow', true); if ($this->isCurrentUser()) { $filters['user'] = ['eq' => ['field' => 'user_id', 'value' => zbase_auth_user()->id()]]; } if ($this->isPublic()) { $filters['status'] = ['eq' => ['field' => 'status', 'value' => 2]]; } $filters = array_merge($filters, $this->_v('entity.filter.query', [])); $sorting = array_merge($sorting, $this->_v('entity.sorting.query', [])); if (!empty($singleRow)) { return $this->_entity = $entity->repository()->all($selects, $filters, $sorting, $joins)->first(); } else { return $this->_entity = $entity->repository()->all($selects, $filters, $sorting, $joins); } } } $repoMethod = $this->_v('entity.method', null); if (!is_null($repoMethod)) { return $this->_entity = $this->_entityObject->{$repoMethod}(); } $this->_entityIsDefault = true; return $this->_entity = $this->_entityObject; } } return $this->_entity; }
?> " 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;
/** * Third/Final step in updating email address * */ public function updateEmailAddress() { $newEmail = $this->getDataOption('email_new', null); if (!is_null($newEmail)) { zbase_db_transaction_start(); try { $oldEmail = $this->email(); $oldEmails = $this->getDataOption('email_old', []); $oldEmails[] = ['old' => $this->email(), 'date' => zbase_date_now(), 'ip' => zbase_ip(), 'new' => $newEmail]; //$this->setDataOption('email_old', $oldEmails); $emailVerificationEnabled = zbase_config_get('auth.emailverify.enable', true); $this->email = $newEmail; $this->email_verified = $emailVerificationEnabled ? 0 : 1; $this->email_verified_at = null; if (!empty($emailVerificationEnabled)) { $code = zbase_generate_code(); $this->setDataOption('email_verification_code', $code); zbase_alert('info', _zt('Successfully updated your email address. We sent an email to <strong>%email%</strong> to verify your new email address.', ['%email%' => $newEmail])); zbase_messenger_email($this->email(), 'account-noreply', _zt('Email address verification code'), zbase_view_file_contents('email.account.newEmailAddressVerification'), ['entity' => $this, 'code' => $code, 'newEmailAddress' => $newEmail]); } else { zbase_alert('info', _zt('Successfully updated your email address to <strong>' . $newEmail . '</strong>', ['%email%' => $newEmail])); } /** * Remove options on updating email address */ $this->unsetDataOption('email_new'); $this->unsetDataOption('email_new_request_date'); $this->save(); $this->log('user::updateEmailAddress', null, ['old_email' => $oldEmail]); zbase_db_transaction_commit(); return true; } catch (\Zbase\Exceptions\RuntimeException $e) { zbase_db_transaction_rollback(); return false; } } return false; }
/** * 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)); }
<?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'));
<?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 } }
/** * Return the Search Text Placeholder * * @return string */ public function searchResultsTemplate() { return $this->_v('searchable.view.template', zbase_view_file_contents('ui.datatable.table')); }
/** * HTML the widget * @return string */ public function __toString() { if (!empty($this->_renderOption)) { return parent::__toString(); } $labelClass = $this->_v('html.attributes.label.class', []); $this->_prepared(); $str = $this->preTag(); $str .= '<div ' . $this->htmlAttributes($this->wrapperAttributes()) . '>'; $multiOptions = $this->getMultiOptions(); if (!empty($multiOptions)) { $str .= '<label class="' . implode(' ', $labelClass) . '">' . $this->getLabel() . '</label>'; } else { $str .= '<label class="' . implode(' ', $labelClass) . '"> </label>'; } $str .= '<div class="checkbox-list">'; $str .= $this->renderMultiOptions(); $str .= '</div>'; $str .= \View::make(zbase_view_file_contents('ui.form.helpblock'), array('ui' => $this))->__toString(); $str .= '</div>'; $str .= $this->postTag(); return $str; }
public function boot() { parent::boot(); $this->loadViewsFrom(__DIR__ . '/../resources/views', zbase_tag()); $this->loadViewsFrom(__DIR__ . '/../modules', zbase_tag() . 'modules'); if (!zbase_is_testing()) { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', zbase_tag()); $packages = zbase()->packages(); if (!empty($packages)) { foreach ($packages as $packageName) { $packagePath = zbase_package($packageName)->path(); $this->loadViewsFrom($packagePath . 'modules', $packageName . 'modules'); if (zbase_file_exists($packagePath . 'resources/views')) { $this->loadViewsFrom($packagePath . 'resources/views', $packageName); } if (zbase_file_exists($packagePath . 'resources/assets')) { $this->publishes([$packagePath . 'resources/assets' => zbase_public_path(zbase_path_asset($packageName))], 'public'); } if (zbase_file_exists($packagePath . '/Http/Controllers/Laravel/routes.php')) { require $packagePath . '/Http/Controllers/Laravel/routes.php'; } } } $this->app['config'][zbase_tag()] = array_replace_recursive($this->app['config'][zbase_tag()], zbase()->getPackagesMergedConfigs()); } else { $this->loadViewsFrom(__DIR__ . '/../tests/resources/views', zbase_tag() . 'test'); copy(__DIR__ . '/../config/entities/user.php', __DIR__ . '/../tests/config/entities/user.php'); $this->mergeConfigFrom(__DIR__ . '/../tests/config/config.php', zbase_tag()); } $this->publishes([__DIR__ . '/../resources/assets' => zbase_public_path(zbase_path_asset())], 'public'); $this->publishes([__DIR__ . '/../database/migrations' => base_path('database/migrations'), __DIR__ . '/../database/seeds' => base_path('database/seeds'), __DIR__ . '/../database/factories' => base_path('database/factories')], 'migrations'); $this->app['config']['database.connections.mysql.prefix'] = zbase_db_prefix(); $this->app['config']['auth.providers.users.model'] = get_class(zbase_entity('user')); $this->app['config']['auth.passwords.users.table'] = zbase_config_get('entity.user_tokens.table.name'); $this->app['config']['auth.passwords.users.email'] = zbase_view_file_contents('auth.password.email.password'); require __DIR__ . '/Http/Controllers/Laravel/routes.php'; zbase()->prepareWidgets(); /** * Validator to check for account password * @TODO should be placed somewhere else other than here, and just call */ \Validator::extend('accountPassword', function ($attribute, $value, $parameters, $validator) { if (zbase_auth_has()) { $user = zbase_auth_user(); if (zbase_bcrypt_check($value, $user->password)) { return true; } } return false; }); \Validator::replacer('accountPassword', function ($message, $attribute, $rule, $parameters) { return _zt('Account password don\'t match.'); }); /** * */ \Validator::extend('passwordStrengthCheck', function ($attribute, $value, $parameters, $validator) { // if(!preg_match("#[0-9]+#", $value)) // { // //$errors[] = "Password must include at least one number!"; // return false; // } // // if(!preg_match("#[a-zA-Z]+#", $value)) // { // //$errors[] = "Password must include at least one letter!"; // return false; // } return true; }); \Validator::replacer('passwordStrengthCheck', function ($message, $attribute, $rule, $parameters) { return _zt('New password is too weak.'); }); // dd(zbase_config_get('email.account-noreply.email')); // dd(\Zbase\Utility\Service\Flickr::findByTags(['heavy equipment','dozers','loader'])); }
/** * HTML the widget * @return string */ public function __toString() { if (!empty($this->_renderOption)) { return parent::__toString(); } $labelClass = $this->_v('html.attributes.label.class', []); // $inputClass = $this->_v('html.attributes.input.class', []); $this->_prepared(); $str = '<div id="' . $this->_type . '-' . $this->getHtmlId() . '-form-group" class="col-md-12 ' . $this->_type . '-form-group form-group">'; $str .= '<label class="' . implode(' ', $labelClass) . '">' . $this->getLabel() . '</label>'; $str .= '<div class="radio-list">'; $str .= $this->renderMultiOptions(); $str .= '</div>'; $str .= \View::make(zbase_view_file_contents('ui.form.helpblock'), array('ui' => $this))->__toString(); $str .= '</div>'; return $str; }
<?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 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.image.enable', true); }, 'config' => ['entity' => ['name' => 'user', 'method' => 'currentUser', 'repo' => ['method' => 'currentUser']], 'event' => ['back' => ['image' => ['post' => ['post' => ['url' => function () { return zbase_url_previous(); }, 'redirect' => ['enable' => true]]]]]], 'form' => ['startTag' => ['action' => function () { if (zbase_is_back()) { return zbase_url_from_route('admin.account', ['action' => 'image']); } return zbase_url_from_route('account', ['action' => 'image']); }]], 'elements' => ['file' => ['type' => 'file', 'id' => 'file', 'label' => 'Update Image', 'html' => ['content' => ['pre' => ['enable' => true, 'view' => zbase_view_file_contents('node.files.files')]]]]]]];
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 }
@extends(zbase_view_template_layout()) @section('content') <?php echo view(zbase_view_file_contents($ui->widgetViewFile()), $ui->viewParams()); ?> @stop
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; }
<?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>
?> var <?php echo $prefix; ?> Columns = <?php echo json_encode($columnConfig, true); ?> ; <?php } ?> var <?php echo $prefix; ?> TemplateToolbar = '<?php echo zbase_view_render(zbase_view_file_contents('ui.datatable.toolbar'), ['ui' => $ui, 'template' => true]); ?> '; var <?php echo $prefix; ?> TemplateTable = '<table class="table table-hover flip-content" id="<?php echo $prefix; ?> Table"> <thead class="flip-content"> <tr> <?php echo implode("\n", $tHeads); ?> </tr>
* 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); } }]]]];
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(); return 'not_in:' . implode(',', $notAllowedUsernames); }, 'message' => 'Please provide a different username.']]]]], 'email' => ['type' => 'tab', 'label' => 'Email Address', 'id' => 'email', 'group' => 'accountTab', 'enable' => function () { return zbase_config_get('modules.account.widgets.account.tab.email', true); }, 'formConfiguration' => ['form' => ['startTag' => ['action' => zbase_url_from_current(), 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]]], 'elements' => ['email' => ['type' => 'email', 'id' => 'email', 'label' => 'Email Address', 'entity' => ['property' => 'email'], 'angular' => ['ngModel' => 'currentUser.email'], 'html' => ['attributes' => ['input' => ['autocomplete' => 'off']]], 'validations' => ['required' => ['enable' => true, 'message' => 'Email address is required.'], 'unique' => ['enable' => true, 'text' => function () { return 'unique:' . zbase_entity('user')->getTable() . ',email,' . zbase_auth_user()->id() . ',user_id'; }, 'message' => 'Email address already exists.'], 'not_in' => ['enable' => true, 'text' => function () { return 'not_in:' . zbase_auth_user()->email; }, 'message' => 'Please provide a different email address.']]]]], 'password' => ['type' => 'tab', 'label' => 'Update Password', 'id' => 'password', 'group' => 'accountTab', 'enable' => function () { return zbase_config_get('modules.account.widgets.account.tab.password', true); }, 'formConfiguration' => ['form' => ['startTag' => ['action' => zbase_url_from_current(), 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]]], 'elements' => ['header' => ['ui' => ['type' => 'component.pageHeader', 'id' => 'header', 'text' => 'To update password, enter your current password.']], 'password' => ['type' => 'password', 'id' => 'password', 'label' => null, 'validations' => ['required' => ['enable' => true, 'message' => 'Enter your account password.'], 'accountPassword' => ['enable' => true, 'message' => 'Account password don\'t match.']]]]], 'images' => ['type' => 'tab', 'label' => 'Profile Image', 'id' => 'images', 'group' => 'accountTab', 'enable' => function () { return zbase_config_get('modules.account.widgets.account.tab.images', true); }, 'position' => 90, 'formConfiguration' => ['angular' => ['form' => ['startTag' => ['html' => ['attributes' => ['ng-controller' => 'adminAccountMainController', 'flow-init' => function () { return '{headers:{\'X-CSRF-TOKEN\': \'' . zbase_csrf_token() . '\'}, target: \'' . zbase_api_url(['module' => 'account', 'object' => 'user', 'method' => 'updateProfileImage']) . '\'}'; }, 'flow-files-submitted' => '$flow.upload();']]]], 'submit' => ['button' => ['enable' => false]]]], 'elements' => ['file' => ['type' => 'file', 'id' => 'file', 'label' => 'Update Image', 'action' => function () { return zbase_api_url(['module' => 'account', 'object' => 'user', 'method' => 'updateProfileImage']); }, 'entity' => ['property' => 'file'], 'html' => ['attributes' => ['input' => ['style' => 'width: 100px;']], 'content' => ['pre' => ['enable' => true, 'view' => zbase_view_file_contents('node.files.files')]]]]]]]]];
/** * 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); } }
<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>
/** * 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; } }
</span> </a> <?php } ?> </div> <?php } else { ?> <div class="alert alert-warning">You don't have any messages.</div> <?php } ?> </div> </div> <hr /> <?php if (!empty($rows->count())) { ?> <div class="pull-right"> <?php echo zbase_view_render(zbase_view_file_contents('ui.datatable.pagination'), ['paginator' => $rows, 'ui' => $ui]); ?> </div> <?php } ?> </div>