Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - PHP Nuke
Author Message
dean
Worker
Worker


Joined: Apr 14, 2004
Posts: 193

PostPosted: Fri Jul 15, 2005 11:41 pm Reply with quote

After installing patch 3.0b to one of my nuke sites that uses Nucalendar, the month of events 2 block provided the following error:

Quote:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND recur_schedule='yearly' AND recur_month= AND isactive=1 AND


Has anyone else run into this issue and if so, have ya fixed it?
 
View user's profile Send private message
dean
PostPosted: Sat Jul 16, 2005 3:16 pm Reply with quote

Here's the fix for that: Only registered users can see links on this board! Get registered or login!

Now I'm trying to figure out why in the admin panel I see:
Quote:
Table 'alaskand_main.nuke_nucal_bydate' doesn't exist
Table 'alaskand_main.nuke_nucal_recurring' doesn't exist


Neither table are created by the installation and I don't understand the reason why it is calling it now after this patch upgrade. The old support forums for nucalendar ignored this request for help in the past so I put it here..........
 
chatserv
Member Emeritus


Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sun Jul 17, 2005 6:57 pm Reply with quote

Where can i download this add-on so that i can look into it?
 
View user's profile Send private message Visit poster's website
dean
PostPosted: Sun Jul 17, 2005 9:14 pm Reply with quote

Only registered users can see links on this board! Get registered or login!
 
chatserv
PostPosted: Sun Jul 17, 2005 9:24 pm Reply with quote

Thanks, what Nuke and patch versions are you using this with?
 
chatserv
PostPosted: Sun Jul 17, 2005 9:32 pm Reply with quote

dean wrote:
Here's the fix for that: Only registered users can see links on this board! Get registered or login!

Now I'm trying to figure out why in the admin panel I see:
Quote:
Table 'alaskand_main.nuke_nucal_bydate' doesn't exist
Table 'alaskand_main.nuke_nucal_recurring' doesn't exist


Neither table are created by the installation and I don't understand the reason why it is calling it now after this patch upgrade. The old support forums for nucalendar ignored this request for help in the past so I put it here..........

I found multiple instances of both tables in admin/modules/nucalender.php, very likely they are present in other files as well.
 
dean
PostPosted: Sun Jul 17, 2005 9:53 pm Reply with quote

Im using nuke 7.3 with patch 3.0b.
 
chatserv
PostPosted: Sun Jul 17, 2005 10:03 pm Reply with quote

Only registered users can see links on this board! Get registered or login! are the files that required editing to match Nuke Patched 3.0b, as for the references to those db tables they are present in the files so the tables are required so either check the sql file or contact the author.
 
dean
PostPosted: Sun Jul 17, 2005 10:36 pm Reply with quote

I've checked the sql file and the tables are not referenced there. This was brought to the author's attention last year and he commented that the code in question was referencing an earlier version of nucalendar. However, he provided no edits and has not responded to help requests at his support site in quite some time.
 
chatserv
PostPosted: Sun Jul 17, 2005 10:52 pm Reply with quote

Change the admin file to this:

Code:
<?php


/************************************************************************/
/* NuCalendar                                                           */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2003 by Bill Smith                                     */
/* http://www.vettesofthetropics.com                                    */
/*                                                                      */
/* Based on Web Calendar                                                */
/* Copyright (c) 2001 by Proverbs, LLC                                  */
/* http://www.proverbs.biz                                              */
/*                                                                      */
/* 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.       */
/************************************************************************/

/*
 *  ©2001 Proverbs, LLC. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify it withthe following stipulations:
 *  Changes or modifications must retain all Copyright statements, including, but not limited to the Copyright statement
 *  and Proverbs, LLC homepage link provided at the bottom of this page.
 */

if ( !defined('ADMIN_FILE') )
{
   die ("Access Denied");
}

$result = $db->sql_query("select radminlink, radminsuper from ".$prefix."_authors where aid='$aid'");
list($radminlink, $radminsuper) = $db->sql_fetchrow($result);
if (($radminlink==1) OR ($radminsuper==1)) {

require_once("modules/NuCalendar/dbaccess.inc.php");
require_once("modules/NuCalendar/datefuncs.php");
require_once("modules/NuCalendar/printevent.php");
get_lang("NuCalendar");


/*********************************************************/
/* Links Modified Web Links                              */
/*********************************************************/
function NuCalendar_Header()
{
   include("header.php");
        GraphicAdmin();
   OpenTable();
        echo "<center><font class=\"title\">"._ADMIN_TITLE."</font><br><br><a href=admin.php?op=NuCalendar_Edit_Options>"._ADMIN_EDIT_OPTIONS."</a><br><a href=admin.php?op=NuCalendar_Show_Categories>"._ADMIN_EDIT_CATEGORIES."</a><br><a href=admin.php?op=NuCalendar>"._ADMIN_EDIT_EVENTS."</a></center>";
        CloseTable();
}

function NuCalendar_Footer()
{
        include("footer.php");
}

function NuCalendar_EditOptions()
{
        NuCalendar_Header();
   OpenTable();

   global $db, $prefix;
   
   $result = $db->sql_query("SELECT * FROM ".$prefix."_nucal_options WHERE 1");
   
   $row = $db->sql_fetchrow($result);

   echo "<form action=\"admin.php?op=NuCalendar_Set_Options\" method=\"POST\">";
   echo "<table width=100%><tbody><tr>";

   echo "<td><font class=\"title\">"._ADMIN_OPTIONS_TITLE."</font></td><td></td><td></td></tr><tr>";
   echo "<td>"._ADMIN_CAL_TITLE."</td><td></td>";
   echo "<td><input type=\"text\" name=\"calendar_title\" value=\"".$row[calendar_title]."\" maxlength=128></td>";
   echo "</tr><tr>";

         echo "<td>"._ADMIN_CAL_IMAGE."</td><td></td>";
   echo "<td><input type=\"text\" name=\"calendar_title_image\" value=\"".$row[calendar_title_image]."\" maxlength=255></td>";
   echo "</tr><tr>";

         echo "<td>"._ADMIN_ALLOW_USER_SUBMISSION."</td><td></td>";
   echo "<td><select name=\"allow_user_submitted_events\">";
        echo "<option value=\"0\"";
        if ($row[allow_user_submitted_events] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[allow_user_submitted_events]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";
         echo "<td>"._ADMIN_MUST_APPROVE."</td>";
   echo "<td></td>";
         echo "</select></td>";
         echo "<td><select name=\"user_submitted_events_need_admin_aproval\">";
   echo "<option value=\"0\"";
        if ($row[user_submitted_events_need_admin_aproval] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[user_submitted_events_need_admin_aproval]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_DATE_FORMAT."</td>";
        echo "<td></td>";
   echo "<td><select name=\"show_mdy\">";
        echo "<option value=\"0\"";
        if ($row[show_mdy] == 0)
                echo " selected";
        echo ">"._ADMIN_DATE_FORMAT_DMY."</option>";
        echo "<option value=\"1\"";
        if ($row[show_mdy]==1)
                echo " selected";
        echo ">"._ADMIN_DATE_FORMAT_MDY."</option></select></td>";


       echo "</tr><tr><td></td><td></td><td></td><tr>";

   echo "<td><font class=\"title\">"._ADMIN_BLOCK_OPTIONS."</font></td><td></td><td>"._ADMIN_TURN_OFF_FOR_PERFORMANCE."</td></tr><tr>";

        echo "<td>"._ADMIN_SHOW_N_EVENTS."</td><td></td>";
        echo "<td><input type=\"text\" name=\"show_n_events\" value=\"".$row[show_n_events]."\" maxlength=2></td>";
        echo "</tr><tr>";

        echo "<td>"._ADMIN_SCAN_N_DAYS."</td><td></td>";
        echo "<td><input type=\"text\" name=\"in_n_days\" value=\"".$row[in_n_days]."\" maxlength=3></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_ONE_TIME."</td>";
        echo "<td></td>";
   echo "<td><select name=\"show_bydate_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_bydate_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_bydate_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_WEEKLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_weekly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_weekly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_weekly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_MONTHLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_monthly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_monthly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_monthly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_WEEKLY_RECUR."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_monthly_recurring_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_monthly_recurring_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_monthly_recurring_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_YEARLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_yearly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_yearly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_yearly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_YEARLY_RECUR."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_yearly_recurring_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_yearly_recurring_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_yearly_recurring_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td valign=\"top\">"._ADMIN_SHOW_CATS."</td>";
   echo "<td></td>";
   echo "<td><select name=\"showcats[]\" multiple>";
   $resultcats = $db->sql_query("SELECT * FROM ".$prefix."_nucal_categories WHERE 1 ORDER BY title");
   for ($x = 0; $x < $db->sql_numrows($resultcats); $x++) {
      $catrow = $db->sql_fetchrow($resultcats);
      echo "<option value=\"".$catrow[id]."\" ";
      if ($catrow[showinblock] == 1)
         echo "selected";
      echo ">".$catrow[title]."</option>";
   }

   echo "</select></td>";
   echo "</tr><tr>";
   



        echo "</tr><tr><td></td><td></td><td></td><tr>";

        echo "<td><font class=\"title\">"._ADMIN_COLOR_TITLE."</font></td><td></td><td>"._ADMIN_COLORS_FOR_MONTH_VIEW."</td></tr><tr>";
   echo "<td>"._ADMIN_COLOR_DAY."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_day_color\" value=\"".$row[month_day_color]."\" maxlength=6></td>";
   echo "</tr><tr>";
   echo "<td>"._ADMIN_COLOR_TODAY."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_today_color\" value=\"".$row[month_today_color]."\" maxlength=6></td>";
   echo "<tr></tr>";
   echo "<td>"._ADMIN_COLOR_MOUSE_HOVER."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_hover_color\" value=\"".$row[month_hover_color]."\" maxlength=6></td>";



        echo "</tr><tr><td></td><td></td><td></td><tr>";

   echo "</tr></tbody></table>";
   echo "<input type=\"submit\" value=\""._ADMIN_UPDATE_OPTIONS."\"><input type=\"reset\" value=\""._ADMIN_RESET."\"></form>";

   CloseTable();

        NuCalendar_Footer();
}

function NuCalendar_SetOptions($xcalendar_title, $xcalendar_title_image, $xallow_user_submitted_events, $xuser_submitted_events_need_admin_aproval, $xshow_n_events, $xin_n_days, $xmonth_day_color, $xmonth_today_color, $xmonth_hover_color, $xshow_bydate_in_block, $xshow_yearly_in_block, $xshow_yearly_recurring_in_block, $xshow_monthly_in_block, $xshow_monthly_recurring_in_block, $xshow_weekly_in_block, $showcats, $show_mdy)
{
   global $db, $prefix;
   $query = "UPDATE ".$prefix."_nucal_options SET calendar_title='$xcalendar_title', calendar_title_image='$xcalendar_title_image', allow_user_submitted_events='$xallow_user_submitted_events', user_submitted_events_need_admin_aproval='$xuser_submitted_events_need_admin_aproval', show_n_events='$xshow_n_events', in_n_days='$xin_n_days', month_day_color='$xmonth_day_color', month_today_color='$xmonth_today_color', month_hover_color='$xmonth_hover_color', show_bydate_in_block='$xshow_bydate_in_block', show_yearly_in_block='$xshow_yearly_in_block', show_yearly_recurring_in_block='$xshow_yearly_recurring_in_block', show_monthly_in_block='$xshow_monthly_in_block', show_monthly_recurring_in_block='$xshow_monthly_recurring_in_block', show_weekly_in_block='$xshow_weekly_in_block', show_mdy='$show_mdy' WHERE 1";
        $resultID = $db->sql_query($query);


   $query = "UPDATE ".$prefix."_nucal_categories SET showinblock=0 WHERE 1";
   $db->sql_query($query);

   for ($x = 0; $x < count($showcats); $x++) {
      $query = "UPDATE ".$prefix."_nucal_categories SET showinblock=1 WHERE id='$showcats[$x]'";
           $db->sql_query($query);   
   }

   Header("Location: admin.php?op=NuCalendar_Edit_Options");
}


function NuCalendar_Quick_Pick_Existing()
{
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_EDIT_EXISTING."</font></center>";
   echo "<form method=\"POST\" ACTION=\"admin.php?op=NuCalendar_Edit\">";
   echo _ADMIN_EDIT_ONE_TIME."  <select name=\"eventid\">";
   global $db, $prefix;
        $chkdate = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
   $query = "SELECT * FROM ".$prefix."_nucal_events WHERE isrecurring=0 AND isapproved=1 ORDER BY onetime_date";
        $resultID = $db->sql_query($query);

        if ($resultID) {
      $nr = $db->sql_numrows($resultID);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
              $myrow = $db->sql_fetchrow($resultID);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[onetime_date] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
        } else {
                  echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
        }
         echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
   echo "</form>";
   echo "<br>";
   echo "<form method=\"POST\" ACTION=\"admin.php?op=NuCalendar_Edit\">";
   echo _ADMIN_EDIT_RECUR."  <select name=\"eventid\">";
        $query = "SELECT * FROM ".$prefix."_nucal_events WHERE isrecurring=1 AND isapproved=1 ORDER BY id";               
   $resultID = $db->sql_query($query);
        if ($resultID) {
                $nr = $db->sql_numrows($resultID);
                $content = "";
           for ($k=0;$k<$nr;$k++) {
                   $myrow = $db->sql_fetchrow($resultID);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[eventdate] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
         } else {
                 echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
         }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
   echo "</form>";

   echo "</form>";
        echo "<br>";
        echo "<form method=\"POST\" ACTION=\"admin.php?op=NuCalendar_Edit\">";
        echo _ADMIN_EDIT_NEED_APPROVE."  <select name=\"eventid\">";
        $query = "SELECT * FROM ".$prefix."_nucal_events WHERE isapproved=0 ORDER BY id";
        $resultID = $db->sql_query($query);
        if ($resultID) {
                $nr = $db->sql_numrows($resultID);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
                        $myrow = $db->sql_fetchrow($resultID);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[eventdate] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }

      if ($nr == 0) {
         echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
      }
         } else {
                 echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
         }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
        echo "</form>";




   CloseTable();
}

function NuCalendar_Main()
{
   NuCalendar_Header();
   NuCalendar_Quick_Pick_Existing();
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_ADD_EVENT."</font></center>";
   $onetimeevent = 1;
   $formaction = "admin.php?op=NuCalendar_Add";
   $formsubmitbutton = _ADMIN_ADD_EVENT;
   ShowEventForm($formaction, "", "", $formsubmitbutton, $onetimeevent,"", "", "", "", 1);

   CloseTable();
   NuCalendar_Footer();
}

function NuCalendar_Edit($eventid)
{
        NuCalendar_Header();
   NuCalendar_Quick_Pick_Existing();
        OpenTable();
        echo "<center><font class=\"title\">"._ADMIN_EDIT_EVENT."</font></center>";
   

   global $db, $prefix;

   $query = "SELECT * FROM ".$prefix."_nucal_events WHERE id=" . $eventid;
   $resultID = $db->sql_query($query);
   if ($resultID) {
      $mydatarow = $db->sql_fetchrow($resultID);
      $onetimeevent=1;
      if ($mydatarow[isrecurring] == "0") {
         $ripdate = array();
                   $ripdate = explode("-", $mydatarow[onetime_date]);
         $year = $ripdate[0];
         $month = $ripdate[1];
         $day = $ripdate[2];
      } else {
         $onetimeevent=0;
      }
      $formaction = "admin.php?op=NuCalendar_Set_Values";
      $formsubmitbutton = _ADMIN_EDIT_EVENT;
      $formactiondelete = "admin.php?op=NuCalendar_Delete_Confirm";
      
      ShowEventForm($formaction, $mydatarow, $eventid, $formsubmitbutton, $onetimeevent, $month, $day, $year, $formactiondelete, 1);
   } else {
      echo _ADMIN_NO_EVENT_WITH_ID;
   }
   CloseTable();
   NuCalendar_Footer();
}





function NuCalendar_Add($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month)
{
   NuCalendar_Insert_Row($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);

   Header("Location: admin.php?op=NuCalendar");
}




function NuCalendar_Set_Values($eventid, $title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month)
{
   global $db, $prefix;

   $starttime = TimeToMilitaryTime($start_hour, $start_min, $start_pm);
   $duration = TimeToMilitaryTime($dur_hour, $dur_min, 0);

   $query = "UPDATE ".$prefix."_nucal_events SET title='$title', location='$location', fulldesc='$fulldesc', starttime='$starttime', duration='$duration', isactive='$isactive', isrecurring='$isrecurring', categoryid='$categoryid', isapproved='$isapproved', onetime_date='$onetime_date', recur_weekday='$recur_weekday', recur_schedule='$recur_schedule', recur_period='$recur_period', recur_month='$recur_month' WHERE id=$eventid";

        $resultID = $db->sql_query($query);

   Header("Location: admin.php?op=NuCalendar");
}




function NuCalendar_Delete_Confirm($eventid)
{
        NuCalendar_Header();
        OpenTable();

   echo "<form method=\"POST\" action=\"admin.php?op=NuCalendar_Delete\">";
   echo "<input type=\"hidden\" name=\"eventid\" value=\"". $eventid . "\">";
   echo "<center><font class=\"title\">"._ADMIN_EVENT_DELETE_CONFIRM."</font></center><br>";
   echo "<center><input type=\"submit\" value=\""._DELETE."\">";
   echo "<input type=\"reset\" value=\""._CANCEL."\"></center>";
   echo "</form>";
   CloseTable();
   NuCalendar_Footer();
}

function NuCalendar_Delete($eventid)
{
   global $db, $prefix;

   $query=  "DELETE from ".$prefix."_nucal_events WHERE id='$eventid'";
   $resultID = $db->sql_query($query);

   Header("Location: admin.php?op=NuCalendar");
}

function NuCalendar_Show_Categories()
{
   NuCalendar_Header();
        OpenTable();

   global $db, $prefix;
        $query = "SELECT * FROM ".$prefix."_nucal_categories WHERE 1";

        echo "<center><font class=\"title\">"._ADMIN_EDIT_EXISTING_CATEGORY_TITLE."</font></center><br>";       

   echo "<form method=\"POST\" ACTION=\"admin.php?op=NuCalendar_Edit_Category\">";
        echo _ADMIN_CATEGORY_NAME."  <select name=\"catid\">";
        $resultID = $db->sql_query($query);
        if ($resultID) {
                $nr = $db->sql_numrows($resultID);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
                        $myrow = $db->sql_fetchrow($resultID);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
        } else {
                echo "<option value=-1>"._ADMIN_NO_CATS_DEFINED."</option>";
        }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_CATEGORY."\">";
        echo "</form>";

   CloseTable();
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_ADD_CATEGORY."</font></center>";
   NuCalendar_Show_Category_Form("admin.php?op=NuCalendar_Add_Category", _ADMIN_ADD_CATEGORY_FORM, "");
   CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Add_Category($title, $description, $showinblock)
{
   global $db, $prefix;

        $query = "INSERT INTO ".$prefix."_nucal_categories (title, description, showinblock) VALUES ('$title', '$description', '$showinblock')";

   $result = $db->sql_query($query);
        Header("Location: admin.php?op=NuCalendar_Show_Categories");
}

function NuCalendar_Edit_Category($catid, $title, $description, $showinblock)
{
   NuCalendar_Header();
        OpenTable();

        global $db, $prefix;
        $query = "SELECT * FROM ".$prefix."_nucal_categories WHERE id=".$catid;
   $result = $db->sql_query($query);
   $row = $db->sql_fetchrow($result);

   echo "<center><font class=\"title\">"._ADMIN_EDIT_CATEGORY_TITLE."</font></center>";
   $formactiondelete = "admin.php?op=NuCalendar_Delete_Category_Confirm";
   NuCalendar_Show_Category_Form("admin.php?op=NuCalendar_Set_Category_Values", _ADMIN_EDIT_CATEGORY, $row, $formactiondelete);
   CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Show_Category_Form($formaction, $formsubmitbutton, $mydatarow, $formactiondelete="")
{
?>
   <form action="<?php echo $formaction; ?>" method="POST">
   <table width="100%" cellspacing=0 border=0 cellpadding=0>
        <tr align="left">
                <td width="30%"></td>
                <td width="10"></td>
                <td width="70%"></td>
        </tr>
        <tr align="left">
                <td width="30%"><?php echo _ADMIN_CATEGORY_TITLE; ?></td>
                <td width="10"></td>
                <td width="70%"><input type="text" name="title" value="<?php echo $mydatarow[title]; ?>" size=30></td>
        </tr>
   <tr align="left">
                <td width="30%" valign="top"><?php echo _ADMIN_CATEGORY_DESC; ?></td>
                <td width="10"></td>
                <td width="70%"><textarea rows="7" name="description" cols="45"><?php echo $mydatarow[description]; ?></textarea></td>
        </tr>
   <tr align="left">
                <td width="30%" valign="top"><?php echo _ADMIN_SHOW_CAT_IN_BLOCK; ?></td>
                <td width="10"></td>
                <td width="70%">
      <select name="showinblock">
      <option value="0"
      <?php
         if ($mydatarow[showinblock] == 0)
            echo " selected";
      ?>
      ><?php echo _NO; ?></option>
      <option value="1"
                <?php
                        if ($mydatarow[showinblock] == 1)
                                echo " selected";
                ?>
                ><?php echo _YES; ?></option>
      </select></td>
        </tr>
   </table>
   <input type="hidden" name="catid" value="<?php echo $mydatarow[id]; ?>">
   <input type="submit" value="<?php echo $formsubmitbutton; ?>">
   </form>

<?php
if ($formactiondelete != "") {
?>
<div align="right">
<form action="admin.php?op=NuCalendar_Delete_Category_Confirm" method="POST">
<input type="hidden" name="catid" value="<?php echo $mydatarow[id]; ?>">
<input type="submit" value="<?php echo _ADMIN_DELETE_CATEGORY; ?>">
</form>
</div>
<?php
}
}
   

function NuCalendar_Set_Category_Values($catid, $title, $description, $showinblock)
{
   global $db, $prefix;
        $query = "UPDATE ".$prefix."_nucal_categories SET title='$title', description='$description', showinblock='$showinblock' WHERE id=$catid";
        $resultID = $db->sql_query($query);
        Header("Location: admin.php?op=NuCalendar_Show_Categories");
}

function NuCalendar_Delete_Category_Confirm($catid)
{
   NuCalendar_Header();
        OpenTable();

        echo "<form method=\"POST\" action=\"admin.php?op=NuCalendar_Delete_Category\">";
        echo "<input type=\"hidden\" name=\"catid\" value=\"". $catid . "\">";
        echo "<center><font class=\"title\">Confirm Event Category Delete</font></center><br>";
        echo "<center><input type=\"submit\" value=\""._DELETE."\">";
        echo "<input type=\"reset\" value=\""._CANCEL."\"></center>";
        echo "</form>";
        CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Delete_Category($catid)
{
   global $db, $prefix;
        $query=  "DELETE from ".$prefix."_nucal_categories WHERE id='$catid'";
   echo $query;
        $resultID = $db->sql_query($query);
        Header("Location: admin.php?op=NuCalendar_Show_Categories");
}   

switch ($op) {
    case "NuCalendar":
   NuCalendar_Main();
    break;

    case "NuCalendar_Add":
   $isrecurring = 1;
        if ($onetime == "onetime") {
                $isrecurring = 0;
        }
   $onetime_date = $year."-".$month."-".$day;
   NuCalendar_Add($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, 1, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);
    break;         

    case "NuCalendar_Set_Values":
   $isrecurring = 1;
   if ($onetime == "onetime") {
      $isrecurring = 0;
   }

   $onetime_date = $year."-".$month."-".$day;
   NuCalendar_Set_Values($eventid, $title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);
    break;

    case "NuCalendar_Edit":
   NuCalendar_Edit($eventid);
    break;

    case "NuCalendar_Delete_Confirm":
   NuCalendar_Delete_Confirm($eventid);
    break;

    case "NuCalendar_Delete":
   NuCalendar_Delete($eventid);
    break;

    case "NuCalendar_Edit_Options":
   NuCalendar_EditOptions();
    break;

    case "NuCalendar_Set_Options":

   NuCalendar_SetOptions($calendar_title, $calendar_title_image, $allow_user_submitted_events, $user_submitted_events_need_admin_aproval, $show_n_events, $in_n_days, $month_day_color, $month_today_color, $month_hover_color, $show_bydate_in_block, $show_yearly_in_block, $show_yearly_recurring_in_block, $show_monthly_in_block, $show_monthly_recurring_in_block, $show_weekly_in_block, $showcats, $show_mdy);
    break;

    case "NuCalendar_Show_Categories":
        NuCalendar_Show_Categories();
    break;
    case "NuCalendar_Add_Category":
   NuCalendar_Add_Category($title, $description, $showinblock);
    break;
    case "NuCalendar_Edit_Category":
   NuCalendar_Edit_Category($catid, $title, $description, $showinblock);
    break;
    case "NuCalendar_Set_Category_Values":
        NuCalendar_Set_Category_Values($catid, $title, $description, $showinblock);
    break;
    case "NuCalendar_Delete_Category":
   NuCalendar_Delete_Category($catid);
    break;
    case "NuCalendar_Delete_Category_Confirm":
   NuCalendar_Delete_Category_Confirm($catid);
    break;

}

} else {
    echo "Access Denied";
}

?>
 
dean
PostPosted: Sun Jul 17, 2005 11:19 pm Reply with quote

That did it. Thank you Chatserv!!!!!
 
chatserv
PostPosted: Sun Jul 17, 2005 11:25 pm Reply with quote

Wave
 
KOMAPA
New Member
New Member


Joined: Sep 11, 2004
Posts: 20

PostPosted: Sun Sep 25, 2005 3:08 am Reply with quote

chatserv wrote:
Only registered users can see links on this board! Get registered or login! are the files that required editing to match Nuke Patched 3.0b, as for the references to those db tables they are present in the files so the tables are required so either check the sql file or contact the author.
Hi

I use PHP-Nuke-7.6-patchedv3.1 and try this files, but in admin area just Access Denied
Can somebody help me please?
 
View user's profile Send private message
chatserv
PostPosted: Sun Sep 25, 2005 9:25 am Reply with quote

Does your admin.php file have this after the file credits:
Code:
define('ADMIN_FILE', true);


If it doesn't then it is not a patched one.
 
KOMAPA
PostPosted: Sun Sep 25, 2005 2:01 pm Reply with quote

All works now... tanx a lot again!
 
chatserv
PostPosted: Sun Sep 25, 2005 2:13 pm Reply with quote

If that line was missing from your admin.php file you don't have the one included with Nuke Patched.
 
lazarus111
Regular
Regular


Joined: Jul 14, 2005
Posts: 64

PostPosted: Sun Nov 27, 2005 1:14 pm Reply with quote

Hey i have PHP-Nuke-7.6-patchedv3.1 and im running Nucalendar...
i also get access denied and yes i do have the
Code:
define('ADMIN_FILE', true);

after the file credits in my admin.php ..
 
View user's profile Send private message
chatserv
PostPosted: Sun Nov 27, 2005 1:21 pm Reply with quote

Did you use the files listed above in the link?
 
lazarus111
PostPosted: Sun Nov 27, 2005 10:17 pm Reply with quote

yes i do.. but im still getting the problem Sad
I dropped the nucal tables and re-imported them but still no luck..
 
peterski
New Member
New Member


Joined: Jan 30, 2006
Posts: 1

PostPosted: Tue Jan 31, 2006 3:56 am Reply with quote

I'm having this same problem but none of the above has worked for me.

I have a php-Nuke 7.8 system and patched 3.1

Any fixes ?

Thanks,

P
 
View user's profile Send private message Send e-mail
nighttrror
New Member
New Member


Joined: Feb 25, 2006
Posts: 7

PostPosted: Mon Feb 27, 2006 10:57 pm Reply with quote

I got the same problem after applying the newest patch on 7.8.

I narrowed the problem down to the file .../admin/modules/nucalendar.php

Replace the code in this file with:
Code:


<?php

/************************************************************************/
/* NuCalendar                                                           */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2003 by Bill Smith                                     */
/* http://www.vettesofthetropics.com                                    */
/*                                                                      */
/* Based on Web Calendar                                                */
/* Copyright (c) 2001 by Proverbs, LLC                                  */
/* http://www.proverbs.biz                                              */
/*                                                                      */
/* 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.       */
/************************************************************************/

/*
 *  ©2001 Proverbs, LLC. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify it withthe following stipulations:
 *  Changes or modifications must retain all Copyright statements, including, but not limited to the Copyright statement
 *  and Proverbs, LLC homepage link provided at the bottom of this page.
 */

if (!defined('ADMIN_FILE')) {
   die ("Access Denied");
}

global $prefix, $db, $admin_file;
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));

if ($row['radminsuper'] == 1)  {
require_once("modules/NuCalendar/dbaccess.inc.php");
require_once("modules/NuCalendar/datefuncs.php");
require_once("modules/NuCalendar/printevent.php");
get_lang("NuCalendar");


/*********************************************************/
/* Links Modified Web Links                              */
/*********************************************************/
function NuCalendar_Header()
{
   include("header.php");
        GraphicAdmin();
   OpenTable();
        echo "<center><font class=\"title\">"._ADMIN_TITLE."</font><br><br><a href=$admin_file?op=NuCalendar_Edit_Options>"._ADMIN_EDIT_OPTIONS."</a><br><a href=$admin_file?op=NuCalendar_Show_Categories>"._ADMIN_EDIT_CATEGORIES."</a><br><a href=$admin_file?op=NuCalendar>"._ADMIN_EDIT_EVENTS."</a></center>";

   global $user_prefix, $dbi;

   $result = $db->sql_query("SELECT * FROM ".$user_prefix."_nucal_bydate WHERE 1", $dbi);
   $v010exists = 0;
   if ($result) {
      $v010exists = 1;
   }

   $result = $db->sql_query("SELECT * FROM ".$user_prefix."_nucal_recurring WHERE 1", $dbi);
    if ($result) {
       $v010exists = 1;
        }

   if ($v010exists) {
      echo "<br><br><center><a href=$admin_file?op=NuCalendar_Import_From_v010>"._ADMIN_IMPORT_FROM_V010."</a></center>";
   }

   CloseTable();
}

function NuCalendar_Footer()
{
        include("footer.php");
}

function NuCalendar_EditOptions()
{
    NuCalendar_Header();

   OpenTable();

   global $dbi, $user_prefix;

   $result = sql_query("SELECT * FROM ".$user_prefix."_nucal_options WHERE 1", $dbi);

   $row = sql_fetch_array($result, $dbi);

   echo "<form action=\"$admin_file?op=NuCalendar_Set_Options\" method=\"POST\">";
   echo "<table width=100%><tbody><tr>";

   echo "<td><font class=\"title\">"._ADMIN_OPTIONS_TITLE."</font></td><td></td><td></td></tr><tr>";
   echo "<td>"._ADMIN_CAL_TITLE."</td><td></td>";
   echo "<td><input type=\"text\" name=\"calendar_title\" value=\"".$row[calendar_title]."\" maxlength=128></td>";
   echo "</tr><tr>";

         echo "<td>"._ADMIN_CAL_IMAGE."</td><td></td>";
   echo "<td><input type=\"text\" name=\"calendar_title_image\" value=\"".$row[calendar_title_image]."\" maxlength=255></td>";
   echo "</tr><tr>";

         echo "<td>"._ADMIN_ALLOW_USER_SUBMISSION."</td><td></td>";
   echo "<td><select name=\"allow_user_submitted_events\">";
        echo "<option value=\"0\"";
        if ($row[allow_user_submitted_events] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[allow_user_submitted_events]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";
         echo "<td>"._ADMIN_MUST_APPROVE."</td>";
   echo "<td></td>";
         echo "</select></td>";
         echo "<td><select name=\"user_submitted_events_need_admin_aproval\">";
   echo "<option value=\"0\"";
        if ($row[user_submitted_events_need_admin_aproval] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[user_submitted_events_need_admin_aproval]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_DATE_FORMAT."</td>";
        echo "<td></td>";
   echo "<td><select name=\"show_mdy\">";
        echo "<option value=\"0\"";
        if ($row[show_mdy] == 0)
                echo " selected";
        echo ">"._ADMIN_DATE_FORMAT_DMY."</option>";
        echo "<option value=\"1\"";
        if ($row[show_mdy]==1)
                echo " selected";
        echo ">"._ADMIN_DATE_FORMAT_MDY."</option></select></td>";


       echo "</tr><tr><td></td><td></td><td></td><tr>";

   echo "<td><font class=\"title\">"._ADMIN_BLOCK_OPTIONS."</font></td><td></td><td>"._ADMIN_TURN_OFF_FOR_PERFORMANCE."</td></tr><tr>";

        echo "<td>"._ADMIN_SHOW_N_EVENTS."</td><td></td>";
        echo "<td><input type=\"text\" name=\"show_n_events\" value=\"".$row[show_n_events]."\" maxlength=2></td>";
        echo "</tr><tr>";

        echo "<td>"._ADMIN_SCAN_N_DAYS."</td><td></td>";
        echo "<td><input type=\"text\" name=\"in_n_days\" value=\"".$row[in_n_days]."\" maxlength=3></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_ONE_TIME."</td>";
        echo "<td></td>";
   echo "<td><select name=\"show_bydate_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_bydate_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_bydate_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
   echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_WEEKLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_weekly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_weekly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_weekly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_MONTHLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_monthly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_monthly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_monthly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_WEEKLY_RECUR."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_monthly_recurring_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_monthly_recurring_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_monthly_recurring_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_YEARLY."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_yearly_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_yearly_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_yearly_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td>"._ADMIN_SHOW_YEARLY_RECUR."</td>";
        echo "<td></td>";
        echo "<td><select name=\"show_yearly_recurring_in_block\">";
        echo "<option value=\"0\"";
        if ($row[show_yearly_recurring_in_block] == 0)
                echo " selected";
        echo ">"._NO."</option>";
        echo "<option value=\"1\"";
        if ($row[show_yearly_recurring_in_block]==1)
                echo " selected";
        echo ">"._YES."</option></select></td>";
        echo "</tr><tr>";

   echo "<td valign=\"top\">"._ADMIN_SHOW_CATS."</td>";
   echo "<td></td>";
   echo "<td><select name=\"showcats[]\" multiple>";
   $resultcats = sql_query("SELECT * FROM ".$user_prefix."_nucal_categories WHERE 1 ORDER BY title", $dbi);
   for ($x = 0; $x < sql_num_rows($resultcats, $dbi); $x++) {
      $catrow = sql_fetch_array($resultcats, $dbi);
      echo "<option value=\"".$catrow[id]."\" ";
      if ($catrow[showinblock] == 1)
         echo "selected";
      echo ">".$catrow[title]."</option>";
   }

   echo "</select></td>";
   echo "</tr><tr>";




        echo "</tr><tr><td></td><td></td><td></td><tr>";

        echo "<td><font class=\"title\">"._ADMIN_COLOR_TITLE."</font></td><td></td><td>"._ADMIN_COLORS_FOR_MONTH_VIEW."</td></tr><tr>";
   echo "<td>"._ADMIN_COLOR_DAY."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_day_color\" value=\"".$row[month_day_color]."\" maxlength=6></td>";
   echo "</tr><tr>";
   echo "<td>"._ADMIN_COLOR_TODAY."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_today_color\" value=\"".$row[month_today_color]."\" maxlength=6></td>";
   echo "<tr></tr>";
   echo "<td>"._ADMIN_COLOR_MOUSE_HOVER."</td><td></td>";
        echo "<td>#<input type=\"text\" name=\"month_hover_color\" value=\"".$row[month_hover_color]."\" maxlength=6></td>";



        echo "</tr><tr><td></td><td></td><td></td><tr>";

   echo "</tr></tbody></table>";
   echo "<input type=\"submit\" value=\""._ADMIN_UPDATE_OPTIONS."\"><input type=\"reset\" value=\""._ADMIN_RESET."\"></form>";

   CloseTable();

        NuCalendar_Footer();
}

function NuCalendar_SetOptions($xcalendar_title, $xcalendar_title_image, $xallow_user_submitted_events, $xuser_submitted_events_need_admin_aproval, $xshow_n_events, $xin_n_days, $xmonth_day_color, $xmonth_today_color, $xmonth_hover_color, $xshow_bydate_in_block, $xshow_yearly_in_block, $xshow_yearly_recurring_in_block, $xshow_monthly_in_block, $xshow_monthly_recurring_in_block, $xshow_weekly_in_block, $showcats, $show_mdy)
{
   global $dbi, $user_prefix;
   $query = "UPDATE ".$user_prefix."_nucal_options SET calendar_title='$xcalendar_title', calendar_title_image='$xcalendar_title_image', allow_user_submitted_events='$xallow_user_submitted_events', user_submitted_events_need_admin_aproval='$xuser_submitted_events_need_admin_aproval', show_n_events='$xshow_n_events', in_n_days='$xin_n_days', month_day_color='$xmonth_day_color', month_today_color='$xmonth_today_color', month_hover_color='$xmonth_hover_color', show_bydate_in_block='$xshow_bydate_in_block', show_yearly_in_block='$xshow_yearly_in_block', show_yearly_recurring_in_block='$xshow_yearly_recurring_in_block', show_monthly_in_block='$xshow_monthly_in_block', show_monthly_recurring_in_block='$xshow_monthly_recurring_in_block', show_weekly_in_block='$xshow_weekly_in_block', show_mdy='$show_mdy' WHERE 1";
        $resultID = sql_query($query, $dbi);


   $query = "UPDATE ".$user_prefix."_nucal_categories SET showinblock=0 WHERE 1";
   sql_query($query, $dbi);

   for ($x = 0; $x < count($showcats); $x++) {
      $query = "UPDATE ".$user_prefix."_nucal_categories SET showinblock=1 WHERE id='$showcats[$x]'";
           sql_query($query, $dbi);
   }

   Header("Location: $admin_file?op=NuCalendar_Edit_Options");
}


function NuCalendar_Quick_Pick_Existing()
{
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_EDIT_EXISTING."</font></center>";
   echo "<form method=\"POST\" ACTION=\"$admin_file?op=NuCalendar_Edit\">";
   echo _ADMIN_EDIT_ONE_TIME."  <select name=\"eventid\">";
   global $dbi, $user_prefix;
        $chkdate = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
   $query = "SELECT * FROM ".$user_prefix."_nucal_events WHERE isrecurring=0 AND isapproved=1 ORDER BY onetime_date";
        $resultID = sql_query($query, $dbi);

        if ($resultID) {
      $nr = sql_num_rows($resultID, $dbi);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
              $myrow = sql_fetch_array($resultID, $dbi);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[onetime_date] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
        } else {
                  echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
        }
         echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
   echo "</form>";
   echo "<br>";
   echo "<form method=\"POST\" ACTION=\"$admin_file?op=NuCalendar_Edit\">";
   echo _ADMIN_EDIT_RECUR."  <select name=\"eventid\">";
        $query = "SELECT * FROM ".$user_prefix."_nucal_events WHERE isrecurring=1 AND isapproved=1 ORDER BY id";
   $resultID = sql_query($query, $dbi);
        if ($resultID) {
                $nr = sql_num_rows($resultID, $dbi);
                $content = "";
           for ($k=0;$k<$nr;$k++) {
                   $myrow = sql_fetch_array($resultID, $dbi);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[eventdate] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
         } else {
                 echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
         }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
   echo "</form>";

   echo "</form>";
        echo "<br>";
        echo "<form method=\"POST\" ACTION=\"$admin_file?op=NuCalendar_Edit\">";
        echo _ADMIN_EDIT_NEED_APPROVE."  <select name=\"eventid\">";
        $query = "SELECT * FROM ".$user_prefix."_nucal_events WHERE isapproved=0 ORDER BY id";
        $resultID = sql_query($query, $dbi);
        if ($resultID) {
                $nr = sql_num_rows($resultID, $dbi);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
                        $myrow = sql_fetch_array($resultID, $dbi);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[eventdate] . " " . $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }

      if ($nr == 0) {
         echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
      }
         } else {
                 echo "<option value=-1>"._ADMIN_NO_EVENTS."</option>";
         }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_EVENT."\">";
        echo "</form>";




   CloseTable();
}

function NuCalendar_Main()
{
   NuCalendar_Header();
   NuCalendar_Quick_Pick_Existing();
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_ADD_EVENT."</font></center>";
   $onetimeevent = 1;
   $formaction = "$admin_file?op=NuCalendar_Add";
   $formsubmitbutton = _ADMIN_ADD_EVENT;
   ShowEventForm($formaction, "", "", $formsubmitbutton, $onetimeevent,"", "", "", "", 1);

   CloseTable();
   NuCalendar_Footer();
}

function NuCalendar_Edit($eventid)
{
        NuCalendar_Header();
   NuCalendar_Quick_Pick_Existing();
        OpenTable();
        echo "<center><font class=\"title\">"._ADMIN_EDIT_EVENT."</font></center>";


   global $dbi, $user_prefix;

   $query = "SELECT * FROM ".$user_prefix."_nucal_events WHERE id=" . $eventid;
   $resultID = sql_query($query, $dbi);
   if ($resultID) {
      $mydatarow = sql_fetch_array($resultID, $dbi);
      $onetimeevent=1;
      if ($mydatarow[isrecurring] == "0") {
         $ripdate = array();
                   $ripdate = explode("-", $mydatarow[onetime_date]);
         $year = $ripdate[0];
         $month = $ripdate[1];
         $day = $ripdate[2];
      } else {
         $onetimeevent=0;
      }
      $formaction = "$admin_file?op=NuCalendar_Set_Values";
      $formsubmitbutton = _ADMIN_EDIT_EVENT;
      $formactiondelete = "$admin_file?op=NuCalendar_Delete_Confirm";

      ShowEventForm($formaction, $mydatarow, $eventid, $formsubmitbutton, $onetimeevent, $month, $day, $year, $formactiondelete, 1);
   } else {
      echo _ADMIN_NO_EVENT_WITH_ID;
   }
   CloseTable();
   NuCalendar_Footer();
}





function NuCalendar_Add($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month)
{
   NuCalendar_Insert_Row($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);

   Header("Location: $admin_file?op=NuCalendar");
}




function NuCalendar_Set_Values($eventid, $title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month)
{
   global $dbi, $user_prefix;

   $starttime = TimeToMilitaryTime($start_hour, $start_min, $start_pm);
   $duration = TimeToMilitaryTime($dur_hour, $dur_min, 0);

   $query = "UPDATE ".$user_prefix."_nucal_events SET title='$title', location='$location', fulldesc='$fulldesc', starttime='$starttime', duration='$duration', isactive='$isactive', isrecurring='$isrecurring', categoryid='$categoryid', isapproved='$isapproved', onetime_date='$onetime_date', recur_weekday='$recur_weekday', recur_schedule='$recur_schedule', recur_period='$recur_period', recur_month='$recur_month' WHERE id=$eventid";

        $resultID = sql_query($query, $dbi);

   Header("Location: $admin_file?op=NuCalendar");
}




function NuCalendar_Delete_Confirm($eventid)
{
        NuCalendar_Header();
        OpenTable();

   echo "<form method=\"POST\" action=\"$admin_file?op=NuCalendar_Delete\">";
   echo "<input type=\"hidden\" name=\"eventid\" value=\"". $eventid . "\">";
   echo "<center><font class=\"title\">"._ADMIN_EVENT_DELETE_CONFIRM."</font></center><br>";
   echo "<center><input type=\"submit\" value=\""._DELETE."\">";
   echo "<input type=\"reset\" value=\""._CANCEL."\"></center>";
   echo "</form>";
   CloseTable();
   NuCalendar_Footer();
}

function NuCalendar_Delete($eventid)
{
   global $dbi, $user_prefix;

   $query=  "DELETE from ".$user_prefix."_nucal_events WHERE id='$eventid'";
   $resultID = sql_query($query, $dbi);

   Header("Location: $admin_file?op=NuCalendar");
}

function NuCalendar_Show_Categories()
{
   NuCalendar_Header();
        OpenTable();

   global $dbi, $user_prefix;
        $query = "SELECT * FROM ".$user_prefix."_nucal_categories WHERE 1";

        echo "<center><font class=\"title\">"._ADMIN_EDIT_EXISTING_CATEGORY_TITLE."</font></center><br>";

   echo "<form method=\"POST\" ACTION=\"$admin_file?op=NuCalendar_Edit_Category\">";
        echo _ADMIN_CATEGORY_NAME."  <select name=\"catid\">";
        $resultID = sql_query($query, $dbi);
        if ($resultID) {
                $nr = sql_num_rows($resultID, $dbi);
                $content = "";
                for ($k=0;$k<$nr;$k++) {
                        $myrow = sql_fetch_array($resultID, $dbi);
                        $content = '<option value="' . $myrow[id] . '">';
                        $content .= $myrow[title];
                        $content .= "</option>";
                        echo $content;
                }
        } else {
                echo "<option value=-1>"._ADMIN_NO_CATS_DEFINED."</option>";
        }
        echo "</select>";
        echo "<input type=\"submit\" value=\""._ADMIN_EDIT_CATEGORY."\">";
        echo "</form>";

   CloseTable();
   OpenTable();
   echo "<center><font class=\"title\">"._ADMIN_ADD_CATEGORY."</font></center>";
   NuCalendar_Show_Category_Form("$admin_file?op=NuCalendar_Add_Category", _ADMIN_ADD_CATEGORY_FORM, "");
   CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Add_Category($title, $description, $showinblock)
{
   global $dbi, $user_prefix;

        $query = "INSERT INTO ".$user_prefix."_nucal_categories (title, description, showinblock) VALUES ('$title', '$description', '$showinblock')";

   $result = sql_query($query, $dbi);
        Header("Location: $admin_file?op=NuCalendar_Show_Categories");
}

function NuCalendar_Edit_Category($catid, $title, $description, $showinblock)
{
   NuCalendar_Header();
        OpenTable();

        global $dbi, $user_prefix;
        $query = "SELECT * FROM ".$user_prefix."_nucal_categories WHERE id=".$catid;
   $result = sql_query($query, $dbi);
   $row = sql_fetch_array($result, $dbi);

   echo "<center><font class=\"title\">"._ADMIN_EDIT_CATEGORY_TITLE."</font></center>";
   $formactiondelete = "$admin_file?op=NuCalendar_Delete_Category_Confirm";
   NuCalendar_Show_Category_Form("$admin_file?op=NuCalendar_Set_Category_Values", _ADMIN_EDIT_CATEGORY, $row, $formactiondelete);
   CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Show_Category_Form($formaction, $formsubmitbutton, $mydatarow, $formactiondelete="")
{
?>
   <form action="<?php echo $formaction; ?>" method="POST">
   <table width="100%" cellspacing=0 border=0 cellpadding=0>
        <tr align="left">
                <td width="30%"></td>
                <td width="10"></td>
                <td width="70%"></td>
        </tr>
        <tr align="left">
                <td width="30%"><?php echo _ADMIN_CATEGORY_TITLE; ?></td>
                <td width="10"></td>
                <td width="70%"><input type="text" name="title" value="<?php echo $mydatarow[title]; ?>" size=30></td>
        </tr>
   <tr align="left">
                <td width="30%" valign="top"><?php echo _ADMIN_CATEGORY_DESC; ?></td>
                <td width="10"></td>
                <td width="70%"><textarea rows="7" name="description" cols="45"><?php echo $mydatarow[description]; ?></textarea></td>
        </tr>
   <tr align="left">
                <td width="30%" valign="top"><?php echo _ADMIN_SHOW_CAT_IN_BLOCK; ?></td>
                <td width="10"></td>
                <td width="70%">
      <select name="showinblock">
      <option value="0"
      <?php
         if ($mydatarow[showinblock] == 0)
            echo " selected";
      ?>
      ><?php echo _NO; ?></option>
      <option value="1"
                <?php
                        if ($mydatarow[showinblock] == 1)
                                echo " selected";
                ?>
                ><?php echo _YES; ?></option>
      </select></td>
        </tr>
   </table>
   <input type="hidden" name="catid" value="<?php echo $mydatarow[id]; ?>">
   <input type="submit" value="<?php echo $formsubmitbutton; ?>">
   </form>

<?php
if ($formactiondelete != "") {
?>
<div align="right">
<form action="$admin_file?op=NuCalendar_Delete_Category_Confirm" method="POST">
<input type="hidden" name="catid" value="<?php echo $mydatarow[id]; ?>">
<input type="submit" value="<?php echo _ADMIN_DELETE_CATEGORY; ?>">
</form>
</div>
<?php
}
}


function NuCalendar_Set_Category_Values($catid, $title, $description, $showinblock)
{
   global $dbi, $user_prefix;
        $query = "UPDATE ".$user_prefix."_nucal_categories SET title='$title', description='$description', showinblock='$showinblock' WHERE id=$catid";
        $resultID = sql_query($query, $dbi);
        Header("Location: $admin_file?op=NuCalendar_Show_Categories");
}

function NuCalendar_Delete_Category_Confirm($catid)
{
   NuCalendar_Header();
        OpenTable();

        echo "<form method=\"POST\" action=\"$admin_file?op=NuCalendar_Delete_Category\">";
        echo "<input type=\"hidden\" name=\"catid\" value=\"". $catid . "\">";
        echo "<center><font class=\"title\">Confirm Event Category Delete</font></center><br>";
        echo "<center><input type=\"submit\" value=\""._DELETE."\">";
        echo "<input type=\"reset\" value=\""._CANCEL."\"></center>";
        echo "</form>";
        CloseTable();
        NuCalendar_Footer();
}

function NuCalendar_Delete_Category($catid)
{
   global $dbi, $user_prefix;
        $query=  "DELETE from ".$user_prefix."_nucal_categories WHERE id='$catid'";
   echo $query;
        $resultID = sql_query($query, $dbi);
        Header("Location: $admin_file?op=NuCalendar_Show_Categories");
}

function NuCalendar_Import_From_v010()
{
   global $dbi, $user_prefix;

   include("header.php");
        GraphicAdmin();
        OpenTable();

   echo "<center><font class=\"title\">Updating DB from v0.10</font></center><br><br>";

   echo "Importing from ".$user_prefix."_nucal_bydate ...";
   $result = sql_query("SELECT * FROM ".$user_prefix."_nucal_bydate WHERE 1", $dbi);
   $numrows = sql_num_rows($result, $dbi);
   echo $numrows . " row(s) to update ... ";
   $numrowsadded = 0;
   for ($x = 0; $x < $numrows; $x++) {
      $row = sql_fetch_array($result, $dbi);

      list($start_hour, $start_min, $start_sec) = split(":", $row[eventtime]);
      list($dur_hour, $dur_min, $dur_sec) = split(":", $row[eventlength]);

      $addresult = NuCalendar_Insert_Row($row[shortevent], $row[location], $start_hour, $start_min,  MilitaryTimeIsPM($row[eventtime]), $dur_hour, $dur_min, $row[longevent], $row[active], 0, 1, 1, $row[eventdate], 0, "weekly", 0, 0);
      if ($addresult) {
         $numrowsadded++;
      }
   }
   echo $numrowsadded . " row(s) updated.<br>";
   if ($numrows != $numrowsadded) {
      echo "<b>WARNING: NOT ALL BYDATE ROWS COULD BE AUTOMATICALLY UPDADED.  PLEASE RE-ENTER THEM BY HAND</b><br>";
   }



   echo "<br>Importing from ".$user_prefix."_nucal_recurring ...";
        $result = sql_query("SELECT * FROM ".$user_prefix."_nucal_recurring WHERE 1", $dbi);
        $numrows = sql_num_rows($result, $dbi);
        echo $numrows . " row(s) to update ... ";
        $numrowsadded = 0;
        for ($x = 0; $x < $numrows; $x++) {
                $row = sql_fetch_array($result, $dbi);
      list($start_hour, $start_min, $start_sec) = split(":", $row[eventtime]);
                list($dur_hour, $dur_min, $dur_sec) = split(":", $row[eventlength]);

                $addresult = NuCalendar_Insert_Row($row[shortevent], $row[location], $start_hour, $start_min,  MilitaryTimeIsPM($row[eventtime]), $dur_hour, $dur_min, $row[longevent], $row[active], 1, 1, 1, "0000-00-00", $row[weekday], $row[schedule], $row[period], $row[month]);
                if ($addresult) {
                        $numrowsadded++;
                }
        }
        echo $numrowsadded . " row(s) updated.<br>";
        if ($numrows != $numrowsadded) {
                echo "<b>WARNING: NOT ALL RECURRING ROWS COULD BE AUTOMATICALLY UPDADED.  PLEASE RE-ENTER THEM BY HAND</b><br>";
        }

   echo "<br>You may now delete tables ".$user_prefix."_nucal_bydate and ".$user_prefix."_nucal_recurring after you are satsified with the update";


   CloseTable();
   NuCalendar_Footer();
}

switch ($op) {
    case "NuCalendar":
   NuCalendar_Main();
    break;

    case "NuCalendar_Add":
   $isrecurring = 1;
        if ($onetime == "onetime") {
                $isrecurring = 0;
        }
   $onetime_date = $year."-".$month."-".$day;
   NuCalendar_Add($title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, 1, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);
    break;

    case "NuCalendar_Set_Values":
   $isrecurring = 1;
   if ($onetime == "onetime") {
      $isrecurring = 0;
   }

   $onetime_date = $year."-".$month."-".$day;
   NuCalendar_Set_Values($eventid, $title, $location, $fulldesc, $start_hour, $start_min, $start_pm, $dur_hour, $dur_min, $isactive, $isrecurring, $categoryid, $isapproved, $onetime_date, $recur_weekday, $recur_schedule, $recur_period, $recur_month);
    break;

    case "NuCalendar_Edit":
   NuCalendar_Edit($eventid);
    break;

    case "NuCalendar_Delete_Confirm":
   NuCalendar_Delete_Confirm($eventid);
    break;

    case "NuCalendar_Delete":
   NuCalendar_Delete($eventid);
    break;

    case "NuCalendar_Edit_Options":
   NuCalendar_EditOptions();
    break;

    case "NuCalendar_Set_Options":

   NuCalendar_SetOptions($calendar_title, $calendar_title_image, $allow_user_submitted_events, $user_submitted_events_need_admin_aproval, $show_n_events, $in_n_days, $month_day_color, $month_today_color, $month_hover_color, $show_bydate_in_block, $show_yearly_in_block, $show_yearly_recurring_in_block, $show_monthly_in_block, $show_monthly_recurring_in_block, $show_weekly_in_block, $showcats, $show_mdy);
    break;

    case "NuCalendar_Show_Categories":
        NuCalendar_Show_Categories();
    break;
    case "NuCalendar_Add_Category":
   NuCalendar_Add_Category($title, $description, $showinblock);
    break;
    case "NuCalendar_Edit_Category":
   NuCalendar_Edit_Category($catid, $title, $description, $showinblock);
    break;
    case "NuCalendar_Set_Category_Values":
        NuCalendar_Set_Category_Values($catid, $title, $description, $showinblock);
    break;
    case "NuCalendar_Delete_Category":
   NuCalendar_Delete_Category($catid);
    break;
    case "NuCalendar_Delete_Category_Confirm":
   NuCalendar_Delete_Category_Confirm($catid);
    break;
    case "NuCalendar_Import_From_v010":
   NuCalendar_Import_From_v010();
    break;

}

} else {
    echo "Access Denied";
}

?>


This has seemed to resolve my problems...I hope it works for yours...Best of luck...


Oh...yeah...one last thing you should look at if this doesn't take care of it right away. I got my original fix ideas from this post before it broke with the security patches: Only registered users can see links on this board! Get registered or login!

You can omit the last fix pertaining to the nucalendar.php since I already included it in the above code fix. If your calendar worked before the patch then just use the code i gave. If you didn't try it until after the patch then I would suggest doing the fixes from the post first and then replacing the code I suggested. Best of Luck and I hope this helps you...
 
View user's profile Send private message
verice
New Member
New Member


Joined: Mar 31, 2006
Posts: 1

PostPosted: Fri Mar 31, 2006 3:37 pm Reply with quote

dean wrote:
Here's the fix for that: Only registered users can see links on this board! Get registered or login!


I just had that error and managed to find this pages cached on google. So if anyone one else needs:

Code:
Replace the AddDayBlock2() function block with the following: 

Code:
function AddDayBlock2($fdotw, $fday, $fmonth, $fyear)
{
   $thisday=date("d");
   $rtnVal = "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">";

   // If AddDayBlock is called with $year as '' it will cause warnings
   // to pop up all over a windows machine as this value of '' gets
   // passed into mktime(). This is not right, but linux does not care
   // however windows does as it does not like -ve offsets so.
   if( $fday == '' ) {
      $rtnVal .= $fday . "</td>";
      return $rtnVal;
   }

    $numEvents = Calendar_NumEventsOn($fmonth, $fday, $fyear, $fdotw);

   if ($fday == $thisday) {
      $rtnVal .= MakeDayLink($fmonth, $fday, $fyear, "#0f0fff");
   } else if ($numEvents > 0) {
      $rtnVal .= MakeDayLink($fmonth, $fday, $fyear, "#cc0000");
   } else {
      $rtnVal .= $fday;
   }

   $rtnVal .= "</td>";
   return $rtnVal;
}
 

Also there is a small problem with the code block at the start of this file that you might as well fix at the same time. The line:
Code:

if (eregi("block-Month_Of_Events.php",$PHP_SELF)) {

Should read:

Code:
if (eregi("block-Month_Of_Events2.php",$PHP_SELF)) {


Thanks for the help! Saved me many headaches!
 
View user's profile Send private message
helix512
Hangin' Around


Joined: Aug 07, 2006
Posts: 40

PostPosted: Sat Aug 12, 2006 7:37 am Reply with quote

im trying NuCalender sinc ei cant seem to get any thing to work so i install it on my Raven7.6 and woot it works i can see the calender i can subit events ( this cant be happening i say to my self)

OUCH smak in the face

in the admin cP i click the NuCalender icon and BANG!!!!!

Unknown column 'radminlink' in 'field list'

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/.baguette/customrides/customstreetrides.com/includes/sql_layer.php on line 287
Unknown column 'radminlink' in 'field list'
Access Denied

i knew it was too good to be true.
this is the closest i have goten to get a calender workgi on this site so any ideas would be great. thanks
 
View user's profile Send private message
nighttrror
PostPosted: Wed Aug 16, 2006 11:21 pm Reply with quote

its been awhile since i actually installed this on raven 7.6 but it almost looks like you are missing the info in the "/admin" folder. I know there was 4 things you had to update in that folder:
1) copy case.nucalendar.php into the /admin/case folder
2) copy links.nucalendar.php into the /admin/links folder
3) copy nucalendar.php into the /admin/modules folder
4) append "define("_NUCALENDAR", "Calendar");" into the lang-english.php file in the /admin/language folder

The above 4 steps had their own directories included with the nucalendar distro under the admin folder. The first 3 are simply copied into the appropriate folders. The 4rth was up to you to append the info into lang-enghlish.php file.

This stuff in the /admin folder is what put that link in the admin section of ravennuke and what is repsonsible for retrieving the necessary info...

My guess is that your either missing the file in the links folder or the modules folder but I'm guessing at this point without looking too much into the code. Its been awhile and I don't know where you got your nucalendar distro or what steps you've followed from the installation guide included with the distro.

Hope this points you in the right direction...
 
helix512
PostPosted: Thu Aug 17, 2006 6:32 am Reply with quote

thanks i got it working but did nto like it much. so i went with kalender 1.4d.

again thansk for the help
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - PHP Nuke

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 ©