Advertisement
Guest User

Untitled

a guest
Jun 28th, 2013
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  calendar/common/wbtools.php    | 2 ++
  2.  calendar/cronjobs/eventchk.php | 3 ++-
  3.  calendar/pages/event.php       | 9 +++++----
  4.  calendar/pages/eventcheck.php  | 3 ++-
  5.  4 files changed, 11 insertions(+), 6 deletions(-)
  6.  
  7. diff --git a/calendar/common/wbtools.php b/calendar/common/wbtools.php
  8. index 74d03dd..64103c0 100644
  9. --- a/calendar/common/wbtools.php
  10. +++ b/calendar/common/wbtools.php
  11. @@ -109,6 +109,8 @@ function createDbTable($tableName, $calID='x') { //create database table
  12.             a_date DATE NOT NULL DEFAULT '9999-00-00',
  13.             m_date DATE NOT NULL DEFAULT '9999-00-00',
  14.             status TINYINT(1) NOT NULL DEFAULT '0',
  15. +           a_time DATE NOT NULL DEFAULT '99:00:00',
  16. +           m_time DATE NOT NULL DEFAULT '99:00:00',
  17.             PRIMARY KEY (event_id)
  18.         )");
  19.         break;
  20. diff --git a/calendar/cronjobs/eventchk.php b/calendar/cronjobs/eventchk.php
  21. index 62553f6..2f84fd9 100644
  22. --- a/calendar/cronjobs/eventchk.php
  23. +++ b/calendar/cronjobs/eventchk.php
  24. @@ -21,12 +21,13 @@ function cronEventChk() {
  25.    
  26.     //initialize
  27.     $todayD = date("Y-m-d");
  28. +   $todayT = date("H:i:s");
  29.     $expireD = date("Y-m-d",time() - ($set['eventExp'] * 86400)); //expire date
  30.  
  31.     //delete events (set status to -1) which expired >= $set['eventExp'] days ago
  32.     $result = dbQuery("UPDATE [db]events e
  33.         INNER JOIN [db]categories c ON c.category_id = e.category_id
  34. -       SET e.status = -1, e.m_date = '".$todayD."'
  35. +       SET e.status = -1, e.m_date = '".$todayD."', e.m_time = '".$todayT."'
  36.         WHERE ((c.rpeat = 0 AND e.r_type = 0 AND (IF(e.e_date != '9999-00-00', e.e_date, e.s_date) <= '$expireD')) OR e.r_until <= '$expireD')
  37.     ");
  38.     $nrDeleted = mysql_affected_rows();
  39. diff --git a/calendar/pages/event.php b/calendar/pages/event.php
  40. index ca4ceab..e0cf472 100644
  41. --- a/calendar/pages/event.php
  42. +++ b/calendar/pages/event.php
  43. @@ -247,6 +247,7 @@ if($tit != "Demande" && $tit != "Proposition" && $tit != "Acceptation") $tit = "
  44.  $non = isset($_POST['non']) ? ($_POST['non'] == 'yes' ? 1 : 0) : 0; //notify now
  45.  $oUid = isset($_POST['oUid']) ? $_POST['oUid'] : $uid; //remember original user ID
  46.  $todayD = date("Y-m-d");
  47. +$todayT = date("H:i:s");
  48.  
  49.  //check rights
  50.  $mayEdit = ($privs > 2 or ($privs == 2 and $uid == $_SESSION['uid'])) ? true : false; //edit rights
  51. @@ -366,7 +367,7 @@ if ($mayEdit) { //last minute rights check
  52.    
  53.         //update tables
  54.         if ($mode == "add_exe") { //add new event
  55. -           $q = "INSERT INTO [db]events VALUES (NULL,DEFAULT,'$titEsc','$desEsc',$cid,'$venEsc',$uid,DEFAULT,$apd,$pri,DEFAULT,'$sdate','$edate',DEFAULT,'$stime','$etime',$r_t,$r_i,$r_p,$r_m,'$runtil',$not,'$nml','".$todayD."',DEFAULT,DEFAULT)";
  56. +           $q = "INSERT INTO [db]events VALUES (NULL,DEFAULT,'$titEsc','$desEsc',$cid,'$venEsc',$uid,DEFAULT,$apd,$pri,DEFAULT,'$sdate','$edate',DEFAULT,'$stime','$etime',$r_t,$r_i,$r_p,$r_m,'$runtil',$not,'$nml','".$todayD."',DEFAULT,DEFAULT, '$todayT', DEFAULT)";
  57.             $result = dbQuery($q); //add to events table
  58.             $eid = mysql_insert_id(); //set id to new event
  59.             $cMsg .= $xx['evt_confirm_added'];
  60. @@ -375,14 +376,14 @@ if ($mayEdit) { //last minute rights check
  61.             $mda = $todayD;
  62.             if ($editN != 1) { //update the series
  63.                 $q = "UPDATE [db]events
  64. -                   SET title='$titEsc', venue='$venEsc', description='$desEsc', approved=$apd, private=$pri, category_id=$cid, user_id=$uid, not_mail='$nml', editor='$uname', s_date='$sdate', e_date='$edate', s_time='$stime', e_time='$etime', r_type=$r_t, r_interval=$r_i, r_period=$r_p, r_month=$r_m, r_until='$runtil', notify=$not, m_date='$todayD'
  65. +                   SET title='$titEsc', venue='$venEsc', description='$desEsc', approved=$apd, private=$pri, category_id=$cid, user_id=$uid, not_mail='$nml', editor='$uname', s_date='$sdate', e_date='$edate', s_time='$stime', e_time='$etime', r_type=$r_t, r_interval=$r_i, r_period=$r_p, r_month=$r_m, r_until='$runtil', notify=$not, m_date='$todayD', m_time = '$todayT'
  66.                     WHERE event_id=$eid";
  67.                 $result = dbQuery($q); //update events table
  68.                 $cMsg .= $xx['evt_confirm_saved'];
  69.             } else { //update 1 occurrence
  70.                 $xda .= ';'.$evD;
  71. -               $result = dbQuery("UPDATE [db]events SET x_dates='$xda', editor='$uname', m_date='$todayD' WHERE event_id=$eid"); //exclude date from series
  72. -               $q = "INSERT INTO [db]events VALUES (NULL,DEFAULT,'$titEsc','$desEsc',$cid,'$venEsc',$uid,'".$uname."',$apd,$pri,DEFAULT,'$sdate','$edate',DEFAULT,'$stime','$etime',$r_t,$r_i,$r_p,$r_m,'$runtil',$not,'$nml','".$ada."','".$todayD."',DEFAULT)";
  73. +               $result = dbQuery("UPDATE [db]events SET x_dates='$xda', editor='$uname', m_date='$todayD', m_time = '$todayT' WHERE event_id=$eid"); //exclude date from series
  74. +               $q = "INSERT INTO [db]events VALUES (NULL,DEFAULT,'$titEsc','$desEsc',$cid,'$venEsc',$uid,'".$uname."',$apd,$pri,DEFAULT,'$sdate','$edate',DEFAULT,'$stime','$etime',$r_t,$r_i,$r_p,$r_m,'$runtil',$not,'$nml','".$ada."','".$todayD."',DEFAULT, '$todayT', DEFAULT)";
  75.                 $result = dbQuery($q); //add new event
  76.                 $eid = mysql_insert_id(); //set id to new event
  77.                 $editN = 0;
  78. diff --git a/calendar/pages/eventcheck.php b/calendar/pages/eventcheck.php
  79. index f120d81..1a3f902 100644
  80. --- a/calendar/pages/eventcheck.php
  81. +++ b/calendar/pages/eventcheck.php
  82. @@ -56,6 +56,7 @@ if (!isset($_POST['checkExe'])) { //get event details
  83.  //update database
  84.  if (isset($_POST['checkExe'])) {
  85.     $mda = date("Y-m-d");
  86. +   $todayT = date("H:i:s");
  87.     //set checked
  88.     if ($chk) {
  89.         if (!strpos($chd, $evD)) { $chd .= ";$evD"; } //check
  90. @@ -63,7 +64,7 @@ if (isset($_POST['checkExe'])) {
  91.         $chd = str_replace(";$evD",'',$chd);
  92.     }
  93.     $q = "UPDATE [db]events
  94. -   SET checked='$chd', editor='$uname', m_date='$mda'
  95. +   SET checked='$chd', editor='$uname', m_date='$mda', m_time = '$todayT'
  96.     WHERE event_id=$eid";
  97.     $result = dbQuery($q); //update events table
  98.     //refresh calendar and close event window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement