Changeset 157
- Timestamp:
- 08/17/05 13:12:00 (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
admin/plog-admin-functions.php (modified) (4 diffs)
-
plog-functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/plog-admin-functions.php
r154 r157 184 184 }; 185 185 186 // do not allow collections with duplicate names, otherwise mod_rewritten links will start 187 // to behave weird. 188 $collection_exists = get_collection_by_name($collection_name); 189 if ($collection_exists) { 190 return array("errors" => 'New collection could not be created, because there already is one named `'.$collection_exists['name'].'`!'); 191 } 192 186 193 $collection_folder = strtolower(sanitize_filename($collection_name)); 187 194 // first try to create the directory, and only if that succeeds, then insert … … 221 228 222 229 $errors = $output = ""; 230 231 $name = trim(SmartStripSlashes($name)); 232 if (empty($name)) { 233 return array("errors" => "Please enter a valid name for the collection"); 234 }; 223 235 224 236 $target_name = strtolower(sanitize_filename($name)); 225 /* 226 if (!is_valid_directory($name)) { 227 $errors .= 'Collection name contains invalid characters!'; 228 return array("errors" => $errors); 229 }; 230 */ 237 231 238 232 239 $errors = $output = ""; … … 240 247 // rename the directory 241 248 // first, get the collection name of our source collection 242 $sql = "SELECT c.path as collection_path 249 $sql = "SELECT c.path as collection_path,name 243 250 FROM ".$TABLE_PREFIX."collections c 244 251 WHERE c.id = '$collection_id'"; … … 246 253 $result = run_query($sql); 247 254 $row = mysql_fetch_assoc($result); 255 256 // do not allow collections with duplicate names, otherwise mod_rewritten links will start 257 // to behave weird. 258 $collection_exists = get_collection_by_name($name); 259 if ($row["name"] != $name && $collection_exists) { 260 return array("errors" => 'Collection `' . $row['name'] . '` could not be renamed to `'.$name.'`, because there is another collection with that name'); 261 } 248 262 249 263 $source_collection_name = $row["collection_path"]; -
trunk/plog-functions.php
r151 r157 84 84 }; 85 85 return $picdata; 86 } 87 88 function get_collection_by_name($name) { 89 global $TABLE_PREFIX; 90 $name = mysql_real_escape_string($name); 91 $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE name = '$name'"; 92 $result = run_query($sql); 93 $collection = mysql_fetch_assoc($result); 94 return $collection; 86 95 } 87 96
Note: See TracChangeset
for help on using the changeset viewer.
