|
From: Jon O. <jon...@us...> - 2006-08-01 21:02:22
|
Update of /cvsroot/mxbb/mx_linkdb/linkdb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22573/modules/mx_linkdb/linkdb/includes Modified Files: functions.php functions_admin.php functions_auth.php functions_comment.php functions_linkdb.php Removed Files: functions_cache.php functions_field.php Log Message: massive update Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** functions.php 5 Jul 2006 22:49:20 -0000 1.12 --- functions.php 1 Aug 2006 21:02:19 -0000 1.13 *************** *** 81,84 **** --- 81,196 ---- } + /** + * 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_kb; + global $mx_root_path, $module_root_path, $is_block, $phpEx; + + $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 ); + } + } + // since that I can't use the original function with new template system // I just copy it and chagne it *************** *** 129,133 **** if ( $action == 'category' ) { ! $upload_url = append_sid( $linkdb->this_mxurl( "action=user_upload&cat_id={$_REQUEST['cat_id']}" ) ); } else --- 241,257 ---- if ( $action == 'category' ) { ! if ( $linkdb->modules[$linkdb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_post'] || $linkdb->modules[$linkdb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_mod'] ) ! { ! $upload_url = append_sid( $linkdb->this_mxurl( "action=user_upload&cat_id={$_REQUEST['cat_id']}" ) ); ! if ( !$linkdb_config['lock_submit_site'] ) ! { ! $template->assign_block_vars( 'ADD_LINK', array() ); ! } ! } ! $mcp_url = append_sid( $linkdb->this_mxurl( "action=mcp&cat_id={$_REQUEST['cat_id']}" ) ); ! if ( $linkdb->modules[$linkdb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_mod'] ) ! { ! $template->assign_block_vars( 'MCP', array() ); ! } } else *************** *** 136,144 **** } - if ( !$linkdb_config['lock_submit_site'] || $userdata['user_level'] == ADMIN ) - { - $template->assign_block_vars( 'ADD_LINK', array() ); - } - $template->set_filenames( array( 'linkdb_header' => "link_header.tpl" )); --- 260,263 ---- *************** *** 151,154 **** --- 270,274 ---- 'L_SEARCH' => $lang['Link_Search'], 'L_UPLOAD' => $lang['AddLink'], + 'L_MCP' => $lang['MCP_title'], 'L_VIEW_ALL' => $lang['Viewall'], 'L_DESCEND_BY_HITS' => $lang['Descend_by_hits'], *************** *** 161,164 **** --- 281,285 ---- 'U_PASEARCH' => append_sid( $linkdb->this_mxurl( "action=search" ) ), 'U_UPLOAD' => $upload_url, + 'U_MCP' => $mcp_url, 'U_VIEW_ALL' => append_sid( $linkdb->this_mxurl( "action=viewall" ) ), 'U_DESCEND_BY_HITS' => append_sid( $linkdb->this_mxurl( "action=viewall&&sort_method=link_hits&sort_order=DESC" ) ), *************** *** 169,172 **** --- 290,308 ---- )); + // + // Ratings enabled for any category ? + // + if ( !empty( $linkdb->modules[$linkdb->module_name]->cat_rowset ) ) + { + foreach( $linkdb->modules[$linkdb->module_name]->cat_rowset as $cat_id => $cat_row ) + { + if ( $linkdb->modules[$linkdb->module_name]->ratings[$cat_id]['activated'] ) + { + $template->assign_block_vars( 'switch_toprated', array() ); + break; + } + } + } + $template->pparse( 'linkdb_header' ); } *************** *** 189,193 **** $template->assign_vars( array( 'L_JUMP' => $lang['Jump'], ! 'JUMPMENU' => $linkdb->modules[$linkdb->module_name]->generate_jumpbox( 0, 0, array( $_GET['cat_id'] => 1 ) ), 'S_JUMPBOX_ACTION' => append_sid( $linkdb->this_mxurl() ), 'MX_PAGE' => $page_id, --- 325,329 ---- $template->assign_vars( array( 'L_JUMP' => $lang['Jump'], ! 'JUMPMENU' => $linkdb->modules[$linkdb->module_name]->generate_jumpbox( 0, 0, array( $_GET['cat_id'] => 1, true, true, 'auth_view' ) ), 'S_JUMPBOX_ACTION' => append_sid( $linkdb->this_mxurl() ), 'MX_PAGE' => $page_id, Index: functions_admin.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions_admin.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_admin.php 8 Jul 2006 16:26:04 -0000 1.2 --- functions_admin.php 1 Aug 2006 21:02:19 -0000 1.3 *************** *** 74,85 **** // $view_level = intval( $_POST['auth_view'] ); - $post_level = intval( $_POST['auth_post'] ); - $rate_level = intval( $_POST['auth_rate'] ); - $comment_level = intval( $_POST['auth_comment'] ); $edit_level = intval( $_POST['auth_edit'] ); $delete_level = intval( $_POST['auth_delete'] ); $approval_level = intval( $_POST['auth_approval'] ); $approval_edit_level = intval( $_POST['auth_approval_edit'] ); if ( empty( $cat_name ) ) { --- 74,89 ---- // $view_level = intval( $_POST['auth_view'] ); $edit_level = intval( $_POST['auth_edit'] ); $delete_level = intval( $_POST['auth_delete'] ); + $post_level = intval( $_POST['auth_post'] ); $approval_level = intval( $_POST['auth_approval'] ); $approval_edit_level = intval( $_POST['auth_approval_edit'] ); + $rate_level = intval( $_POST['auth_rate'] ); + $comment_view_level = intval( $_POST['auth_view_comment'] ); + $comment_post_level = intval( $_POST['auth_post_comment'] ); + $comment_edit_level = intval( $_POST['auth_edit_comment'] ); + $comment_delete_level = intval( $_POST['auth_delete_comment'] ); + if ( empty( $cat_name ) ) { *************** *** 119,124 **** $cat_order += 10; ! $sql = 'INSERT INTO ' . LINK_CATEGORIES_TABLE . " (cat_name, cat_desc, cat_parent, cat_order, cat_allow_file, cat_allow_ratings, cat_allow_comments, internal_comments, autogenerate_comments, comments_forum_id, show_pretext, notify, notify_group, auth_view, auth_post, auth_rate, auth_comment, auth_edit, auth_delete, auth_approval, auth_approval_edit) ! VALUES('$cat_name', '$cat_desc', $cat_parent, $cat_order, $cat_allow_file, $cat_use_ratings, $cat_use_comments, $cat_internal_comments, $cat_autogenerate_comments, $comments_forum_id, $cat_show_pretext, $cat_notify, $cat_notify_group, $view_level, $post_level, $rate_level, $comment_level, $edit_level, $delete_level, $approval_level, $approval_edit_level)"; if ( !( $db->sql_query( $sql ) ) ) --- 123,128 ---- $cat_order += 10; ! $sql = 'INSERT INTO ' . LINK_CATEGORIES_TABLE . " (cat_name, cat_desc, cat_parent, cat_order, cat_allow_file, cat_allow_ratings, cat_allow_comments, internal_comments, autogenerate_comments, comments_forum_id, show_pretext, notify, notify_group, auth_view, auth_post, auth_rate, auth_view_comment, auth_post_comment, auth_edit_comment, auth_delete_comment, auth_edit, auth_delete, auth_approval, auth_approval_edit) ! VALUES('$cat_name', '$cat_desc', $cat_parent, $cat_order, $cat_allow_file, $cat_use_ratings, $cat_use_comments, $cat_internal_comments, $cat_autogenerate_comments, $comments_forum_id, $cat_show_pretext, $cat_notify, $cat_notify_group, $view_level, $post_level, $rate_level, $comment_view_level, $comment_post_level, $comment_edit_level, $comment_delete_level, $edit_level, $delete_level, $approval_level, $approval_edit_level)"; if ( !( $db->sql_query( $sql ) ) ) *************** *** 130,134 **** { $sql = 'UPDATE ' . LINK_CATEGORIES_TABLE . " ! SET cat_name = '$cat_name', cat_desc = '$cat_desc', cat_parent = $cat_parent, cat_allow_file = $cat_allow_file, cat_allow_ratings = $cat_use_ratings, cat_allow_comments = $cat_use_comments, internal_comments = $cat_internal_comments, autogenerate_comments = $cat_autogenerate_comments, comments_forum_id = $comments_forum_id, show_pretext = $cat_show_pretext, notify = $cat_notify, notify_group = $cat_notify_group, auth_view = $view_level, auth_post = $post_level, auth_rate = $rate_level, auth_comment = $comment_level, auth_edit = $edit_level, auth_delete = $delete_level, auth_approval = $approval_level, auth_approval_edit = $approval_edit_level WHERE cat_id = $cat_id"; --- 134,138 ---- { $sql = 'UPDATE ' . LINK_CATEGORIES_TABLE . " ! SET cat_name = '$cat_name', cat_desc = '$cat_desc', cat_parent = $cat_parent, cat_allow_file = $cat_allow_file, cat_allow_ratings = $cat_use_ratings, cat_allow_comments = $cat_use_comments, internal_comments = $cat_internal_comments, autogenerate_comments = $cat_autogenerate_comments, comments_forum_id = $comments_forum_id, show_pretext = $cat_show_pretext, notify = $cat_notify, notify_group = $cat_notify_group, auth_view = $view_level, auth_post = $post_level, auth_rate = $rate_level, auth_view_comment = '" . $comment_view_level . "', auth_post_comment = '" . $comment_post_level . "', auth_edit_comment = '" . $comment_edit_level . "', auth_delete_comment = '" . $comment_delete_level . "', auth_edit = $edit_level, auth_delete = $delete_level, auth_approval = $approval_level, auth_approval_edit = $approval_edit_level WHERE cat_id = $cat_id"; *************** *** 203,211 **** if ( $file_mode == 'delete' ) { ! $this->delete_links( $cat_id, 'category' ); } else { ! $this->move_links( $cat_id, $file_to_cat_id ); } --- 207,215 ---- if ( $file_mode == 'delete' ) { ! $this->delete_items( $cat_id, 'category' ); } else { ! $this->move_items( $cat_id, $file_to_cat_id ); } *************** *** 228,232 **** * @param unknown_type $to_cat */ ! function move_links( $from_cat, $to_cat ) { global $db; --- 232,236 ---- * @param unknown_type $to_cat */ ! function move_items( $from_cat, $to_cat ) { global $db; *************** *** 274,282 **** if ( $file_mode == 'delete' ) { ! $this->delete_links( $sub_cat_id, 'category' ); } else { ! $this->move_links( $sub_cat_id, $to_cat ); } } --- 278,286 ---- if ( $file_mode == 'delete' ) { ! $this->delete_items( $sub_cat_id, 'category' ); } else { ! $this->move_items( $sub_cat_id, $to_cat ); } } --- functions_cache.php DELETED --- Index: functions_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions_comment.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_comment.php 5 Jul 2006 22:49:20 -0000 1.2 --- functions_comment.php 1 Aug 2006 21:02:19 -0000 1.3 *************** *** 71,75 **** $sql = 'SELECT * FROM ' . LINKS_TABLE . " ! WHERE file_id = $item_data"; if ( !( $result = $db->sql_query( $sql ) ) ) --- 71,75 ---- $sql = 'SELECT * FROM ' . LINKS_TABLE . " ! WHERE link_id = $item_data"; if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 82,87 **** $this->comments_type = $comments_type == 'internal' ? 'internal' : 'phpbb'; ! $this->cat_id = $item_data['file_catid']; ! $this->item_id = $item_data['file_id']; $this->topic_id = $item_data['topic_id']; --- 82,87 ---- $this->comments_type = $comments_type == 'internal' ? 'internal' : 'phpbb'; ! $this->cat_id = $item_data['link_catid']; ! $this->item_id = $item_data['link_id']; $this->topic_id = $item_data['topic_id']; *************** *** 91,99 **** $this->forum_id = $linkdb->modules[$linkdb->module_name]->comments[$this->cat_id]['comments_forum_id']; ! $this->auth['auth_view'] = $linkdb->modules[$linkdb->module_name]->auth[$this->cat_id]['auth_view_comment']; ! $this->auth['auth_post'] = $linkdb->modules[$linkdb->module_name]->auth[$this->cat_id]['auth_post_comment']; ! $this->auth['auth_edit'] = $linkdb->modules[$linkdb->module_name]->auth[$this->cat_id]['auth_edit_comment']; ! $this->auth['auth_delete'] = $linkdb->modules[$linkdb->module_name]->auth[$this->cat_id]['auth_delete_comment']; ! $this->auth['auth_mod'] = $linkdb->modules[$linkdb->module_name]->auth[$this->cat_id]['auth_mod']; // --- 91,99 ---- $this->forum_id = $linkdb->modules[$linkdb->module_name]->comments[$this->cat_id]['comments_forum_id']; ! $this->auth['auth_view'] = $linkdb->modules[$linkdb->module_name]->auth_user[$this->cat_id]['auth_view_comment']; ! $this->auth['auth_post'] = $linkdb->modules[$linkdb->module_name]->auth_user[$this->cat_id]['auth_post_comment']; ! $this->auth['auth_edit'] = $linkdb->modules[$linkdb->module_name]->auth_user[$this->cat_id]['auth_edit_comment']; ! $this->auth['auth_delete'] = $linkdb->modules[$linkdb->module_name]->auth_user[$this->cat_id]['auth_delete_comment']; ! $this->auth['auth_mod'] = $linkdb->modules[$linkdb->module_name]->auth_user[$this->cat_id]['auth_mod']; // *************** *** 101,105 **** // $this->pagination_action = 'action=file'; ! $this->pagination_target = 'file_id='; $this->pagination_num = empty($show_num_comments) ? $this->pagination_num : $show_num_comments; --- 101,105 ---- // $this->pagination_action = 'action=file'; ! $this->pagination_target = 'link_id='; $this->pagination_num = empty($show_num_comments) ? $this->pagination_num : $show_num_comments; *************** *** 605,611 **** global $db, $template; ! $sql = "SELECT COUNT(file_id) AS number FROM " . LINK_COMMENTS_TABLE . " ! WHERE file_id = " . $this->item_id; if ( !($result = $db->sql_query($sql)) ) --- 605,611 ---- global $db, $template; ! $sql = "SELECT COUNT(link_id) AS number FROM " . LINK_COMMENTS_TABLE . " ! WHERE link_id = " . $this->item_id; if ( !($result = $db->sql_query($sql)) ) *************** *** 619,623 **** FROM ' . LINK_COMMENTS_TABLE . ' AS c LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id ! WHERE c.file_id = '" . $this->item_id . "' ORDER BY c.comments_id DESC"; --- 619,623 ---- FROM ' . LINK_COMMENTS_TABLE . ' AS c LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id ! WHERE c.link_id = '" . $this->item_id . "' ORDER BY c.comments_id DESC"; *************** *** 1288,1292 **** $sql = "UPDATE " . LINKS_TABLE . " SET topic_id = '0' ! WHERE file_id = ". $this->item_id; if ( !( $result = $db->sql_query( $sql ) ) ) --- 1288,1292 ---- $sql = "UPDATE " . LINKS_TABLE . " SET topic_id = '0' ! WHERE link_id = ". $this->item_id; if ( !( $result = $db->sql_query( $sql ) ) ) Index: functions_auth.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions_auth.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_auth.php 3 Jul 2006 20:11:30 -0000 1.2 --- functions_auth.php 1 Aug 2006 21:02:19 -0000 1.3 *************** *** 15,18 **** --- 15,58 ---- /** + * Auth Defs. + * + */ + define('LINKDB_AUTH_ALL', 0); // In reality only option used ;) + define('LINKDB_AUTH_VIEW', 1); + define('LINKDB_AUTH_EDIT', 2); + define('LINKDB_AUTH_DELETE', 3); + define('LINKDB_AUTH_POST', 4); + define('LINKDB_AUTH_RATE', 5); + + define('LINKDB_AUTH_VIEW_COMMENT', 10); + define('LINKDB_AUTH_POST_COMMENT', 11); + define('LINKDB_AUTH_EDIT_COMMENT', 12); + define('LINKDB_AUTH_DELETE_COMMENT', 13); + + define('LINKDB_AUTH_APPROVAL', 20); + define('LINKDB_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... * *************** *** 29,36 **** * @param unknown_type $userdata * @param unknown_type $f_access - * @param unknown_type $f_access_group * @return unknown */ ! function auth( $type, $cat_id, $userdata, $f_access = '', $f_access_group = '' ) { global $db, $lang; --- 69,75 ---- * @param unknown_type $userdata * @param unknown_type $f_access * @return unknown */ ! function auth( $type, $cat_id, $userdata, $f_access = '' ) { global $db, $lang; *************** *** 38,49 **** switch ( $type ) { ! case AUTH_ALL: ! $a_sql = 'a.auth_view, a.auth_post, a.auth_rate, a.auth_comment, a.auth_edit, a.auth_delete, a.auth_approval, a.auth_approval_edit'; ! $a_sql_groups = 'a.auth_view_groups, a.auth_post_groups, a.auth_rate_groups, a.auth_comment_groups, a.auth_edit_groups, a.auth_delete_groups, a.auth_approval_groups, a.auth_approval_edit_groups'; ! $auth_fields = array( 'auth_view', 'auth_post', 'auth_rate', 'auth_comment', 'auth_edit', 'auth_delete', 'auth_approval', 'auth_approval_edit' ); ! $auth_fields_groups = array( 'auth_view_groups', 'auth_post_groups', 'auth_rate_groups', 'auth_comment_groups', 'auth_edit_groups', 'auth_delete_groups', 'auth_approval_groups', 'auth_approval_edit_groups' ); break; ! case AUTH_VIEW: $a_sql = 'a.auth_view'; $a_sql_groups = 'a.auth_view_groups'; --- 77,88 ---- switch ( $type ) { ! case LINKDB_AUTH_ALL: ! $a_sql = 'a.auth_view, a.auth_edit, a.auth_delete, a.auth_post, a.auth_rate, 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_rate_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_rate', '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_rate_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 LINKDB_AUTH_VIEW: $a_sql = 'a.auth_view'; $a_sql_groups = 'a.auth_view_groups'; *************** *** 52,56 **** break; ! case AUTH_POST: $a_sql = 'a.auth_post'; $a_sql_groups = 'a.auth_post_groups'; --- 91,109 ---- break; ! case LINKDB_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 LINKDB_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 LINKDB_AUTH_POST: $a_sql = 'a.auth_post'; $a_sql_groups = 'a.auth_post_groups'; *************** *** 59,63 **** break; ! case AUTH_RATE: $a_sql = 'a.auth_rate'; $a_sql_groups = 'a.auth_rate_groups'; --- 112,116 ---- break; ! case LINKDB_AUTH_RATE: $a_sql = 'a.auth_rate'; $a_sql_groups = 'a.auth_rate_groups'; *************** *** 66,91 **** break; ! case AUTH_COMMENT: ! $a_sql = 'a.auth_comment'; ! $a_sql_groups = 'a.auth_comment_groups'; ! $auth_fields = array( 'auth_comment' ); ! $auth_fields_groups = array( 'auth_comment_groups' ); break; ! case 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 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 AUTH_APPROVAL: $a_sql = 'a.auth_approval'; $a_sql_groups = 'a.auth_approval_groups'; --- 119,151 ---- break; ! case LINKDB_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 LINKDB_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 LINKDB_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 LINKDB_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 LINKDB_AUTH_APPROVAL: $a_sql = 'a.auth_approval'; $a_sql_groups = 'a.auth_approval_groups'; *************** *** 94,98 **** break; ! case AUTH_APPROVAL_EDIT: $a_sql = 'a.auth_approval_edit'; $a_sql_groups = 'a.auth_approval_edit_groups'; --- 154,158 ---- break; ! case LINKDB_AUTH_APPROVAL_EDIT: $a_sql = 'a.auth_approval_edit'; $a_sql_groups = 'a.auth_approval_edit_groups'; *************** *** 115,119 **** $forum_match_sql = ( $cat_id != AUTH_LIST_ALL ) ? "WHERE a.cat_id = $cat_id" : ''; ! $sql = "SELECT a.cat_id, $a_sql FROM " . LINK_CATEGORIES_TABLE . " a $forum_match_sql"; --- 175,179 ---- $forum_match_sql = ( $cat_id != AUTH_LIST_ALL ) ? "WHERE a.cat_id = $cat_id" : ''; ! $sql = "SELECT * FROM " . LINK_CATEGORIES_TABLE . " a $forum_match_sql"; *************** *** 133,162 **** } - // - // If f_access_group 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_group) ) - { - $forum_match_sql = ( $cat_id != AUTH_LIST_ALL ) ? "WHERE a.cat_id = $cat_id" : ''; - - $sql = "SELECT a.cat_id, $a_sql_groups, a.auth_moderator_groups - FROM " . LINK_CATEGORIES_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_group = $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++ ) --- 193,196 ---- *************** *** 175,179 **** { $value = $f_access[$key]; ! $value_groups = $f_access_group[$key_groups]; switch ( $value ) --- 209,213 ---- { $value = $f_access[$key]; ! $value_groups = $f_access[$key_groups]; switch ( $value ) *************** *** 194,204 **** break; ! case AUTH_ACL: // PRIVATE ! $this->auth_user[$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $value_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_group['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$key . '_type'] = $lang['Auth_Moderators']; break; --- 228,238 ---- break; ! case AUTH_ACL: // PRIVATE OR MODERATOR ! $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: // MODERATOR ONLY ! $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; *************** *** 219,227 **** { $value = $f_access[$k][$key]; ! $value_groups = $f_access_group[$k][$key_groups]; $f_cat_id = $f_access[$k]['cat_id']; - switch ( $value ) { --- 253,260 ---- { $value = $f_access[$k][$key]; ! $value_groups = $f_access[$k][$key_groups]; $f_cat_id = $f_access[$k]['cat_id']; switch ( $value ) { *************** *** 241,251 **** break; ! case AUTH_ACL: // PRIVATE ! $this->auth_user[$f_cat_id][$key] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $value_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_group[$k]['auth_moderator_groups'] ) || $is_admin : 0; $this->auth_user[$f_cat_id][$key . '_type'] = $lang['Auth_Moderators']; break; --- 274,284 ---- break; ! case AUTH_ACL: // PRIVATE OR MODERATOR ! $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: // MODERATOR ONLY ! $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; *************** *** 269,273 **** if ( $cat_id != AUTH_LIST_ALL ) { ! $this->auth_user['auth_mod'] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access_group['auth_moderator_groups'] ) || $is_admin : 0; } else --- 302,306 ---- 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 *************** *** 276,284 **** { $f_cat_id = $f_access[$k]['cat_id']; ! ! $this->auth_user[$f_cat_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? mx_is_group_member( $f_access_group[$k]['auth_moderator_groups'] ) || $is_admin : 0; } } - return $this->auth_user; } --- 309,315 ---- { $f_cat_id = $f_access[$k]['cat_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; } } } Index: functions_linkdb.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions_linkdb.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** functions_linkdb.php 8 Jul 2006 16:26:04 -0000 1.15 --- functions_linkdb.php 1 Aug 2006 21:02:19 -0000 1.16 *************** *** 134,168 **** $this->subcat_rowset[$cat_rowset[$i]['cat_parent']][$cat_rowset[$i]['cat_id']] = $cat_rowset[$i]; $this->total_cat++; - } ! // ! // Comments ! // Note: some settings are category dependent, but may use default config settings ! // ! $this->comments[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_comments'] == -1 ? ($linkdb_config['use_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_comments'] == 1 ? true : false ); ! $this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] = $cat_rowset[$i]['internal_comments'] == -1 ? ($linkdb_config['internal_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['internal_comments'] == 1 ? true : false ); // phpBB or internal comments ! $this->comments[$cat_rowset[$i]['cat_id']]['autogenerate_comments'] = $cat_rowset[$i]['autogenerate_comments'] == -1 ? ($linkdb_config['autogenerate_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['autogenerate_comments'] == 1 ? true : false ); // autocreate comments when updated ! $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id'] = $cat_rowset[$i]['comments_forum_id'] < 1 ? ( intval($linkdb_config['comments_forum_id']) ) : ( intval($cat_rowset[$i]['comments_forum_id']) ); // phpBB target forum (only used for phpBB comments) ! if (!$this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] && intval($this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']) < 1) ! { ! mx_message_die(GENERAL_ERROR, 'Init Failure, phpBB comments with no target forum_id :(<br> Category: ' . $cat_rowset[$i]['cat_name'] . ' Forum_id: ' . $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']); ! } ! // ! // Ratings ! // ! $this->ratings[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_ratings'] == -1 ? ($linkdb_config['use_ratings'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_ratings'] == 1 ? true : false ); ! // ! // Information ! // ! $this->information[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['show_pretext'] == -1 ? ($linkdb_config['show_pretext'] == 1 ? true : false ) : ( $cat_rowset[$i]['show_pretext'] == 1 ? true : false ); // phpBB or internal ratings ! // ! // Notification ! // ! $this->notification[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['notify'] == -1 ? (intval($linkdb_config['notify'])) : ( intval($cat_rowset[$i]['notify']) ); // -1, 0, 1, 2 ! $this->notification[$cat_rowset[$i]['cat_id']]['notify_group'] = $cat_rowset[$i]['notify_group'] == -1 || $cat_rowset[$i]['notify_group'] == 0 ? (intval($linkdb_config['notify_group'])) : ( intval($cat_rowset[$i]['notify_group']) ); // Group_id } } --- 134,168 ---- $this->subcat_rowset[$cat_rowset[$i]['cat_parent']][$cat_rowset[$i]['cat_id']] = $cat_rowset[$i]; $this->total_cat++; ! // ! // Comments ! // Note: some settings are category dependent, but may use default config settings ! // ! $this->comments[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_comments'] == -1 ? ($linkdb_config['use_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_comments'] == 1 ? true : false ); ! $this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] = $cat_rowset[$i]['internal_comments'] == -1 ? ($linkdb_config['internal_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['internal_comments'] == 1 ? true : false ); // phpBB or internal comments ! $this->comments[$cat_rowset[$i]['cat_id']]['autogenerate_comments'] = $cat_rowset[$i]['autogenerate_comments'] == -1 ? ($linkdb_config['autogenerate_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['autogenerate_comments'] == 1 ? true : false ); // autocreate comments when updated ! $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id'] = $cat_rowset[$i]['comments_forum_id'] < 1 ? ( intval($linkdb_config['comments_forum_id']) ) : ( intval($cat_rowset[$i]['comments_forum_id']) ); // phpBB target forum (only used for phpBB comments) ! if (!$this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] && intval($this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']) < 1) ! { ! mx_message_die(GENERAL_ERROR, 'Init Failure, phpBB comments with no target forum_id :(<br> Category: ' . $cat_rowset[$i]['cat_name'] . ' Forum_id: ' . $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']); ! } ! // ! // Ratings ! // ! $this->ratings[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_ratings'] == -1 ? ($linkdb_config['use_ratings'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_ratings'] == 1 ? true : false ); ! // ! // Information ! // ! $this->information[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['show_pretext'] == -1 ? ($linkdb_config['show_pretext'] == 1 ? true : false ) : ( $cat_rowset[$i]['show_pretext'] == 1 ? true : false ); // phpBB or internal ratings ! // ! // Notification ! // ! $this->notification[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['notify'] == -1 ? (intval($linkdb_config['notify'])) : ( intval($cat_rowset[$i]['notify']) ); // -1, 0, 1, 2 ! $this->notification[$cat_rowset[$i]['cat_id']]['notify_group'] = $cat_rowset[$i]['notify_group'] == -1 || $cat_rowset[$i]['notify_group'] == 0 ? (intval($linkdb_config['notify_group'])) : ( intval($cat_rowset[$i]['notify_group']) ); // Group_id ! } } } *************** *** 312,316 **** * @return unknown */ ! function file_in_cat( $cat_id ) { if ( $this->cat_rowset[$cat_id]['cat_links'] == -1 || $this->modified ) --- 312,316 ---- * @return unknown */ ! function items_in_cat( $cat_id ) { if ( $this->cat_rowset[$cat_id]['cat_links'] == -1 || $this->modified ) *************** *** 329,340 **** } ! $files_no = 0; if ( $row = $db->sql_fetchrow( $result ) ) { ! $files_no = $row['total_files']; } $sql = 'UPDATE ' . LINK_CATEGORIES_TABLE . " ! SET cat_links = $files_no WHERE cat_id = $cat_id"; --- 329,340 ---- } ! $number_of_items = 0; if ( $row = $db->sql_fetchrow( $result ) ) { ! $number_of_items = $row['total_files']; } $sql = 'UPDATE ' . LINK_CATEGORIES_TABLE . " ! SET cat_links = $number_of_items WHERE cat_id = $cat_id"; *************** *** 346,353 **** else { ! $files_no = $this->cat_rowset[$cat_id]['cat_links']; } ! return $files_no; } --- 346,353 ---- else { ! $number_of_items = $this->cat_rowset[$cat_id]['cat_links']; } ! return $number_of_items; } *************** *** 362,369 **** * @return unknown */ ! function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = false ) { global $page_id; ! static $cat_rowset = false; if ( !is_array( $cat_rowset ) ) --- 362,369 ---- * @return unknown */ ! function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = false, $auth = 'auth_view' ) { global $page_id; ! //static $cat_rowset = false; if ( !is_array( $cat_rowset ) ) *************** *** 375,379 **** foreach( $this->cat_rowset as $row ) { ! if ( $this->auth_user[$row['cat_id']]['auth_post'] ) { $cat_rowset[$row['cat_id']] = $row; --- 375,379 ---- foreach( $this->cat_rowset as $row ) { ! if ( $this->auth_user[$row['cat_id']][$auth] ) { $cat_rowset[$row['cat_id']] = $row; *************** *** 449,453 **** foreach( $this->subcat_rowset[$cat_id] as $cat_id => $cat_row ) { ! if ( $cat_row['cat_allow_file'] || !empty( $this->subcat_rowset[$cat_row['cat_id']] ) ) { $i++; --- 449,453 ---- foreach( $this->subcat_rowset[$cat_id] as $cat_id => $cat_row ) { ! if ( $this->auth_user[$cat_row['cat_id']]['auth_view'] && ( $cat_row['cat_allow_file'] || !empty( $this->subcat_rowset[$cat_row['cat_id']] ) ) ) { $i++; *************** *** 457,461 **** break; } ! $cat_sub .= (!empty($cat_sub) ? '<span class=' . $class . '>, </span>' : '') . '<a href="' . append_sid( $this->this_mxurl( 'action=category&cat_id=' . $cat_row['cat_id'] ) ) . '" class=' . $class . '>' . $cat_row['cat_name'] . '</a> '; } /* --- 457,461 ---- break; } ! $cat_sub .= (!empty($cat_sub) ? '<span class=' . $class . '>, </span>' : '') . '<a href="' . append_sid( $this->this_mxurl( 'action=category&cat_id=' . $cat_row['cat_id'] ) ) . '" class=' . $class . '>' . $cat_row['cat_name'] . '</a>'; } /* *************** *** 543,551 **** * @return unknown */ ! function new_file_in_cat( $cat_id ) { global $linkdb_config, $board_config, $db; ! $cat_array = explode(',', $this->gen_cat_ids( $cat_id )); $files_new = 0; --- 543,551 ---- * @return unknown */ ! function new_item_in_cat( $cat_id ) { global $linkdb_config, $board_config, $db; ! $cat_array = explode(', ', $this->gen_cat_ids( $cat_id )); $files_new = 0; *************** *** 569,573 **** * @param unknown_type $file_info */ ! function last_file_in_cat( $cat_id, &$file_info ) { if ( ( empty( $this->cat_rowset[$cat_id]['cat_last_link_id'] ) && empty( $this->cat_rowset[$cat_id]['cat_last_link_name'] ) && empty( $this->cat_rowset[$cat_id]['cat_last_link_time'] ) ) || $this->modified ) --- 569,573 ---- * @param unknown_type $file_info */ ! function last_item_in_cat( $cat_id, &$file_info ) { if ( ( empty( $this->cat_rowset[$cat_id]['cat_last_link_id'] ) && empty( $this->cat_rowset[$cat_id]['cat_last_link_name'] ) && empty( $this->cat_rowset[$cat_id]['cat_last_link_time'] ) ) || $this->modified ) *************** *** 658,667 **** } ! $template->assign_block_vars( 'CAT_PARENT', array() ); $template->assign_vars( array( 'L_SUB_CAT' => $lang['Sub_category'], 'L_CATEGORY' => $lang['Category'], ! 'L_LAST_FILE' => $lang['Last_file'], ! 'L_FILES' => $lang['Files'] ) ); --- 658,672 ---- } ! // ! // Introduce a style switch for simple/standard category navigation ! // ! $cat_style = $linkdb_config['use_simple_navigation'] ? 'CAT_NAV_SIMPLE' : 'CAT_NAV_STANDARD'; ! ! $template->assign_block_vars( $cat_style, array() ); $template->assign_vars( array( 'L_SUB_CAT' => $lang['Sub_category'], 'L_CATEGORY' => $lang['Category'], ! 'L_LAST_LINK' => $lang['Last_link'], ! 'L_LINKS' => $lang['Link'] ) ); *************** *** 669,674 **** --- 674,683 ---- // Output the categories // + $num_of_cats = 0; if ( isset( $this->subcat_rowset[$cat_id] ) ) { + // + // Variables needed for the simple nav + // $catnum = count($this->subcat_rowset[$cat_id]); $catcol = $linkdb_config['cat_col'] > 0 ? $linkdb_config['cat_col'] : 1; *************** *** 680,787 **** } ! $template->assign_vars( array( 'LINK_WIDTH' => 100 / $catcol ) ); ! $i = 0; foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) { ! if ( $i == 0 || $i == $catcol) ! { ! $template->assign_block_vars( 'CAT_PARENT.catcol', array() ); ! $i = 0; ! } ! $i++; ! ! $last_file_info = array(); ! $this->last_file_in_cat( $subcat_id, $last_file_info ); ! ! if ( !empty( $last_file_info['file_id'] ) && $this->auth[$subcat_id]['auth_read'] ) ! { ! $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['file_time'], $board_config['board_timezone'] ); ! $last_file = $last_file_time . '<br />'; ! $last_file_name = ( strlen( stripslashes( $last_file_info['file_name'] ) ) > 20 ) ? substr( stripslashes( $last_file_info['file_name'] ), 0, 20 ) . '...' : stripslashes( $last_file_info['file_name'] ); ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '" alt="' . stripslashes( $last_file_info['file_name'] ) . '" title="' . stripslashes( $last_file_info['file_name'] ) . '">' . $last_file_name . '</a> '; ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '"><img src="' . $images['linkdb_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; ! } ! else ! { ! $last_file = $lang['No_file']; ! } ! ! $is_new = false; ! if ( $this->new_file_in_cat( $subcat_id ) ) { ! $is_new = true; ! } ! ! $sub_cat = $this->get_sub_cat( $subcat_id ); ! $template->assign_block_vars( 'CAT_PARENT.catcol.no_cat_parent', array( ! 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ), ! 'SUB_CAT' => ( !empty( $sub_cat ) ) ? " $sub_cat" : "", ! 'CAT_IMAGE' => ( $is_new ) ? $images['linkdb_folder_new'] : $images['linkdb_folder'], ! 'CAT_NAME' => $subcat_row['cat_name'], ! 'FILECAT' => $this->file_in_cat( $subcat_id ) ) ! ); ! } ! } ! } ! /** ! * display_categories - original. ! * - not implemented for linkdb...yet ! * ! * @param unknown_type $cat_id ! */ ! function display_categories_original( $cat_id = LINKDB_ROOT_CAT ) ! { ! global $db, $template, $lang, $userdata, $phpEx, $images; ! global $linkdb_config, $board_config, $debug; ! global $phpbb_root_path, $mx_root_path, $module_root_path, $is_block, $phpEx; ! if ( $this->cat_empty() ) ! { ! if ( !$userdata['session_logged_in'] ) ! { ! $redirect = ( $cat_id != LINKDB_ROOT_CAT ) ? $this->this_mxurl( "action=category&cat_id=$cat_id" ) : $this->this_mxurl(); ! redirect( append_sid( "login.$phpEx?redirect=$redirect", true ) ); ! } ! mx_message_die( GENERAL_ERROR, 'Either you are not allowed to view any category, or there is no category in the database' ); ! } ! $template->assign_vars( array( ! 'CAT_PARENT_ORIGINAL' => true, ! 'L_SUB_CAT' => $lang['Sub_category'], ! 'L_CATEGORY' => $lang['Category'], ! 'L_LAST_FILE' => $lang['Last_file'], ! 'L_FILES' => $lang['Files'] ) ! ); - // - // Category navigation for cat_id that allow files - // - used in cat pages without files - // - if ( isset( $this->subcat_rowset[$cat_id] ) ) - { - foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) - { - if ( ( $subcat_row['cat_allow_file'] == LINKDB_CAT_ALLOW_FILE ) ) - { $last_file_info = array(); ! $this->last_file_in_cat( $subcat_id, $last_file_info ); ! if ( !empty( $last_file_info['file_id'] ) && $this->auth[$subcat_id]['auth_read'] ) { ! $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['file_time'], $board_config['board_timezone'] ); $last_file = $last_file_time . '<br />'; ! $last_file_name = ( strlen( stripslashes( $last_file_info['file_name'] ) ) > 20 ) ? substr( stripslashes( $last_file_info['file_name'] ), 0, 20 ) . '...' : stripslashes( $last_file_info['file_name'] ); ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '" alt="' . stripslashes( $last_file_info['file_name'] ) . '" title="' . stripslashes( $last_file_info['file_name'] ) . '">' . $last_file_name . '</a> '; ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '"><img src="' . $images['linkdb_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; } else { ! $last_file = $lang['No_file']; } - $is_new = false; ! if ( $this->new_file_in_cat( $subcat_id ) ) { $is_new = true; --- 689,735 ---- } ! $template->assign_vars( array( 'WIDTH' => 100 / $catcol ) ); $i = 0; + foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) { ! // ! // Auth ! // ! if ( $this->auth_user[$subcat_id]['auth_view'] ) { ! if ( $i == 0 || $i == $catcol) ! { ! $template->assign_block_vars( $cat_style.'.catrow', array() ); ! $i = 0; ! } ! $i++; ! $category_links = $this->items_in_cat($subcat_id); ! $category_details = $subcat_row['cat_desc']; ! $category_name = $subcat_row['cat_name']; ! $category_url = append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ); ! $num_of_cats++; $last_file_info = array(); ! $this->last_item_in_cat( $subcat_id, $last_file_info ); ! if ( !empty( $last_file_info['link_id'] ) && $this->auth_user[$subcat_id]['auth_view'] ) { ! $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['link_time'], $board_config['board_timezone'] ); $last_file = $last_file_time . '<br />'; ! $last_file_name = ( strlen( stripslashes( $last_file_info['link_name'] ) ) > 20 ) ? substr( stripslashes( $last_file_info['link_name'] ), 0, 20 ) . '...' : stripslashes( $last_file_info['link_name'] ); ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=link&link_id=' . $last_file_info['link_id'] ) ) . '" alt="' . stripslashes( $last_file_info['link_name'] ) . '" title="' . stripslashes( $last_file_info['link_name'] ) . '">' . $last_file_name . '</a> '; ! $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=link&link_id=' . $last_file_info['link_id'] ) ) . '"><img src="' . $images['linkdb_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; } else { ! $last_file = $lang['No_link']; } ! $is_new = false; ! if ( $this->new_item_in_cat( $subcat_id ) ) { $is_new = true; *************** *** 789,890 **** $sub_cat = $this->get_sub_cat( $subcat_id ); - $template->assign_block_vars( 'no_cat_parent', array( - 'IS_HIGHER_CAT' => false, - 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ), - 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', 'CAT_IMAGE' => ( $is_new ) ? $images['linkdb_folder_new'] : $images['linkdb_folder'], ! 'CAT_NEW_FILE' => ( $is_new ) ? $lang['New_file'] : $lang['No_new_file'], ! 'CAT_NAME' => $subcat_row['cat_name'], ! 'FILECAT' => $this->file_in_cat( $subcat_id ), ! 'LAST_FILE' => $last_file, ! 'CAT_DESC' => $subcat_row['cat_desc'] ) ! ); ! } ! } ! } ! // ! // Category navigation for cat_id that doesn't allow files ! // - used in cat pages with files ! // ! if ( isset( $this->subcat_rowset[$cat_id] ) ) ! { ! foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) ! { ! $total_sub_cat = 0; ! if ( isset( $this->subcat_rowset[$subcat_id] ) ) ! { ! foreach( $this->subcat_rowset[$subcat_id] as $sub_no_cat_id => $sub_no_cat_row ) ! { ! if ( $sub_no_cat_row['cat_allow_file'] == LINKDB_CAT_ALLOW_FILE ) ! { ! $sub_cat_rowset[$total_sub_cat] = $sub_no_cat_row; ! $total_sub_cat++; ! } ! } ! } ! // ! // This is a container category ! // ! if ( ( $subcat_row['cat_allow_file'] != LINKDB_CAT_ALLOW_FILE ) ) ! { ! if ( $total_sub_cat ) { ! $template->assign_block_vars( 'no_cat_parent', array( ! 'IS_HIGHER_CAT' => true, ! 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ), ! 'CAT_NAME' => $subcat_row['cat_name'] ) ! ); } - - for( $k = 0; $k < $total_sub_cat; $k++ ) - { - $last_file_info = array(); - $this->last_file_in_cat( $sub_cat_rowset[$k]['cat_id'], $last_file_info ); - - if ( $sub_cat_rowset[$k]['cat_parent'] == $subcat_id ) - { - if ( !empty( $last_file_info['file_id'] ) && $this->auth[$sub_cat_rowset[$k]['cat_id']]['auth_read'] ) - { - $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['file_time'], $board_config['board_timezone'] ); - $last_file = $last_file_time . '<br />'; - $last_file_name = ( strlen( $last_file_info['file_name'] ) > 20 ) ? substr( $last_file_info['file_name'], 0, 20 ) . '...' : $last_file_info['file_name']; - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '">' . $last_file_name . '</a> '; - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'action=file&file_id=' . $last_file_info['file_id'] ) ) . '"><img src="' . $images['linkdb_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; - } - else - { - $last_file = $lang['No_file']; - } - - $is_new = false; - - if ( $this->new_file_in_cat( $sub_cat_rowset[$k]['cat_id'] ) ) - { - $is_new = true; - } - - $sub_cat = $this->get_sub_cat( $sub_cat_rowset[$k]['cat_id'] ); - - $template->assign_block_vars( 'no_cat_parent', array( - 'IS_HIGHER_CAT' => false, - 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $sub_cat_rowset[$k]['cat_id'] ) ), - 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', - 'CAT_IMAGE' => ( $is_new ) ? $images['linkdb_folder_new'] : $images['linkdb_folder'], - 'CAT_NEW_FILE' => ( $is_new ) ? $lang['New_file'] : $lang['No_new_file'], - 'CAT_NAME' => $sub_cat_rowset[$k]['cat_name'], - 'FILECAT' => $this->file_in_cat( $sub_cat_rowset[$k]['cat_id'] ), - 'LAST_FILE' => $last_file, - 'CAT_DESC' => $sub_cat_rowset[$k]['cat_desc'] ) - ); - } // Have a permission to view the category - } // It is not parent category } } ! } //higher Category ! } /** --- 737,768 ---- $sub_cat = $this->get_sub_cat( $subcat_id ); + $template->assign_block_vars( $cat_style.'.catrow.catcol', array( + 'CATEGORY' => $category_name, + 'U_CATEGORY' => $category_url, + 'CAT_DESCRIPTION' => $category_details, + 'CAT_LINKS' => $category_links, 'CAT_IMAGE' => ( $is_new ) ? $images['linkdb_folder_new'] : $images['linkdb_folder'], ! 'SUB_CAT' => ( !empty( $sub_cat ) ) ? " $sub_cat" : "", ! 'L_SUB_CAT' => $lang['Sub_categories'], ! 'LAST_LINK' => $last_file, ! )); ! if (!empty( $sub_cat )) { ! $template->assign_block_vars( $cat_style.'.catrow.catcol.show_subs', array()); } } } ! } + if ( $num_of_cats == 0 ) + { + $template->assign_block_vars( $cat_style.'.no_cats', array( + 'COMMENT' => 'You are not allowed to view any category.', + )); + } + } /** *************** *** 897,901 **** * @param unknown_type $cat_id */ ! function display_files( $sort_method, $sort_order, $start, $show_file_message, $cat_id = false ) { global $db, $linkdb_config, $template, $board_config; --- 775,779 ---- * @param unknown_type $cat_id */ ! function display_items( $sort_method, $sort_order, $start, $show_file_message, $cat_id = false ) { global $db, $linkdb_config, $template, $board_config; *************** *** 944,948 **** } ! if ( !( $result = $linkdb_functions->sql_query_limit( $sql, $linkdb_config['settings_link_page'], $start ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldn\'t get file info for this category', '', __LINE__, __FILE__, $sql ); --- 822,826 ---- } ! if ( !( $result = $linkdb_functions->sql_query_limit( $sql, $linkdb_config['pagination'], $start ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldn\'t get file info for this category', '', __LINE__, __FILE__, $sql ); *************** *** 987,990 **** --- 865,881 ---- } + // + // Ratings + // + $link_use_ratings = false; + for ( $i = 0; $i < count( $file_rowset ); $i++ ) + { + if ( $this->ratings[$file_rowset[$i]['link_catid']]['activated'] ) + { + $link_use_ratings = true; + break; + } + } + for ( $i = 0; $i < count( $file_rowset ); $i++ ) { *************** *** 997,1001 **** // Get rating for the file and format it // =================================================== ! $file_rating = ( $file_rowset[$i]['rating'] != 0 ) ? round( $file_rowset[$i]['rating'], 2 ) . '/10' : $lang['Not_rated']; // // If the file is new then put a new image in front of it --- 888,895 ---- // Get rating for the file and format it // =================================================== ! if ($link_use_ratings) ! { ! $file_rating = ( $file_rowset[$i]['rating'] != 0 ) ? round( $file_rowset[$i]['rating'], 2 ) . '/10' : $lang['Not_rated']; ! } // // If the file is new then put a new image in front of it *************** *** 1007,1010 **** --- 901,908 ---- } + $link_title = $file_rowset[$i]['link_name']; + $link_url = append_sid( $this->this_mxurl( 'action=link&link_id=' . $file_rowset[$i]['link_id'] ) ); + $link_url_jump = append_sid( $this->this_mxurl( 'action=jump&link_id=' . $file_rowset[$i]['link_id'] ) ); + $cat_name = ( empty( $cat_id ) ) ? $this->cat_rowset[$file_rowset[$i]['link_catid']]['cat_name'] : ''; $cat_url = append_sid( $this->this_mxurl( 'action=category&cat_id=' . $file_rowset[$i]['link_catid'] ) ); *************** *** 1023,1039 **** 'L_NEW_FILE' => $lang['New_file'], 'PIN_IMAGE' => $this->display_banner( $file_rowset[$i], $row ), ! 'FILE_NAME' => $file_rowset[$i]['link_name'], 'FILE_DESC' => $file_rowset[$i]['link_longdesc'], 'DATE' => $date, 'FILE_DLS' => $file_rowset[$i]['link_hits'], 'FILE_VOTES' => $file_rowset[$i]['total_votes'], ! 'L_RATING' => '<a href="' . append_sid( $this->this_mxurl( 'action=rate&link_id=' . $file_rowset[$i]['link_id'] ) ) . '">' . $lang['LinkRating'] . '</a>', 'RATING' => $file_rating, 'CAT_NAME' => $cat_name, - 'IS_NEW_FILE' => $is_new, 'U_CAT' => $cat_url, ! 'U_FILE' => append_sid( $this->this_mxurl( 'action=link&link_id=' . $file_rowset[$i]['link_id'] ) ), 'POSTER' => $file_poster, --- 921,941 ---- 'L_NEW_FILE' => $lang['New_file'], 'PIN_IMAGE' => $this->display_banner( $file_rowset[$i], $row ), ! 'FILE_NAME' => $link_title, 'FILE_DESC' => $file_rowset[$i]['link_longdesc'], 'DATE' => $date, 'FILE_DLS' => $file_rowset[$i]['link_hits'], + 'FILE_VOTES' => $file_rowset[$i]['total_votes'], ! 'L_RATING' => $lang['LinkRating'], ! 'DO_RATE' => $this->auth_user[$cat_id]['auth_rate'] ? '<a href="' . append_sid( $this->this_mxurl( 'action=rate&link_id=' . $file_rowset[$i]['link_id'] ) ) . '">' . $lang['Do_rate'] . '</a>' : '', 'RATING' => $file_rating, 'CAT_NAME' => $cat_name, 'U_CAT' => $cat_url, ! 'U_FILE' => $link_url_jump, ! ! 'L_FILE_MORE' => $lang['Link_review'], ! 'U_FILE_MORE' => $link_url, 'POSTER' => $file_poster, *************** *** 1042,1048 **** )); ! if ( $this->ratings[$file_rowset[$i]['link_catid']]['activated'] ) { ! $template->assign_block_vars( "FILELIST.file_rows.LINK_VOTE", array() ); } --- 944,955 ---- )); ! if ( $link_use_ratings ) { ! $template->assign_block_vars( "FILELIST.file_rows.show_ratings", array() ); ! } ! ! if ( $is_new ) ! { ! $template->assign_block_vars( "FILELIST.file_rows.is_new_file", array() ); } *************** *** 1080,1085 **** 'SORT_ASC' => ( $sort_order == 'ASC' ) ? 'selected="selected"' : '', 'SORT_DESC' => ( $sort_order == 'DESC' ) ? 'selected="selected"' : '', ! 'PAGINATION' => generate_pagination( append_sid( $this->this_mxurl( "action=$action&sort_method=$sort_method&sort_order=$sort_order" ) ), $total_file, $linkdb_config['settings_link_page'], $start ), ! 'PAGE_NUMBER' => sprintf( $lang['Page_of'], ( floor( $start / $linkdb_config['settings_link_page'] ) + 1 ), ceil( $total_file / $linkdb_config['settings_link_page'] ) ), 'ID' => $cat_id, 'START' => $start, --- 987,992 ---- 'SORT_ASC' => ( $sort_order == 'ASC' ) ? 'selected="selected"' : '', 'SORT_DESC' => ( $sort_order == 'DESC' ) ? 'selected="selected"' : '', ! 'PAGINATION' => generate_pagination( append_sid( $this->this_mxurl( "action=$action&sort_method=$sort_method&sort_order=$sort_order" ) ), $total_file, $linkdb_config['pagination'], $start ), ! 'PAGE_NUMBER' => sprintf( $lang['Page_of'], ( floor( $start / $linkdb_config['pagination'] ) + 1 ), ceil( $total_file / $linkdb_config['pagination'] ) ), 'ID' => $cat_id, 'START' => $start, *************** *** 1090,1099 **** else { ! $template->assign_block_vars( 'NO_FILE', array() ); ! $template->assign_vars( array( ! 'NO_FILE' => $show_file_message, ! 'L_NO_FILES' => $lang['No_links'], ! 'L_NO_FILES_CAT' => $lang['No_links_cat'] ) ! ); } } --- 997,1009 ---- else { ! if ($this->cat_rows... [truncated message content] |