} } } } } if ($bError == false) { $picture->setFilenames($_FILES['file']['name']); $picture->setLocal(1); // try saving file and record if (!move_uploaded_file($_FILES['file']['tmp_name'], $picture->getFilename())) { $tpl->assign('errorfile', ERROR_UPLOAD_UNKNOWN); $bError = true; } else { if ($picture->save()) { if ($redirect == '') { $redirect = 'viewcache.php?cacheid=' . urlencode($picture->getCacheId()); } $tpl->redirect($redirect); } else { $tpl->assign('errorfile', ERROR_UPLOAD_UNKNOWN); $bError = true; } } } } } else { if ($action == 'edit' || $action == 'delete') { $uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : 0; $picture = picture::fromUUID($uuid); if ($picture === null) { $tpl->error(ERROR_PICTURE_NOT_EXISTS);