コード例 #1
0
#
# 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: edit_slide.php,v 1.4 2005/02/23 23:30:27 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$slide = null;
if (isset($_GET['id'])) {
    $slide = $db->selectObject('slideshow_slide', 'id=' . $_GET['id']);
    if ($slide) {
        $loc = unserialize($slide->location_data);
    }
}
if ($slide == null && pathos_permissions_check('create_slide', $loc) || $slide != null && pathos_permissions_check('edit_slide', $loc)) {
    $form = slideshow_slide::form($slide);
    $form->location($loc);
    $form->meta('action', 'save_slide');
    $template = new template('slideshowmodule', '_form_editSlide', $loc);
    $template->assign('is_edit', $slide != null ? 1 : 0);
    $template->assign('form_html', $form->toHTML());
    $template->output();
}
コード例 #2
0
# Boston, MA 02111-1307  USA
#
# $Id: save_slide.php,v 1.6 2005/05/09 06:01:45 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$slide = null;
if (isset($_POST['id'])) {
    $slide = $db->selectObject('slideshow_slide', 'id=' . $_POST['id']);
    if ($slide) {
        $loc = unserialize($slide->location_data);
    }
}
if ($slide == null && pathos_permissions_check('create_slide', $loc) || $slide != null && pathos_permissions_check('edit_slide', $loc)) {
    $slide = slideshow_slide::update($_POST, $slide);
    $slide->location_data = serialize($loc);
    $directory = 'files/slideshowmodule/' . $loc->src;
    $file = file::update('file', $directory, null);
    if (is_object($file)) {
        if (isset($slide->id)) {
            // We have a slide already.  Delete the old one
            $oldfile = $db->selectObject('file', 'id=' . $slide->file_id);
            file::delete($oldfile);
        }
        $slide->file_id = $db->insertObject($file, 'file');
    } else {
        // If file::update() returns a non-object, it should be a string.  That string is the error message.
        $post = $_POST;
        $post['_formError'] = $file;
        pathos_sessions_set('last_POST', $post);