ezPortal Admin
Moderatorer: Moderatorgrupp, Supportgrupp
ezPortal Admin
Jag hade denna hack tidigare: ezPortal Admin.
Jag tog bort den då den skapade problem. Finns det en annan typ som jag kan ersätta den med? Har du något förslag?
Tack för all hjälp
Hälsningar
Kod: Markera allt
<?
#########################################################
## Database self installer for EzPortal Admin ver 1.0.0
## Author: Willie Yaw
## Nickname: Cyborg
## Email: cyborg@cyborgworks.com
##
## Ver 1.0.5
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really ## doesen't matter
## The script will look what prefix you are using, and use the existing DB ## defined by congig.php
## The execution of this script's included SQL is harmless, so you can run ## it as meny times you like
##
## you will after execution get a list over those commands that are run ## with succes and those with warnings !
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
define('PORTAL_TABLE', $table_prefix.'portal');
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'CREATE TABLE ' . PORTAL_TABLE . ' (portal_name VARCHAR(255) NOT NULL, portal_value TEXT NOT NULL, PRIMARY KEY (portal_name))',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("welcome_text", "Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("number_of_news", "5")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("news_length", "200")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("news_forum", "1")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("poll_forum", "1")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("number_recent_topics", "10")',
'INSERT INTO ' . PORTAL_TABLE . ' (portal_name, portal_value) VALUES ("last_seen", "5")'
);
$mods = array (
'Portal Table',
'Portal Values',
'Portal Values',
'Portal Values',
'Portal Values',
'Portal Values',
'Portal Values',
'Portal Values'
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, $lang['Not_Authorised']);
$n=0;
$message="<b>This list is a result of the SQL queries needed for the ezPortal Admin Hack ©2002/2003<a href=mailto<b>cyborg@cyborgworks.com</b></b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if( !($result = $db->sql_query($sql[$n])) )
{
$message .= '<b><font color=#DD4444>[Already changed or Posible error]</b> line: '.($n+1).' , '.$sql[$n].'</font><br />';
} else
{
if ( $db->sql_affectedrows() )
{
$message .='<b><font color=#0000FF>[Added/Updated]</b> line: '.($n+1).' , '.$sql[$n].'</font><br />';
} else
{
$message .='<b><font color=#BBBBFF>[Already added]</b> line: '.($n+1).' , '.$sql[$n].'</font><br />';
}
}
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>Kod: Markera allt
CREATE TABLE phpbb_portal (portal_name VARCHAR(255) NOT NULL, portal_value TEXT NOT NULL, PRIMARY KEY (portal_name)),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("welcome_text", "Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("number_of_news", "5"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("news_length", "200"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("news_forum", "1"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("poll_forum", "1"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("number_recent_topics", "10"),
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("last_seen", "5")
);Ingen support via PM!
إستعلام-SQL:
CREATE TABLE phpbb_portal(
portal_name VARCHAR( 255 ) NOT NULL ,
portal_value TEXT NOT NULL ,
PRIMARY KEY ( portal_name )
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"welcome_text", "Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"number_of_news", "5"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"news_length", "200"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"news_forum", "1"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"poll_forum", "1"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"number_recent_topics", "10"
),
INSERT INTO phpbb_portal( portal_name, portal_value )
VALUES (
"last_seen", "5"
)
MySQL قال:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '
INSERT INTO phpbb_portal (portal_name, portal_value) VALUE
Kod: Markera allt
CREATE TABLE phpbb_portal (portal_name VARCHAR(255) NOT NULL, portal_value TEXT NOT NULL, PRIMARY KEY (portal_name));
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("welcome_text", "Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("number_of_news", "5");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("news_length", "200");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("news_forum", "1");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("poll_forum", "1");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("number_recent_topics", "10");
INSERT INTO phpbb_portal (portal_name, portal_value) VALUES ("last_seen", "5");Ingen support via PM!
Kod: Markera allt
Parse error: syntax error, unexpected T_STRING in /hsphere/local/home/aafiklbw/macarabia.net/forum/portal.php on line 35<?php
/***************************************************************************
* portal.php
* -------------------
* begin : Tuesday, August 13, 2002
* copyright : (C) 2002 Smartor
* email : smartor_xp@hotmail.com
*
* $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program 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.
*
***************************************************************************/
/***************************************************************************
*
* Some code in this file I borrowed from the original index.php, Welcome
* Avatar MOD and others...
*
***************************************************************************/
//
// Set configuration for ezPortal
//
// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
// $CFG['welcome_text'] = 'ط§ظ„ط§ط®ظˆط© ط§ظ„ط§ط¹ط¶ط§ط، ظˆط§ظ„ط¶ظٹظˆظپ ط§ظ„ظƒط±ط§ظ…<br />
ظپظٹ ط§ظ„ط¨ط¯ط، ظ†ط±طط¨ ط¨ظƒظ… ظپظٹ ظ…ظˆظ‚ط¹ظƒظ… ظ‡ط°ط§طŒ ط§ظ„ط°ظٹ ظٹظ‡ط¯ظپ ط§ظ„ظ‰ ظ†ط´ط± ط§ظ„طھظˆط¹ظٹط© ظˆط§ظ„ظ…ط¹ط±ظپط© ظˆطھط¨ط§ط¯ظ„ ط§ظ„ط®ط¨ط±ط§طھ ظپظٹ ظ†ط¸ط§ظ… ظ…ط§ظƒ ظˆط§ظ‡ظ…ظٹطھظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹ. ظپط¶ظ„ط§ظ‹ ط¹ظ† ط§ظ„ط¨ط±ط§ظ…ط¬ ط§ظ„ظ…طھظˆط§ظپظ‚ط© ظ…ط¹ ظ‡ط°ظ‡ ط§ظ„ط¨ظٹط¦ط©. ط¨ط±ط¬ط§ط، ط§ظ„طھظƒط±ظ… ط¨ط§ظ„طھظ‚ظٹط¯ ط¨ط´ط±ظˆط· ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ط§ظ„ط°ظٹ ظ„ط§ ظٹط³ظ…ط ط¨طھط¨ط§ط¯ظ„ ط§ظ„ط¨ط±ط§ظ…ط¬ ط؛ظٹط± ط§ظ„ظ‚ط§ظ†ظˆظ†ظٹط© (ط§ظ„ظ…ظ‚ط±طµظ†ط©) ط§ظˆ ط§ط±ظ‚ط§ظ… ط§ظ„طھط³ط¬ظٹظ„ ظƒظ…ط§ ظ†ط±ط¬ظˆ طھظپظ‡ظ…طŒ ط§ظ† ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ظ…ظˆط¬ظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹطŒ ظˆط¹ظ„ظٹظ‡ ظپط§ظ„ظ„ط؛ط© ط§ظ„ظ…ط³طھط®ط¯ظ…ط© ظپظٹ ط§ظ„ظ…ط´ط§ط±ظƒط§طھ ظٹط¬ط¨ ط§ظ† طھظƒظˆظ† ط§ظ„ط¹ط±ط¨ظٹط© ظˆط§ظ„ط§ ط³ظ†ط¶ط·ط± ط¢ط³ظپظٹظ† ظ„طط°ظپ ط§ظٹ ظ…ط´ط§ط±ظƒط© طھطط±ط± ط¨ط؛ظٹط± ظ„ط؛طھظ†ط§ ط§ظ„طط¨ظٹط¨ط©. <br />
<br /> ظ†ط±طط¨ ط¨ظƒظ… ط¬ظ…ظٹط¹ط§ظ‹طŒ ظˆظ†طھظ…ظ†ظ‰ ظ„ظƒظ… ط§ظ„ط§ط³طھظپط§ط¯ط© ظ…ظ† ظ‡ط°ط§ ط§ظ„ظ…ظˆظ‚ط¹ ظ„ظ…ط§ ظپظٹظ‡ ط®ظٹط± ط§ظ„ط¬ظ…ظٹط¹.<br /><br />ط§ظ„ظ…ط´ط±ظپ ط§ظ„ط¹ط§ظ…';
// Number of news on portal
// $CFG['number_of_news'] = '5';
// Length of news
// $CFG['news_length'] = '200';
// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
// $CFG['news_forum'] = '1';
// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
// $CFG['poll_forum'] = '1';
// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';
// Excluding forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '1';
//
// END configuration
// --------------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if( $total_posts == 0 )
{
$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
$l_total_post_s = $lang['Posted_article_total'];
}
else
{
$l_total_post_s = $lang['Posted_articles_total'];
}
if( $total_users == 0 )
{
$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
$l_total_user_s = $lang['Registered_user_total'];
}
else
{
$l_total_user_s = $lang['Registered_users_total'];
}
// Read Portal Configuration from DB
define('PORTAL_TABLE', $table_prefix.'portal');
$CFG = array();
$sql = "SELECT * FROM " . PORTAL_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$CFG[$row['portal_name']] = $row['portal_value'];
}
//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
$template->assign_block_vars('recent_topic_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
'S_POSTER' => $recent_topic_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
//
// END - Recent Topics
//
if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'];
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
$lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")";
}
}
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header_lite.'.$phpEx);
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
//
// Avatar On Index MOD
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
// Check For Anonymous User
if ($userdata['user_id'] != '-1')
{
$name_link = '<a href="' . append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']) . '">' . $userdata['username'] . '</a>';
}
else
{
$name_link = $lang['Guest'];
}
//
// END: Avatar On Index MOD
//
// Start add - Photo Album Block
$album_root_path = $phpbb_root_path . 'album_mod/';
include_once($album_root_path . 'album_common.'.$phpEx);
// Build Categories Index
$sql = "SELECT c.*
FROM ". ALBUM_CAT_TABLE ." AS c
LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id
WHERE cat_id <> 0
GROUP BY cat_id
ORDER BY cat_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}
$catrows = array();
while( $row = $db->sql_fetchrow($result) )
{
$album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW
if ($album_user_access['view'] == 1)
{
$catrows[] = $row;
}
}
if ( $album_config['pics_all'] == '1' )
{
$allowed_cat = '0'; // For Recent Public Pics below
}
else
{
$allowed_cat = '';
}
//
// $catrows now stores all categories which this user can view. Dump them out!
//
for ($i = 0; $i < count($catrows); $i++)
{
// Build allowed category-list (for recent pics after here)
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
// Check Pic Approval
if ( ($catrows[$i]['cat_approval'] == ALBUM_ADMIN) || ($catrows[$i]['cat_approval'] == ALBUM_MOD) )
{
$pic_approval_sql = 'AND p.pic_approval = 1'; // Pic Approval ON
}
else
{
$pic_approval_sql = ''; // Pic Approval OFF
}
}
// Recent Public Pics
if ( $album_config['pics_all'] == '1' )
{
$pics_allowed = '0';
}
else
{
$pics_allowed = '';
}
if ( $allowed_cat != $pics_allowed )
{
$category_id = $album_config['cat_id'];
if ( $album_config['pics_sort'] == '1' )
{
if ( $category_id != 0 )
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['pics_number'];
}
else
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['pics_number'];
}
}
else if ( $album_config['pics_sort'] == '0' )
{
if ( $category_id != 0 )
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
GROUP BY p.pic_id
ORDER BY pic_time DESC
LIMIT ". $album_config['pics_number'];
}
else
{
$sql = "SELECT u.user_level, p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY pic_time DESC
LIMIT ". $album_config['pics_number'];
}
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql);
}
$recentrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$recentrow[] = $row;
}
if (count($recentrow) > 0)
{
for ($i = 0; $i < count($recentrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('recent_pics', array());
for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
{
if ( $j >= count($recentrow) )
{
break;
}
if (!$recentrow[$j]['rating'])
{
$recentrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$recentrow[$j]['rating'] = round($recentrow[$j]['rating'], 2);
}
// Display pics horizontally
$template->assign_block_vars('recent_pics.recent_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'DESC' => $recentrow[$j]['pic_desc'])
);
if ( ($recentrow[$j]['user_id'] == ALBUM_GUEST) or ($recentrow[$j]['username'] == '') )
{
$recent_poster = ($recentrow[$j]['pic_username'] == '') ? $lang['Guest'] : $recentrow[$j]['pic_username'];
}
else
{
// Start add - Username Color Mod
switch ( $recentrow[$j]['user_level'] )
{
case ADMIN:
$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
$style_color = ' style="color:# ' . $theme['fontcolor3'] . '"';
break;
case MOD:
$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
$style_color = ' style="color:# ' . $theme['fontcolor2'] . '"';
break;
default:
$poster_name = $recentrow[$j]['username'];
$style_color = '';
break;
}
// End add - Username Color Mod
$recent_poster = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $recentrow[$j]['user_id']) . '"' . $style_color . '>' . $poster_name . '</a>';
}
// Start add - Pics Dimension/Size Add-on
$pic_dimension = getimagesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename']);
$pic_width = $pic_dimension[0];
$pic_height = $pic_dimension[1];
$pic_size = round(((filesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename'])) / 1024), 2) . ' ' . $lang['Kb'];
// End add - Pics Dimension/Size Add-on
// Display pics vertically
$template->assign_block_vars('recent_pics.recent_detail', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'DESC' => $recentrow[$j]['pic_desc'],
'TITLE' => $recentrow[$j]['pic_title'],
'POSTER' => $recent_poster,
'TIME' => create_date($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']),
// New entries - Pics Dimension/Size Add-on
'DIMENSION' => $pic_width . ' x ' . $pic_height,
'SIZE' => $pic_size,
'VIEW' => $recentrow[$j]['pic_view_count'],
'RATING' => ($album_config['rate'] == 1) ? ( $lang['Rating'] . ': <a href="' . append_sid("album_rate.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['rating'] . '</a><br />') : '',
'COMMENTS' => ($album_config['comment'] == 1) ? ( $lang['Comments'] . ': <a href="' . append_sid("album_comment.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['comments'] . '</a>') : '')
);
}
}
}
else
{
// No Pics Found
$template->assign_block_vars('no_pics', array());
}
}
else
{
// No Cats Found
$template->assign_block_vars('no_pics', array());
}
// End add - Photo Album Block
$template->assign_vars(array(
'WELCOME_TEXT' => $CFG['welcome_text'],
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'L_FORUM' => $lang['Forum'],
'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
'L_STATISTICS' => $lang['Statistics'],
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
'L_POSTED' => $lang['Posted'],
'L_COMMENTS' => $lang['Comments'],
'L_VIEW_COMMENTS' => $lang['View_comments'],
'L_POST_COMMENT' => $lang['Post_your_comment'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
'L_REMEMBER_ME' => $lang['Remember_me'],
'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
'L_POLL' => $lang['Poll'],
'L_VOTE_BUTTON' => $lang['Vote'],
// Start add - Photo Album Block
'S_COLS' => $album_config['cols_per_page'],
'S_COL_WIDTH' => ( 100/$album_config['cols_per_page'] ) . '%',
'TARGET_BLANK' => ( $album_config['fullpic_popup'] ) ? ' target="_blank"' : '',
'U_ALBUM' => append_sid('album.'.$phpEx),
'L_ALBUM' => $lang['Album'],
'L_NEWEST_PICS' => ( $album_config['pics_sort'] == '0' ) ? $lang['Newest_pics'] : $lang['Random_pics'],
'L_NO_PICS' => $lang['No_Pics'],
'L_PIC_TITLE' => $lang['Pic_Title'],
'L_POSTER' => $lang['Poster'],
'L_POSTED' => $lang['Posted'],
'L_DIMENSION' => $lang['Dimension'],
'L_SIZE' => $lang['Size'],
'L_VIEW' => $lang['View'],
// End add - Photo Album Block
// Recent Topics
'L_RECENT_TOPICS' => $lang['Recent_topics'],
// Search
'L_SEARCH_AT' => $lang['Search_at'],
'L_ADVANCED_SEARCH' => $lang['Advanced_search'],
// Welcome Avatar
'L_NAME_WELCOME' => $lang['Welcome'],
'U_NAME_LINK' => $name_link,
'AVATAR_IMG' => $avatar_img)
);
//
// Fetch Posts from Announcements Forum
//
if(!isset($HTTP_GET_VARS['article']))
{
$template->assign_block_vars('welcome_text', array());
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);
for ($i = 0; $i < count($fetchposts); $i++)
{
if( $fetchposts[$i]['striped'] == 1 )
{
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $lang['Read_Full'];
}
else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id']),
'U_READ_FULL' => append_sid('portal.' . $phpEx . '?article=' . $i),
'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket)
);
}
}
else
{
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);
$i = intval($HTTP_GET_VARS['article']);
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id'])
)
);
}
//
// END: Fetch Announcements
//
//\\
//\\ Start - vgan's Portal Poll Mod V. 2.0
//\\
// Set the vote graphic length to 100
// Note: If the bars look too long at %100, (only 1 vote) set this value lower.
// Likewise, if it looks too short to you, increase it here.
$length = 100;
// Get the poll forum from EZportal config above
$poll_forum = $CFG['poll_forum'];
{
$template->assign_block_vars('PORTAL_POLL', array());
$sql = 'SELECT
t.*, vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
t.forum_id = ' . $poll_forum . ' AND
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain poll information.", "", __LINE__, __FILE__, $sql);
}
if(!$total_posts = $db->sql_numrows($result))
{
message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$pollrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$topic_id = $pollrow[0]['topic_id'] ;
$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
}
if( $vote_options = $db->sql_numrows($result) )
{
$vote_info = $db->sql_fetchrowset($result);
$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
}
$user_voted = ( $db->sql_numrows($result) ) ? TRUE : 0;
if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
{
$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == "viewresult" ) ? TRUE : 0;
}
else
{
$view_result = 0;
}
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
if( $user_voted || $view_result || $poll_expired || $forum_row['topic_status'] == TOPIC_LOCKED )
{
$template->set_filenames(array(
"pollbox" => "portal_poll_result.tpl")
);
$vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++)
{
$vote_results_sum += $vote_info[$i]['vote_result'];
}
$vote_graphic = 0;
$vote_graphic_max = count($images['voting_graphic']);
for($i = 0; $i < $vote_options; $i++)
{
$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
$portal_vote_graphic_length = round($vote_percent * $length);
$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'],
"POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'],
"POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)),
"POLL_OPTION_IMG" => $vote_graphic_img,
"POLL_OPTION_IMG_WIDTH" => $portal_vote_graphic_length/1)
);
}
$template->assign_vars(array(
"L_TOTAL_VOTES" => $lang['Total_votes'],
"TOTAL_VOTES" => $vote_results_sum,
"L_VIEW_RESULTS" => $lang['View_results'],
"U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
);
}
else
{
$template->set_filenames(array(
"pollbox" => "portal_poll_ballot.tpl")
);
for($i = 0; $i < $vote_options; $i++)
{
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
"LOGIN_TO_VOTE" => '<b><a href="' . append_sid("login.$phpEx?redirect=portal.$phpEx") . '">' . $lang['Login_to_vote'] . '</a><b>')
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
}
if( count($orig_word) )
{
$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
}
$template->assign_vars(array(
"POLL_QUESTION" => $vote_title,
"L_SUBMIT_VOTE" => $lang['Submit_vote'],
"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
);
$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
}
}
//\\
//\\ End - vgan's Portal Poll Mod V. 2.0
//\\
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Kod: Markera allt
// $CFG['welcome_text'] = 'ط§ظ„ط§ط®ظˆط© ط§ظ„ط§ط¹ط¶ط§ط، ظˆط§ظ„ط¶ظٹظˆظپ ط§ظ„ظƒط±ط§ظ…<br />
ظپظٹ ط§ظ„ط¨ط¯ط، ظ†ط±طط¨ ط¨ظƒظ… ظپظٹ ظ…ظˆظ‚ط¹ظƒظ… ظ‡ط°ط§طŒ ط§ظ„ط°ظٹ ظٹظ‡ط¯ظپ ط§ظ„ظ‰ ظ†ط´ط± ط§ظ„طھظˆط¹ظٹط© ظˆط§ظ„ظ…ط¹ط±ظپط© ظˆطھط¨ط§ط¯ظ„ ط§ظ„ط®ط¨ط±ط§طھ ظپظٹ ظ†ط¸ط§ظ… ظ…ط§ظƒ ظˆط§ظ‡ظ…ظٹطھظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹ. ظپط¶ظ„ط§ظ‹ ط¹ظ† ط§ظ„ط¨ط±ط§ظ…ط¬ ط§ظ„ظ…طھظˆط§ظپظ‚ط© ظ…ط¹ ظ‡ط°ظ‡ ط§ظ„ط¨ظٹط¦ط©. ط¨ط±ط¬ط§ط، ط§ظ„طھظƒط±ظ… ط¨ط§ظ„طھظ‚ظٹط¯ ط¨ط´ط±ظˆط· ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ط§ظ„ط°ظٹ ظ„ط§ ظٹط³ظ…ط ط¨طھط¨ط§ط¯ظ„ ط§ظ„ط¨ط±ط§ظ…ط¬ ط؛ظٹط± ط§ظ„ظ‚ط§ظ†ظˆظ†ظٹط© (ط§ظ„ظ…ظ‚ط±طµظ†ط©) ط§ظˆ ط§ط±ظ‚ط§ظ… ط§ظ„طھط³ط¬ظٹظ„ ظƒظ…ط§ ظ†ط±ط¬ظˆ طھظپظ‡ظ…طŒ ط§ظ† ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ظ…ظˆط¬ظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹطŒ ظˆط¹ظ„ظٹظ‡ ظپط§ظ„ظ„ط؛ط© ط§ظ„ظ…ط³طھط®ط¯ظ…ط© ظپظٹ ط§ظ„ظ…ط´ط§ط±ظƒط§طھ ظٹط¬ط¨ ط§ظ† طھظƒظˆظ† ط§ظ„ط¹ط±ط¨ظٹط© ظˆط§ظ„ط§ ط³ظ†ط¶ط·ط± ط¢ط³ظپظٹظ† ظ„طط°ظپ ط§ظٹ ظ…ط´ط§ط±ظƒط© طھطط±ط± ط¨ط؛ظٹط± ظ„ط؛طھظ†ط§ ط§ظ„طط¨ظٹط¨ط©. <br />
<br /> ظ†ط±طط¨ ط¨ظƒظ… ط¬ظ…ظٹط¹ط§ظ‹طŒ ظˆظ†طھظ…ظ†ظ‰ ظ„ظƒظ… ط§ظ„ط§ط³طھظپط§ط¯ط© ظ…ظ† ظ‡ط°ط§ ط§ظ„ظ…ظˆظ‚ط¹ ظ„ظ…ط§ ظپظٹظ‡ ط®ظٹط± ط§ظ„ط¬ظ…ظٹط¹.<br /><br />ط§ظ„ظ…ط´ط±ظپ ط§ظ„ط¹ط§ظ…'; Eller ännu bättre:
Ersätt
Kod: Markera allt
// $CFG['welcome_text'] = 'ط§ظ„ط§ط®ظˆط© ط§ظ„ط§ط¹ط¶ط§ط، ظˆط§ظ„ط¶ظٹظˆظپ ط§ظ„ظƒط±ط§ظ…<br />
ظپظٹ ط§ظ„ط¨ط¯ط، ظ†ط±طط¨ ط¨ظƒظ… ظپظٹ ظ…ظˆظ‚ط¹ظƒظ… ظ‡ط°ط§طŒ ط§ظ„ط°ظٹ ظٹظ‡ط¯ظپ ط§ظ„ظ‰ ظ†ط´ط± ط§ظ„طھظˆط¹ظٹط© ظˆط§ظ„ظ…ط¹ط±ظپط© ظˆطھط¨ط§ط¯ظ„ ط§ظ„ط®ط¨ط±ط§طھ ظپظٹ ظ†ط¸ط§ظ… ظ…ط§ظƒ ظˆط§ظ‡ظ…ظٹطھظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹ. ظپط¶ظ„ط§ظ‹ ط¹ظ† ط§ظ„ط¨ط±ط§ظ…ط¬ ط§ظ„ظ…طھظˆط§ظپظ‚ط© ظ…ط¹ ظ‡ط°ظ‡ ط§ظ„ط¨ظٹط¦ط©. ط¨ط±ط¬ط§ط، ط§ظ„طھظƒط±ظ… ط¨ط§ظ„طھظ‚ظٹط¯ ط¨ط´ط±ظˆط· ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ط§ظ„ط°ظٹ ظ„ط§ ظٹط³ظ…ط ط¨طھط¨ط§ط¯ظ„ ط§ظ„ط¨ط±ط§ظ…ط¬ ط؛ظٹط± ط§ظ„ظ‚ط§ظ†ظˆظ†ظٹط© (ط§ظ„ظ…ظ‚ط±طµظ†ط©) ط§ظˆ ط§ط±ظ‚ط§ظ… ط§ظ„طھط³ط¬ظٹظ„ ظƒظ…ط§ ظ†ط±ط¬ظˆ طھظپظ‡ظ…طŒ ط§ظ† ظ‡ط°ط§ ط§ظ„ظ…ظ†طھط¯ظ‰ ظ…ظˆط¬ظ‡ ظ„ظ„ظ…ط³طھط®ط¯ظ… ط§ظ„ط¹ط±ط¨ظٹطŒ ظˆط¹ظ„ظٹظ‡ ظپط§ظ„ظ„ط؛ط© ط§ظ„ظ…ط³طھط®ط¯ظ…ط© ظپظٹ ط§ظ„ظ…ط´ط§ط±ظƒط§طھ ظٹط¬ط¨ ط§ظ† طھظƒظˆظ† ط§ظ„ط¹ط±ط¨ظٹط© ظˆط§ظ„ط§ ط³ظ†ط¶ط·ط± ط¢ط³ظپظٹظ† ظ„طط°ظپ ط§ظٹ ظ…ط´ط§ط±ظƒط© طھطط±ط± ط¨ط؛ظٹط± ظ„ط؛طھظ†ط§ ط§ظ„طط¨ظٹط¨ط©. <br />
<br /> ظ†ط±طط¨ ط¨ظƒظ… ط¬ظ…ظٹط¹ط§ظ‹طŒ ظˆظ†طھظ…ظ†ظ‰ ظ„ظƒظ… ط§ظ„ط§ط³طھظپط§ط¯ط© ظ…ظ† ظ‡ط°ط§ ط§ظ„ظ…ظˆظ‚ط¹ ظ„ظ…ط§ ظپظٹظ‡ ط®ظٹط± ط§ظ„ط¬ظ…ظٹط¹.<br /><br />ط§ظ„ظ…ط´ط±ظپ ط§ظ„ط¹ط§ظ…'; // $CFG['welcome_text'] = '';
Ingen support via PM!
Could not query recent topics information
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8
SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username FROM phpbb_topics AS t, phpbb_posts AS p, phpbb_users AS u WHERE t.forum_id NOT IN ('start') AND t.topic_status <> 2 AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id ORDER BY p.post_id DESC LIMIT
Line : 176
File : portal.php
<?php
/***************************************************************************
* portal.php
* -------------------
* begin : Tuesday, August 13, 2002
* copyright : (C) 2002 Smartor
* email : smartor_xp@hotmail.com
*
* $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program 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.
*
***************************************************************************/
/***************************************************************************
*
* Some code in this file I borrowed from the original index.php, Welcome
* Avatar MOD and others...
*
***************************************************************************/
//
// Set configuration for ezPortal
//
// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
// $CFG['welcome_text'] = '';
// Number of news on portal
// $CFG['number_of_news'] = '3';
// Length of news
// $CFG['news_length'] = '0';
// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
// $CFG['news_forum'] = '1';
// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
// $CFG['poll_forum'] = '1';
// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';
// Excluding forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '1';
//
// END configuration
// --------------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if( $total_posts == 0 )
{
$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
$l_total_post_s = $lang['Posted_article_total'];
}
else
{
$l_total_post_s = $lang['Posted_articles_total'];
}
if( $total_users == 0 )
{
$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
$l_total_user_s = $lang['Registered_user_total'];
}
else
{
$l_total_user_s = $lang['Registered_users_total'];
}
// Read Portal Configuration from DB
define('PORTAL_TABLE', $table_prefix.'portal');
$CFG = array();
$sql = "SELECT * FROM " . PORTAL_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$CFG[$row['portal_name']] = $row['portal_value'];
}
//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
$template->assign_block_vars('recent_topic_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
'S_POSTER' => $recent_topic_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
//
// END - Recent Topics
//
if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'];
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
$lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")";
}
}
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header_lite.'.$phpEx);
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
//
// Avatar On Index MOD
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
// Check For Anonymous User
if ($userdata['user_id'] != '-1')
{
$name_link = '<a href="' . append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']) . '">' . $userdata['username'] . '</a>';
}
else
{
$name_link = $lang['Guest'];
}
//
// END: Avatar On Index MOD
//
// Start add - Photo Album Block
$album_root_path = $phpbb_root_path . 'album_mod/';
include_once($album_root_path . 'album_common.'.$phpEx);
// Build Categories Index
$sql = "SELECT c.*
FROM ". ALBUM_CAT_TABLE ." AS c
LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id
WHERE cat_id <> 0
GROUP BY cat_id
ORDER BY cat_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}
$catrows = array();
while( $row = $db->sql_fetchrow($result) )
{
$album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW
if ($album_user_access['view'] == 1)
{
$catrows[] = $row;
}
}
if ( $album_config['pics_all'] == '1' )
{
$allowed_cat = '0'; // For Recent Public Pics below
}
else
{
$allowed_cat = '';
}
//
// $catrows now stores all categories which this user can view. Dump them out!
//
for ($i = 0; $i < count($catrows); $i++)
{
// Build allowed category-list (for recent pics after here)
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
// Check Pic Approval
if ( ($catrows[$i]['cat_approval'] == ALBUM_ADMIN) || ($catrows[$i]['cat_approval'] == ALBUM_MOD) )
{
$pic_approval_sql = 'AND p.pic_approval = 1'; // Pic Approval ON
}
else
{
$pic_approval_sql = ''; // Pic Approval OFF
}
}
// Recent Public Pics
if ( $album_config['pics_all'] == '1' )
{
$pics_allowed = '0';
}
else
{
$pics_allowed = '';
}
if ( $allowed_cat != $pics_allowed )
{
$category_id = $album_config['cat_id'];
if ( $album_config['pics_sort'] == '1' )
{
if ( $category_id != 0 )
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['pics_number'];
}
else
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['pics_number'];
}
}
else if ( $album_config['pics_sort'] == '0' )
{
if ( $category_id != 0 )
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
GROUP BY p.pic_id
ORDER BY pic_time DESC
LIMIT ". $album_config['pics_number'];
}
else
{
$sql = "SELECT u.user_level, p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY pic_time DESC
LIMIT ". $album_config['pics_number'];
}
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql);
}
$recentrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$recentrow[] = $row;
}
if (count($recentrow) > 0)
{
for ($i = 0; $i < count($recentrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('recent_pics', array());
for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
{
if ( $j >= count($recentrow) )
{
break;
}
if (!$recentrow[$j]['rating'])
{
$recentrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$recentrow[$j]['rating'] = round($recentrow[$j]['rating'], 2);
}
// Display pics horizontally
$template->assign_block_vars('recent_pics.recent_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'DESC' => $recentrow[$j]['pic_desc'])
);
if ( ($recentrow[$j]['user_id'] == ALBUM_GUEST) or ($recentrow[$j]['username'] == '') )
{
$recent_poster = ($recentrow[$j]['pic_username'] == '') ? $lang['Guest'] : $recentrow[$j]['pic_username'];
}
else
{
// Start add - Username Color Mod
switch ( $recentrow[$j]['user_level'] )
{
case ADMIN:
$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
$style_color = ' style="color:# ' . $theme['fontcolor3'] . '"';
break;
case MOD:
$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
$style_color = ' style="color:# ' . $theme['fontcolor2'] . '"';
break;
default:
$poster_name = $recentrow[$j]['username'];
$style_color = '';
break;
}
// End add - Username Color Mod
$recent_poster = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $recentrow[$j]['user_id']) . '"' . $style_color . '>' . $poster_name . '</a>';
}
// Start add - Pics Dimension/Size Add-on
$pic_dimension = getimagesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename']);
$pic_width = $pic_dimension[0];
$pic_height = $pic_dimension[1];
$pic_size = round(((filesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename'])) / 1024), 2) . ' ' . $lang['Kb'];
// End add - Pics Dimension/Size Add-on
// Display pics vertically
$template->assign_block_vars('recent_pics.recent_detail', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
'DESC' => $recentrow[$j]['pic_desc'],
'TITLE' => $recentrow[$j]['pic_title'],
'POSTER' => $recent_poster,
'TIME' => create_date($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']),
// New entries - Pics Dimension/Size Add-on
'DIMENSION' => $pic_width . ' x ' . $pic_height,
'SIZE' => $pic_size,
'VIEW' => $recentrow[$j]['pic_view_count'],
'RATING' => ($album_config['rate'] == 1) ? ( $lang['Rating'] . ': <a href="' . append_sid("album_rate.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['rating'] . '</a><br />') : '',
'COMMENTS' => ($album_config['comment'] == 1) ? ( $lang['Comments'] . ': <a href="' . append_sid("album_comment.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['comments'] . '</a>') : '')
);
}
}
}
else
{
// No Pics Found
$template->assign_block_vars('no_pics', array());
}
}
else
{
// No Cats Found
$template->assign_block_vars('no_pics', array());
}
// End add - Photo Album Block
$template->assign_vars(array(
'WELCOME_TEXT' => $CFG['welcome_text'],
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'L_FORUM' => $lang['Forum'],
'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
'L_STATISTICS' => $lang['Statistics'],
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
'L_POSTED' => $lang['Posted'],
'L_COMMENTS' => $lang['Comments'],
'L_VIEW_COMMENTS' => $lang['View_comments'],
'L_POST_COMMENT' => $lang['Post_your_comment'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
'L_REMEMBER_ME' => $lang['Remember_me'],
'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
'L_POLL' => $lang['Poll'],
'L_VOTE_BUTTON' => $lang['Vote'],
// Start add - Photo Album Block
'S_COLS' => $album_config['cols_per_page'],
'S_COL_WIDTH' => ( 100/$album_config['cols_per_page'] ) . '%',
'TARGET_BLANK' => ( $album_config['fullpic_popup'] ) ? ' target="_blank"' : '',
'U_ALBUM' => append_sid('album.'.$phpEx),
'L_ALBUM' => $lang['Album'],
'L_NEWEST_PICS' => ( $album_config['pics_sort'] == '0' ) ? $lang['Newest_pics'] : $lang['Random_pics'],
'L_NO_PICS' => $lang['No_Pics'],
'L_PIC_TITLE' => $lang['Pic_Title'],
'L_POSTER' => $lang['Poster'],
'L_POSTED' => $lang['Posted'],
'L_DIMENSION' => $lang['Dimension'],
'L_SIZE' => $lang['Size'],
'L_VIEW' => $lang['View'],
// End add - Photo Album Block
// Recent Topics
'L_RECENT_TOPICS' => $lang['Recent_topics'],
// Search
'L_SEARCH_AT' => $lang['Search_at'],
'L_ADVANCED_SEARCH' => $lang['Advanced_search'],
// Welcome Avatar
'L_NAME_WELCOME' => $lang['Welcome'],
'U_NAME_LINK' => $name_link,
'AVATAR_IMG' => $avatar_img)
);
//
// Fetch Posts from Announcements Forum
//
if(!isset($HTTP_GET_VARS['article']))
{
$template->assign_block_vars('welcome_text', array());
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);
for ($i = 0; $i < count($fetchposts); $i++)
{
if( $fetchposts[$i]['striped'] == 1 )
{
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $lang['Read_Full'];
}
else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id']),
'U_READ_FULL' => append_sid('portal.' . $phpEx . '?article=' . $i),
'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket)
);
}
}
else
{
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);
$i = intval($HTTP_GET_VARS['article']);
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id'])
)
);
}
//
// END: Fetch Announcements
//
//\\
//\\ Start - vgan's Portal Poll Mod V. 2.0
//\\
// Set the vote graphic length to 100
// Note: If the bars look too long at %100, (only 1 vote) set this value lower.
// Likewise, if it looks too short to you, increase it here.
$length = 100;
// Get the poll forum from EZportal config above
$poll_forum = $CFG['poll_forum'];
{
$template->assign_block_vars('PORTAL_POLL', array());
$sql = 'SELECT
t.*, vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
t.forum_id = ' . $poll_forum . ' AND
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain poll information.", "", __LINE__, __FILE__, $sql);
}
if(!$total_posts = $db->sql_numrows($result))
{
message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$pollrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$topic_id = $pollrow[0]['topic_id'] ;
$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
}
if( $vote_options = $db->sql_numrows($result) )
{
$vote_info = $db->sql_fetchrowset($result);
$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
}
$user_voted = ( $db->sql_numrows($result) ) ? TRUE : 0;
if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
{
$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == "viewresult" ) ? TRUE : 0;
}
else
{
$view_result = 0;
}
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
if( $user_voted || $view_result || $poll_expired || $forum_row['topic_status'] == TOPIC_LOCKED )
{
$template->set_filenames(array(
"pollbox" => "portal_poll_result.tpl")
);
$vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++)
{
$vote_results_sum += $vote_info[$i]['vote_result'];
}
$vote_graphic = 0;
$vote_graphic_max = count($images['voting_graphic']);
for($i = 0; $i < $vote_options; $i++)
{
$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
$portal_vote_graphic_length = round($vote_percent * $length);
$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'],
"POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'],
"POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)),
"POLL_OPTION_IMG" => $vote_graphic_img,
"POLL_OPTION_IMG_WIDTH" => $portal_vote_graphic_length/1)
);
}
$template->assign_vars(array(
"L_TOTAL_VOTES" => $lang['Total_votes'],
"TOTAL_VOTES" => $vote_results_sum,
"L_VIEW_RESULTS" => $lang['View_results'],
"U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
);
}
else
{
$template->set_filenames(array(
"pollbox" => "portal_poll_ballot.tpl")
);
for($i = 0; $i < $vote_options; $i++)
{
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
"LOGIN_TO_VOTE" => '<b><a href="' . append_sid("login.$phpEx?redirect=portal.$phpEx") . '">' . $lang['Login_to_vote'] . '</a><b>')
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
}
if( count($orig_word) )
{
$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
}
$template->assign_vars(array(
"POLL_QUESTION" => $vote_title,
"L_SUBMIT_VOTE" => $lang['Submit_vote'],
"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
);
$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
}
}
//\\
//\\ End - vgan's Portal Poll Mod V. 2.0
//\\
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Som jag ser det har du gjort något fel. Du har deaktiverat CFG i början av filen ... men samma CFG är fortfarande aktiva längre ner i portal.php.
Skulle de inte ersättas med board_config?
Kod: Markera allt
#
#-----[ FIND ALL ]-----------------------
#
$CFG['*']
#
#-----[ REPLACE BY ]------------------
#
$board_config['*']Ingen support via PM!
Vilka är online
Användare som besöker denna kategori: 4 och 0 gäster



