public function picture_update()
 {
     $validator = Validator::make(Input::all(), file::$rules);
     if ($validator->fails()) {
         Session::flash('error', 'uploaded file is not valid');
         return Redirect::back()->withInput()->withErrors($validator->messages());
     }
     $data = file::where('user_id', '=', Auth::user()->id)->pluck('path');
     $file = Input::file('image');
     $extension = $file->getClientOriginalExtension();
     $filename = Auth::user()->id . '.' . $extension;
     $file->move('uploads', $filename);
     $path = '../uploads/' . $filename;
     $picture = new file();
     $picture->user_id = Auth::user()->id;
     $picture->path = $path;
     if ($data == null) {
         $picture->save();
     } else {
         $picture->update();
     }
     return Redirect::back();
 }
$i18n = exponent_lang_loadFile('modules/importer/importers/usercsv/mapper.php');
//Get the post data for future massaging
$post = $_POST;
//Check to make sure the user filled out the required input.
if (!is_numeric($_POST["rowstart"])) {
    unset($post['rowstart']);
    $post['_formError'] = $i18n['need_number'];
    exponent_sessions_set("last_POST", $post);
    header("Location: " . $_SERVER['HTTP_REFERER']);
    exit('Redirecting...');
}
//Get the temp directory to put the uploaded file
$directory = "modules/importer/importers/usercsv/tmp";
//Get the file save it to the temp directory
if ($_FILES["upload"]["error"] == UPLOAD_ERR_OK) {
    $file = file::update("upload", $directory, null, time() . "_" . $_FILES['upload']['name']);
    if ($file == null) {
        switch ($_FILES["upload"]["error"]) {
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                $post['_formError'] = $i18n['err_file_toolarge'];
                break;
            case UPLOAD_ERR_PARTIAL:
                $post['_formError'] = $i18n['err_file_partial'];
                break;
            case UPLOAD_ERR_NO_FILE:
                $post['_formError'] = $i18n['err_file_none'];
                break;
            default:
                $post['_formError'] = $i18n['err_file_unknown'];
                break;
Exemple #3
0
                file::delete($file);
                $db->delete("file", "id=" . $file->id);
            }
            $file = file::update($filefield, $directory, null);
            if ($file != null) {
                $data->swf_id = $db->insertObject($file, "file");
            }
        }
        $filefield = 'alt_image_name';
        if (isset($_FILES[$filefield]) && $_FILES[$filefield]['name'] != "") {
            if (isset($data->alt_image_id) && $data->alt_image_id != 0) {
                $file = $db->selectObject("file", "id=" . $data->alt_image_id);
                file::delete($file);
                $db->delete("file", "id=" . $file->id);
            }
            $file = file::update($filefield, $directory, null);
            if ($file != null) {
                $data->alt_image_id = $db->insertObject($file, "file");
            }
        }
        if (isset($data->id)) {
            $db->updateObject($data, "swfitem");
        } else {
            $db->insertObject($data, "swfitem");
        }
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
# 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: upload_standalone.php,v 1.1 2005/05/04 19:11:32 filetreefrog Exp $
##################################################
include_once '../../../pathos.php';
$collection = null;
if (isset($_POST['collection_id'])) {
    $collection = $db->selectObject('file_collection', 'id=' . $_POST['collection_id']);
} else {
    $collection->id = 0;
    $collection->name = 'Uncategorized Files';
    $collection->description = 'Theses files have not been categorized yet,';
}
$loc = pathos_core_makeLocation('filemanagermodule');
// PERM CHECK
$file = file::update('file', 'files', null);
if (is_object($file)) {
    $file->name = $_POST['name'];
    $file->collection_id = $collection->id;
    $file_id = $db->insertObject($file, 'file');
    header('Location: ' . URL_FULL . 'modules/filemanagermodule/actions/picker.php?id=' . $collection->id . '&highlight_file=' . $file_id);
} else {
    echo $file;
}
// END PERM CHECK
         if ($_POST['rank'] > $image->rank) {
             // New rank is after the current rank. Item moved down
             $db->decrement('imagegallery_image', 'rank', 1, 'gallery_id=' . $image->gallery_id . ' AND rank < ' . $_POST['rank'] . ' AND rank >= ' . $image->rank);
             $_POST['rank']--;
         }
     }
     // Rank didn't change
     $image->rank = $_POST['rank'];
 } else {
     $image->rank = $_POST['rank'];
     $db->increment('imagegallery_image', 'rank', 1, "gallery_id=" . $image->gallery_id . " AND rank >= " . $_POST['rank'] . " AND rank < " . $image->rank);
 }
 $loc = unserialize($gallery->location_data);
 if (!isset($image->id)) {
     $dir = 'files/imagegallerymodule/' . $loc->src . '/gallery' . $gallery->id;
     $file = file::update('file', $dir, null);
     if (is_object($file)) {
         $image->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);
         header('Location: ' . $_SERVER['HTTP_REFERER']);
     }
 }
 if (isset($image->id)) {
     $db->updateObject($image, 'imagegallery_image');
 } else {
     $image->posted = time();
     $db->insertObject($image, "imagegallery_image");
     $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));
         }
         $file = file::update('file', $directory, null, $fname);
         if (is_object($file)) {
             $item->file_id = $db->insertObject($file, 'file');
             // Make thumbnail?
             $db->insertObject($item, 'imagemanageritem');
             exponent_flow_redirect();
         } else {
             // If file::update() returns a non-object, it should be a string.  That string is the error message.
             $post = $_POST;
             $post['_formError'] = $file;
             exponent_sessions_set('last_POST', $post);
             header('Location: ' . $_SERVER['HTTP_REFERER']);
         }
     }
 } else {
     $db->updateObject($item, 'imagemanageritem');
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$resource = $db->selectObject('resourceitem', 'id=' . intval($_POST['id']));
if ($resource) {
    $loc = unserialize($resource->location_data);
    $iloc = exponent_core_makeLocation($loc->mod, $loc->src, $resource->id);
    if (exponent_permissions_check('edit', $loc) || exponent_permissions_check('edit', $iloc)) {
        $directory = 'files/resourcesmodule/' . $loc->src;
        $file = file::update('file', $directory, null, time() . '_' . $_FILES['file']['name']);
        if (is_object($file)) {
            $id = $db->insertObject($file, 'file');
            $resource->file_id = $id;
            $resource->editor = $user->id;
            $resource->edited = time();
            if (isset($_POST['checkin']) && ($user->is_acting_admin == 1 || $user->id == $resource->flock_owner)) {
                $resource->flock_owner = 0;
            }
            if (!defined('SYS_WORKFLOW')) {
                include_once BASE . 'subsystems/workflow.php';
            }
            exponent_workflow_post($resource, 'resourceitem', $loc);
            unset($_SESSION['resource_cache']);
        } else {
            // If file::update() returns a non-object, it should be a string.  That string is the error message.
    exit('');
}
$banner = null;
if (isset($_POST['id'])) {
    $banner = $db->selectObject('banner_ad', 'id=' . intval($_POST['id']));
    $loc = unserialize($banner->location_data);
}
if (exponent_permissions_check('manage', $loc)) {
    $filenew = $_FILES['file']['tmp_name'];
    $fileup = getimagesize($filenew);
    if ($fileup[2] > 0 && $fileup[1] > 0) {
        $banner = banner_ad::update($_POST, $banner);
        $banner->location_data = serialize($loc);
        if (!isset($banner->file_id)) {
            $directory = 'files/BannerModule/' . $loc->src;
            $file = file::update('file', $directory, null);
            if (is_object($file)) {
                $banner->file_id = $db->insertObject($file, 'file');
                $db->insertObject($banner, 'banner_ad');
            } else {
                // If file::update() returns a non-object, it should be a string.  That string is the error message.
                $post = $_POST;
                $post['_formError'] = $file;
                exponent_sessions_set('last_POST', $post);
                header('Location: ' . $_SERVER['HTTP_REFERER']);
            }
        } else {
            $db->updateObject($banner, 'banner_ad');
        }
        exponent_flow_redirect();
    } else {
# 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: upload_image.php,v 1.1 2005/04/18 01:27:23 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
// PERM CHECK
$image = imageworkshop_image::update($_POST, null);
$file = file::update('file', 'files/imageworkshopmodule/' . $loc->src, null, uniqid('') . '_' . $_FILES['file']['name']);
$image->file_id = $db->insertObject($file, 'file');
$image->is_upload = 1;
$image->location_data = serialize($loc);
$image->rank = $db->max('imageworkshop_image', 'rank', 'location_data', "location_data='" . $image->location_data . "'");
if ($image->rank == null) {
    $image->rank = 0;
} else {
    $image->rank++;
}
$db->insertObject($image, 'imageworkshop_image');
pathos_flow_redirect();
// END PERM CHECK
#
# $Id: save_upload.php,v 1.5 2005/02/19 00:32:32 filetreefrog Exp $
##################################################
//GREP:HARDCODEDTEXT
if (!defined("PATHOS")) {
    exit("");
}
if (pathos_permissions_check("create", $loc)) {
    $t = null;
    if (isset($_POST['id'])) {
        $t = $db->selectObject("htmltemplate", "id=" . $_POST['id']);
    }
    $t = htmltemplate::update($_POST, $t);
    $directory = "files/htmltemplatemodule";
    if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
        $file = file::update("file", $directory, null);
        if ($file != null) {
            $t->body = file_get_contents(BASE . $directory . "/" . $file->filename);
            unlink(BASE . $directory . "/" . $file->filename);
            if (isset($t->id)) {
                $db->updateObject($t, "htmltemplate");
            } else {
                $db->insertObject($t, "htmltemplate");
            }
            pathos_flow_redirect();
        }
    } else {
        $post = $_POST;
        pathos_lang_loadDictionary('modules', 'filemanager');
        switch ($_FILES["file"]["error"]) {
            case UPLOAD_ERR_INI_SIZE:
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$collection = null;
if (isset($_POST['collection_id'])) {
    $collection = $db->selectObject('file_collection', 'id=' . intval($_POST['collection_id']));
}
$loc = exponent_core_makeLocation('FileManagerModule');
if ($collection) {
    // PERM CHECK
    $file = file::update('file', 'files.php', null);
    if (is_object($file)) {
        $file->name = $_POST['name'];
        $file->collection_id = $collection->id;
        $db->insertObject($file, 'file');
        exponent_flow_redirect();
    } else {
        echo $file;
    }
    // END PERM CHECK
} else {
    echo SITE_404_HTML;
}
Exemple #12
0
if (isset($_POST['id'])) {
    $resource = $db->selectObject("resourceitem", "id=" . $_POST['id']);
    $loc = unserialize($resource->location_data);
    $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $resource->id);
}
if ($resource == null && pathos_permissions_check("post", $loc) || $resource != null && pathos_permissions_check("edit", $loc) || $iloc != null && pathos_permissions_check("edit", $iloc)) {
    $resource = resourceitem::update($_POST, $resource);
    $resource->location_data = serialize($loc);
    if (!isset($resource->id)) {
        $resource->rank = $_POST['rank'];
        $db->increment('resourceitem', 'rank', 1, "location_data='" . serialize($loc) . "' AND rank >= " . $resource->rank);
    }
    if (!isset($resource->file_id)) {
        $directory = "files/resourcesmodule/" . $loc->src;
        if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
            $file = file::update("file", $directory, null, time() . "_" . $_FILES['file']['name']);
            if ($file != null) {
                $resource->file_id = $db->insertObject($file, "file");
                $id = $db->insertObject($resource, "resourceitem");
                // Assign new perms on loc
                $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $id);
                pathos_permissions_grant($user, "edit", $iloc);
                pathos_permissions_grant($user, "delete", $iloc);
                pathos_permissions_grant($user, "administrate", $iloc);
                pathos_permissions_triggerSingleRefresh($user);
                if (!defined("SYS_WORKFLOW")) {
                    require_once BASE . "subsystems/workflow.php";
                }
                $resource->id = $id;
                $resource->poster = $user->id;
                $resource->posted = time();
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: save_upload.php,v 1.1 2005/05/04 19:11:32 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$collection = null;
if (isset($_POST['collection_id'])) {
    $collection = $db->selectObject('file_collection', 'id=' . $_POST['collection_id']);
}
$loc = pathos_core_makeLocation('filemanagermodule');
if ($collection) {
    // PERM CHECK
    $file = file::update($_POST['file'], 'files', 'files.php', null);
    if (is_object($file)) {
        $file->name = $_POST['name'];
        $file->collection_id = $collection->id;
        $db->insertObject($file, $_POST['name']);
        pathos_flow_redirect();
    } else {
        echo $file;
    }
    // END PERM CHECK
} else {
    echo SITE_404_HTML;
}
if ($item == null && pathos_permissions_check("post", $loc) || $item != null && pathos_permissions_check("edit", $loc)) {
    $item = imagemanageritem::update($_POST, $item);
    $item->location_data = serialize($loc);
    if (!isset($item->id)) {
        if (!defined("SYS_FILES")) {
            require_once BASE . "subsystems/files.php";
        }
        $directory = "files/imagemanagermodule/" . $loc->src;
        $fname = null;
        if (pathos_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}"));
        }
        $file = file::update("file", $directory, null, $fname);
        if ($file != null) {
            $item->file_id = $db->insertObject($file, "file");
            // Make thumbnail?
            $db->insertObject($item, "imagemanageritem");
            pathos_flow_redirect();
        }
    } else {
        $db->updateObject($item, "imagemanageritem");
        pathos_flow_redirect();
    }
} else {
    echo SITE_403_HTML;
}
Exemple #15
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new file();
    switch ($_REQUEST['act']) {
        case 1:
            // json retrieval & operations
        // json retrieval & operations
        case "json":
            if ($_REQUEST['op'] == 'upload') {
                $tmp_name = $_REQUEST['tmp_name'];
                if ($tmp_name == "{{BASE64}}") {
                    $tmp_name = base64_encode($_REQUEST['name']);
                }
                $file = file::register_upload($tmp_name, $_REQUEST['name'], $_REQUEST['parent']);
                if (!empty($file)) {
                    echo json_encode(array('id' => $file->id, 'name' => $file->name));
                } else {
                    echo json_encode(false);
                }
            }
            switch ($_REQUEST['op']) {
                case 'create_folder':
                    file::create_folder($_REQUEST['name'], $_REQUEST['mime'], $_REQUEST['parent']);
                    echo json_encode(true);
                    break;
                case 'edit_folder':
                    $f = new file();
                    $f->load(intval($_REQUEST['id']));
                    $f->name = $_REQUEST['name'];
                    $f->mime = $_REQUEST['mime'];
                    $ok = $f->save();
                    echo json_encode($ok);
                    break;
                case 'edit_file':
                    $f = new file();
                    $f->load(intval($_REQUEST['id']));
                    $f->name = $_REQUEST['name'];
                    $ok = $f->save();
                    echo json_encode($ok);
                    break;
                case 'duplicate_file':
                    //error_reporting(~0);
                    //ini_set('display_errors', 1);
                    $status = false;
                    $f = new file();
                    $f->load(intval($_REQUEST['id']));
                    $f->id = 0;
                    $f->insert();
                    if (!empty($f->id)) {
                        $done = copy(NAVIGATE_PRIVATE . '/' . $website->id . '/files/' . intval($_REQUEST['id']), NAVIGATE_PRIVATE . '/' . $website->id . '/files/' . $f->id);
                        $status = "true";
                        if (!$done) {
                            $f->delete();
                            $status = t(56, "Unexpected error");
                        }
                    }
                    echo $status;
                    break;
                case 'move':
                    if (is_array($_REQUEST['item'])) {
                        $ok = true;
                        for ($i = 0; $i < count($_REQUEST['item']); $i++) {
                            unset($item);
                            $item = new file();
                            $item->load($_REQUEST['item'][$i]);
                            $item->parent = $_REQUEST['folder'];
                            $ok = $ok & $item->update();
                        }
                        echo json_encode($ok ? true : false);
                    } else {
                        $item->load($_REQUEST['item']);
                        $item->parent = $_REQUEST['folder'];
                        echo json_encode($item->update());
                    }
                    break;
                case 'delete':
                    try {
                        $item->load($_REQUEST['id']);
                        $status = $item->delete();
                        echo json_encode($status);
                    } catch (Exception $e) {
                        echo $e->getMessage();
                    }
                    break;
                case 'permissions':
                    $item->load($_REQUEST['id']);
                    if (!empty($_POST)) {
                        $item->access = intval($_POST['access']);
                        $item->permission = intval($_POST['permission']);
                        $item->enabled = intval($_POST['enabled']);
                        $item->groups = $_POST['groups'];
                        if ($item->access < 3) {
                            $item->groups = array();
                        }
                        $status = $item->save();
                        echo json_encode($status);
                    } else {
                        echo json_encode(array('access' => $item->access, 'groups' => $item->groups, 'permission' => $item->permission, 'enabled' => $item->enabled));
                    }
                    break;
                case 'description':
                    $item->load($_REQUEST['id']);
                    if (!empty($_POST)) {
                        $item->title = array();
                        $item->description = array();
                        foreach ($website->languages as $language) {
                            $lcode = $language['code'];
                            if (!isset($_REQUEST['titles'][$lcode])) {
                                break;
                            }
                            $item->title[$lcode] = $_REQUEST['titles'][$lcode];
                            $item->description[$lcode] = $_REQUEST['descriptions'][$lcode];
                        }
                        $status = $item->save();
                        echo json_encode($status);
                    } else {
                        // return file title and description (alt)
                        $data = array('title' => $item->title, 'description' => $item->description);
                        echo json_encode($data);
                    }
                    break;
                case 'focalpoint':
                    $item->load($_REQUEST['id']);
                    if (!empty($_POST)) {
                        $item->focalpoint = $_REQUEST['top'] . '#' . $_REQUEST['left'];
                        $status = $item->save();
                        // remove cached thumbnails
                        file::thumbnails_remove($item->id);
                        echo json_encode($status);
                    } else {
                        if (empty($item->focalpoint)) {
                            $item->focalpoint = '50#50';
                            $item->save();
                            // remove cached thumbnails
                            file::thumbnails_remove($item->id);
                        }
                        echo $item->focalpoint;
                    }
                    break;
                case 'video_info':
                    if ($_REQUEST['provider'] == 'youtube') {
                        $item->load_from_youtube($_REQUEST['reference'], false);
                        // force cache reload
                    } else {
                        if ($_REQUEST['provider'] == 'vimeo') {
                            $item->load_from_vimeo($_REQUEST['reference'], false);
                            // force cache reload
                        } else {
                            if (!empty($_REQUEST['reference']) && is_numeric($_REQUEST['reference'])) {
                                $item->load($_REQUEST['reference']);
                            } else {
                                if (is_numeric($_REQUEST['provider'])) {
                                    $item->load($_REQUEST['provider']);
                                } else {
                                    unset($item);
                                }
                            }
                            if (!empty($item)) {
                                // add some extra data
                                $item->extra = array('reference' => $item->id, 'link' => '', 'thumbnail' => 'img/icons/ricebowl/mimetypes/video.png', 'thumbnail_big' => 'img/icons/ricebowl/mimetypes/video.png', 'thumbnail_url' => 'img/icons/ricebowl/mimetypes/video.png', 'duration' => '', 'embed_code' => '<video src="' . file::file_url($item->id, 'inline') . '></video>');
                            }
                        }
                    }
                    if (!empty($item)) {
                        echo json_encode($item);
                    } else {
                        echo false;
                    }
                    break;
            }
            session_write_close();
            $DB->disconnect();
            exit;
            break;
        case 2:
            // show/edit item properties
        // show/edit item properties
        case "edit":
            $item->load($_REQUEST['id']);
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    unset($item);
                    $item = new file();
                    $item->load($_REQUEST['id']);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
            }
            $out = files_item_properties($item);
            break;
        case 10:
        case 'media_browser':
            files_media_browser($_GET['limit'], $_GET['offset']);
            break;
        case 92:
            // pixlr (image editor) overlay remover
        // pixlr (image editor) overlay remover
        case 'pixlr_exit':
            ob_clean();
            file::thumbnails_remove(intval($_GET['id']));
            echo '
			<html>
			<head></head>
			<body>
			<script language="javascript" type="text/javascript">
				//window.parent.eval("$(\'#thumbnail-cache\').attr(\'src\', $(\'#thumbnail-cache\').attr(\'src\') + \'&refresh=\' + new Date().getTime());");
				window.parent.eval(\'$("#image-preview").attr("src", $("#image-preview").attr("src") + "&refresh=" + new Date().getTime());\');
				window.parent.eval("pixlr.overlay.hide();");
			</script>
			</body>
			</html>	
			';
            core_terminate();
            break;
            /*	
            case 91: // picnik editing
            	ob_clean();
            	
            	// $strPicnikUrl is the URL that we use to launch Picnik.
            	$strPicnikUrl = "http://www.picnik.com/service";	
            	// $aPicnikParams collects together all the params we'll give Picnik.  Start with an API key
            	$aPicnikParams['_apikey'] = $website->picnik_api_key;
            	// tell Picnik where to send the exported image
            	$aPicnikParams['_export'] = NAVIGATE_URL.'/navigate_upload.php?wid='.$website->id.'&engine=picnik&id='.$_REQUEST['id'].'&engine=picnik&session_id='.session_id();
            	// give the export button a title
            	$aPicnikParams['_export_title'] = t(34, 'Save');
            	// turn on the close button, and tell it to come back here
            	//$aPicnikParams['_close_target'] = $strRoot;
            	// send in the previous "king" image in case the user feels like decorating it
            	$aPicnikParams['_import'] = NAVIGATE_DOWNLOAD.'?wid='.$website->id.'&id='.$_REQUEST['id'].'&disposition=attachment&sid='.session_id();	
            	// tell Picnik to redirect the user to the following URL after the HTTP POST instead of just redirecting to _export
            	$aPicnikParams['_redirect'] = NAVIGATE_DOWNLOAD.'?wid='.$website->id.'&id='.$_REQUEST['id'].'&disposition=inline&ts='.core_time(); //'javascript: return false;';
            
            	// tell Picnik our name.  It'll use it in a few places as appropriate
            	$aPicnikParams['_host_name'] = 'Navigate';
            	// turn off the "Save &amp; Share" tab so users don't get confused
            	$aPicnikParams['_exclude'] = "out";
            
            	echo '<html><head></head><body>';
            
            	echo '<form id="picnik_form" method="POST" action="'.$strPicnikUrl.'" style=" visibility: hidden; ">';
            	
            	// put all the API parameters into the form as hidden inputs
            	foreach( $aPicnikParams as $key => $value ) {
            		echo "<input type='hidden' name='$key' value='$value'/>\n";
            	}
            	
            	//echo "<input type='text' name='address' value='Your Majesty'/>\n";
            	echo "<input type='submit' value='Picnik'/>\n";
            	echo "</form>";
            	echo '<script language="javascript" type="text/javascript">
            			document.forms[0].submit();
            		  </script>';
            	echo '</body></html>';
            
            	core_terminate();
            	break;
            */
        /*	
        case 91: // picnik editing
        	ob_clean();
        	
        	// $strPicnikUrl is the URL that we use to launch Picnik.
        	$strPicnikUrl = "http://www.picnik.com/service";	
        	// $aPicnikParams collects together all the params we'll give Picnik.  Start with an API key
        	$aPicnikParams['_apikey'] = $website->picnik_api_key;
        	// tell Picnik where to send the exported image
        	$aPicnikParams['_export'] = NAVIGATE_URL.'/navigate_upload.php?wid='.$website->id.'&engine=picnik&id='.$_REQUEST['id'].'&engine=picnik&session_id='.session_id();
        	// give the export button a title
        	$aPicnikParams['_export_title'] = t(34, 'Save');
        	// turn on the close button, and tell it to come back here
        	//$aPicnikParams['_close_target'] = $strRoot;
        	// send in the previous "king" image in case the user feels like decorating it
        	$aPicnikParams['_import'] = NAVIGATE_DOWNLOAD.'?wid='.$website->id.'&id='.$_REQUEST['id'].'&disposition=attachment&sid='.session_id();	
        	// tell Picnik to redirect the user to the following URL after the HTTP POST instead of just redirecting to _export
        	$aPicnikParams['_redirect'] = NAVIGATE_DOWNLOAD.'?wid='.$website->id.'&id='.$_REQUEST['id'].'&disposition=inline&ts='.core_time(); //'javascript: return false;';
        
        	// tell Picnik our name.  It'll use it in a few places as appropriate
        	$aPicnikParams['_host_name'] = 'Navigate';
        	// turn off the "Save &amp; Share" tab so users don't get confused
        	$aPicnikParams['_exclude'] = "out";
        
        	echo '<html><head></head><body>';
        
        	echo '<form id="picnik_form" method="POST" action="'.$strPicnikUrl.'" style=" visibility: hidden; ">';
        	
        	// put all the API parameters into the form as hidden inputs
        	foreach( $aPicnikParams as $key => $value ) {
        		echo "<input type='hidden' name='$key' value='$value'/>\n";
        	}
        	
        	//echo "<input type='text' name='address' value='Your Majesty'/>\n";
        	echo "<input type='submit' value='Picnik'/>\n";
        	echo "</form>";
        	echo '<script language="javascript" type="text/javascript">
        			document.forms[0].submit();
        		  </script>';
        	echo '</body></html>';
        
        	core_terminate();
        	break;
        */
        case 0:
            // list / search result
        // list / search result
        default:
            // show requested folder or search
            $out = files_browser($_REQUEST['parent'], $_REQUEST['navigate-quicksearch']);
            users_log::action($_REQUEST['fid'], intval($_REQUEST['parent']), 'list', '', json_encode($_REQUEST));
            break;
    }
    return $out;
}
Exemple #16
0
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('configure', $loc)) {
    $config = $db->selectObject('pagemodule_config', "location_data='" . serialize($loc) . "'");
    $file = null;
    if ($config && $config->file_id != 0) {
        // Delete the original file
        $file = $db->selectObject('file', 'id=' . $config->file_id);
        file::delete($file);
        $config->file_id = 0;
    }
    // Clear the file path, if it exists.
    $config->filepath = '';
    $config->location_data = serialize($loc);
    $file = file::update('file', 'files/pagemodule/' . $loc->src, null);
    if (is_object($file)) {
        $config->file_id = $db->insertObject($file, 'file');
        if (!isset($config->id)) {
            $db->insertObject($config, 'pagemodule_config');
        } else {
            $db->updateObject($config, 'pagemodule_config');
        }
        pathos_flow_redirect();
    } 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);
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    }