--- /tmp/dsg/dolibarr/htdocs/public/agenda/github_19.0.3_agendaexport.php +++ /tmp/dsg/dolibarr/htdocs/public/agenda/client_agendaexport.php @@ -31,21 +31,7 @@ -if (!defined('NOTOKENRENEWAL')) { - define('NOTOKENRENEWAL', '1'); -} -if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); // If there is no menu to show -} -if (!defined('NOREQUIREHTML')) { - define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -} -if (!defined('NOREQUIREAJAX')) { - define('NOREQUIREAJAX', '1'); -} -if (!defined('NOLOGIN')) { - define("NOLOGIN", 1); // This means this output page does not require to be logged. -} -if (!defined('NOCSRFCHECK')) { - define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. -} -if (!defined('NOIPCHECK')) { - define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -} +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. +if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip @@ -75,8 +60,0 @@ -// For MultiCompany module. -// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_numeric($entity)) { - define("DOLENTITY", $entity); -} - -// Load Dolibarr environment @@ -86 +64,2 @@ -$object = new ActionComm($db); +// Security check +if (empty($conf->agenda->enabled)) accessforbidden('', 0, 0, 1); @@ -89,3 +68 @@ -if (!getDolGlobalString('MAIN_AGENDA_EXPORT_PAST_DELAY')) { - $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit -} +if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit @@ -96,6 +73,2 @@ -if (GETPOST("format", 'alpha')) { - $format = GETPOST("format", 'alpha'); -} -if (GETPOST("type", 'alpha')) { - $type = GETPOST("type", 'alpha'); -} +if (GETPOST("format", 'alpha')) $format = GETPOST("format", 'apha'); +if (GETPOST("type", 'apha')) $type = GETPOST("type", 'alpha'); @@ -104,48 +77,11 @@ -if (GETPOST("year", 'int')) { - $filters['year'] = GETPOST("year", 'int'); -} -if (GETPOST("id", 'int')) { - $filters['id'] = GETPOST("id", 'int'); -} -if (GETPOST("idfrom", 'int')) { - $filters['idfrom'] = GETPOST("idfrom", 'int'); -} -if (GETPOST("idto", 'int')) { - $filters['idto'] = GETPOST("idto", 'int'); -} -if (GETPOST("project", 'alpha')) { - $filters['project'] = GETPOST("project", 'alpha'); -} -if (GETPOST("logina", 'alpha')) { - $filters['logina'] = GETPOST("logina", 'alpha'); -} -if (GETPOST("logint", 'alpha')) { - $filters['logint'] = GETPOST("logint", 'alpha'); -} -if (GETPOST("notactiontype", 'alpha')) { - $filters['notactiontype'] = GETPOST("notactiontype", 'alpha'); -} -if (GETPOST("actiontype", 'alpha')) { - $filters['actiontype'] = GETPOST("actiontype", 'alpha'); -} -if (GETPOST("notolderthan", 'int')) { - $filters['notolderthan'] = GETPOST("notolderthan", "int"); -} else { - $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; -} -if (GETPOST("module", 'alpha')) { - $filters['module'] = GETPOST("module", 'alpha'); -} -if (GETPOST("status", 'int')) { - $filters['status'] = GETPOST("status", 'int'); -} - -// Security check -if (!isModEnabled('agenda')) { - httponly_accessforbidden('Module Agenda not enabled'); -} - - -/* - * View - */ +if (GETPOST("year", 'int')) $filters['year'] = GETPOST("year", 'int'); +if (GETPOST("id", 'int')) $filters['id'] = GETPOST("id", 'int'); +if (GETPOST("idfrom", 'int')) $filters['idfrom'] = GETPOST("idfrom", 'int'); +if (GETPOST("idto", 'int')) $filters['idto'] = GETPOST("idto", 'int'); +if (GETPOST("project", 'apha')) $filters['project'] = GETPOST("project", 'apha'); +if (GETPOST("logina", 'apha')) $filters['logina'] = GETPOST("logina", 'apha'); +if (GETPOST("logint", 'apha')) $filters['logint'] = GETPOST("logint", 'apha'); +if (GETPOST("notactiontype", 'apha')) $filters['notactiontype'] = GETPOST("notactiontype", 'apha'); +if (GETPOST("actiontype", 'apha')) $filters['actiontype'] = GETPOST("actiontype", 'apha'); +if (GETPOST("notolderthan", 'int')) $filters['notolderthan'] = GETPOST("notolderthan", "int"); +else $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; @@ -154 +90,2 @@ -if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { +if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) +{ @@ -170 +107 @@ - print '
'.implode('
', $hookmanager->errors).'
'; + print '
'.implode('
', $hookmanager->errors).'
'; @@ -175 +112,2 @@ -} elseif (empty($reshook)) { +} +elseif (empty($reshook)) { @@ -192 +130,2 @@ -foreach ($filters as $key => $value) { +foreach ($filters as $key => $value) +{ @@ -194,33 +133,8 @@ - if ($key == 'year') { - $filename .= '-year'.$value; - } - if ($key == 'id') { - $filename .= '-id'.$value; - } - if ($key == 'idfrom') { - $filename .= '-idfrom'.$value; - } - if ($key == 'idto') { - $filename .= '-idto'.$value; - } - if ($key == 'project') { - $filename .= '-project'.$value; - } - if ($key == 'logina') { - $filename .= '-logina'.$value; // Author - } - if ($key == 'logint') { - $filename .= '-logint'.$value; // Assigned to - } - if ($key == 'notactiontype') { - $filename .= '-notactiontype'.$value; - } - if ($key == 'actiontype') { - $filename .= '-actiontype'.$value; - } - if ($key == 'module') { - $filename .= '-module'.$value; - } - if ($key == 'status') { - $filename .= '-status'.$value; - } + if ($key == 'year') $filename .= '-year'.$value; + if ($key == 'id') $filename .= '-id'.$value; + if ($key == 'idfrom') $filename .= '-idfrom'.$value; + if ($key == 'idto') $filename .= '-idto'.$value; + if ($key == 'project') $filename .= '-project'.$value; + if ($key == 'logina') $filename .= '-logina'.$value; // Author + if ($key == 'logint') $filename .= '-logint'.$value; // Assigned to + if ($key == 'notactiontype') $filename .= '-notactiontype'.$value; @@ -229,13 +143,7 @@ -if ($format == 'vcal') { - $shortfilename .= '.vcs'; - $filename .= '.vcs'; -} -if ($format == 'ical') { - $shortfilename .= '.ics'; - $filename .= '.ics'; -} -if ($format == 'rss') { - $shortfilename .= '.rss'; - $filename .= '.rss'; -} -if ($shortfilename == 'dolibarrcalendar') { +if ($format == 'vcal') { $shortfilename .= '.vcs'; $filename .= '.vcs'; } +if ($format == 'ical') { $shortfilename .= '.ics'; $filename .= '.ics'; } +if ($format == 'rss') { $shortfilename .= '.rss'; $filename .= '.rss'; } + +if ($shortfilename == 'dolibarrcalendar') +{ + $langs->load("main"); @@ -252,3 +160 @@ -if (getDolGlobalString('MAIN_AGENDA_EXPORT_CACHE')) { - $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE; -} +if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE; @@ -259 +165,2 @@ -if ($format == 'ical' || $format == 'vcal') { +if ($format == 'ical' || $format == 'vcal') +{ @@ -261 +168,2 @@ - if ($result >= 0) { + if ($result >= 0) + { @@ -263,3 +171 @@ - if (isset($_GET["attachment"])) { - $attachment = $_GET["attachment"]; - } + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; @@ -268,3 +174 @@ - if (isset($_GET["contenttype"])) { - $contenttype = $_GET["contenttype"]; - } + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; @@ -274,12 +178,5 @@ - if ($contenttype) { - header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); - } - if ($attachment) { - header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); - } - - if ($cachedelay) { - header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); - } else { - header('Cache-Control: private, must-revalidate'); - } + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); + if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); + + if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); + else header('Cache-Control: private, must-revalidate'); @@ -290,3 +187 @@ - if (!$result) { - print 'File '.$outputfile.' was empty.'; - } + if (!$result) print 'File '.$outputfile.' was empty.'; @@ -296 +191,3 @@ - } else { + } + else + { @@ -303 +200,2 @@ -if ($format == 'rss') { +if ($format == 'rss') +{ @@ -305 +203,2 @@ - if ($result >= 0) { + if ($result >= 0) + { @@ -307,3 +206 @@ - if (isset($_GET["attachment"])) { - $attachment = $_GET["attachment"]; - } + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; @@ -312,3 +209 @@ - if (isset($_GET["contenttype"])) { - $contenttype = $_GET["contenttype"]; - } + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; @@ -318,6 +213,2 @@ - if ($contenttype) { - header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); - } - if ($attachment) { - header('Content-Disposition: attachment; filename="'.$filename.'"'); - } + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); + if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); @@ -328,5 +219,2 @@ - if ($cachedelay) { - header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); - } else { - header('Cache-Control: private, must-revalidate'); - } + if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); + else header('Cache-Control: private, must-revalidate'); @@ -337,3 +225 @@ - if (!$result) { - print 'File '.$outputfile.' was empty.'; - } + if (!$result) print 'File '.$outputfile.' was empty.'; @@ -343 +229,3 @@ - } else { + } + else + {