Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_modules / postcalendar [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
02 Oct 2002 13:07:14postnuke_modules/postcalendarcommon.api.php,NONE,1.1 pnadmin.php,1.30,1.31 pnadminapi.php,1.9,1.10 pnuserapi.php,1.108,1.109Roger Raymond
 added common api functions

Update of /home/cvsroot/postnuke_modules/postcalendar
In directory ns7.hostnuke.net:/tmp/cvs-serv24039

Modified Files:
	pnadmin.php pnadminapi.php pnuserapi.php 
Added Files:
	common.api.php 
Log Message:
added common api functions


--- NEW FILE: common.api.php ---
<?php
/**
 *  Returns an array of form data for FormSelectMultiple
 */
function postcalendar_adminapi_buildTimeSelect($args) 
{   return postcalendar_userapi_buildTimeSelect($args);
}
function postcalendar_userapi_buildTimeSelect($args) 
{   
    $time24hours = pnModGetVar('postcalendar','time24hours');
    $inc = 15; // <--- should this be a setting?
    extract($args);
    $output         = array();
    $output['h']    = array();
    $output['m']    = array();
    if($time24hours) { 
        $start=0; $end=23; 
    } else { 
        $start=1; $end=12;
        $hselected = $hselected > 12 ? $hselected-=12 : $hselected; 
    }
    
    $count = 0;
    for ($h = $start; $h <= $end; $h++) {   
        $hour = sprintf('%02d',$h);
        $output['h'][$count]['id']         = pnVarPrepForStore($h);
        $output['h'][$count]['selected']   = $hselected == $hour;
        $output['h'][$count]['name']       = pnVarPrepForDisplay($hour);
        $count++;
    }
    
    $count = 0;
    for ($m = 0; $m <= 60-$inc; $m+=$inc) {   
        $min = sprintf('%02d',$m);
        $output['m'][$count]['id']         = pnVarPrepForStore($m);
        $output['m'][$count]['selected']   = $mselected == $min;
        $output['m'][$count]['name']       = pnVarPrepForDisplay($min);
        $count++;
    }
    return $output;
}
/**
 *  Returns an array of form data for FormSelectMultiple
 */
function postcalendar_adminapi_buildMonthSelect($args) 
{   return postcalendar_userapi_buildMonthSelect($args);
}
function postcalendar_userapi_buildMonthSelect($args) 
{
    extract($args);
    if(!isset($pc_month)) { $pc_month = Date_Calc::getMonth(); } 
    // create the return object to be inserted into the form
    $output = array();
    $count = 0;
    if(!isset($selected)) $selected = '';
    for ($i = 1; $i <= 12; $i++) {
        if ($selected)              { $sel = $selected == $i ? true : false; }
        elseif ($i == $pc_month)    { $sel = true; } 
        else                        { $sel = false; }
        $output[$count]['id']         = sprintf('%02d',$i);
        $output[$count]['selected']   = $sel;
        $output[$count++]['name']     = postcalendar_userapi_getmonthname(array('Date'=>mktime(0,0,0,$i)));
    }
    return $output;
}

/**
 *  Returns an array of form data for FormSelectMultiple
 */
function postcalendar_adminapi_buildDaySelect($args) 
{   return postcalendar_userapi_buildDaySelect($args);
}
function postcalendar_userapi_buildDaySelect($args) 
{   
    extract($args);
    if(!isset($pc_day)) { $pc_day = Date_Calc::getDay(); }
    // create the return object to be inserted into the form
    $output = array();
    $count = 0;
    if(!isset($selected)) $selected = '';
    for ($i = 1; $i <= 31; $i++) {   
        if ($selected)          { $sel = $selected == $i ? true : false; }
        elseif ($i == $pc_day)  { $sel = true; } 
        else                    { $sel = false; }
        $output[$count]['id']         = sprintf('%02d',$i);
        $output[$count]['selected']   = $sel;
        $output[$count++]['name']     = sprintf('%02d',$i);
    }
    return $output;
}

/**
 *  Returns an array of form data for FormSelectMultiple
 */
function postcalendar_adminapi_buildYearSelect($args) 
{   return postcalendar_userapi_buildYearSelect($args);
}
function postcalendar_userapi_buildYearSelect($args) 
{   
    extract($args);
    if(!isset($pc_year)) { $pc_year = date('Y'); }
    // create the return object to be inserted into the form
    $output = array();
    // we want the list to contain 10 years before today and 30 years after
    // maybe this will eventually become a user defined value
    $pc_start_year = date('Y') - 10;
    $pc_end_year = date('Y') + 30;
    $count = 0;
    if(!isset($selected)) $selected = '';
    for ($i = $pc_start_year; $i <= $pc_end_year; $i++) {   
        if ($selected)          { $sel = $selected == $i ? true : false; } 
        elseif ($i == $pc_year) { $sel = true; } 
        else                    { $sel = false; }
        $output[$count]['id']         = sprintf('%04d',$i);
        $output[$count]['selected']   = $sel;
        $output[$count++]['name']     = sprintf('%04d',$i);
    }
    return $output;
}

function postcalendar_adminapi_getCategories()
{   return postcalendar_userapi_getCategories();
}
function postcalendar_userapi_getCategories()
{
    pnModDBInfoLoad('postcalendar');
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $cat_table = $pntable['postcalendar_categories'];
    $sql = "SELECT pc_catid,pc_catname,pc_catcolor,pc_catdesc
            FROM $cat_table";
    $result = $dbconn->Execute($sql);
    
    if($dbconn->ErrorNo() != 0) { return array(); }
    if(!isset($result)) { return array(); }
    
    $categories = array();
    for($i=0; !$result->EOF; $result->MoveNext()) {
        list($catid,$catname,$catcolor,$catdesc) = $result->fields;
        // check the category's permissions
        if (!pnSecAuthAction(0,'PostCalendar::Event',":$catname:",ACCESS_OVERVIEW)) {
            continue;
        }
        $categories[$i]['id']     = $catid;
        $categories[$i]['name']   = $catname;
        $categories[$i]['color']  = $catcolor;
        $categories[$i++]['desc'] = $catdesc;
     }
    $result->Close();
    return $categories;   
}
?>

Index: pnadmin.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/postcalendar/pnadmin.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** pnadmin.php	10 Sep 2002 16:22:53 -0000	1.30
--- pnadmin.php	2 Oct 2002 13:07:11 -0000	1.31
***************
*** 5,9 ****
   *  PostCalendar::PostNuke Events Calendar Module
   *  Copyright (C) 2002  The PostCalendar Team
!  *  http://www.alyousif.tv/cal
   *  
   *  This program is free software; you can redistribute it and/or modify
--- 5,9 ----
   *  PostCalendar::PostNuke Events Calendar Module
   *  Copyright (C) 2002  The PostCalendar Team
!  *  http://pc.bahraini.tv
   *  
   *  This program is free software; you can redistribute it and/or modify
***************
*** 25,39 ****
   *
   */
! 
! //************************************************************************
! //  Require utility classes
! //************************************************************************
! $pcModInfo = pnModGetInfo(pnModGetIDFromName('postcalendar'));
! $pcDir = pnVarPrepForOS($pcModInfo['directory']);
! 
! @define('SMARTY_DIR',"modules/$pcDir/pnincludes/Smarty/");
! @define('SMARTY_TEMPLATE_DIR',"modules/$pcDir/pntemplates");
! @define('SMARTY_COMPILE_DIR',"modules/$pcDir/pntemplates/compiled");
! require_once(SMARTY_DIR.'/Smarty.class.php');
  
  /**
--- 25,33 ----
   *
   */
! //=========================================================================
! //  Load the API Functions
! //=========================================================================
! //pnModAPILoad('PostCalendar','user'); // remove once we move functionality to admin api
! pnModAPILoad('PostCalendar','admin');
  
  /**
***************
*** 581,589 ****
      }
      
-     if (!pnModAPILoad('postcalendar', 'admin')) {
-         $output->Text(_PC_API_LOAD_FAILED);
-         return $output->GetOutput();
-     }
-     
      list($action,$pc_event_id,$thelist) = pnVarCleanFromInput('action','pc_event_id','thelist');
      
--- 575,578 ----
***************
*** 822,830 ****
      $pcAllowSiteWide        = pnModGetVar('postcalendar','pcAllowSiteWide');
      
-     if (!pnModAPILoad('postcalendar', 'user')) {
-         $output->Text(_PC_API_LOAD_FAILED);
-         return $output->GetOutput();
-     }
- 
      // get DB information
      pnModDBInfoLoad('postcalendar');
--- 811,814 ----
***************
*** 1143,1151 ****
      // build the form
      // set up Smarty
!     $tpl = new Smarty();
!     $tpl->template_dir = SMARTY_TEMPLATE_DIR;
!     $tpl->compile_dir  = SMARTY_COMPILE_DIR;
!     $tpl->left_delimiter  =  '[-';
!     $tpl->right_delimiter =  '-]';
      // find out what template we're using
      $template_name = pnModGetVar('postcalendar','pcTemplate');
--- 1127,1131 ----
      // build the form
      // set up Smarty
!     $tpl = new pcSmarty();
      // find out what template we're using
      $template_name = pnModGetVar('postcalendar','pcTemplate');
***************
*** 1786,1790 ****
      
      $output->Text(postcalendar_adminmenu());
-     pnModAPILoad('PostCalendar','admin');
      $cats = pnModAPIFunc('PostCalendar','admin','getCategories');
      if(!is_array($cats)) {
--- 1766,1769 ----
***************
*** 1881,1885 ****
      $output->SetInputMode(_PNH_VERBATIMINPUT);
      $output->Text(postcalendar_adminmenu());
-     pnModAPILoad('PostCalendar','admin');
      
      list($dbconn) = pnDBGetConn();
--- 1860,1863 ----
***************
*** 1975,1983 ****
      // lets get the module's information
      $modinfo = pnModGetInfo(pnModGetIDFromName('postcalendar'));
-     
-     if (!pnModAPILoad('postcalendar', 'user')) {
-         $output->Text(_LOADFAILED);
-         return $output->GetOutput();
-     }
      
      $output->Text(pnGetStatusMsg());
--- 1953,1956 ----

Index: pnadminapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/postcalendar/pnadminapi.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pnadminapi.php	7 Sep 2002 15:39:38 -0000	1.9
--- pnadminapi.php	2 Oct 2002 13:07:11 -0000	1.10
***************
*** 5,9 ****
   *  PostCalendar::PostNuke Events Calendar Module
   *  Copyright (C) 2002  The PostCalendar Team
!  *  http://www.alyousif.tv/cal
   *  
   *  This program is free software; you can redistribute it and/or modify
--- 5,9 ----
   *  PostCalendar::PostNuke Events Calendar Module
   *  Copyright (C) 2002  The PostCalendar Team
!  *  http://pc.bahraini.tv
   *  
   *  This program is free software; you can redistribute it and/or modify
***************
*** 25,28 ****
--- 25,46 ----
   *
   */
+ 
+ //=========================================================================
+ //  Require utility classes
+ //=========================================================================
+ $pcModInfo = pnModGetInfo(pnModGetIDFromName('PostCalendar'));
+ $pcDir = pnVarPrepForOS($pcModInfo['directory']);
+ require_once("modules/$pcDir/pnincludes/Date/Calc.php");
+ require_once("modules/$pcDir/pnincludes/Benchmark/Timer.php");
+ require_once("modules/$pcDir/functions.php");
+ require_once("modules/$pcDir/common.api.php");
+ //=========================================================================
+ //  Setup Smarty defines
+ //=========================================================================
+ @define('SMARTY_DIR',"modules/$pcDir/pnincludes/Smarty/");
+ require_once("modules/$pcDir/smarty_plugins.php");
+ require_once(SMARTY_DIR.'/Smarty.class.php');
+ require_once("modules/$pcDir/pcSmarty.class.php");
+ 
  
  /**

Index: pnuserapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/postcalendar/pnuserapi.php,v
retrieving revision 1.108
retrieving revision 1.109
diff -C2 -d -r1.108 -r1.109
*** pnuserapi.php	2 Oct 2002 00:30:05 -0000	1.108
--- pnuserapi.php	2 Oct 2002 13:07:11 -0000	1.109
***************
*** 85,140 ****
  require_once("modules/$pcDir/pnincludes/Benchmark/Timer.php");
  require_once("modules/$pcDir/functions.php");
  //=========================================================================
  //  Setup Smarty defines
  //=========================================================================
! define('SMARTY_DIR',"modules/$pcDir/pnincludes/Smarty/");
  require_once("modules/$pcDir/smarty_plugins.php");
  require_once(SMARTY_DIR.'/Smarty.class.php');
! //=========================================================================
! //  Here we extend smarty to make configuring it simpler
! //=========================================================================
! class pcSmarty extends Smarty
! {
!     function pcSmarty()
!     {
!         pnThemeLoad(pnUserGetTheme());
!         global $bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$bgcolor6,$textcolor1,$textcolor2;
!         
!         // call constructor
!         $this->Smarty();
!         // gather module information
!         $pcModInfo = pnModGetInfo(pnModGetIDFromName('PostCalendar'));
!         $pcDir = pnVarPrepForOS($pcModInfo['directory']);
!         // setup up pcSmarty configs
!         $this->template_dir     =   "modules/$pcDir/pntemplates";
!         $this->compile_dir      =   "modules/$pcDir/pntemplates/compiled";
!         $this->left_delimiter   =   '[-';
!         $this->right_delimiter  =   '-]';
!         $this->caching          =   false;
!         $this->cache_dir        =   "modules/$pcDir/pntemplates/cache";
!         $this->cache_lifetime   =   60*60*24*1; // 1 day
!         // check for safe mode and set accordingly
!         if(ini_get('safe_mode') > 0) {
!             $this->use_sub_dirs = false;
!         } else {
!             $this->use_sub_dirs = true;
!         }
!         // register postcalendar custom functions
!         $this->register_function('pc_date_format','postcalendar_smarty_pcDateFormat');
!         $this->register_function('pc_event_url','postcalendar_smarty_pcEventURL');
!         $this->register_function('pc_date_select','postcalendar_smarty_pcDateSelect');
!         $this->register_function('pc_url','postcalendar_smarty_pcURL');
!         $this->register_modifier('pc_date_format','postcalendar_smarty_pc_date_format');
!         // assign theme globals
!         $this->assign('BGCOLOR1',   $bgcolor1);    
!         $this->assign('BGCOLOR2',   $bgcolor2);  
!         $this->assign('BGCOLOR3',   $bgcolor3);  
!         $this->assign('BGCOLOR4',   $bgcolor4); 
!         $this->assign('BGCOLOR5',   $bgcolor5);
!         $this->assign('BGCOLOR6',   $bgcolor6);
!         $this->assign('TEXTCOLOR1', $textcolor1);  
!         $this->assign('TEXTCOLOR2', $textcolor2);
!     }    
! }
  
  /**
--- 85,96 ----
  require_once("modules/$pcDir/pnincludes/Benchmark/Timer.php");
  require_once("modules/$pcDir/functions.php");
+ require_once("modules/$pcDir/common.api.php");
  //=========================================================================
  //  Setup Smarty defines
  //=========================================================================
! @define('SMARTY_DIR',"modules/$pcDir/pnincludes/Smarty/");
  require_once("modules/$pcDir/smarty_plugins.php");
  require_once(SMARTY_DIR.'/Smarty.class.php');
! require_once("modules/$pcDir/pcSmarty.class.php");
  
  /**
***************
*** 164,237 ****
  
  /**
-  *  Returns an array of form data for FormSelectMultiple
-  */
- function postcalendar_userapi_buildMonthSelect($args) 
- {
-     extract($args);
-     if(!isset($pc_month)) { $pc_month = Date_Calc::getMonth(); } 
-     // create the return object to be inserted into the form
-     $output = array();
-     $count = 0;
-     if(!isset($selected)) $selected = '';
-     for ($i = 1; $i <= 12; $i++) {
-         if ($selected)              { $sel = $selected == $i ? true : false; }
-         elseif ($i == $pc_month)    { $sel = true; } 
-         else                        { $sel = false; }
-         $output[$count]['id']         = sprintf('%02d',$i);
-         $output[$count]['selected']   = $sel;
-         $output[$count++]['name']     = postcalendar_userapi_getmonthname(array('Date'=>mktime(0,0,0,$i)));
-     }
-     return $output;
- }
- 
- /**
-  *  Returns an array of form data for FormSelectMultiple
-  */
- function postcalendar_userapi_buildDaySelect($args) 
- {   
-     extract($args);
-     if(!isset($pc_day)) { $pc_day = Date_Calc::getDay(); }
-     // create the return object to be inserted into the form
-     $output = array();
-     $count = 0;
-     if(!isset($selected)) $selected = '';
-     for ($i = 1; $i <= 31; $i++) {   
-         if ($selected)          { $sel = $selected == $i ? true : false; }
-         elseif ($i == $pc_day)  { $sel = true; } 
-         else                    { $sel = false; }
-         $output[$count]['id']         = sprintf('%02d',$i);
-         $output[$count]['selected']   = $sel;
-         $output[$count++]['name']     = sprintf('%02d',$i);
-     }
-     return $output;
- }
- 
- /**
-  *  Returns an array of form data for FormSelectMultiple
-  */
- function postcalendar_userapi_buildYearSelect($args) 
- {   
-     extract($args);
-     if(!isset($pc_year)) { $pc_year = date('Y'); }
-     // create the return object to be inserted into the form
-     $output = array();
-     // we want the list to contain 10 years before today and 30 years after
-     // maybe this will eventually become a user defined value
-     $pc_start_year = date('Y') - 10;
-     $pc_end_year = date('Y') + 30;
-     $count = 0;
-     if(!isset($selected)) $selected = '';
-     for ($i = $pc_start_year; $i <= $pc_end_year; $i++) {   
-         if ($selected)          { $sel = $selected == $i ? true : false; } 
-         elseif ($i == $pc_year) { $sel = true; } 
-         else                    { $sel = false; }
-         $output[$count]['id']         = sprintf('%04d',$i);
-         $output[$count]['selected']   = $sel;
-         $output[$count++]['name']     = sprintf('%04d',$i);
-     }
-     return $output;
- }
-  
- /**
   *  Return formated date string
   */
--- 120,123 ----
***************
*** 251,292 ****
  } 
  
- /**
-  *  Returns an array of form data for FormSelectMultiple
-  */
- function postcalendar_userapi_buildTimeSelect($args) 
- {   
-     $time24hours = pnModGetVar('postcalendar','time24hours');
-     $inc = 15; // <--- should this be a setting?
-     extract($args);
-     $output         = array();
-     $output['h']    = array();
-     $output['m']    = array();
-     if($time24hours) { 
-         $start=0; $end=23; 
-     } else { 
-         $start=1; $end=12;
-         $hselected = $hselected > 12 ? $hselected-=12 : $hselected; 
-     }
-     
-     $count = 0;
-     for ($h = $start; $h <= $end; $h++) {   
-         $hour = sprintf('%02d',$h);
-         $output['h'][$count]['id']         = pnVarPrepForStore($h);
-         $output['h'][$count]['selected']   = $hselected == $hour;
-         $output['h'][$count]['name']       = pnVarPrepForDisplay($hour);
-         $count++;
-     }
-     
-     $count = 0;
-     for ($m = 0; $m <= 60-$inc; $m+=$inc) {   
-         $min = sprintf('%02d',$m);
-         $output['m'][$count]['id']         = pnVarPrepForStore($m);
-         $output['m'][$count]['selected']   = $mselected == $min;
-         $output['m'][$count]['name']       = pnVarPrepForDisplay($min);
-         $count++;
-     }
-     return $output;
- }
- 
  function postcalendar_userapi_getTime($args) 
  {
--- 137,140 ----
***************
*** 1691,1723 ****
      
      return $days;
- }
- 
- function postcalendar_userapi_getCategories()
- {
-     pnModDBInfoLoad('postcalendar');
-     list($dbconn) = pnDBGetConn();
-     $pntable = pnDBGetTables();
-     $cat_table = $pntable['postcalendar_categories'];
-     $sql = "SELECT pc_catid,pc_catname,pc_catcolor,pc_catdesc
-             FROM $cat_table";
-     $result = $dbconn->Execute($sql);
-     
-     if($dbconn->ErrorNo() != 0) { return array(); }
-     if(!isset($result)) { return array(); }
-     
-     $categories = array();
-     for($i=0; !$result->EOF; $result->MoveNext()) {
-         list($catid,$catname,$catcolor,$catdesc) = $result->fields;
-         // check the category's permissions
-         if (!pnSecAuthAction(0,'PostCalendar::Event',":$catname:",ACCESS_OVERVIEW)) {
-             continue;
-         }
-         $categories[$i]['id']     = $catid;
-         $categories[$i]['name']   = $catname;
-         $categories[$i]['color']  = $catcolor;
-         $categories[$i++]['desc'] = $catdesc;
-      }
-     $result->Close();
-     return $categories;   
  }
  ?>
--- 1539,1542 ----


Directory filter : [ all ] / postnuke_modules / postcalendar [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3