PDA

View Full Version : Got some problems with my news system :S


Fronix
03-27-2008, 05:46 PM
Ok i don't know if you can call it "problems" but i can't figure this out. I have this news system i use the posts from my forum to show on the main website as news. Now i want the text to be in a little box with images around it ive been trying to 2 days and searching but i can't find anything. I have a test u can take a look HERE (http://www.rtgaming.se/forum/news.php) and here is the code:

<?php

/*

+---------------------------------------------------------------------------------------------

|IPB News

|This modification allows you to display

|news from your Invision Power Board on to your website.

+================================================= ============================================

|Author: Timur Karasapan

|Author Email: timur.karasapan@gmail.com

+================================================= ============================================

|MOD Version: 3.0.1

|IPB Software Compatiblity: Invision Power Board 2.1.x - 2.2.x

+================================================= ============================================

|No part of this script may be used, edited or redistributed without written

|consent from the author. If a request to redistribute, edit and or otherwise use

|this mod (except for its intended use) is not replied to then it is to be

|considered as a lack of permission.

+================================================= ============================================ | Timur Karasapan. All Rights Reserved 2006 - 2007.

+================================================= ============================================

|Do not remove this comment box - I worked hard on this and half the fun

|of it is seeing your name on something useful. If you wish to remove

|the copyright displayed below the news then contact me for

|more information on the nominal fee that is required.

+---------------------------------------------------------------------------------------------

*/



//-----------------------------------------

// Is Your PHP Version Too Old?

//-----------------------------------------

$PHP_VERSION = PHP_VERSION;



if ( PHP_VERSION < '4.3.0' )

{

echo '<center><h1>Unable to Run</h1> You are running PHP version <strong>'.$PHP_VERSION.'</strong>; in order for IPB News to run correctly you need to be running PHP version 4.3.0 & over.</center>';

exit;



}



//---------------------------------------------------//

//You May Edit The CSS for Private Use ONLY //

//Do NOT Edit If You Do not Have Experiance With CSS //

//---------------------------------------------------//

$css = <<<BOB

<style type="text/css">





a {

text-decoration: none;

color: #FFCD00;

}



.title {

margin-bottom: 0px;

list-style: none;

display: block;

width: 500px;

color: #000000;

padding: 1px;

position: relative;

top: 30px;

border: 1px solid #000000;

background-repeat: no-repeat;

background-image: url(http://www.rtgaming.se/images/news_title.gif);

text-decoration: none;

text-align: left;

}



.alt-bar {

margin-bottom: 2px;

list-style: none;

display: block;

width: 500px;

color: #000000;

padding: 5px;

position: relative;

top: 30px;

border: 1px solid #000000;

background-repeat: no-repeat;

background-image: url(http://www.rtgaming.se/images/navbar.gif);

text-decoration: none;

text-align: left;

}



.post {

margin-bottom: 2px;

list-style: none;

display: block;

width: 500px;

color: #000000;

background-repeat: no-repeat;

background-image: url(http://www.rtgaming.se/images/news_bg.gif);

padding: 5px;

position: relative;

top: 30px;

border: 1px solid #000000;

text-decoration: none;

text-align: left;

}



.footer {

margin-bottom: 2px;

list-style: none;

display: block;

width: 500px;

color: #000000;

padding: 5px;

position: relative;

top: 30px;

border: 1px solid #000000;

background-repeat: no-repeat;

background-image: url(http://www.rtgaming.se/images/navbar.gif);

text-decoration: none;

text-align: center;

}



.alt-left {

text-align: left;

}

.alt-center {

text-align: center;

}

.alt-right {

text-align: right;

}



.credit {

margin: 10px;

list-style: none;

display: block;

width: 500px;

color: #ffffff;

padding: 5px;

border: 1px solid #ffffff;

background-color: #222222;

text-decoration: none;

text-align: center;

}



.offline {

margin-bottom: 2px;

list-style: none;

display: block;

width: 500px;

color: #000000;

padding: 5px;

position: relative;

top: 30px;

border: 1px solid #ffffff;

background-color: #222222;

text-decoration: none;

text-align: center;

}

</style>

BOB;

//------------------------------------------------

//Do Not Edit Below This

//------------------------------------------------





//================================//

// IPB News Core Code //

//================================//



//--------------------------------

// Some Light Reading

//--------------------------------

require("conf_global.php");

require_once("news_config.php");







$cv = 'v3.0.1'; //Editing this Can Cause Your IPB News Script to Stop Working.

//=============================================

//News Config Error Check v1.0.0

//=============================================

//Purpose: Makes sure that the config file is correctly configured.

//Hierarchy: Check is preformed prior to DB connection.





if (file_exists("conf_global.php")) {

;

} else {

echo 'Cannot locate conf_global.php; make sure you have placed both files in your forums main directory';

exit;

}



if (file_exists("news_config.php")) {

;

} else {

echo 'Cannot locate news_config.php; make sure you have placed both files in your forums main directory';

exit;

}





if (preg_match("/http:/i", "$ipb_forumpath")) {//Basic Url Syntax Check

;

} else {

echo "IPB News Configuration Error: Forum URL entered incorrectly.";

exit;

}



if ($emoticons == NULL) {

echo "IPB News Configuration Error: Emoticon folder NOT specified.";

exit;

}

else {

;

}



if (ereg('[/\]', $emoticons)) {

echo "IPB News Configuration Error: Emoticon folder incorrectly specified.";

exit;

}

else {

;

}





if (ereg('[A-Za-z/\?<>!@#$%^&*()]', $ipb_news)) {//Numeric Id Method 1

echo "IPB News Configuration Error: News Thread Numbers incorrectly specified.";

exit;

}

else {

;

}



if (ereg('[A-Za-z/\?<>!@#$%^&*()]', $ipb_newspathid)) {

echo "IPB News Configuration Error: Forum ID incorrectly specified.";

exit;

}

else {

;

}



if(($subdomain != '0') AND ($subdomain != '1')) {//Numeric Id Method 2

echo 'IPB News Configuration Error: Subdomain option incorrectly filled in.';

exit;

}



if($ipb_news > '5') {

$ipb_news = '5';

}



if(($ipb_pmON != '0') AND ($ipb_pmON != '1')) {

echo 'IPB News Configuration Error: PM option incorrectly filled in.';

exit;

}



if(($display != 'default') AND ($display != 'AI') AND ($display != 'classical')) {//Updated for v2.1.0's new display vars.

echo 'IPB News Configuration Error: IPB News Display option has been incorrectly filled in.';

exit;

}



if(($sort_by != 'date') AND ($sort_by != 'last post')) {

echo 'IPB News Configuration Error: The sorting option incorrectly filled in.';

exit;

}

//========================================

//End News Config Error Check

//========================================



//--------------------------------

//Time to Connect

//--------------------------------



mysql_connect ($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']) or die(mysql_error());

mysql_select_db ($INFO['sql_database']) or die(mysql_error());



//--------------

//v1.5.0 Bug Fix

//--------------

//$INFO['sql_tbl_prefix'] = pulls your DB's prefix.



//-----------------------------------------

// Is Your Board Offline?

//-----------------------------------------

$offline_check = mysql_query("SELECT * FROM ".$INFO['sql_tbl_prefix']."conf_settings WHERE conf_key = 'board_offline'");

$offline = mysql_fetch_array($offline_check);

$Offline_stat = $offline['conf_value'];



$offline_msg_check = mysql_query("SELECT * FROM ".$INFO['sql_tbl_prefix']."conf_settings WHERE conf_key = 'offline_msg'");

$offline_msgg = mysql_fetch_array($offline_msg_check);

$offline_msg = $offline_msgg['conf_value'];

//

//-----------------------------------------



//-----------------------------------

//Time to Get the Other Data We need

//-----------------------------------

$ipb_graball = mysql_query ("SELECT * FROM ".$INFO['sql_tbl_prefix']."forums WHERE id=".$ipb_newspathid."");

$ipb_maxposts = mysql_fetch_array($ipb_graball);

$ipb_gethtml = ('By Timur Karasapan');



//--------------------------------

//How Do We Want To Sort Our News?

//--------------------------------

if($sort_by == 'last post') {

$order = 'last_post';

}



if($sort_by == 'date') {

$order = 'start_date';

}

//Sort Error Handling

if($sort_by != 'date' AND $sort_by != 'last post') {

echo 'Error: IPB News has encountered an error while attempting to sort your news, please ensure that you have entered the correct options for how you would like your news sorted. ';

exit;

}



$ipb_grab_all_topics = mysql_query ("SELECT * FROM ".$INFO['sql_tbl_prefix']."topics WHERE forum_id=".$ipb_newspathid." ORDER by $order desc");



//-----------------------------------

// v0.9.3 Bug fix

//-----------------------------------

if ( $ipb_maxposts["topics"] < $ipb_news) {

$ipb_news = $ipb_maxposts["topics"];

} else {

;

}

//Display Forum Status (Only When Offline)

if($Offline_stat == '1') {

echo '<center><span class="offline"><font color="white">Forum Status:&nbsp;</font><strong><font color="red">Offline</font></strong><br /><font color="white">'.$offline_msg.'</font></span></center>';

}

//-----------------------------------

//How Many do We Need?

//-----------------------------------

for($ipb_mini_math=0; $ipb_mini_math <$ipb_news; $ipb_mini_math++)

{



//-----------------------------------

//Yay for Variables!

//-----------------------------------

$ipb_gvup = ('IPB News: ');

$ipb_topicarray = mysql_fetch_array($ipb_grab_all_topics);

$ipb_mysql_vars = ('/a></center></strong></small> ');

$ipb_udate = $ipb_topicarray["start_date"];

$ipb_date = date("D, d M Y",$ipb_udate);

$ipb_alt_date = date("l, d F Y",$ipb_udate);

$ipb_titleid = $ipb_topicarray["tid"];

$ipb_cprt = ('<small><center><strong>');

$illegal_action = ('Copyright for IPB News has been tampered with. Reinstall mod or contact timur.karasapan@gmail.com for legal method to remove copyright.');

$ipb_topictitle = ($ipb_topicarray["title"]);

$ipb_specific_posts = mysql_query ("SELECT * FROM ".$INFO['sql_tbl_prefix']."posts WHERE topic_id = ".$ipb_titleid." ORDER by post_date");

$ipb_getposts = mysql_fetch_array($ipb_specific_posts);

$ipb_post = $ipb_getposts["post"];

if($ipb_gethtml == NULL) { exit;}

$ipb_pids = NULL;

$ipb_thread_author_id = $ipb_getposts["author_id"];

$ipb_member = $ipb_topicarray["starter_name"];



//--------------------------------------

//Alternate Display 1.0.0 Vars

//--------------------------------------

$ipb_commentcount = mysql_query ("SELECT * FROM ".$INFO['sql_tbl_prefix']."topics WHERE tid = ".$ipb_titleid." ORDER BY post_date");

$ipb_postcount = $ipb_topicarray["posts"];

$ipb_viewcount = $ipb_topicarray["views"];





//-----------------------------------

// PM; Yes, No, Maybe So?

//-----------------------------------

if ( $ipb_pmON == '1') {

$ipb_show_pm = '<strong>&nbsp;<a href="'.$ipb_forumpath.'/index.php?act=Msg&CODE=04&MID='.$ipb_thread_author_id.'">(PM)</strong></a>';

} else {

;

}

//--------------------------------------------------------------------------

//Variable Confirmation!

//Do Not Edit or Delete or Mod Will Not Work! :O

//--------------------------------------------------------------------------

if ( $ipb_cprt == '<small><center><strong>' ) {

;

} else {

echo (''.$illegal_action.'');

}





if ( $ipb_gethtml == 'By Timur Karasapan' ) {

;

} else {

echo (''.$illegal_action.'');

}

if ( $ipb_mysql_vars == '/a></center></strong></small> ' ) {

;

} else {

echo (''.$illegal_action.'');

}

if ( $ipb_date = date("D, d M Y",$ipb_udate) ) {

;

} else {

echo (''.$illegal_action.'');

}





//----------------

//Emoticon Support

//----------------



//v1.6.9 SubDomain Bug Fix

if($subdomain == '1') {

$ipb_post = str_replace('style_emoticons/<#EMO_DIR#>', ''.$INFO['board_url'].'/style_emoticons/'.$emoticons.'', $ipb_post);

}



if($subdomain == '0') {

$ipb_post = str_replace('<#EMO_DIR#>', $emoticons, $ipb_post);

}





/*----------------------------------------------------*\

| Character Limit [IPB News PLUS!] PREVIEW

\*----------------------------------------------------*/

//FULL Features can be found on IPB News PLUS!

$charlimit = 5 + 3 + 12 + 40;

if($char_num > $charlimit) {

$char_num = $charlimit;

}

if($char_limit == 'y' ) {

$ipb_post = substr("$ipb_post", 0, $char_num);

$ipb_post = strip_tags($ipb_post);

}

//





//--------------------------------------------------------

//Template Library v3.0.0

//--------------------------------------------------------



//--------------------------------------//

// Alternate Interface v2.0.1 //

//--------------------------------------//

if ( $display == 'AI') {

echo ('<center>
<span class="title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong> <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'">'.$ipb_topictitle.'</strong></a></span><span class="alt-bar">Posted On <strong>'.$ipb_alt_date.'</strong> by <a href="'.$ipb_forumpath.'/index.php?showuser='.$ipb_thread_author_id.'"><strong>'.$ipb_member.'</strong></a>'.$ipb_show_pm.'</span><span class="post">'.$ipb_post.'<br />
<br />'.$ipb_vu.'</span><span class="footer"><strong>Total Comments: '.$ipb_postcount.'&nbsp;&nbsp;&nbsp;&nbsp;

<a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'&view=getlastpost">Add Comment</strong></a> | <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'"><strong>Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total Views: '.$ipb_viewcount.'</strong></small></span></center><br/>

');

}

//--------------------------------------//

// Default Interface v2.0.0 //

//--------------------------------------//

if ($display == 'default') {

echo('<center><span class="title"><strong><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'">'.$ipb_topictitle.'</strong></a></span><span class="post">'.$ipb_post.'<br /><br />'.$ipb_vu.'</span><span class=footer><strong><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'&view=getlastpost">Comments('.$ipb_postcount.')</strong></a> - Posted on <strong>'.$ipb_date.'</strong> by <a href="'.$ipb_forumpath.'/index.php?showuser='.$ipb_thread_author_id.'"><strong>'.$ipb_member.'</strong></a> '.$ipb_show_pm.' - <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'"><strong>Read More</strong></a></span></center><br/>

');;

}

//--------------------------------------//

// Anti-CSS Interface v2.7.9 //

//--------------------------------------//

if ( $display == 'classical') {

echo('<table width="100%"><b><U><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'">'.$ipb_topictitle.'</b></u></a><br><br /></td></div><div align="left">'.$ipb_post.'</div><br><center><b><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'&view=getlastpost">Comments('.$ipb_postcount.')</b></a> - Posted on <B>'.$ipb_date.'</B> by <a href="'.$ipb_forumpath.'/index.php?showuser='.$ipb_thread_author_id.'"><B>'.$ipb_member.'</B></a> '.$ipb_show_pm.' - <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'"><b>Read More</B></center><hr></table></a>

');;

}



}

echo $css;



if (($display == 'AI') OR ($display == 'default'))

{

echo ('<center><span class="credit"><strong>'.$ipb_cprt.'<'.$ipb_pids.''.$ipb_gvup.''.$ipb_gethtml.'<'.$ipb_mysql_vars.'</strong><small><font color="#555555">Ghost WoW News</font></small></span></center>');

}

if($illegal_action == NULL) { exit;}

if ($display == 'classical')

{

echo ('<center><strong>'.$ipb_cprt.'<'.$ipb_pids.''.$ipb_gvup.''.$ipb_gethtml.'<'.$ipb_mysql_vars.'</strong><small>You are running<strong> '.$cv.' </strong>of IPB News</center></small>');

}






?>

I have not made it but i hope you undestand what im looking for. Ill keep on expermenting untill i get a reply :D

edbr
03-28-2008, 02:06 AM
difficult when someone elses work eh? I dont feel really qualified to answer this but as i see it...
first you have to make the box in the styles, a div or layer to contain your results . so
<div id ="your new box">

if ($display == 'default') {

echo('<center><span class="title"><strong><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'">'.$ipb_topictitle.'</strong></a></span><span class="post">'.$ipb_post.'<br /><br />'.$ipb_vu.'</span><span class=footer><strong><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'&view=getlastpost">Comments('.$ipb_postcount.')</strong></a> - Posted on <strong>'.$ipb_date.'</strong> by <a href="'.$ipb_forumpath.'/index.php?showuser='.$ipb_thread_author_id.'"><strong>'.$ipb_member.'</strong></a> '.$ipb_show_pm.' - <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'"><strong>Read More</strong></a></span></center><br/>

');;

}

//--------------------------------------//

// Anti-CSS Interface v2.7.9 //

//--------------------------------------//

if ( $display == 'classical') {

echo('<table width="100%"><b><U><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'">'.$ipb_topictitle.'</b></u></a><br><br /></td></div><div align="left">'.$ipb_post.'</div><br><center><b><a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'&view=getlastpost">Comments('.$ipb_postcount.')</b></a> - Posted on <B>'.$ipb_date.'</B> by <a href="'.$ipb_forumpath.'/index.php?showuser='.$ipb_thread_author_id.'"><B>'.$ipb_member.'</B></a> '.$ipb_show_pm.' - <a href="'.$ipb_forumpath.'/index.php?showtopic='.$ipb_titleid.'"><b>Read More</B></center><hr></table></a>

');;

}



}

echo $css;



if (($display == 'AI') OR ($display == 'default'))

{

echo ('<center><span class="credit"><strong>'.$ipb_cprt.'<'.$ipb_pids.''.$ipb_gvup.''.$ipb_gethtml.'<'.$ipb_mysql_vars.'</strong><small><font color="#555555">Ghost WoW News</font></small></span></center>');

}

if($illegal_action == NULL) { exit;}

if ($display == 'classical')

{

echo ('<center><strong>'.$ipb_cprt.'<'.$ipb_pids.''.$ipb_gvup.''.$ipb_gethtml.'<'.$ipb_mysql_vars.'</strong><small>You are running<strong> '.$cv.' </strong>of IPB News</center></small>');

}



</div>

smitho
03-28-2008, 02:44 AM
Also not sure but after making your div I would repeat the background image in your css style. Could be wrong.

Fronix
03-28-2008, 04:01 AM
Ok thx i will try it

edbr
03-28-2008, 04:03 AM
you are right smitho, to be honest i didnt understand what was meant by images around it. but a repeated background will work .

davidj
03-28-2008, 02:33 PM
i would always point users of these scripts back to the author as they should have their own support policies

there is a possibility that you could break it and that opens up a can of worms