Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
mordain
Regular
Regular



Joined: Jul 08, 2006
Posts: 77

PostPosted: Thu Jul 27, 2006 5:49 pm Reply with quote

I run a WoW guild website and I'm looking for a module (or something I can put on the modules menu block) or something similar that would look like one big admin message that would replace the genter blocks and leave the blocks on the right if possible. I hope this isnt too confusing. Thanks!
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Thu Jul 27, 2006 6:08 pm Reply with quote

If you want it to appear on the modules menu, you must make a custom module (not that difficult - look for guides on how to do this). Another option is to use the content module or some other existing module that would allow you to display the text on the first page. But this approach might cause other issues - like trying to make a link.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
mordain







PostPosted: Thu Jul 27, 2006 6:12 pm Reply with quote

Ok, cool, is there a good tutorial or program (free please Very Happy) for making modules that I could find somewhere?
 
kguske







PostPosted: Thu Jul 27, 2006 6:16 pm Reply with quote

Yes, there is even a tool that helps, but I'm not sure it will work with the latest patches.

You can start with the PHPNuke How To available here.
 
mordain







PostPosted: Thu Jul 27, 2006 10:13 pm Reply with quote

Ok well the content module looks like it will work just fine for what I'm trying to do. One thing though is, id there a way to make the blocks on the right show up when someone accesses the module?
 
kguske







PostPosted: Thu Jul 27, 2006 10:22 pm Reply with quote

You can find that in the How To manual, too. Hint: $index = 1;
 
mordain







PostPosted: Fri Jul 28, 2006 12:26 am Reply with quote

Ok, I'm starting to get this stuff lol. I need to put in $index = 0

The problem is that I'm clueless when it comes to coding. It looks like it would be near the beginning of the file. Here is the index.php file for the content module:

Code:
<?php




/************************************************************************/

/* PHP-NUKE: Web Portal System                                          */

/* ===========================                                          */

/*                                                                      */

/* Copyright (c) 2005 by Francisco Burzi                                */

/* http://phpnuke.org                                                   */

/*                                                                      */

/* 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.       */

/************************************************************************/



if (!defined('MODULE_FILE')) {

    die ("You can't access this file directly...");

}



require_once("mainfile.php");

$module_name = basename(dirname(__FILE__));

get_lang($module_name);



$pagetitle = "- $module_name";



function showpage($pid, $page=0) {

    global $prefix, $db, $sitename, $admin, $module_name;

    include("header.php");

    OpenTable();

    $pid = intval($pid);

    $mypage = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE pid='$pid'"));

    $myactive = intval($mypage['active']);

    $mytitle = stripslashes(check_html($mypage['title'], "nohtml"));

    $mysubtitle = stripslashes(check_html($mypage['subtitle'], "nohtml"));

    $mypage_header = stripslashes($mypage['page_header']);

    $mytext = stripslashes($mypage['text']);

    $mypage_footer = stripslashes($mypage['page_footer']);

    $mysignature = stripslashes($mypage['signature']);

    $mydate = $mypage['date'];

    $mycounter = intval($mypage['counter']);

    if (($myactive == 0) AND (!is_admin($admin))) {

   echo "Sorry... This page doesn't exist.";

    } else {

   $db->sql_query("UPDATE ".$prefix."_pages SET counter=counter+1 WHERE pid='$pid'");

   $date = explode(" ", $mydate);

   echo "<font class=\"title\">$mytitle</font><br>"

      ."<font class=\"content\">$mysubtitle<br><br><br><br>";

   $contentpages = explode( "<!--pagebreak-->", $mytext );

   $pageno = count($contentpages);

   if ( $page=="" || $page < 1 )

       $page = 1;

   if ( $page > $pageno )

       $page = $pageno;

   $arrayelement = (int)$page;

   $arrayelement --;

   if ($pageno > 1) {

       echo ""._PAGE.": $page/$pageno<br>";

   }

   if ($page == 1) {

       echo "<p align=\"justify\">".nl2br($mypage_header)."</p><br>";

   }

   echo "<p align=\"justify\">$contentpages[$arrayelement]</p>";

   if($page >= $pageno) {

       $next_page = "";

   } else {

       $next_pagenumber = $page + 1;

       if ($page != 1) {

      $next_page .= "- ";

       }

       $next_page .= "<a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$next_pagenumber\">"._NEXT." ($next_pagenumber/$pageno)</a> <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$next_pagenumber\"><img src=\"images/right.gif\" border=\"0\" alt=\""._NEXT."\" title=\""._NEXT."\"></a>";

   }

   if ($page == $pageno) {

       echo "<br><p align=\"justify\">".nl2br($mypage_footer)."</p><br><br>";

   }

   if($page <= 1) {

       $previous_page = "";

   } else {

       $previous_pagenumber = $page - 1;

       $previous_page = "<a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$previous_pagenumber\"><img src=\"images/left.gif\" border=\"0\" alt=\""._PREVIOUS."\" title=\""._PREVIOUS."\"></a> <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid&amp;page=$previous_pagenumber\">"._PREVIOUS." ($previous_pagenumber/$pageno)</a>";

   }

   echo "<br><br><br><center>$previous_page $next_page</center><br><br>";

   if ($page == $pageno) {

       echo "<p align=\"right\">".nl2br($mysignature)."</p>"

      ."<p align=\"right\">"._COPYRIGHT." $sitename "._COPYRIGHT2."</p>"

      ."<p align=\"right\"><font class=\"tiny\">"._PUBLISHEDON.": $date[0] ($mycounter "._READS.")</font></p>"

      ."<center>"._GOBACK."</center>";

   }

    }

    CloseTable();

    include("footer.php");

}



function list_pages() {

    global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;

    include("header.php");

    title("$sitename: "._PAGESLIST."");

    OpenTable();

    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>";

    $result = $db->sql_query("SELECT * FROM ".$prefix."_pages_categories");

    $numrows = $db->sql_numrows($result);

    $numrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid!='0' AND active='1'"));

    if ($numrows > 0 AND $numrows2 > 0) {

      echo "<center>"._CONTENTCATEGORIES."</center><br><br>"

            ."<table border=\"1\" align=\"center\" width=\"95%\">";

      while ($row = $db->sql_fetchrow($result)) {

          $cid = intval($row['cid']);

          $title = stripslashes(check_html($row['title'], "nohtml"));

          $description = stripslashes($row['description']);

          $numrows3 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid='$cid'"));

          if ($numrows3 > 0) {

            echo "<tr><td valign=\"top\">&nbsp;<a href=\"modules.php?name=$module_name&amp;pa=list_pages_categories&amp;cid=$cid\">$title</a>&nbsp;</td><td align=\"left\">$description</td></tr>";

          }

      }

      echo "</td></tr></table><br><br>"

          ."<center>"._NONCLASSCONT."</center><br><br>";

    }

    $result4 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='0' ORDER BY date");

    echo "<blockquote>";

    while ($row4 = $db->sql_fetchrow($result4)) {

      $pid = intval($row4['pid']);

      $title = stripslashes(check_html($row4['title'], "nohtml"));

      $subtitle = stripslashes(check_html($row4['subtitle'], "nohtml"));

      $clanguage = $row4['clanguage'];

      if ($multilingual == 1) {

          $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";

      } else {

          $the_lang = "";

      }

       if ($subtitle != "") {

          $subtitle = " ($subtitle)";

      } else {

            $subtitle = "";

      }

      if (is_admin($admin)) {

          echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";

      } else {

          echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br>";

      }

    }

    echo "</blockquote>";

    if (is_admin($admin)) {

      $result5 = $db->sql_query("SELECT pid, cid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='0' ORDER BY date");

      echo "<br><br><center><b>"._YOURADMINLIST."</b></center><br><br>";

      echo "<blockquote>";

      while ($row5 = $db->sql_fetchrow($result5)) {

          $pid = intval($row5['pid']);

          $cid = intval($row5['cid']);

          $title = stripslashes(check_html($row5['title'], "nohtml"));

         $subtitle = stripslashes(check_html($row5['subtitle'], "nohtml"));

          $clanguage = $row5['clanguage'];

          if ($multilingual == 1) {

            $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";

          } else {

            $the_lang = "";

          }

          if ($subtitle != "") {

              $subtitle = " ($subtitle) ";

          } else {

              $subtitle = " ";

          }

          echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";

      }

      echo "</blockquote>";

    }

    CloseTable();

    include("footer.php");

}



function list_pages_categories($cid) {

    global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;

    include("header.php");

    title("$sitename: "._PAGESLIST."");

    OpenTable();

    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>";

    $cid = intval($cid);

    $result = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='$cid' ORDER BY date");

    echo "<blockquote>";

    while ($row = $db->sql_fetchrow($result)) {

   $pid = intval($row['pid']);

   $title = stripslashes(check_html($row['title'], "nohtml"));

   $subtitle = stripslashes(check_html($row['subtitle'], "nohtml"));

   $clanguage = $row['clanguage'];

   if ($multilingual == 1) {

       $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";

   } else {

       $the_lang = "";

   }

        if ($subtitle != "") {

       $subtitle = " ($subtitle)";

   } else {

           $subtitle = "";

   }

   if (is_admin($admin)) {

       echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";

   } else {

       echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br>";

   }

    }

    echo "</blockquote>";

    if (is_admin($admin)) {

   $result2 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='0' AND cid='$cid' ORDER BY date");

   echo "<br><br><center><b>"._YOURADMINLIST."</b></center><br><br>";

   echo "<blockquote>";

   while ($row2 = $db->sql_fetchrow($result2)) {

       $pid = intval($row2['pid']);

       $title = stripslashes(check_html($row2['title'], "nohtml"));

       $subtitle = stripslashes(check_html($row2['subtitle'], "nohtml"));

       $clanguage = $row2['clanguage'];

       if ($multilingual == 1) {

      $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">";

       } else {

      $the_lang = "";

       }

           if ($subtitle != "") {

           $subtitle = " ($subtitle) ";

       } else {

               $subtitle = " ";

       }

       echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br>";

   }

   echo "</blockquote>";

    }

    echo "<center>"._GOBACK."</center>";

    CloseTable();

    include("footer.php");

}



switch($pa) {



    case "showpage":

    showpage($pid, $page);

    break;

   

    case "list_pages_categories":

    list_pages_categories($cid);

    break;

   

    default:

    list_pages();

    break;



}



?>


Now where should I put this code so that I wouldnt kill the module Very Happy
 
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Fri Jul 28, 2006 1:31 am Reply with quote

Your close, but not quite there. Your patch level is about 3.2 and Id recomend you read the patch documents on 3.2.

Ohh man I cant hold it back well heres a tip, if it WASNT patched(which I can see it is from the code) it would be $index=1;

$index=0; is the same as $index=""; or nothing at all

so read the documents on the patch level, Then remember it WAS index=1; now what does the patch level docs tell you to change that to?

Next is where,

if (!defined('MODULE_FILE')) {

die ("You can't access this file directly...");

}
paste it below that, Theres another clue, the defined within the if bracket Wink

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Jul 28, 2006 7:20 am Reply with quote

If this really IS 3.1 or greater, I believe to get the right blocks to show, you need to instead use:

define('INDEX_FILE',true);

This was changed in the later patches for better security.

Of course, if $index=1 works, then you are NOT at these higher patch levels... but should be. Wink

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
mordain







PostPosted: Fri Jul 28, 2006 8:41 am Reply with quote

Awesome, I put $index = 1 after

if (!defined('MODULE_FILE')) {

die ("You can't access this file directly...");

}

and it worked. Thanks a lot guys!!!
 
kguske







PostPosted: Fri Jul 28, 2006 4:39 pm Reply with quote

Isn't it pretty satisfying to learn and accomplish at the same time? Keep it up and before long you'll be posting assistance to others here.
 
mordain







PostPosted: Fri Jul 28, 2006 6:26 pm Reply with quote

I used to work a lot with HTML, so I didnt think PHP would be to much trouble but wow, it's like comparing english to chinese lol. I'm slowly getting it though.
 
gregexp







PostPosted: Fri Jul 28, 2006 6:30 pm Reply with quote

You know, I honestly found it easier to learn php AFTER I started learning javascript.

I think the basic fundamentals are VERY close.

Keep pushing, Youll catch on.

I think we can all say, were still learning. And thus RavensScripts
 
kguske







PostPosted: Fri Jul 28, 2006 7:25 pm Reply with quote

HTML is a formatting "language" whereas Javascript, PHP, etc. are programming languages. The nice thing about PHP (as compared with, for example, Java) is that PHP supports both procedural and object-oriented programming, instead of imposing one or the other (Java is only object-oriented). That makes is easier to learn (pick your flavor).

Raven offers great reference material in these forums and in the PHP manual on this site. You can sometimes find great ideas and information at php.net - in the comments, especially. Sure, you can find some bad stuff there, too. One of the great things about open source software is that you can see the source others have created - it is often the best tool for learning...enjoy!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©