function grid_comments_list($controller) { $options = array('is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'order_by' => 'date_pub', 'order_to' => 'desc', 'show_id' => true); $columns = array('id' => array('title' => 'id', 'width' => 30), 'date_pub' => array('title' => LANG_DATE, 'width' => 110, 'handler' => function ($value, $item) { return html_date($value, true); }, 'filter' => 'date'), 'target_id' => array('title' => LANG_COMMENTS_TEXT, 'handler' => function ($value, $row) use($controller) { return '<a title="' . LANG_COMMENTS_EDIT_TEXT . '" class="ajax-modal comment_text_edit" href="' . href_to($controller->root_url, 'text_edit', array($row['id'])) . '">' . string_short($row['content_html'], 350) . '</a>'; }), 'user_id' => array('title' => LANG_AUTHOR, 'width' => 180, 'handler' => function ($value, $row) { if ($row['user_id']) { $v = '<a target="_blank" href="' . href_to('users', $row['user_id']) . '">' . $row['user_nickname'] . '</a>'; } else { $v = '<span class="guest_name">' . $row['author_name'] . '</span>'; if (!empty($row['author_email'])) { $v .= '<span>, ' . $row['author_email'] . '</span>'; } } return $v; }), 'author_url' => array('title' => LANG_COMMENTS_IP, 'width' => 120, 'filter' => 'like', 'handler' => function ($value) { if ($value) { return '<a href="#" class="ajaxlink filter_ip tooltip" title="' . LANG_CP_USER_FIND_BYIP . '">' . $value . '</a> <a class="view_target tooltip" href="https://apps.db.ripe.net/search/query.html?searchtext=' . $value . '#resultsAnchor" target="_blank" title="' . LANG_CP_USER_RIPE_SEARCH . '"></a>'; } return ''; }), 'rating' => array('title' => LANG_RATING, 'width' => 50, 'handler' => function ($value, $row) { return '<span class="' . html_signed_class($value) . '">' . html_signed_num($value) . '</span>'; }, 'filter' => 'exact'), 'is_deleted' => array('title' => LANG_COMMENTS_IS_DELETED, 'flag' => 'flag_lock', 'flag_toggle' => href_to($controller->root_url, 'toggle_item', array('{id}', 'comments', 'is_deleted')), 'width' => 50, 'filter' => 'exact'), 'is_approved' => array('title' => LANG_MODERATION, 'flag' => true, 'width' => 50, 'filter' => 'exact', 'handler' => function ($value, $item) { if (!$item['is_approved']) { return '<div class="flag_trigger flag_off"><span><a class="approve_comment" title="' . LANG_COMMENTS_APPROVE . '" href="#" data-approve-url="' . href_to('comments', 'approve') . '?id=' . $item['id'] . '"></a></span></div>'; } return '<div class="flag_trigger flag_on"></div>'; }), 'is_private' => array('title' => LANG_COMMENTS_IS_PRIVATE, 'flag' => true, 'width' => 50, 'filter' => 'exact')); $actions = array(array('title' => LANG_COMMENTS_VIEW, 'class' => 'view tooltip', 'href' => href_to('{target_url}', '#comment_{id}')), array('title' => LANG_DELETE, 'class' => 'delete', 'href' => href_to($controller->root_url, 'comments_delete', array('{id}')), 'confirm' => LANG_COMMENTS_DELETE_CONFIRM)); return array('options' => $options, 'columns' => $columns, 'actions' => $actions); }
public function run() { if (cmsUser::isLogged()) { $this->redirectToHome(); } $users_model = cmsCore::getModel('users'); $form = $this->getForm('restore'); $data = array(); $is_submitted = $this->request->has('submit'); if ($is_submitted) { $data = $form->parse($this->request, $is_submitted); $errors = $form->validate($this, $data); if ($errors) { cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error'); } if (!$errors) { $user = $users_model->getUserByEmail($data['email']); if (!$user) { cmsUser::addSessionMessage(LANG_EMAIL_NOT_FOUND, 'error'); } else { $pass_token = string_random(32, $user['email']); $users_model->updateUserPassToken($user['id'], $pass_token); $messenger = cmsCore::getController('messages'); $to = array('email' => $user['email'], 'name' => $user['nickname']); $letter = array('name' => 'reg_restore'); $messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'reset', $pass_token), 'valid_until' => html_date(date('d.m.Y H:i', time() + 24 * 3600), true))); cmsUser::addSessionMessage(LANG_TOKEN_SENDED, 'success'); } } } return cmsTemplate::getInstance()->render('restore', array('data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false)); }
function grid_content_items($controller, $ctype_name = false) { $options = array('is_auto_init' => false, 'is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'is_selectable' => true, 'order_by' => 'id', 'order_to' => 'desc', 'show_id' => true); $columns = array('id' => array('title' => 'id', 'width' => 30, 'filter' => 'exact'), 'title' => array('title' => LANG_TITLE, 'href' => href_to($ctype_name, 'edit', '{id}') . '?back=' . href_to($controller->name, 'content'), 'filter' => 'like'), 'date_pub' => array('title' => LANG_DATE, 'width' => 80, 'handler' => function ($value, $item) { return html_date($value); }), 'is_pub' => array('title' => LANG_ON, 'width' => 40, 'flag' => true, 'flag_toggle' => href_to($controller->name, 'content', array('item_toggle', $ctype_name, '{id}'))), 'user_nickname' => array('title' => LANG_AUTHOR, 'href' => href_to('users', '{user_id}'), 'order_by' => 'u.nickname')); $actions = array(array('title' => LANG_VIEW, 'class' => 'view', 'href' => href_to($ctype_name, '{slug}.html')), array('title' => LANG_EDIT, 'class' => 'edit', 'href' => href_to($ctype_name, 'edit', '{id}') . '?back=' . href_to($controller->name, 'content')), array('title' => LANG_DELETE, 'class' => 'delete', 'href' => href_to($ctype_name, 'delete', '{id}') . '?back=' . href_to($controller->name, 'content'), 'confirm' => LANG_CP_CONTENT_ITEM_DELETE_CONFIRM)); return array('options' => $options, 'columns' => $columns, 'actions' => $actions); }
function grid_users($controller) { $options = array('is_auto_init' => false, 'is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'order_by' => 'id', 'order_to' => 'asc', 'show_id' => true); $columns = array('id' => array('title' => 'id', 'width' => 30, 'filter' => 'exact'), 'nickname' => array('title' => LANG_NICKNAME, 'href' => href_to($controller->name, 'users', array('edit', '{id}')), 'filter' => 'like', 'handler' => function ($nickname, $user) { if ($user['is_admin']) { $nickname = '<b class="tooltip" title="' . LANG_USER_IS_ADMIN . '">' . $nickname . '</b>'; } return $nickname; }), 'email' => array('title' => LANG_EMAIL, 'width' => 200, 'filter' => 'like'), 'ip' => array('title' => LANG_USERS_PROFILE_LAST_IP, 'width' => 120, 'filter' => 'like', 'handler' => function ($value) { return '<a href="#" class="ajaxlink filter_ip tooltip" title="' . LANG_CP_USER_FIND_BYIP . '">' . $value . '</a> <a class="view_target tooltip" href="https://apps.db.ripe.net/search/query.html?searchtext=' . $value . '#resultsAnchor" target="_blank" title="' . LANG_CP_USER_RIPE_SEARCH . '"></a>'; }), 'date_reg' => array('title' => LANG_REGISTRATION, 'width' => 80, 'filter' => 'like', 'handler' => function ($date, $user) { $ld = $user['is_online'] ? LANG_ONLINE : LANG_USERS_PROFILE_LOGDATE . ' ' . string_date_age_max($user['date_log'], true); return '<span class="tooltip" title="' . $ld . '">' . html_date($date) . '</span>'; }), 'karma' => array('title' => LANG_KARMA, 'width' => 60, 'filter' => 'exact', 'handler' => function ($value) { return '<span class="' . html_signed_class($value) . '">' . html_signed_num($value) . '</span>'; }), 'rating' => array('title' => LANG_RATING, 'width' => 60, 'filter' => 'exact'), 'is_locked' => array('title' => LANG_CP_USER_LOCKED, 'flag' => 'flag_lock', 'width' => 24, 'handler' => function ($value, $user) { $title = $user['is_locked'] ? $user['lock_reason'] ? $user['lock_reason'] : LANG_TO . ' ' . strip_tags(html_date($user['lock_until'])) : ''; return '<div class="tooltip" title="' . $title . '">' . $value . '</div>'; })); $actions = array(array('title' => LANG_PROFILE, 'class' => 'view tooltip', 'href' => href_to('users', '{id}')), array('title' => LANG_EDIT, 'class' => 'edit tooltip', 'href' => href_to($controller->name, 'users', array('edit', '{id}'))), array('title' => LANG_DELETE, 'class' => 'delete tooltip', 'href' => href_to($controller->name, 'users', array('delete', '{id}')), 'confirm' => LANG_CP_USER_DELETE_CONFIRM)); return array('options' => $options, 'columns' => $columns, 'actions' => $actions); }
public function parse($value) { return $value ? html_date($value, $this->getOption('show_time')) : null; }
public function logoutLockedUser($user) { $now = time(); $lock_until = !empty($user['lock_until']) ? strtotime($user['lock_until']) : false; if ($lock_until && $lock_until <= $now) { $this->model->unlockUser($user['id']); return; } $notice_text = array(); $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE); if ($user['lock_until']) { $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_UNTIL, html_date($user['lock_until'])); } if ($user['lock_reason']) { $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_REASON, $user['lock_reason']); } $notice_text = implode('<br>', $notice_text); cmsUser::addSessionMessage($notice_text, 'error'); cmsUser::logout(); return; }
function html_date_time($date = false) { return html_date($date, true); }
public function sendEmail($to, $letter, $data = array()) { if (is_array($to)) { if (empty($to['email'])) { return false; } if (empty($to['name'])) { $to['name'] = false; } } else { if (empty($to)) { return false; } $to = array('email' => $to, 'name' => false); } if (is_array($letter)) { if (empty($letter['text'])) { $letter['text'] = cmsCore::getLanguageTextFile("letters/{$letter['name']}"); } } else { $letter = array('text' => cmsCore::getLanguageTextFile("letters/{$letter}")); } if (!$letter['text']) { return false; } $config = cmsConfig::getInstance(); $data = array_merge(array('site' => $config->sitename, 'date' => html_date(time()), 'time' => html_time(time())), $data); $letter['text'] = string_replace_keys_values($letter['text'], $data); $mailer = new cmsMailer(); $mailer->addTo($to['email'], $to['name']); $letter['text'] = $mailer->parseSubject($letter['text']); $letter['text'] = $mailer->parseAttachments($letter['text']); $mailer->setBodyHTML(nl2br($letter['text'])); $result = $mailer->send(); $mailer->clearTo()->clearAttachments(); return $result; }
public function getItemForm($ctype, $fields, $action, $data = array(), $item_id = false, $item = false) { $user = cmsUser::getInstance(); // Контейнер для передачи дополнительных списков: // $groups_list, $folders_list и т.д. extract($data); // Строим форму $form = new cmsForm(); $fieldset_id = $form->addFieldset(); // Если включены категории, добавляем в форму поле выбора категории if ($ctype['is_cats'] && ($action != 'edit' || $ctype['options']['is_cats_change'])) { $fieldset_id = $form->addFieldset(LANG_CATEGORY, 'category'); $form->addField($fieldset_id, new fieldList('category_id', array('rules' => array(array('required')), 'generator' => function ($item) { $content_model = cmsCore::getModel('content'); $ctype = $content_model->getContentTypeByName($item['ctype_name']); $tree = $content_model->getCategoriesTree($item['ctype_name']); $level_offset = 0; $last_header_id = false; $items = array('' => LANG_CONTENT_SELECT_CATEGORY); if ($tree) { foreach ($tree as $c) { if ($ctype['options']['is_cats_only_last']) { $dash_pad = $c['ns_level'] - 1 >= 0 ? str_repeat('-', $c['ns_level'] - 1) . ' ' : ''; if ($c['ns_right'] - $c['ns_left'] == 1) { if ($last_header_id !== false && $last_header_id != $c['parent_id']) { $items['opt' . $c['id']] = array(str_repeat('-', $c['ns_level'] - 1) . ' ' . $c['title']); } $items[$c['id']] = $dash_pad . $c['title']; } else { if ($c['parent_id'] > 0) { $items['opt' . $c['id']] = array($dash_pad . $c['title']); $last_header_id = $c['id']; } } continue; } if (!$ctype['options']['is_cats_only_last']) { if ($c['parent_id'] == 0 && !$ctype['options']['is_cats_open_root']) { $level_offset = 1; continue; } $items[$c['id']] = str_repeat('-- ', $c['ns_level'] - $level_offset) . ' ' . $c['title']; continue; } } } return $items; }))); if (cmsUser::isAllowed($ctype['name'], 'add_cat')) { $form->addField($fieldset_id, new fieldString('new_category', array('title' => LANG_ADD_CATEGORY_QUICK))); } if (!empty($ctype['options']['is_cats_multi'])) { $fieldset_id = $form->addFieldset(LANG_ADDITIONAL_CATEGORIES, 'multi_cats', array('is_empty' => true)); } } // Если включены личные папки, добавляем в форму поле выбора личной папки if ($ctype['is_folders']) { $fieldset_id = $form->addFieldset(LANG_FOLDER, 'folder'); $folders = array('0' => LANG_CONTENT_SELECT_FOLDER); if ($folders_list) { $folders = $folders + $folders_list; } $form->addField($fieldset_id, new fieldList('folder_id', array('items' => $folders))); $form->addField($fieldset_id, new fieldString('new_folder', array('title' => LANG_ADD_FOLDER_QUICK))); } // Если есть поля-свойства, то добавляем область для них if ($ctype['props']) { $form->addFieldset('', 'props', array('is_empty' => true, 'class' => 'highlight')); } // Если этот контент можно создавать в группах (сообществах) то добавляем // поле выбора группы if ($action == 'add' && $groups_list && $groups_list != array('0' => '')) { $fieldset_id = $form->addFieldset(LANG_GROUP); $form->addField($fieldset_id, new fieldList('parent_id', array('items' => $groups_list))); } // Разбиваем поля по группам $fieldsets = cmsForm::mapFieldsToFieldsets($fields, function ($field, $user) { // пропускаем системные поля if ($field['is_system']) { return false; } // проверяем что группа пользователя имеет доступ к редактированию этого поля if ($field['groups_edit'] && !$user->isInGroups($field['groups_edit'])) { return false; } return true; }); // Добавляем поля в форму foreach ($fieldsets as $fieldset) { $fieldset_id = $form->addFieldset($fieldset['title']); foreach ($fieldset['fields'] as $field) { // добавляем поле в форму $form->addField($fieldset_id, $field['handler']); } } // // Если включены теги, то добавляем поле для них // if ($ctype['is_tags']) { $fieldset_id = $form->addFieldset(LANG_TAGS); $form->addField($fieldset_id, new fieldString('tags', array('hint' => LANG_TAGS_HINT, 'autocomplete' => array('multiple' => true, 'url' => href_to('tags', 'autocomplete'))))); } // Если ручной ввод SLUG, то добавляем поле для этого if (!$ctype['is_auto_url']) { $slug_field_rules = array(array('required'), array('slug')); if ($action == 'add') { $slug_field_rules[] = array('unique', $this->model->table_prefix . $ctype['name'], 'slug'); } if ($action == 'edit') { $slug_field_rules[] = array('unique_exclude', $this->model->table_prefix . $ctype['name'], 'slug', $item_id); } $fieldset_id = $form->addFieldset(LANG_SLUG); $form->addField($fieldset_id, new fieldString('slug', array('prefix' => '/' . $ctype['name'] . '/', 'suffix' => '.html', 'rules' => $slug_field_rules))); } // Если разрешено управление видимостью, то добавляем поле if (cmsUser::isAllowed($ctype['name'], 'privacy')) { $fieldset_id = $form->addFieldset(LANG_PRIVACY); $form->addField($fieldset_id, new fieldList('is_private', array('items' => array(0 => LANG_PRIVACY_PUBLIC, 1 => LANG_PRIVACY_PRIVATE), 'rules' => array(array('number'))))); } // если разрешено отключать комментарии к записи if (cmsUser::isAllowed($ctype['name'], 'disable_comments') && $ctype['is_comments']) { $fieldset_id = $form->addFieldset(LANG_RULE_CONTENT_COMMENT, 'is_comment'); $form->addField($fieldset_id, new fieldList('is_comments_on', array('default' => 1, 'items' => array(1 => LANG_YES, 0 => LANG_NO)))); } // // Если ручной ввод ключевых слов или описания, то добавляем поля для этого // if (!empty($ctype['options']['is_manual_title']) || !$ctype['is_auto_keys'] || !$ctype['is_auto_desc']) { $fieldset_id = $form->addFieldset(LANG_SEO); if ($ctype['options']['is_manual_title']) { $form->addField($fieldset_id, new fieldString('seo_title', array('title' => LANG_SEO_TITLE, 'rules' => array(array('max_length', 256))))); } if (!$ctype['is_auto_keys']) { $form->addField($fieldset_id, new fieldString('seo_keys', array('title' => LANG_SEO_KEYS, 'hint' => LANG_SEO_KEYS_HINT, 'rules' => array(array('max_length', 256))))); } if (!$ctype['is_auto_desc']) { $form->addField($fieldset_id, new fieldText('seo_desc', array('title' => LANG_SEO_DESC, 'hint' => LANG_SEO_DESC_HINT, 'rules' => array(array('max_length', 256))))); } } // // Если включен выбор даты публикации, то добавляем поля // $pub_fieldset_id = false; $is_dates = $ctype['is_date_range']; $is_pub_start_date = cmsUser::isAllowed($ctype['name'], 'pub_late'); $is_pub_end_date = cmsUser::isAllowed($ctype['name'], 'pub_long', 'any'); $is_pub_end_days = cmsUser::isAllowed($ctype['name'], 'pub_long', 'days'); $is_pub_control = cmsUser::isAllowed($ctype['name'], 'pub_on'); $is_pub_ext = cmsUser::isAllowed($ctype['name'], 'pub_max_ext'); $pub_max_days = intval(cmsUser::getPermissionValue($ctype['name'], 'pub_max_days')); if ($user->is_admin) { $is_pub_end_days = false; } if ($is_pub_control) { $pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB); $form->addField($pub_fieldset_id, new fieldList('is_pub', array('title' => sprintf(LANG_CONTENT_IS_PUB, $ctype['labels']['create']), 'default' => 1, 'items' => array(1 => LANG_YES, 0 => LANG_NO)))); } if ($is_dates) { if ($is_pub_start_date) { $pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB); $m = date('i'); $form->addField($pub_fieldset_id, new fieldDate('date_pub', array('title' => LANG_CONTENT_DATE_PUB, 'default' => date('Y-m-d H:') . ($m - $m % 5), 'options' => array('show_time' => true), 'rules' => array(array('required'))))); } if ($is_pub_end_date) { $pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB); $form->addField($pub_fieldset_id, new fieldDate('date_pub_end', array('title' => LANG_CONTENT_DATE_PUB_END, 'hint' => LANG_CONTENT_DATE_PUB_END_HINT))); } if ($action == 'add' && $is_pub_end_days || $action == 'edit' && $is_pub_ext && $is_pub_end_days) { $pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB); $title = $action == 'add' ? LANG_CONTENT_PUB_LONG : LANG_CONTENT_PUB_LONG_EXT; $hint = $action == 'add' ? false : sprintf(LANG_CONTENT_PUB_LONG_NOW, html_date($item['date_pub_end'])); if ($pub_max_days) { $days = array(); $rules = array(); if ($action == 'add') { $rules[] = array('required'); $min = 1; } if ($action == 'edit') { $min = 0; } $rules[] = array('number'); $rules[] = array('min', $min); $rules[] = array('max', $pub_max_days); if ($action == 'add') { $rules[] = array('required'); $min = 1; } if ($action == 'edit') { $min = 0; } for ($d = $min; $d <= $pub_max_days; $d++) { $days[$d] = $d; } $form->addField($pub_fieldset_id, new fieldList('pub_days', array('title' => $title, 'hint' => $hint, 'items' => $days, 'rules' => $rules))); } else { $rules = array(); if ($action == 'add') { $rules[] = array('required'); $min = 1; } if ($action == 'edit') { $min = 0; } $rules[] = array('min', $min); $rules[] = array('max', 65535); $form->addField($pub_fieldset_id, new fieldNumber('pub_days', array('title' => $title, 'default' => 10, 'rules' => $rules))); } } } return $form; }
<?php echo html_host_report($host_ip, $host_data['name']); ?> </td> <?php html_set_values($host_ip, 'host', $host_data["max_{$ac}"], $host_data["max_{$ac}_date"], $host_data["current_{$ac}"], $host_data["threshold_{$ac}"], $ac); ?> <td nowrap><?php echo html_rrd(); ?> <?php echo html_incident(); ?> </td> <td nowrap><?php echo html_date(); ?> </td> <?php echo html_max(); ?> <?php echo html_current(); ?> </tr> <?php } ?> <?php } ?>
public function run() { if (cmsUser::isLogged() && !cmsUser::isAdmin()) { $this->redirectToHome(); } $users_model = cmsCore::getModel('users'); $form = $this->getForm('registration'); // // Добавляем поле для кода приглашения, // если регистрация доступна только по приглашениям // if ($this->options['is_reg_invites']) { $fieldset_id = $form->addFieldsetToBeginning(LANG_REG_INVITED_ONLY); $form->addField($fieldset_id, new fieldString('inv', array('title' => LANG_REG_INVITE_CODE, 'rules' => array(array('required'), array('min_length', 10), array('max_length', 10))))); } // // Добавляем поле выбора группы, // при наличии публичных групп // $public_groups = $users_model->getPublicGroups(); if ($public_groups) { $pb_items = array(); foreach ($public_groups as $pb) { $pb_items[$pb['id']] = $pb['title']; } $form->addFieldToBeginning('basic', new fieldList('group_id', array('title' => LANG_USER_GROUP, 'items' => $pb_items))); } // // Добавляем в форму обязательные поля профилей // $content_model = cmsCore::getModel('content'); $content_model->setTablePrefix(''); $content_model->orderBy('ordering'); $fields = $content_model->getRequiredContentFields('users'); // Разбиваем поля по группам $fieldsets = cmsForm::mapFieldsToFieldsets($fields); // Добавляем поля в форму foreach ($fieldsets as $fieldset) { $fieldset_id = $form->addFieldset($fieldset['title']); foreach ($fieldset['fields'] as $field) { if ($field['is_system']) { continue; } $form->addField($fieldset_id, $field['handler']); } } $user = array(); if ($this->request->hasInQuery('inv')) { $user['inv'] = $this->request->get('inv'); } $is_submitted = $this->request->has('submit'); if ($is_submitted) { if (!$this->options['is_reg_enabled']) { cmsCore::error404(); } $errors = false; $is_captcha_valid = true; // // Проверяем капчу // if ($this->options['reg_captcha']) { $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request); if (!$is_captcha_valid) { $errors = true; cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error'); } } // // Парсим и валидируем форму // if (!$errors) { $user = $form->parse($this->request, $is_submitted); $user['groups'] = array(); if (!empty($this->options['def_groups'])) { $user['groups'] = $this->options['def_groups']; } if (isset($user['group_id'])) { if (!in_array($user['group_id'], $user['groups'])) { $user['groups'][] = $user['group_id']; } } // // убираем поля которые не относятся к выбранной пользователем группе // foreach ($fieldsets as $fieldset) { foreach ($fieldset['fields'] as $field) { if (!$field['groups_edit']) { continue; } if (in_array(0, $field['groups_edit'])) { continue; } if (!in_array($user['group_id'], $field['groups_edit'])) { $form->disableField($field['name']); unset($user[$field['name']]); } } } $errors = $form->validate($this, $user); } if (!$errors) { // // проверяем код приглашения // if ($this->options['is_reg_invites']) { $invite = $this->model->getInviteByCode($user['inv']); if (!$invite) { $errors['inv'] = LANG_REG_WRONG_INVITE_CODE; } else { if ($this->options['is_invites_strict'] && $invite['email'] != $user['email']) { $errors['inv'] = LANG_REG_WRONG_INVITE_CODE_EMAIL; } else { $user['inviter_id'] = $invite['user_id']; } } } // // проверяем допустимость e-mail, имени и IP // if (!$this->isEmailAllowed($user['email'])) { $errors['email'] = sprintf(LANG_AUTH_RESTRICTED_EMAIL, $user['email']); } if (!$this->isNameAllowed($user['nickname'])) { $errors['nickname'] = sprintf(LANG_AUTH_RESTRICTED_NAME, $user['nickname']); } if (!$this->isIPAllowed(cmsUser::get('ip'))) { cmsUser::addSessionMessage(sprintf(LANG_AUTH_RESTRICTED_IP, cmsUser::get('ip')), 'error'); $errors = true; } } if (!$errors) { unset($user['inv']); // // Блокируем пользователя, если включена верификация e-mail // if ($this->options['verify_email']) { $user = array_merge($user, array('is_locked' => true, 'lock_reason' => LANG_REG_CFG_VERIFY_LOCK_REASON, 'pass_token' => string_random(32, $user['email']), 'date_token' => '')); } $result = $users_model->addUser($user); if ($result['success']) { $user['id'] = $result['id']; cmsUser::addSessionMessage(LANG_REG_SUCCESS, 'success'); // отправляем письмо верификации e-mail if ($this->options['verify_email']) { $messenger = cmsCore::getController('messages'); $to = array('email' => $user['email'], 'name' => $user['nickname']); $letter = array('name' => 'reg_verify'); $messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'verify', $user['pass_token']), 'valid_until' => html_date(date('d.m.Y H:i', time() + $this->options['verify_exp'] * 3600), true))); cmsUser::addSessionMessage(sprintf(LANG_REG_SUCCESS_NEED_VERIFY, $user['email']), 'info'); } else { cmsEventsManager::hook('user_registered', $user); } $back_url = cmsUser::sessionGet('auth_back_url') ? cmsUser::sessionGet('auth_back_url', true) : false; if ($back_url) { $this->redirect($back_url); } else { $this->redirectToHome(); } } else { $errors = $result['errors']; } } if ($errors && $is_captcha_valid) { cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error'); } } // Капча if ($this->options['reg_captcha']) { $captcha_html = cmsEventsManager::hook('captcha_html'); } return cmsTemplate::getInstance()->render('registration', array('user' => $user, 'form' => $form, 'captcha_html' => isset($captcha_html) ? $captcha_html : false, 'errors' => isset($errors) ? $errors : false)); }
?> <span class="rate_value rating" title="<?php echo LANG_RATING; ?> "><?php echo $group['rating']; ?> </span> <?php } else { ?> <?php echo html_date($group['date_pub']); ?> <?php } ?> </div> </div> <?php $index++; ?> <?php
} ?> <?php if (!empty($update['version'])) { ?> <h2><?php printf(LANG_CP_UPDATE_AVAILABLE, $update['version']); ?> </h2> <h3><?php echo LANG_CP_UPDATE_DATE; ?> : <?php echo html_date($update['date']); ?> </h3> <?php if (!function_exists('curl_init')) { ?> <p> <?php echo LANG_CP_UPDATE_MANUAL_1; ?> <br> <?php echo LANG_CP_UPDATE_MANUAL_2; ?>
<td width="32"> <?php echo html_avatar_image($moderator['user_avatar'], 'micro'); ?> </td> <td> <a href="<?php echo href_to('users', $moderator['user_id']); ?> "><?php html($moderator['user_nickname']); ?> </a> </td> <td class="center"><?php echo html_date($moderator['date_assigned']); ?> </td> <td class="center"><?php echo $moderator['count_approved']; ?> </td> <td class="center"><?php echo $moderator['count_deleted']; ?> </td> <td class="center"><?php echo $moderator['count_idle']; ?> </td> <td>