Welcome, Guest. Please Login or Register.
April 21, 2025, 11:40:13 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  <yabb copyright> « previous next »
Pages: [1] Reply Ignore Print
Author Topic: <yabb copyright>  (Read 5023 times)
Andi252
Noobie
*
Posts: 22


WHOOT

<yabb copyright>
« on: August 07, 2002, 03:52:58 PM »
Reply with quote

function footer() {
   global $yyboardname,$yytitle,$yyuname,$yyim,$yytime,$yymenu,$yymain;
   global $yytemplate,$yycopyin,$yytemplatemain,$yycopyright,$settings,$yyVBStyleLogin,$yynews;
//   if ($settings[7]=='Administrator')
//      print totalTime("Seconds to process this directive: ");
   for($i = $yytemplatemain; $i < sizeof($yytemplate); $i++) {
      $curline = $yytemplate[$i];
      if( !$yycopyin && strstr($curline,"<yabb copyright>")) { $yycopyin = 1; }
      $tags = array();
      while (preg_match ("/<yabb\s+(\w+)>/",$curline,$tags))
      {
         $temp = "yy$tags[1]";
         if (function_exists($temp))
         {
            ob_start();
            $temp();
            $str = ob_get_contents();
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$str,$curline);
            ob_end_clean();
         }
         else
         {
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$$temp,$curline);
         }
      }

      print "$curline";
   }
   # Do not remove hard-coded text - it's in here so users cannot change the text easily (as if it were in .lng)
   if($yycopyin == 0) {
      print "<center><font size=5><B>Sorry, the copyright tag <yabb copyright> must be in the template.<BR>Please notify this forum's administrator that this site is using an ILLEGAL copy of YaBB!</B></font></center>";
   }
}


I want to create a new <yabb> tag called banner. I have done this by using a function yybanner {} which is working fine. The next step is to write in a copy like on the copyright above to say, if the banner isn't in place, then print a message.

How do I do this ?

Thanks
Logged
sylvester
YaBB God
*****
Posts: 525


Re:<yabb copyright>
« Reply #1 on: August 07, 2002, 09:53:58 PM »
Reply with quote

function footer() {
   global $yyboardname,$yytitle,$yyuname,$yyim,$yytime,$yymenu,$yymain;
   global $yytemplate,$yycopyin,$yytemplatemain,$yycopyright,$settings,$yyVBStyleLogin,$yynews;
   $yybannerin = 0;
//   if ($settings[7]=='Administrator')
//      print totalTime("Seconds to process this directive: ");
   for($i = $yytemplatemain; $i < sizeof($yytemplate); $i++) {
      $curline = $yytemplate[$i];
      if( !$yycopyin && strstr($curline,"<yabb copyright>")) { $yycopyin = 1; }
      if( !$yybannerin && strstr($curline,"<yabb banner>")) { $yybannerin = 1; }
      $tags = array();
      while (preg_match ("/<yabb\s+(\w+)>/",$curline,$tags))
      {
         $temp = "yy$tags[1]";
         if (function_exists($temp))
         {
            ob_start();
            $temp();
            $str = ob_get_contents();
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$str,$curline);
            ob_end_clean();
         }
         else
         {
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$$temp,$curline);
         }
      }

      print "$curline";
   }
   # Do not remove hard-coded text - it's in here so users cannot change the text easily (as if it were in .lng)
   if($yycopyin == 0) {
      print "<center><font size=5><B>Sorry, the copyright tag <yabb copyright> must be in the template.<BR>Please notify this forum's administrator that this site is using an ILLEGAL copy of YaBB!</B></font></center>";
   }
   if($yybannerin == 0) {
      print "<center><font size=5><B>Sorry, the banner tag <yabb banner> must be in the template.<BR>Please notify this forum's administrator that this site is using an illegal copy of YaBB!</B></font></center>";
   }
}
Logged

I'm back
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #2 on: August 07, 2002, 10:45:05 PM »
Reply with quote

yeah, i think i'v tried that once
not sure if the codes are exactly the same tho
let me try it again...
Logged
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #3 on: August 07, 2002, 11:43:21 PM »
Reply with quote

worked a treat, thank you very much.

One small problem tho, if you put <yabb banner> at the bottom of the page, all is well, if you put <yabb banner at the top, it think there is no banner in place and prints the error. How do I fox this?

Thank you
Logged
sylvester
YaBB God
*****
Posts: 525


Re:<yabb copyright>
« Reply #4 on: August 08, 2002, 12:55:27 AM »
Reply with quote

replace the functions template_header() and footer() with the following code:
function footer() {
  global $yyboardname,$yytitle,$yyuname,$yyim,$yytime,$yymenu,$yymain;
  global $yytemplate,$yycopyin,$yytemplatemain,$yycopyright,$settings,$yyVBStyleLogin,$yynews,$yybannerin;
//   if ($settings[7]=='Administrator')
//      print totalTime("Seconds to process this directive: ");
  for($i = $yytemplatemain; $i < sizeof($yytemplate); $i++) {
     $curline = $yytemplate[$i];
     if( !$yycopyin && strstr($curline,"<yabb copyright>")) { $yycopyin = 1; }
     if( !$yybannerin && strstr($curline,"<yabb banner>")) { $yybannerin = 1; }
     $tags = array();
     while (preg_match ("/<yabb\s+(\w+)>/",$curline,$tags))
     {
        $temp = "yy$tags[1]";
        if (function_exists($temp))
        {
           ob_start();
           $temp();
           $str = ob_get_contents();
           $curline = preg_replace("/<yabb\s+$tags[1]>/",$str,$curline);
           ob_end_clean();
        }
        else
        {
           $curline = preg_replace("/<yabb\s+$tags[1]>/",$$temp,$curline);
        }
     }

     print "$curline";
  }
  # Do not remove hard-coded text - it's in here so users cannot change the text easily (as if it were in .lng)
  if($yycopyin == 0) {
     print "<center><font size=5><B>Sorry, the copyright tag <yabb copyright> must be in the template.<BR>Please notify this forum's administrator that this site is using an ILLEGAL copy of YaBB!</B></font></center>";
  }
  if($yybannerin == 0) {
     print "<center><font size=5><B>Sorry, the banner tag <yabb banner> must be in the template.<BR>Please notify this forum's administrator that this site is using an illegal copy of YaBB!</B></font></center>";
  }
}

function template_header() {
    global $yytemplate,$yyboardname,$yytitle,$yyuname,$yyim,$yytime,$yymenu,$yymain,$yycopyright;
   global $yynews,$menusep,$enable_notification,$enable_news,$username,$db_prefix,$locale,$boarddir;
   global $maintenance,$txt,$mbname,$date,$settings,$cgi,$img,$scripturl,$helpfile,$realname,$yyheaderdone;
   global $yycopyin,$yytemplatemain,$yytitle,$yyVBStyleLogin,$timeformatstring,$timeoffset,$modSettings, $imagesdir;

   // print stuff to prevent cacheing of pages
   header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
   header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
   if ($modSettings['disableCaching']==1)
   {
      header ("Cache-Control: no-cache, must-revalidate");
      header ("Pragma: no-cache");
   }

   $yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=_blank>$img[help]</a>$menusep<a href=\"$cgi;action=search\">$img[search]</a>";
   if($settings[7] == 'Administrator') { $yymenu = $yymenu.$menusep."<a href=\"$cgi;action=admin\">$img[admin]</a>"; }
   if($username == "Guest") { $yymenu .= $menusep."<a href=\"$cgi;action=login\">$img[login]</a>$menusep<a href=\"$cgi;action=register\">$img[register]</a>";
   } else {
      $euser = urlencode($username);
      $yymenu .= "$menusep<a href=\"$cgi;action=profile;user=$euser\">$img[profile]</a>";
      if($enable_notification) { $yymenu .= "$menusep<a href=\"$cgi;action=shownotify\">$img[notification]</a>"; }
      // Calendar.
if ($modSettings['cal_enabled'] == 1)
$yymenu .= "$menusep<a href=\"$scripturl?action=calendar\">$img[calendar]</a>";

      $yymenu .= "$menusep<a href=\"$cgi;action=logout\">$img[logout]</a>";
   }

   if($enable_news=='1') {
      $request = mysql_query("SELECT value FROM {$db_prefix}settings WHERE variable='news'");
      $temp = mysql_fetch_row($request);
      $news = $temp[0];
      $newsmessages = explode("\n",str_replace("\r","",trim($news)));
      // if we've disabled the fader....
      srand(time());
      // then some crappity smack-nut decided we should display a random news item
      $newstring = '';
      if (sizeof($newsmessages) == 1)
         $newstring = $newsmessages[0];
      elseif (sizeof($newsmessages) > 1)
         $newstring = $newsmessages[floor(rand(0,(sizeof($newsmessages)-1)))];
      $yynews = "<b>$txt[102]:</b> ".DoUBBC($newstring);
   }
   if($username != "Guest") {
      $request = mysql_query("SELECT COUNT(*) FROM {$db_prefix}instant_messages WHERE (toName='$username' && deletedBy!=1)");
      $temp = mysql_fetch_row($request);
      $mnum = $temp[0];
      $requestred = mysql_query("SELECT COUNT(*) FROM {$db_prefix}instant_messages WHERE (toName='$username' && readBy!=1 && deletedBy!=1)");
      $temp2 = mysql_fetch_row($requestred);
      $munred = $temp2[0];
      if ($munred == "1") { $isare = $txt[newmessages0]; }
      else { $isare = $txt[newmessages1]; }
      if($mnum == "1") { $yyim = "$txt[152] <a href=\"$cgi;action=im\">$mnum $txt[471]</a>$txt[newmessages4] $munred $isare $txt[newmessages2]."; }
      else { $yyim = "$txt[152] <a href=\"$cgi;action=im\">$mnum $txt[153]</a>$txt[newmessages4] $munred $isare $txt[newmessages2]."; }
      if($maintenance) { $yyim .= "<BR><B>$txt[616]</B>"; }
   }

   ob_start();
   $templateFile = $boarddir."/template.php";
   if (!file_exists($templateFile))
      $templateFile = $boarddir."/template.html";
   include ($templateFile);
   $yytemplate = explode("\n",ob_get_contents());
   ob_end_clean();
   
   if (!sizeof($yytemplate)){ die ("$txt[23]: $templateFile"); }

   $yyboardname = $mbname;
   $time = isset($settings[18])?$settings[18]:0;

   $yytime = lang_strftime(time()+(($timeoffset+$time)*3600));
   // display their username if they haven't set their real name yet.
   $tmp = ($realname=='')?$username:$realname;
   $yyuname = ($username == 'Guest') ? "$txt[248] <b>$txt[28]</b>. $txt[249] <a href=\"$cgi;action=login\">$txt[34]</a> $txt[377] <a href=\"$cgi;action=register\">$txt[97]</a>." : "$txt[247] <b>$tmp</b>, ";
   $yycopyin = 0;
   $yybannerin = 0;

   $yyVBStyleLogin = '<br>';
   if ($modSettings['enableVBStyleLogin']=='1' && $username=='Guest')
   {
      $yyVBStyleLogin =<<<EOT
<form action="$cgi;action=login2" method="post"><br><input type=text name="user" size="7"> <input type=password name="passwrd" size="7"> <select name="cookielength"><option value="60">$txt[yse53]</option><option value="1440">$txt[yse47]</option><option value="10080">$txt[yse48]</option><option value="302400">$txt[yse49]</option><option value="$txt[yse50]" selected>$txt[yse50]</option></select> <input type="submit" value="$txt[34]"><br>$txt[yse52]</form>
EOT;
   }

   for( $yytemplatemain = 0; $yytemplatemain < sizeof($yytemplate); $yytemplatemain++ ) {
      $curline = $yytemplate[$yytemplatemain];
      if(strstr($curline,"<yabb main>")) { $yytemplatemain++; break; }
      if( !$yycopyin && strstr($curline,"<yabb copyright>")) { $yycopyin = 1; }
      if( !$yybannerin && strstr($curline,"<yabb banner>")) { $yybannerin = 1; }
      $tags = array();
      while (preg_match ("/<yabb\s+(\w+)>/",$curline,$tags))
      {
         $temp = "yy$tags[1]";
         if (function_exists($temp))
         {
            ob_start();
            $temp();
            $str = ob_get_contents();
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$str,$curline);
            ob_end_clean();
         }
         else
         {
            $curline = preg_replace("/<yabb\s+$tags[1]>/",$$temp,$curline);
         }
      }

      print "$curline";
   }
   $yyheaderdone = 1;
}
Logged

I'm back
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #5 on: August 08, 2002, 07:48:27 PM »
Reply with quote

FFS, Thanks  >:(

That just balls up all the subs.php and it doesn't work.
Logged
sylvester
YaBB God
*****
Posts: 525


Re:<yabb copyright>
« Reply #6 on: August 08, 2002, 09:48:15 PM »
Reply with quote

Quote from: Andi252 on August 08, 2002, 07:48:27 PMFFS, Thanks  >:(

That just balls up all the subs.php and it doesn't work.
Are you angry? You have to replace the functions template_header() and footer().!!!
Logged

I'm back
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #7 on: August 08, 2002, 11:39:14 PM »
Reply with quote

What exactly do you think I have done ???
Logged
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #8 on: August 09, 2002, 12:18:41 AM »
Reply with quote

What do I do to fix it ???

I have restored subs.php and replaced the newer code, as above, and still nothing is working...  :'(
Logged
sylvester
YaBB God
*****
Posts: 525


Re:<yabb copyright>
« Reply #9 on: August 09, 2002, 11:51:51 AM »
Reply with quote

Quote from: Andi252 on August 09, 2002, 12:18:41 AMWhat do I do to fix it ???

I have restored subs.php and replaced the newer code, as above, and still nothing is working...  :'(
I don't know what you did.

I think you've replaced something else! :P
Logged

I'm back
Andi252
Noobie
*
Posts: 22


WHOOT

Re:<yabb copyright>
« Reply #10 on: August 09, 2002, 06:58:23 PM »
Reply with quote

I did exactly what you said. I have managed to restore the backups and have it working in the foorer again. I think I'll leave it like this unless you know a code that will work ???
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  <yabb copyright> « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.037 seconds with 20 queries.