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


PHP no_perms_error函数代码示例

本文整理汇总了PHP中no_perms_error函数的典型用法代码示例。如果您正苦于以下问题:PHP no_perms_error函数的具体用法?PHP no_perms_error怎么用?PHP no_perms_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         exit('In the 7.1 release.');
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:9,代码来源:announcements.class.php

示例2: execute

 function execute(&$request)
 {
     k4_bread_crumbs($request['template'], $request['dba'], 'L_SEARCH');
     $request['template']->setFile('content', 'search.html');
     if (get_map('advsearch', 'can_view', array()) > $request['user']->get('perms')) {
         no_perms_error($request);
         return TRUE;
     }
     unset($_SESSION['search']['search_queries']);
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:11,代码来源:search.php

示例3: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= ADMIN) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_WELCOME');
         $request['template']->setVar('adv_view', 1);
         $request['template']->setFile('content', 'admin_menu.html');
     } else {
         no_perms_error($request);
         return TRUE;
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:12,代码来源:admin.php

示例4: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         global $_QUERYPARAMS, $_ALLFORUMS;
         k4_bread_crumbs($request['template'], $request['dba'], 'L_POSTS');
         $request['template']->setVar('posts_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/posts.html');
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:12,代码来源:posts.class.php

示例5: execute

 function execute(&$request)
 {
     if (!$request['user']->isMember()) {
         no_perms_error($request);
         return TRUE;
     }
     if (!isset($_REQUEST['id']) || intval($_REQUEST['id']) == 0) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $action = new K4InformationAction(new K4LanguageElement('L_POLLDOESNTEXIST'), 'content', TRUE);
         return $action->execute($request);
     }
     if (!isset($_POST['vote']) || intval($_POST['vote']) <= 0) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $action = new K4InformationAction(new K4LanguageElement('L_CHOOSEPOLLOPTION'), 'content', TRUE);
         return $action->execute($request);
     }
     $question = $request['dba']->getRow("SELECT * FROM " . K4POLLQUESTIONS . " WHERE id = " . intval($_REQUEST['id']));
     if (!is_array($question) || empty($question)) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $action = new K4InformationAction(new K4LanguageElement('L_POLLDOESNTEXIST'), 'content', TRUE);
         return $action->execute($request);
     }
     $answer = $request['dba']->getRow("SELECT * FROM " . K4POLLANSWERS . " WHERE id = " . intval($_POST['vote']));
     if (!is_array($answer) || empty($answer)) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $action = new K4InformationAction(new K4LanguageElement('L_POLLOPTIONDOESNTEXIST'), 'content', TRUE);
         return $action->execute($request);
     }
     $has_voted = $request['dba']->executeQuery("SELECT * FROM " . K4POLLVOTES . " WHERE question_id = " . intval($question['id']) . " AND user_id = " . intval($request['user']->get('id')));
     if ($has_voted->numRows() > 0) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $action = new K4InformationAction(new K4LanguageElement('L_USERHASVOTED'), 'content', TRUE);
         return $action->execute($request);
     }
     $insert = $request['dba']->prepareStatement("INSERT INTO " . K4POLLVOTES . " (question_id, answer_id, user_id, user_name, voted_time) VALUES (?,?,?,?,?)");
     $insert->setInt(1, $question['id']);
     $insert->setInt(2, $answer['id']);
     $insert->setInt(3, $request['user']->get('id'));
     $insert->setString(4, $request['user']->get('name'));
     $insert->setInt(5, time());
     $insert->executeUpdate();
     $request['dba']->executeUpdate("UPDATE " . K4POLLQUESTIONS . " SET num_votes=num_votes+1 WHERE id = " . intval($question['id']));
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     $action = new K4InformationAction(new K4LanguageElement('L_VOTEDONPOLL', $answer['answer'], $question['question']), 'content', TRUE, referer() . '#poll' . $question['id'], 3);
     return $action->execute($request);
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:47,代码来源:viewpoll.php

示例6: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS;
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     if (!isset($_REQUEST['id']) || intval($_REQUEST['id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_BAD' . strtoupper($this->table_column)), 'content', FALSE);
         return $action->execute($request);
     }
     $avatar = $request['dba']->getRow("SELECT * FROM " . $this->table . " WHERE user_id = " . intval($_REQUEST['id']));
     if (!is_array($avatar) || empty($avatar)) {
         $action = new K4InformationAction(new K4LanguageElement('L_BAD' . strtoupper($this->table_column)), 'content', FALSE);
         return $action->execute($request);
     }
     $user = $request['dba']->getRow("SELECT {$_QUERYPARAMS['user']}{$_QUERYPARAMS['userinfo']}{$_QUERYPARAMS['usersettings']} FROM ((" . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id) LEFT JOIN " . K4USERSETTINGS . " us ON us.user_id=u.id) WHERE u.id=" . intval($_REQUEST['id']));
     if (!is_array($user) || empty($user)) {
         $action = new K4InformationAction(new K4LanguageElement('L_USERDOESNTEXIST'), 'content', TRUE);
         return $action->execute($request);
     }
     /* Do we have permission to view attachments in this forum? */
     if (isset($user['attach' . $this->table_column]) && $user['attach' . $this->table_column] == 0) {
         no_perms_error($request);
         return TRUE;
     }
     // send our headers
     header("Content-Type: " . $avatar['mime_type']);
     header("Content-Length: " . $avatar['file_size']);
     $avatar_file = BB_BASE_DIR . '/tmp/upload/' . $this->table_column . 's/' . intval($user['id']) . '.' . $avatar['file_type'];
     if ($avatar['in_db'] == 1) {
         $contents = $avatar['file_contents'];
     } else {
         if (file_exists($avatar_file)) {
             $contents = file_get_contents($avatar_file);
         } else {
             $action = new K4InformationAction(new K4LanguageElement('L_BAD' . strtoupper($this->table_column)), 'content', FALSE);
             return $action->execute($request);
         }
     }
     echo $contents;
     unset($contents);
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:42,代码来源:viewfile.php

示例7: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS;
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     if (!isset($_REQUEST['id']) || intval($_REQUEST['id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_BADATTACHMENT'), 'content', FALSE);
         return $action->execute($request);
     }
     $attachment = $request['dba']->getRow("SELECT * FROM " . K4ATTACHMENTS . " WHERE id = " . intval($_REQUEST['id']));
     if (!is_array($attachment) || empty($attachment)) {
         $action = new K4InformationAction(new K4LanguageElement('L_BADATTACHMENT'), 'content', FALSE);
         return $action->execute($request);
     }
     if (isset($_REQUEST['post_id']) && intval($_REQUEST['post_id']) != 0) {
         $post = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['post_id']));
     } else {
         //$action = new K4InformationAction(new K4LanguageElement('L_POSTDOESNTEXIST'), 'content', FALSE);
         //return $action->execute($request);
         $post = array('post_id' => 0, 'forum_id' => $attachment['forum_id'], 'row_type' => 0);
     }
     if (!is_array($post) || empty($post)) {
         $action = new K4InformationAction(new K4LanguageElement('L_POSTDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     /* Get the current forum */
     $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($post['forum_id']));
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     /* Do we have permission to delete attachments in this forum? */
     if ($request['user']->get('perms') < get_map('attachments', 'can_del', array('forum_id' => $forum['forum_id']))) {
         no_perms_error($request);
         return TRUE;
     }
     if ($request['user']->get('id') != 0 && $request['user']->get('id') == $attachment['user_id'] || is_moderator($request['user']->getInfoArray(), $forum)) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_REMOVEATTACHMENT');
         $request['dba']->executeUpdate("DELETE FROM " . K4ATTACHMENTS . " WHERE id = " . intval($attachment['id']));
         if ($post['post_id'] > 0) {
             $request['dba']->executeUpdate("UPDATE " . K4POSTS . " SET total_attachments=total_attachments-1, attachments=attachments-1 WHERE post_id=" . intval($post['row_type'] & REPLY ? $post['parent_id'] : $post['post_id']));
             if ($post['row_type'] & REPLY) {
                 $request['dba']->executeUpdate("UPDATE " . K4POSTS . " SET attachments=attachments-1 WHERE post_id=" . intval($post['post_id']));
             }
         }
         $referer = basename(referer());
         if (strpos($referer, 'misc.php') === FALSE) {
             $action = new K4InformationAction(new K4LanguageElement('L_REMOVEDATTACHMENT', k4_htmlentities($attachment['file_name'], ENT_QUOTES)), 'content', TRUE, referer(), 3);
             return $action->execute($request);
         } else {
             header("Location: misc.php?act=attachments_manager&post_id=" . $post['post_id'] . "&forum_id=" . $post['forum_id'] . "");
             exit;
         }
     } else {
         no_perms_error($request);
         return TRUE;
     }
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:58,代码来源:attachments.class.php

示例8: execute


//.........这里部分代码省略.........
         if (get_map('topics', 'can_view', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) {
             $action = new K4InformationAction(new K4LanguageElement('L_CANTVIEWFORUMTOPICS'), 'content_extra', FALSE);
             return $action->execute($request);
         }
         k4_bread_crumbs($request['template'], $request['dba'], NULL, $forum);
         /**
          * Pagination
          */
         //$extra_topics		= intval(@$_ALLFORUMS[GLBL_ANNOUNCEMENTS]['topics']);
         $extra_topics = 0;
         // TODO: need only Announcements from global announcements
         /* Create the Pagination */
         $resultsperpage = $request['user']->get('topicsperpage') <= 0 ? $forum['topicsperpage'] : $request['user']->get('topicsperpage');
         $num_results = $forum['topics'] + $extra_topics;
         $perpage = isset($_REQUEST['limit']) && ctype_digit($_REQUEST['limit']) && intval($_REQUEST['limit']) > 0 ? intval($_REQUEST['limit']) : $resultsperpage;
         $perpage = $perpage > 100 ? 100 : $perpage;
         $page = isset($_REQUEST['page']) && ctype_digit($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
         /* Get the topics for this forum */
         $daysprune = $_daysprune = isset($_REQUEST['daysprune']) && ctype_digit($_REQUEST['daysprune']) ? $_REQUEST['daysprune'] == 0 ? 0 : intval($_REQUEST['daysprune']) : 365;
         $daysprune = $daysprune > 0 ? time() - @($daysprune * 86400) : 0;
         $sortorder = isset($_REQUEST['order']) && ($_REQUEST['order'] == 'ASC' || $_REQUEST['order'] == 'DESC') ? $_REQUEST['order'] : 'DESC';
         $sortedby = isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sort_orders) ? $_REQUEST['sort'] : 'lastpost_created';
         $start = ($page - 1) * $perpage;
         if ($page == 1) {
             $announcements = $request['dba']->executeQuery("SELECT * FROM " . K4POSTS . " WHERE row_type=" . TOPIC . " AND (is_draft=0 AND display=1) AND post_type = " . TOPIC_ANNOUNCE . " AND (forum_id = " . intval($forum['forum_id']) . " OR forum_id = " . GLBL_ANNOUNCEMENTS . ") ORDER BY lastpost_created DESC");
         }
         $importants = $request['dba']->executeQuery("SELECT * FROM " . K4POSTS . " WHERE row_type=" . TOPIC . " AND is_draft=0 AND display = 1 AND forum_id = " . intval($forum['forum_id']) . " AND (post_type <> " . TOPIC_ANNOUNCE . ") AND (post_type = " . TOPIC_STICKY . " OR is_feature = 1) ORDER BY lastpost_created DESC");
         /* get the topics */
         $result = $request['dba']->prepareStatement("SELECT * FROM " . K4POSTS . " WHERE row_type=" . TOPIC . " AND created>=? AND is_draft=0 AND display = 1 AND forum_id = " . intval($forum['forum_id']) . " AND (post_type <> " . TOPIC_ANNOUNCE . " AND post_type <> " . TOPIC_STICKY . " AND is_feature = 0) ORDER BY {$sortedby} {$sortorder} LIMIT ?,?");
         /* Set the query values */
         $result->setInt(1, $daysprune);
         $result->setInt(2, $start);
         $result->setInt(3, $perpage);
         /* Execute the query */
         $topics = $result->executeQuery();
         if (isset($announcements)) {
             $it = new FAChainedIterator($announcements);
             $it->addIterator($importants);
         } else {
             $it = new FAChainedIterator($importants);
         }
         $it->addIterator($topics);
         $request['template']->setList('topics', new RSSPostIterator($it));
         $request['template']->setVarArray($forum);
         $xml = $request['template']->render(BB_BASE_DIR . '/templates/RSS/rss-' . $rss_version . '/forum.xml');
         header("Content-Type: text/xml");
         echo $xml;
         exit;
         /**
          * Topic
          */
     } else {
         if (isset($_REQUEST['t']) && intval($_REQUEST['t']) > 0) {
             $result = $request['dba']->executeQuery("SELECT * FROM " . K4POSTS . " WHERE post_id=" . intval($_REQUEST['t']) . " LIMIT 1");
             $topic = $result->next();
             $result->reset();
             // reset the pointer of the iterator
             if (!is_array($topic) || empty($topic)) {
                 $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE);
                 return $action->execute($request);
             }
             if (get_map('topics', 'can_view', array('forum_id' => $topic['forum_id'])) > $request['user']->get('perms')) {
                 $action = new K4InformationAction(new K4LanguageElement('L_CANTVIEWFORUMTOPICS'), 'content_extra', FALSE);
                 return $action->execute($request);
             }
             $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($topic['forum_id']));
             if (!is_array($forum) || empty($forum)) {
                 $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
                 return $action->execute($request);
             }
             $it = new FAChainedIterator($result);
             if (get_map('replies', 'can_view', array('forum_id' => $topic['forum_id'])) <= $request['user']->get('perms')) {
                 if ($topic['num_replies'] > 0) {
                     $resultsperpage = $request['user']->get('postsperpage') <= 0 ? $forum['postsperpage'] : $request['user']->get('postsperpage');
                     $num_results = $topic['num_replies'];
                     $perpage = isset($_REQUEST['limit']) && ctype_digit($_REQUEST['limit']) && intval($_REQUEST['limit']) > 0 ? intval($_REQUEST['limit']) : $resultsperpage;
                     $num_pages = @ceil($num_results / $perpage);
                     $page = isset($_REQUEST['page']) && ctype_digit($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
                     $daysprune = isset($_REQUEST['daysprune']) && ctype_digit($_REQUEST['daysprune']) ? iif($_REQUEST['daysprune'] == -1, 0, intval($_REQUEST['daysprune'])) : 0;
                     $sortorder = isset($_REQUEST['order']) && ($_REQUEST['order'] == 'ASC' || $_REQUEST['order'] == 'DESC') ? $_REQUEST['order'] : 'ASC';
                     $sortedby = isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sort_orders) ? $_REQUEST['sort'] : 'created';
                     $start = ($page - 1) * $perpage;
                     $replies = $request['dba']->executeQuery("SELECT * FROM " . K4POSTS . " WHERE parent_id=" . intval($topic['post_id']) . " AND row_level>1 AND created>=" . 3600 * 24 * intval($daysprune) . " ORDER BY " . $sortedby . " " . $sortorder . " LIMIT " . intval($start) . "," . intval($perpage));
                     $it->addIterator($replies);
                 }
             }
             $request['template']->setList('posts', new RSSPostIterator($it));
             $xml = $request['template']->render(BB_BASE_DIR . '/templates/RSS/rss-' . $rss_version . '/topic.xml');
             header("Content-Type: text/xml");
             echo $xml;
             exit;
             /**
              * Error
              */
         } else {
             no_perms_error($request);
         }
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:101,代码来源:rss.php

示例9: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         global $_FILTERS;
         k4_bread_crumbs($request['template'], $request['dba'], 'L_EDITFORUMFILTERS');
         $request['template']->setVar('forums_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/forums.html');
         $request['template']->setFile('content', 'filters_selectforum.html');
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:13,代码来源:filters.class.php

示例10: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS, $_DATASTORE, $_SETTINGS;
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     /* Check the request ID */
     if (!isset($_REQUEST['id']) || !$_REQUEST['id'] || intval($_REQUEST['id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_TOPICDOESNTEXIST');
     }
     /* Get our topic */
     $topic = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['id']));
     if (!$topic || !is_array($topic) || empty($topic)) {
         $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_TOPICDOESNTEXIST');
     }
     $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($topic['forum_id']));
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message('L_FORUMDOESNTEXIST');
     }
     if (!isset($_REQUEST['name']) || $_REQUEST['name'] == '') {
         $name = $topic['name'];
     } else {
         $name = strip_tags($_REQUEST['name']);
     }
     $name = $name == '' ? $topic['name'] : $name;
     if (strlen($name) < intval($_SETTINGS['topicminchars']) || strlen($name) > intval($_SETTINGS['topicmaxchars'])) {
         $action = new K4InformationAction(new K4LanguageElement('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])), 'content', TRUE);
         return !USE_XMLHTTP ? $action->execute($request) : xmlhttp_message(sprintf('L_TITLETOOSHORT', intval($_SETTINGS['topicminchars']), intval($_SETTINGS['topicmaxchars'])));
     }
     if ($name != $topic['name']) {
         $name = k4_htmlentities($name, ENT_QUOTES);
         if (!is_moderator($request['user']->getInfoArray(), $forum)) {
             no_perms_error($request);
             return !USE_XMLHTTP ? TRUE : xmlhttp_message('L_NEEDPERMS');
         }
         if ($topic['poster_id'] == $request['user']->get('id')) {
             if ($request['user']->get('perms') < get_map('topics', 'can_edit', array('forum_id' => $topic['forum_id']))) {
                 no_perms_error($request);
                 return !USE_XMLHTTP ? TRUE : xmlhttp_message('L_NEEDPERMS');
             }
         } else {
             if ($request['user']->get('perms') < get_map('other_topics', 'can_edit', array('forum_id' => $topic['forum_id']))) {
                 no_perms_error($request);
                 return !USE_XMLHTTP ? TRUE : xmlhttp_message('L_NEEDPERMS');
             }
         }
         /* If this topic is a redirect/ connects to one, update the original */
         if ($topic['moved_new_post_id'] > 0 || $topic['moved_old_post_id'] > 0) {
             $redirect = $request['dba']->prepareStatement("UPDATE " . K4POSTS . " SET name=?,edited_time=?,edited_username=?,edited_userid=? WHERE post_id=?");
             $redirect->setString(1, $name);
             $redirect->setInt(2, time());
             $redirect->setString(3, $request['user']->get('name'));
             $redirect->setInt(4, $request['user']->get('id'));
             $redirect->setInt(5, $topic['moved_new_post_id'] > 0 ? $topic['moved_new_post_id'] : $topic['moved_old_post_id']);
             $redirect->executeUpdate();
         }
         $update_a = $request['dba']->prepareStatement("UPDATE " . K4POSTS . " SET name=?,edited_time=?,edited_username=?,edited_userid=? WHERE post_id=?");
         $update_a->setString(1, $name);
         $update_a->setInt(2, time());
         $update_a->setString(3, $request['user']->get('name'));
         $update_a->setInt(4, $request['user']->get('id'));
         $update_a->setInt(5, $topic['post_id']);
         $update_a->executeUpdate();
         if ($forum['post_id'] == $topic['post_id']) {
             $update_c = $request['dba']->prepareStatement("UPDATE " . K4FORUMS . " SET post_name=? WHERE forum_id=?");
             $update_c->setString(1, $name);
             $update_c->setInt(2, $forum['forum_id']);
             $update_c->executeUpdate();
         }
         // id this is the last post in a forum
         if ($forum['post_id'] == $topic['post_id'] && $forum['post_created'] == $topic['created']) {
             $update_d = $request['dba']->prepareStatement("UPDATE " . K4FORUMS . " SET post_name=? WHERE forum_id=?");
             $update_d->setString(1, $name);
             $update_d->setInt(2, $forum['forum_id']);
             $update_d->executeUpdate();
         }
     }
     if (!USE_XMLHTTP) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_EDITTOPIC', $forum);
         $action = new K4InformationAction(new K4LanguageElement('L_UPDATEDTOPIC', $topic['name']), 'content', FALSE, referer(), 3);
         return $action->execute($request);
     } else {
         xmlhttp_header();
         echo '<a href="viewtopic.php?id=' . $topic['post_id'] . '" title="' . $name . '" style="font-size: 13px;">' . (strlen($name) > 40 ? substr($name, 0, 40) . '...' : $name) . '</a>';
         xmlhttp_footer();
     }
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:89,代码来源:moderator.class.php

示例11: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         global $_DATASTORE;
         k4_bread_crumbs($request['template'], $request['dba'], 'L_EMAILUSERS');
         $request['template']->setVar('misc_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/misc.html');
         if (isset($_DATASTORE['massmail'])) {
             $action = new K4InformationAction(new K4LanguageElement('L_EMAILINPROGRESS'), 'content', FALSE);
             return $action->execute($request);
         }
         if (!isset($_REQUEST['subject']) || $_REQUEST['subject'] == '') {
             $action = new K4InformationAction(new K4LanguageElement('L_INSERTMAILSUBJECT'), 'content', TRUE);
             return $action->execute($request);
         }
         if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') {
             $action = new K4InformationAction(new K4LanguageElement('L_INSERTMAILMESSAGE'), 'content', TRUE);
             return $action->execute($request);
         }
         $from = isset($_REQUEST['from']) && $_REQUEST['from'] != '' ? $_REQUEST['from'] : 'noreply';
         $subject = $_REQUEST['subject'];
         $message = preg_replace("~(\r\n|\r|\n)~i", "\n", $_REQUEST['message']);
         // set where to start the userids to email in the datastore
         $update = $request['dba']->prepareStatement("INSERT INTO " . K4DATASTORE . " (varname, data) VALUES (?,?)");
         $update->setString(1, 'massmail');
         $update->setString(2, serialize(array('startid' => 0, 'from' => $from, 'subject' => $subject, 'message' => $message)));
         $update->executeUpdate();
         reset_cache('email_queue');
         // success
         $action = new K4InformationAction(new K4LanguageElement('L_EMAILSSENTTOUSERS'), 'content', FALSE);
         return $action->execute($request);
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:36,代码来源:email.class.php

示例12: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         global $_QUERYPARAMS;
         if (!isset($_REQUEST['id']) || intval($_REQUEST['id']) == 0) {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDCATEGORY'), 'content', FALSE);
             return $action->execute($request);
         }
         $category = $request['dba']->getRow("SELECT * FROM " . K4CATEGORIES . " WHERE category_id = " . intval($_REQUEST['id']));
         if (!is_array($category) || empty($category)) {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDCATEGORY'), 'content', FALSE);
             return $action->execute($request);
         }
         foreach ($category as $key => $val) {
             $request['template']->setVar('category_' . $key, $val);
         }
         $category_map = $request['dba']->getRow("SELECT * FROM " . K4MAPS . " WHERE varname = 'category" . $category['category_id'] . "' AND category_id = " . intval($category['category_id']));
         $category_maps = $request['dba']->executeQuery("SELECT * FROM " . K4MAPS . " WHERE category_id = " . intval($category['category_id']) . " AND forum_id = 0");
         while ($category_maps->next()) {
             $c = $category_maps->current();
             if (isset($_REQUEST[$c['varname'] . '_can_view']) && isset($_REQUEST[$c['varname'] . '_can_add']) && isset($_REQUEST[$c['varname'] . '_can_edit']) && isset($_REQUEST[$c['varname'] . '_can_del'])) {
                 if ($_REQUEST[$c['varname'] . '_can_view'] != $c['can_view'] || $_REQUEST[$c['varname'] . '_can_add'] != $c['can_add'] || $_REQUEST[$c['varname'] . '_can_edit'] != $c['can_edit'] || $_REQUEST[$c['varname'] . '_can_del'] != $c['can_del']) {
                     $update = $request['dba']->prepareStatement("UPDATE " . K4MAPS . " SET can_view=?,can_add=?,can_edit=?,can_del=? WHERE varname=? AND category_id=?");
                     $update->setInt(1, $_REQUEST[$c['varname'] . '_can_view']);
                     $update->setInt(2, $_REQUEST[$c['varname'] . '_can_add']);
                     $update->setInt(3, $_REQUEST[$c['varname'] . '_can_edit']);
                     $update->setInt(4, $_REQUEST[$c['varname'] . '_can_del']);
                     $update->setString(5, $c['varname']);
                     $update->setInt(6, $category['category_id']);
                     $update->executeUpdate();
                     unset($update);
                 }
             }
         }
         reset_cache('all_forums');
         k4_bread_crumbs($request['template'], $request['dba'], 'L_CATEGORIES');
         $request['template']->setVar('forums_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/forums.html');
         $action = new K4InformationAction(new K4LanguageElement('L_UPDATEDCATEGORYPERMS', $category['name']), 'content', FALSE, 'admin.php?act=categories', 3);
         return $action->execute($request);
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:45,代码来源:categories.class.php

示例13: execute

 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= ADMIN) {
         $fields = $request['dba']->executeQuery("SELECT * FROM " . K4PROFILEFIELDS . " ORDER BY name ASC");
         while ($fields->next()) {
             $field = $fields->current();
             if (isset($_REQUEST['display_order_' . $field['name']]) && intval($_REQUEST['display_order_' . $field['name']]) >= 0) {
                 $update = $request['dba']->prepareStatement("UPDATE " . K4PROFILEFIELDS . " SET display_order=? WHERE name=?");
                 $update->setInt(1, $_REQUEST['display_order_' . $field['name']]);
                 $update->setString(2, $field['name']);
                 $update->executeUpdate();
                 unset($update);
             }
         }
         k4_bread_crumbs($request['template'], $request['dba'], 'L_USERPROFILEFIELDS');
         $request['template']->setVar('users_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/users.html');
         $action = new K4InformationAction(new K4LanguageElement('L_UPDATEDPROFILEFIELDS'), 'content', FALSE, 'admin.php?act=userfields', 3);
         return $action->execute($request);
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:24,代码来源:profilefields.class.php

示例14: execute

 function execute(&$request)
 {
     global $_QUERYPARAMS, $_USERGROUPS, $_URL;
     /* set the breadcrumbs bit */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
     /**
      * Error Checking
      */
     if (!isset($_REQUEST['post_id']) || intval($_REQUEST['post_id']) == 0) {
         $action = new K4InformationAction(new K4LanguageElement('L_TOPICDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     /* Get our topic */
     $post = $request['dba']->getRow("SELECT * FROM " . K4POSTS . " WHERE post_id = " . intval($_REQUEST['post_id']));
     if (!$post || !is_array($post) || empty($post)) {
         $action = new K4InformationAction(new K4LanguageElement('L_POSTDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     /* Should we redirect this user? */
     if ($post['moved_new_post_id'] > 0) {
         header("Location: viewpost.php?post_id=" . intval($post['moved_new_post_id']));
     }
     /* Get the current forum */
     $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($post['forum_id']));
     if (!$forum || !is_array($forum) || empty($forum)) {
         $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE);
         return $action->execute($request);
     }
     /**
      * This sets the last time that we've seen this forum
      */
     $cookieinfo = get_forum_cookies();
     $cookieinfo[$forum['forum_id']] = time();
     $cookiestr = '';
     foreach ($cookieinfo as $key => $val) {
         $cookiestr .= ',' . $key . ',' . intval($val);
     }
     $domain = get_domain();
     setcookie(K4FORUMINFO, trim($cookiestr, ','), time() + 2592000, $domain);
     unset($cookieinfo, $cookiestr);
     $cookieinfo = get_topic_cookies();
     /**
      * Set the new breadcrumbs bit
      */
     k4_bread_crumbs($request['template'], $request['dba'], $post['name'], $forum);
     /**
      * Now tell the cookies that we've read this topic
      */
     $cookieinfo[$post['post_id']] = time();
     $cookiestr = '';
     foreach ($cookieinfo as $key => $val) {
         // make sure to weed out 30-day old topic views
         if ((time() - intval($val)) / 30 <= 2592000) {
             $cookiestr .= ',' . $key . ',' . intval($val);
         }
     }
     setcookie(K4TOPICINFO, trim($cookiestr, ','), time() + 2592000, $domain);
     unset($cookieinfo, $cookiestr);
     /**
      * More error checking
      */
     if ($post['is_draft'] == 1 || $post['display'] == 0 || $post['queue'] == 1 && !$moderator) {
         no_perms_error($request);
         return TRUE;
     }
     if (get_map('forums', 'can_view', array()) > $request['user']->get('perms') || get_map($post['row_type'] & TOPIC ? 'topics' : 'replies', 'can_view', array('forum_id' => $forum['forum_id'])) > $request['user']->get('perms')) {
         $action = new K4InformationAction(new K4LanguageElement('L_PERMCANTVIEWTOPIC'), 'content', FALSE);
         return $action->execute($request);
     }
     /**
      * Is this topic expired?
      */
     $extra = '';
     if ($post['post_type'] > TOPIC_NORMAL && $post['post_expire'] > 0) {
         if ($post['created'] + 3600 * 24 * $post['post_expire'] > time()) {
             $extra = ",post_expire=0,post_type=" . TOPIC_NORMAL;
         }
     }
     /* Add the topic info to the template */
     foreach ($post as $key => $val) {
         $request['template']->setVar('post_' . $key, $val);
     }
     /* Add the forum info to the template */
     foreach ($forum as $key => $val) {
         $request['template']->setVar('forum_' . $key, $val);
     }
     /* Update the number of views for this topic */
     $request['dba']->executeUpdate("UPDATE " . K4POSTS . " SET views=views+1 {$extra} WHERE post_id=" . intval($post['post_id']));
     /* set the topic iterator */
     if ($post['row_type'] & TOPIC) {
         $request['template']->setVar('next_oldest', intval($request['dba']->getValue("SELECT post_id FROM " . K4POSTS . " WHERE post_id < " . $post['post_id'] . " LIMIT 1")));
         $request['template']->setVar('next_newest', intval($request['dba']->getValue("SELECT post_id FROM " . K4POSTS . " WHERE post_id > " . $post['post_id'] . " LIMIT 1")));
         /**
          * Topic subscription stuff
          */
         if ($request['user']->isMember()) {
             $subscribed = $request['dba']->executeQuery("SELECT * FROM " . K4SUBSCRIPTIONS . " WHERE post_id = " . intval($post['post_id']) . " AND user_id = " . $request['user']->get('id'));
             $request['template']->setVar('is_subscribed', iif($subscribed->numRows() > 0, 1, 0));
         }
     }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:101,代码来源:viewpost.php

示例15: execute

 function execute(&$request)
 {
     global $_SETTINGS;
     if ($request['user']->get('perms') < get_map('warnuser', 'can_add', array())) {
         no_perms_error($request);
         return TRUE;
     }
     if (isset($_REQUEST['id'])) {
         $user = $request['dba']->getRow("SELECT * FROM " . K4USERS . " WHERE id = " . intval($_REQUEST['id']));
         k4_bread_crumbs($request['template'], $request['dba'], 'L_WARNUSER');
         if (!isset($_REQUEST['warning']) || $_REQUEST['warning'] == '') {
             $action = new K4InformationAction(new K4LanguageElement('L_PASTPAGELIMIT'), 'content', FALSE, 'mod.php?act=findusers&username=' . $username . '&limit=' . $perpage . '&page=' . $num_pages, 3);
             return $action->execute($request);
         }
         if (!is_array($user) || empty($user)) {
             k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
             $action = new K4InformationAction(new K4LanguageElement('L_INSERTWARNING'), 'content', TRUE);
             return $action->execute($request);
         }
         $request['dba']->executeUpdate("UPDATE " . K4USERS . " SET warn_level=warn_level+1 WHERE id = " . intval($user['id']));
         email_user($user['email'], $request['template']->getVar('L_WARNING'), $_REQUEST['warning']);
         $action = new K4InformationAction(new K4LanguageElement('L_SENTWARNING', $user['name']), 'content', TRUE, 'index.php', 3);
         return $action->execute($request);
     } else {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_WARNUSER');
         $request['template']->setFile('content', 'finduser.html');
     }
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:28,代码来源:modusers.class.php


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