<?php // $Id: move.php,v 1.1.2.1 2006/12/05 10:05:29 janne Exp $ /// This script does the actual removing images from /// the database and filesystem. require_once "../../config.php"; require_once "lib.php"; $sesskey = required_param('sesskey', PARAM_ALPHANUM); $imageids = required_param('image', PARAM_NOTAGS); $galleryid = required_param('gallery', PARAM_INT); $catid = optional_param('category', PARAM_INT); $gallery = new modImagegallery(); // Instantiate imagegallery object. if (!$gallery->user_allowed_editing()) { error("You're not allowed to use this page!!!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } if (!confirm_sesskey($sesskey)) { error("Session key error!!!"); } $arrimages = explode(",", $imageids); if (empty($arrimages) && !is_array($arrimages)) { error("Could not find any images to move!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } if ($images = get_records_select("imagegallery_images", "id IN (" . addslashes($imageids) . ")")) { $sql = "UPDATE {$CFG->prefix}imagegallery_images "; $sql .= "SET galleryid = '{$galleryid}', categoryid = "; $sql .= "'{$catid}' WHERE id IN (" . addslashes($imageids) . ")"; if (execute_sql($sql, false)) { $count = 1; $strimages = ''; foreach ($images as $image) {
$action = 'add'; } else { if (!empty($edit)) { $action = 'edit'; } else { if (!empty($delete)) { $action = 'delete'; } else { $action = optional_param('action', '', PARAM_ALPHA); } } } if (!confirm_sesskey($sesskey)) { error("Session key error!!!"); } $gallery = new modImagegallery(); // Instantiate imagegallery object. if (!$gallery->isteacher) { error("You're not allowed to use this page!!!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } // Check directory if (!$gallery->file_area()) { error("Could not create necessary directory!", "{$CFG->wwwroot}/course/view.php?id={$gallery->course->id}"); } if ($data = data_submitted()) { if (empty($data->cancel)) { $form = new stdClass(); $form->galleryid = clean_param($data->galleryid, PARAM_INT); $form->userid = clean_param($USER->id, PARAM_INT); switch ($data->action) { case 'add':
<?php // $Id: action.php,v 1.1.2.1 2006/12/05 10:05:29 janne Exp $ /// This page handels image deleting and image moving to another category. require_once "../../config.php"; require_once "lib.php"; $sesskey = required_param('sesskey', PARAM_ALPHANUM); $imageids = required_param('image', PARAM_NOTAGS); $catid = required_param('catid', PARAM_INT); $action = optional_param('action', '', PARAM_NOTAGS); $gallery = new modImagegallery(); // Instantiate imagegallery object. if (!$gallery->user_allowed_editing()) { error("You're not allowed to use this page!!!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } if (!confirm_sesskey($sesskey)) { error("Session key error!!!"); } if (is_array($imageids)) { // clean image id array. $arrayimages = array(); foreach ($imageids as $key => $value) { array_push($arrayimages, intval($value)); } $strimageids = implode(",", $arrayimages); $select = "galleryid = {$gallery->module->id} AND "; $select .= "categoryid = {$catid} AND "; $select .= "id IN ({$strimageids})"; $images = get_records_select("imagegallery_images", $select, 'id', 'id, name, userid, path'); $strimagegalleries = get_string("modulenameplural", "imagegallery"); $strimagegallery = get_string("modulename", "imagegallery");
<?php // $Id: upload.php,v 1.9 2006/10/17 10:24:47 janne Exp $ /// This page handles uploads for imagegallery. require_once "../../config.php"; require_once "lib.php"; $id = required_param('id', PARAM_ALPHA); // Module instance id. $skey = required_param('sesskey', PARAM_ALPHANUM); // Session key. $catid = optional_param('categoryid', 0, PARAM_INT); // Category id. $gallery = new modImagegallery(); // Instantiate imagegallery object. if (!confirm_sesskey($skey)) { error("Session key error!!!"); } if (!$gallery->user_allowed_upload()) { error(get_string('unallowedupload', 'imagegallery'), "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } if (!($category = get_record("imagegallery_categories", "id", $catid))) { $category = new stdClass(); $category->id = 0; } $strsuccess = ''; if ($data = data_submitted()) { include $CFG->libdir . '/filelib.php'; include $CFG->libdir . '/uploadlib.php'; // Process uploaded images or uploaded zip file. $dir = $gallery->file_area($category->id); $um = new upload_manager('userfile', false, true, $gallery->course, false, 0);
<?php // $Id: details.php,v 1.7.2.1 2006/12/05 10:05:29 janne Exp $ /// This page prints a particular instance of learningdiary require_once "../../config.php"; require_once "lib.php"; $imageid = required_param('image', PARAM_INT); $catid = required_param('catid', PARAM_INT); $edit = optional_param('edit', '', PARAM_ALPHA); $page = optional_param('page', 0, PARAM_INT); $sort = optional_param('sort', 'name', PARAM_ALPHA); $dir = optional_param('dir', 'asc', PARAM_ALPHA); $gallery = new modImagegallery(); // Instantiate imagegallery object. $strimagegalleries = get_string("modulenameplural", "imagegallery"); $strimagegallery = get_string("modulename", "imagegallery"); if (!($images = $gallery->get_images_listing($catid, $sort, $dir, $page * $gallery->module->imagesperpage))) { error("Images not found!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } $image = null; if (!empty($images[$imageid])) { $image = $images[$imageid]; } else { error("Image not found!!!!", "{$CFG->wwwroot}/mod/imagegallery/view.php?id={$gallery->cm->id}"); } if ($data = data_submitted()) { $sesskey = required_param('sesskey', PARAM_ALPHANUM); $onerrorurl = "{$CFG->wwwroot}/mod/imagegallery/details.php?id="; $onerrorurl .= "{$gallery->cm->id}&image={$image->id}&"; $onerrorurl .= "page={$page}&sort={$sort}&dir={$dir}"; $file = new stdClass();
<?php // $Id: view.php,v 1.4 2006/10/19 12:06:28 janne Exp $ /// This page prints a particular instance of learningdiary require_once "../../config.php"; require_once "lib.php"; //include_once ("slideshow.php"); $edit = optional_param('edit', '', PARAM_ALPHA); $pageid = optional_param('page', 0, PARAM_INT); $catid = optional_param('catid', '0', PARAM_INT); $sort = optional_param('sort', 'name', PARAM_ALPHA); $dir = optional_param('dir', 'asc', PARAM_ALPHA); $gallery = new modImagegallery(); // Instantiate imagegallery object. // Check directory if (!$gallery->file_area()) { error("Could not create necessary directory!", "{$CFG->wwwroot}/course/view.php?id={$gallery->course->id}"); } if (!isset($USER->editing)) { $USER->editing = false; } $strimagegalleries = get_string("modulenameplural", "imagegallery"); $strimagegallery = get_string("modulename", "imagegallery"); if ($gallery->user_allowed_editing()) { if ($edit == 'on') { $USER->editing = true; } else { if ($edit == 'off') { $USER->editing = false; } }