/** * Prepare output comment post information array * @return array|null */ public function make() { if ($this->_record === null) { return null; } // build user data $userName = __('Unknown'); $userAvatar = App::$Alias->scriptUrl . '/upload/user/avatar/small/default.jpg'; $userObject = $this->_record->getUser(); if ($userObject !== null) { $userName = $userObject->getProfile()->getNickname(); $userAvatar = $userObject->getProfile()->getAvatarUrl('small'); } else { if (!Str::likeEmpty($this->_record->guest_name)) { $userName = App::$Security->strip_tags($this->_record->guest_name); } } // return output json data $res = ['type' => $this->_type, 'id' => $this->_record->id, 'text' => $this->_record->message, 'date' => Date::convertToDatetime($this->_record->created_at, Date::FORMAT_TO_HOUR), 'pathway' => $this->_record->pathway, 'moderate' => (int) $this->_record->moderate, 'user' => ['id' => $this->_record->user_id, 'name' => $userName, 'avatar' => $userAvatar]]; if ($this->_type === 'post' && method_exists($this->_record, 'getAnswerCount') && $this->_calcAnswers) { $res['answers'] = $this->_record->getAnswerCount(); } elseif ($this->_type === 'answer') { $res['comment_id'] = $this->_record->comment_id; } return $res; }
/** * Construct records into data array to display in view */ public function before() { // set data to display in view foreach ($this->_records as $row) { $this->data[] = ['id' => $row->id, 'title' => $row->getLocaled('title'), 'date' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_HOUR)]; } }
/** * Check comment add conditions. On bad conditions will be throw'd exception. * @throws JsonException * @return boolean */ public function check() { // check if user is auth'd or guest name is defined if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { throw new JsonException(__('Guest name is not defined')); } // check if pathway is empty if (Str::likeEmpty($this->pathway)) { throw new JsonException(__('Wrong target pathway')); } // check if message length is correct if (Str::length($this->message) < (int) $this->_configs['minLength'] || Str::length($this->message) > (int) $this->_configs['maxLength']) { throw new JsonException(__('Message length is incorrect. Current: %cur%, min - %min%, max - %max%', ['cur' => Str::length($this->message), 'min' => $this->_configs['minLength'], 'max' => $this->_configs['maxLength']])); } // guest moderation if (!App::$User->isAuth() && (bool) $this->_configs['guestModerate']) { $captcha = App::$Request->request->get('captcha'); if (!App::$Captcha->validate($captcha)) { throw new JsonException(__('Captcha is incorrect! Click on image to refresh and try again')); } } // check delay between 2 comments from 1 user or 1 ip $query = CommentPost::where('user_id', '=', $this->_userId)->orWhere('ip', '=', $this->ip)->orderBy('created_at', 'DESC')->first(); // check if latest post time for this user is founded if ($query !== null) { $postTime = Date::convertToTimestamp($query->created_at); $delay = $postTime + $this->_configs['delay'] - time(); if ($delay > 0) { throw new JsonException(__('Spam protection: please, wait %sec% seconds', ['sec' => $delay])); } } return true; }
/** * Upload files from ckeditor * @param string $type * @return string * @throws NativeException * @throws \Ffcms\Core\Exception\SyntaxException */ public function actionUpload($type) { /** @var $loadFile \Symfony\Component\HttpFoundation\File\UploadedFile */ $loadFile = App::$Request->files->get('upload'); if ($loadFile === null || $loadFile->getError() !== 0) { return $this->errorResponse(__('File upload failed')); } // get file extension $fileExt = '.' . $loadFile->guessExtension(); // check if this request type is allowed if ($this->allowedExt[$type] === null || !Obj::isArray($this->allowedExt[$type])) { throw new NativeException('Hack attempt'); } // check if this file extension is allowed to upload if (!Arr::in($fileExt, $this->allowedExt[$type])) { return $this->errorResponse(__('This file type is not allowed to upload')); } $date = Date::convertToDatetime(time(), 'd-m-Y'); // create file hash based on name-size $fileNewName = App::$Security->simpleHash($loadFile->getFilename() . $loadFile->getSize()) . $fileExt; $savePath = Normalize::diskFullPath('/upload/' . $type . '/' . $date); // save file from tmp to regular $loadFile->move($savePath, $fileNewName); // generate URI of uploaded file $url = '/upload/' . $type . '/' . $date . '/' . $fileNewName; return App::$View->render('editor/load_success', ['callbackId' => (int) App::$Request->query->get('CKEditorFuncNum'), 'url' => $url], __DIR__); }
/** * Make post to user wall from $viewer to $target instance of iUser interface objects * @param iUser $target * @param iUser $viewer * @param int $delay * @return bool */ public function makePost(iUser $target, iUser $viewer, $delay = 60) { if ($target === null || $viewer === null) { return false; } $find = WallRecords::where('sender_id', '=', $viewer->id)->orderBy('updated_at', 'desc')->first(); if ($find !== null) { $lastPostTime = Date::convertToTimestamp($find->updated_at); if (time() - $lastPostTime < static::POST_GLOBAL_DELAY) { // past time was less then default delay return false; } } // save new post to db $record = new WallRecords(); $record->target_id = $target->id; $record->sender_id = $viewer->id; $record->message = $this->message; $record->save(); // add user notification if ($target->id !== $viewer->id) { $notify = new EntityAddNotification($target->id); $notify->add('profile/show/' . $target->id . '#wall-post-' . $record->id, EntityAddNotification::MSG_ADD_WALLPOST, ['snippet' => Text::snippet($this->message, 50)]); } // cleanup message $this->message = null; return true; }
/** * Build sitemap index files information - location, last modify time */ public function make() { if (!Obj::isArray($this->files)) { return; } // build file information data foreach ($this->files as $file) { $this->info[] = ['loc' => App::$Alias->scriptUrl . $file, 'lastmod' => Date::convertToDatetime(File::mTime($file), 'c')]; } }
/** * Add uri/url item to sitemap builder * @param string $uri * @param int|string $lastmod * @param string $freq * @param float $priority */ public function add($uri, $lastmod, $freq = 'weekly', $priority = 0.5) { // generate multi-language files if ($this->langs !== null && Obj::isArray($this->langs) && count($this->langs) > 0) { foreach ($this->langs as $lang) { // set data to local attribute $this->data[$lang][] = ['uri' => Url::standaloneUrl($uri, $lang), 'lastmod' => Date::convertToDatetime($lastmod, 'c'), 'freq' => (string) $freq, 'priority' => (double) $priority]; } } else { // only one language, multilanguage is disabled $this->data[App::$Properties->get('singleLanguage')][] = ['uri' => Url::standaloneUrl($uri), 'lastmod' => Date::convertToDatetime($lastmod, 'c'), 'freq' => (string) $freq, 'priority' => (double) $priority]; } }
/** * Save data after validation */ public function save() { $profile = $this->_user->getProfile(); $profile->nick = $this->nick; $profile->sex = $this->sex; $newBirthday = Date::convertToDatetime($this->birthday, Date::FORMAT_SQL_DATE); if (false !== $newBirthday) { $profile->birthday = $newBirthday; } $profile->city = $this->city; $profile->hobby = $this->hobby; $profile->phone = $this->phone; $profile->url = $this->url; $profile->custom_data = $this->custom_data; $profile->save(); }
/** * Magic method before */ public function before() { // get full name of update object $class = 'Apps\\Controller\\Admin\\' . $this->_record->sys_name; if (class_exists($class)) { $this->_callback = $class; } else { throw new NotFoundException(__('Admin controller is not founded - %c%', ['c' => $this->_record->sys_name])); } // compare versions if ($this->_record->checkVersion() === true) { throw new ForbiddenException('Extension is not be updated - version comparing done successful'); } // set public attributes to display $this->name = $this->_record->getLocaleName(); $this->dbVersion = $this->_record->version; $this->scriptVersion = $this->_record->getScriptVersion(); $this->date = Date::convertToDatetime($this->_record->updated_at, Date::FORMAT_TO_HOUR); }
/** * Build notification list as array */ public function make() { // check if records is not empty if ($this->_records === null) { return; } // list records and build response foreach ($this->_records as $record) { /** @var UserNotification $record */ $vars = null; if (!Str::likeEmpty($record->vars)) { $vars = $record->vars; } if (!$vars !== null && isset($vars['snippet'])) { $vars['snippet'] = Url::standaloneLink($vars['snippet'], $record->uri, App::$Request->getLanguage()); } $text = App::$Translate->get('Profile', $record->msg, $vars); $this->items[] = ['text' => $text, 'date' => Date::humanize($record->created_at), 'new' => (bool) $record->readed === false]; } }
/** * Find latest release in github API and get required info */ private function findLatestVersion() { // get remote api with json response $gitJson = File::getFromUrl(static::API_LATEST_RELEASE); if ($gitJson === null || $gitJson === false) { return; } // parse api response to model attributes $git = json_decode($gitJson, true); $this->lastVersion = $git['tag_name']; // get download url to full compiled distributive (uploaded to each release as .zip archive, placed in release.assets) $download = null; if (Obj::isArray($git['assets'])) { foreach ($git['assets'] as $asset) { if ($asset['content_type'] === 'application/zip' && $asset['state'] === 'uploaded') { $download = $asset['browser_download_url']; } } } $this->lastInfo = ['name' => $git['name'], 'created_at' => Date::convertToDatetime($git['published_at'], Date::FORMAT_TO_HOUR), 'download_url' => $download]; }
/** * After validation generate new pwd, recovery token and send email * @throws SyntaxException * @throws \Ffcms\Core\Exception\NativeException */ public function make() { $user = App::$User->getIdentityViaEmail($this->email); if ($user === null) { throw new SyntaxException('Email not found'); } if ($user->approve_token !== '0' && Str::length($user->approve_token) > 0) { throw new SyntaxException('You must approve your account'); } $rows = UserRecovery::where('user_id', '=', $user->getId())->orderBy('id', 'DESC')->first(); if ($rows !== null && $rows !== false) { // prevent spam of recovery messages if (Date::convertToTimestamp($rows->created_at) > time() - self::DELAY) { return; } } // generate pwd, token and pwdCrypt $newPwd = Str::randomLatinNumeric(mt_rand(8, 16)); $pwdCrypt = App::$Security->password_hash($newPwd); $token = Str::randomLatinNumeric(mt_rand(64, 128)); // write new data to recovery table $rObject = new UserRecovery(); $rObject->user_id = $user->id; $rObject->password = $pwdCrypt; $rObject->token = $token; $rObject->save(); // write logs data $log = new UserLog(); $log->user_id = $user->id; $log->type = 'RECOVERY'; $log->message = __('Password recovery is initialized from: %ip%', ['ip' => App::$Request->getClientIp()]); $log->save(); // generate mail template $mailTemplate = App::$View->render('user/mail/recovery', ['login' => $user->login, 'email' => $this->email, 'password' => $newPwd, 'token' => $token, 'id' => $rObject->id]); $sender = App::$Properties->get('adminEmail'); // format SWIFTMailer format $mailMessage = \Swift_Message::newInstance(App::$Translate->get('Profile', 'Account recovery on %site%', ['site' => App::$Request->getHost()]))->setFrom([$sender])->setTo([$this->email])->setBody($mailTemplate, 'text/html'); // send message App::$Mailer->send($mailMessage); }
/** * Check if comment answer conditions is ok. Will throw exception if not. * @return bool * @throws JsonException */ public function check() { // check if user is auth'd or guest name is defined if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { throw new JsonException(__('Guest name is not defined')); } // guest moderation if (!App::$User->isAuth() && (bool) $this->_configs['guestModerate']) { $captcha = App::$Request->request->get('captcha'); if (!App::$Captcha->validate($captcha)) { throw new JsonException(__('Captcha is incorrect! Click on image to refresh and try again')); } } // check if replayTo is defined if ($this->replayTo < 1) { throw new JsonException(__('Comment post thread is not founded')); } // check if message length is correct if (Str::length($this->message) < (int) $this->_configs['minLength'] || Str::length($this->message) > (int) $this->_configs['maxLength']) { throw new JsonException(__('Message length is incorrect. Current: %cur%, min - %min%, max - %max%', ['cur' => Str::length($this->message), 'min' => $this->_configs['minLength'], 'max' => $this->_configs['maxLength']])); } $count = CommentPost::where('id', '=', $this->replayTo)->count(); if ($count !== 1) { throw new JsonException(__('Comment post thread is not founded')); } // check to prevent spam $query = CommentAnswer::where('user_id', '=', $this->_userId)->orWhere('ip', '=', $this->ip)->orderBy('created_at', 'DESC')->first(); // something is founded :D if ($query !== null) { $answerTime = Date::convertToTimestamp($query->created_at); $delay = $answerTime + $this->_configs['delay'] - time(); if ($delay > 0) { // sounds like config time is not passed now throw new JsonException(__('Spam protection: please, wait %sec% seconds', ['sec' => $delay])); } } return true; }
?> <h1><?php echo __('Content publish'); ?> </h1> <hr /> <p><?php echo __('Are you sure to make this item public?'); ?> </p> <?php $items = []; foreach ($records as $record) { /** @var $record \Apps\ActiveRecord\Content */ $items[] = [['text' => $record->id], ['text' => $record->getLocaled('title')], ['text' => Simplify::parseUserLink($record->author_id), 'html' => true], ['text' => Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR)]]; } ?> <div class="table-responsive"> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Title')], ['text' => __('Author')], ['text' => __('Date')]]], 'tbody' => ['items' => $items]]); ?> </div> <?php $form = new Form($model, ['class' => 'form-horizontal']); echo $form->start(); ?> <?php
<?php /** @var object $records */ use Ffcms\Core\Helper\Date; use Ffcms\Core\Helper\Text; use Ffcms\Core\Helper\Type\Str; foreach ($records as $record) { $title = \App::$Translate->getLocaleText($record->title); if (Str::likeEmpty($title)) { continue; } $title = Text::snippet($title, 50); $date = Date::humanize($record->created_at); $categoryUrl = \App::$Alias->baseUrl . '/content/list/' . $record->cpath; $categoryLink = '<a href="' . $categoryUrl . '">' . \App::$Translate->getLocaleText($record->ctitle) . '</a>'; $newsLink = \App::$Alias->baseUrl . '/content/read/' . $record->cpath; $newsLink = rtrim($newsLink, '/') . '/' . $record->path; echo '<div class="row"><div class="col-md-12">'; echo '<a href="' . $newsLink . '">→ ' . $title . '</a><br />'; echo '<small class="pull-left">' . $categoryLink . '</small>'; echo '<small class="pull-right">' . $date . '</small>'; echo '</div></div>'; echo '<hr class="pretty" />'; }
/** * Cleanup old invites */ public static function clean() { $date = time() - self::TOKEN_VALID_TIME; $timestamp = Date::convertToDatetime($date, Date::FORMAT_SQL_TIMESTAMP); self::where('created_at', '<=', $timestamp)->delete(); }
use Ffcms\Core\Helper\Type\Str; use Ffcms\Core\Helper\Url; $this->title = __('Profile list'); $this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), __('Profile')]; ?> <?php echo $this->render('profile/_tabs'); ?> <h1><?php echo __('Profile list'); ?> </h1> <hr /> <?php $items = []; foreach ($records as $profile) { $items[] = [['text' => $profile->id], ['text' => $profile->User()->login . '/' . $profile->User()->email], ['text' => $profile->nick], ['text' => Str::startsWith('0000-', $profile->birthday) ? __('None') : Date::convertToDatetime($profile->birthday)], ['text' => ($profile->rating > 0 ? '+' : null) . $profile->rating], ['text' => Url::link(['profile/update', $profile->id], '<i class="fa fa-pencil fa-lg"></i> ') . Url::link(['user/delete', $profile->User()->id], '<i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']]]; } ?> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => 'id'], ['text' => 'login/email'], ['text' => __('Nickname')], ['text' => __('Birthday')], ['text' => __('Rating')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items]]); ?> <div class="text-center"> <?php echo $pagination->display(['class' => 'pagination pagination-centered']); ?> </div>
?> </h1> <hr /> <?php echo __('Are you sure to delete this comments or answers?'); ?> <?php $items = []; foreach ($records as $item) { $message = Str::sub(\App::$Security->strip_tags($item->message), 0, 50); $author = Simplify::parseUserNick($item->user_id, $item->guest_name); if ((int) $item->user_id > 0) { $author = Url::link(['user/update', (int) $item->user_id], $author); } $items[] = [['text' => $item->id], ['text' => $message], ['text' => $author, 'html' => true], ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)]]; } ?> <div class="table-responsive"> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Message')], ['text' => __('Author')], ['text' => __('Date')]]], 'tbody' => ['items' => $items]]); ?> </div> <?php $form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post']); echo $form->start(); ?> <?php
if ($catConfigs['showCategory'] === true) { ?> <span class="spaced"><i class="fa fa-list"></i> <?php echo Url::link(['content/list', $item['category']->path], \App::$Translate->getLocaleText($item['category']->title), ['itemprop' => 'genre']); ?> </span> <?php } ?> <?php if ($catConfigs['showDate'] === true) { ?> <span class="spaced"><i class="fa fa-calendar"></i> <time datetime="<?php echo date('c', Date::convertToTimestamp($item['date'])); ?> " itemprop="datePublished"> <?php echo $item['date']; ?> </time> </span> <?php } ?> <?php if ($catConfigs['showAuthor'] === true) { ?> <span class="spaced"><i class="fa fa-user"></i> <?php
/** * Save changes in database */ public function save() { $this->_content->title = $this->title; $this->_content->text = $this->text; $this->_content->path = $this->path; $this->_content->category_id = $this->categoryId; $this->_content->author_id = $this->authorId; $this->_content->display = $this->display; $this->_content->meta_title = $this->metaTitle; $this->_content->meta_keywords = $this->metaKeywords; $this->_content->meta_description = $this->metaDescription; $this->_content->source = $this->source; // check if rating is changed if ((int) $this->addRating !== 0) { $this->_content->rating += (int) $this->addRating; } // check if special comment hash is exist if ($this->_new || Str::length($this->_content->comment_hash) < 32) { $this->_content->comment_hash = $this->generateCommentHash(); } // check if date is updated if (!Str::likeEmpty($this->createdAt) && !Str::startsWith('0000', Date::convertToDatetime($this->createdAt, Date::FORMAT_SQL_TIMESTAMP))) { $this->_content->created_at = Date::convertToDatetime($this->createdAt, Date::FORMAT_SQL_TIMESTAMP); } // save poster data $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; if (File::exist($posterPath)) { $this->_content->poster = $this->poster; } // get temporary gallery id $tmpGalleryId = $this->galleryFreeId; // save row $this->_content->save(); // update tags data in special table (relation: content->content_tags = oneToMany) ContentTag::where('content_id', '=', $this->_content->id)->delete(); $insertData = []; foreach ($this->metaKeywords as $lang => $keys) { // split keywords to tag array $tags = explode(',', $keys); foreach ($tags as $tag) { // cleanup tag from white spaces $tag = trim($tag); // prepare data to insert if (Str::length($tag) > 0) { $insertData[] = ['content_id' => $this->_content->id, 'lang' => $lang, 'tag' => $tag]; } } } // insert tags ContentTag::insert($insertData); // move files if ($tmpGalleryId !== $this->_content->id) { Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); } }
echo $referNickname; ?> " src="<?php echo $referObject->getProfile()->getAvatarUrl('small'); ?> " /> </div> </div> <div class="col-xs-8 col-md-10"> <h5 style="margin-top: 0;"> <i class="fa fa-pencil"></i> <?php echo Url::link(['profile/show', $post->sender_id], $referNickname); ?> <small class="pull-right"><?php echo Date::humanize($post->updated_at); ?> </small> </h5> <div class="object-text"> <?php echo $post->message; ?> </div> <hr style="margin: 5px;" /> <div><i class="fa fa-comment-o"></i> <a href="#wall-post-<?php echo $post->id; ?> " id="wall-post-response-<?php echo $post->id;
$this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), __('User list')]; ?> <?php echo $this->render('user/_tabs'); ?> <h1><?php echo __('User list'); ?> </h1> <hr /> <?php $items = []; foreach ($records as $user) { $items[] = [1 => ['text' => $user->id], 2 => ['text' => $user->email], 3 => ['text' => $user->login], 4 => ['text' => $user->getRole()->name], 5 => ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_DAY)], 6 => ['text' => Url::link(['user/update', $user->id], '<i class="fa fa-pencil fa-lg"></i>') . Url::link(['user/delete', $user->id], ' <i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']], 'property' => ['class' => 'checkbox-row' . ($user->approve_token != '0' ? ' alert-warning' : null)]]; } ?> <div class="pull-right"> <?php echo Url::link(['user/invite'], __('Send invite'), ['class' => 'btn btn-primary']); ?> <?php echo Url::link(['user/update', '0'], __('Add user'), ['class' => 'btn btn-primary']); ?> </div> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Email')], ['text' => __('Login')], ['text' => __('Role')], ['text' => __('Register date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items], 'selectableBox' => ['attachOrder' => 1, 'form' => ['method' => 'GET', 'class' => 'form-horizontal', 'action' => Url::to('user/delete')], 'selector' => ['type' => 'checkbox', 'name' => 'selected[]', 'class' => 'massSelectId'], 'buttons' => [['type' => 'submit', 'class' => 'btn btn-danger', 'value' => __('Delete selected')]]]]); ?>
<?php use Ffcms\Core\Helper\Date; use Ffcms\Core\Helper\HTML\Table; use Ffcms\Core\Helper\Url; /** @var \Apps\ActiveRecord\FeedbackPost|\Apps\ActiveRecord\FeedbackAnswer $record */ /** @var \Apps\Model\Admin\Feedback\FormAnswerAdd|null $model */ $this->title = __('Feedback delete'); $this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), Url::to('feedback/index') => __('Feedback'), __('Delete message')]; echo $this->render('feedback/_tabs'); ?> <h1><?php echo __('Delete feedback message'); ?> </h1> <hr /> <div class="table-responsive"> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'tbody' => ['items' => [[['text' => __('Sender')], ['text' => $record->name . ' (' . $record->email . ')']], [['text' => __('Date')], ['text' => Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR)]], [['text' => __('Message')], ['text' => $record->message]]]]]); ?> </div> <form action="" method="post"> <input type="submit" name="deleteFeedback" value="<?php echo __('Delete'); ?> " class="btn btn-danger" /> <?php echo Url::link(['feedback/index'], __('Cancel'), ['class' => 'btn btn-default']); ?> </form>
?> <h2><?php echo __('List of blocked users'); ?> </h2> <hr /> <?php if ($records !== null && $records->count() > 0) { ?> <?php $items = []; foreach ($records as $row) { $userProfile = $row->getUser()->getProfile(); $userNick = \Ffcms\Core\Helper\Simplify::parseUserNick($userProfile->user_id, __('No name')); $items[] = [['text' => Url::link(['profile/show', $row->target_id], $userNick, ['target' => '_blank']), 'html' => true], ['text' => $row->comment], ['text' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_DAY)], ['text' => Url::link(['profile/unblock', $row->target_id], '<i class="fa fa-times"></i>'), 'html' => true, 'property' => ['class' => 'text-center']]]; } ?> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => __('User')], ['text' => __('Comment')], ['text' => __('Add date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items]]); ?> <div class="text-center"> <?php echo $pagination->display(['class' => 'pagination pagination-centered']); ?> </div> <?php } else { ?>
echo $this->render('user/_tabs'); ?> <h1><?php echo __('Delete users'); ?> </h1> <hr /> <p><?php echo __('Are you sure to delete this users?'); ?> </p> <?php $items = []; foreach ($model->users as $user) { /** @var \Apps\ActiveRecord\User $user */ $items[] = [['text' => $user->getParam('id')], ['text' => $user->getParam('email')], ['text' => $user->getParam('login')], ['text' => $user->getProfile()->getNickname()], ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_HOUR)]]; } ?> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Email')], ['text' => __('Login')], ['text' => __('Nickname')], ['text' => __('Register date')]]], 'tbody' => ['items' => $items]]); ?> <?php $form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post', 'action' => '']); echo $form->start(); echo $form->submitButton(__('Delete'), ['class' => 'btn btn-danger']) . " "; echo Url::link(['user/index'], __('Cancel'), ['class' => 'btn btn-default']); echo $form->finish();
<?php use Ffcms\Core\Helper\Date; use Ffcms\Core\Helper\HTML\Table; use Ffcms\Core\Helper\Url; /** @var $this object */ /** @var $records Apps\ActiveRecord\UserLog */ $this->title = __('Logs'); $this->breadcrumbs = [Url::to('main/index') => __('Home'), Url::to('profile/show', \App::$User->identity()->getId()) => __('Profile'), __('Logs')]; ?> <?php echo $this->render('profile/_settingsTab'); ?> <h2><?php echo __('My logs'); ?> </h2> <hr /> <?php if ($records === null || $records->count() < 1) { echo __('No logs is available'); return; } $logs = []; foreach ($records->get() as $log) { $logs[] = [['type' => 'text', 'text' => $log->id], ['type' => 'text', 'text' => $log->type], ['type' => 'text', 'text' => $log->message], ['type' => 'text', 'text' => Date::convertToDatetime($log->created_at, Date::FORMAT_TO_HOUR)]]; } echo Table::display(['table' => ['class' => 'table table-striped'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Type')], ['text' => __('Message')], ['text' => __('Date')]]], 'tbody' => ['items' => $logs]]);
<h1><?php echo __('Feedback requests'); ?> </h1> <?php echo $this->render('feedback/_authTabs'); ?> <?php if ($records->count() < 1) { echo '<p class="alert alert-warning">' . __('No requests is founded') . '</p>'; return; } $items = []; foreach ($records as $item) { $items[] = [['text' => $item->id], ['text' => Url::link(['feedback/read', $item->id, $item->hash], Text::cut($item->message, 0, 40)), 'html' => true], ['text' => (int) $item->closed === 1 ? '<span class="label label-danger">' . __('Closed') . '</span>' : '<span class="label label-success">' . __('Opened') . '</span>', 'html' => true, '!secure' => true], ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)]]; } ?> <?php echo \Ffcms\Core\Helper\HTML\Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Message')], ['text' => __('Status')], ['text' => __('Created')], ['text' => __('Updated')]]], 'tbody' => ['items' => $items]]); ?> <div class="text-center"> <?php echo $pagination->display(['class' => 'pagination pagination-centered']); ?> </div>
<div class="text-center"><img src="<?php echo $profile->getAvatarUrl('small'); ?> " class="img-responsive img-circle img-thumbnail"/></div> </div> <div class="col-md-8"> <h3> <?php echo Url::link(['profile/show', $profile->user_id], Str::likeEmpty($profile->nick) ? __('No name') . '(id' . $profile->user_id . ')' : $profile->nick); ?> </h3> <p><?php echo __('Registered'); ?> : <?php echo Date::convertToDatetime($profile->created_at, Date::FORMAT_TO_DAY); ?> </p> <?php if (\App::$User->identity() !== null && $profile->user_id !== \App::$User->identity()->getId()) { ?> <?php echo Url::link(['profile/messages', null, null, ['newdialog' => $profile->user_id]], '<i class="fa fa-pencil-square-o"></i> ' . __('New message'), ['class' => 'btn btn-info']); ?> <?php } ?> </div> <div class="col-md-2"> <div class="h3 pull-right"> <?php
foreach ($record->getAnswers()->get() as $answer) { ?> <div class="panel <?php echo (int) $answer->is_admin === 1 ? 'panel-success' : 'panel-default'; ?> "> <div class="panel-heading"> <?php echo __('From'); ?> : <?php echo $answer->name . '(' . $answer->email . ')' . ((int) $answer->user_id > 0 ? Url::link(['user/update', $answer->user_id], '[id' . $answer->user_id . ']') : null); ?> , <?php echo Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR); ?> <span class="pull-right"> <?php echo Url::link(['feedback/update', 'answer', $answer->id], __('Edit'), ['class' => 'label label-primary']); ?> <?php echo Url::link(['feedback/delete', 'answer', $answer->id], __('Delete'), ['class' => 'label label-danger']); ?> </span> </div> <div class="panel-body"> <?php echo Str::replace("\n", "<br />", $answer->message); ?> </div>
use Ffcms\Core\Helper\Url; /** @var $widget object */ /** @var $this object */ /** @var $model object */ $this->title = __('Turn on/off'); $this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('widget/index') => __('Widgets'), __('Turn on/off')]; ?> <h1><?php echo __('Widget turn on/off'); ?> </h1> <hr /> <?php echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => __('Param')], ['text' => __('Value')]]], 'tbody' => ['items' => [[['text' => __('Name')], ['text' => $widget->getLocaleName()]], [['text' => __('System name')], ['text' => $widget->sys_name]], [['text' => __('Last update')], ['text' => Date::convertToDatetime($widget->updated_at, DATE::FORMAT_TO_SECONDS)]], [['text' => __('Status')], ['text' => (int) $widget->disabled === 0 ? 'On' : 'Off'], 'property' => ['class' => (int) $widget->disabled === 0 ? 'alert-success' : 'alert-danger']]]]]); ?> <?php $form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post', 'action' => '', 'enctype' => 'multipart/form-data']); ?> <?php echo $form->start(); ?> <div class="col-md-12"> <?php echo $form->submitButton(__('Switch'), ['class' => 'btn btn-primary']); ?> <?php