}
$this->SetPreference('allowed_extensions', $params['allowed_extensions']);
if (ctype_digit($params['maximagewidth'])) {
    $this->SetPreference("maximagewidth", $params['maximagewidth']);
}
if (ctype_digit($params['maximageheight'])) {
    $this->SetPreference("maximageheight", $params['maximageheight']);
}
if (ctype_digit($params['imagejpgquality']) && $params['imagejpgquality'] <= 100) {
    $this->SetPreference('imagejpgquality', $params['imagejpgquality']);
}
if (ctype_digit($params['thumbjpgquality']) && $params['thumbjpgquality'] <= 100) {
    $this->SetPreference('thumbjpgquality', $params['thumbjpgquality']);
}
$this->SetPreference('use_permissions', isset($params['use_permissions']) ? $params['use_permissions'] : false);
$this->SetPreference('newgalleries_active', isset($params['newgalleries_active']) ? $params['newgalleries_active'] : false);
$this->SetPreference('use_comment_wysiwyg', isset($params['use_comment_wysiwyg']) ? $params['use_comment_wysiwyg'] : false);
$this->SetPreference('editdirdates', isset($params['editdirdates']) ? $params['editdirdates'] : false);
$this->SetPreference('editfiledates', isset($params['editfiledates']) ? $params['editfiledates'] : false);
$this->SetPreference('fe_folderpath', empty($params['fe_folderpath']) ? 'modules/Gallery/images/folder.png' : $params['fe_folderpath']);
$this->SetPreference('be_folderpath', empty($params['be_folderpath']) ? 'modules/Gallery/images/foldersmall.png' : $params['be_folderpath']);
if (isset($params['updatethumbs']) && $params['updatethumbs'] == 1) {
    Gallery_utils::DeleteFiles(str_replace('/', DIRECTORY_SEPARATOR, '../' . DEFAULT_GALLERYTHUMBS_PATH), '*', false);
    $galleries = Gallery_utils::GetGalleries();
    foreach ($galleries as $gallery) {
        $dir = str_replace('/', DIRECTORY_SEPARATOR, '../' . DEFAULT_GALLERY_PATH . $gallery['filepath'] . (empty($gallery['filepath']) ? '' : '/') . ($gallery['filename'] == "Gallery/" ? '' : $gallery['filename']));
        Gallery_utils::DeleteFiles($dir, IM_PREFIX . '*', false);
    }
}
$params = array('tab_message' => 'optionsupdated', 'active_tab' => 'options');
$this->Redirect($id, 'defaultadmin', '', $params);
Ejemplo n.º 2
0
if (isset($params['unsortbutton'])) {
    $query = "UPDATE " . cms_db_prefix() . "module_gallery SET fileorder=0 WHERE galleryid = ?";
    $result = $db->Execute($query, array($params['gid']));
    if ($result) {
        $params['module_message'] = $this->Lang('galleryupdated');
    }
} elseif (isset($params['updatethumbsbutton'])) {
    $query = "SELECT fileid, filepath FROM " . cms_db_prefix() . "module_gallery WHERE galleryid=?";
    $result = $db->Execute($query, array($params['gid']));
    if ($result && $result->RecordCount() > 0) {
        while ($row = $result->FetchRow()) {
            Gallery_utils::DeleteFiles(str_replace('/', DIRECTORY_SEPARATOR, '../' . DEFAULT_GALLERYTHUMBS_PATH), $row['fileid'] . '-*', false);
            $filepath = $row['filepath'];
        }
        $filepath .= $filepath != '' ? '/' : '';
        Gallery_utils::DeleteFiles(str_replace('/', DIRECTORY_SEPARATOR, '../' . DEFAULT_GALLERY_PATH . $filepath), IM_PREFIX . '*', false);
    }
    if ($result) {
        $params['module_message'] = $this->Lang('thumbsdeleted') . ' ' . $this->Lang('thumbsrecreated');
    }
} elseif (isset($params['directoryname'])) {
    // cleanup the directoryname, see reference-arrays in lib/replacement.php
    $params['directoryname'] = munge_string_to_url($params['directoryname']);
    // add subgallery
    if (empty($params['directoryname'])) {
        $params['module_error'] = $this->Lang('error_directorynameinvalid');
        $this->Redirect($id, 'editgallery', '', $params);
        exit;
    }
    $params['gid'] = $params['moveto'];
    $galleryinfo = Gallery_utils::Getgalleryinfobyid($params['gid']);