save logo and headline correctly when submit button is pressed

This commit is contained in:
Roland Gruber 2005-07-06 13:48:55 +00:00
parent de42963447
commit a96258b8c8
1 changed files with 24 additions and 22 deletions

View File

@ -63,9 +63,32 @@ if(isset($_GET['abort'])) {
metarefresh('pdfmain.php'); metarefresh('pdfmain.php');
exit; exit;
} }
// set new logo and headline
if ((isset($_GET['headline'])) && ($_GET['logoFile'] != $_SESSION['currentPageDefinitions']['filename'])) {
$_SESSION['currentPageDefinitions']['filename'] = $_GET['logoFile'];
}
if ((isset($_GET['headline'])) && ($_GET['headline'] != $_SESSION['currentPageDefinitions']['headline'])) {
$_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_GET['headline']));
}
if(isset($_POST['defaults'])) {
foreach($_POST['defaults'] as $default) {
switch($default) {
case 'logoFile':
unset($_SESSION['currentPageDefinitions']['filename']);
break;
case 'headline':
unset($_SESSION['currentPageDefinitions']['headline']);
break;
default:
break;
}
}
}
// Check if pdfname is valid, then save current structure to file and go to // Check if pdfname is valid, then save current structure to file and go to
// main pdf structure page // main pdf structure page
elseif(isset($_GET['submit'])) { if(isset($_GET['submit'])) {
if(!isset($_GET['pdfname']) || !preg_match('/[a-zA-Z0-9\-\_\.]+/',$_GET['pdfname'])) { if(!isset($_GET['pdfname']) || !preg_match('/[a-zA-Z0-9\-\_\.]+/',$_GET['pdfname'])) {
StatusMessage('ERROR',_('PDF-structure name not valid'),_('The name for that PDF-structure you submitted is not valid. A valid name must constist at least of one of the following characters \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\',\'.\'.')); StatusMessage('ERROR',_('PDF-structure name not valid'),_('The name for that PDF-structure you submitted is not valid. A valid name must constist at least of one of the following characters \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\',\'.\'.'));
} }
@ -310,27 +333,6 @@ elseif(isset($_GET['down'])) {
} }
} }
if ((isset($_GET['headline'])) && ($_GET['logoFile'] != $_SESSION['currentPageDefinitions']['filename'])) {
$_SESSION['currentPageDefinitions']['filename'] = $_GET['logoFile'];
}
if ((isset($_GET['headline'])) && ($_GET['headline'] != $_SESSION['currentPageDefinitions']['headline'])) {
$_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_GET['headline']));
}
if(isset($_POST['defaults'])) {
foreach($_POST['defaults'] as $default) {
switch($default) {
case 'logoFile':
unset($_SESSION['currentPageDefinitions']['filename']);
break;
case 'headline':
unset($_SESSION['currentPageDefinitions']['headline']);
break;
default:
break;
}
}
}
// Load PDF structure from file if it is not defined in session // Load PDF structure from file if it is not defined in session
if(!isset($_SESSION['currentPDFStructure'])) { if(!isset($_SESSION['currentPDFStructure'])) {
// Load structure file to be edit // Load structure file to be edit