'calendar', 'noappheader' => True, 'noappfooter' => True, 'nofooter' => True ); $GLOBALS['phpgw_info']['flags'] = $phpgw_flags; include('../../header.inc.php'); $_SESSION['calendar']['user'] = $GLOBALS['phpgw_info']['user']; $_SESSION['calendar']['server'] = $GLOBALS['phpgw_info']['server']; define('PHPGW_API_INC','../../phpgwapi/inc'); include_once(PHPGW_API_INC.'/class.db.inc.php'); $page_content = << PAGE; echo $page_content; $db = new db(); $db->Halt_On_Error = 'no'; $db->connect( $_SESSION['calendar']['server']['db_name'], $_SESSION['calendar']['server']['db_host'], $_SESSION['calendar']['server']['db_port'], $_SESSION['calendar']['server']['db_user'], $_SESSION['calendar']['server']['db_pass'], $_SESSION['calendar']['server']['db_type'] ); if (IsSet($_POST['CAT'])){ if (!preg_match("/[a-zA-Z0-9]+/i",$_POST['CAT'][0])){ echo "Invalid entry:".$_POST['CAT'][0]; return false; } if (strlen($_POST['DAT']) > 0 && !preg_match("/[0123][0-9].[01][0-9].[12][90][0-9][0-9]$/i",$_POST['DAT'])){ echo "Invalid entry:".$_POST['DAT']; return false; } if (IsSet($_POST['DAT'])) $initDate = mktime(null,null,null,substr($_POST['DAT'],3,2),substr($_POST['DAT'],0,2),substr($_POST['DAT'],6,4)); if ($_POST['CAL'][0] != 'run') $user_id = $_POST['CAL'][0]; foreach ($_POST['CAL'] as $cal_uid){ $found = false; foreach($_SESSION['calendar']['cals'] as $grant) if ($cal_uid == $grant['value']) $found = true; if (!$found){ echo "Permission denied, cal. id:".$cal_uid."
"; return; } } foreach($_POST['CAT'] as $catid){ $query = "select cal_id,title,description,datetime,edatetime from phpgw_cal where ".(!$_POST['NORM']?"cal_type = 'H' and":" is_public = 1 and ")." owner = ".$user_id." and (category like '%,".$catid.",%' or category like '%,".$catid."' or category like '".$catid.",%' or category = '".$catid."')".(IsSet($initDate)?" and datetime > ".$initDate:""); if(!$db->query($query)){ print("
Query failed at host:
".$_SESSION['calendar']['server']['db_user']."@".$_SESSION['calendar']['server']['db_host'].":".$_SESSION['calendar']['server']['db_port']."
"); return; } else{ while($db->next_record()){ $entry = $db->row(); $repeated = false; if (!empty($result_)) foreach($result_ as $value){ if ($value['cal_id'] == $entry['cal_id']) $repeated = true; } if(!$repeated) $result_[] = $entry; } } } echo ""; return; } $self = $_SERVER['PHP_SELF']; print(""); print(""); print("
"); print("
"); print("Categoria(s):
"); print("
"); print("Incluir ocorrências do tipo normal:
Usuario:
Apartir da data: dd/mm/aaaa
(caso todas deixar em branco):


"); print(""); ?>