|
From: Jon O. <jon...@us...> - 2007-02-15 12:43:55
|
Update of /cvsroot/mxbb/mx_bugsbt/bugsbt/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7691/bugsbt/includes Added Files: bugsbt_constants.php functions.php functions_admin.php functions_auth.php functions_bugsbt.php functions_comment.php functions_node.php index.htm Log Message: Ok. here we go. This is the cool new mxBB Bugtracker ;) --- NEW FILE: functions.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions.php,v 1.1 2007/02/15 12:43:46 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /** * mx_bugsbt_functions. * * This class is used for general kb handling * * @access public * @author Jon Ohlsson * */ class mx_bugsbt_functions { /** * This class is used for general bugsbt handling * * @param unknown_type $config_name * @param unknown_type $config_value */ function set_config( $config_name, $config_value ) { global $mx_bugsbt_cache, $bugsbt_config, $db, $mx_bugsbt; $mx_bugsbt->debug('functions->set_config', basename( __FILE__ )); $sql = "UPDATE " . BUGSBT_CONFIG_TABLE . " SET config_value = '" . str_replace( "\'", "''", $config_value ) . "' WHERE config_name = '$config_name'"; if ( !$db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, "Failed to update bugsbt configuration for $config_name", "", __LINE__, __FILE__, $sql ); } if ( !$db->sql_affectedrows() && !isset( $bugsbt_config[$config_name] ) ) { $sql = 'INSERT INTO ' . BUGSBT_CONFIG_TABLE . " (config_name, config_value) VALUES ('$config_name', '" . str_replace( "\'", "''", $config_value ) . "')"; if ( !$db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, "Failed to update bugsbt configuration for $config_name", "", __LINE__, __FILE__, $sql ); } } $bugsbt_config[$config_name] = $config_value; $mx_bugsbt_cache->put( 'config', $bugsbt_config ); } /** * Enter description here... * * @return unknown */ function bugsbt_config() { global $db; $sql = "SELECT * FROM " . BUGSBT_CONFIG_TABLE; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt query bugsbt configuration', '', __LINE__, __FILE__, $sql ); } while ( $row = $db->sql_fetchrow( $result ) ) { $bugsbt_config[$row['config_name']] = trim( $row['config_value'] ); } $db->sql_freeresult( $result ); return ( $bugsbt_config ); } /** * Enter description here... * * @param unknown_type $mode * @param unknown_type $page_id */ function generate_smilies( $mode, $page_id ) { global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path; global $user_ip, $session_length, $starttime; global $userdata, $mx_bugsbt; global $mx_root_path, $module_root_path, $is_block, $phpEx; $mx_bugsbt->debug('functions->generate smilies', basename( __FILE__ )); $inline_columns = 4; $inline_rows = 5; $window_columns = 8; if ( $mode == 'window' ) { $userdata = session_pagestart( $user_ip, $page_id ); init_userprefs( $userdata ); $gen_simple_header = true; $page_title = $lang['Review_topic'] . " - $topic_title"; include( $mx_root_path . 'includes/page_header.' . $phpEx ); $template->set_filenames( array( 'smiliesbody' => 'posting_smilies.tpl' ) ); } $sql = "SELECT emoticon, code, smile_url FROM " . SMILIES_TABLE . " ORDER BY smilies_id"; if ( $result = $db->sql_query( $sql ) ) { $num_smilies = 0; $rowset = array(); while ( $row = $db->sql_fetchrow( $result ) ) { if ( empty( $rowset[$row['smile_url']] ) ) { $rowset[$row['smile_url']]['code'] = str_replace( "'", "\\'", str_replace( '\\', '\\\\', $row['code'] ) ); $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; $num_smilies++; } } if ( $num_smilies ) { $smilies_count = ( $mode == 'inline' ) ? min( 19, $num_smilies ) : $num_smilies; $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1; $s_colspan = 0; $row = 0; $col = 0; while ( list( $smile_url, $data ) = @each( $rowset ) ) { if ( !$col ) { $template->assign_block_vars( 'smilies_row', array() ); } $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url, 'SMILEY_DESC' => $data['emoticon'] ) ); $s_colspan = max( $s_colspan, $col + 1 ); if ( $col == $smilies_split_row ) { if ( $mode == 'inline' && $row == $inline_rows - 1 ) { break; } $col = 0; $row++; } else { $col++; } } if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns ) { $template->assign_block_vars( 'switch_smilies_extra', array() ); $template->assign_vars( array( 'L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ); } $template->assign_vars( array( 'L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan ) ); } } if ( $mode == 'window' ) { $template->pparse( 'smiliesbody' ); include( $mx_root_path . 'includes/page_tail.' . $phpEx ); } } /** * Enter description here... * * @param unknown_type $query * @param unknown_type $total * @param unknown_type $offset * @return unknown */ function sql_query_limit( $query, $total, $offset = 0, $sql_cache = false ) { global $db; $query .= ' LIMIT ' . ( ( !empty( $offset ) ) ? $offset . ', ' . $total : $total ); return $sql_cache ? $db->sql_query( $query, $sql_cache ) : $db->sql_query( $query ); } /** * page header. * */ /* function page_header( ) { } */ /** * page footer. * */ function page_footer() { global $lang, $board_config, $userdata, $phpbb_root_path, $mx_root_path, $module_root_path, $is_block, $phpEx, $page_id; global $mx_bugsbt_cache, $mx_bugsbt; global $phpEx, $template, $do_gzip_compress, $debug, $db, $starttime; $mx_bugsbt->modules[$mx_bugsbt->module_name]->_bugsbt(); $mx_bugsbt_cache->unload(); } /** * Quick stats. * * @param unknown_type $category_id */ /* function get_quick_stats( $category_id = '' ) { } */ /** * get type list for adding and editing articles. * * @param unknown_type $sel_id */ function get_bugsbt_type_list( $sel_id ) { global $db, $template; $sql = "SELECT * FROM " . BUGSBT_TYPES_TABLE; if ( !( $type_result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Could not obtain category information", '', __LINE__, __FILE__, $sql ); } while ( $type = $db->sql_fetchrow( $type_result ) ) { $type_name = isset($lang['KB_type_' . $type['type']]) ? $lang['KB_type_' . $type['type']] : $type['type']; $type_id = $type['id']; if ( $sel_id == $type_id ) { $status = 'selected'; } else { $status = ''; } $type = '<option value="' . $type_id . '" ' . $status . '>' . $type_name . '</option>'; $template->assign_block_vars( 'types', array( 'TYPE' => $type ) ); } } /** * Enter description here... * * @param unknown_type $article * @return unknown */ function article_formatting( $article ) { // Prepare ingress/preword $search = array (); $replace = array (); $search = array ( "'\[title*?[^\[\]]*?\]'si", "'\[\/title*?[^\[\]]*?\]'si", "'\[subtitle*?[^\[\]]*?\]'si", "'\[\/subtitle*?[^\[\]]*?\]'si", "'\[subsubtitle*?[^\[\]]*?\]'si", "'\[\/subsubtitle*?[^\[\]]*?\]'si", "'\[quote*?[^\[\]]*?\]'si", "'\[\/quote*?[^\[\]]*?\]'si", "'\[abstract*?[^\[\]]*?\]'si", "'\[\/abstract*?[^\[\]]*?\]'si" ); $replace = array ( "<span class=\"cattitle\">", "</span>", "<span class=\"topictitle\">", "</span>", "<span class=\"gensmall\"><b>", "</b></span>", "<div align=\"center\"><span class=\"gensmall\"><i>''", "''</i></span></div>", "<table cellpadding=\"20\" style=\"margin-bottom: -20px;\"><tr><td><span class=\"postbody\" style=\"font-weight: bold; font-size: 9pt;\">", "</span></td></td></tr></table>" ); $article = preg_replace( $search, $replace, $article ); return $article; } } /** * mx_user_info * * This class is used to determin Browser and operating system info of the user * * @access public * @author http://www.chipchapin.com * @copyright (c) 2002 Chip Chapin <cc...@ch...> */ class mx_user_info { var $agent = 'unknown'; var $ver = 0; var $majorver = 0; var $minorver = 0; var $platform = 'unknown'; /** * Constructor. * * Determine client browser type, version and platform using heuristic examination of user agent string. * * @param unknown_type $user_agent allows override of user agent string for testing. */ function user_info( $user_agent = '' ) { global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS; if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } else if ( !empty( $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; } else if ( !isset( $HTTP_USER_AGENT ) ) { $HTTP_USER_AGENT = ''; } if ( empty( $user_agent ) ) { $user_agent = $HTTP_USER_AGENT; } $user_agent = strtolower( $user_agent ); // Determine browser and version // The order in which we test the agents patterns is important // Intentionally ignore Konquerer. It should show up as Mozilla. // post-Netscape Mozilla versions using Gecko show up as Mozilla 5.0 if ( preg_match( '/(opera |opera\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msie )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(mozilla\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; else { $matches[1] = 'unknown'; $matches[2] = 0; $matches[3] = 0; } $this->majorver = $matches[2]; $this->minorver = $matches[3]; $this->ver = $matches[2] . '.' . $matches[3]; switch ( $matches[1] ) { case 'opera/': case 'opera ': $this->agent = 'OPERA'; break; case 'msie ': $this->agent = 'IE'; break; case 'mozilla/': $this->agent = 'NETSCAPE'; if ( $this->majorver >= 5 ) { $this->agent = 'MOZILLA'; } break; case 'unknown': $this->agent = 'OTHER'; break; default: $this->agent = 'Oops!'; } // Determine platform // This is very incomplete for platforms other than Win/Mac if ( preg_match( '/(win|mac|linux|unix)/', $user_agent, $matches ) ); else $matches[1] = 'unknown'; switch ( $matches[1] ) { case 'win': $this->platform = 'Win'; break; case 'mac': $this->platform = 'Mac'; break; case 'linux': $this->platform = 'Linux'; break; case 'unix': $this->platform = 'Unix'; break; case 'unknown': $this->platform = 'Other'; break; default: $this->platform = 'Oops!'; } } /** * update_info. * * - Not implemented in this module. * * @param unknown_type $id */ function update_info( $id ) { global $user_ip, $db, $userdata; $where_sql = ( $userdata['user_id'] != ANONYMOUS ) ? "user_id = '" . $userdata['user_id'] . "'" : "downloader_ip = '" . $user_ip . "'"; $sql = "SELECT user_id, downloader_ip FROM " . PA_DOWNLOAD_INFO_TABLE . " WHERE $where_sql"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt Query User id', '', __LINE__, __FILE__, $sql ); } if ( !$db->sql_numrows( $result ) ) { $sql = "INSERT INTO " . PA_DOWNLOAD_INFO_TABLE . " (file_id, user_id, downloader_ip, downloader_os, downloader_browser, browser_version) VALUES('" . $id . "', '" . $userdata['user_id'] . "', '" . $user_ip . "', '" . $this->platform . "', '" . $this->agent . "', '" . $this->ver . "')"; if ( !( $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt Update Downloader Table Info', '', __LINE__, __FILE__, $sql ); } } $db->sql_freeresult( $result ); } } /** * mx_bugsbt_notification. * * This class extends general mx_notification class * * // MODE: MX_PM_MODE/MX_MAIL_MODE, $id: get all file/article data for this id * $mx_notification->init($mode, $id); // MODE: MX_PM_MODE/MX_MAIL_MODE * * // MODE: MX_PM_MODE/MX_MAIL_MODE, ACTION: MX_NEW_NOTIFICATION/MX_EDITED_NOTIFICATION/MX_APPROVED_NOTIFICATION/MX_UNAPPROVED_NOTIFICATION * $mx_notification->notify( $mode = MX_PM_MODE, $action = MX_NEW_NOTIFICATION, $to_id, $from_id, $subject, $message, $html_on, $bbcode_on, $smilies_on ) * * @access public * @author Jon Ohlsson */ class mx_bugsbt_notification extends mx_notification { /** * Enter description here... * * @param unknown_type $item_id */ function init( $item_id = 0) { global $db, $lang, $module_root_path, $phpbb_root_path, $phpEx, $userdata, $mx_bugsbt; // ======================================================= // item id is not set, give him/her a nice error message // ======================================================= if (empty($item_id)) { mx_message_die(GENERAL_ERROR, 'Bad Init pars'); } unset($this->langs); // // Build up generic lang keys // $this->langs['item_not_exist'] = $lang['File_not_exist']; $this->langs['module_title'] = $lang['bugsbt_title']; $this->langs['notify_subject_new'] = $lang['bugsbt_notify_subject_new']; $this->langs['notify_subject_edited'] = $lang['bugsbt_notify_subject_edited']; $this->langs['notify_subject_approved'] = $lang['bugsbt_notify_subject_approved']; $this->langs['notify_subject_unapproved'] = $lang['bugsbt_notify_subject_unapproved']; $this->langs['notify_subject_deleted'] = $lang['bugsbt_notify_subject_deleted']; $this->langs['notify_new_body'] = $lang['bugsbt_notify_new_body']; $this->langs['notify_edited_body'] = $lang['bugsbt_notify_edited_body']; $this->langs['notify_approved_body'] = $lang['bugsbt_notify_approved_body']; $this->langs['notify_unapproved_body'] = $lang['bugsbt_notify_unapproved_body']; $this->langs['notify_deleted_body'] = $lang['bugsbt_notify_deleted_body']; $this->langs['item_title'] = $lang['Bug_title']; $this->langs['author'] = $lang['Author']; $this->langs['item_description'] = $lang['Bug_description']; $this->langs['item_type'] = $lang['Bug_type']; $this->langs['category'] = $lang['Category']; $this->langs['read_full_item'] = $lang['Read_full_bug']; $this->langs['edited_item_info'] = $lang['Edited_Bug_info']; switch ( SQL_LAYER ) { case 'oracle': $sql = "SELECT a.*, u.user_id, u.username, c.category_id, c.category_name FROM " . BUGSBT_BUGS_TABLE . " AS a, " . USERS_TABLE . " AS u, " . BUGSBT_PRODUCTS_TABLE . " AS c WHERE a.bug_author_id = u.user_id(+) AND c.category_id = a.bug_category_id AND a.bug_id = '" . $item_id . "' GROUP BY a.bug_id"; break; default: /* Bug 50 $sql = "SELECT a.*, AVG(r.rate_point) AS rating, COUNT(r.votes_article) AS total_votes, u.user_id, u.username, c.category_id, c.category_name FROM " . KB_ARTICLES_TABLE . " AS a, " . KB_CATEGORIES_TABLE . " AS c LEFT JOIN " . KB_VOTES_TABLE . " AS r ON a.article_id = r.votes_article LEFT JOIN " . USERS_TABLE . " AS u ON a.article_author_id = u.user_id WHERE c.category_id = a.article_category_id AND a.article_id = '" . $item_id . "' GROUP BY a.article_id"; */ $sql = "SELECT a.*, u.user_id, u.username, c.category_id, c.category_name FROM " . BUGSBT_BUGS_TABLE . " AS a LEFT JOIN " . BUGSBT_PRODUCTS_TABLE . " AS c ON c.category_id = a.bug_category_id LEFT JOIN " . USERS_TABLE . " AS u ON a.bug_author_id = u.user_id WHERE a.bug_id = '" . $item_id . "' GROUP BY a.bug_id "; break; } if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt Query bug info', '', __LINE__, __FILE__, $sql ); } // =================================================== // file doesn't exist' // =================================================== if ( !$item_data = $db->sql_fetchrow( $result ) ) { mx_message_die( GENERAL_MESSAGE, $this->langs['Item_not_exist'] ); } $db->sql_freeresult( $result ); unset($this->data); // // File data // $this->data['item_id'] = $item_id; $this->data['item_title'] = $item_data['bug_title']; $this->data['item_desc'] = $item_data['bug_description']; // // Category data // $this->data['item_category_id'] = $item_data['category_id']; $this->data['item_category_name'] = $item_data['category_name']; // // File author // $this->data['item_author_id'] = $item_data['user_id']; $this->data['item_author'] = ( $item_data['user_id'] != ANONYMOUS ) ? $item_data['username'] : $lang['Guest']; // // File editor // $this->data['item_editor_id'] = $userdata['user_id']; $this->data['item_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : $lang['Guest']; $this->temp_url = PORTAL_URL . $mx_kb->this_mxurl("mode=" . "article&k=" . $this->data['item_id'], false, true); } } ?> --- NEW FILE: functions_node.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions_node.php,v 1.1 2007/02/15 12:43:47 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // +--------------------------------------------------------------------+ // | DO NOT REMOVE THIS | // +--------------------------------------------------------------------+ // | Nodes.php | // | Tree management, all files/dirs operations. | // +--------------------------------------------------------------------+ // | Author: Cezary Tomczak [www.gosu.pl] | // | Project: SimpleDoc | // | URL: http://gosu.pl/php/simpledoc.html | // | License: GPL | // +--------------------------------------------------------------------+ if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // Nodes management. // Dependencies: IoFile, IoDir // Author: Cezary Tomczak [www.gosu.pl] // Project: SimpleDoc class Node { var $id; // id of the node, empty for the root element var $path; // full path to file or directory var $io; // IoFile or IoDir object var $currFolder; // current folder, the node exists inside it, for the root element it points to itself var $level; // level of immersion, 0 for the root dir // this properties are overwritten on object creation, using global variables, see Node::Node() var $root = 'content'; // path to root element, without slash at the end var $sortFile = '.sort'; // name of the sort file var $chmodFile = 666; var $chmodDir = 777; var $error = false; function Node($id = '') { global $CONTENT, $SORT, $CHMOD_FILE, $CHMOD_DIR; $this->root = $CONTENT; $this->sortFile = $SORT; $this->chmodFile = $CHMOD_FILE; $this->chmodDir = $CHMOD_DIR; $this->id = $id; $this->path = $this->root.'/'.$this->id; $this->level = substr_count($this->id, '/'); if ($this->id) { if (IoFile::exists($this->path)) { $this->io = new IoFile(); } else if (IoDir::exists($this->path)) { $this->io = new IoDir(); } else { return trigger_error("Node.Node() failed, node with id: '{$this->id}' doesn't exist", E_USER_ERROR); } $this->currFolder = dirname($this->path); } else { $this->currFolder = $this->root; } } // ------- // ACTIONS // ------- function moveUp() { if (!$this->id) { return trigger_error("Node.moveUp() failed, this action cannot be executed for the root element", E_USER_ERROR); } $nodes = $this->loadSort($this->currFolder); $key = array_search($this->path, $nodes); if ($key === false) { return trigger_error("Node.moveUp() failed, unknown error", E_USER_ERROR); } if ($key == 0) { return trigger_error("Node.moveUp() failed, current node is the first element", E_USER_ERROR); } $nodes2 = $nodes; $nodes2[$key-1] = $nodes[$key]; $nodes2[$key] = $nodes[$key-1]; $this->saveSort($this->currFolder, $nodes2); } function moveDown() { if (!$this->id) { return trigger_error("Node.moveDown() failed, this action cannot be executed for the root element", E_USER_ERROR); } $nodes = $this->loadSort($this->currFolder); $key = array_search($this->path, $nodes); if ($key === false) { return trigger_error("Node.moveDown() failed, unknown error", E_USER_ERROR); } if ($key == count($nodes) - 1) { return trigger_error("Node.moveDown() failed, current node is the last element", E_USER_ERROR); } $nodes2 = $nodes; $nodes2[$key+1] = $nodes[$key]; $nodes2[$key] = $nodes[$key+1]; $this->saveSort($this->currFolder, $nodes2); } function moveLeft() { if (!$this->id) { return trigger_error("Node.moveLeft() failed, this action cannot be executed for the root element", E_USER_ERROR); } if ($this->level <= 0) { return trigger_error("Node.moveLeft() failed, node doesn't have a parent", E_USER_ERROR); } $newCurrFolder = dirname($this->currFolder); $sort = $this->loadSort($newCurrFolder); $key = array_search($this->getCurrFolder(), $sort); if ($key === false) { return trigger_error("Node.moveLeft() failed, unknown error", E_USER_ERROR); } $Node = new Node($this->getIdByFullPath($newCurrFolder)); if (in_array($this->getName(), $Node->getChildNames($Node->getCurrFolder()))) { return trigger_error("Node.moveLeft() failed, there is already w node with such name", E_USER_ERROR); } $new = $newCurrFolder.'/'.$this->getName(); $this->io->move($this->path, $new); $this->fixSort($this->currFolder); array_splice($sort, $key, 0, $new); $this->saveSort($newCurrFolder, $sort); $this->Node($this->getIdByFullPath($new)); } function moveRight() { if (!$this->id) { return trigger_error("Node.moveRight() failed, this action cannot be executed for the root element", E_USER_ERROR); } $nodes = $this->loadSort($this->currFolder); $key = array_search($this->path, $nodes); if ($key === false) { return trigger_error("Node.moveRight() failed, unknown error", E_USER_ERROR); } if ($key == count($nodes) - 1) { return trigger_error("Node.moveRight() failed, current node is the last element", E_USER_ERROR); } $Next = new Node($this->getIdByFullPath($nodes[$key+1])); if (!$Next->isFolder()) { return trigger_error("Node.moveRight() failed, next node is not a folder", E_USER_ERROR); } if (in_array($this->getName(), $Next->getChildNames($Next->getPath()))) { return trigger_error("Node.moveRight() failed, there is already a node with such name", E_USER_ERROR); } $sort = $Next->loadSort($Next->getPath()); $new = $Next->getPath().'/'.$this->getName(); $this->io->move($this->path, $new); $this->fixSort($this->currFolder); $sort = array_merge(array($new), $sort); $this->saveSort($Next->getPath(), $sort); $this->Node($this->getIdByFullPath($new)); } function insert($name, $is_folder) { if ($this->id) { return trigger_error("Note.insert() failed, this action can be executed only for the root element", E_USER_ERROR); } if (in_array($name, $this->getChildNames($this->currFolder))) { return trigger_error("Node.insert() failed, there is already a node with such name", E_USER_ERROR); } $sort = $this->loadSort($this->currFolder); if ($is_folder) { IoDir::create($this->currFolder.'/'.$name, $this->chmodDir); IoFile::create($this->currFolder.'/'.$name.'/'.$this->sortFile, $this->chmodFile); } else { IoFile::create($this->currFolder.'/'.$name, $this->chmodFile); } $this->saveSort($this->currFolder, array_merge(array($name), $sort)); } function insertBefore($name, $is_folder) { if (!$this->id) { return trigger_error("Node.insertBefore() failed, this action cannot be executed for the root element", E_USER_ERROR); } $Parent = new Node($this->getIdByFullPath($this->currFolder)); if (in_array($name, $Parent->getChildNames($Parent->getCurrFolder()))) { return trigger_error("Node.insertBefore() failed, there is already a node with such name", E_USER_ERROR); } $sort = $this->loadSort($this->currFolder); $key = array_search($this->path, $sort); if ($key === false) { return trigger_error("Node.insertBefore() failed, unknown error", E_USER_ERROR); } if ($is_folder) { IoDir::create($this->currFolder.'/'.$name, $this->chmodDir); IoFile::create($this->currFolder.'/'.$name.'/'.$this->sortFile, $this->chmodFile); } else { IoFile::create($this->currFolder.'/'.$name, $this->chmodFile); } $a1 = array_slice($sort, 0, $key); $a3 = array_slice($sort, $key); $this->saveSort($this->currFolder, array_merge($a1, array($name), $a3)); } function insertAfter($name, $is_folder) { if (!$this->id) { return trigger_error("Node.insertAfter() failed, this action cannot be executed for the root element", E_USER_ERROR); } $Parent = new Node($this->getIdByFullPath($this->currFolder)); if (in_array($name, $Parent->getChildNames($Parent->getCurrFolder()))) { return trigger_error("Node.insertAfter() failed, there is already a node with such name", E_USER_ERROR); } $sort = $this->loadSort($this->currFolder); $key = array_search($this->path, $sort); if ($key === false) { return trigger_error("Node.insertAfter() failed, unknown error", E_USER_ERROR); } if ($is_folder) { IoDir::create($this->currFolder.'/'.$name, $this->chmodDir); IoFile::create($this->currFolder.'/'.$name.'/'.$this->sortFile, $this->chmodFile); } else { IoFile::create($this->currFolder.'/'.$name, $this->chmodFile); } $a1 = array_slice($sort, 0, $key+1); $a3 = array_slice($sort, $key+1); $this->saveSort($this->currFolder, array_merge($a1, array($name), $a3)); } function insertInsideAtStart($name, $is_folder) { if (!$this->id) { return trigger_error("Node.insertInsideAtStart() failed, this action cannot be executed for the root element", E_USER_ERROR); } if (!$this->isFolder()) { return trigger_error("Node.insertInsideAtStart() failed, current node is not a folder", E_USER_ERROR); } if (in_array($name, $this->getChildNames($this->path))) { return trigger_error("Node.insertInsideAtStart() failed, there is already a node with such name", E_USER_ERROR); } $sort = $this->loadSort($this->path); if ($is_folder) { IoDir::create($this->path.'/'.$name, $this->chmodDir); IoFile::create($this->path.'/'.$name.'/'.$this->sortFile, $this->chmodFile); } else { IoFile::create($this->path.'/'.$name, $this->chmodFile); } $this->saveSort($this->path, array_merge(array($name), $sort)); } function insertInsideAtEnd($name, $is_folder) { if (!$this->id) { return trigger_error("Node.insertInsideAtEnd() failed, this action cannot be executed for the root element", E_USER_ERROR); } if (!$this->isFolder()) { return trigger_error("Node.insertInsideAtEnd() failed, current node is not a folder", E_USER_ERROR); } if (in_array($name, $this->getChildNames($this->path))) { return trigger_error("Node.insertInsideAtEnd() failed, there is already a node with such name", E_USER_ERROR); } $sort = $this->loadSort($this->path); if ($is_folder) { IoDir::create($this->path.'/'.$name, $this->chmodDir); IoFile::create($this->path.'/'.$name.'/'.$this->sortFile, $this->chmodFile); } else { IoFile::create($this->path.'/'.$name, $this->chmodFile); } $this->saveSort($this->path, array_merge($sort, array($name))); } function remove() { if (!$this->id) { return trigger_error("Node.remove() failed, this action cannot be executed for the root element", E_USER_ERROR); } if ($this->isFolder()) { if (count($this->getChildNames($this->path))) { return trigger_error("Node.remove() failed, there are still other nodes in the folder", E_USER_ERROR); } IoFile::delete($this->path.'/'.$this->sortFile); IoDir::delete($this->path); $this->fixSort($this->currFolder); } else { IoFile::delete($this->path); $this->fixSort($this->currFolder); } } // ---- // INFO // ---- function isDoc() { return is_a($this->io, 'IoFile'); } function isFolder() { return is_a($this->io, 'IoDir'); } function getPath() { return $this->path; } function getCurrFolder() { return $this->currFolder; } function getName() { if (!$this->id) return null; return substr($this->path, strlen(dirname($this->path).'/')); } // ---------- // HELP FUNCS // ---------- function getChildNames($folder) { $names = IoDir::read($folder, array($this->sortFile)); foreach ($names as $k => $path) { $names[$k] = substr($path, strlen(dirname($path).'/')); } return $names; } function getIdByFullPath($path) { return substr($path, strlen($this->root.'/')); } // ---- // SORT // ---- // returns array of given folder nodes (full paths) function loadSort($folder) { $nodes = IoDir::read($folder, array($this->sortFile)); $sort = IoFile::read($folder.'/'.$this->sortFile); $sort = $sort ? explode("\n", $sort) : array(); foreach ($sort as $k => $v) { $sort[$k] = trim($v); } $sort2 = array(); foreach ($sort as $node) { $node = $folder.'/'.$node; if (in_array($node, $nodes)) { $sort2[] = $node; } } foreach ($nodes as $node) { if (!in_array($node, $sort2)) { $sort2[] = $node; } } return $sort2; } // $arr can contain full paths or only node name function saveSort($folder, $arr) { $sort = array(); foreach ($arr as $node) { $sort[] = strpos($node, '/') !== false ? substr($node, (int)strrpos($node, '/')+1) : $node; } IoFile::write($folder.'/'.$this->sortFile, implode("\r\n", $sort)); } function fixSort($folder) { $nodes = $this->loadSort($folder); $this->saveSort($folder, $nodes); } } ?> --- NEW FILE: functions_admin.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions_admin.php,v 1.1 2007/02/15 12:43:46 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /** * Public mx_bugsbt class. * */ class mx_bugsbt_admin extends mx_bugsbt_public { /** * load admin module * * @param unknown_type $module_name send module name to load it */ function adminmodule( $module_name ) { if ( !class_exists( 'bugsbt_' . $module_name ) ) { global $module_root_path, $phpEx; $this->module_name = $module_name; require_once( $module_root_path . 'bugsbt/admin/admin_' . $module_name . '.' . $phpEx ); eval( '$this->modules[' . $module_name . '] = new mx_bugsbt_' . $module_name . '();' ); if ( method_exists( $this->modules[$module_name], 'init' ) ) { $this->modules[$module_name]->init(); } } } /** * Enter description here... * * @param unknown_type $cat_parent * @param unknown_type $depth */ function admin_cat_main( $cat_parent = 0, $depth = 0 ) { global $phpbb_root_path, $template, $phpEx, $lang, $images, $module_root_path, $theme; $pre = str_repeat( ' ', $depth ); if ( isset( $this->subcat_rowset[$cat_parent] ) ) { foreach( $this->subcat_rowset[$cat_parent] as $category_id => $category ) { $category_details = '<span class="gensmall">' . $category['category_details'] . '</span>'; $category_id = $category['category_id']; $category_name = $category['category_name']; $temp_url = append_sid( $module_root_path . "admin/admin_bugsbt.$phpEx?action=cat_manage&mode=edit&cat=$category_id" ); $edit = '<a href="' . $temp_url . '">'.$lang['Edit'].'</a>'; $temp_url = append_sid( $module_root_path . "admin/admin_bugsbt.$phpEx?action=cat_manage&mode=delete&cat=$category_id" ); $delete = '<a href="' . $temp_url . '" class="gen">'.$lang['Delete'].'</a>'; $temp_url = append_sid( $module_root_path . "admin/admin_bugsbt.$phpEx?action=cat_manage&mode=up&cat=$category_id" ); $up = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_up'] . '</a>'; $temp_url = append_sid( $module_root_path . "admin/admin_bugsbt.$phpEx?action=cat_manage&mode=down&cat=$category_id" ); $down = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_down'] . '</a>'; $row_class = ( !( $ss % 2 ) ) ? $theme['td_class1'] : $theme['td_class2']; switch ( $depth ) { case 0: // Product $template->assign_block_vars( 'productrow', array( 'CATEGORY' => $category_name, 'CATEGORY_ID' => $category_id, 'CAT_DESCRIPTION' => $category_details, 'U_EDIT' => $edit, 'U_DELETE' => $delete, 'U_UP' => $up, 'U_DOWN' => $down, 'ROW_CLASS' => $row_class, 'PRE' => $pre )); break; case 1: // Product $template->assign_block_vars( 'productrow.edition', array( 'CATEGORY' => $category_name, 'CATEGORY_ID' => $category_id, 'CAT_DESCRIPTION' => $category_details, 'U_EDIT' => $edit, 'U_DELETE' => $delete, 'U_UP' => $up, 'U_DOWN' => $down, 'ROW_CLASS' => $row_class, 'PRE' => $pre )); break; case 2: // Product $template->assign_block_vars( 'productrow.edition.build', array( 'CATEGORY' => $category_name, 'CATEGORY_ID' => $category_id, 'CAT_DESCRIPTION' => $category_details, 'U_EDIT' => $edit, 'U_DELETE' => $delete, 'U_UP' => $up, 'U_DOWN' => $down, 'ROW_CLASS' => $row_class, 'PRE' => $pre )); break; } $this->admin_cat_main( $category_id, $depth + 1 ); } return; } return; } /** * Enter description here... * * @param unknown_type $sel_id * @param unknown_type $use_default_option * @param unknown_type $select_name * @return unknown */ function get_forums( $sel_id = 0, $use_default_option = false, $select_name = 'forum_id' ) { global $db, $lang; $sql = "SELECT forum_id, forum_name FROM " . FORUMS_TABLE; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, "Couldn't get list of forums", "", __LINE__, __FILE__, $sql ); } $forumlist = '<select name="'.$select_name.'">'; if ( $sel_id == 0 ) { $forumlist .= '<option value="0" selected >'.$lang['Select_topic_id'].'</option>'; } if ( $use_default_option ) { $status = $sel_id == "-1" ? "selected" : ""; $forumlist .= '<option value="-1" '.$status.' >::'.$lang['Use_default'].'::</option>'; } while ( $row = $db->sql_fetchrow( $result ) ) { if ( $sel_id == $row['forum_id'] ) { $status = "selected"; } else { $status = ''; } $forumlist .= '<option value="' . $row['forum_id'] . '" ' . $status . '>' . $row['forum_name'] . '</option>'; } $forumlist .= '</select>'; return $forumlist; } /** * Enter description here... * * @param unknown_type $id * @param unknown_type $select * @return unknown */ function get_list_types( $id, $select ) { global $db; $idfield = 'id'; $namefield = 'type'; $sql = "SELECT * FROM " . BUGSBT_TYPES_TABLE; if ( $select == 0 ) { $sql .= " WHERE $idfield <> $id"; } if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, "Couldn't get list of types", "", __LINE__, __FILE__, $sql ); } $typelist = ""; while ( $row = $db->sql_fetchrow( $result ) ) { $typelist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n"; } return( $typelist ); } } ?> --- NEW FILE: functions_bugsbt.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions_bugsbt.php,v 1.1 2007/02/15 12:43:47 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /** * Public mx_kb class. * */ [...2020 lines suppressed...] { // Not translating double quotes // Remove double quote from translation table unset( $trans_tbl["""] ); } return strtr ( $string, $trans_tbl ); } */ } // // Just to be safe ;o) // /* if ( !defined( "ENT_COMPAT" ) ) define( "ENT_COMPAT", 2 ); if ( !defined( "ENT_NOQUOTES" ) ) define( "ENT_NOQUOTES", 0 ); if ( !defined( "ENT_QUOTES" ) ) define( "ENT_QUOTES", 3 ); */ ?> --- NEW FILE: functions_comment.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions_comment.php,v 1.1 2007/02/15 12:43:47 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /** * Enter description here... * */ [...1314 lines suppressed...] $return_data = $this->delete_phpbb_post($this->forum_id, $this->topic_id, $cid ); $this->validate_topic_id(); break; case 'insert': $return_data = $this->insert_phpbb_post( $title, $comments_text, $this->forum_id, $user_id, $username, $user_attach_sig, $this->topic_id, '', $title_first, $comments_text_first, $comment_bbcode_uid ); break; case 'update': $return_data = $this->insert_phpbb_post( $title, $comments_text, $this->forum_id, $user_id, $username, $user_attach_sig, $this->topic_id, $cid, $title_first, $comments_text_first, $comment_bbcode_uid ); break; default: mx_message_die(GENERAL_ERROR, 'bad post mode'); } return $return_data; } } ?> --- NEW FILE: bugsbt_constants.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: bugsbt_constants.php,v 1.1 2007/02/15 12:43:46 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // ------------------------------------------------------------------------- // This file defines specific constants for the module // ------------------------------------------------------------------------- define( 'BUGSBT_BUGS_TABLE', $mx_table_prefix . 'bugsbt_bugs' ); define( 'BUGSBT_PRODUCTS_TABLE', $mx_table_prefix . 'bugsbt_products' ); define( 'BUGSBT_EDITIONS_TABLE', $mx_table_prefix . 'bugsbt_editions' ); define( 'BUGSBT_BUILDS_TABLE', $mx_table_prefix . 'bugsbt_builds' ); define( 'BUGSBT_TYPES_TABLE', $mx_table_prefix . 'bugsbt_types' ); define( 'BUGSBT_STATUS_TABLE', $mx_table_prefix . 'bugsbt_status' ); define( 'BUGSBT_CONFIG_TABLE', $mx_table_prefix . 'bugsbt_config' ); define( 'BUGSBT_COMMENTS_TABLE', $mx_table_prefix . 'bugsbt_comments' ); define( 'BUGSBT_CUSTOM_TABLE', $mx_table_prefix . 'bugsbt_custom' ); define( 'BUGSBT_CUSTOM_DATA_TABLE', $mx_table_prefix . 'bugsbt_customdata' ); // ------------------------------------------------------------------------- // Field Types // ------------------------------------------------------------------------- define( 'INPUT', 0 ); define( 'TEXTAREA', 1 ); define( 'RADIO', 2 ); define( 'SELECT', 3 ); define( 'SELECT_MULTIPLE', 4 ); define( 'CHECKBOX', 5 ); // ------------------------------------------------------------------------- // Footer Copyrights // ------------------------------------------------------------------------- if (is_object($mx_page)) { // ------------------------------------------------------------------------- // Extend User Style with module lang and images // Usage: $mx_user->extend(LANG, IMAGES) // Switches: // - LANG: MX_LANG_MAIN (default), MX_LANG_ADMIN, MX_LANG_ALL, MX_LANG_NONE // - IMAGES: MX_IMAGES (default), MX_IMAGES_NONE // ------------------------------------------------------------------------- $mx_user->extend(); $mx_page->add_copyright( 'mxBB bugsBT BugTracker Module' ); } ?> --- NEW FILE: functions_auth.php --- <?php /** * * @package mxBB Portal Module - mx_bugsbt * @version $Id: functions_auth.php,v 1.1 2007/02/15 12:43:46 jonohlsson Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Cezary Tomczak] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /** * Auth Defs. * */ define('BUGSBT_AUTH_ALL', 0); // In reality only option used ;) define('BUGSBT_AUTH_VIEW', 1); define('BUGSBT_AUTH_EDIT', 2); define('BUGSBT_AUTH_DELETE', 3); define('BUGSBT_AUTH_POST', 4); //define('BUGSBT_AUTH_RATE', 5); define('BUGSBT_AUTH_VIEW_COMMENT', 10); define('BUGSBT_AUTH_POST_COMMENT', 11); define('BUGSBT_AUTH_EDIT_COMMENT', 12); define('BUGSBT_AUTH_DELETE_COMMENT', 13); define('BUGSBT_AUTH_APPROVAL', 20); define('BUGSBT_AUTH_APPROVAL_EDIT', 21); /** * Auth API. * * $class->auth_user['auth_view']; * $class->auth_user['auth_post']; * $class->auth_user['auth_edit']; * $class->auth_user['auth_delete']; * * $class->auth_user['auth_approval']; * $class->auth_user['auth_approval_edit']; * * // $class->auth_user['auth_rate']; * * $class->auth_user['auth_view_comment']; * $class->auth_user['auth_post_comment']; * $class->auth_user['auth_edit_comment']; * $class->auth_user['auth_delete_comment']; * * $class->auth_user['auth_mod']; */ /** * Enter description here... * */ class mx_bugsbt_auth { var $auth_user = array(); /** * Enter description here... * * @param unknown_type $type * @param unknown_type $cat_id * @param unknown_type $userdata * @param unknown_type $f_access * @return unknown */ function auth( $type, $cat_id, $userdata, $f_access = '' ) { global $db, $lang; switch ( $type ) { case BUGSBT_AUTH_ALL: $a_sql = 'a.auth_view, a.auth_edit, a.auth_delete, a.auth_post, a.auth_view_comment, a.auth_post_comment, a.auth_edit_comment, a.auth_delete_comment, a.auth_approval, a.auth_approval_edit'; $a_sql_groups = 'a.auth_view_groups, a.auth_edit_groups, a.auth_delete_groups, a.auth_post_groups, a.auth_view_comment_groups, a.auth_post_comment_groups, a.auth_edit_comment_groups, a.auth_delete_comment_groups, a.auth_approval_groups, a.auth_approval_edit_groups'; $auth_fields = array( 'auth_view', 'auth_edit', 'auth_delete', 'auth_post', 'auth_view_comment', 'auth_post_comment', 'auth_edit_comment', 'auth_delete_comment', 'auth_approval', 'auth_approval_edit' ); $auth_fields_groups = array( 'auth_view_groups', 'auth_edit_groups', 'auth_delete_groups', 'auth_post_groups', 'auth_view_comment_groups', 'auth_post_comment_groups', 'auth_edit_comment_groups', 'auth_delete_comment_groups', 'auth_approval_groups', 'auth_approval_edit_groups' ); break; case BUGSBT_AUTH_VIEW: $a_sql = 'a.auth_view'; $a_sql_groups = 'a.auth_view_groups'; $auth_fields = array( 'auth_view' ); $auth_fields_groups = array( 'auth_view_groups' ); break; case BUGSBT_AUTH_EDIT: $a_sql = 'a.auth_edit'; $a_sql_groups = 'a.auth_edit_groups'; $auth_fields = array( 'auth_edit' ); $auth_fields_groups = array( 'auth_edit_groups' ); break; case BUGSBT_AUTH_DELETE: $a_sql = 'a.auth_delete'; $a_sql_groups = 'a.auth_delete_groups'; $auth_fields = array( 'auth_delete' ); $auth_fields_groups = array( 'auth_delete_groups' ); break; case BUGSBT_AUTH_POST: $a_sql = 'a.auth_post'; $a_sql_groups = 'a.auth_post_groups'; $auth_fields = array( 'auth_post' ); $auth_fields_groups = array( 'auth_post_groups' ); break; case BUGSBT_AUTH_VIEW_COMMENT: $a_sql = 'a.auth_view_comment'; $a_sql_groups = 'a.auth_view_comment_groups'; $auth_fields = array( 'auth_view_comment' ); $auth_fields_groups = array( 'auth_view_comment_groups' ); break; case BUGSBT_AUTH_POST_COMMENT: $a_sql = 'a.auth_post_comment'; $a_sql_groups = 'a.auth_post_comment_groups'; $auth_fields = array( 'auth_post_comment' ); $auth_fields_groups = array( 'auth_post_comment_groups' ); break; case BUGSBT_AUTH_EDIT_COMMENT: $a_sql = 'a.auth_edit_comment'; $a_sql_groups = 'a.auth_edit_comment_groups'; $auth_fields = array( 'auth_edit_comment' ); $auth_fields_groups = array( 'auth_edit_comment_groups' ); break; case BUGSBT_AUTH_DELETE_COMMENT: $a_sql = 'a.auth_delete_comment'; $a_sql_groups = 'a.auth_delete_comment_groups'; $auth_fields = array( 'auth_delete_comment' ); $auth_fields_groups = array( 'auth_delete_comment_groups' ); break; case BUGSBT_AUTH_APPROVAL: $a_sql = 'a.auth_approval'; $a_sql_groups = 'a.auth_approval_groups'; $auth_fields = array( 'auth_approval' ); $auth_fields_groups = array( 'auth_approval_groups' ); break; case BUGSBT_AUTH_APPROVAL_EDIT: $a_sql = 'a.auth_approval_edit'; $a_sql_groups = 'a.auth_approval_edit_groups'; $auth_fields = array( 'auth_approval_edit' ); $auth_fields_groups = array( 'auth_approval_edit_groups' ); break; default: break; } $is_admin = ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? true : 0; // // If f_access has not been passed, or auth is needed to return an array of forums // then we need to pull the auth information on the given forum (or all forums) // if ( empty($f_access) ) { $forum_match_sql = ( $cat_id != AUTH_LIST_ALL ) ? "WHERE a.category_id = $cat_id" : ''; $sql = "SELECT * FROM " . BUGSBT_PRODUCTS_TABLE . " a $forum_match_sql"; if ( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Failed obtaining forum access control lists', '', __LINE__, __FILE__, $sql); } $sql_fetchrow = ( $cat_id != AUTH_LIST_ALL ) ? 'sql_fetchrow' : 'sql_fetchrowset'; if ( !($f_access = $db->$sql_fetchrow($result)) ) { $db->sql_freeresult($result); return array(); } $db->sql_freeresult($result); } $auth_user = array(); for( $i = 0; $i < count( $auth_fields ); $i++ ) { $key = $auth_fields[$i]; $key_groups = $auth_fields_groups[$i]; // If the user is logged on and the module type is either ALL or REG then the user has access // If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions // to do whatever it is they want to do ... to do this we pull relevant information for the // user (and any groups they belong to) // Now we compare the users access level against the modules. We assume here that a moderator // and admin automatically have access to an ACL module, similarly we assume admins meet an // auth requirement of MOD if ( $cat_id != AUTH_LIST_ALL ) { $value = $f_access[$key]; $value_groups = $f_access[$key_groups]; switch ( $value ) { case AUTH_ALL: $this->auth_user[$key] = true; $this->auth_user[$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_REG: $this->auth_user[$key] = ( $userdata['session_logged_in'] ) ? true : 0; $this->auth_user[$key . '_type'] = $lang['Auth_Registered_Users']; break; case AUTH_ANONYMOUS: $this->auth_user[$key] = ( ! $userdata['session_logged_in'] ) ? true : 0; $this->auth_user[$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_ACL: // PRIVATE $this->auth_user[$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $value_groups ) || mx_is_group_member( $f_access['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$key . '_type'] = $lang['Auth_Users_granted_access']; break; case AUTH_MOD: $this->auth_user[$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$key . '_type'] = $lang['Auth_Moderators']; break; case AUTH_ADMIN: $this->auth_user[$key] = $is_admin; $this->auth_user[$key . '_type'] = $lang['Auth_Administrators']; break; default: $this->auth_user[$key] = 0; break; } } else { for($k = 0; $k < count($f_access); $k++) { $value = $f_access[$k][$key]; $value_groups = $f_access[$k][$key_groups]; $f_cat_id = $f_access[$k]['category_id']; switch ( $value ) { case AUTH_ALL: $this->auth_user[$f_cat_id][$key] = true; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_REG: $this->auth_user[$f_cat_id][$key] = ( $userdata['session_logged_in'] ) ? true : 0; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Registered_Users']; break; case AUTH_ANONYMOUS: $this->auth_user[$f_cat_id][$key] = ( ! $userdata['session_logged_in'] ) ? true : 0; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_ACL: // PRIVATE $this->auth_user[$f_cat_id][$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $value_groups ) || mx_is_group_member( $f_access[$k]['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Users_granted_access']; break; case AUTH_MOD: $this->auth_user[$f_cat_id][$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access[$k]['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Moderators']; break; case AUTH_ADMIN: $this->auth_user[$f_cat_id][$key] = $is_admin; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Administrators']; break; default: $this->auth_user[$f_cat_id][$key] = 0; break; } } } } // // Is user a moderator? // if ( $cat_id != AUTH_LIST_ALL ) { $this->auth_user['auth_mod'] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access['auth_moderator_groups'] ) || $is_admin : 0; } else { for($k = 0; $k < count($f_access); $k++) { $f_cat_id = $f_access[$k]['category_id']; $this->auth_user[$f_cat_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access[$k]['auth_moderator_groups'] ) || $is_admin : 0; } } } } ?> --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |