function handleOptionSave($themename, $themealbum) { if (getOption('galleryArticles_import')) { require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/galleryArticles/combiNews.php'; purgeOption('galleryArticles_import'); } return false; }
function tinymce4Options() { setOptionDefault('tinymce4_zenphoto', 'zenphoto-ribbon.js.php'); setOptionDefault('tinymce4_zenpage', 'zenpage-slim.js.php'); if (getOption('zp_plugin_tiny_mce')) { setOptionDefault('zp_plugin_tinymce4', 5 | ADMIN_PLUGIN); purgeOption('zp_plugin_tiny_mce'); } }
function __construct() { global $plugin_is_filter; if (OFFSET_PATH == 2) { setOptionDefault('zp_plugin_rss', $plugin_is_filter); // migrate old RSS options setOptionDefault('RSS_items', getOption('feed_items')); // options for standard images rss setOptionDefault('RSS_imagesize', getOption('feed_imagesize')); setOptionDefault('RSS_sortorder', getOption('feed_sortorder')); setOptionDefault('RSS_items_albums', getOption('feed_items_albums')); // options for albums rss setOptionDefault('RSS_imagesize_albums', getOption('feed_imagesize_albums')); setOptionDefault('RSS_sortorder_albums', getOption('feed_sortorder_albums')); setOptionDefault('RSS_enclosure', getOption('feed_enclosure')); setOptionDefault('RSS_mediarss', getOption('feed_mediarss')); setOptionDefault('RSS_cache', getOption('feed_cache')); setOptionDefault('RSS_cache_expire', getOption('feed_cache_expire')); setOptionDefault('RSS_hitcounter', getOption('feed_hitcounter')); setOptionDefault('RSS_title', getOption('feed_title')); setOptionDefault('RSS_truncate_length', getOption('zenpage_rss_length')); setOptionDefault('RSS_zenpage_items', getOption('zenpage_rss_items')); purgeOption('feed_items'); purgeOption('feed_imagesize'); purgeOption('feed_sortorder'); purgeOption('feed_items_albums'); purgeOption('feed_imagesize_albums'); purgeOption('feed_sortorder_albums'); purgeOption('feed_enclosure'); purgeOption('feed_mediarss'); purgeOption('feed_cache'); purgeOption('feed_cache_expire'); purgeOption('feed_hitcounter'); purgeOption('feed_title'); purgeOption('zenpage_rss_length'); purgeOption('zenpage_rss_items'); setOptionDefault('RSS_truncate_length', '100'); setOptionDefault('RSS_zenpage_items', '10'); setOptionDefault('RSS_items', 10); // options for standard images rss setOptionDefault('RSS_imagesize', 240); setOptionDefault('RSS_sortorder', 'latest'); setOptionDefault('RSS_items_albums', 10); // options for albums rss setOptionDefault('RSS_imagesize_albums', 240); setOptionDefault('RSS_sortorder_albums', 'latest'); setOptionDefault('RSS_enclosure', '0'); setOptionDefault('RSS_mediarss', '0'); setOptionDefault('RSS_cache', '1'); setOptionDefault('RSS_cache_expire', 86400); setOptionDefault('RSS_hitcounter', 1); setOptionDefault('RSS_title', 'both'); } }
function handleOptionSave($themename, $themealbum) { if (isset($_POST['AnyFile_file_list'])) { $mysetoptions = sanitize($_POST['AnyFile_file_list']); } else { $mysetoptions = array(); } if ($new = getOption('AnyFile_file_new')) { $mysetoptions[] = $new; } purgeOption('AnyFile_file_new'); setOption('AnyFileSuffixList', serialize($mysetoptions)); return false; }
function get_AnyFile_suffixes() { $mysetoptions = array(); $alloptionlist = getOptionList(); foreach ($alloptionlist as $key => $option) { if (strpos($key, 'AnyFile_file_list_') === 0) { if ($option) { $mysetoptions[] = str_replace('AnyFile_file_list_', '', $key); } else { purgeOption($key); } } } return $mysetoptions; }
function __construct() { if (OFFSET_PATH == 2) { setOptionDefault('htmlmeta_cache_control', 'no-cache'); setOptionDefault('htmlmeta_pragma', 'no-cache'); setOptionDefault('htmlmeta_robots', 'index'); setOptionDefault('htmlmeta_revisit_after', '10'); setOptionDefault('htmlmeta_expires', '43200'); setOptionDefault('htmlmeta_tags', ''); if (getOption('htmlmeta_og-title')) { // assume this will be set setOptionDefault('htmlmeta_opengraph', 1); } //remove obsolete old options purgeOption('htmlmeta_og-title'); purgeOption('htmlmeta_og-image'); purgeOption('htmlmeta_og-description'); purgeOption('htmlmeta_og-url'); purgeOption('htmlmeta_og-type'); // the html meta tag selector prechecked ones setOptionDefault('htmlmeta_htmlmeta_tags', '1'); setOptionDefault('htmlmeta_tags_threshold', 1); setOptionDefault('htmlmeta_http-equiv-cache-control', '1'); setOptionDefault('htmlmeta_http-equiv-pragma', '1'); setOptionDefault('htmlmeta_name=keywords', '1'); setOptionDefault('htmlmeta_name-description', '1'); setOptionDefault('htmlmeta_name-robot', '1'); setOptionDefault('htmlmeta_name-publisher', '1'); setOptionDefault('htmlmeta_name-creator', '1'); setOptionDefault('htmlmeta_name-author', '1'); setOptionDefault('htmlmeta_name-copyright', '1'); setOptionDefault('htmlmeta_name-generator', '1'); setOptionDefault('htmlmeta_name-revisit-after', '1'); setOptionDefault('htmlmeta_name-expires', '1'); setOptionDefault('htmlmeta_name-generator', '1'); setOptionDefault('htmlmeta_name-date', '1'); setOptionDefault('htmlmeta_canonical-url', '0'); setOptionDefault('htmlmeta_sitelogo', ''); setOptionDefault('htmlmeta_twittercard', ''); setOptionDefault('htmlmeta_twittername', ''); setOptionDefault('htmlmeta_ogimage_width', 1280); setOptionDefault('htmlmeta_ogimage_height', 900); if (class_exists('cacheManager')) { cacheManager::deleteThemeCacheSizes('html_meta_tags'); cacheManager::addThemeCacheSize('html_meta_tags', NULL, getOption('htmlmeta_ogimage_width'), getOption('htmlmeta_ogimage_height'), NULL, NULL, NULL, NULL, NULL, NULL, NULL, true); } } }
function handleOptionSave($themename, $themealbum) { $mysetoptions = array(); foreach ($_POST as $key => $option) { if (strpos($key, 'AnyFile_file_list_') === 0) { $mysetoptions[] = str_replace('AnyFile_file_list_', '', $key); purgeOption($key); } } if ($_POST['AnyFile_file_new']) { $mysetoptions[] = sanitize($_POST['AnyFile_file_new']); $suffix = getOption('AnyFile_file_new'); purgeOption('AnyFile_file_new'); } setOption('AnyFileSuffixList', serialize($mysetoptions)); return false; }
function __construct() { setOptionDefault('gmap_width', 595); setOptionDefault('gmap_height', 300); setOptionDefault('gmap_map_roadmap', 1); setOptionDefault('gmap_map_hybrid', 1); setOptionDefault('gmap_map_satellite', 1); setOptionDefault('gmap_map_terrain', 1); setOptionDefault('gmap_starting_map', 'HYBRID'); setOptionDefault('gmap_control_type', 'HORIZONTAL_BAR'); setOptionDefault('gmap_zoom_size', 'LARGE'); setOptionDefault('gmap_cluster_max_zoom', 13); setOptionDefault('gmap_sessions', 1); if (OFFSET_PATH == 2) { setOptionDefault('gmap_display', 'hide'); purgeOption('gmap_hide'); } setOptionDefault('gmap_display', 'show'); }
function contactformOptions() { global $_zp_authority; if (OFFSET_PATH == 2 && !getOption('contactform_mailaddress')) { purgeOption('contactform_mailaddress'); } setOptionDefault('contactform_rewrite', '_PAGE_/contact'); gettext($str = '<p>Fields with <strong>*</strong> are required. HTML or any other code is not allowed.</p>'); setOptionDefault('contactform_introtext', getAllTranslations($str)); gettext($str = '<p>Please confirm that you really want to send this email. Thanks.</p>'); setOptionDefault('contactform_confirmtext', getAllTranslations($str)); gettext($str = '<p>Thanks for your message.</p>'); setOptionDefault('contactform_thankstext', getAllTranslations($str)); gettext($str = 'Send another message.'); setOptionDefault('contactform_newmessagelink', getAllTranslations($str)); setOptionDefault('contactform_title', "show"); setOptionDefault('contactform_name', "required"); setOptionDefault('contactform_company', "show"); setOptionDefault('contactform_street', "show"); setOptionDefault('contactform_city', "show"); setOptionDefault('contactform_state', "show"); setOptionDefault('contactform_postal', "show"); setOptionDefault('contactform_country', "show"); setOptionDefault('contactform_email', "required"); setOptionDefault('contactform_website', "show"); setOptionDefault('contactform_phone', "show"); setOptionDefault('contactform_captcha', 0); setOptionDefault('contactform_confirm', 1); setOptionDefault('contactform_sendcopy', 0); gettext($str = '<p>A copy of your e-mail will automatically be sent to the address you provided for your own records.</p>'); setOptionDefault('contactform_sendcopy_text', getAllTranslations($str)); $mailings = $_zp_authority->getAdminEmail(); $email_list = ''; foreach ($mailings as $email) { $email_list .= ';' . $email; } if ($email_list) { setOptionDefault('contactform_mailaddress', substr($email_list, 1)); } }
/** * * This method establishes the current set of database fields. It will add the * fields to the database if they are not already present. Fields from previous * constructor calls that are no longer in the list will be removed from the * database (along with any data associated with them.) * * @param array $newfields */ function constructor($me, $newfields) { $previous = getSerializedArray(getOption(get_class($this) . '_addedFields')); $current = $fields = array(); if (extensionEnabled($me)) { //need to update the database tables. foreach ($newfields as $newfield) { $current[$newfield['table']][$newfield['name']] = true; unset($previous[$newfield['table']][$newfield['name']]); switch (strtolower($newfield['type'])) { default: $dbType = strtoupper($newfield['type']); break; case 'int': case 'varchar': $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')'; break; } $sql = 'ALTER TABLE ' . prefix($newfield['table']) . ' ADD COLUMN `' . $newfield['name'] . '` ' . $dbType; if (query($sql, false) && in_array($newfield['table'], array('albums', 'images', 'news', 'news_categories', 'pages'))) { $fields[] = strtolower($newfield['name']); } } setOption(get_class($this) . '_addedFields', serialize($current)); } else { purgeOption(get_class($this) . '_addedFields'); } $set_fields = array_flip(explode(',', getOption('search_fields'))); foreach ($previous as $table => $orpahed) { //drop fields no longer defined foreach ($orpahed as $field => $v) { unset($set_fields[$field]); $sql = 'ALTER TABLE ' . prefix($table) . ' DROP `' . $field . '`'; query($sql, false); } } $set_fields = array_unique(array_merge($fields, array_flip($set_fields))); setOption('search_fields', implode(',', $set_fields)); }
function __construct() { setOptionDefault('gmap_width', 595); setOptionDefault('gmap_height', 300); setOptionDefault('gmap_map_roadmap', 1); setOptionDefault('gmap_map_hybrid', 1); setOptionDefault('gmap_map_satellite', 1); setOptionDefault('gmap_map_terrain', 1); setOptionDefault('gmap_starting_map', 'HYBRID'); setOptionDefault('gmap_control_type', 'HORIZONTAL_BAR'); setOptionDefault('gmap_zoom_size', 'LARGE'); setOptionDefault('gmap_cluster_max_zoom', 13); setOptionDefault('gmap_sessions', 1); if (OFFSET_PATH == 2) { setOptionDefault('gmap_display', 'hide'); purgeOption('gmap_hide'); } setOptionDefault('gmap_display', 'show'); if (class_exists('cacheManager')) { cacheManager::deleteThemeCacheSizes('GoogleMap'); cacheManager::addThemeCacheSize('GoogleMap', 150, NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL); } }
function __construct() { if (OFFSET_PATH == 2) { if ($personality = getThemeOption('Theme_personality', NULL, 'effervescence_plus')) { if (strpos($personality, ' ') == false) { if ($personality == 'Slimbox') { setThemeOptionDefault('effervescence_personality', 'colorbox'); } if ($personality == 'Smoothgallery') { setThemeOptionDefault('effervescence_personality', 'image_gallery'); } setThemeOptionDefault('effervescence_personality', $personality); } } purgeOption('Theme_personality'); } $me = basename(dirname(__FILE__)); setThemeOptionDefault('Theme_logo', ''); setThemeOptionDefault('Allow_search', true); setThemeOptionDefault('Slideshow', true); setThemeOptionDefault('Graphic_logo', '*'); setThemeOptionDefault('Watermark_head_image', true); setThemeOptionDefault('effervescence_personality', 'image_page'); setThemeOptionDefault('effervescence_transition', 'slide-hori'); setThemeOptionDefault('effervescence_caption_location', 'image'); setThemeOptionDefault('Theme_colors', 'kish-my father'); setThemeOptionDefault('effervescence_menu', ''); setThemeOptionDefault('albums_per_page', 9); setThemeOptionDefault('albums_per_row', 3); setThemeOptionDefault('images_per_page', 20); setThemeOptionDefault('images_per_row', 5); setThemeOption('image_size', 595, NULL, 'effervescence_plus'); setThemeOption('image_use_side', 'longest', NULL, 'effervescence_plus'); setThemeOptionDefault('thumb_transition', 1); setThemeOptionDefault('thumb_size', 90); setThemeOptionDefault('thumb_crop_width', 100); setThemeOptionDefault('thumb_crop_height', 100); setThemeOptionDefault('thumb_crop', 1); setThemeOptionDefault('effervescence_daily_album_image', 1); setThemeOptionDefault('effervescence_daily_album_image_effect', ''); setOptionDefault('colorbox_' . $me . '_album', 1); setOptionDefault('colorbox_' . $me . '_image', 1); setOptionDefault('colorbox_' . $me . '_search', 1); if (extensionEnabled('zenpage')) { setThemeOption('custom_index_page', 'gallery', NULL, 'effervescence_plus', false); } if (class_exists('cacheManager')) { cacheManager::deleteThemeCacheSizes($me); cacheManager::addThemeCacheSize($me, 595, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL); cacheManager::addThemeCacheSize($me, getThemeOption('thumb_size'), NULL, NULL, getThemeOption('thumb_crop_width'), getThemeOption('thumb_crop_height'), NULL, NULL, true, NULL, NULL, NULL); cacheManager::addThemeCacheSize($me, NULL, 180, 80, NUll, NULL, NULL, NULL, true, NULL, NULL, NULL); } if (function_exists('createMenuIfNotExists')) { $menuitems = array(array('type' => 'menulabel', 'title' => gettext('News Articles'), 'link' => '', 'show' => 1, 'nesting' => 0), array('type' => 'menufunction', 'title' => gettext('All news'), 'link' => 'printAllNewsCategories("All news",TRUE,"","menu-active",false,false,false,"list",false,getOption("menu_manager_truncate_string"));', 'show' => 1, 'include_li' => 0, 'nesting' => 1), array('type' => 'html', 'title' => gettext('News Articles Rule'), 'link' => '<li class="menu_rule menu_menulabel"></li>', 'show' => 1, 'include_li' => 0, 'nesting' => 0), array('type' => 'custompage', 'title' => gettext('Gallery'), 'link' => 'gallery', 'show' => 1, 'nesting' => 0), array('type' => 'menufunction', 'title' => gettext('All Albums'), 'link' => 'printAlbumMenuList("list",NULL,"","menu-active","submenu","menu-active","",false,false,false,false,getOption("menu_manager_truncate_string"));', 'show' => 1, 'include_li' => 0, 'nesting' => 1), array('type' => 'html', 'title' => gettext('Gallery Rule'), 'link' => '<li class="menu_rule menu_menulabel"></li>', 'show' => 1, 'include_li' => 0, 'nesting' => 0), array('type' => 'menulabel', 'title' => gettext('Pages'), 'link' => '', 'show' => 1, 'nesting' => 0), array('type' => 'menufunction', 'title' => gettext('All pages'), 'link' => 'printPageMenu("list","","menu-active","submenu","menu-active","",0,false,getOption("menu_manager_truncate_string"));', 'show' => 1, 'include_li' => 0, 'nesting' => 1, getOption("menu_manager_truncate_string")), array('type' => 'html', 'title' => gettext('Pages Rule'), 'link' => '<li class="menu_rule menu_menulabel"></li>', 'show' => 1, 'include_li' => 0, 'nesting' => 0), array('type' => 'menulabel', 'title' => gettext('Archive'), 'link' => '', 'show' => 1, 'nesting' => 0), array('type' => 'custompage', 'title' => gettext('Gallery and News'), 'link' => 'archive', 'show' => 1, 'nesting' => 1), array('type' => 'html', 'title' => gettext('Archive Rule'), 'link' => '<li class="menu_rule menu_menulabel"></li>', 'show' => 1, 'include_li' => 0, 'nesting' => 0)); if (extensionEnabled('rss')) { $rssItems = array(array('type' => 'menulabel', 'title' => gettext('RSS'), 'link' => '', 'show' => 1, 'nesting' => 0), array('type' => 'customlink', 'title' => gettext('Gallery'), 'link' => WEBPATH . '/index.php?rss', 'show' => 1, 'nesting' => 1), array('type' => 'customlink', 'title' => gettext('News'), 'link' => getRSSLink('news'), 'show' => 1, 'nesting' => 1), array('type' => 'customlink', 'title' => gettext('News and Gallery'), 'link' => getRSSLink('news') . '&withimages', 'show' => 1, 'nesting' => 1)); $menuitems = array_merge($menuitems, $rssItems); } createMenuIfNotExists($menuitems, 'effervescence'); } }
static function handleOptionSave($themename, $themealbum) { $notify = ''; $list = array(); foreach ($_POST as $key => $param) { if ($param) { if (strpos($key, 'ipBlocker_ip_') !== false) { if (preg_match("/^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\$/", $param)) { $p = explode('_', substr($key, 13)); $list[$p[1]][$p[0]] = $param; } } } } foreach ($list as $key => $range) { if (!array_key_exists('start', $range) || !array_key_exists('end', $range)) { unset($list[$key]); $notify .= gettext('IP address format error') . '<br />'; } } setOption('ipBlocker_list', serialize($list)); purgeOption('ipBlocker_import'); if (!empty($_POST['ipBlocker_import'])) { $file = SERVERPATH . '/' . UPLOAD_FOLDER . '/' . sanitize_path($_POST['ipBlocker_import']); if (file_exists($file)) { $import_list = array(); // insert current list into import list for posterity foreach ($list as $range) { $ipa = explode('.', $range['end']); $ipend = sprintf('%03u.%03u.%03u.%03u', @$ipa[0], @$ipa[1], @$ipa[2], @$ipa[3]); $ipa = explode('.', $range['start']); do { $current = sprintf('%03u.%03u.%03u.%03u', @$ipa[0], @$ipa[1], @$ipa[2], @$ipa[3]); $ipa[3]++; if ($ipa[3] > 255) { $ipa[3] = 0; $ipa[2]++; if ($ipa[2] > 255) { $ipa[2] = 0; $ipa[2]++; if ($ipa[1] > 255) { $ipa[1] = 0; $ipa[0]++; if ($ipa[0] > 255) { break; } } } } $import_list[] = $current; } while ($current < $ipend); } $import = explode("\n", file_get_contents($file)); foreach ($import as $ip) { $ip = trim($ip); if ($ip) { $ipa = explode('.', $ip); $import_list[] = sprintf('%03u.%03u.%03u.%03u', @$ipa[0], @$ipa[1], @$ipa[2], @$ipa[3]); } } $list = array(); if (!empty($import_list)) { $import_list = array_unique($import_list); // remove duplicates sort($import_list); //now make a range pair list for the storage. $current = $start = array_shift($import_list); $end = $start; $clean = false; while (!empty($import_list)) { $try = trim(array_shift($import_list)); if ($try) { // ignore empty lines $ipa = explode('.', $current); $ipa[3]++; if ($ipa[3] > 255) { $ipa[3] = 0; $ipa[2]++; if ($ipa[2] > 255) { $ipa[2] = 0; $ipa[2]++; if ($ipa[1] > 255) { $ipa[1] = 0; $ipa[0]++; if ($ipa[0] > 255) { break; } } } } $next = sprintf('%03u.%03u.%03u.%03u', @$ipa[0], @$ipa[1], @$ipa[2], @$ipa[3]); $current = $try; if ($clean = $current != $next) { $list[] = array('start' => $start, 'end' => $end); $start = $end = $current; } else { $end = $next; } } } if (!$clean) { $list[] = array('start' => $start, 'end' => $end); } setOption('ipBlocker_list', serialize($list)); } } } if ($notify) { return '&custom=' . $notify; } else { return false; } }
function handleOptionSave($themename, $themealbum) { if ($site = getOption('externalFeed_site')) { purgeOption('externalFeed_site'); $key = md5($site . serialize($_SERVER)); query('INSERT INTO ' . prefix('plugin_storage') . ' (`type`, `aux`,`data`) VALUES ("externalFeed",' . db_quote($site) . ',' . db_quote($key) . ') ON DUPLICATE KEY UPDATE `data`=' . db_quote($key)); } foreach ($_POST as $option => $value) { if (strpos($option, 'externalFeed_delete_') !== false) { $site = str_replace('externalFeed_delete_', '', $option); query('DELETE FROM ' . prefix('plugin_storage') . ' WHERE `type`="externalFeed" AND `aux`=' . db_quote($site)); } } return false; }
foreach ($combi as $article) { switch ($article['type']) { case 'images': $obj = newImage(NULL, array('folder' => $article['albumname'], 'filename' => $article['titlelink']), false); if ($obj->exists) { $obj->setPublishDate($article['date']); self::publishArticle($obj, 'combiNews'); } break; case 'albums': $obj = newAlbum($article['albumname'], false); if ($obj->exists) { $obj->setPublishDate($article['date']); self::publishArticle($obj, 'combiNews'); } break; } } purgeOption('zenpage_combinews'); purgeOption('combinews-customtitle'); purgeOption('combinews-customtitle-imagetitles'); purgeOption("zenpage_combinews_sortorder"); purgeOption('zenpage_combinews_imagesize'); purgeOption('combinews-thumbnail-width'); purgeOption('combinews-thumbnail-height'); purgeOption('combinews-thumbnail-cropwidth'); purgeOption('combinews-thumbnail-cropheight'); purgeOption('combinews-thumbnail-cropx'); purgeOption('combinews-thumbnail-cropy'); purgeOption('zenpage_combinews_mode');
if (strpos($key, 'gallery_page_unprotected_') === 0) { purgeOption($key); } } } // cleanup options for missing elements $sql = 'SELECT DISTINCT `creator` FROM ' . prefix('options') . ' WHERE `creator` IS NOT NULL'; $result = query_full_array($sql); if (is_array($result)) { foreach ($result as $row) { $filename = $row['creator']; if (!file_exists(SERVERPATH . '/' . $filename)) { $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `creator`=' . db_quote($filename); query($sql); if (strpos($filename, PLUGIN_FOLDER) !== false || strpos($filename, USER_PLUGIN_FOLDER) !== false) { purgeOption('zp_plugin_' . stripSuffix(basename($filename))); } } } } // missing themes $sql = 'SELECT DISTINCT `theme` FROM ' . prefix('options') . ' WHERE `theme` IS NOT NULL'; $result = query_full_array($sql); if (is_array($result)) { foreach ($result as $row) { $filename = THEMEFOLDER . '/' . $row['theme']; if ($filename && !file_exists(SERVERPATH . '/' . $filename)) { $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `theme`=' . db_quote($row['theme']); query($sql); } }
function __construct() { if (OFFSET_PATH == 2) { $present = array('albums' => 0, 'images' => 0, 'news' => 0, 'pages' => 0, 'news_categories' => 0); foreach ($present as $table => $v) { $tablecols = db_list_fields($table); foreach ($tablecols as $key => $datum) { if ($datum['Field'] == 'custom_data') { $present[$table] = 1 + (int) (!empty($datum['Comment'])); } } } if (extensionEnabled('customdata')) { setOptionDefault('customDataAlbums', $present['albums']); setOptionDefault('customDataImages', $present['images']); setOptionDefault('customDataNews', $present['news']); setOptionDefault('customDataPages', $present['pages']); setOptionDefault('customDataCategories', $present['news_categories']); } else { purgeOption('customDataAlbums'); purgeOption('customDataImages'); purgeOption('customDataNews'); purgeOption('customDataPages'); purgeOption('customDataCategories'); } if (getOption('customDataAlbums')) { if (!$present['albums']) { setupQuery('ALTER TABLE ' . prefix('albums') . " ADD COLUMN `custom_data` TEXT COMMENT 'optional_customData'"); } } else { if ($present['albums']) { setupQuery('ALTER TABLE ' . prefix('albums') . ' DROP `custom_data`'); } } if (getOption('customDataImages')) { if (!$present['images']) { setupQuery('ALTER TABLE ' . prefix('images') . " ADD COLUMN `custom_data` TEXT COMMENT 'optional_customData'"); } } else { if ($present['images']) { setupQuery('ALTER TABLE ' . prefix('images') . ' DROP `custom_data`'); } } if (getOption('customDataNews')) { if (!$present['news']) { setupQuery('ALTER TABLE ' . prefix('news') . " ADD COLUMN `custom_data` TEXT COMMENT 'optional_customData'"); } } else { if ($present['news']) { setupQuery('ALTER TABLE ' . prefix('news') . ' DROP `custom_data`'); } } if (getOption('customDataPages')) { if (!$present['pages']) { setupQuery('ALTER TABLE ' . prefix('pages') . " ADD COLUMN `custom_data` TEXT COMMENT 'optional_customData'"); } } else { if ($present['pages']) { setupQuery('ALTER TABLE ' . prefix('pages') . ' DROP `custom_data`'); } } if (getOption('customDataCategories')) { if (!$present['news_categories']) { setupQuery('ALTER TABLE ' . prefix('news_categories') . " ADD COLUMN `custom_data` TEXT COMMENT 'optional_customData'"); } } else { if ($present['news_categories']) { setupQuery('ALTER TABLE ' . prefix('news_categories') . ' DROP `custom_data`'); } } } }
if (preg_match('~^' . THEMEFOLDER . '/~', $owner)) { if ($owner == THEMEFOLDER . '/') { $where = ' WHERE `creator` = "' . THEMEFOLDER . '/"'; } else { $where = ' WHERE `creator` LIKE ' . db_quote('%' . basename($owner) . '/themeoptions.php'); } $sql = 'DELETE FROM ' . prefix('options') . $where; $result = query($sql); } else { purgeOption('zp_plugin_' . stripSuffix(basename($owner))); } } } if (isset($_POST['missingplugin'])) { foreach ($_POST['missingplugin'] as $plugin) { purgeOption('zp_plugin_' . stripSuffix($plugin)); } } } printAdminHeader('options', ''); ?> <link rel="stylesheet" href="purgeOptions.css" type="text/css"> </head> <body> <?php printLogoAndLinks(); ?> <div id="main"> <?php printTabs(); ?>
function handleOptionSave($theme, $album) { $notify = false; if (getOption('rewriteTokens_restore')) { $updated = false; purgeOption('rewriteTokens_restore'); $template = file_get_contents(SERVERPATH . '/' . ZENFOLDER . '/zenphoto_cfg.txt'); $i = strpos($template, "\$conf['special_pages']"); $j = strpos($template, '//', $i); $newtext = substr($template, $i, $j - $i); eval($newtext); $this->conf_vars = $conf['special_pages']; foreach ($this->plugin_vars as $page => $element) { if (isset($element['option'])) { $this->plugin_vars[$page]['rewrite'] = $element['default']; setOption($element['option'], $element['default']); } } } else { foreach ($this->conf_vars as $page => $element) { $rewrite = sanitize($_POST['rewriteTokens_' . $page]); if (empty($rewrite)) { $notify = '&custom=' . gettext('Rewrite tokens may not be empty.'); } else { $this->conf_vars[$page]['rewrite'] = $rewrite; } foreach ($this->plugin_vars as $page => $element) { if (isset($element['option'])) { $rewrite = sanitize($_POST['rewriteTokens_' . $page]); if (empty($rewrite)) { $notify = '&custom=' . gettext('Rewrite tokens may not be empty.'); } else { $this->plugin_vars[$page]['rewrite'] = $rewrite; setOption($element['option'], $rewrite); } } } } } $newtext = "\$conf['special_pages'] = array("; foreach ($this->conf_vars as $page => $element) { if ($define = $element['define']) { $define = "'" . $define . "'"; $desc = sprintf(gettext('Link for <em>%s</em> rule.'), $page); } else { $define = 'false'; $desc = sprintf(gettext('Link for <em>%s</em> script page.'), $page); } if (array_key_exists('rule', $element)) { $rule = ",\t\t'rule'=>'{$element['rule']}'"; } else { $rule = ''; } $newtext .= $token = "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$page}'=>\t\t\tarray('define'=>{$define},\t\t\t\t\t\t'rewrite'=>'{$element['rewrite']}'{$rule}),"; } $newtext = substr($newtext, 0, -1) . "\n\t\t\t\t\t\t\t\t\t\t\t\t);\n"; $zp_cfg = $this->zp_cfg_a . $newtext . $this->zp_cfg_b; storeConfig($zp_cfg); return $notify; }
if ($i !== false) { $j = strpos($po, '\\n', $i); if ($j !== false) { $pversion = strtolower(substr($po, $i + 19, $j - $i - 19)); $vers = explode('.', trim(str_replace('zenphoto', '', $pversion))); while (count($vers) < 3) { $vers[] = 0; } $version = (int) $vers[0] . '.' . (int) $vers[1] . '.' . (int) $vers[2]; } } if (is_null(getOption('disallow_' . $dirname)) && $version < $zpversion) { setOptionDefault('disallow_' . $dirname, 1); } if (setupLocale($dirname)) { purgeOption('unsupported_' . $dirname); } else { setOption('unsupported_' . $dirname, 1); } } } //The following should be done LAST so it catches anything done above //set plugin default options by instantiating the options interface $plugins = getPluginFiles('*.php'); ?> <p> <?php $plugins = array_keys($plugins); natcasesort($plugins); echo gettext('Plugin setup:') . '<br />'; foreach ($plugins as $extension) {
/** * * This method establishes the current set of database fields. It will add the * fields to the database if they are not already present. Fields from previous * constructor calls that are no longer in the list will be removed from the * database (along with any data associated with them.) * * @param array $newfields */ function constructor($me, $newfields) { $database = array(); foreach (getDBTables() as $table) { $tablecols = db_list_fields($table); foreach ($tablecols as $key => $datum) { $database[$table][$datum['Field']] = $datum; } } $current = $fields = $searchDefault = array(); if (extensionEnabled($me)) { //need to update the database tables. foreach ($newfields as $newfield) { $table = $newfield['table']; $name = $newfield['name']; if (!($existng = isset($database[$table][$name]))) { if (isset($newfield['searchDefault']) && $newfield['searchDefault']) { $searchDefault[] = $name; } } if (is_null($newfield['type'])) { if ($name == 'tags') { setOption('adminTagsTab', 1); } } else { switch (strtolower($newfield['type'])) { default: $dbType = strtoupper($newfield['type']); break; case 'int': $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')'; if (isset($newfield['attribute'])) { $dbType .= ' ' . $newfield['attribute']; unset($newfield['attribute']); } break; case 'varchar': $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')'; break; } if ($existng) { if (strtoupper($database[$table][$name]['Type']) != $dbType || empty($database[$table][$name]['Comment'])) { $cmd = ' CHANGE `' . $name . '`'; } else { $cmd = NULL; } unset($database[$table][$name]); } else { $cmd = ' ADD COLUMN'; } $sql = 'ALTER TABLE ' . prefix($newfield['table']) . $cmd . ' `' . $name . '` ' . $dbType; if (isset($newfield['attribute'])) { $sql .= ' ' . $newfield['attribute']; } if (isset($newfield['default'])) { $sql .= ' DEFAULT ' . $newfield['default']; } $sql .= " COMMENT 'optional_{$me}'"; if ((!$cmd || setupQuery($sql)) && in_array($newfield['table'], array('albums', 'images', 'news', 'news_categories', 'pages'))) { $fields[] = strtolower($newfield['name']); } $current[$newfield['table']][$newfield['name']] = $dbType; } } setOption(get_class($this) . '_addedFields', serialize($current)); if (!empty($searchDefault)) { $fieldExtenderMutex = new zpMutex('fE'); $fieldExtenderMutex->lock(); $engine = new SearchEngine(); $set_fields = $engine->allowedSearchFields(); $set_fields = array_unique(array_merge($set_fields, $searchDefault)); setOption('search_fields', implode(',', $set_fields)); $fieldExtenderMutex->unlock(); } } else { purgeOption(get_class($this) . '_addedFields'); } foreach ($database as $table => $fields) { //drop fields no longer defined foreach ($fields as $field => $orphaned) { if ($orphaned['Comment'] == "optional_{$me}") { $sql = 'ALTER TABLE ' . prefix($table) . ' DROP `' . $field . '`'; setupQuery($sql); } } } }