## ## MOD Title: winner ## MOD Author: tony hawk ## MOD Description: this mod is let you to set user as winner. ## MOD Version: 1.0.0 ## ## Installation Level: medium ## Installation Time: 20 minutes ## Files To Edit: ## viewtopic.php ## viewonline.php ## viewforum.php ## includes/constants.php ## includes/page_header.php ## admin/admin_ug_auth.php ## admin/admin_styles.php ## language/lang_hebrew/lang_main.php ## language/lang_hebrew/lang_admin.php ## templates/subSilver/admin/styles_edit_body.tpl ## templates/subSilver/index_body.tpl ## Included Files: none ## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ## ## Author Notes: you can install this mod only if you have installed the citation mod. ## i want to give a special thank to REPTOR because he helped me to test this mod ## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ## # #----------------------------------------------- # ALTER TABLE phpbb_themes ADD fontcolor6 VARCHAR (6) ; ALTER TABLE phpbb_themes_name ADD fontcolor6_name CHAR (50) ; # #----------------------------------------------- # viewtopic.php # #----------------------------------------------- # $poster = ( $poster_id == ANONYMOUS ) ? $lang : $poster = ($postrow == ADMIN ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="admin.gif" border="0">' : ( ($postrow == MOD ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="moder.gif" border="0">' : $poster = ($postrow == CITATION ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="citation.gif" border="0">' : $postrow ); # #----------------------------------------------- # $poster = ( $poster_id == ANONYMOUS ) ? $lang : $poster = ($postrow == ADMIN ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="admin.gif" border="0">' : ( ($postrow == MOD ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="moder.gif" border="0">' : $poster = ($postrow == CITATION ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="citation.gif" border="0">' : $poster = ($postrow == WINNER ) ? '<span style="color:#' . $theme . '">' . $postrow . '</span> <img src="winner.gif" border="0">' : $postrow ); # #----------------------------------------------- # viewonline.php # #----------------------------------------------- # $style_color = ""; if ( $row == ADMIN ) { $username = '<b style="color:#' . $theme . '">' . $username . '</b> <img src="admin.gif" border="0">'; } else if ( $row == MOD ) { $username = '<b style="color:#' . $theme . '">' . $username . '</b> <img src="moder.gif" border="0">'; } else if ( $row == CITATION ) { $username = '<b style="color:#' . $theme . '">' . $username . '</b> <img src="citation.gif" border="0">'; } # #----------------------------------------------- # else if ( $row == WINNER ) { $username = '<b style="color:#' . $theme . '">' . $username . '</b> <img src="'winner.gif" border="0">'; } # #----------------------------------------------- # viewforum.php # #----------------------------------------------- # if($topic_rowset==1){ $topic_author .= ( $topic_rowset != ANONYMOUS ) ? '<img src=admin.gif border=0></a>' : ''; } if($topic_rowset==3){ $topic_author .= ( $topic_rowset != ANONYMOUS ) ? '<img src=citation.gif border=0></a>' : ''; } if($topic_rowset==4){ $topic_author .= ( $topic_rowset != ANONYMOUS ) ? '<img src=moder.gif border=0></a>' : ''; } # #----------------------------------------------- # if($topic_rowset==6){ $topic_author .= ( $topic_rowset != ANONYMOUS ) ? '<img src=winner.gif border=0></a>' : ''; } # #----------------------------------------------- # includes/constants.php # #----------------------------------------------- # define('USER', 0); define('ADMIN', 1); define('CITATION', 2); define('MOD', 3); # #----------------------------------------------- # define('WINNER', 6); # #----------------------------------------------- # includes/page_header.php # #----------------------------------------------- # if ( $row == ADMIN ) { $row = '<b>' . $row . '</b> <img src="admin.gif" border="0">'; $style_color = 'style="color:#' . $theme . '"'; } else if ( $row == MOD ) { $row = '<b>' . $row . '</b> <img src="moder.gif" border="0">'; $style_color = 'style="color:#' . $theme . '"'; } else if ( $row == CITATION ) { $row = '<b>' . $row . '</b> <img src="citation.gif" border="0">'; $style_color = 'style="color:#' . $theme . '"'; } # #----------------------------------------------- # else if ( $row == WINNER ) { $row = '<b>' . $row . '</b> <img src="winner.gif" border="0">'; $style_color = 'style="color:#' . $theme . '"'; } # #----------------------------------------------- # 'L_WHOSONLINE_CITATION' => sprintf($lang, '<span style="color:#' . $theme . '">', '</span>'), # #----------------------------------------------- # 'L_WHOSONLINE_WINNER' => sprintf($lang, '<span style="color:#' . $theme . '">', '</span>'), # #----------------------------------------------- # 'T_FONTCOLOR5' => '#'.$theme, # #----------------------------------------------- # 'T_FONTCOLOR6' => '#'.$theme, # #----------------------------------------------- # admin/admin_ug_auth.php # #----------------------------------------------- # else if ( $mode == 'user' && $HTTP_POST_VARS == 'citation' && $user_level != CITATION ) { // // Make user an admin (if already user) // if ( $userdata != $user_id ) { // // Update users level, reset // $sql = "UPDATE " . USERS_TABLE . " SET user_level = " . CITATION . " WHERE user_id = $user_id"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql); } $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id AND auth_mod = 0"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Couldn't delete auth access info", "", __LINE__, __FILE__, $sql); } // // Delete any entries in auth_access, they are not required if user is becoming an // admin // $sql = "UPDATE " . AUTH_ACCESS_TABLE . " SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Couldn't update auth access", "", __LINE__, __FILE__, $sql); } } $message = $lang . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } # #----------------------------------------------- # else if ( $mode == 'user' && $HTTP_POST_VARS == 'winner' && $user_level != WINNER ) { // // Make user an admin (if already user) // if ( $userdata != $user_id ) { // // Update users level, reset // $sql = "UPDATE " . USERS_TABLE . " SET user_level = " . WINNER . " WHERE user_id = $user_id"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql); } $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id AND auth_mod = 0"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Couldn't delete auth access info", "", __LINE__, __FILE__, $sql); } // // Delete any entries in auth_access, they are not required if user is becoming an // admin // $sql = "UPDATE " . AUTH_ACCESS_TABLE . " SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Couldn't update auth access", "", __LINE__, __FILE__, $sql); } } $message = $lang . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } # #----------------------------------------------- # else if ( $mode == 'user' && $HTTP_POST_VARS == 'user' && $user_level == CITATION ) { // // Make citation mod a user (if already citation) ... ignore if you're trying // to change yourself from a citation to user! // if ( $userdata != $user_id ) { $sql = "UPDATE " . AUTH_ACCESS_TABLE . " SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update auth access', '', __LINE__, __FILE__, $sql); } // // Update users level, reset to USER // $sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . " WHERE user_id = $user_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); } } $message = $lang . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); } # #----------------------------------------------- # else if ( $mode == 'user' && $HTTP_POST_VARS == 'user' && $user_level == WINNER ) { // // Make winner mod a user (if already winner) ... ignore if you're trying // to change yourself from a winner to user! // if ( $userdata != $user_id ) { $sql = "UPDATE " . AUTH_ACCESS_TABLE . " SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 WHERE group_id = $group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update auth access', '', __LINE__, __FILE__, $sql); } // // Update users level, reset to USER // $sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . " WHERE user_id = $user_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); } } $message = $lang . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang, '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); } # #----------------------------------------------- # switch ( SQL_LAYER ) { case 'postgresql': $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id AND aa.group_id = ug.group_id AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0 UNION ( SELECT u.user_id FROM " . USERS_TABLE . " u WHERE NOT EXISTS ( SELECT aa.auth_mod FROM " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id AND aa.group_id = ug.group_id ) AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ") GROUP BY u.user_id )"; break; case 'oracle': $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id(+) AND aa.group_id = ug.group_id(+) AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0"; break; default: $sql = "SELECT u.user_id FROM ( ( " . USERS_TABLE . " u LEFT JOIN " . USER_GROUP_TABLE . " ug ON ug.user_id = u.user_id ) LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = ug.group_id ) WHERE u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0"; break; } # #----------------------------------------------- # switch ( SQL_LAYER ) { case 'postgresql': $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id AND aa.group_id = ug.group_id AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ", " . WINNER . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0 UNION ( SELECT u.user_id FROM " . USERS_TABLE . " u WHERE NOT EXISTS ( SELECT aa.auth_mod FROM " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id AND aa.group_id = ug.group_id ) AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ", " . WINNER . ") GROUP BY u.user_id )"; break; case 'oracle': $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa WHERE ug.user_id = u.user_id(+) AND aa.group_id = ug.group_id(+) AND u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ", " . WINNER . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0"; break; default: $sql = "SELECT u.user_id FROM ( ( " . USERS_TABLE . " u LEFT JOIN " . USER_GROUP_TABLE . " ug ON ug.user_id = u.user_id ) LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = ug.group_id ) WHERE u.user_level NOT IN (" . USER . ", " . ADMIN . ", " . CITATION . ", " . WINNER . ") GROUP BY u.user_id HAVING SUM(aa.auth_mod) = 0"; break; } # #----------------------------------------------- # $is_cita = ( $mode == 'user' ) ? ( ( $ug_info == CITATION && $ug_info != ANONYMOUS ) ? 1 : 0 ) : 0; # #----------------------------------------------- # $is_winner = ( $mode == 'user' ) ? ( ( $ug_info == WINNER && $ug_info != ANONYMOUS ) ? 1 : 0 ) : 0; # #----------------------------------------------- # $s_user_type .= ($is_cita) ? '<option value="citation" selected=\"selected\">' . $lang . '</option>' : '<option value="citation">' . $lang . '</option>'; # #----------------------------------------------- # $s_user_type .= ($is_winner) ? '<option value="winner" selected=\"selected\">' . $lang . '</option>' : '<option value="winner">' . $lang . '</option>'; # #----------------------------------------------- # admin/admin_styles.php # #----------------------------------------------- # $updated = $HTTP_POST_VARS; $updated_name = $HTTP_POST_VARS; # #----------------------------------------------- # $updated = $HTTP_POST_VARS; $updated_name = $HTTP_POST_VARS; # #----------------------------------------------- # "L_FONTCOLOR_5" => $lang, # #----------------------------------------------- # "L_FONTCOLOR_6" => $lang, # #----------------------------------------------- # "FONTCOLOR5" => $selected, # #----------------------------------------------- # "FONTCOLOR6" => $selected, # #----------------------------------------------- # "FONTCOLOR5_NAME" => $selected, # #----------------------------------------------- # "FONTCOLOR6_NAME" => $selected, # #----------------------------------------------- # language/lang_hebrew/lang_main.php # #----------------------------------------------- # ?> # #----------------------------------------------- # $lang = '%s# #----------------------------------------------- # language/lang_english/lang_admin.php # #----------------------------------------------- # ?> # #----------------------------------------------- # $lang = '# #----------------------------------------------- # templates/subSilver/admin/styles_edit_body.tpl # #----------------------------------------------- # <tr> <td class="row1">{L_FONTCOLOR_5}:</td> <td class="row2"><input type="text" size="6" maxlength="6" name="fontcolor5" value="{FONTCOLOR5}"></td> <td class="row2"><input type="text" size="25" maxlength="100" name="fontcolor5_name" value="{FONTCOLOR5_NAME}"> </tr> # #----------------------------------------------- # <tr> <td class="row1">{L_FONTCOLOR_6}:</td> <td class="row2"><input type="text" size="6" maxlength="6" name="fontcolor6" value="{FONTCOLOR6}"></td> <td class="row2"><input type="text" size="25" maxlength="100" name="fontcolor6_name" value="{FONTCOLOR6_NAME}"> </tr> # #----------------------------------------------- # templates/subSilver/index_body.tpl # #----------------------------------------------- # <td class="row1" align="{S_CONTENT_DIR_LEFT}"><span class="gensmall">{TOTAL_USERS_ONLINE} <br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td> # #----------------------------------------------- # <td class="row1" align="right"><span class="gensmall">{TOTAL_USERS_ONLINE} <br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td> # #----------------------------------------------- # # EoM
|