1
krobi
cbb - how to approve a posting
  • 2006/8/20 18:50

  • krobi

  • Quite a regular

  • Posts: 290

  • Since: 2003/12/21


i have a problem with cbb 3.05, i cant approve a posting.

in newbb 2 there was a option in the administration where i can approve postings but in cbb 3.05 there is no such option.

so does anyone know how to approve a posting?
Developer of PD-Modules like PD-Downloads and PD-Links.
Webmaster of Power-Dreams.com

2
krobi
Re: cbb - how to approve a posting
  • 2006/8/20 21:44

  • krobi

  • Quite a regular

  • Posts: 290

  • Since: 2003/12/21


i have fixed this "bug" for me now,

i have copied the code from newbb into cbb with some small changes and it works, as it not necessary for me to have the "uid" displayed i have insered a static name "gast".

so if you want the uid you have to do this change yourself

here is the whole index.php from the admin with the additional code from newbb 2.x

Quote:
// $Id: index.php,v 1.3 2005/10/19 17:20:32 phppp Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://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 //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://www.xoopscube.jp/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
include('admin_header.php');

foreach (array('approved', 'topic_id', 'post_id') as $getint) {
${$getint} = isset($_POST[$getint]) ? intval($_POST[$getint]) : 0;
}
foreach (array('approved', 'topic_id', 'post_id') as $getint) {
${$getint} = (${$getint})?${$getint}:(isset($_GET[$getint]) ? intval($_GET[$getint]) : 0);
}

function newbb_admin_getPathStatus($path)
{
if(empty($path)) return false;
if(@is_writable($path)){
$path_status = _AM_NEWBB_AVAILABLE;
}elseif(!@is_dir($path)){
$path_status = _AM_NEWBB_NOTAVAILABLE." "._AM_NEWBB_CREATETHEDIR.'';
}else{
$path_status = _AM_NEWBB_NOTWRITABLE." "._AM_NEWBB_SETMPERM.'';
}
return $path_status;
}

function newbb_admin_mkdir($target, $mode=0777)
{
// http://www.php.net/manual/en/function.mkdir.php
return is_dir($target) or ( newbb_admin_mkdir(dirname($target), $mode) and mkdir($target, $mode) );
}

function newbb_admin_chmod($target, $mode = 0777)
{
return @chmod($target, $mode);
}

function newbb_getImageLibs()
{
global $xoopsModuleConfig;

$imageLibs= array();
unset($output, $status);
if ( $xoopsModuleConfig['image_lib'] == 1 or $xoopsModuleConfig['image_lib'] == 0 ){
$path = empty($xoopsModuleConfig['path_magick'])?"":$xoopsModuleConfig['path_magick']."/";
@exec($path.'convert -version', $output, $status);
if(empty($status)&&!empty($output)){
if(preg_match("/imagemagick[ \t]+([0-9\.]+)/i",$output[0],$matches))
$imageLibs['imagemagick'] = $matches[0];
}
unset($output, $status);
}
if ( $xoopsModuleConfig['image_lib'] == 2 or $xoopsModuleConfig['image_lib'] == 0 ){
$path = empty($xoopsModuleConfig['path_netpbm'])?"":$xoopsModuleConfig['path_netpbm']."/";
@exec($path.'jpegtopnm -version 2>&1', $output, $status);
if(empty($status)&&!empty($output)){
if(preg_match("/netpbm[ \t]+([0-9\.]+)/i",$output[0],$matches))
$imageLibs['netpbm'] = $matches[0];
}
unset($output, $status);
}

$GDfuncList = get_extension_funcs('gd');
ob_start();
@phpinfo(INFO_MODULES);
$output=ob_get_contents();
ob_end_clean();
$matches[1]='';
if(preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s",$output,$matches)){
$gdversion = $matches[2];
}
if( $GDfuncList ){
if( in_array('imagegd2',$GDfuncList) )
$imageLibs['gd2'] = $gdversion;
else
$imageLibs['gd1'] = $gdversion;
}
return $imageLibs;
}

$op = (isset($_GET['op']))? $_GET['op'] : "";

switch ($op) {
case "del":
$post_handler = &xoops_getmodulehandler('post', 'newbb');
if (!empty($ok)) {
if (!empty($post_id)) {
$post = &$post_handler->get($post_id);

if ($ok == 2 && isset($post)) {
$post_handler->delete($post, true);
}

sync($post->getVar('forum_id'), "forum");
sync($post->getVar('topic_id'), "topic");
}
if ($post->istopic()) {
redirect_header("index.php", 2, _AM_NEWBB_POSTSDELETED);
exit();
} else {
redirect_header("index.php", 2, _AM_NEWBB_POSTSDELETED);
exit();
}
} else {
xoops_cp_header();
xoops_confirm(array('post_id' => $post_id, 'op' => 'del', 'ok' => 2), 'index.php', _AM_NEWBB_DEL_ONE);
xoops_cp_footer();
}
exit();
break;

case "approve":

if (isset($post_id) && $post_id > 0) {
$post_handler = &xoops_getmodulehandler('post', 'newbb');
if ($post_handler->approve($post_id)) {
redirect_header("index.php", 1, _AM_NEWBB_POSTAPPROVED);
} else {
redirect_header("index.php", 1, _AM_NEWBB_POSTNOTAPPROVED);
}
} elseif (isset($topic_id) && $topic_id > 0) {
$topic_handler = &xoops_getmodulehandler('topic', 'newbb');
if ($topic_handler->approve($topic_id)) {
redirect_header("index.php", 1, _AM_NEWBB_TOPICAPPROVED);
} else {
redirect_header("index.php", 1, _AM_NEWBB_TOPICNOTAPPROVED);
}
}
exit();
break;

/* removed */

case "mod":
if (empty($post_id)) {
redirect_header("index.php", 2, _MD_ERRORPOST);
exit();
} else {
xoops_cp_header();
loadModuleAdminMenu(0, "");
echo "
";

$post_handler = &xoops_getmodulehandler('post', 'newbb');
$forumpost = &$post_handler->get($post_id);
$forum_handler =& xoops_getmodulehandler('forum', 'newbb');
$forum = $forum_handler->get($forumpost->getVar('forum_id'));

$pid = $forumpost->getVar('pid');
$dohtml = $forumpost->getVar('dohtml');
$dosmiley = $forumpost->getVar('dosmiley');
$doxcode = $forumpost->getVar('doxcode');
$icon = $forumpost->getVar('icon');
$attachsig = $forumpost->getVar('attachsig');
$topic_id=$forumpost->getVar('topic_id');
$istopic = ( $forumpost->istopic() )?1:0;
$isedit =1;
$subject_pre="";
$subject=$forumpost->getVar('subject', "E");
$message=$forumpost->getVar('post_text', "E");
$poster_name=$forumpost->getVar('poster_name', "E");
$attachments=$forumpost->getAttachment();
$post_karma=$forumpost->getVar('post_karma');
$require_reply=$forumpost->getVar('require_reply');
$hidden = "";

$admin_form_action = "admin_post.php";
include '../include/forumform.inc.php';
xoops_cp_footer();
}

exit();
break;
/* */
case "createdir":
if (isset($_GET['path'])) $path = $_GET['path'];
$res = newbb_admin_mkdir($path);
$msg = ($res)?_AM_NEWBB_DIRCREATED:_AM_NEWBB_DIRNOTCREATED;
redirect_header('index.php', 2, $msg . ': ' . $path);
exit();
break;

case "setperm":
if (isset($_GET['path'])) $path = $_GET['path'];
$res = newbb_admin_chmod($path, 0777);
$msg = ($res)?_AM_NEWBB_PERMSET:_AM_NEWBB_PERMNOTSET;
redirect_header('index.php', 2, $msg . ': ' . $path);
exit();
break;

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);
exit();
break;

case "default":
default:

xoops_cp_header();

loadModuleAdminMenu(0, "Index");
$imageLibs = newbb_getImageLibs();

echo "
" . _AM_NEWBB_PREFERENCES . "";

echo "
" . _AM_NEWBB_POLLMODULE . ": ";
$module_handler = &xoops_gethandler('module');
$xoopspoll = &$module_handler->getByDirname('xoopspoll');
if (is_object($xoopspoll)) $isOK = $xoopspoll->getVar('isactive');
else $isOK = false;
echo ($isOK)?_AM_NEWBB_AVAILABLE:_AM_NEWBB_NOTAVAILABLE;
echo "
";
echo "
";
echo ""._AM_NEWBB_IMAGEMAGICK." ";
if(array_key_exists('imagemagick',$imageLibs)) {
echo ""._AM_NEWBB_AUTODETECTED.$imageLibs['imagemagick']."";
}
else { echo _AM_NEWBB_NOTAVAILABLE;
}
echo "
";
echo "NetPBM: ";
if(array_key_exists('netpbm',$imageLibs)) {
echo ""._AM_NEWBB_AUTODETECTED.$imageLibs['netpbm']."";
}
else { echo _AM_NEWBB_NOTAVAILABLE;
}
echo "
";
echo _AM_NEWBB_GDLIB1." ";
if(array_key_exists('gd1',$imageLibs)) {
echo ""._AM_NEWBB_AUTODETECTED.$imageLibs['gd1']."";
}
else { echo _AM_NEWBB_NOTAVAILABLE;
}

echo "
";
echo _AM_NEWBB_GDLIB2." ";
if(array_key_exists('gd2',$imageLibs)) {
echo ""._AM_NEWBB_AUTODETECTED.$imageLibs['gd2']."";
}
else { echo _AM_NEWBB_NOTAVAILABLE;
}
echo "
";


echo "
" . _AM_NEWBB_ATTACHPATH . ": ";
$attach_path = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/';
$path_status = newbb_admin_getPathStatus($attach_path);
echo $attach_path . ' ( ' . $path_status . ' )';

echo "
" . _AM_NEWBB_THUMBPATH . ": ";
$thumb_path = $attach_path . 'thumbs/'; // be careful
$path_status = newbb_admin_getPathStatus($thumb_path);
echo $thumb_path . ' ( ' . $path_status . ' )';

echo "
";

echo "

";

echo "
" . _AM_NEWBB_BOARDSUMMARY . "";
echo "
";
echo _AM_NEWBB_TOTALTOPICS . " " . get_total_topics() . " | ";
echo _AM_NEWBB_TOTALPOSTS . " " . get_total_posts() . " | ";
echo _AM_NEWBB_TOTALVIEWS . " " . get_total_views() . "
";
echo "

";

$report_handler = &xoops_getmodulehandler('report', 'newbb');
echo "
" . _AM_NEWBB_REPORT . "";
echo "
" . _AM_NEWBB_REPORT_PENDING . " " . $report_handler->getCount(new Criteria("report_result", 0)) . " | ";
echo _AM_NEWBB_REPORT_PROCESSED . " " . $report_handler->getCount(new Criteria("report_result", 1)) . "";
echo "
";
echo "

";

if ($xoopsModuleConfig['email_digest'] > 0) {
$digest_handler = &xoops_getmodulehandler('digest', 'newbb');
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_PENDING_POSTS_FOR_AUTH . "
";
$sql = "SELECT p.*, t.post_text FROM " . $xoopsDB->prefix("bb_posts") . " p LEFT JOIN " . $xoopsDB->prefix("bb_posts_text") . " t ON p.post_id=t.post_id LEFT JOIN " . $xoopsDB->prefix("bb_topics") . " tp ON tp.topic_id=p.topic_id WHERE p.approved='0'";
$result = $xoopsDB->query($sql);
$numrows = $xoopsDB->getRowsNum($result);
echo "
\n
\n
\n
\n
\n
\n
\n
";
if ($numrows > 0) { // That is, if there ARE columns in the system
while ($post = $xoopsDB->fetchArray($result)) {
$user = "Gast";
$modify = "".newbb_displayImage($forumImage['edit'], _EDIT)."";
$delete = "".newbb_displayImage($forumImage['delete'], _DELETE)."";
$approve = "".newbb_displayImage($forumImage['approve'], _AM_NEWBB_APPROVE)."";
$text = $myts->displayTarea($post['post_text'], $post['dohtml'], $post['dosmiley'], $post['doxcode']);

echo "\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
";
}
} else { // that is, $numrows = 0, there's no columns yet
echo "\n
\n
";
}

echo "
" . _AM_NEWBB_POSTID . " " . _AM_NEWBB_POSTER . " " . _AM_NEWBB_SUBJECT . " " . _AM_NEWBB_POSTDATE . " " . _AM_NEWBB_ACTION . "
" . $post['post_id'] . " " . $user . " " . $post['subject'] . " " . formatTimestamp($post['post_time']) . " $modify $approve $delete
" . $post['post_id'] . " " . _AM_NEWBB_APPROVETEXT . "
" . $post['post_id'] . " " . $text . "
" . _AM_NEWBB_NOAPPROVEPOST . "
\n
";

$sql = "SELECT t.* FROM " . $xoopsDB->prefix("bb_topics") . " t LEFT JOIN " . $xoopsDB->prefix("bb_posts") . " p ON p.topic_id=t.topic_id WHERE p.pid = 0 AND p.approved = 1 AND t.approved = 0";
$result = $xoopsDB->query($sql);
$numrows = $xoopsDB->getRowsNum($result);
if ($numrows > 0) {
echo "
" . _AM_NEWBB_ORPHAN_TOPICS_FOR_AUTH . "
\n
\n
\n
\n
\n
\n
\n
";
while ($topic = $xoopsDB->fetchArray($result)) {
$approve = "".newbb_displayImage($forumImage['approve'], _AM_NEWBB_APPROVE)."";
echo "\n
\n
\n
\n
\n
";
}
echo "
" . _AM_NEWBB_TOPICID . " " . _AM_NEWBB_SUBJECT . " " . _AM_NEWBB_POSTDATE . " " . _AM_NEWBB_ACTION . "
" . $topic['topic_id'] . " " . $topic['topic_title'] . " " . formatTimestamp($topic['topic_time']) . " $approve
\n
";
}

echo "

";

/* A trick to clear garbage for suspension management
* Not good but works
*/
if (!empty($xoopsModuleConfig['enable_usermoderate'])){
$moderate_handler =& xoops_getmodulehandler('moderate', 'newbb');
$moderate_handler->clearGarbage();
}

xoops_cp_footer();
break;
}

?>
Developer of PD-Modules like PD-Downloads and PD-Links.
Webmaster of Power-Dreams.com

3
krobi
Re: cbb - how to approve a posting
  • 2006/8/23 12:55

  • krobi

  • Quite a regular

  • Posts: 290

  • Since: 2003/12/21


the problem is still here

especially i have a problem my deleting a new thread when a user has open a new thread and i have to approve it - so where can i find this option to delete this thread?

with my hack i can see there is a thread, with its name and text but i dont see this option in the forum.

and there is also no answer on my question on dev.xoops.org for my problem

in my option this is a big usability problem, so users have this option to approve postings/thread but its not userfriedly - so a user have to search thru the forum to find posts he have to approve, but i dont find the option to approve topics.

hopefully someone can help me because its a big problem for my website
Developer of PD-Modules like PD-Downloads and PD-Links.
Webmaster of Power-Dreams.com

Login

Who's Online

279 user(s) are online (214 user(s) are browsing Support Forums)


Members: 0


Guests: 279


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits