// This goes against stricter security, but it confuses users to have
     // to re-approve events they already approved.
     if ($participants[$i] == "__public__" && $is_admin && $old_status['__public__'] == 'A') {
         $status = 'A';
     }
     $my_cat_id = $participants[$i] != $login ? $tmp_cat : $cat_id;
     // If user is admin and
     // if it's a global cat, then set it for other users as well.
     if ($is_admin && !empty($categories[$cat_id]) && empty($category_owners[$cat_id])) {
         // found categ. and owner set to NULL; it is global
         $my_cat_id = $cat_id;
     }
 } else {
     // New Event
     $send_user_mail = true;
     $status = $participants[$i] != $login && boss_must_approve_event($login, $participants[$i]) && $require_approvals == "Y" && !$is_nonuser_admin ? "W" : "A";
     // If admin, no need to approve Public Access Events
     if ($participants[$i] == "__public__" && $is_admin) {
         $status = "A";
     }
     if ($participants[$i] == $login) {
         $my_cat_id = $cat_id;
     } else {
         // if it's a global cat, then set it for other users as well.
         if (!empty($categories[$cat_id]) && empty($category_owners[$cat_id])) {
             // found cat. and owner set to NULL; it is global
             $my_cat_id = $cat_id;
         } else {
             // not global category
             $my_cat_id = 'NULL';
         }
Beispiel #2
0
           $status = $participants[$i] != $login && boss_must_approve_event($login, $participants[$i]) && $REQUIRE_APPROVALS == 'Y' && !$is_nonuser_admin ? $tmp_status : 'A';
           // Set percentage to old_percent if not owner.
           $tmp_percent = empty($old_percent[$participants[$i]]) ? 0 : $old_percent[$participants[$i]];
           // TODO:  This logic needs work.
           $new_percent = $participants[$i] != $login ? $tmp_percent : $percent;
           // If user is admin and this event was previously approved for public,
           // keep it as approved even though date/time may have changed.
           // This goes against stricter security, but it confuses users to have
           // to re-approve events they already approved.
           if ($participants[$i] == '__public__' && $is_admin && (empty($old_status['__public__']) || $old_status['__public__'] == 'A')) {
               $status = 'A';
           }
       } else {
           // New Event.
           $send_user_mail = true;
           $status = $participants[$i] != $login && boss_must_approve_event($login, $participants[$i]) && $REQUIRE_APPROVALS == 'Y' && !$is_nonuser_admin ? 'W' : 'A';
           $new_percent = $participants[$i] != $login ? 0 : $percent;
           // If admin, no need to approve Public Access Events
           if ($participants[$i] == '__public__' && $is_admin) {
               $status = 'A';
           }
       }
   }
   //end new/old event
   // Some users report that they get an error on duplicate keys
   // on the following add... As a safety measure, delete any
   // existing entry with the id. Ignore the result.
   dbi_execute('DELETE FROM webcal_entry_user WHERE cal_id = ? AND cal_login = ?', array($id, $participants[$i]));
   if (!dbi_execute('INSERT INTO webcal_entry_user ( cal_id, cal_login,
 cal_status, cal_percent ) VALUES ( ?, ?, ?, ? )', array($id, $participants[$i], $status, $new_percent))) {
       $error = $dberror . dbi_error();