|
From: Jon O. <jon...@us...> - 2006-07-04 22:34:40
|
Update of /cvsroot/mxbb/mx_linkdb/linkdb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13289/modules/mx_linkdb/linkdb/includes Modified Files: functions.php Log Message: working... Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** functions.php 4 Jul 2006 18:00:33 -0000 1.10 --- functions.php 4 Jul 2006 22:34:37 -0000 1.11 *************** *** 51,55 **** FROM " . LINK_CONFIG_TABLE; ! if ( !( $result = $db->sql_query( $sql, 300 ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt query linkdb configuration', '', __LINE__, __FILE__, $sql ); --- 51,55 ---- FROM " . LINK_CONFIG_TABLE; ! if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt query linkdb configuration', '', __LINE__, __FILE__, $sql ); *************** *** 96,133 **** return ( $link_rating != 0 ) ? round( $link_rating, 2 ) . ' / 10' : $lang['Not_rated']; } - - function update_voter_info( $link_id, $rating ) - { - global $user_ip, $db, $userdata, $lang; - - $where_sql = ( $userdata['user_id'] != ANONYMOUS ) ? "user_id = '" . $userdata['user_id'] . "'" : "votes_ip = '" . $user_ip . "'"; - - $sql = "SELECT user_id, votes_ip - FROM " . LINK_VOTES_TABLE . " - WHERE $where_sql - AND votes_link = '" . $link_id . "' - LIMIT 1"; - - 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 " . LINK_VOTES_TABLE . " (user_id, votes_ip, votes_link, rate_point) - VALUES('" . $userdata['user_id'] . "', '" . $user_ip . "', '" . $link_id . "','" . $rating . "')"; - if ( !( $db->sql_query( $sql ) ) ) - { - mx_message_die( GENERAL_ERROR, 'Couldnt Update Votes Table Info', '', __LINE__, __FILE__, $sql ); - } - } - else - { - mx_message_die( GENERAL_MESSAGE, $lang['Rerror'] ); - } - - $db->sql_freeresult( $result ); - } } --- 96,99 ---- *************** *** 291,307 **** * Enter description here... * ! * @param unknown_type $file_id * @param unknown_type $rating */ ! function update_voter_info( $file_id, $rating ) { ! global $user_ip, $db, $userdata, $lang; ! $where_sql = ( $userdata['user_id'] != ANONYMOUS ) ? "user_id = '" . $userdata['user_id'] . "'" : "votes_ip = '" . $user_ip . "'"; $sql = "SELECT user_id, votes_ip ! FROM " . PA_VOTES_TABLE . " WHERE $where_sql - AND votes_file = '" . $file_id . "' LIMIT 1"; --- 257,290 ---- * Enter description here... * ! * @param unknown_type $link_id * @param unknown_type $rating */ ! function update_voter_info( $link_id, $rating, $cat_id = 0 ) { ! global $db, $userdata, $lang, $linkdb_config; ! $ipaddy = getenv ( "REMOTE_ADDR" ); ! ! if ($linkdb_config['votes_check_ip'] && $linkdb_config['votes_check_userid']) ! { ! $where_sql = ( $userdata['user_id'] != ANONYMOUS ) ? "(user_id = '" . $userdata['user_id'] . "' OR votes_ip = '" . $ipaddy . "')": "votes_ip = '" . $ipaddy . "'"; ! } ! else if($linkdb_config['votes_check_ip']) ! { ! $where_sql = ( $linkdb_config['votes_check_ip'] ) ? "votes_ip = '" . $ipaddy . "'" : ''; ! } ! else if($linkdb_config['votes_check_userid']) ! { ! $where_sql = ( $userdata['user_id'] != ANONYMOUS ) ? "user_id = '" . $userdata['user_id'] . "'" : ''; ! } ! else ! { ! $where_sql = "user_id = '-99'"; ! } ! $where_sql .= !empty($where_sql) ? " AND votes_link = '" . $link_id . "'" : "votes_link = '" . $link_id . "'"; $sql = "SELECT user_id, votes_ip ! FROM " . LINK_VOTES_TABLE . " WHERE $where_sql LIMIT 1"; *************** *** 311,318 **** } if ( !$db->sql_numrows( $result ) ) { ! $sql = "INSERT INTO " . PA_VOTES_TABLE . " (user_id, votes_ip, votes_file, rate_point, voter_os, voter_browser, browser_version) ! VALUES('" . $userdata['user_id'] . "', '" . $user_ip . "', '" . $file_id . "','" . $rating . "', '" . $this->platform . "', '" . $this->agent . "', '" . $this->ver . "')"; if ( !( $db->sql_query( $sql ) ) ) { --- 294,305 ---- } + // + // Has already voted. Should we care? + // if ( !$db->sql_numrows( $result ) ) { ! $sql = "INSERT INTO " . LINK_VOTES_TABLE . " (user_id, votes_ip, votes_link, rate_point) ! VALUES('" . $userdata['user_id'] . "', '" . $ipaddy . "', '" . $link_id . "','" . $rating . "')"; ! if ( !( $db->sql_query( $sql ) ) ) { *************** *** 322,326 **** else { ! mx_message_die( GENERAL_MESSAGE, $lang['Rerror'] ); } --- 309,314 ---- else { ! $message = $lang['Rerror'] . "<br /><br />" . sprintf( $lang['Click_return'], "<a href=\"" . ( !empty($cat_id) ? append_sid( linkdb_this_mxurl( "action=category&cat_id=$cat_id" ) ) : append_sid( linkdb_this_mxurl( "action=link&link_id=$link_id" ) ) ) . "\">", "</a>" ); ! mx_message_die( GENERAL_MESSAGE, $message ); } *************** *** 1425,1485 **** $template->pparse( 'linkdb_header' ); - - /* - $mx_kb->debug('kb_page_header', basename( __FILE__ )); - - $template->set_filenames( array( 'kb_header' => 'kb_header.tpl' ) ); - - if ( isset ( $HTTP_GET_VARS['cat'] ) ) - { - $category_id = intval ($HTTP_GET_VARS['cat'] ); - - if ( $mx_kb->modules[$mx_kb->module_name]->auth_user[$category_id]['auth_post'] || $mx_kb->modules[$mx_kb->module_name]->auth_user[$category_id]['auth_mod'] ) - { - $temp_url = append_sid( this_kb_mxurl( "mode=add&cat=" . $category_id ) ); - $add_article = '<a href="' . $temp_url . '">' . $lang['Add_article'] . '</a>'; - } - } - else - { - $add_article = $lang['Click_cat_to_add']; - } - - $template->assign_block_vars( 'switch_add_article', array() ); - - $temp_url = append_sid( this_kb_mxurl( "mode=search" ) ); - $search = '<a href="' . $temp_url . '">' . $lang['Search'] . '</a>'; - - if ( $kb_config['header_banner'] == 1 ) - { - $temp_url = append_sid( this_kb_mxurl() ); - $block_title = '<td align="center" class="row1"><a href="' . $temp_url . '"><img src="' . $images['kb_title'] . '" width="285" height="45" border="0" alt="' . $title . '"></a></td>'; - } - else - { - $block_title = MXBB_MODULE ? '' : '<td align="center"><b>' . $lang['KB_title'] . '</b></td>'; - } - - $template->assign_vars( array( - 'L_KB_TITLE' => $block_title, - 'L_ADD_ARTICLE' => $add_article, - 'L_SEARCH_MODULE' => $search, - 'SPACER_IMG' => $images['mx_spacer'], - - 'U_TOPRATED' => append_sid( this_kb_mxurl( "mode=stats&stats=toprated" ) ), - 'L_TOPRATED' => $lang['Top_toprated'], - 'U_MOST_POPULAR' => append_sid( this_kb_mxurl( "mode=stats&stats=mostpopular" ) ), - 'L_MOST_POPULAR' => $lang['Top_most_popular'], - 'U_LATEST' => append_sid( this_kb_mxurl( "mode=stats&stats=latest" ) ), - 'L_LATEST' => $lang['Top_latest'] - )); - - if ( $kb_config['stats_list'] == 1 ) - { - $mx_kb->get_quick_stats( $category_id ); - } - - $template->pparse( 'kb_header' ); - */ } --- 1413,1416 ---- *************** *** 1499,1530 **** $template->set_filenames( array( 'link_footer' => "link_footer.tpl" ) ); - /* - if ( !empty($mx_kb->modules[$mx_kb->module_name]->auth_can_list) ) - { - $template->assign_block_vars( 'auth_can_list', array() ); - } - - if ( !empty($mx_kb->modules[$mx_kb->module_name]->jumpbox) ) - { - $template->assign_block_vars( 'jumpbox', array() ); - } - - if ( !MXBB_MODULE || MXBB_27x ) - { - $template->assign_block_vars( 'copy_footer', array() ); - } - */ - - // $s_hidden_vars = '<input type="hidden" name="action" value="category"><input type="hidden" name="page" value="' . $page_id . '">'; - - /* - // - // Generate debug message - // - $debug_message_top = $mx_kb->display_debug(); - $debug_message_module = $mx_kb->modules[$mx_kb->module_name]->display_debug(); - $debug_message = $debug_message_top . '<br><br>' . $debug_message_module; - */ - $template->assign_vars( array( 'L_JUMP' => $lang['Jump'], --- 1430,1433 ---- *************** *** 1550,1606 **** $linkdb_cache->unload(); - - /* - $mx_kb->debug('kb_page_footer', basename( __FILE__ )); - - $template->set_filenames( array( 'kb_footer' => 'kb_footer.tpl' ) ); - - if ( !empty($mx_kb->modules[$mx_kb->module_name]->auth_can_list) ) - { - $template->assign_block_vars( 'auth_can_list', array() ); - } - - if ( !empty($mx_kb->modules[$mx_kb->module_name]->jumpbox) ) - { - $template->assign_block_vars( 'jumpbox', array() ); - } - - if ( !MXBB_MODULE || MXBB_27x ) - { - $template->assign_block_vars( 'copy_footer', array() ); - } - - $s_hidden_vars = '<input type="hidden" name="mode" value="cat"><input type="hidden" name="page" value="' . $page_id . '">'; - - // - // Generate debug message - // - $debug_message_top = $mx_kb->display_debug(); - $debug_message_module = $mx_kb->modules[$mx_kb->module_name]->display_debug(); - $debug_message = $debug_message_top . '<br><br>' . $debug_message_module; - - $template->assign_vars( array( - 'QUICK_JUMP_ACTION' => this_kb_mxurl(), - 'S_HIDDEN_VARS' => $s_hidden_vars, - - 'L_QUICK_GO' => $lang['Quick_go'], - 'L_QUICK_NAV' => $lang['Quick_nav'], - 'L_QUICK_JUMP' => $lang['Quick_jump'], - 'QUICK_NAV' => $mx_kb->modules[$mx_kb->module_name]->jumpbox, - - 'S_AUTH_LIST' => $mx_kb->modules[$mx_kb->module_name]->auth_can_list, - - 'L_MODULE_VERSION' => $kb_module_version, - 'L_MODULE_ORIG_AUTHOR' => $kb_module_orig_author, - 'L_MODULE_AUTHOR' => $kb_module_author, - 'DEBUG' => !empty($debug_message) && $mx_kb->debug ? '<div style="overflow:auto; height:100px;"><span class="gensmall">' . $debug_message . '<br/> -::-</span></div>': '', - )); - - $template->pparse( 'kb_footer' ); - - $mx_kb->modules[$mx_kb->module_name]->_kb(); - - $mx_kb_cache->unload(); - */ } --- 1453,1456 ---- |