public function delete($names) { $model = new model_dir(IMAGES); $images = $this->getElementsByTagName('photo'); $parent = $this->documentElement; $todo = $this->createElement('todo'); $parent->appendChild($todo); $i = 0; for ($j = 0; $j < $images->length; $j++) { if (in_array($images->item($j)->getAttribute('name'), $names)) { $model->remove(IMAGES . '/' . $images->item(0)->getAttribute('name')); $todo->appendChild($images->item(0)); } } $parent->removeChild($todo); $this->save(ROOT . '/cache/photos.xml'); }
<?php /** * do.login.php * * login script * @author Anders Ytterström <*****@*****.**> * @since 2007-08-13 */ require '../init.php'; $registry =& registry::getInstance(); $user =& user::getInstance(); $model = new model_photos(); $modeld = new model_dir(IMAGES); // fetch inputs $name = http_request::getString('name'); $alt = http_request::getString('alt'); $body = http_request::getString('body'); //$delete = http_request::getCheckboxes('delete',array('1')); $action = http_request::getString('action'); // conditions for further execution if (!$user->isOnline()) { http_response::redir('/login.php'); } if (!$alt || !$body || $action == "new" && count($_FILES) == 0) { echo $alt . "<br>"; echo $body . "<br>"; // redirect and tell user that input contained errors. die("sopa"); } // delete action is chosen, delete photo.