当前位置: 首页>>代码示例>>PHP>>正文


PHP Notifier::info方法代码示例

本文整理汇总了PHP中Notifier::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::info方法的具体用法?PHP Notifier::info怎么用?PHP Notifier::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notifier的用法示例。


在下文中一共展示了Notifier::info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

    function getContent()
    {
        global $cfg, $user, $sql, $plug;
        $note = new Notifier();
        $tpl = new PHPTAL('plugins/comments/comments.tpl.html');
        $err = new Error();
        $tpl->entries = '';
        if ($this->total_comments != -1 && !Kio::getConfig('view_only_logged', 'comments')) {
            if ($this->total_comments > 0) {
                $tpl->backlink = $this->backlink;
                $tpl->cfg = $cfg;
                $tpl->user = $user;
                $tpl->entries = $this->getEntries();
            } else {
                $note->info('There is no comments.');
            }
            if (!Kio::getConfig('add_only_logged', 'comments') || LOGGED) {
                if ($this->edited) {
                    $form = array('id' => $this->edited['comment_id'], 'author' => $this->edited['comment_author'], 'author_id' => $this->edited['comment_author_id'], 'message' => $this->edited['comment_message']);
                    if (!$form['author']) {
                        $form['author'] = User::getNickname(BY_ID, $this->edited['comment_author_id']);
                    }
                    $this->edit_mode = true;
                } else {
                    $form['author'] = User::$nickname;
                }
                $add = isset($_POST['add']) ? true : false;
                $edit = isset($_POST['edit']) ? true : false;
                // Add or delete
                if (isset($_POST['add']) || $edit) {
                    $form['author'] = isset($_POST['add']) && LOGGED ? User::$nickname : filter($_POST['author'], 100);
                    $form['message'] = filter($_POST['message'], Kio::getConfig('message_max', 'comments'));
                    $err->setError('author_empty', t('Author field is required.'))->condition(!$form['author']);
                    $err->setError('author_exists', t('Entered nickname is registered.'))->condition($add && !LOGGED && is_registered($form['author'], 'nickname'));
                    $err->setError('message_empty', t('Message field is required.'))->condition(!$form['message']);
                    // No errors
                    if ($err->noErrors()) {
                        // Add
                        if (isset($_POST['add'])) {
                            $sql->exec('
								INSERT INTO ' . DB_PREFIX . 'comments (
									comment_owner, comment_owner_child_id, comment_author,
									comment_author_id, comment_author_ip, comment_added,
									comment_message, comment_backlink)
								VALUES(
									"' . u0 . '",
									' . $this->connector_id . ',
									"' . (!LOGGED || isset($_POST['edit']) ? $form['author'] : '') . '",
									' . UID . ',
									"' . IP . '",
									' . TIMESTAMP . ',
									"' . $form['message'] . '",
									"' . $this->backlink . '")');
                            $last = $sql->lastInsertId();
                            $sql->exec('
								UPDATE ' . DB_PREFIX . $this->owner . '
								SET comments = (comments + 1)
								WHERE id = ' . $this->connector_id);
                            setcookie(COOKIE . '-comments', 'true', TIMESTAMP + Kio::getConfig('flood_interval', 'comments') + 1, '/');
                            redirect(HREF . PATH . '#comment-' . $last);
                        } else {
                            if (isset($_POST['edit'])) {
                                if ($form['author_id'] = User::getId(BY_NICKNAME, $form['author'])) {
                                    $form['author'] = '';
                                } else {
                                    $form['author_id'] = 0;
                                }
                                $sql->exec('
								UPDATE ' . DB_PREFIX . 'comments
								SET
									comment_author = "' . $form['author'] . '",
									comment_author_id = ' . $form['author_id'] . ',
									comment_message = "' . $form['message'] . '"
								WHERE comment_id = ' . $this->edited['comment_id']);
                                redirect(HREF . $this->edited['comment_backlink'] . '#comment-' . $this->edited['comment_id']);
                            }
                        }
                    } else {
                        $note->error($err->toArray());
                    }
                } else {
                    if (isset($_POST['delete_id']) && ctype_digit($_POST['delete_id'])) {
                        $sql->exec('
						DELETE FROM ' . DB_PREFIX . 'comments WHERE comment_id = ' . $_POST['delete_id'] . ';
						UPDATE ' . DB_PREFIX . $this->owner . ' SET comments = (comments - 1) WHERE id = ' . $this->connector_id);
                        redirect(strpos(REFERER, 'admin') ? REFERER : '#comments');
                    }
                }
                //$tpl->comments = $comments;
                $tpl->form = $form;
                $tpl->err = $err->toArray();
            } else {
                $note->error(sprintf('Dodawanie komentarzy jest możliwe tylko dla <a href="%1$slogin">zalogowanych</a> osób, <a href="%1$sregistration">zarejestruj się</a> jeśli nie masz jeszcze konta.', HREF));
            }
        } else {
            if ($this->total_comments != -1) {
                $note->error(array('Komentarze są widoczne tylko dla zalogowanych osób.', '<a href="' . HREF . 'registration">Zarejestruj się</a> jeśli nie masz jeszcze konta.'));
            }
        }
        $tpl->edit_mode = $this->edit_mode;
//.........这里部分代码省略.........
开发者ID:rafalenden,项目名称:KioCMS,代码行数:101,代码来源:comments.plugin.php

示例2: t

// modules/contact/admin/index.php
$kio->path['admin/modules/contact'] = t('Contact');
$note = new Notifier();
$err = new Error();
$save = $_POST['save'] ? true : false;
$blocks = Settings::getBlocks();
if ($save) {
    $form = $_POST['form'];
    $form['blocks'] = array_diff(array_keys($blocks), (array) $_POST['blocks']);
    $err->receivers_empty($lang2['ERROR_RECEIVERS_EMPTY'], !$form['receivers']);
    $err->receivers_invalid($lang2['ERROR_RECEIVERS_INVALID'], $form['receivers'] && !preg_match('#^\\d+(, *\\d)*$#', $form['receivers']));
    if (!$err->count()) {
        Settings::update('contact');
        Cache::clear('contact.txt');
        $info->positive(t('SAVED_SUCCESSFUL'));
        redirect(HREF . 'admin/modules/contact');
    } else {
        $note->error($err);
    }
} else {
    $form = $cfg->contact;
    $form['blocks'] = explode(', ', $cfg->contact['blocks']);
    $note->info(array($lang_admin['MODULE_SETTINGS'], $lang_system['REQUIRED']));
}
$tpl = new PHPTAL('modules/contact/admin/settings.html');
$tpl->note = $note;
$tpl->form = $form;
$tpl->err = $err;
$tpl->columns = Settings::formColumns();
$tpl->blocks = Settings::formBlocks();
echo $tpl->execute();
开发者ID:rafalenden,项目名称:KioCMS,代码行数:31,代码来源:index.php

示例3: getFolder

    private function getFolder($folder_id)
    {
        global $sql;
        Kio::addTitle(t(ucfirst(u1)));
        Kio::addBreadcrumb(t(ucfirst(u1)), 'pm/' . u1);
        $note = new Notifier();
        $this->subcodename = 'box';
        $pager = new Pager('pm/' . u1, User::${'pm' . ucfirst(u1)}, Kio::getConfig('limit', 'pm'));
        $pager->sort(array(t('Subject') => 'subject', t('Message') => 'message', u1 == 'outbox' ? t('To') : t('From') => 'nickname', t('Sent') => 'sent'), 'sent', 'asc');
        // Reset new messages counter
        if (User::$pmNew) {
            $sql->exec('UPDATE ' . DB_PREFIX . 'users SET pm_new = 0 WHERE id = ' . UID);
        }
        if (isset($_POST['action']) && !empty($_POST['messages'])) {
            $action_messages = implode(', ', array_map('intval', $_POST['messages']));
            switch ($_POST['action']) {
                // Mark messages as read
                case 'read':
                    $sql->exec('
						UPDATE ' . DB_PREFIX . 'pm
						SET is_read = 1
						WHERE id IN(' . $action_messages . ')
							AND folder = ' . $folder_id . '
							AND owner_id = ' . UID);
                    break;
                    // Mark messages as unread
                // Mark messages as unread
                case 'unread':
                    $sql->exec('
						UPDATE ' . DB_PREFIX . 'pm
						SET is_read = 0
						WHERE id IN(' . $action_messages . ')
							AND folder = ' . $folder_id . '
							AND owner_id = ' . UID);
                    break;
                    // Delete messages
                // Delete messages
                case 'delete':
                    $sql->exec('
						DELETE FROM ' . DB_PREFIX . 'pm
						WHERE id IN(' . $action_messages . ')
							AND folder = ' . $folder_id . '
							AND owner_id = ' . UID);
            }
            redirect(HREF . PATH);
        }
        $stmt = $sql->query('
			SELECT pm.*, u.nickname, u.group_id
			FROM ' . DB_PREFIX . 'pm pm
			LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = pm.connector_id
			WHERE pm.owner_id = ' . UID . ' AND pm.folder = ' . $folder_id . '
			ORDER BY ' . $pager->orderBy . '
			LIMIT ' . $pager->limit . '
			OFFSET ' . $pager->offset);
        if ($stmt->rowCount()) {
            $messages = array();
            while ($row = $stmt->fetch()) {
                if ($row['connector_id']) {
                    $row['nickname'] = User::format($row['connector_id'], $row['nickname'], $row['group_id']);
                }
                $messages[] = $row;
            }
            try {
                $tpl = new PHPTAL('modules/pm/pm.tpl.html');
                $tpl->messages = $messages;
                $tpl->sort = $pager->sorters;
                $tpl->total = User::${'pm' . ucfirst(u1)};
                $tpl->max = Kio::getConfig(u1 . '_max', 'pm');
                $tpl->note = $note;
                $tpl->pager = $pager;
                $tpl->pagination = $pager->getLinks();
                return $tpl->execute();
            } catch (Exception $e) {
                return template_error($e);
            }
        } else {
            return $note->info(t('There is no messages in the box.'));
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:79,代码来源:pm.module.php


注:本文中的Notifier::info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。