parent
43bd663cb3
commit
e317d96322
7 changed files with 114 additions and 11 deletions
|
|
@ -71,6 +71,11 @@ class configuration
|
|||
*/
|
||||
var $punbb_wotd_id = '1';
|
||||
|
||||
/**
|
||||
* PunBB's forum max length for the message
|
||||
*/
|
||||
var $punbb_max_length = 60;
|
||||
|
||||
/**
|
||||
* Additional URL
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class language
|
|||
var $see_also = "See also:";
|
||||
var $forum ="Forum";
|
||||
var $forum_new = "New";
|
||||
var $forum_view = "Show the topic";
|
||||
var $forum_error = "Cannot read comments";
|
||||
var $comments = "Comments";
|
||||
var $wotd = "Word of the day";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class language
|
|||
var $see_also = "Voir aussi :";
|
||||
var $forum = "Forum";
|
||||
var $forum_new = "Nouveau";
|
||||
var $forum_view = "Voir le sujet";
|
||||
var $forum_error = "Impossible de lire les commentaires";
|
||||
var $comments = "Commentaires";
|
||||
var $wotd = "Dernier message du webmaster";
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ require PUN_ROOT.'include/functions.php';
|
|||
// Load DB abstraction layer and try to connect
|
||||
require PUN_ROOT.'include/dblayer/common_db.php';
|
||||
|
||||
// Load cached config
|
||||
@include PUN_ROOT.'cache/cache_config.php';
|
||||
if (!defined('PUN_CONFIG_LOADED'))
|
||||
{
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
generate_config_cache();
|
||||
require PUN_ROOT.'cache/cache_config.php';
|
||||
// Load cached config
|
||||
@include PUN_ROOT.'cache/cache_config.php';
|
||||
if (!defined('PUN_CONFIG_LOADED'))
|
||||
{
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
generate_config_cache();
|
||||
require PUN_ROOT.'cache/cache_config.php';
|
||||
}
|
||||
|
||||
// Make sure we (guests) have permission to read the forums
|
||||
|
|
@ -363,6 +363,10 @@ else if ( $_GET['action'] == 'topic') {
|
|||
;';
|
||||
|
||||
$result = $db->query($sql) or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
if (isset($_GET['max_subject_length']) && is_numeric($_GET['max_subject_length']) && !empty($_GET['max_subject_length'])) {
|
||||
$max_subject_length = $_GET['max_subject_length'];
|
||||
}
|
||||
|
||||
while ($cur_post = $db->fetch_assoc($result))
|
||||
{
|
||||
|
|
|
|||
91
punbb-1.2.15_redirect_stripit.php
Normal file
91
punbb-1.2.15_redirect_stripit.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/***********************************************************************
|
||||
|
||||
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
|
||||
|
||||
This file is part of PunBB.
|
||||
|
||||
PunBB is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
PunBB is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
MA 02111-1307 USA
|
||||
|
||||
************************************************************************/
|
||||
define('PUN_ROOT', './');
|
||||
@include PUN_ROOT.'config.php';
|
||||
|
||||
// If PUN isn't defined, config.php is missing or corrupt
|
||||
if (!defined('PUN'))
|
||||
exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
|
||||
|
||||
|
||||
// Make sure PHP reports all errors except E_NOTICE
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
// Turn off magic_quotes_runtime
|
||||
set_magic_quotes_runtime(0);
|
||||
|
||||
|
||||
// Load the functions script
|
||||
require PUN_ROOT.'include/functions.php';
|
||||
|
||||
// Load DB abstraction layer and try to connect
|
||||
require PUN_ROOT.'include/dblayer/common_db.php';
|
||||
|
||||
// Load cached config
|
||||
@include PUN_ROOT.'cache/cache_config.php';
|
||||
if (!defined('PUN_CONFIG_LOADED'))
|
||||
{
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
generate_config_cache();
|
||||
require PUN_ROOT.'cache/cache_config.php';
|
||||
}
|
||||
|
||||
// Make sure we (guests) have permission to read the forums
|
||||
$result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->result($result) == '0')
|
||||
exit('No permission');
|
||||
|
||||
|
||||
// Attempt to load the common language file
|
||||
@include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php';
|
||||
if (!isset($lang_common))
|
||||
exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');
|
||||
|
||||
// Check if we are to display a maintenance message
|
||||
if ($pun_config['o_maintenance'] && !defined('PUN_TURN_OFF_MAINT'))
|
||||
maintenance_message();
|
||||
|
||||
if (!isset($_GET['ttitle']))
|
||||
exit('No parameters supplied. See redirect_stripit.php for instructions.');
|
||||
|
||||
|
||||
$sql = 'SELECT t.id
|
||||
FROM '.$db->prefix.'topics AS t
|
||||
WHERE t.subject="'.utf8_decode($_GET['ttitle']).'";';
|
||||
|
||||
$res = $db->query( $sql );
|
||||
|
||||
if ($res != false && $db->num_rows($res) > 0) {
|
||||
$_tid = $db->fetch_row( $res );
|
||||
$tid = intval( $_tid[0] );
|
||||
} else {
|
||||
$tid = 0;
|
||||
}
|
||||
|
||||
if( $tid > 0 ) {
|
||||
header('Location: viewtopic.php?id='.$tid);
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
}
|
||||
exit;
|
||||
|
|
@ -423,19 +423,19 @@ class strip_manager
|
|||
// if one want to use punbb as forum
|
||||
if( $this->general->use_punbb ) {
|
||||
// lasts posts associated to the strip
|
||||
$fh = fopen( $this->general->forum.'/extern.php?action=topic&ttitle='.urlencode($this->title), 'r');
|
||||
$fh = fopen( $this->general->forum.'/extern.php?action=topic&ttitle='.urlencode($this->title).'&max_subject_length='.$this->general->punbb_max_length, 'r');
|
||||
|
||||
if (!$fh) {
|
||||
// TODO traduction
|
||||
$this->comments = $this->lang->forum_error;
|
||||
} else {
|
||||
$this->comments = stream_get_contents($fh);
|
||||
$this->comments = utf8_encode(stream_get_contents($fh));
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
// link for posting a new comment
|
||||
$this->forum_post_url = $this->general->forum . '/post.php?ttitle='.urlencode($this->title).'&fid='.$this->general->punbb_forum_id;
|
||||
|
||||
$this->forum_view_url = $this->general->forum . '/redirect_stripit.php?ttitle='.urlencode($this->title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@
|
|||
<ul id="comments">
|
||||
{comments:h}
|
||||
</ul>
|
||||
<a href="{forum_post_url}">{lang.forum_new}</a>
|
||||
<a href="{forum_post_url}">{lang.forum_new}</a> |
|
||||
<a href="{forum_view_url}">{lang.forum_view}</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue