TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 01, 2024, 04:15:59 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 160
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 134
  • Total: 134

TP and phpraider block

Started by RebelRose, June 05, 2007, 01:57:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rebelrose

Quote from: StormLrdâ„¢ on June 05, 2007, 02:31:04 AM
its cool, if you give me the database parameters will fix ya up.

ok I am php and msql challanged, what do you mean by parameters?

stormlrd

i need to know how you set the table up for this in the database, what its name is, what variables you added to it inorder to setup the call to retreive this data for your function to work.

rebelrose

You mean the database name?

stormlrd

yes and the variables in it.

rebelrose

Database name is  ngwforums         


          phpraider_announcements
           phpraider_attribute 
           phpraider_attribute_data
           phpraider_character
           phpraider_class
           phpraider_definitions
           phpraider_gender
           phpraider_groups
           phpraider_guild
           phpraider_permissions
           phpraider_profile
           phpraider_race
           phpraider_raid
           phpraider_raid_limits
           phpraider_raid_templates
           phpraider_role
           phpraider_signups
           phpraider_subclass

stormlrd

<?php
$rootlink 
"http://www.nethergard.com/phpraider/index.php?option=com_view&id";

function 
newDate$format$timestamp$tz ) {
$offset = (60 60) * ($tz 100); // Seconds from GMT
    
$timestamp $timestamp $offset;
    return 
gmdate$format$timestamp );
}

if (!
defined("IN_MKP")) {
    die (
"Sorry !! You cannot access this file directly.");
}
$content "";
$pConfig_timezone = -500;
$offset = (60 60) * ($pConfig_timezone/100);
$time_buffer = (60 60) * 2;  
$rightnow time() + $offset;
$future $rightnow $time_buffer;

global 
$db_prefix$scripturl$txt,$settings,$modSettings$sourcedir;


$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC "__FILE____LINE__);

$sep ",";
$totalraids $DB->get_num_rows();


while ($raids $DB->fetch_row()) {
$year newDate"Y"$raids['start_time'], $pConfig_timezone);
$month newDate"m"$raids['start_time'], $pConfig_timezone );
$day newDate"d"$raids['start_time'], $pConfig_timezone );
$today_month newDate"m"time(), $pConfig_timezone );
$today_day newDate"d"time(), $pConfig_timezone );
$today "";
$timedone $raids['start_time'] + $time_buffer;
$hour gmdate"H"$raids['start_time'] );
$suffix="";
if($hour 12){
$hour $hour 12;
$suffix "pm";
}else {
$suffix "am";
}
$mins gmdate"i"$raids['start_time'] );
$hour2 gmdate"H:i"$rightnow );
$hour3 gmdate"H:i"$timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day && 
    $raids['start_time'] < $rightnow && $rightnow $timedone) {
$today "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

   
$activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu "No upcoming raids.   ";
}
$activeu substr($activeu0, (strlen($activeu) -2));
$content "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">
$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"
$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://www.nethergard.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>            
        "
;


unset($totalraids);
unset($rootlink);
unset($rightnow);

?>


that should work other than the images, you'll need to set the path for any of those.

rebelrose

Thank You StormLrd, your a prince  ;)

stormlrd

welcome, and im not positive but i believe it iwll work.

rebelrose

Thanks will let you know if not  :)

djuplift

So here is the original code and here is the modified working code, but its working with most of the original functionality missing not sure what AJ has done.

Original code
<?php

$rootlink 
"http://www.wowsovguard.com/phpraider/index.php?option=com_view&id";

function 
newDate$format$timestamp$tz ) {
$offset = (60 60) * ($tz 100); // Seconds from GMT
    
$timestamp $timestamp $offset;
    return 
gmdate$format$timestamp );
}

if (!
defined("IN_MKP")) {
    die (
"Sorry !! You cannot access this file directly.");
}
$content "";
$pConfig_timezone = -500;
$offset = (60 60) * ($pConfig_timezone/100);
$time_buffer = (60 60) * 2;  
$rightnow time() + $offset;
$future $rightnow $time_buffer;


//$DB->query("DELETE FROM mkp_chat WHERE run_time < ".$dead_users." ");
$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ");

$sep ",";
$totalraids $DB->get_num_rows();


while ($raids $DB->fetch_row()) {
$year newDate"Y"$raids['start_time'], $pConfig_timezone);
$month newDate"m"$raids['start_time'], $pConfig_timezone );
$day newDate"d"$raids['start_time'], $pConfig_timezone );
$today_month newDate"m"time(), $pConfig_timezone );
$today_day newDate"d"time(), $pConfig_timezone );
$today "";
$timedone $raids['start_time'] + $time_buffer;
$hour gmdate"H"$raids['start_time'] );
$suffix="";
if($hour 12){
$hour $hour 12;
$suffix "pm";
}else {
$suffix "am";
}
$mins gmdate"i"$raids['start_time'] );
$hour2 gmdate"H:i"$rightnow );
$hour3 gmdate"H:i"$timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day && 
    $raids['start_time'] < $rightnow && $rightnow $timedone) {
$today "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

   
$activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu "No upcoming raids.   ";
}
$activeu substr($activeu0, (strlen($activeu) -2));
$content "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">
$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"
$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://www.wowsovguard.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>            
        "
;


unset($totalraids);
unset($rootlink);
unset($rightnow);

?>



Edited not functioning properly code:
// number of news items you want displaying
$feed_limit = 5;
$offset = 50; // find first space after this many chars and return result.

$stylesheet = '../raidfeed.css'; // stylesheet to use

$feed = 'http://www.nethergard.com/phpraider/index.php?option=com_rss&task=raid';   

ini_set('allow_url_fopen', true);
$fp = fopen($feed, 'r');
$xml = '';

while (!feof($fp))
{
   $xml .= fread($fp, 128);
}

fclose($fp);

function untag($string, $tag)
{
   $tmpval = array();
   $preg = "|<$tag>(.*?)</$tag>|is";

   preg_match_all($preg, $string, $tags);

   foreach ($tags[1] as $tmpcont)
   {
      $tmpval[] = $tmpcont;
   }

   return $tmpval;
}

$items = untag($xml, 'item');
$output = '<html>';
$output .= '<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
$output .= '<title></title>';
$output .= '<link href="' . $stylesheet . '" rel="stylesheet" type="text/css">';
$output .= '</head><body>';

$output .= '<font face="verdana" size="1">';
$html = '';

$id=0;

foreach ($items as $item)
{
   $title = untag($item, 'title');

   $link = untag($item, 'link'); 

   $when = untag($item, 'when');

   $descr = untag($item, 'description');

   $html .= '<div class="genmed">';
   $html .= 'Ã,» ' . '<a href="' . $link[0] . '" target="_new">' . $title[0] . '</a>' . ' on ' . $when[0] . '</div>';

   $id++;
   
   if($id == $feed_limit)
   {
      break;
   }
}


$output .= $html;
$output .= '</font>';
$output .= '</body></html>';

echo $output;
?>


So whats missing is its querying for all raids not just upcoming raids, its posting expired raids not upcomign raids, the original text formatting is missing (large red text) the flashing today, in progress functionality is missing as well.  Please take a look at this thread  http://www.wowsovguard.com/smf/index.php?topic=818.0 2 pages.. I am the GM And Admin of the website this is being made for btw. I would really like to get this functioning just as they do (http://www.wowsovguard.com/index.php I want it exactly like that.

EDIT: here is our website so you can see how it currently working and how it looks. www.nethergard.com