From e1bcd1b8f50a748af3a0e0d8d4df2890ca2aa6cd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 30 Jul 2015 09:30:36 -0400 Subject: [PATCH 01/25] Code updates/clean-up --- newbb/action.post.php | 108 +-- newbb/action.topic.php | 66 +- newbb/admin/about.php | 134 +-- newbb/admin/admin_blocks.php | 8 +- newbb/admin/admin_cat_manager.php | 96 +- newbb/admin/admin_digest.php | 32 +- newbb/admin/admin_forum_manager.php | 144 +-- newbb/admin/admin_forum_prune.php | 62 +- newbb/admin/admin_forum_reorder.php | 87 +- newbb/admin/admin_groupmod.php | 37 +- newbb/admin/admin_header.php | 6 +- newbb/admin/admin_permissions.php | 154 +-- newbb/admin/admin_report.php | 82 +- newbb/admin/admin_synchronization.php | 18 +- newbb/admin/admin_type_manager.php | 320 +++--- newbb/admin/admin_votedata.php | 16 +- newbb/admin/index.php | 156 +-- newbb/admin/menu.php | 8 +- newbb/assets/images/category/cbb.png | Bin 1011 -> 0 bytes newbb/assets/images/category/newbb.png | Bin 0 -> 1650 bytes newbb/assets/images/category/xoops-cn.png | Bin 587 -> 0 bytes newbb/assets/images/cbb.png | Bin 1011 -> 0 bytes newbb/assets/images/newbb.png | Bin 0 -> 1650 bytes newbb/blocks/list_topic.php | 20 +- newbb/blocks/newbb_block.php | 32 +- newbb/blocks/newbb_block_tag.php | 4 +- newbb/class/category.php | 10 +- newbb/class/digest.php | 20 +- newbb/class/forum.php | 268 ++--- newbb/class/icon.php | 6 +- newbb/class/karma.php | 6 +- newbb/class/moderate.php | 22 +- newbb/class/newbbtree.php | 6 +- newbb/class/online.php | 20 +- newbb/class/permission.category.php | 8 +- newbb/class/permission.forum.php | 20 +- newbb/class/permission.php | 21 +- newbb/class/plugin/userlog.php | 12 +- newbb/class/plugins/plugin.tag.php | 8 +- newbb/class/post.php | 32 +- newbb/class/rate.php | 14 +- newbb/class/read.php | 30 +- newbb/class/readforum.php | 14 +- newbb/class/readtopic.php | 18 +- newbb/class/report.php | 16 +- newbb/class/stats.php | 26 +- newbb/class/text.php | 14 +- newbb/class/topic.php | 38 +- newbb/class/topic.renderer.php | 64 +- newbb/class/tree.php | 6 +- newbb/class/type.php | 16 +- newbb/class/uploader.php | 16 +- newbb/class/user.php | 20 +- newbb/class/userstats.php | 16 +- newbb/class/xmlrss.php | 12 +- newbb/delete.php | 26 +- newbb/digest.php | 10 +- newbb/dl_attachment.php | 42 +- newbb/docs/changelog.txt | 2 + newbb/edit.php | 42 +- newbb/footer.php | 8 +- newbb/header.php | 44 +- newbb/include/display.php | 24 +- newbb/include/form.forum.php | 4 +- newbb/include/form.post.php | 12 +- newbb/include/functions.config.php | 12 +- newbb/include/functions.forum.php | 78 +- newbb/include/functions.image.php | 18 +- newbb/include/functions.ini.php | 10 +- newbb/include/functions.language.php | 4 +- newbb/include/functions.php | 4 +- newbb/include/functions.read.php | 4 +- newbb/include/functions.recon.php | 4 +- newbb/include/functions.render.php | 13 +- newbb/include/functions.rpc.php | 6 +- newbb/include/functions.session.php | 11 +- newbb/include/functions.stats.php | 10 +- newbb/include/functions.text.php | 6 +- newbb/include/functions.time.php | 10 +- newbb/include/functions.topic.php | 4 +- newbb/include/functions.user.php | 26 +- newbb/include/functions.welcome.inc.php | 6 +- newbb/include/functions.welcome.php | 4 +- newbb/include/images.php | 38 +- newbb/include/module.php | 13 +- newbb/include/module.v100.php | 6 +- newbb/include/module.v220.php | 6 +- newbb/include/module.v400.php | 136 +-- newbb/include/notification.inc.php | 6 +- newbb/include/plugin.dist.php | 60 +- newbb/include/plugin.php | 8 +- newbb/include/search.inc.php | 6 +- newbb/include/sitemap.plugin.php | 46 +- newbb/include/vars.php | 4 +- newbb/index.php | 154 +-- newbb/language/english/admin.php | 524 +++++----- newbb/language/english/blocks.php | 80 +- newbb/language/english/main.php | 912 +++++++++--------- newbb/language/english/modinfo.php | 448 ++++----- newbb/list.tag.php | 6 +- newbb/list.topic.php | 30 +- newbb/makepdf.php | 44 +- newbb/moderate.php | 93 +- newbb/newtopic.php | 26 +- newbb/notification_update.php | 6 +- newbb/polls.php | 385 ++++---- newbb/post.php | 158 +-- newbb/print.php | 46 +- newbb/ratethread.php | 60 +- newbb/reply.php | 69 +- newbb/report.php | 37 +- newbb/rss.php | 46 +- newbb/search.php | 289 +++--- newbb/seo.php | 6 +- newbb/seo_url.php | 60 +- newbb/sql/mysql.sql | 2 +- .../templates/css/language/english/style.css | 165 ++-- .../js/language/english/newbb_validation.js | 2 +- newbb/templates/newbb_index.tpl | 2 +- newbb/templates/newbb_viewforum.tpl | 2 +- .../blocks/newbb_block_list_topic.tpl | 2 +- .../css/language/english/style.css | 104 +- .../js/language/english/newbb_validation.js | 2 +- .../templates_fulldiv_opacity/newbb_index.tpl | 2 +- .../newbb_viewforum.tpl | 298 +++--- newbb/topicmanager.php | 120 +-- newbb/update_type.php | 88 +- newbb/view.tag.php | 6 +- newbb/viewforum.php | 152 +-- newbb/viewpost.php | 178 ++-- newbb/viewtopic.php | 350 +++---- newbb/votepolls.php | 50 +- newbb/xoops_version.php | 16 +- 133 files changed, 4102 insertions(+), 4060 deletions(-) delete mode 100644 newbb/assets/images/category/cbb.png create mode 100644 newbb/assets/images/category/newbb.png delete mode 100644 newbb/assets/images/category/xoops-cn.png delete mode 100644 newbb/assets/images/cbb.png create mode 100644 newbb/assets/images/newbb.png diff --git a/newbb/action.post.php b/newbb/action.post.php index 05b2f979..024463b1 100644 --- a/newbb/action.post.php +++ b/newbb/action.post.php @@ -1,25 +1,25 @@ * @since 4.00 * @version $Id $ * @package module::newbb */ -include_once __DIR__ . "/header.php"; +include_once __DIR__ . '/header.php'; $topic_id = XoopsRequest::getInt('topic_id', 0, 'POST'); $post_id = XoopsRequest::getArray('post_id', XoopsRequest::getArray('post_id', 0, 'POST'), 'GET'); $uid = XoopsRequest::getInt('uid', 0, 'GET'); $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); -$op = in_array($op, array("approve", "delete", "restore", "split")) ? $op : ""; +$op = in_array($op, array('approve', 'delete', 'restore', 'split'), true) ? $op : ''; $mode = XoopsRequest::getInt('mode', 1, 'GET'); -if (empty($post_id) || empty($op)) { +if (0 === count($post_id) || 0 === count($op)) { // irmtfan - issue with javascript:history.go(-1) redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NORIGHTTOACCESS); } @@ -37,23 +37,23 @@ $isadmin = newbb_isAdmin($forum_obj); if (!$isadmin) { - redirect_header("index.php", 2, _MD_NORIGHTTOACCESS); + redirect_header(XOOPS_URL .'/index.php', 2, _MD_NORIGHTTOACCESS); } switch ($op) { - case "restore": + case 'restore': $post_id = array_values($post_id); sort($post_id); $topics = array(); $forums = array(); foreach ($post_id as $post) { $post_obj =& $postHandler->get($post); - if ($post_obj->getVar("topic_id") < 1) { + if ($post_obj->getVar('topic_id') < 1) { continue; } $postHandler->approve($post_obj, true); - $topics[$post_obj->getVar("topic_id")] = 1; - $forums[$post_obj->getVar("forum_id")] = 1; + $topics[$post_obj->getVar('topic_id')] = 1; + $forums[$post_obj->getVar('forum_id')] = 1; unset($post_obj); } foreach (array_keys($topics) as $topic) { @@ -63,21 +63,21 @@ $forumHandler->synchronization($forum); } break; - case "approve": + case 'approve': $post_id = array_values($post_id); sort($post_id); $topics = array(); $forums = array(); - $criteria = new Criteria("post_id", "(" . implode(",", $post_id) . ")", "IN"); + $criteria = new Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); $posts_obj =& $postHandler->getObjects($criteria, true); foreach ($post_id as $post) { $post_obj =& $posts_obj[$post]; - if (!empty($topic_id) && $topic_id !== $post_obj->getVar("topic_id")) { + if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) { continue; } $postHandler->approve($post_obj); - $topics[$post_obj->getVar("topic_id")] = $post; - $forums[$post_obj->getVar("forum_id")] = 1; + $topics[$post_obj->getVar('topic_id')] = $post; + $forums[$post_obj->getVar('forum_id')] = 1; } foreach (array_keys($topics) as $topic) { $topicHandler->synchronization($topic); @@ -90,42 +90,42 @@ break; } - $criteria_topic = new Criteria("topic_id", "(" . implode(",", array_keys($topics)) . ")", "IN"); + $criteria_topic = new Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); $topic_list =& $topicHandler->getList($criteria_topic, true); - $criteria_forum = new Criteria("forum_id", "(" . implode(",", array_keys($forums)) . ")", "IN"); + $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); $forum_list =& $forumHandler->getList($criteria_forum); include_once 'include/notification.inc.php'; $notification_handler =& xoops_gethandler('notification'); foreach ($post_id as $post) { $tags = array(); - $tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar("topic_id")]; - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $posts_obj[$post]->getVar("topic_id") . '&forum=' . $posts_obj[$post]->getVar('forum_id'); + $tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar('topic_id')]; + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $posts_obj[$post]->getVar('topic_id') . '&forum=' . $posts_obj[$post]->getVar('forum_id'); $tags['FORUM_NAME'] = $forum_list[$posts_obj[$post]->getVar('forum_id')]; $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $posts_obj[$post]->getVar('forum_id'); $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; - $notification_handler->triggerEvent('thread', $posts_obj[$post]->getVar("topic_id"), 'new_post', $tags); + $notification_handler->triggerEvent('thread', $posts_obj[$post]->getVar('topic_id'), 'new_post', $tags); $notification_handler->triggerEvent('forum', $posts_obj[$post]->getVar('forum_id'), 'new_post', $tags); $notification_handler->triggerEvent('global', 0, 'new_post', $tags); - $tags['POST_CONTENT'] = $posts_obj[$post]->getVar("post_text"); - $tags['POST_NAME'] = $posts_obj[$post]->getVar("subject"); + $tags['POST_CONTENT'] = $posts_obj[$post]->getVar('post_text'); + $tags['POST_NAME'] = $posts_obj[$post]->getVar('subject'); $notification_handler->triggerEvent('global', 0, 'new_fullpost', $tags); $notification_handler->triggerEvent('forum', $posts_obj[$post]->getVar('forum_id'), 'new_fullpost', $tags); } break; - case "delete": + case 'delete': $post_id = array_values($post_id); rsort($post_id); $topics = array(); $forums = array(); foreach ($post_id as $post) { $post_obj =& $postHandler->get($post); - if (!empty($topic_id) && $topic_id !== $post_obj->getVar("topic_id")) { + if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) { continue; } - $topics[$post_obj->getVar("topic_id")] = 1; - $forums[$post_obj->getVar("forum_id")] = 1; + $topics[$post_obj->getVar('topic_id')] = 1; + $forums[$post_obj->getVar('forum_id')] = 1; $postHandler->delete($post_obj, true); unset($post_obj); } @@ -136,53 +136,53 @@ $forumHandler->synchronization($forum); } break; - case "split": + case 'split': $post_obj =& $postHandler->get($post_id); - if (empty($post_id) || $post_obj->isTopic()) { + if (0 === count($post_id) || $post_obj->isTopic()) { break; } - $topic_id = $post_obj->getVar("topic_id"); + $topic_id = $post_obj->getVar('topic_id'); $newtopic =& $topicHandler->create(); - $newtopic->setVar("topic_title", $post_obj->getVar("subject"), true); - $newtopic->setVar("topic_poster", $post_obj->getVar("uid"), true); - $newtopic->setVar("forum_id", $post_obj->getVar("forum_id"), true); - $newtopic->setVar("topic_time", $post_obj->getVar("post_time"), true); - $newtopic->setVar("poster_name", $post_obj->getVar("poster_name"), true); - $newtopic->setVar("approved", 1, true); + $newtopic->setVar('topic_title', $post_obj->getVar('subject'), true); + $newtopic->setVar('topic_poster', $post_obj->getVar('uid'), true); + $newtopic->setVar('forum_id', $post_obj->getVar('forum_id'), true); + $newtopic->setVar('topic_time', $post_obj->getVar('post_time'), true); + $newtopic->setVar('poster_name', $post_obj->getVar('poster_name'), true); + $newtopic->setVar('approved', 1, true); $topicHandler->insert($newtopic, true); $new_topic_id = $newtopic->getVar('topic_id'); - $pid = $post_obj->getVar("pid"); + $pid = $post_obj->getVar('pid'); - $post_obj->setVar("topic_id", $new_topic_id, true); - $post_obj->setVar("pid", 0, true); + $post_obj->setVar('topic_id', $new_topic_id, true); + $post_obj->setVar('pid', 0, true); $postHandler->insert($post_obj); /* split a single post */ if ($mode === 1) { - $criteria = new CriteriaCompo(new Criteria("topic_id", $topic_id)); + $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $criteria->add(new Criteria('pid', $post_id)); - $postHandler->updateAll("pid", $pid, $criteria, true); + $postHandler->updateAll('pid', $pid, $criteria, true); /* split a post and its children posts */ } elseif ($mode === 2) { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("bb_posts"), "post_id", "pid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('bb_posts'), 'post_id', 'pid'); $posts = $mytree->getAllChildId($post_id); if (count($posts) > 0) { - $criteria = new Criteria('post_id', "(" . implode(",", $posts) . ")", "IN"); - $postHandler->updateAll("topic_id", $new_topic_id, $criteria, true); + $criteria = new Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); } /* split a post and all posts coming after */ } elseif ($mode === 3) { - $criteria = new CriteriaCompo(new Criteria("topic_id", $topic_id)); - $criteria->add(new Criteria('post_id', $post_id, ">")); - $postHandler->updateAll("topic_id", $new_topic_id, $criteria, true); + $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); + $criteria->add(new Criteria('post_id', $post_id, '>')); + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); unset($criteria); - $criteria = new CriteriaCompo(new Criteria("topic_id", $new_topic_id)); - $criteria->add(new Criteria('post_id', $post_id, ">")); - $postHandler->identifierName = "pid"; + $criteria = new CriteriaCompo(new Criteria('topic_id', $new_topic_id)); + $criteria->add(new Criteria('post_id', $post_id, '>')); + $postHandler->identifierName = 'pid'; $posts = $postHandler->getList($criteria); unset($criteria); @@ -193,15 +193,15 @@ } } if (count($post_update)) { - $criteria = new Criteria('post_id', "(" . implode(",", $post_update) . ")", "IN"); - $postHandler->updateAll("pid", $post_id, $criteria, true); + $criteria = new Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); + $postHandler->updateAll('pid', $post_id, $criteria, true); } } - $forum_id = $post_obj->getVar("forum_id"); + $forum_id = $post_obj->getVar('forum_id'); $topicHandler->synchronization($topic_id); $topicHandler->synchronization($new_topic_id); - $sql = sprintf("UPDATE %s SET forum_topics = forum_topics+1 WHERE forum_id = %u", $GLOBALS['xoopsDB']->prefix("bb_forums"), $forum_id); + $sql = sprintf('UPDATE %s SET forum_topics = forum_topics+1 WHERE forum_id = %u', $GLOBALS['xoopsDB']->prefix('bb_forums'), $forum_id); $result = $GLOBALS['xoopsDB']->queryF($sql); break; @@ -214,5 +214,5 @@ redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_DBUPDATED); } // irmtfan move to footer.php -include_once __DIR__ . "/footer.php"; +include_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/newbb/action.topic.php b/newbb/action.topic.php index 7587e37a..83677375 100644 --- a/newbb/action.topic.php +++ b/newbb/action.topic.php @@ -1,23 +1,23 @@ * @since 4.00 * @version $Id $ * @package module::newbb */ -include_once __DIR__ . "/header.php"; +include_once __DIR__ . '/header.php'; $forum_id = XoopsRequest::getInt('forum_id', 0, 'POST'); -$topic_id = XoopsRequest::getInt('topic_id', null, 'POST'); +$topic_id = XoopsRequest::getArray('topic_id', null, 'POST'); $op = XoopsRequest::getCmd('op', '', 'POST'); -$op = in_array($op, array("approve", "delete", "restore", "move")) ? $op : ""; +$op = in_array($op, array('approve', 'delete', 'restore', 'move'), true) ? $op : ''; -if (empty($topic_id) || empty($op)) { +if (0 === count($topic_id) || 0 === count($op)) { // irmtfan - issue with javascript:history.go(-1) redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NORIGHTTOACCESS); } @@ -29,36 +29,36 @@ $isadmin = newbb_isAdmin($forum_id); if (!$isadmin) { - redirect_header("index.php", 2, _MD_NORIGHTTOACCESS); + redirect_header(XOOPS_URL .'/index.php', 2, _MD_NORIGHTTOACCESS); } switch ($op) { - case "restore": + case 'restore': $forums = array(); - $topics_obj =& $topicHandler->getAll(new Criteria("topic_id", "(" . implode(",", $topic_id) . ")", "IN")); + $topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; $topicHandler->approve($topic_obj); $topicHandler->synchronization($topic_obj); - $forums[$topic_obj->getVar("forum_id")] = 1; + $forums[$topic_obj->getVar('forum_id')] = 1; } - $criteria_forum = new Criteria("forum_id", "(" . implode(",", array_keys($forums)) . ")", "IN"); + $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); $forums_obj =& $forumHandler->getAll($criteria_forum); foreach (array_keys($forums_obj) as $id) { $forumHandler->synchronization($forums_obj[$id]); } unset($topics_obj, $forums_obj); break; - case "approve": + case 'approve': $forums = array(); - $topics_obj =& $topicHandler->getAll(new Criteria("topic_id", "(" . implode(",", $topic_id) . ")", "IN")); + $topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; $topicHandler->approve($topic_obj); $topicHandler->synchronization($topic_obj); - $forums[$topic_obj->getVar("forum_id")] = 1; + $forums[$topic_obj->getVar('forum_id')] = 1; } - $criteria_forum = new Criteria("forum_id", "(" . implode(",", array_keys($forums)) . ")", "IN"); + $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); $forums_obj =& $forumHandler->getAll($criteria_forum); foreach (array_keys($forums_obj) as $id) { $forumHandler->synchronization($forums_obj[$id]); @@ -73,51 +73,51 @@ foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; $tags = array(); - $tags['THREAD_NAME'] = $topic_obj->getVar("topic_title"); + $tags['THREAD_NAME'] = $topic_obj->getVar('topic_title'); $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topic_obj->getVar('forum_id'); - $tags['FORUM_NAME'] = $forums_obj[$topic_obj->getVar("forum_id")]->getVar("forum_name"); + $tags['FORUM_NAME'] = $forums_obj[$topic_obj->getVar("forum_id")]->getVar('forum_name'); $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $topic_obj->getVar('forum_id'); $notification_handler->triggerEvent('global', 0, 'new_thread', $tags); $notification_handler->triggerEvent('forum', $topic_obj->getVar('forum_id'), 'new_thread', $tags); $post_obj =& $topicHandler->getTopPost($id); - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_obj->getVar("post_id"); + $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_obj->getVar('post_id'); $notification_handler->triggerEvent('thread', $id, 'new_post', $tags); $notification_handler->triggerEvent('forum', $topic_obj->getVar('forum_id'), 'new_post', $tags); $notification_handler->triggerEvent('global', 0, 'new_post', $tags); - $tags['POST_CONTENT'] = $post_obj->getVar("post_text"); - $tags['POST_NAME'] = $post_obj->getVar("subject"); + $tags['POST_CONTENT'] = $post_obj->getVar('post_text'); + $tags['POST_NAME'] = $post_obj->getVar('subject'); $notification_handler->triggerEvent('global', 0, 'new_fullpost', $tags); $notification_handler->triggerEvent('forum', $topic_obj->getVar('forum_id'), 'new_fullpost', $tags); unset($post_obj); } unset($topics_obj, $forums_obj); break; - case "delete": + case 'delete': $forums = array(); - $topics_obj =& $topicHandler->getAll(new Criteria("topic_id", "(" . implode(",", $topic_id) . ")", "IN")); + $topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { $topic_obj =& $topics_obj[$id]; // irmtfan should be set to false to not delete topic from database $topicHandler->delete($topic_obj, false); $topicHandler->synchronization($topic_obj); - $forums[$topic_obj->getVar("forum_id")] = 1; + $forums[$topic_obj->getVar('forum_id')] = 1; } - $criteria_forum = new Criteria("forum_id", "(" . implode(",", array_keys($forums)) . ")", "IN"); + $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); $forums_obj =& $forumHandler->getAll($criteria_forum); foreach (array_keys($forums_obj) as $id) { $forumHandler->synchronization($forums_obj[$id]); } unset($topics_obj, $forums_obj); break; - case "move": + case 'move': if (XoopsRequest::getInt('newforum', 0, 'POST') && XoopsRequest::getInt('newforum', 0, 'POST') !== $forum_id && $forumHandler->getPermission(XoopsRequest::getInt('newforum', 0, 'POST'), 'post') ) { - $criteria = new Criteria('topic_id', "(" . implode(",", $topic_id) . ")", "IN"); + $criteria = new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); $postHandler =& xoops_getmodulehandler('post', 'newbb'); - $postHandler->updateAll("forum_id", XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); - $topicHandler->updateAll("forum_id", XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); + $postHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); + $topicHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); $forumHandler->synchronization(XoopsRequest::getInt('newforum', 0, 'POST')); $forumHandler->synchronization($forum_id); } else { @@ -146,7 +146,7 @@ $box .= ""; unset($forums, $categories); - echo "
"; + echo ""; echo ""; echo "
"; echo ""; @@ -167,13 +167,13 @@ } break; } -$statsHandler = xoops_getmodulehandler('stats', 'newbb'); +$statsHandler = &xoops_getmodulehandler('stats', 'newbb'); $statsHandler->reset(); if (empty($forum_id)) { - redirect_header(XOOPS_URL . "/modules/newbb/list.topic.php", 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_DBUPDATED); } else { - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . '/modules/newbb/viewforum.php?forum=$forum_id', 2, _MD_DBUPDATED); } // irmtfan move to footer.php -include_once __DIR__ . "/footer.php"; +include_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/newbb/admin/about.php b/newbb/admin/about.php index 474ca8b3..baec0eed 100644 --- a/newbb/admin/about.php +++ b/newbb/admin/about.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,144 +25,144 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); if ($newXoopsModuleGui) { - $module_info =& $module_handler->get($xoopsModule->getVar("mid")); + $module_info =& $module_handler->get($xoopsModule->getVar('mid')); $aboutAdmin = new ModuleAdmin(); echo $aboutAdmin->addNavigation('about.php'); - echo $aboutAdmin->renderabout('PBQZ7D6LT6UBC', true); + echo $aboutAdmin->renderAbout('PBQZ7D6LT6UBC', true); } else { $module_handler =& xoops_gethandler('module'); $versioninfo =& $module_handler->get($xoopsModule->getVar('mid')); //loadModuleAdminMenu(13, _AM_NEWBB_ABOUT . " " . $versioninfo->getInfo('name')); - echo "
"; + echo '
'; // Left headings... - echo ""; - echo "
" . $versioninfo->getInfo('name') . " version " . $versioninfo->getInfo('version') . " (" . $versioninfo->getInfo('status_version') . ")
"; + echo "dirname() . '/' . $versioninfo->getInfo('image') . "' alt='' hspace='0' vspace='0' align='left' style='margin-right: 10px;' />"; + echo "
" . $versioninfo->getInfo('name') . ' version ' . $versioninfo->getInfo('version') . ' (' . $versioninfo->getInfo('status_version') . ')
'; if ($versioninfo->getInfo('author_realname') !== '') { - $author_name = $versioninfo->getInfo('author') . " (" . $versioninfo->getInfo('author_realname') . ")"; + $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; } else { $author_name = $versioninfo->getInfo('author'); } - echo "
" . _AM_NEWBB_BY . " " . $author_name; - echo "
"; + echo "
" . _AM_NEWBB_BY . ' ' . $author_name; + echo '
'; echo "
" . $versioninfo->getInfo('license') . "


\n"; // Author Information echo "
"; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; if ($versioninfo->getInfo('$author_name') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } if ($versioninfo->getInfo('author_website_url') !== '') { - echo ""; - echo ""; + echo ''; + echo "'; echo ""; - echo ""; + echo ''; } if ($versioninfo->getInfo('author_email') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } if ($versioninfo->getInfo('credits') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } - echo "
" . _AM_NEWBB_AUTHOR_INFO . "
" . _AM_NEWBB_AUTHOR_INFO . '
" . _AM_NEWBB_AUTHOR_NAME . "" . $author_name . "
" . _AM_NEWBB_AUTHOR_NAME . '" . $author_name . '
" . _AM_NEWBB_AUTHOR_WEBSITE . "
" . _AM_NEWBB_AUTHOR_WEBSITE . '" . $versioninfo->getInfo('author_website_name') . "
" . _AM_NEWBB_AUTHOR_EMAIL . "" . $versioninfo->getInfo('author_email') . "
" . _AM_NEWBB_AUTHOR_EMAIL . '" . $versioninfo->getInfo('author_email') . '
" . _AM_NEWBB_AUTHOR_CREDITS . "" . $versioninfo->getInfo('credits') . "
" . _AM_NEWBB_AUTHOR_CREDITS . '" . $versioninfo->getInfo('credits') . '
"; + echo '
'; echo "
\n"; // Module Developpment information echo ""; - echo ""; + echo ''; echo ""; - echo ""; + echo ''; if ($versioninfo->getInfo('status') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } if ($versioninfo->getInfo('demo_site_url') !== '') { - echo ""; - echo ""; + echo ''; + echo "'; echo ""; - echo ""; + echo ''; } if ($versioninfo->getInfo('support_site_url') !== '') { - echo ""; - echo ""; + echo ''; + echo "'; echo ""; - echo ""; + echo ''; } if ($versioninfo->getInfo('submit_bug') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } if ($versioninfo->getInfo('submit_feature') !== '') { - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } - echo "
" . _AM_NEWBB_MODULE_INFO . "
" . _AM_NEWBB_MODULE_STATUS . "" . $versioninfo->getInfo('status') . "
" . _AM_NEWBB_MODULE_STATUS . '" . $versioninfo->getInfo('status') . '
" . _AM_NEWBB_MODULE_DEMO . "
" . _AM_NEWBB_MODULE_DEMO . '" . $versioninfo->getInfo('demo_site_name') . "
" . _AM_NEWBB_MODULE_SUPPORT . "
" . _AM_NEWBB_MODULE_SUPPORT . '" . $versioninfo->getInfo('support_site_name') . "
" . _AM_NEWBB_MODULE_BUG . "" . "Submit a Bug in newBB Bug Tracker" . "
" . _AM_NEWBB_MODULE_BUG . '" . 'Submit a Bug in newBB Bug Tracker' . '
" . _AM_NEWBB_MODULE_FEATURE . "" . "Request a feature in the newBB Feature Tracker" . "
" . _AM_NEWBB_MODULE_FEATURE . '" . 'Request a feature in the newBB Feature Tracker' . '
"; + echo ''; // Warning if ($versioninfo->getInfo('warning') !== '') { echo "
\n"; echo ""; - echo ""; - echo ""; - echo ""; - - echo ""; - echo ""; - echo ""; - echo "
" . _AM_NEWBB_MODULE_DISCLAIMER . "
" . $versioninfo->getInfo('warning') . "
"; + echo ''; + echo "" . _AM_NEWBB_MODULE_DISCLAIMER . ''; + echo ''; + + echo ''; + echo "" . $versioninfo->getInfo('warning') . ''; + echo ''; + echo ''; } // Author's note if ($versioninfo->getInfo('author_word') !== '') { echo "
\n"; echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; $extra = (defined('_AM_NEWBB_AUTHOR_WORD_EXTRA')) ? _AM_NEWBB_AUTHOR_WORD_EXTRA : ''; - echo ""; - echo ""; - echo ""; - echo "
" . _AM_NEWBB_AUTHOR_WORD . "
" . _AM_NEWBB_AUTHOR_WORD . '
" . $versioninfo->getInfo('author_word') . "
"; + echo ''; + echo "" . $versioninfo->getInfo('author_word') . ''; + echo ''; + echo ''; } - echo ""; + echo ''; } xoops_cp_footer(); diff --git a/newbb/admin/admin_blocks.php b/newbb/admin/admin_blocks.php index c46b0c74..c77683c8 100644 --- a/newbb/admin/admin_blocks.php +++ b/newbb/admin/admin_blocks.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // // ------------------------------------------------------------------------- // // myblocksadmin.php // @@ -34,4 +34,4 @@ // GIJOE // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; -header("Location: ".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&selmod=".$xoopsModule->getVar("mid")); +header("Location: " . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selmod=" . $xoopsModule->getVar("mid")); diff --git a/newbb/admin/admin_cat_manager.php b/newbb/admin/admin_cat_manager.php index 1368e898..0e76c390 100644 --- a/newbb/admin/admin_cat_manager.php +++ b/newbb/admin/admin_cat_manager.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,15 +25,15 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; -mod_loadFunctions("render", "newbb"); +mod_loadFunctions('render', 'newbb'); xoops_cp_header(); -echo "
"; +echo '
'; $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); -$cat_id = XoopsRequest::getInt('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'), 'GET'); // (int) ( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] ); +$cat_id = XoopsRequest::getInt('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] ); $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); @@ -52,7 +52,7 @@ function newCategory() * @param null $category_obj * @internal param int $catid */ -function editCategory($category_obj = null) +function editCategory(XoopsObject $category_obj = null) { global $xoopsModule; $categoryHandler = &xoops_getmodulehandler('category', 'newbb'); @@ -60,38 +60,38 @@ function editCategory($category_obj = null) $category_obj =& $categoryHandler->create(); } $groups_cat_access = null; - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); + include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); if (!$category_obj->isNew()) { - $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $category_obj->getVar('cat_title'), "op", xoops_getenv('PHP_SELF')); + $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $category_obj->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); } else { - $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF')); + $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF')); $category_obj->setVar('cat_title', ''); $category_obj->setVar('cat_image', ''); $category_obj->setVar('cat_description', ''); $category_obj->setVar('cat_order', 0); - $category_obj->setVar('cat_url', 'http://www.simple-xoops.de newBB Support'); + $category_obj->setVar('cat_url', 'http://xoops.org/modules/newbb/ newBB Support'); } $sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false); $sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $category_obj->getVar('cat_title', 'E')), true); $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $category_obj->getVar('cat_description', 'E'), 10, 60), false); - $imgdir = "/modules/" . $xoopsModule->getVar("dirname") . "/assets/images/category"; + $imgdir = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category'; $cat_image = $category_obj->getVar("cat_image"); $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image; - $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/"); + $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/'); array_unshift($graph_array, _NONE); $cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image')); $cat_image_select->addOptionArray($graph_array); $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); $cat_image_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); $cat_image_tray->addElement($cat_image_select); - $cat_image_tray->addElement(new XoopsFormLabel('', "
")); + $cat_image_tray->addElement(new XoopsFormLabel('', "
")); $sform->addElement($cat_image_tray); $sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $category_obj->getVar('cat_url', 'E')), false); - $sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar("cat_id"))); + $sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar('cat_id'))); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormHidden('op', 'save')); @@ -99,7 +99,7 @@ function editCategory($category_obj = null) $butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit'); $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"'); $button_tray->addElement($butt_save); - if ($category_obj->getVar("cat_id")) { + if ($category_obj->getVar('cat_id')) { $butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit'); $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"'); $button_tray->addElement($butt_delete); @@ -109,11 +109,11 @@ function editCategory($category_obj = null) } switch ($op) { - case "mod": + case 'mod': $category_obj = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create(); if (!$newXoopsModuleGui) { //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $category_obj->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); - echo "" . _AM_NEWBB_EDITCATEGORY . ""; + echo "" . _AM_NEWBB_EDITCATEGORY . ''; } else { echo $indexAdmin->addNavigation('admin_cat_manager.php'); } @@ -121,7 +121,7 @@ function editCategory($category_obj = null) editCategory($category_obj); break; - case "del": + case 'del': if (!(XoopsRequest::getBool('confirm', '', 'POST'))) { xoops_confirm(array('op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1), 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); break; @@ -130,12 +130,12 @@ function editCategory($category_obj = null) $category_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST')); $categoryHandler->delete($category_obj); - redirect_header("admin_cat_manager.php", 2, _AM_NEWBB_CATEGORYDELETED); + redirect_header(XOOPS_URL . '/admin/admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); } break; - case "save": - mod_clearCacheFile("permission_category", "newbb"); + case 'save': + mod_clearCacheFile('permission_category', 'newbb'); if ($cat_id) { $category_obj =& $categoryHandler->get($cat_id); $message = _AM_NEWBB_CATEGORYUPDATED; @@ -157,60 +157,60 @@ function editCategory($category_obj = null) if ($cat_id = $category_obj->getVar("cat_id") && $cat_isNew) { $categoryHandler->applyPermissionTemplate($category_obj); } - redirect_header("admin_cat_manager.php", 2, $message); + redirect_header(XOOPS_URL . '/admin/admin_cat_manager.php', 2, $message); break; default: - if (!$categories = $categoryHandler->getByPermission("all")) { + if (!$categories = $categoryHandler->getByPermission('all')) { if (!$newXoopsModuleGui) { //loadModuleAdminMenu(1, _AM_NEWBB_CREATENEWCATEGORY); - echo "" . _AM_NEWBB_CREATENEWCATEGORY . ""; + echo "" . _AM_NEWBB_CREATENEWCATEGORY . ''; } else { $indexAdmin->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); echo $indexAdmin->renderButton(); } - echo "
"; - echo "
"; + echo '
'; + echo '
'; newCategory(); - echo "
"; + echo '
'; break; } if (!$newXoopsModuleGui) { //loadModuleAdminMenu(1, _AM_NEWBB_CATADMIN); - echo "
"; - echo "" . _AM_NEWBB_CATADMIN . ""; - echo "
"; - echo "" . _AM_NEWBB_CREATENEWCATEGORY . "

"; + echo '
'; + echo "" . _AM_NEWBB_CATADMIN . ''; + echo '
'; + echo "" . _AM_NEWBB_CREATENEWCATEGORY . '

'; } else { echo $indexAdmin->addNavigation('admin_cat_manager.php'); - echo "
"; + echo '
'; $indexAdmin->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); echo $indexAdmin->renderButton(); } echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo "'; + echo ''; foreach ($categories as $key => $onecat) { - $cat_edit_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_edit', _EDIT) . ""; - $cat_del_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_delete', _DELETE) . ""; - $cat_title_link = "getVar("dirname") . "/index.php?cat=" . $onecat->getVar('cat_id') . "\">" . $onecat->getVar('cat_title') . ""; + $cat_edit_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_edit', _EDIT) . ''; + $cat_del_link = "getVar('cat_id') . "\">" . newbbDisplayImage('admin_delete', _DELETE) . ''; + $cat_title_link = "getVar("dirname") . '/index.php?cat=' . $onecat->getVar('cat_id') . "\">" . $onecat->getVar('cat_title') . ''; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; } - echo "
" . _AM_NEWBB_CATEGORY1 . "" . _AM_NEWBB_EDIT . "" . _AM_NEWBB_DELETE . "
" . _AM_NEWBB_CATEGORY1 . '" . _AM_NEWBB_EDIT . '" . _AM_NEWBB_DELETE . '
" . $cat_title_link . "" . $cat_edit_link . "" . $cat_del_link . "
' . $cat_title_link . '" . $cat_edit_link . '" . $cat_del_link . '
"; - echo "
"; + echo ''; + echo '
'; break; } -mod_clearCacheFile("permission_category", "newbb"); -echo "
"; +mod_clearCacheFile('permission_category', 'newbb'); +echo '
'; xoops_cp_footer(); diff --git a/newbb/admin/admin_digest.php b/newbb/admin/admin_digest.php index 86fc75be..7f0c5744 100644 --- a/newbb/admin/admin_digest.php +++ b/newbb/admin/admin_digest.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; @@ -40,7 +40,7 @@ xoops_cp_header(); switch ($op) { - case "delete": + case 'delete': $digest_ids = XoopsRequest::getArray('digest_id', '', 'POST'); $digest_handler =& xoops_getmodulehandler('digest', 'newbb'); if ($digest_ids !== '') { @@ -48,12 +48,12 @@ $digest_handler->delete($did); } } - redirect_header("admin_digest.php", 1); + redirect_header('admin_digest.php', 1); break; default: - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); - echo "
"; + include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . '/class/xoopsformloader.php'); + echo '
'; $limit = 5; if ($newXoopsModuleGui) { echo $indexAdmin->addNavigation('admin_digest.php'); @@ -63,17 +63,17 @@ echo ''; echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo ''; $digest_handler =& xoops_getmodulehandler('digest', 'newbb'); $digests =& $digest_handler->getAllDigests($start, $limit); foreach ($digests as $digest) { echo ""; - echo ""; + echo ''; echo ""; - echo ""; + echo ''; echo ""; } $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); @@ -81,14 +81,14 @@ $hidden = new XoopsFormHidden('op', 'delete'); echo $hidden->render(); $hidden = new XoopsFormHidden('item', $item); - echo $hidden->render() . ""; + echo $hidden->render() . ''; - echo "
" . _AM_NEWBB_DIGESTCONTENT . "" . _DELETE . "
" . _AM_NEWBB_DIGESTCONTENT . '" . _DELETE . '
#" . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '
' . str_replace("\n", "
", $digest['digest_content']) . "
#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '
' . str_replace("\n", "
", $digest['digest_content']) . '
"; + echo ''; - $nav = new XoopsPageNav($digest_handler->getDigestCount(), $limit, $start, "start"); + $nav = new XoopsPageNav($digest_handler->getDigestCount(), $limit, $start, 'start'); echo $nav->renderNav(4); - echo "
"; + echo '
'; break; } diff --git a/newbb/admin/admin_forum_manager.php b/newbb/admin/admin_forum_manager.php index 15d490db..82989659 100644 --- a/newbb/admin/admin_forum_manager.php +++ b/newbb/admin/admin_forum_manager.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,20 +25,20 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; include $GLOBALS['xoops']->path('class/xoopstree.php'); include_once $GLOBALS['xoops']->path('class/pagenav.php'); -mod_loadFunctions("forum", "newbb"); -mod_loadFunctions("render", "newbb"); -load_functions("cache"); +mod_loadFunctions('forum', 'newbb'); +mod_loadFunctions('render', 'newbb'); +load_functions('cache'); xoops_cp_header(); $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); -$forum_id = XoopsRequest::getInt('forum', XoopsRequest::getInt('forum', 0, 'POST'), 'GET'); //(int) ( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); +$forum_id = XoopsRequest::getInt('forum', XoopsRequest::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); switch ($op) { @@ -48,28 +48,28 @@ if (XoopsRequest::getInt('dest_forum', 0, 'POST')) { $dest = XoopsRequest::getInt('dest_forum', 0, 'POST'); if ($dest > 0) { - $pid = (int) ($dest); + $pid = (int)($dest); $forum_dest =& $forumHandler->get($pid); - $cid = $forum_dest->getVar("cat_id"); + $cid = $forum_dest->getVar('cat_id'); unset($forum_dest); } else { - $cid = abs((int) ($dest)); + $cid = abs((int)($dest)); $pid = 0; } $forum_obj =& $forumHandler->get($forum_id); - $forum_obj->setVar("cat_id", $cid); - $forum_obj->setVar("parent_forum", $pid); + $forum_obj->setVar('cat_id', $cid); + $forum_obj->setVar('parent_forum', $pid); $forumHandler->insert($forum_obj); if ($forumHandler->insert($forum_obj)) { - if ($cid !== $forum_obj->getVar("cat_id") && $subforums = newbb_getSubForum($forum_id)) { - $forums = array_map("intval", array_values($subforums)); - $forumHandler->updateAll("cat_id", $cid, new Criteria("forum_id", "(" . implode(", ", $forums) . ")", "IN")); + if ($cid !== $forum_obj->getVar('cat_id') && $subforums = newbb_getSubForum($forum_id)) { + $forums = array_map('intval', array_values($subforums)); + $forumHandler->updateAll('cat_id', $cid, new Criteria('forum_id', '(' . implode(", ", $forums) . ')', 'IN')); } - mod_clearCacheFile("forum", "newbb"); - redirect_header('./admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED); + mod_clearCacheFile('forum', 'newbb'); + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED); } else { - redirect_header('./admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); } } else { $box = ''; $box .= ''; - $box .= newbb_forumSelectBox($forum_id, "all"); + $box .= newbb_forumSelectBox($forum_id, 'all'); $box .= ''; echo '
'; @@ -143,7 +143,7 @@ } break; - case "save": + case 'save': if ($forum_id) { $forum_obj =& $forumHandler->get($forum_id); @@ -162,63 +162,63 @@ $forum_obj->setVar('attach_ext', XoopsRequest::getString('attach_ext', '', 'POST')); $forum_obj->setVar('hot_threshold', XoopsRequest::getInt('hot_threshold', 0, 'POST')); if (XoopsRequest::getInt('parent_forum', 0, 'POST')) { - $parent_obj =& $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), array("cat_id")); - $_POST['cat_id'] = $parent_obj->getVar("cat_id"); + $parent_obj =& $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), array('cat_id')); + $_POST['cat_id'] = $parent_obj->getVar('cat_id'); } $forum_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST')); if ($forumHandler->insert($forum_obj)) { - mod_clearCacheFile("forum", "newbb"); + mod_clearCacheFile('forum', 'newbb'); if (XoopsRequest::getInt('perm_template', 0, 'POST')) { - $groupperm_handler = xoops_getmodulehandler('permission', $xoopsModule->getVar("dirname")); + $groupperm_handler = xoops_getmodulehandler('permission', $xoopsModule->getVar('dirname')); $perm_template = $groupperm_handler->getTemplate(); $member_handler =& xoops_gethandler('member'); $glist = $member_handler->getGroupList(); $perms = $groupperm_handler->getValidForumPerms(true); foreach (array_keys($glist) as $group) { foreach ($perms as $perm) { - $ids = $groupperm_handler->getItemIds($perm, $group, $xoopsModule->getVar("mid")); - if (!in_array($forum_obj->getVar("forum_id"), $ids)) { + $ids = $groupperm_handler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); + if (!in_array($forum_obj->getVar('forum_id'), $ids)) { if (empty($perm_template[$group][$perm])) { - $groupperm_handler->deleteRight($perm, $forum_obj->getVar("forum_id"), $group, $xoopsModule->getVar("mid")); + $groupperm_handler->deleteRight($perm, $forum_obj->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); } else { - $groupperm_handler->addRight($perm, $forum_obj->getVar("forum_id"), $group, $xoopsModule->getVar("mid")); + $groupperm_handler->addRight($perm, $forum_obj->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); } } } } } - redirect_header("admin_forum_manager.php", 2, $message); + redirect_header('admin_forum_manager.php', 2, $message); } else { - redirect_header("admin_forum_manager.php?op=mod&forum=" . $forum_obj->getVar('forum_id') . "", 2, _AM_NEWBB_FORUM_ERROR); + redirect_header('admin_forum_manager.php?op=mod&forum=' . $forum_obj->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR); } break; - case "mod": + case 'mod': $forum_obj =& $forumHandler->get($forum_id); //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, _AM_NEWBB_EDITTHISFORUM . $forum_obj->getVar('forum_name')); - echo "
" . _AM_NEWBB_EDITTHISFORUM . ""; + echo "
" . _AM_NEWBB_EDITTHISFORUM . ''; - include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/include/form.forum.php"); + include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); - echo "
"; + echo '
'; break; - case "del": + case 'del': if (1 !== XoopsRequest::getInt('confirm', 0, 'POST')) { xoops_confirm(array('op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1), 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); break; } else { $forum_obj =& $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST')); $forumHandler->delete($forum_obj); - mod_clearCacheFile("forum", "newbb"); - redirect_header("admin_forum_manager.php?op=manage", 1, _AM_NEWBB_FORUMREMOVED); + mod_clearCacheFile('forum', 'newbb'); + redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED); } break; - case "addforum": + case 'addforum': //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, _AM_NEWBB_CREATENEWFORUM); - echo "
" . _AM_NEWBB_CREATENEWFORUM . ""; + echo "
" . _AM_NEWBB_CREATENEWFORUM . ''; echo "
"; $parent_forum = XoopsRequest::getInt('forum', 0, 'GET'); $cat_id = XoopsRequest::getInt('cat_id', 0, 'GET'); @@ -226,38 +226,46 @@ break; } $forum_obj =& $forumHandler->create(); - $forum_obj->setVar("parent_forum", $parent_forum); - $forum_obj->setVar("cat_id", $cat_id); - include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/include/form.forum.php"); + $forum_obj->setVar('parent_forum', $parent_forum); + $forum_obj->setVar('cat_id', $cat_id); + include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . '/include/form.forum.php'); - echo "
"; + echo '
'; break; default: + $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + $criteriaCategory->setSort('cat_order'); + $categories = $categoryHandler->getList($criteriaCategory); + if (0 === count($categories)) { + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); + } + if (!$newXoopsModuleGui) { //loadModuleAdminMenu(2, _AM_NEWBB_FORUM_MANAGER); - $echo = "
" . _AM_NEWBB_FORUM_MANAGER . ""; + $echo = "
" . _AM_NEWBB_FORUM_MANAGER . ''; } else { $echo = $indexAdmin->addNavigation('admin_forum_manager.php'); $echo .= "
"; } $echo .= ""; $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; + $echo .= "'; + $echo .= "'; + $echo .= "'; + $echo .= "'; + $echo .= "'; + $echo .= "'; $echo .= ""; $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - $forums = $forumHandler->getTree(array_keys($categories), 0, "all"); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($categories) as $c) { $category = $categories[$c]; $cat_id = $c; @@ -267,9 +275,9 @@ $forum_add_link = "" . newbbDisplayImage('new_forum') . ""; $echo .= ""; $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; + $echo .= "'; + $echo .= "'; + $echo .= "'; $echo .= ""; $echo .= ""; $echo .= ""; @@ -289,19 +297,19 @@ $class = (($i++) % 2) ? "odd" : "even"; $echo .= ""; $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; - $echo .= ""; + $echo .= "'; + $echo .= "'; + $echo .= "'; + $echo .= "'; + $echo .= "'; $echo .= ""; } } unset($forums, $categories); echo $echo; - echo "
" . _AM_NEWBB_NAME . "" . _AM_NEWBB_EDIT . "" . _AM_NEWBB_DELETE . "" . _AM_NEWBB_ADD . "" . _AM_NEWBB_MOVE . "" . _AM_NEWBB_MERGE . "" . _AM_NEWBB_NAME . '" . _AM_NEWBB_EDIT . '" . _AM_NEWBB_DELETE . '" . _AM_NEWBB_ADD . '" . _AM_NEWBB_MOVE . '" . _AM_NEWBB_MERGE . '
" . $cat_link . "" . $cat_edit_link . "" . $cat_del_link . "" . $forum_add_link . "" . $cat_edit_link . '" . $cat_del_link . '" . $forum_add_link . '
" . $f_link . "" . $f_edit_link . "" . $f_del_link . "" . $sf_add_link . "" . $f_move_link . "" . $f_merge_link . "" . $f_edit_link . '" . $f_del_link . '" . $sf_add_link . '" . $f_move_link . '" . $f_merge_link . '
"; - echo "
"; + echo ''; + echo '
'; break; } xoops_cp_footer(); diff --git a/newbb/admin/admin_forum_prune.php b/newbb/admin/admin_forum_prune.php index e075c5b5..269aa8be 100644 --- a/newbb/admin/admin_forum_prune.php +++ b/newbb/admin/admin_forum_prune.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,10 +25,10 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); +include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); xoops_cp_header(); -echo "
"; +echo '
'; if ($newXoopsModuleGui) { echo $indexAdmin->addNavigation('admin_forum_prune.php'); } @@ -44,44 +44,44 @@ $posts_number = 0; $selected_forums = ''; // irmtfan fix if it is array - if (!XoopsRequest::getArray('forums', 0, 'POST') || !XoopsRequest::getArray('forums'[0], 0, 'POST')) { - redirect_header("./admin_forum_prune.php", 1, _AM_NEWBB_PRUNE_FORUMSELERROR); + if (!XoopsRequest::getArray('forums', null, 'POST') || !(XoopsRequest::getArray('forums', null, 'POST')[0])) { + redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR); } elseif (is_array(XoopsRequest::getArray('forums', '', 'POST'))) { - $selected_forums = implode(",", XoopsRequest::getArray('forums', array(), 'POST')); + $selected_forums = implode(',', XoopsRequest::getArray('forums', null, 'POST')); } else { - $selected_forums = XoopsRequest::getArray('forums', '', 'POST'); + $selected_forums = XoopsRequest::getArray('forums', null, 'POST'); } - $prune_days = $myts->addSlashes(XoopsRequest::getInt('days', 0, 'POST')); + $prune_days = $myts->addslashes(XoopsRequest::getInt('days', 0, 'POST')); $prune_ddays = time() - $prune_days; - $archive = $myts->addSlashes(XoopsRequest::getInt('archive', 0, 'POST'));//$_POST["archive"]); - $sticky = $myts->addSlashes(XoopsRequest::getInt('sticky', 0, 'POST'));//$_POST["sticky"]); - $digest = $myts->addSlashes(XoopsRequest::getInt('digest', 0, 'POST'));//$_POST["digest"]); - $lock = $myts->addSlashes(XoopsRequest::getInt('lock', 0, 'POST'));//$_POST["lock"]); - $hot = $myts->addSlashes(XoopsRequest::getInt('hot', 0, 'POST'));//$_POST["hot"]); + $archive = XoopsRequest::getInt('archive', 0, 'POST');//$_POST["archive"]); + $sticky = XoopsRequest::getInt('sticky', 0, 'POST');//$_POST["sticky"]); + $digest = XoopsRequest::getInt('digest', 0, 'POST');//$_POST["digest"]); + $lock = XoopsRequest::getInt('lock', 0, 'POST');//$_POST["lock"]); + $hot = XoopsRequest::getInt('hot', 0, 'POST');//$_POST["hot"]); $store = null; //irmtfan define to fix if (XoopsRequest::getInt('store', 0, 'POST')) { - $store = $myts->addSlashes(XoopsRequest::getInt('store', 0, 'POST')); + $store = $myts->addslashes(XoopsRequest::getInt('store', 0, 'POST')); } - $sql = "SELECT t.topic_id FROM " . $GLOBALS['xoopsDB']->prefix("bb_topics") . " t, " . $GLOBALS['xoopsDB']->prefix("bb_posts") . " p + $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix("bb_topics") . " t, " . $GLOBALS['xoopsDB']->prefix('bb_posts') . " p WHERE t.forum_id IN (" . $selected_forums . ") AND p.post_id =t.topic_last_post_id "; if ($sticky) { - $sql .= " AND t.topic_sticky <> 1 "; + $sql .= ' AND t.topic_sticky <> 1 '; } if ($digest) { - $sql .= " AND t.topic_digest <> 1 "; + $sql .= ' AND t.topic_digest <> 1 '; } if ($lock) { - $sql .= " AND t.topic_status <> 1 "; + $sql .= ' AND t.topic_status <> 1 '; } if ($hot !== 0) { - $sql .= " AND t.topic_replies < " . $hot . " "; + $sql .= ' AND t.topic_replies < ' . $hot . ' '; } - $sql .= " AND p.post_time<= " . $prune_ddays . " "; + $sql .= ' AND p.post_time<= ' . $prune_ddays . ' '; // Ok now we have the sql query completed, go for topic_id's and posts_id's $topics = array(); if (!$result = $GLOBALS['xoopsDB']->query($sql)) { @@ -93,10 +93,10 @@ } $topics_number = count($topics); $topic_list = implode(',', $topics); + $post_list = ''; - if (null !== $topic_list) { - $sql = "SELECT post_id FROM " . $GLOBALS['xoopsDB']->prefix("bb_posts") . " - WHERE topic_id IN (" . $topic_list . ")"; + if ('' !== $topic_list) { + $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; $posts = array(); if (!$result = $GLOBALS['xoopsDB']->query($sql)) { @@ -110,15 +110,15 @@ $post_list = implode(',', $posts); } // OKZ Now we have al posts id and topics id - if (null !== $post_list) { + if ('' !== $post_list) { // COPY POSTS TO OTHER FORUM if (null !== $store) { - $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix("bb_posts") . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix("bb_posts") . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _AM_NEWBB_ERROR; + return _MD_ERROR; } - $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix("bb_topics") . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix("bb_topics") . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { return _MD_ERROR; } @@ -187,7 +187,7 @@ $sform->addElement($days); // START irmtfan remove hardcode db access include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/footer.php"); // to include js files - mod_loadFunctions("forum", "newbb"); + mod_loadFunctions('forum', 'newbb'); $forumSelMulti = ""; // disable all categories $forumSelBox = ""; @@ -247,7 +247,7 @@ ); $sform->addElement($hot_confirmation); - $sform->addElement(/*$radiobox*/ + $sform->addElement( /*$radiobox*/ $storeEle); // irmtfan $archive_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); @@ -263,6 +263,6 @@ $sform->display(); } -echo ""; -echo "
"; +echo ''; +echo '
'; xoops_cp_footer(); diff --git a/newbb/admin/admin_forum_reorder.php b/newbb/admin/admin_forum_reorder.php index 8545b5ed..caadc59a 100644 --- a/newbb/admin/admin_forum_reorder.php +++ b/newbb/admin/admin_forum_reorder.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,109 +25,100 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; -if (XoopsRequest::getInt('cat_orders', 0, 'POST')) { - $cat_orders = XoopsRequest::getInt('cat_orders', 0, 'POST'); -} -if (XoopsRequest::getInt('orders', 0, 'POST')) { - $orders = XoopsRequest::getInt('orders', 0, 'POST'); -} -if (XoopsRequest::getInt('cat', 0, 'POST')) { - $cat = XoopsRequest::getInt('cat', 0, 'POST'); -} -if (XoopsRequest::getInt('forum', 0, 'POST')) { - $forum = XoopsRequest::getInt('forum', 0, 'POST'); -} +$cat_orders = XoopsRequest::getArray('cat_orders', null, 'POST'); +$orders = XoopsRequest::getArray('orders', null, 'POST'); +$cat = XoopsRequest::getArray('cat', null, 'POST'); +$forum = XoopsRequest::getArray('forum', null, 'POST'); if (XoopsRequest::getString('submit', '', 'POST')) { $catOrdersCount = count($cat_orders); for ($i = 0; $i < $catOrdersCount; ++$i) { - $sql = "update " . $GLOBALS['xoopsDB']->prefix("bb_categories") . " set cat_order = " . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('bb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - redirect_header("admin_forum_reorder.php", 1, _AM_NEWBB_FORUM_ERROR); + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); } } $ordersCount = count($orders); for ($i = 0; $i < $ordersCount; ++$i) { - $sql = "update " . $GLOBALS['xoopsDB']->prefix("bb_forums") . " set forum_order = " . $orders[$i] . " WHERE forum_id=" . $forum[$i]; + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - redirect_header("admin_forum_reorder.php", 1, _AM_NEWBB_FORUM_ERROR); + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); } } - redirect_header("admin_forum_reorder.php", 1, _AM_NEWBB_BOARDREORDER); + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); } else { - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); + include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); $orders = array(); $cat_orders = array(); $forum = array(); $cat = array(); xoops_cp_header(); - echo "
"; + echo '
'; if (!$newXoopsModuleGui) { //loadModuleAdminMenu(4, _AM_NEWBB_SETFORUMORDER); - echo "
"; - echo "" . _AM_NEWBB_SETFORUMORDER . ""; + echo '
'; + echo "" . _AM_NEWBB_SETFORUMORDER . ''; } else { echo $indexAdmin->addNavigation('admin_forum_reorder.php'); } - echo "" - . "'; + echo '
"; - $tform = new XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, "", ""); + echo "" . "
"; + $tform = new XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); $tform->display(); echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo ''; $forumHandler = &xoops_getmodulehandler('forum', 'newbb'); $categoryHandler = &xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); - $categories = $categoryHandler->getAll($criteriaCategory, array("cat_id", "cat_order", "cat_title")); - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', "    "); + $categories = $categoryHandler->getAll($criteriaCategory, array('cat_id', 'cat_order', 'cat_title')); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); foreach (array_keys($categories) as $c) { - echo ""; - echo ""; + echo ''; + echo "'; echo ""; - echo ""; + echo ''; + echo ''; if (!isset($forums[$c])) { continue; } $i = 0; foreach ($forums[$c] as $key => $forum) { - echo ""; - $class = ((++$i) % 2) ? "odd" : "even"; - echo ""; + echo ''; + $class = ((++$i) % 2) ? 'odd' : 'even'; + echo "'; echo ""; - echo ""; + echo ''; + echo ''; } } echo ""; - echo "
" . _AM_NEWBB_REORDERTITLE . "" . _AM_NEWBB_REORDERWEIGHT . "
" . _AM_NEWBB_REORDERTITLE . '" . _AM_NEWBB_REORDERWEIGHT . '
" . $categories[$c]->getVar("cat_title") . "
" . $categories[$c]->getVar('cat_title') . '"; echo ""; echo ""; - echo "
" . $forum['prefix'] . $forum['forum_name'] . "
" . $forum['prefix'] . $forum['forum_name'] . '"; echo $forum['prefix'] . ""; echo ""; - echo "
"; echo ""; - echo "
"; - echo ""; - echo "
"; - echo ""; + echo '
'; + echo ''; + echo ''; + echo '
'; if (!$newXoopsModuleGui) { - echo "
"; + echo '
'; } } xoops_cp_footer(); diff --git a/newbb/admin/admin_groupmod.php b/newbb/admin/admin_groupmod.php index 3cc766ad..6667a4a8 100644 --- a/newbb/admin/admin_groupmod.php +++ b/newbb/admin/admin_groupmod.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -26,23 +26,23 @@ // ------------------------------------------------------------------------ // // Author: Dirk Herrmann (AKA alfred) // // URL: http://www.mymyxoops.org/, http://simple-xoops.de/ // -// Project: The XOOPS Project // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -echo "
"; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); +echo '
'; +include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); if (!$newXoopsModuleGui) { //loadModuleAdminMenu(10,_AM_NEWBB_GROUPMOD_TITLE); - echo "
" . _AM_NEWBB_GROUPMOD_TITLE . ""; + echo "
" . _AM_NEWBB_GROUPMOD_TITLE . ''; } else { echo $indexAdmin->addNavigation('admin_groupmod.php'); } -$member_handler =& xoops_gethandler('member'); +$member_handler =&xoops_gethandler('member'); $forumHandler = &xoops_getmodulehandler('forum', 'newbb'); if (XoopsRequest::getString('submit', '', 'POST')) { $fgroups = XoopsRequest::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; - $fforum = XoopsRequest::getInt('forenid', 0, 'POST');// (int) ($_POST['forenid']); + $fforum = XoopsRequest::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); $fuser = array(); if ($fforum !== 0) { if ($fgroups !== '') { @@ -56,16 +56,17 @@ } } if ($fforum === -1) { // alle Foren - $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; } else { - $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; } if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { $mess = _AM_NEWBB_GROUPMOD_ADDMOD; } else { - $mess = _AM_NEWBB_GROUPMOD_ERRMOD . "
( " . $sql . " )"; + $mess = _AM_NEWBB_GROUPMOD_ERRMOD . '
( ' . $sql . ' )'; } - echo '
' . $mess . '


'; + redirect_header('admin_groupmod.php', 1, $mess); +// echo '
' . $mess . '


'; } } @@ -76,8 +77,8 @@ $categoryHandler = &xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); -$categories = $categoryHandler->getAll($criteriaCategory, array("cat_id", "cat_order", "cat_title")); -$forums = $forumHandler->getTree(array_keys($categories), 0, 'all', "    "); +$categories = $categoryHandler->getAll($criteriaCategory, array('cat_id', 'cat_order', 'cat_title')); +$forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); echo ''; echo ""; $groups =& $member_handler->getGroups(); foreach ($groups as $value) { - echo ' ' . $value->getVar('name') . "
"; + echo ' ' . $value->getVar('name') . '
'; } echo ""; echo ''; -echo ""; -echo "
"; -echo "
"; +echo ''; +echo '
'; +echo '
'; xoops_cp_footer(); diff --git a/newbb/admin/admin_header.php b/newbb/admin/admin_header.php index bedd4b0e..c8cfe200 100644 --- a/newbb/admin/admin_header.php +++ b/newbb/admin/admin_header.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // //include $GLOBALS['xoops']->path('include/cp_header.php'); include("../../../include/cp_header.php"); diff --git a/newbb/admin/admin_permissions.php b/newbb/admin/admin_permissions.php index db0aa2f4..2b7a6757 100644 --- a/newbb/admin/admin_permissions.php +++ b/newbb/admin/admin_permissions.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: XOOPS Foundation // -// URL: http://www.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . '/class/xoopsformloader.php'); @@ -45,7 +45,7 @@ * * Note: this is a __patchy__ solution. We should have a more extensible and flexible group permission management: not only for data architecture but also for management interface */ -class newbb_XoopsGroupPermForm extends XoopsGroupPermForm +class NewbbXoopsGroupPermForm extends XoopsGroupPermForm { /** * @param $title @@ -54,6 +54,12 @@ class newbb_XoopsGroupPermForm extends XoopsGroupPermForm * @param $permdesc * @param string $url */ + +public function __construct($title, $modid, $permname, $permdesc, $url = '') +{ + $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); +} + /** * @param $title * @param $modid @@ -61,11 +67,14 @@ class newbb_XoopsGroupPermForm extends XoopsGroupPermForm * @param $permdesc * @param string $url */ + + /* public function newbb_XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url = "") { - $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); +// $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); + self::__construct($title, $modid, $permname, $permdesc, $url); } - +*/ /** * @return string */ @@ -82,7 +91,7 @@ public function render() foreach (array_keys($glist) as $i) { // get selected item id(s) for each group $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); - $ele = new newbbXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); + $ele = new NewbbXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); $ele->setOptionTree($this->_itemTree); $this->addElement($ele); unset($ele); @@ -116,9 +125,9 @@ public function render() } /** - * Class newbbXoopsGroupFormCheckBox + * Class NewbbXoopsGroupFormCheckBox */ -class newbbXoopsGroupFormCheckBox extends XoopsGroupFormCheckBox +class NewbbXoopsGroupFormCheckBox extends XoopsGroupFormCheckBox { /** * @param $caption @@ -137,7 +146,7 @@ public function __construct($caption, $name, $groupId, $values = null) * @param string $prefix * @param array $parentIds */ - public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) + public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds = array()) { if ($option['id'] > 0) { $tree .= $prefix . "getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; @@ -179,18 +188,18 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) $perms = $newbbperm_handler->getValidForumPerms(); switch ($action) { - case "template": + case 'template': xoops_cp_header(); echo $indexAdmin->addNavigation('admin_permissions.php'); - echo "" . _AM_NEWBB_PERM_ACTION . ""; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', "get"); - $op_select = new XoopsFormSelect("", 'action'); + echo "" . _AM_NEWBB_PERM_ACTION . ''; + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray(array( - "no" => _SELECT, - "template" => _AM_NEWBB_PERM_TEMPLATE, - "apply" => _AM_NEWBB_PERM_TEMPLATEAPP, - "default" => _AM_NEWBB_PERM_SETBYGROUP + 'no' => _SELECT, + 'template' => _AM_NEWBB_PERM_TEMPLATE, + 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP, + 'default' => _AM_NEWBB_PERM_SETBYGROUP )); $opform->addElement($op_select); $opform->display(); @@ -211,10 +220,10 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) if ($ii % 5 === 0) { $ret_ele .= ''; } - $checked = in_array("forum_" . $perm, $selected) ? " checked='checked'" : ""; + $checked = in_array('forum_' . $perm, $selected) ? " checked='checked'" : ''; $option_id = $perm . '_' . $i; $option_ids[] = $option_id; - $ret_ele .= '' . CONSTANT("_AM_NEWBB_CAN_" . strtoupper($perm)) . '
'; + $ret_ele .= '' . constant("_AM_NEWBB_CAN_" . strtoupper($perm)) . '
'; } $ret_ele .= ''; $ret_ele .= _ALL . ' '; @@ -237,29 +246,29 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) xoops_cp_footer(); break; - case "template_save": + case 'template_save': // $res = $newbbperm_handler->setTemplate($_POST['perms'], $groupid = 0); $res = $newbbperm_handler->setTemplate(XoopsRequest::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { - redirect_header("admin_permissions.php?action=template", 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); + redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); } else { - redirect_header("admin_permissions.php?action=template", 2, _AM_NEWBB_PERM_TEMPLATE_ERROR); + redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE_ERROR); } break; // exit(); - case "apply": + case 'apply': $perm_template = $newbbperm_handler->getTemplate(); if ($perm_template === null) { - redirect_header("admin_permissions.php?action=template", 2, _AM_NEWBB_PERM_TEMPLATE); + redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } xoops_cp_header(); echo $indexAdmin->addNavigation('admin_permissions.php'); - echo "" . _AM_NEWBB_PERM_ACTION . ""; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', "get"); - $op_select = new XoopsFormSelect("", 'action'); + echo "" . _AM_NEWBB_PERM_ACTION . ''; + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); - $op_select->addOptionArray(array("no" => _SELECT, "template" => _AM_NEWBB_PERM_TEMPLATE, "apply" => _AM_NEWBB_PERM_TEMPLATEAPP)); + $op_select->addOptionArray(array('no' => _SELECT, 'template' => _AM_NEWBB_PERM_TEMPLATE, 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP)); $opform->addElement($op_select); $opform->display(); @@ -269,12 +278,12 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) $categories = $categoryHandler->getList($criteriaCategory); $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); - $forums = $forumHandler->getTree(array_keys($categories), 0, "all"); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { - $fm_options[-1 * $c - 1000] = " "; - $fm_options[-1 * $c] = "[" . $categories[$c] . "]"; + $fm_options[-1 * $c - 1000] = ' '; + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; foreach (array_keys($forums[$c]) as $f) { - $fm_options[$f] = $forums[$c][$f]["prefix"] . $forums[$c][$f]["forum_name"]; + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; } } unset($forums, $categories); @@ -292,7 +301,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) xoops_cp_footer(); break; - case "apply_save": + case 'apply_save': if (!XoopsRequest::getArray('forums', '', 'POST')) { break; } @@ -302,58 +311,77 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) } $newbbperm_handler->applyTemplate($forum, $module_id); } - mod_clearCacheFile("permission", "newbb"); - redirect_header("admin_permissions.php", 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED); + mod_clearCacheFile('permission', 'newbb'); + redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED); break; default: xoops_cp_header(); + + + $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + $criteriaCategory->setSort('cat_order'); + $categories = $categoryHandler->getList($criteriaCategory); + + if (0 === count($categories)) { + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); + } + + $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); + + if (0 === count($forums)) { + redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); + } + + echo $indexAdmin->addNavigation('admin_permissions.php'); - echo "" . _AM_NEWBB_PERM_ACTION . ""; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', "get"); - $op_select = new XoopsFormSelect("", 'action'); + echo "" . _AM_NEWBB_PERM_ACTION . ''; + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray(array( - "no" => _SELECT, - "template" => _AM_NEWBB_PERM_TEMPLATE, - "apply" => _AM_NEWBB_PERM_TEMPLATEAPP, - "default" => _AM_NEWBB_PERM_SETBYGROUP + 'no' => _SELECT, + 'template' => _AM_NEWBB_PERM_TEMPLATE, + 'apply' => _AM_NEWBB_PERM_TEMPLATEAPP, + 'default' => _AM_NEWBB_PERM_SETBYGROUP )); $opform->addElement($op_select); $opform->display(); - $op_options = array("category" => _AM_NEWBB_CAT_ACCESS); - $fm_options = array("category" => array("title" => _AM_NEWBB_CAT_ACCESS, "item" => "category_access", "desc" => "", "anonymous" => true)); + $op_options = array('category' => _AM_NEWBB_CAT_ACCESS); + $fm_options = array('category' => array('title' => _AM_NEWBB_CAT_ACCESS, 'item' => 'category_access', 'desc' => '', 'anonymous' => true)); foreach ($perms as $perm) { - $op_options[$perm] = CONSTANT("_AM_NEWBB_CAN_" . strtoupper($perm)); - $fm_options[$perm] = array("title" => CONSTANT("_AM_NEWBB_CAN_" . strtoupper($perm)), "item" => "forum_" . $perm, "desc" => "", "anonymous" => true); + $op_options[$perm] = constant("_AM_NEWBB_CAN_" . strtoupper($perm)); + $fm_options[$perm] = array('title' => constant("_AM_NEWBB_CAN_" . strtoupper($perm)), "item" => "forum_" . $perm, "desc" => "", "anonymous" => true); } $op_keys = array_keys($op_options); $op = strtolower(XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'COOKIE'), 'GET')); if (empty($op)) { $op = $op_keys[0]; - setCookie("op", isset($op_keys[1]) ? $op_keys[1] : ""); + setcookie('op', isset($op_keys[1]) ? $op_keys[1] : ''); } elseif (false !== ($key = array_search($op, $op_keys))) { - setCookie("op", isset($op_keys[$key + 1]) ? $op_keys[$key + 1] : ""); + setcookie('op', isset($op_keys[$key + 1]) ? $op_keys[$key + 1] : ''); } - $opform = new XoopsSimpleForm('', 'opform', 'admin_permissions.php', "get"); - $op_select = new XoopsFormSelect("", 'op', $op); + $opform = new XoopsSimpleForm('', 'opform', 'admin_permissions.php', 'get'); + $op_select = new XoopsFormSelect('', 'op', $op); $op_select->setExtra('onchange="document.forms.opform.submit()"'); $op_select->addOptionArray($op_options); $opform->addElement($op_select); $opform->display(); - $perm_desc = ""; + $perm_desc = ''; - $form = new newbb_XoopsGroupPermForm($fm_options[$op]["title"], $module_id, $fm_options[$op]["item"], $fm_options[$op]["desc"], 'admin/admin_permissions.php', $fm_options[$op]["anonymous"]); + $form = new NewbbXoopsGroupPermForm($fm_options[$op]["title"], $module_id, $fm_options[$op]["item"], $fm_options[$op]["desc"], 'admin/admin_permissions.php', $fm_options[$op]["anonymous"]); $categoryHandler = &xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - if ($op === "category") { + if ($op === 'category') { foreach (array_keys($categories) as $key) { $form->addItem($key, $categories[$key]); } @@ -361,12 +389,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) } else { $forumHandler = &xoops_getmodulehandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, "all"); - foreach (array_keys($forums) as $c) { - $key_c = -1 * $c; - $form->addItem($key_c, "[" . $categories[$c] . "]"); - foreach (array_keys($forums[$c]) as $f) { - $pid = $forums[$c][$f]['parent_forum'] ?: $key_c; - $form->addItem($f, $forums[$c][$f]["prefix"] . $forums[$c][$f]["forum_name"], $pid); + if (count($forums) > 0) { + foreach (array_keys($forums) as $c) { + $key_c = -1 * $c; + $form->addItem($key_c, "[" . $categories[$c] . "]"); + foreach (array_keys($forums[$c]) as $f) { + $pid = $forums[$c][$f]['parent_forum'] ?: $key_c; + $form->addItem($f, $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name'], $pid); + } } } unset($forums, $categories); @@ -374,9 +404,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, array $parentIds) $form->display(); // Since we can not control the permission update, a trick is used here - $permission_handler =& xoops_getmodulehandler("permission", "newbb"); + $permission_handler =& xoops_getmodulehandler('permission', 'newbb'); $permission_handler->createPermData(); - mod_clearCacheFile("permission", "newbb"); + mod_clearCacheFile('permission', 'newbb'); xoops_cp_footer(); break; } diff --git a/newbb/admin/admin_report.php b/newbb/admin/admin_report.php index 4c6bb508..be804462 100644 --- a/newbb/admin/admin_report.php +++ b/newbb/admin/admin_report.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; @@ -34,18 +34,18 @@ $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); $item = XoopsRequest::getString('op', XoopsRequest::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); -$start = XoopsRequest::getInt('start', XoopsRequest::getInt('start', 0, 'GET'), 'POST'); //$start = !empty($_POST['start']) ? (int) ( $_POST['start'] ) : (int) ( @$_GET['start'] ); +$start = XoopsRequest::getInt('start', XoopsRequest::getInt('start', 0, 'GET'), 'POST'); //$start = !empty($_POST['start']) ? (int)( $_POST['start'] ) : (int)( @$_GET['start'] ); $reportHandler =& xoops_getmodulehandler('report', 'newbb'); xoops_cp_header(); -echo "
"; +echo '
'; switch ($op) { - case "save": + case 'save': $report_ids = XoopsRequest::getArray('report_id', '', 'POST'); // $report_ids = XoopsRequest::getInt('report_id', 0, 'POST'); //$_POST['report_id']; // irmtfan add error redirect header if (0 === count($report_ids)) { - redirect_header("admin_report.php?item={$item}" . (empty($start) ? "" : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); + redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); } $report_memos = XoopsRequest::getArray('report_memo', array(), 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array(); foreach ($report_ids as $rid => $value) { @@ -53,20 +53,20 @@ continue; } $report_obj = $reportHandler->get($rid); - $report_obj->setVar("report_result", 1); - $report_obj->setVar("report_memo", $report_memos[$rid]); + $report_obj->setVar('report_result', 1); + $report_obj->setVar('report_memo', $report_memos[$rid]); $reportHandler->insert($report_obj); } // irmtfan add message - redirect_header("admin_report.php?item={$item}" . (empty($start) ? "" : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE); + redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE); break; - case "delete": + case 'delete': $report_ids = XoopsRequest::getArray('report_id', array(), 'POST');// $_POST['report_id']; // irmtfan add error redirect header if (0 === count($report_ids)) { - redirect_header("admin_report.php?item={$item}" . (empty($start) ? "" : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); + redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); } foreach ($report_ids as $rid => $value) { if (!$value) { @@ -77,14 +77,14 @@ } } // irmtfan add message - redirect_header("admin_report.php?item={$item}" . (empty($start) ? "" : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE); + redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE); break; - case "default": + case 'default': default: - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname", "n") . "/class/xoopsformloader.php"); - mod_loadFunctions("user", "newbb"); + include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/xoopsformloader.php'); + mod_loadFunctions('user', 'newbb'); if ($item !== 'processed') { $process_result = 0; @@ -105,64 +105,64 @@ //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN); // else echo $indexAdmin->addNavigation('admin_report.php') ; - echo "
" . $title_other . "

"; + echo "
" . $title_other . '

'; echo '
'; echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo ''; - $reports = $reportHandler->getAllReports(0, "ASC", $limit, $start, $process_result); + $reports = $reportHandler->getAllReports(0, 'ASC', $limit, $start, $process_result); foreach ($reports as $report) { - $post_link = "getVar('dirname') . "/viewtopic.php?post_id=" . $report['post_id'] . "&topic_id=" . $report['topic_id'] . "&forum=" . $report['forum_id'] . "&viewmode=thread\" target=\"checkreport\">" . $myts->htmlSpecialChars($report['subject']) . ""; + $post_link = "getVar('dirname') . "/viewtopic.php?post_id=" . $report['post_id'] . "&topic_id=" . $report['topic_id'] . "&forum=" . $report['forum_id'] . "&viewmode=thread\" target=\"checkreport\">" . $myts->htmlspecialchars($report['subject']) . ''; $checkbox = ''; if ($item !== 'processed') { $memo = ''; } else { - $memo = $myts->htmlSpecialChars($report['report_memo']); + $memo = $myts->htmlspecialchars($report['report_memo']); } echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; echo ""; - echo ""; - $uid = (int) ($report['reporter_uid']); + echo ''; + $uid = (int)($report['reporter_uid']); $reporter_name = newbb_getUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']); - $reporter = (!empty($uid)) ? "" . $reporter_name . "
" : ""; + $reporter = (!empty($uid)) ? "" . $reporter_name . '
' : ''; - echo ""; - echo ""; + echo "'; + echo ''; echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; echo ""; } - $buttons = ""; + $buttons = ''; if ($item !== 'processed') { $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); - $buttons .= $submit->render() . " "; + $buttons .= $submit->render() . ' '; } $delete = new XoopsFormButton('', 'delete', _DELETE, 'submit'); - $buttons .= $delete->render() . " "; + $buttons .= $delete->render() . ' '; $cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'reset'); $buttons .= $cancel->render(); echo ""; $hidden = new XoopsFormHidden('start', $start); echo $hidden->render(); $hidden = new XoopsFormHidden('item', $item); - echo $hidden->render() . ""; + echo $hidden->render() . ''; - echo "
" . _AM_NEWBB_REPORTTITLE . "" . $extra . "
" . _AM_NEWBB_REPORTTITLE . '" . $extra . '
" . _AM_NEWBB_REPORTPOST . ': ' . $post_link . "" . $report['report_id'] . "
' . _AM_NEWBB_REPORTPOST . ': ' . $post_link . '" . $report['report_id'] . '
" . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . "' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlspecialchars($report['report_text']) . '" . $reporter . long2ip($report['reporter_ip']) . "
" . $reporter . long2ip($report['reporter_ip']) . '
" . _AM_NEWBB_REPORTMEMO . ': ' . $memo . "" . $checkbox . "
' . _AM_NEWBB_REPORTMEMO . ': ' . $memo . '" . $checkbox . '
{$buttons}
"; + echo ''; - $nav = new XoopsPageNav($reportHandler->getCount(new Criteria("report_result", $process_result)), $limit, $start, "start", "item=" . $item); + $nav = new XoopsPageNav($reportHandler->getCount(new Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); echo $nav->renderNav(4); - echo "
"; + echo '
'; break; } diff --git a/newbb/admin/admin_synchronization.php b/newbb/admin/admin_synchronization.php index b4496061..bedf86b7 100644 --- a/newbb/admin/admin_synchronization.php +++ b/newbb/admin/admin_synchronization.php @@ -2,7 +2,7 @@ /** * newbb * - * @copyright The XOOPS project http://www.xoops.org/ + * @copyright XOOPS Project (http://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 @@ -22,19 +22,19 @@ // else $form .= $indexAdmin->addNavigation('admin_synchronization.php'); //if (!empty($_GET['type'])) { -$start = XoopsRequest::getInt('start', 0, 'GET'); //(int) ( @$_GET['start'] ); +$start = XoopsRequest::getInt('start', 0, 'GET'); //(int)( @$_GET['start'] ); switch (XoopsRequest::getString('type', '', 'GET')) {// @$_GET['type']) // irmtfan rewrite forum sync case "forum": $result = newbb_synchronization("forum"); if (!empty($result)) { - redirect_header("admin_synchronization.php", 2, _AM_NEWBB_SYNC_TYPE_FORUM . "
" . _AM_NEWBB_DATABASEUPDATED); + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . "
" . _AM_NEWBB_DATABASEUPDATED); } break; // irmtfan rewrite topic sync case "topic": - $limit = XoopsRequest::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int) ($_GET['limit']); + $limit = XoopsRequest::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); $topicHandler =& xoops_getmodulehandler('topic', 'newbb'); $criteria = new Criteria("approved", 1); if ($start >= ($count = $topicHandler->getCount($criteria))) { @@ -47,18 +47,18 @@ $topicHandler->synchronization($tObj); } $result = newbb_synchronization("topic"); - redirect_header("admin_synchronization.php?type=topic&start=" . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); + redirect_header('admin_synchronization.php?type=topic&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); break; // irmtfan rewrite post sync case "post": $result = newbb_synchronization("post"); if (!empty($result)) { - redirect_header("admin_synchronization.php", 2, _AM_NEWBB_SYNC_TYPE_POST . "
" . _AM_NEWBB_DATABASEUPDATED); + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . "
" . _AM_NEWBB_DATABASEUPDATED); } break; // irmtfan - user is not in recon functions - only here case "user": - $limit = XoopsRequest::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int) ($_GET['limit']); + $limit = XoopsRequest::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); $user_handler =& xoops_gethandler('user'); if ($start >= ($count = $user_handler->getCount())) { break; @@ -92,7 +92,7 @@ ); } - redirect_header("admin_synchronization.php?type=user&start=" . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); + redirect_header('admin_synchronization.php?type=user&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); break; // irmtfan rewrite stats reset case "stats": @@ -102,7 +102,7 @@ case "read": $result = newbb_synchronization(array("readtopic", "readforum")); if (!empty($result)) { - redirect_header("admin_synchronization.php", 2, _AM_NEWBB_SYNC_TYPE_READ . "
" . _AM_NEWBB_DATABASEUPDATED); + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . "
" . _AM_NEWBB_DATABASEUPDATED); } exit(); // END irmtfan add read sync diff --git a/newbb/admin/admin_type_manager.php b/newbb/admin/admin_type_manager.php index cfe9ff43..0f96e5ce 100644 --- a/newbb/admin/admin_type_manager.php +++ b/newbb/admin/admin_type_manager.php @@ -3,19 +3,19 @@ * Topic type management for newbb * * - * @copyright The XOOPS project http://www.xoops.org/ + * @copyright XOOPS Project (http://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @author Taiwen Jiang (phppp or D.J.) - * @since 4.00 + * @author Taiwen Jiang (phppp or D.J.) + * @since 4.00 * @version $Id: admin_type_manager.php 62 2012-08-17 10:15:26Z alfred $ * @package module::newbb */ include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -echo "
"; -echo "
"; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"); +echo '
'; +echo '
'; +include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); if ($newXoopsModuleGui) { echo $indexAdmin->addNavigation('admin_type_manager.php'); @@ -36,15 +36,16 @@ * */ $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET');// !empty($_GET['op'])? $_GET['op'] : ( !empty($_POST['op']) ? $_POST['op'] : "" ); -if (!in_array($op, array("save_type", "delete", "template", "save_template", "apply", "save_apply", "forum", "edit_forum", "save_forum", "add"))) { - $op = ""; +if (!in_array($op, array('save_type', 'delete', 'template', 'save_template', 'apply', 'save_apply', 'forum', 'edit_forum', 'save_forum', 'add'), true)) { + $op = ''; } $type_handler =& xoops_getmodulehandler('type', 'newbb'); switch ($op) { - case "save_type": - $type_names = XoopsRequest::getString('type_name', '', 'POST');// $_POST['type_name']; + case 'save_type': + $type_names0 = $_POST['type_name']; + $type_names = XoopsRequest::getArray('type_name', null, 'POST');// $_POST['type_name']; $type_del = array(); foreach (array_keys($type_names) as $key) { if (XoopsRequest::getBool('isnew', '', 'POST')) { @@ -52,26 +53,37 @@ } elseif (!$type_obj =& $type_handler->get($key)) { continue; } - if (XoopsRequest::getArraay("type_del[$key]", '', 'POST')) { + +// if (XoopsRequest::getArray("type_del[$key]", '', 'POST')) { + if (XoopsRequest::getArray('type_del', '', 'POST')[$key]) { $type_del[] = $key; continue; } else { - foreach (array("type_name", "type_color", "type_description") as $var) { - $type_obj->setVar($var, XoopsRequest::getString($var[$key], '', 'POST')); + foreach (array('type_name', 'type_color', 'type_description') as $var) { + +// if ($type_obj->getVar($var) != @$_POST[$var][$key]) { +// $type_obj->setVar($var, @$_POST[$var][$key]); +// } + + if ($type_obj->getVar($var) != XoopsRequest::getArray($var, '', 'POST')[$key]) { + $type_obj->setVar($var, XoopsRequest::getArray($var, '', 'POST')[$key]); + } + +// $type_obj->setVar($var, XoopsRequest::getArray($var, '', 'POST')[$key]); } $type_handler->insert($type_obj); unset($type_obj); } } if (count($type_del) > 0) { - $type_list = $type_handler->getList(new Criteria("type_id", "(" . implode(", ", $type_del) . ")", "IN")); - xoops_confirm(array('op' => 'delete', 'type_del' => serialize($type_del)), xoops_getenv("PHP_SELF"), sprintf(_AM_NEWBB_TODEL_TYPE, implode(", ", array_values($type_list))), '', false); + $type_list = $type_handler->getList(new Criteria('type_id', '(' . implode(", ", $type_del) . ')', 'IN')); + xoops_confirm(array('op' => 'delete', 'type_del' => serialize($type_del)), xoops_getenv("PHP_SELF"), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); } else { - redirect_header(xoops_getenv("PHP_SELF"), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); } break; - case "delete": + case 'delete': $type_dels = @unserialize(XoopsRequest::getString('type_del', '', 'POST')); foreach ($type_dels as $key) { if (!$type_obj =& $type_handler->get($key)) { @@ -80,13 +92,13 @@ $type_handler->delete($type_obj); unset($type_obj); } - redirect_header(xoops_getenv("PHP_SELF"), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); break; - case "template": + case 'template': $types_obj = $type_handler->getAll(); if (count($types_obj) === 0) { - redirect_header(xoops_getenv("PHP_SELF"), 2, _AM_NEWBB_TYPE_ADD); + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } echo ""; @@ -96,23 +108,23 @@ echo ""; echo _AM_NEWBB_TYPE_TEMPLATE_APPLY . " | "; echo ""; - echo _AM_NEWBB_TYPE_FORUM . " | "; - echo "
"; - echo "
"; - echo "
"; + echo _AM_NEWBB_TYPE_FORUM . ' | '; + echo '
'; + echo '
'; + echo '
'; - echo "
" . _AM_NEWBB_TYPE_TEMPLATE . ""; - echo "
"; + echo "
" . _AM_NEWBB_TYPE_TEMPLATE . ''; + echo '
'; - echo "
"; + echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo "'; + echo ''; - if ($templates = mod_loadCacheFile("type_template")) { + if ($templates = mod_loadCacheFile('type_template')) { arsort($templates); foreach ($templates as $order => $key) { if (!isset($types_obj[$key])) { @@ -121,9 +133,9 @@ $type_obj =& $types_obj[$key]; echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo ''; + echo ''; unset($types_obj[$key]); } echo ""; @@ -131,46 +143,46 @@ foreach ($types_obj as $key => $type_obj) { echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo ''; + echo ''; } echo "
" . _AM_NEWBB_TYPE_ORDER . "" . _AM_NEWBB_TYPE_NAME . "" . _AM_NEWBB_TYPE_DESCRIPTION . "
" . _AM_NEWBB_TYPE_ORDER . '" . _AM_NEWBB_TYPE_NAME . '" . _AM_NEWBB_TYPE_DESCRIPTION . '
" . $type_obj->getVar("type_name") . "" . $type_obj->getVar("type_description") . "
" . $type_obj->getVar("type_name") . '' . $type_obj->getVar("type_description") . '
" . $type_obj->getVar("type_name") . "" . $type_obj->getVar("type_description") . "
" . $type_obj->getVar("type_name") . '' . $type_obj->getVar('type_description') . '
"; - echo _AM_NEWBB_TYPE_ORDER_DESC . "

"; + echo _AM_NEWBB_TYPE_ORDER_DESC . '

'; echo ""; echo " "; echo ""; - echo "
"; - echo "
"; - echo "
"; + echo ''; + echo ''; + echo '
'; break; - case "save_template": + case 'save_template': $templates = array_flip(array_filter(XoopsRequest::getArray('type_order', array(), 'POST'))); - mod_createCacheFile($templates, "type_template"); - redirect_header(xoops_getenv("PHP_SELF") . "?op=template", 2, _MD_DBUPDATED); + mod_createCacheFile($templates, 'type_template'); + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_DBUPDATED); break; - case "apply": - if (!$templates = mod_loadCacheFile("type_template")) { - redirect_header(xoops_getenv("PHP_SELF") . "?op=template", 2, _AM_NEWBB_TYPE_TEMPLATE); + case 'apply': + if (!$templates = mod_loadCacheFile('type_template')) { + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); } $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); - $categories = $categoryHandler->getList($criteriaCategory); + $categories = $categoryHandler->getList($criteriaCategory); $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); - $forums = $forumHandler->getTree(array_keys($categories), 0, "all"); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { - $fm_options[-1 * $c] = "[" . $categories[$c] . "]"; + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; foreach (array_keys($forums[$c]) as $f) { - $fm_options[$f] = $forums[$c][$f]["prefix"] . $forums[$c][$f]["forum_name"]; + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; } } unset($forums, $categories); - $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv("PHP_SELF"), "post"); + $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post'); $fm_select = new XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); $fm_select->addOptionArray($fm_options); $fmform->addElement($fm_select); @@ -181,31 +193,31 @@ $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); - echo "
" . _AM_NEWBB_ACTION . ""; - echo "
"; + echo "
" . _AM_NEWBB_ACTION . ''; + echo '
'; echo ""; - echo _AM_NEWBB_TYPE_ADD . " | "; + echo _AM_NEWBB_TYPE_ADD . ' | '; echo ""; - echo _AM_NEWBB_TYPE_TEMPLATE . " | "; + echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; echo ""; - echo _AM_NEWBB_TYPE_TEMPLATE_APPLY . " | "; + echo _AM_NEWBB_TYPE_TEMPLATE_APPLY . ' | '; echo ""; - echo _AM_NEWBB_TYPE_FORUM . " | "; - echo "
"; - echo "
"; - echo "
"; + echo _AM_NEWBB_TYPE_FORUM . ' | '; + echo '
'; + echo '
'; + echo '
'; - echo "
" . _AM_NEWBB_TYPE_TEMPLATE . ""; - echo "
"; + echo "
" . _AM_NEWBB_TYPE_TEMPLATE . ''; + echo '
'; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo "'; + echo ''; - $types_obj = $type_handler->getAll(new Criteria("type_id", "(" . implode(", ", array_values($templates)) . ")", "IN")); + $types_obj = $type_handler->getAll(new Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); arsort($templates); foreach ($templates as $order => $key) { if (!isset($types_obj[$key])) { @@ -213,21 +225,21 @@ } $type_obj =& $types_obj[$key]; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo ''; + echo ''; + echo ''; unset($types_obj[$key]); } - echo "
" . _AM_NEWBB_TYPE_NAME . "" . _AM_NEWBB_TYPE_ORDER . "" . _AM_NEWBB_TYPE_DESCRIPTION . "
" . _AM_NEWBB_TYPE_NAME . '" . _AM_NEWBB_TYPE_ORDER . '" . _AM_NEWBB_TYPE_DESCRIPTION . '
" . $type_obj->getVar("type_name") . "" . $order . "" . $type_obj->getVar("type_description") . "
" . $type_obj->getVar('type_name') . '' . $order . '' . $type_obj->getVar('type_description') . '
"; - echo "
"; + echo ''; + echo '
'; $fmform->display(); - echo "
"; + echo '
'; break; - case "save_apply": - if (!$templates = mod_loadCacheFile("type_template")) { - redirect_header(xoops_getenv("PHP_SELF") . "?op=template", 2, _AM_NEWBB_TYPE_TEMPLATE); + case 'save_apply': + if (!$templates = mod_loadCacheFile('type_template')) { + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); } foreach (XoopsRequest::getArray('forums', array(), 'POST') as $forum) { if ($forum < 1) { @@ -235,31 +247,31 @@ } $type_handler->updateByForum($forum, array_flip($templates)); } - redirect_header(xoops_getenv("PHP_SELF"), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); break; - case "forum": + case 'forum': $categoryHandler =& xoops_getmodulehandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (empty($categories)) { - redirect_header("admin_cat_manager.php", 2, _AM_NEWBB_CREATENEWCATEGORY); + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); - $forums = $forumHandler->getTree(array_keys($categories)); + $forums = $forumHandler->getTree(array_keys($categories)); if (empty($forums)) { - redirect_header("admin_forum_manager.php", 2, _AM_NEWBB_CREATENEWFORUM); + redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); } foreach (array_keys($forums) as $c) { - $fm_options[-1 * $c] = "[" . $categories[$c] . "]"; + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; foreach (array_keys($forums[$c]) as $f) { - $fm_options[$f] = $forums[$c][$f]["prefix"] . $forums[$c][$f]["forum_name"]; + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; } } unset($forums, $categories); - $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv("PHP_SELF"), "post"); + $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post'); $fm_select = new XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); $fm_select->addOptionArray($fm_options); $fmform->addElement($fm_select); @@ -270,7 +282,7 @@ $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); - echo "
" . _AM_NEWBB_ACTION . ""; + echo "
" . _AM_NEWBB_ACTION . ''; echo "
"; echo ""; echo _AM_NEWBB_TYPE_ADD . " | "; @@ -278,154 +290,154 @@ echo _AM_NEWBB_TYPE_TEMPLATE . " | "; echo ""; echo _AM_NEWBB_TYPE_FORUM . " | "; - echo "
"; + echo '
'; echo "
"; echo "
"; - echo "
" . _AM_NEWBB_TYPE_FORUM . ""; + echo "
" . _AM_NEWBB_TYPE_FORUM . ''; echo "
"; $fmform->display(); - echo "
"; + echo '
'; break; - case "edit_forum": + case 'edit_forum': if (!(XoopsRequest::getInt('forum', 0, 'POST')) || XoopsRequest::getInt('forum', 0, 'POST') < 1) { - redirect_header(xoops_getenv("PHP_SELF") . "?op=forum", 2, _AM_NEWBB_TYPE_FORUM); + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); } $forumHandler =& xoops_getmodulehandler('forum', 'newbb'); if (!$forum_obj = $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST'))) { - redirect_header(xoops_getenv("PHP_SELF") . "?op=forum", 2, _AM_NEWBB_TYPE_FORUM); + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); } $types_obj = $type_handler->getAll(); if (count($types_obj) === 0) { - redirect_header(xoops_getenv("PHP_SELF"), 2, _AM_NEWBB_TYPE_ADD); + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } - echo "
" . _AM_NEWBB_ACTION . ""; - echo "
"; + echo "
" . _AM_NEWBB_ACTION . ''; + echo '
'; echo ""; echo _AM_NEWBB_TYPE_ADD . " | "; echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . " | "; echo ""; - echo _AM_NEWBB_TYPE_FORUM . " | "; - echo "
"; - echo "
"; - echo "
"; - echo "
" . _AM_NEWBB_TYPE_FORUM . ""; - echo "
"; - - echo "
" . _AM_NEWBB_TYPE_FORUM . " - " . $forum_obj->getVar("forum_name") . ""; - echo "
"; + echo _AM_NEWBB_TYPE_FORUM . ' | '; + echo '
'; + echo '
'; + echo '
'; + echo "
" . _AM_NEWBB_TYPE_FORUM . ''; + echo '
'; + + echo "
" . _AM_NEWBB_TYPE_FORUM . " - " . $forum_obj->getVar("forum_name") . ''; + echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo "'; + echo ''; $types = $type_handler->getByForum(XoopsRequest::getInt('forum', 0, 'POST')); $types_order = array(); foreach ($types as $key => $type) { - $types_order[] = $type["type_order"]; + $types_order[] = $type['type_order']; } array_multisort($types_order, $types); foreach ($types as $key => $type) { - if (!isset($types_obj[$type["type_id"]])) { + if (!isset($types_obj[$type['type_id']])) { continue; } - $type_obj =& $types_obj[$type["type_id"]]; + $type_obj =& $types_obj[$type['type_id']]; echo ""; echo ""; echo ""; - echo ""; - echo ""; - unset($types_obj[$type["type_id"]]); + echo "'; + echo ''; + unset($types_obj[$type['type_id']]); } echo ""; foreach ($types_obj as $key => $type_obj) { echo ""; echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo ''; + echo ''; } echo "
" . _AM_NEWBB_TYPE_ORDER . "" . _AM_NEWBB_TYPE_NAME . "" . _AM_NEWBB_TYPE_DESCRIPTION . "
" . _AM_NEWBB_TYPE_ORDER . '" . _AM_NEWBB_TYPE_NAME . '" . _AM_NEWBB_TYPE_DESCRIPTION . '
" . $type_obj->getVar("type_name") . "" . $type_obj->getVar("type_description") . "
" . $type_obj->getVar('type_description') . '
" . $type_obj->getVar("type_name") . "" . $type_obj->getVar("type_description") . "
" . $type_obj->getVar("type_name") . '' . $type_obj->getVar('type_description') . '
"; - echo "
  • " . _AM_NEWBB_TYPE_EDITFORUM_DESC . "
  • "; - echo "
  • " . _AM_NEWBB_TYPE_ORDER_DESC . "

  • "; + echo '
    • ' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '
    • '; + echo '
    • ' . _AM_NEWBB_TYPE_ORDER_DESC . '

    • '; echo ""; echo ""; echo " "; echo ""; - echo "
"; - echo ""; - echo "
"; + echo ''; + echo ''; + echo '
'; break; - case "save_forum": + case 'save_forum': if (!(XoopsRequest::getInt('forum', 0, 'POST')) || XoopsRequest::getInt('forum', 0, 'POST') < 1) { - redirect_header(xoops_getenv("PHP_SELF") . "?op=forum", 2, _AM_NEWBB_TYPE_FORUM); + redirect_header(xoops_getenv('PHP_SELF') . "?op=forum", 2, _AM_NEWBB_TYPE_FORUM); } $type_handler->updateByForum(XoopsRequest::getInt('forum', 0, 'POST'), XoopsRequest::getInt('type_order', 0, 'POST')); - redirect_header(xoops_getenv("PHP_SELF") . "?op=forum", 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF') . "?op=forum", 2, _MD_DBUPDATED); break; - case "add": + case 'add': default: $types_obj = $type_handler->getAll(); if (count($types_obj) === 0) { - $op = "add"; + $op = 'add'; $title = _AM_NEWBB_TYPE_ADD; } else { $title = _AM_NEWBB_TYPE_LIST; } - if ($op !== "add") { - echo "
" . _AM_NEWBB_ACTION . ""; - echo "
"; + if ($op !== 'add') { + echo "
" . _AM_NEWBB_ACTION . ''; + echo '
'; echo ""; echo _AM_NEWBB_TYPE_ADD . " | "; echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . " | "; echo ""; - echo _AM_NEWBB_TYPE_FORUM . " | "; - echo "
"; - echo "
"; - echo "
"; + echo _AM_NEWBB_TYPE_FORUM . ' | '; + echo '
'; + echo '
'; + echo '
'; } - echo "
" . $title . ""; - echo "
"; + echo "
" . $title . ''; + echo '
'; - echo "
"; + echo ""; echo ""; echo ""; - if ($op !== "add") { - echo ""; + if ($op !== 'add') { + echo "'; } - echo ""; - echo ""; - echo ""; - echo ""; + echo "'; + echo "'; + echo "'; + echo ''; $isColorpicker = require_once($GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php')); - if ($op !== "add") { + if ($op !== 'add') { foreach ($types_obj as $key => $type_obj) { echo ""; echo ""; echo ""; if ($isColorpicker) { $form_colorpicker = new XoopsFormColorPicker("", "type_color[{$key}]", $type_obj->getVar("type_color")); - echo ""; + echo ''; } else { echo ""; } echo ""; - echo ""; + echo ''; } echo ""; echo ""; if ($isColorpicker) { - $form_colorpicker = new XoopsFormColorPicker("", "type_color[{$i}]", ""); - echo ""; + $form_colorpicker = new XoopsFormColorPicker('', "type_color[{$i}]", ''); + echo ''; } else { echo ""; } echo ""; - echo ""; + echo ''; } echo "
" . _DELETE . "" . _DELETE . '" . _AM_NEWBB_TYPE_NAME . "" . _AM_NEWBB_TYPE_COLOR . "" . _AM_NEWBB_TYPE_DESCRIPTION . "
" . _AM_NEWBB_TYPE_NAME . '" . _AM_NEWBB_TYPE_COLOR . '" . _AM_NEWBB_TYPE_DESCRIPTION . '
" . $form_colorpicker->render() . "' . $form_colorpicker->render() . '
"; } else { @@ -433,13 +445,13 @@ echo "
" . $form_colorpicker->render() . "' . $form_colorpicker->render() . '
"; echo ""; @@ -447,9 +459,9 @@ echo ""; echo " "; echo ""; - echo "
"; - echo "
"; - echo "
"; + echo ''; + echo ''; + echo '
'; break; } diff --git a/newbb/admin/admin_votedata.php b/newbb/admin/admin_votedata.php index 387eb372..f999267d 100644 --- a/newbb/admin/admin_votedata.php +++ b/newbb/admin/admin_votedata.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,8 +25,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; @@ -51,7 +51,7 @@ $sql = sprintf("UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u", $GLOBALS['xoopsDB']->prefix('bb_topics'), $finalrating, $votesDB, $topic_id); $GLOBALS['xoopsDB']->queryF($sql); - redirect_header("admin_votedata.php", 1, _AM_NEWBB_VOTEDELETED); + redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED); break; case 'main': @@ -81,7 +81,7 @@ } xoops_cp_header(); - echo "
"; + echo '
'; if ($newXoopsModuleGui) { echo $indexAdmin->addNavigation('admin_votedata.php'); } @@ -89,7 +89,7 @@ // else echo $indexAdmin->addNavigation('admin_votedata.php') ; if (!$newXoopsModuleGui) { - echo "" . _AM_NEWBB_VOTE_DISPLAYVOTES . ""; + echo "" . _AM_NEWBB_VOTE_DISPLAYVOTES . ''; } echo "
\n
" . _AM_NEWBB_VOTE_USERAVG . ": $useravgrating
\n @@ -124,13 +124,13 @@ $ratingid\n $ratinguname\n $ratinghostname\n - " . $myts->htmlSpecialChars($down_array['topic_title']) . "\n + " . $myts->htmlspecialchars($down_array['topic_title']) . "\n $rating\n $formatted_date\n " . newbbDisplayImage('p_delete', _DELETE) . "\n \n"; } - echo ""; + echo ''; //Include page navigation include_once $GLOBALS['xoops']->path('class/pagenav.php'); $page = ($votes > 20) ? _AM_NEWBB_MINDEX_PAGE : ''; diff --git a/newbb/admin/index.php b/newbb/admin/index.php index 7fb4c487..bf82d3d8 100644 --- a/newbb/admin/index.php +++ b/newbb/admin/index.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -25,11 +25,11 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; -mod_loadFunctions("stats", "newbb"); +mod_loadFunctions('stats', 'newbb'); $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); $thumb_path = $attach_path . 'thumbs/'; @@ -39,13 +39,13 @@ * @param $path * @return bool|string */ -function newbb_admin_getPathStatus($path) +function newbb_admin_getPathStatus($path='') { - if (empty($path)) { + if ('' === $path) { return false; } if (@is_writable($path)) { - $path_status = ""; + $path_status = ''; } elseif (!@is_dir($path)) { $path_status = _AM_NEWBB_NOTAVAILABLE . " " . _AM_NEWBB_CREATETHEDIR . ''; } else { @@ -62,7 +62,7 @@ function newbb_admin_getPathStatus($path) */ function newbb_admin_mkdir($target, $mode = 0777) { - $target = str_replace("..", "", $target); + $target = str_replace('..', '', $target); // http://www.php.net/manual/en/function.mkdir.php return is_dir($target) || (newbb_admin_mkdir(dirname($target), $mode) && mkdir($target, $mode)); } @@ -74,7 +74,7 @@ function newbb_admin_mkdir($target, $mode = 0777) */ function newbb_admin_chmod($target, $mode = 0777) { - $target = str_replace("..", "", $target); + $target = str_replace('..', '', $target); return @chmod($target, $mode); } @@ -87,8 +87,8 @@ function newbb_getImageLibs() $imageLibs = array(); unset($output, $status); - if ($GLOBALS['xoopsModuleConfig']['image_lib'] === 1 or $GLOBALS['xoopsModuleConfig']['image_lib'] === 0) { - $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? "" : $GLOBALS['xoopsModuleConfig']['path_magick'] . "/"; + if ($GLOBALS['xoopsModuleConfig']['image_lib'] === 1 || $GLOBALS['xoopsModuleConfig']['image_lib'] === 0) { + $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/'; @exec($path . 'convert -version', $output, $status); if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) { $imageLibs['imagemagick'] = $matches[0]; @@ -96,8 +96,8 @@ function newbb_getImageLibs() unset($output, $status); } - if ($GLOBALS['xoopsModuleConfig']['image_lib'] === 2 or $GLOBALS['xoopsModuleConfig']['image_lib'] === 0) { - $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? "" : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . "/"; + if ($GLOBALS['xoopsModuleConfig']['image_lib'] === 2 || $GLOBALS['xoopsModuleConfig']['image_lib'] === 0) { + $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/'; @exec($path . 'jpegtopnm -version 2>&1', $output, $status); if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) { $imageLibs['netpbm'] = $matches[0]; @@ -116,7 +116,7 @@ function newbb_getImageLibs() $gdversion = $matches[2]; } if ($GDfuncList) { - if (in_array('imagegd2', $GDfuncList)) { + if (in_array('imagegd2', $GDfuncList, true)) { $imageLibs['gd2'] = $gdversion; } else { $imageLibs['gd1'] = $gdversion; @@ -129,32 +129,32 @@ function newbb_getImageLibs() $op = XoopsRequest::getCmd('op', '', 'GET'); // (isset($_GET['op']))? $_GET['op'] : ""; switch ($op) { - case "createdir": + case 'createdir': $path = XoopsRequest::getString('path', '', 'GET');// $_GET['path']; $res = newbb_admin_mkdir($path); $msg = ($res) ? _AM_NEWBB_DIRCREATED : _AM_NEWBB_DIRNOTCREATED; redirect_header('index.php', 2, $msg . ': ' . $path); break; - case "setperm": + case 'setperm': $path = XoopsRequest::getString('path', '', 'GET');// $_GET['path']; $res = newbb_admin_chmod($path, 0777); $msg = ($res) ? _AM_NEWBB_PERMSET : _AM_NEWBB_PERMNOTSET; redirect_header('index.php', 2, $msg . ': ' . $path); break; - case "senddigest": + case 'senddigest': $digest_handler = &xoops_getmodulehandler('digest', 'newbb'); $res = $digest_handler->process(true); $msg = ($res) ? _AM_NEWBB_DIGEST_FAILED : _AM_NEWBB_DIGEST_SENT; redirect_header('index.php', 2, $msg); break; - case "default": + case 'default': default: xoops_cp_header(); - echo "
"; + echo '
'; $imageLibs = newbb_getImageLibs(); $module_handler = &xoops_gethandler('module'); $reportHandler = &xoops_getmodulehandler('report', 'newbb'); @@ -189,30 +189,30 @@ function newbb_getImageLibs() $indexAdmin->addInfoBox(_AM_NEWBB_PREFERENCES); // START irmtfan better poll module display link and version - check if xoops poll module is available if ($isOK) { - $pollLink = _AM_NEWBB_AVAILABLE . ": "; - $pollLink .= "getVar('dirname') . "/admin/index.php\""; - $pollLink .= " alt=\"" . $xoopspoll->getVar('name') . " " . _VERSION . " (" . $xoopspoll->getInfo('version') . ") \""; - $pollLink .= " title=\"" . $xoopspoll->getVar('name') . " " . _VERSION . " (" . $xoopspoll->getInfo('version') . ") \""; - $pollLink .= ">" . "(" . $xoopspoll->getVar('name') . ")"; + $pollLink = _AM_NEWBB_AVAILABLE . ': '; + $pollLink .= "getVar('dirname') . "/admin/index.php\""; + $pollLink .= " alt=\"" . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ") \""; + $pollLink .= " title=\"" . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ") \""; + $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')'; } else { $pollLink = _AM_NEWBB_NOTAVAILABLE; } - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . _AM_NEWBB_POLLMODULE . ': %s' . "", $pollLink, 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_POLLMODULE . ': %s' . '', $pollLink, 'Green'); // END irmtfan better poll module display link and version - check if xoops poll module is available - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . _AM_NEWBB_IMAGEMAGICK . ' %s' . "", (array_key_exists('imagemagick', $imageLibs)) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . 'NetPBM' . ': %s' . "", array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . _AM_NEWBB_GDLIB1 . ' %s' . "", array_key_exists('gd1', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd1'] : _AM_NEWBB_NOTAVAILABLE, 'Red'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . _AM_NEWBB_GDLIB2 . ' %s' . "", array_key_exists('gd2', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd2'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, "" . _AM_NEWBB_UPLOAD . ' %s' . "", $uploadlimit, $uploadfarbe); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_IMAGEMAGICK . ' %s' . '', (array_key_exists('imagemagick', $imageLibs)) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . 'NetPBM' . ': %s' . '', array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_GDLIB1 . ' %s' . '', array_key_exists('gd1', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd1'] : _AM_NEWBB_NOTAVAILABLE, 'Red'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_GDLIB2 . ' %s' . '', array_key_exists('gd2', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd2'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_UPLOAD . ' %s' . '', $uploadlimit, $uploadfarbe); $indexAdmin->addInfoBox(_AM_NEWBB_BOARDSUMMARY); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, "" . _AM_NEWBB_TOTALTOPICS . ': %s' . "", getTotalTopics(), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, "" . _AM_NEWBB_TOTALPOSTS . ': %s' . "", getTotalPosts(), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, "" . _AM_NEWBB_TOTALVIEWS . ': %s' . "", getTotalViews(), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALTOPICS . ': %s' . '', getTotalTopics(), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALPOSTS . ': %s' . '', getTotalPosts(), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALVIEWS . ': %s' . '', getTotalViews(), 'Green'); $indexAdmin->addInfoBox(_AM_NEWBB_REPORT); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, "" . _AM_NEWBB_REPORT_PENDING . ': %s' . "", $reportHandler->getCount(new Criteria("report_result", 0)), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, "" . _AM_NEWBB_REPORT_PROCESSED . ': %s' . "", $reportHandler->getCount(new Criteria("report_result", 1)), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, '' . _AM_NEWBB_REPORT_PENDING . ': %s' . '', $reportHandler->getCount(new Criteria('report_result', 0)), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, '' . _AM_NEWBB_REPORT_PROCESSED . ': %s' . '', $reportHandler->getCount(new Criteria('report_result', 1)), 'Green'); foreach (array_keys($folder) as $i) { if (!(newbb_admin_getPathStatus($folder[$i])) === '') { @@ -229,77 +229,77 @@ function newbb_getImageLibs() // loadModuleAdminMenu(0, _MI_NEWBB_ADMENU_INDEX); - echo ""; + echo '
'; echo ""; + echo ''; echo "
"; - echo "
" . _AM_NEWBB_PREFERENCES . ""; + echo "
" . _AM_NEWBB_PREFERENCES . ''; - echo "
" . _AM_NEWBB_POLLMODULE . ": "; + echo "
" . _AM_NEWBB_POLLMODULE . ': '; - echo($isOK) ? _AM_NEWBB_AVAILABLE . ": (Modul: " . $xoopspoll->getVar('name') . ")" : _AM_NEWBB_NOTAVAILABLE; - echo "
"; + echo($isOK) ? _AM_NEWBB_AVAILABLE . ': (Module: ' . $xoopspoll->getVar('name') . ')' : _AM_NEWBB_NOTAVAILABLE; + echo '
'; echo "
"; - echo "" . _AM_NEWBB_IMAGEMAGICK . " "; + echo "" . _AM_NEWBB_IMAGEMAGICK . ' '; if (array_key_exists('imagemagick', $imageLibs)) { - echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] . ""; + echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] . ''; } else { echo _AM_NEWBB_NOTAVAILABLE; } - echo "
"; + echo '
'; echo "NetPBM: "; if (array_key_exists('netpbm', $imageLibs)) { - echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] . ""; + echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] . ''; } else { echo _AM_NEWBB_NOTAVAILABLE; } - echo "
"; - echo _AM_NEWBB_GDLIB1 . " "; + echo '
'; + echo _AM_NEWBB_GDLIB1 . ' '; if (array_key_exists('gd1', $imageLibs)) { - echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['gd1'] . ""; + echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['gd1'] . ''; } else { echo _AM_NEWBB_NOTAVAILABLE; } - echo "
"; - echo _AM_NEWBB_GDLIB2 . " "; + echo '
'; + echo _AM_NEWBB_GDLIB2 . ' '; if (array_key_exists('gd2', $imageLibs)) { - echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['gd2'] . ""; + echo "" . _AM_NEWBB_AUTODETECTED . $imageLibs['gd2'] . ''; } else { echo _AM_NEWBB_NOTAVAILABLE; } - echo "
"; + echo ''; - echo "
" . _AM_NEWBB_ATTACHPATH . ": "; + echo "
" . _AM_NEWBB_ATTACHPATH . ': '; $path_status = newbb_admin_getPathStatus($attach_path); echo $attach_path . ' ( ' . $path_status . ' )'; - echo "
" . _AM_NEWBB_THUMBPATH . ": "; + echo '
' . _AM_NEWBB_THUMBPATH . ': '; $path_status = newbb_admin_getPathStatus($thumb_path); echo $thumb_path . ' ( ' . $path_status . ' )'; - echo "
"; - echo "

"; - echo "
" . _AM_NEWBB_BOARDSUMMARY . ""; + echo ''; + echo '

'; + echo "
" . _AM_NEWBB_BOARDSUMMARY . ''; echo "
"; - echo _AM_NEWBB_TOTALTOPICS . " " . getTotalTopics() . " | "; - echo _AM_NEWBB_TOTALPOSTS . " " . getTotalPosts() . " | "; - echo _AM_NEWBB_TOTALVIEWS . " " . getTotalViews() . "
"; - echo "

"; - echo "
" . _AM_NEWBB_REPORT . ""; - echo "
" . _AM_NEWBB_REPORT_PENDING . " " . $reportHandler->getCount(new Criteria("report_result", 0)) . " | "; - echo _AM_NEWBB_REPORT_PROCESSED . " " . $reportHandler->getCount(new Criteria("report_result", 1)) . ""; - echo "
"; - echo "

"; + echo _AM_NEWBB_TOTALTOPICS . ' ' . getTotalTopics() . ' | '; + echo _AM_NEWBB_TOTALPOSTS . ' ' . getTotalPosts() . ' | '; + echo _AM_NEWBB_TOTALVIEWS . ' ' . getTotalViews() . ''; + echo '

'; + echo "
" . _AM_NEWBB_REPORT . ''; + echo "
" . _AM_NEWBB_REPORT_PENDING . ' ' . $reportHandler->getCount(new Criteria('report_result', 0)) . ' | '; + echo _AM_NEWBB_REPORT_PROCESSED . " " . $reportHandler->getCount(new Criteria('report_result', 1)) . ''; + echo '
'; + echo '

'; if ($GLOBALS['xoopsModuleConfig']['email_digest'] > 0) { $digest_handler = &xoops_getmodulehandler('digest', 'newbb'); - echo "
" . _AM_NEWBB_DIGEST . ""; + echo "
" . _AM_NEWBB_DIGEST . ''; $due = ($digest_handler->checkStatus()) / 60; // minutes $prompt = ($due > 0) ? sprintf(_AM_NEWBB_DIGEST_PAST, $due) : sprintf(_AM_NEWBB_DIGEST_NEXT, abs($due)); echo "
" . $prompt . " | "; - echo "" . _AM_NEWBB_DIGEST_ARCHIVE . " " . $digest_handler->getDigestCount() . ""; - echo "
"; - echo "

"; + echo "" . _AM_NEWBB_DIGEST_ARCHIVE . ' ' . $digest_handler->getDigestCount() . ''; + echo ''; + echo '

'; } - echo "
"; echo "