Seite 1 von 2

Neuestes Posting im Thread oben

Verfasst: 12.09.2002 08:13
von px
Moin,

zum dritten Mal suche ich den Mod, der es den Usern zu erlaubt, im Profil zu definieren, wie Postings in einem Topic sortiert werden. :-? Für 2.0.0 gab's diesen Hack mal auf der phpbb.com-Site, jedoch mittlerweile nicht mehr. Es muss doch so einen Hack für 2.0.2 geben??

Würde mich sehr freuen, wenn mir jemand weiterhelfen könnte.

Verfasst: 12.09.2002 10:03
von Gast
Guck mal hier :)

Verfasst: 12.09.2002 10:07
von fussle
klasse, funktioniert der hack auch im 2.02 ?

Verfasst: 12.09.2002 10:26
von px
:) danke sehr!

Edit: Das Ding ist nicht für 2.0.2 aber wenn man aufpasst inwiefern sich die zu ersetzenden Code-Teile unterscheiden, ist es eigentlich kein großes Problem, es auf 2.0.2 anzuwenden.

Verfasst: 15.12.2002 00:07
von px
*rauskram*

:( Der Hack ist leider nicht mehr erhältlich. Kennt irgendwer was vergleichbares?

Verfasst: 15.12.2002 00:11
von Simpson

Verfasst: 15.12.2002 00:39
von px
Hmm... das ist nicht was ich suche. Der Hack soll dem User erlauben im Profil festzulegen, wie die Postings in einem Topic sortiert werden. Sprich entweder neuester zuerst oder ältester zuerst (standard.. leider)

Verfasst: 15.12.2002 00:44
von Simpson
War der falsche, sorry. Glaube den Mod gibts unter phpbb.com/mods

Mußte mal dort alles durchkiken.

EDIT: Hab den Mod auch, poste ihn dir einfach hier rein, ist nicht groß...

Verfasst: 15.12.2002 00:51
von Simpson

Code: Alles auswählen

########################################################
## Mod Title:  user_option_posts_sort
## Mod Version: 1.0.2
## Author:       Adam Ismay <admin@boardz.tk>
##       Shannado <sven@shannado.nl> Sven http://www.shannado.nl/forumorg (v1.0.1)
## Description:  Allows users to choose whether they want
##               posts displayed newest or oldest first by
##         default in thier profile.
##
## Installation Level:  easy
## Installation Time:   2-3 Minutes
## Files To Edit:       viewtopic.php, profile.php, profile_add_body.tpl
## Included Files:  install_sort_mod.php
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## 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/
##############################################################
## Authors Notes:
##      Thanks go out to Shannado for fixing the main mod for phpBB2.0.1+
##      Checked upto 2.0.2.
##      Please see readme for full instructions.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#--- [ OPEN ] --------
#

viewtopic.php

#
#-- [ FIND ]----
#
# (line 195)

if ( !empty($post_id) )
{
   $start = floor(($forum_topic_data['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}

#
#---- [ REPLACE WITH ]-----
#

//
// Decide how to order the post display
//
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
   $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];
   $post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
}
else
{
   $post_order = ( $userdata['user_post_sort'] == TRUE ) ? 'desc' : 'asc';
   $post_time_order = ( $userdata['user_post_sort'] == TRUE ) ? 'DESC' : 'ASC';
}

if(!empty($post_id) )
{
   $posts_before = ( $post_order == 'desc' )? (($forum_topic_data['topic_replies'] + 1) - $forum_topic_data['prev_posts']) : ($forum_topic_data['prev_posts'] - 1);
   $start = floor( $posts_before / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}


#
#--- [ DELETE ] --------
#
# (line 358)

//
// Decide how to order the post display
//
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
   $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];
   $post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
}
else
{
   $post_order = 'asc';
   $post_time_order = 'ASC';
}



#
#--- [ OPEN ] --------
#

includes\usercp_register.php

#
#--- [ FIND ] --------
#
#  (line 175)

$user_avatar_type = ( empty($user_avatar_loc) && $mode == "editprofile" ) ? $userdata['user_avatar_type'] : "";

#
#--- [ AFTER, ADD ] --------
#

$user_post_sort = ($HTTP_POST_VARS['user_post_sort'] == 1) ? 1 : 0;

#
#--- [ FIND ] --------
#
# (line 437)

         $sql = "UPDATE " . USERS_TABLE . "
            SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
            WHERE user_id = $user_id";


#
#--- [ REPLACE WITH ] --------
#


         $sql = "UPDATE " . USERS_TABLE . "
            SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . ", user_post_sort = $user_post_sort
         WHERE user_id = $user_id";


#
#--- [ FIND ] --------
#
# (line 501)

         $sql = "INSERT INTO " . USERS_TABLE . "   (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
            VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";


#
#--- [ REPLACE WITH ] --------
#



         $sql = "INSERT INTO " . USERS_TABLE . "   (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_post_sort, user_level, user_allow_pm, user_active, user_actkey)
            VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, $user_post_sort, 0, 1, ";



#
#--- [ FIND ] --------
#
# (line 902)

      'L_PROFILE_INFO' => $lang['Profile_info'],
      'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
      'L_EMAIL_ADDRESS' => $lang['Email_address'],

#
#--- [ AFTER, ADD ] --------
#



                'L_OLDEST_FIRST' => $lang['Oldest_First'],
                'L_NEWEST_FIRST' => $lang['Newest_First'],
                'L_POSTS_SORT' => $lang['Posts'] . ' ' . $lang['Sort_by'],
                'U_SORT_OLDEST' => $userdata['user_post_sort'] ? '' : 'checked="checked"',
                'U_SORT_NEWEST' => $userdata['user_post_sort']? 'checked="checked"' : '',


#  This is just an example for subSilver. Don't forget to add to all templates.
#
#--- [ OPEN ] --------
#

templates/subSilver/profile_add_body.tpl


#
#--- [ FIND ] --------
#
# (line 184)

   <tr>
     <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_SMILIES}:</span></td>
     <td class="row2">
      <input type="radio" name="allowsmilies" value="1" {ALWAYS_ALLOW_SMILIES_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#--- [ AFTER, ADD ] --------
#

   <tr>
     <td class="row1"><span class="gen">{L_POSTS_SORT}:</span></td>
     <td class="row2">
      <input type="radio" name="user_post_sort" value="0" {U_SORT_OLDEST} />
      <span class="gen">{L_OLDEST_FIRST}</span>&nbsp;&nbsp;
      <input type="radio" name="user_post_sort" value="1" {U_SORT_NEWEST} />
      <span class="gen">{L_NEWEST_FIRST}</span></td>
   </tr>


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Erstelle Datei install-ups.php:

Code: Alles auswählen

<?php 
/*
This file is only for installing the phpBB2 mod 'user option post sort'
It should be deleted once used.
Written by Adam Ismay and released under GNU GPL
*/

define('IN_PHPBB', true);
$phpbb_root_path = "./"; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'config.'.$phpEx); 
include($phpbb_root_path . 'includes/db.'.$phpEx); 

$sql = "ALTER TABLE " . $table_prefix . "users ADD `user_post_sort` TINYINT(2) DEFAULT '0' not null AFTER `user_popup_pm`"; 
$result = $db->sql_query($sql); 
if ($result){ 
echo "Success"; 
} 
Else { 
echo "Failed"; 
} 
?> 
...lade hoch und führe aus.

Verfasst: 15.12.2002 00:53
von px
Ahh! Das ist er ;) Danke sehr :)