function show($view, $loc = null, $title = '') { global $db; $template = new template('listingmodule', $view, $loc); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/listingmodule/' . $loc->src; if (!file_exists(BASE . $directory)) { $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } $listings = $db->selectObjects('listing', "location_data='" . serialize($loc) . "'"); for ($i = 0; $i < count($listings); $i++) { if ($listings[$i]->file_id == 0) { $listings[$i]->picpath = ''; } else { $file = $db->selectObject('file', 'id=' . $listings[$i]->file_id); $listings[$i]->picpath = $file->directory . '/' . $file->filename; } } //sort the listings by their rank usort($listings, 'pathos_sorting_byRankAscending'); $template->register_permissions(array('administrate', 'configure'), $loc); $template->assign('listings', $listings); $template->assign('moduletitle', $title); $template->output(); }
function show($view, $loc = null, $title = '') { if (pathos_permissions_check('administrate', $loc) || pathos_permissions_check('create', $loc) || pathos_permissions_check('edit', $loc) || pathos_permissions_check('delete', $loc)) { $template = new template('htmltemplatemodule', $view, $loc); if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/htmltemplatemodule/' . $loc->src; if (!file_exists(BASE . $directory)) { $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } global $db; $templates = $db->selectObjects('htmltemplate'); for ($i = 0; $i < count($templates); $i++) { $assocs = $db->selectObjects('htmltemplateassociation', 'template_id=' . $templates[$i]->id); if (count($assocs) == 1 && $assocs[0]->global == 1) { $templates[$i]->global_assoc = 1; } else { $templates[$i]->global_assoc = 0; $templates[$i]->associations = $assocs; } } $template->assign('moduletitle', $title); $template->assign('templates', $templates); $template->register_permissions(array('administrate', 'create', 'edit', 'delete'), pathos_core_makeLocation('htmltemplatemodule')); $template->output(); } }
function show($view, $loc = null, $title = '') { global $db; $template = new template('imageworkshopmodule', $view, $loc); $template->assign('moduletitle', $title); $directory = 'files/imageworkshopmodule/' . $loc->src; if (!file_exists(BASE . $directory)) { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } $images = $db->selectObjects('imageworkshop_image', "location_data='" . serialize($loc) . "'"); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } usort($images, 'pathos_sorting_byRankAscending'); $template->assign('images', $images); $template->output(); }
function show($view, $loc, $title = '') { global $db; $template = new template('bannermodule', $view, $loc); $template->assign('title', $title); $viewconfig = array('type' => 'default', 'number' => 1); if (is_readable($template->viewdir . "/{$view}.config")) { $viewconfig = (include $template->viewdir . "/{$view}.config"); } if ($viewconfig['type'] == 'affiliates') { $af = $db->selectObjects('banner_affiliate'); for ($i = 0; $i < count($af); $i++) { $af[$i]->bannerCount = $db->countObjects('banner_ad', 'affiliate_id=' . $af[$i]->id); $af[$i]->contact_info = str_replace("\n", "<br />", $af[$i]->contact_info); } if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } usort($af, 'pathos_sorting_byNameAscending'); $template->assign('affiliates', $af); } else { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/bannermodule/' . $loc->src; if (!file_exists(BASE . $directory)) { $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } $all = $db->selectObjects('banner_ad', "location_data='" . serialize($loc) . "'"); if ($viewconfig['type'] == 'allbanners') { $bfiles = $db->selectObjectsIndexedArray('file', "directory='" . $directory . "'"); $template->assign('affiliates', bannermodule::listAffiliates()); $template->assign('files', $bfiles); $template->assign('banners', $all); } else { $num = $viewconfig['number']; shuffle($all); $banners = array_slice($all, 0, $num); for ($i = 0; $i < count($banners); $i++) { $banners[$i]->file = $db->selectObject('file', 'id=' . $banners[$i]->file_id); } $template->assign('banners', $banners); } } $template->register_permissions(array('administrate', 'manage', 'manage_af'), $loc); $template->output(); }
if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('extensions', pathos_core_makeLocation('administrationmodule'))) { $template = new template('administrationmodule', '_upload_finalSummary', $loc); $sessid = session_id(); if (!file_exists(BASE . "extensionuploads/{$sessid}") || !is_dir(BASE . "extensionuploads/{$sessid}")) { $template->assign('nofiles', 1); } else { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $success = array(); foreach (array_keys(pathos_files_listFlat(BASE . "extensionuploads/{$sessid}", true, null, array(), BASE . "extensionuploads/{$sessid}")) as $file) { if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') { pathos_files_makeDirectory(dirname($file)); $success[$file] = copy(BASE . "extensionuploads/{$sessid}" . $file, BASE . substr($file, 1)); if (basename($file) == 'views_c') { chmod(BASE . substr($file, 1), 0777); } } } $del_return = pathos_files_removeDirectory(BASE . "extensionuploads/{$sessid}"); echo $del_return; $template->assign('nofiles', 0); $template->assign('success', $success); $template->assign('redirect', pathos_flow_get()); ob_start(); include BASE . 'modules/administrationmodule/actions/installtables.php'; ob_end_clean(); }
# Boston, MA 02111-1307 USA # # $Id: workshop.php,v 1.2 2005/04/26 03:05:14 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } // PERM CHECK pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION); $template = new template('imageworkshopmodule', '_workshop', $loc); if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/imageworkshopmodule/' . $loc->src; if (!file_exists(BASE . $directory)) { $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } $images = $db->selectObjects('imageworkshop_image', "location_data='" . serialize($loc) . "'"); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } uasort($images, 'pathos_sorting_byRankAscending'); $template->assign('images', $images); $current = $db->selectObject('imageworkshop_image', "location_data='" . serialize($loc) . "' AND id=" . $_GET['id']); if ($current) { $current->_file = $db->selectObject('file', 'id=' . $current->file_id); if (!defined('SYS_IMAGE')) {
fwrite($fh, "\t'author'=>'" . addslashes($lang->author) . "',\r\n"); fwrite($fh, "\t'charset'=>'" . addslashes($lang->charset) . "',\r\n"); fwrite($fh, "\t'locale'=>'" . addslashes($lang->locale) . "',\r\n"); fwrite($fh, "\t'default_view'=>'" . addslashes($lang->default_view) . "',\r\n"); fwrite($fh, ");\r\n\r\n?>"); fclose($fh); // For collecting and sorting the dictionary entries; $data = array(); foreach ($db->selectObjects('translation_dictentry', 'lang_id=' . $lang->id) as $entry) { if (!isset($data[$entry->dictionary])) { $data[$entry->dictionary] = array(); } $data[$entry->dictionary][$entry->constant] = $entry->value; } foreach ($data as $dictionary => $values) { pathos_files_makeDirectory(dirname($langdir . $dictionary), 0777, true); $fh = fopen($langdir . $dictionary . '.php', 'w'); fwrite($fh, "<?php\r\n\r\n"); foreach ($values as $key => $value) { fwrite($fh, "\tdefine('" . $key . "','" . addslashes($value) . "');\r\n"); } fwrite($fh, "\r\n\r\n?>"); fclose($fh); } include_once BASE . "external/Tar.php"; $fname = tempnam(BASE . '/tmp', 'translation_'); $tar = new Archive_Tar($fname, 'gz'); $tar->createModify($tmpdir, '', $tmpdir); ob_end_clean(); header('Content-Type: application/x-gzip'); header('Content-Disposition: inline; filename="exponent-languagepack-' . $lang->lang . '.tar.gz"');
function copyContent($oloc, $nloc) { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/resourcesmodule/' . $nloc->src; if (!file_exists(BASE . $directory) && pathos_files_makeDirectory($directory) != SYS_FILES_SUCCESS) { return; } global $db; foreach ($db->selectObjects('resourceitem', "location_data='" . serialize($oloc) . "'") as $r) { $file = $db->selectObject('file', 'id=' . $r->file_id); copy($file->directory . '/' . $file->filename, $directory . '/' . $file->filename); $file->directory = $directory; unset($file->id); $file->id = $db->insertObject($file, 'file'); $r->location_data = serialize($nloc); $r->file_id = $file->id; unset($r->id); $db->insertObject($r, 'resourceitem'); } }
function copyContent($oloc, $nloc) { global $db; $dir = "files/pagemodule/" . $nloc->src; if (!file_exists(BASE . $dir)) { if (!defined("SYS_FILES")) { require_once BASE . "subsystems/files.php"; } pathos_files_makeDirectory($dir); } if (!file_exists(BASE . $dir)) { return; } $config = $db->selectObject('pagemodule_config', "location_data='" . serialize($oloc) . "'"); if ($config) { $file = $db->selectObject('file', 'id=' . $config->file_id); if ($file) { copy(BASE . $file->directory . '/' . $file->filename, BASE . $dir . '/' . $file->filename); if (file_exists(BASE . $dir . '/' . $file->filename)) { $file->directory = $dir; unset($file->id); $config->file_id = $db->insertObject($file, 'file'); $config->location_data = serialize($nloc); $db->insertObject($config, 'pagemodule_config'); } } else { unset($config->id); $config->location_data = serialize($nloc); $db->insertObject($config, 'pagemodule_config'); } } }
} } } if ($ext == '') { pathos_lang_loadDictionary('modules', 'administrationmodule'); echo TR_ADMINISTRATIONMODULE_BADARCHIVE . '<br />'; } else { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } // Look for stale sessid directories: $sessid = session_id(); if (file_exists(BASE . "extensionuploads/{$sessid}") && is_dir(BASE . "extensionuploads/{$sessid}")) { pathos_files_removeDirectory("extensionuploads/{$sessid}"); } $return = pathos_files_makeDirectory("extensionuploads/{$sessid}"); if ($return != SYS_FILES_SUCCESS) { switch ($return) { case SYS_FILES_FOUNDFILE: case SYS_FILES_FOUNDDIR: echo 'Found file or directory in the way.<br />'; break; case SYS_FILES_NOTWRITABLE: echo 'Destination parent is not writable.<br />'; break; case SYS_FILES_NOTREADABLE: echo 'Destination parent is not readable.<br />'; break; } } $dest = BASE . "extensionuploads/{$sessid}/archive{$ext}";
case UPLOAD_ERR_FORM_SIZE: echo TR_FILEMANAGER_FILETOOLARGE . '<br />'; break; case UPLOAD_ERR_PARTIAL: echo TR_FILEMANAGER_PARTIALFILE . '<br />'; break; case UPLOAD_ERR_NO_FILE: echo TR_FILEMANAGER_NOFILEUPLOADED . '<br />'; break; } } else { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $tmpdir = BASE . 'tmp/translation_' . uniqid('') . '/'; pathos_files_makeDirectory($tmpdir, 0777, true); if (is_dir($tmpdir)) { include_once BASE . 'external/Tar.php'; $tar = new Archive_Tar($_FILES['file']['tmp_name'], 'gz'); $return = $tar->extract($tmpdir); if (!$return) { echo '<br />Error extracting TAR archive<br />'; } else { if (!file_exists($tmpdir . 'subsystems/lang') || !is_dir($tmpdir . 'subsystems/lang')) { echo '<br />Invalid archive format<br />'; } else { // Keep going $base = $tmpdir . 'subsystems/lang/'; $dh = opendir($base); while (($file = readdir($dh)) !== false) { if (is_dir($base . $file) && $file[0] != '.' && $file != 'CVS' && is_readable($base . $file . '.php')) {
function copyContent($oloc, $nloc) { global $db; $directory = 'files/imagemanagermodule/' . $nloc->src; if (!file_exists(BASE . $directory) && pathos_files_makeDirectory($directory) != SYS_FILES_SUCCESS) { return; } foreach ($db->selectObjects("imagemanageritem", "location_data='" . serialize($oloc) . "'") as $i) { $file = $db->selectObject('file', 'id=' . $i->file_id); copy($file->directory . '/' . $file->filename, $directory . '/' . $file->filename); $file->directory = $directory; unset($file->id); $file->id = $db->insertObject($file, 'file'); $i->location_data = serialize($nloc); unset($i->id); $i->file_id = $file->id; $db->insertObject($i, 'imagemanageritem'); } }
<?php if (!defined("SYS_FILES")) { require_once BASE . "subsystems/files.php"; } // Don't forget to change CHANGEME $directory = "files/CHANGEME/" . $loc->src; if (!file_exists(BASE . $directory)) { switch (pathos_files_makeDirectory($directory)) { case SYS_FILES_FOUNDFILE: echo "Found a file in the directory path."; return; case SYS_FILES_NOTWRITABLE: echo "Unable to create directory to store files in."; return; } }
function show($view, $location = null, $title = '') { global $user; global $db; $template = new template('swfmodule', $view, $location); $template->assign('moduletitle', $title); if (defined('PREVIEW_READONLY') && !defined('SELECTOR')) { return; } if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $directory = 'files/swfmodule'; if (!file_exists(BASE . $directory)) { $err = pathos_files_makeDirectory($directory); if ($err != SYS_FILES_SUCCESS) { $template->assign('noupload', 1); $template->assign('uploadError', $err); } } $data = $db->selectObject('swfitem', "location_data='" . serialize($location) . "'"); if ($data == null) { $data->_noflash = 1; $data->_align = 'center'; } else { $data->_noflash = 0; switch ($data->alignment) { case 1: $data->_align = 'left'; break; case 2: $data->_align = 'right'; break; default: $data->_align = 'center'; break; } $file = $db->selectObject('file', 'id=' . $data->swf_id); if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) { $data->_flashurl = $file->directory . '/' . $file->filename; } else { $data->_flashurl = ''; } $file = $db->selectObject('file', 'id=' . $data->alt_image_id); if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) { $data->_noflashurl = $file->directory . '/' . $file->filename; } else { $data->_noflashurl = ''; } } $template->assign('data', $data); $template->register_permissions(array('administrate', 'configure'), $location); $template->output(); }
function copyContent($oloc, $nloc) { global $db; $basedirectory = 'files/imagegallerymodule/' . $nloc->src; foreach ($db->selectObjects('imagegallery_gallery', "location_data='" . serialize($oloc) . "'") as $gallery) { $old_id = $gallery->id; unset($gallery->id); $gallery->location_data = serialize($nloc); $gallery->id = $db->insertObject($gallery, 'imagegallery_gallery'); $directory = $basedirectory . '/gallery' . $gallery->id; if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } if (!file_exists(BASE . $directory) && pathos_files_makeDirectory($directory) != SYS_FILES_SUCCESS) { return; } foreach ($db->selectObjects('imagegallery_image', 'gallery_id=' . $old_id) as $image) { $file = $db->selectObject('file', 'id=' . $image->file_id); copy(BASE . $file->directory . '/' . $file->filename, BASE . $directory . '/' . $file->filename); if (file_exists(BASE . $directory . '/' . $file->filename)) { $file->directory = $directory; unset($file->id); $image->file_id = $db->insertObject($file, 'file'); unset($image->id); $image->gallery_id = $gallery->id; $db->insertObject($image, 'imagegallery_image'); } } } }
function copyContent($oloc, $nloc) { global $db; $directory = "files/slideshowmodule/" . $nloc->src; $nloc = serialize($nloc); if (!defined("SYS_FILES")) { require_once BASE . "subsystems/files.php"; } if (!file_exists(BASE . $directory)) { pathos_files_makeDirectory($directory); if (!file_exists(BASE . $directory)) { return; } } foreach ($db->selectObjects("slideshow_slide", "location_data='" . serialize($oloc) . "'") as $slide) { $file = $db->selectObject("file", "id=" . $slide->file_id); copy(BASE . $file->directory . '/' . $file->filename, BASE . $directory . '/' . $file->filename); if (file_exists(BASE . $directory . '/' . $file->filename)) { $file->directory = $directory; unset($file->id); $slide->file_id = $db->insertObject($file, 'file'); $slide->location_data = $nloc; $db->insertObject($slide, 'slideshow_slide'); } } }