boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

b2quotes: Random quote management and display

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Mystis



Joined: 02 Mar 2003
Posts: 74

PostPosted: Mon Jun 09, 2003 7:22 pm    Post subject: b2quotes: Random quote management and display Reply with quote

Random quote management, very self explanitory. Control panel based management, with the usual features. Nothing special, but it works.

Download here
_________________
- Mystis
[url=tidakada.com/board/viewtopic.php?t=3375]b2customfields v2[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2sql[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2quotes[/url]
Back to top
View user's profile Send private message
zaecas



Joined: 10 Jun 2003
Posts: 4

PostPosted: Tue Jun 10, 2003 3:11 am    Post subject: Reply with quote

Tried to install, but got the following error:

Code:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1190

Parse error: parse error, expecting `','' or `';'' in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1190



So... what now? Question What did I do wrong? I hate beeing a newbie...
Back to top
View user's profile Send private message
Mystis



Joined: 02 Mar 2003
Posts: 74

PostPosted: Tue Jun 10, 2003 3:37 am    Post subject: Reply with quote

Would you mind pasting about 10 lines before and after the function you added, as well as the function itself? I believe that the problem lies in where you placed it in the file.
_________________
- Mystis
[url=tidakada.com/board/viewtopic.php?t=3375]b2customfields v2[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2sql[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2quotes[/url]
Back to top
View user's profile Send private message
zaecas



Joined: 10 Jun 2003
Posts: 4

PostPosted: Tue Jun 10, 2003 7:54 pm    Post subject: Reply with quote

hey, thanks for your attention!

here's the code


Code:
function add_filter($tag, $function_to_add) {
   global $b2_filter;
   if (isset($b2_filter[$tag])) {
      $functions = $b2_filter[$tag];
      if (is_array($functions)) {
         foreach($functions as $function) {
            $new_functions[] = $function;
         }
      } elseif (is_string($functions)) {
         $new_functions[] = $functions;
      }
      


function randquote(){
   $sql = "SELECT * FROM b2quotes ORDER BY RAND() LIMIT 1";
   $query = mysql_query($sql);
   $quote = mysql_result($query,0);
   echo "\"".$quote['quote_content'].""\"<br />";
   if(!empty($quote['quote_link'])){
      echo "<a href=\"".$quote['quote_link']."\" target=\"_blank\">";
      $end = "<a>"
   }else{
      $end = "";
   }
   echo " - ".$quote['quote_author'].$end;
}
      
/* this is commented out because it just makes PHP die silently
   for no apparent reason
      if (is_array($function_to_add)) {
         foreach($function_to_add as $function) {
            if (!in_array($function, $b2_filter[$tag])) {
               $new_functions[] = $function;
            }
         }
      } else */if (is_string($function_to_add)) {
         if (!@in_array($function_to_add, $b2_filter[$tag])) {
            $new_functions[] = $function_to_add;
         }
      }
      $b2_filter[$tag] = $new_functions;
   } else {
      $b2_filter[$tag] = array($function_to_add);
   }
   return true;
}


?>



have I done something wrong?


edit:

Just realized i've pasted the function inside another function...

Oh my, how silly...
Back to top
View user's profile Send private message
zaecas



Joined: 10 Jun 2003
Posts: 4

PostPosted: Tue Jun 10, 2003 8:21 pm    Post subject: Reply with quote

This can't be good...

I've changed, corrected the code... result: new error.

Here it is:

Code:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1176

Parse error: parse error, expecting `','' or `';'' in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1176




and the code:

Code:
function is_new_day() {
   global $day, $previousday;
   if ($day != $previousday) {
      return(1);
   } else {
      return(0);
   }
}

function apply_filters($tag, $string) {
   global $b2_filter;
   if (isset($b2_filter['all'])) {
      $b2_filter['all'] = (is_string($b2_filter['all'])) ? array($b2_filter['all']) : $b2_filter['all'];
      $b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
      $b2_filter[$tag] = array_unique($b2_filter[$tag]);
   }
   if (isset($b2_filter[$tag])) {
      $b2_filter[$tags] = (is_string($b2_filter[$tag])) ? array($b2_filter[$tag]) : $b2_filter[$tag];
      $functions = $b2_filter[$tag];
      foreach($functions as $function) {
         $string = $function($string);
      }
   }
   return $string;
}

function randquote(){
   $sql = "SELECT * FROM b2quotes ORDER BY RAND() LIMIT 1";
   $query = mysql_query($sql);
   $quote = mysql_result($query,0);
   echo "\"".$quote['quote_content'].""\"<br />";
   if(!empty($quote['quote_link'])){
      echo "<a href=\"".$quote['quote_link']."\" target=\"_blank\">";
      $end = "<a>"
   }else{
      $end = "";
   }
   echo " - ".$quote['quote_author'].$end;
}

function add_filter($tag, $function_to_add) {
   global $b2_filter;
   if (isset($b2_filter[$tag])) {
      $functions = $b2_filter[$tag];
      if (is_array($functions)) {
         foreach($functions as $function) {
            $new_functions[] = $function;
         }
      } elseif (is_string($functions)) {
         $new_functions[] = $functions;
      }
      
/* this is commented out because it just makes PHP die silently
   for no apparent reason
      if (is_array($function_to_add)) {
         foreach($function_to_add as $function) {
            if (!in_array($function, $b2_filter[$tag])) {
               $new_functions[] = $function;
            }
         }
      } else */if (is_string($function_to_add)) {
         if (!@in_array($function_to_add, $b2_filter[$tag])) {
            $new_functions[] = $function_to_add;
         }
      }
      $b2_filter[$tag] = $new_functions;
   } else {
      $b2_filter[$tag] = array($function_to_add);
   }
   return true;
}


?>



I'm feeling quite ashamed...
Back to top
View user's profile Send private message
Mystis



Joined: 02 Mar 2003
Posts: 74

PostPosted: Wed Jun 11, 2003 4:49 am    Post subject: Reply with quote

Try undoing whatever you did in the second post, and replace everything from the first post with the following:

Code:
function add_filter($tag, $function_to_add) {
   global $b2_filter;
   if (isset($b2_filter[$tag])) {
      $functions = $b2_filter[$tag];
      if (is_array($functions)) {
         foreach($functions as $function) {
            $new_functions[] = $function;
         }
      } elseif (is_string($functions)) {
         $new_functions[] = $functions;
      }
/* this is commented out because it just makes PHP die silently
   for no apparent reason
      if (is_array($function_to_add)) {
         foreach($function_to_add as $function) {
            if (!in_array($function, $b2_filter[$tag])) {
               $new_functions[] = $function;
            }
         }
      } else */if (is_string($function_to_add)) {
         if (!@in_array($function_to_add, $b2_filter[$tag])) {
            $new_functions[] = $function_to_add;
         }
      }
      $b2_filter[$tag] = $new_functions;
   } else {
      $b2_filter[$tag] = array($function_to_add);
   }
   return true;
}

function randquote(){
   $sql = "SELECT * FROM b2quotes ORDER BY RAND() LIMIT 1";
   $query = mysql_query($sql);
   $quote = mysql_result($query,0);
   echo "\"".$quote['quote_content'].""\"<br />";
   if(!empty($quote['quote_link'])){
      echo "<a href=\"".$quote['quote_link']."\" target=\"_blank\">";
      $end = "<a>"
   }else{
      $end = "";
   }
   echo " - ".$quote['quote_author'].$end;
}

?>

_________________
- Mystis
[url=tidakada.com/board/viewtopic.php?t=3375]b2customfields v2[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2sql[/url] | [url=tidakada.com/board/viewtopic.php?t=3375]b2quotes[/url]
Back to top
View user's profile Send private message
zaecas



Joined: 10 Jun 2003
Posts: 4

PostPosted: Wed Jun 11, 2003 6:28 am    Post subject: Reply with quote

yeah... still no good. Thaks for your patience.

I've tried here at my local comp (winxp pro, running apache 1.3 and php 4.3.2) and got the same error as the coolfreehost...

which is again:


Code:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1206

Parse error: parse error, expecting `','' or `';'' in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1206


and now... a bonus: when logging in to the b2 i get this:
both at home and at the coolfreeshiznit

Code:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1206

Parse error: parse error, expecting `','' or `';'' in /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php on line 1206

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 133

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 137

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 140

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 142

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 143

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 144

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 145

Warning: Cannot add header information - headers already sent by (output started at /users/curvedspaces.com/zaecas/b2/b2-include/b2template.functions.php:1206) in /users/curvedspaces.com/zaecas/b2/b2login.php on line 165



but I've uploaded the rar-ed modded files to the server in case you want to take a look at them... click here

and... don't forget to rename the file to .rar .... phpbb can do some weird stuff...


Thanks, dude.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group