Пример #1
0
 * Elgg map download.
 *
 * @package ElggShareMaps
 */
// Get the guid
$file_guid = elgg_extract('guid', $vars, '');
// set ignore access for loading non public objexts
$ia = elgg_get_ignore_access();
elgg_set_ignore_access(true);
// Read file
$sharemaps = get_entity($file_guid);
if (!$sharemaps) {
    register_error(elgg_echo("sharemaps:downloadfailed"));
    forward();
}
$sharemaps = new SharemapsPluginMap($file_guid);
$mime = $sharemaps->getMimeType();
if (!$mime) {
    $mime = "application/octet-stream";
}
$filename = $sharemaps->originalfilename;
// fix for IE https issue
header("Pragma: public");
header("Content-type: {$mime}");
if (strpos($mime, "image/") !== false || $mime == "application/pdf") {
    header("Content-Disposition: inline; filename=\"{$filename}\"");
} else {
    header("Content-Disposition: attachment; filename=\"{$filename}\"");
}
ob_clean();
flush();
Пример #2
0
<?php

/**
 * Edit a map
 *
 * @package ElggShareMaps
 */
elgg_load_library('elgg:sharemaps');
gatekeeper();
$file_guid = elgg_extract('guid', $vars, '');
$sharemaps = new SharemapsPluginMap($file_guid);
if (!$sharemaps) {
    forward();
}
if (!$sharemaps->canEdit()) {
    forward();
}
$title = elgg_echo('sharemaps:edit');
elgg_push_breadcrumb(elgg_echo('sharemaps'), "sharemaps/all");
elgg_push_breadcrumb($sharemaps->title, $sharemaps->getURL());
elgg_push_breadcrumb($title);
elgg_set_page_owner_guid($sharemaps->getContainerGUID());
$form_vars = array('enctype' => 'multipart/form-data');
$fname = $sharemaps->getFilename();
if (empty($fname)) {
    $gmap = new ElggObject($file_guid);
    if ($gmap) {
        $body_vars = sharemaps_prepare_form_vars_gmaplink($gmap);
        //$body_vars = sharemaps_prepare_form_vars($gmap);
        $content = elgg_view_form('sharemaps/embed', $form_vars, $body_vars);
        //$content = elgg_view_form('sharemaps/upload', $form_vars, $body_vars);
Пример #3
0
<?php

/**
* Elgg map delete
* 
* @package ElggShareMaps
*/
$guid = (int) get_input('guid');
$sharemaps = new SharemapsPluginMap($guid);
if (!$sharemaps->guid) {
    register_error(elgg_echo("sharemaps:deletefailed"));
    forward('sharemaps/all');
}
if (!$sharemaps->canEdit()) {
    register_error(elgg_echo("sharemaps:deletefailed"));
    forward($sharemaps->getURL());
}
$container = $sharemaps->getContainerEntity();
$fname = $sharemaps->getFilename();
if (empty($fname)) {
    $gmap = new ElggObject($guid);
    if (!$gmap->delete()) {
        register_error(elgg_echo("sharemaps:deletefailed"));
    } else {
        system_message(elgg_echo("sharemaps:deleted"));
    }
} else {
    if (!$sharemaps->delete()) {
        register_error(elgg_echo("sharemaps:deletefailed"));
    } else {
        system_message(elgg_echo("sharemaps:deleted"));
Пример #4
0
if ($new_file) {
    // nikos, must have a link
    if (empty($gmaplink)) {
        $error = elgg_echo('sharemaps:nogmaplink');
        register_error($error);
        forward(REFERER);
    }
    $sharemaps = new SharemapsPluginMap();
    $sharemaps->subtype = "sharemaps";
    // if no title on new upload, grab filename
    if (empty($title)) {
        $title = elgg_echo('sharemaps:dosekapoiotitle');
    }
} else {
    // load original file object
    $sharemaps = new SharemapsPluginMap($guid);
    if (!$sharemaps) {
        register_error(elgg_echo('sharemaps:cannotload'));
        forward(REFERER);
    }
    // user must be able to edit map
    if (!$sharemaps->canEdit()) {
        register_error(elgg_echo('sharemaps:noaccess'));
        forward(REFERER);
    }
    if (!$title) {
        // user blanked title, but we need one
        $title = $sharemaps->title;
    }
}
$sharemaps->title = $title;