# 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: edit.php,v 1.5 2005/03/11 15:18:37 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $item = null; if (isset($_GET['id'])) { $item = $db->selectObject("imagemanageritem", "id=" . $_GET['id']); $loc = unserialize($item->location_data); } if ($item == null && pathos_permissions_check("post", $loc) || $item != null && pathos_permissions_check("edit", $loc)) { $form = imagemanageritem::form($item); $form->location($loc); $form->meta("action", "save"); $template = new template("imagemanagermodule", "_form_edit", $loc); $directory = BASE . "files/imagemanagermodule/" . $loc->src; if (!isset($item->id) && !is_really_writable($directory)) { $template->assign("dir_not_writable", 1); $form->controls['submit']->disabled = 1; } else { $template->assign("dir_not_writable", 0); } $template->assign("form_html", $form->toHTML()); $template->assign("is_edit", isset($_GET['id'])); $template->output(); } else { echo SITE_403_HTML;
# Exponent is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU # General Public License along with Exponent; if # not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: imgmgr_move.php,v 1.1 2005/04/18 01:27:23 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } // PERM CHECK $form = imagemanageritem::form(null); $form->unregister('maxsizemsg'); $form->unregister('file'); $form->meta('imgmgr_src', $_GET['ss']); $form->meta('module', 'imageworkshopmodule'); $form->meta('action', 'imgmgr_save'); $form->meta('file_id', $_GET['file_id']); echo $form->toHTML(); // END PERM CHECK
} $item = null; if (isset($_POST['id'])) { $item = $db->selectObject('imagemanageritem', 'id=' . intval($_POST['id'])); if ($item) { $loc = unserialize($item->location_data); } } if ($item == null && exponent_permissions_check('post', $loc) || $item != null && exponent_permissions_check('edit', $loc)) { // unset the image cache unset($_SESSION['image_cache']); // check for real images. $filenew = $_FILES['file']['tmp_name']; $fileup = getimagesize($filenew); if ($fileup[2] > 0 && $fileup[1] > 0) { $item = imagemanageritem::update($_POST, $item); $item->location_data = serialize($loc); if (!isset($item->id)) { if (!defined('SYS_FILES')) { include_once BASE . 'subsystems/files.php'; } $directory = 'files/imagemanagermodule/' . $loc->src; $fname = null; if (exponent_files_uploadDestinationFileExists($directory, 'file')) { // Auto-uniqify Logic here $fileinfo = pathinfo($_FILES['file']['name']); $fileinfo['extension'] = '.' . $fileinfo['extension']; do { $fname = basename($fileinfo['basename'], $fileinfo['extension']) . uniqid('') . $fileinfo['extension']; } while (file_exists(BASE . $directory . '/' . $fname)); }
# PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU # General Public License along with Exponent; if # not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: imgmgr_save.php,v 1.1 2005/04/18 01:27:23 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } // PERM CHECK $item = imagemanageritem::update($_POST, null); $item->location_data = serialize(pathos_core_makeLocation('imagemanagermodule', $_POST['imgmgr_src'])); $file = $db->selectObject('file', 'id=' . $_POST['file_id']); $new_dir = 'files/imagemanagermodule/' . $_POST['imgmgr_src']; $new_file = time() . '_' . $file->filename; copy(BASE . $file->directory . '/' . $file->filename, BASE . $new_dir . '/' . $new_file); $file->directory = $new_dir; $file->filename = $new_file; unset($file->id); $item->file_id = $db->insertObject($file, 'file'); $db->insertObject($item, 'imagemanageritem'); #echo '<script type="text/javascript">alert("Image Copied Successfully!"); window.close();</script>'; // END PERM CHECK