$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. //if($delete[0] == '1') { // $model->delete($name); // http_response::redir('/admin/fotoalbum.php?success=delete'); //} else { // new photo is uploaded, append to model. if ($action == 'new') { $names = $modeld->append("file", array('png', 'jpg'), 1024 * 1024); $modeld->createThumbnail($names[1], true, 150, 150); $name = $names[0]; $model->append($name, $alt, $body); http_response::redir('/admin/fotoalbum.php?success=new'); } else { // update of photo data, save changes. $model->update($name, $alt, $body); http_response::redir('/admin/fotoalbum.php?success=update'); } //}
/** * 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); $name = http_request::getString('name'); $alt = http_request::getString('alt'); $body = http_request::getString('body'); if (!$user->isOnline()) { http_response::redir('/login.php'); } if (!$alt || !$body || count($_FILES) == 0) { form::setSF('newPhoto', array('alt' => $alt, 'body' => $body)); $_SESSION['msg'] = "badData"; http_response::redir('/admin/fotoalbum/ny.php'); } $names = $modeld->append("file", array('png', 'jpg'), 1024 * 1024); $modeld->createThumbnail($names[1], true, 150, 150); //$name = substr($names[0],strrpos($names[0],"/")); $model->append($names[0], $alt, $body); form::clearSF('newPhoto'); $_SESSION['msg'] = "success"; http_response::redir('/admin/fotoalbum.php');