Project

General

Profile

« Previous | Next » 

Revision 552

Added by thorn almost 17 years ago

added new module-based search-function and publish-by-date code

View differences:

sections_save.php
85 85
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
86 86
			// Update the section record with properties
87 87
			$section_id = $section['section_id'];
88
			$sql = '';
88
			$sql = ''; $publ_start = 0; $publ_end = 0;
89
			$dst = date("I")?" DST":""; // daylight saving time?
89 90
			if(isset($_POST['block'.$section_id]) AND $_POST['block'.$section_id] != '') {
90 91
				$sql = "block = '".$admin->add_slashes($_POST['block'.$section_id])."'";
91
				$query = "UPDATE ".TABLE_PREFIX."sections SET $sql WHERE section_id = '$section_id' LIMIT 1";
92
				if($sql != '') {
93
					$database->query($query);
92
			}
93
			// update publ_start and publ_end, trying to make use of the strtotime()-features like "next week", "+1 month", ...
94
			if(isset($_POST['start_date'.$section_id]) AND isset($_POST['end_date'.$section_id])) {
95
				if(trim($_POST['start_date'.$section_id]) == '0' OR trim($_POST['start_date'.$section_id]) == '') {
96
					$publ_start = 0;
97
				} else {
98
					$publ_start = strtotime($_POST['start_date'.$section_id]);
94 99
				}
100
				if(trim($_POST['end_date'.$section_id]) == '0' OR trim($_POST['end_date'.$section_id]) == '') {
101
					$publ_end = 0;
102
				} else {
103
					$publ_end = strtotime($_POST['end_date'.$section_id], $publ_start);
104
				}
105
				if($sql != '')
106
					$sql .= ",";
107
				$sql .= " publ_start = '".$publ_start."'";
108
				$sql .= ", publ_end = '".$publ_end."'";
95 109
			}
110
			$query = "UPDATE ".TABLE_PREFIX."sections SET $sql WHERE section_id = '$section_id' LIMIT 1";
111
			if($sql != '') {
112
				$database->query($query);
113
			}
96 114
		}
97 115
	}
98 116
}
......
106 124
// Print admin footer
107 125
$admin->print_footer();
108 126

  
109
?>
127
?>

Also available in: Unified diff