function DLM_update_001() { global $_CONF, $_LANG_UPDATE; $retval = ''; $pnum = '#001'; $desc = DLM_check_001(); if (!empty($desc)) { require_once $_CONF['path'] . 'plugins/downloads/install_defaults.php'; require_once $_CONF['path_system'] . 'classes/config.class.php'; if (function_exists('COM_versionCompare')) { DLM_update_ConfValues_addTabs(); } DLM_updateSortOrder(); $msg = sprintf($_LANG_UPDATE['process_completed'], $pnum); $retval .= '<p style="color:green">' . $msg . '</p>' . LB; } else { $msg = sprintf($_LANG_UPDATE['process_canceled'], $pnum); $retval .= '<p style="color:red">' . $msg . '</p>' . LB; } return $retval; }
/** * Called by the plugin Editor to run the SQL Update for a plugin update */ function DLM_upgrade() { global $_CONF, $_TABLES, $_DB_dbms; $pi_name = 'downloads'; $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = '{$pi_name}'"); $func = "plugin_chkVersion_{$pi_name}"; $code_version = $func(); if ($installed_version == $code_version) { return true; } $func = "plugin_compatible_with_this_version_{$pi_name}"; if (!$func($pi_name)) { return 3002; } if (version_compare($installed_version, '1.1.0') < 0) { require_once $_CONF['path'] . 'plugins/downloads/install_defaults.php'; require_once $_CONF['path_system'] . 'classes/config.class.php'; if (function_exists('COM_versionCompare')) { DLM_update_ConfValues_addTabs(); } DLM_updateSortOrder(); } $func = "plugin_autoinstall_{$pi_name}"; $inst_parms = $func($pi_name); $pi_gl_version = $inst_parms['info']['pi_gl_version']; require_once $_CONF['path'] . 'plugins/downloads/sql/' . $_DB_dbms . '_updates.php'; $current_version = $installed_version; if (version_compare($current_version, '1.1.0') < 0) { $current_version = '1.1.0'; } $done = false; while (!$done) { switch ($current_version) { case '1.1.0': if (isset($_UPDATES[$current_version])) { $_SQL = $_UPDATES[$current_version]; foreach ($_SQL as $sql) { DB_query($sql); } } $current_version = '1.2.0'; break; default: $done = true; break; } } // Update the version numbers DB_query("UPDATE {$_TABLES['plugins']} " . "SET pi_version = '{$code_version}', pi_gl_version = '{$pi_gl_version}' " . "WHERE pi_name = '{$pi_name}'"); COM_errorLog(ucfirst($pi_name) . " plugin was successfully updated to version {$code_version}."); return true; }
/** * Initialize Downloads Plugin configuration * * Creates the database entries for the configuation if they don't already * exist. Initial values will be taken from $_DLM_CONF if available (e.g. from * an old config.php), uses $_DLM_DEFAULT otherwise. * * @return boolean true: success; false: an error occurred * */ function plugin_initconfig_downloads() { global $_CONF, $_DLM_CONF, $_DLM_DEFAULT; if (is_array($_DLM_CONF) && count($_DLM_CONF) > 1) { $_DLM_DEFAULT = array_merge($_DLM_DEFAULT, $_DLM_CONF); } $c = config::get_instance(); $n = 'downloads'; $o = 1; if ($c->group_exists($n)) { return true; } $c->add('sg_main', NULL, 'subgroup', 0, 0, NULL, 0, true, $n); // ---------------------------------- $c->add('fs_main', NULL, 'fieldset', 0, 0, NULL, 0, true, $n); $c->add('loginrequired', $_DLM_DEFAULT['loginrequired'], 'select', 0, 0, 0, $o++, true, $n); $c->add('hidemenu', $_DLM_DEFAULT['hidemenu'], 'select', 0, 0, 0, $o++, true, $n); $c->add('delete_download', $_DLM_DEFAULT['delete_download'], 'select', 0, 0, 0, $o++, true, $n); $c->add('download_perpage', $_DLM_DEFAULT['download_perpage'], 'text', 0, 0, 0, $o++, true, $n); $c->add('download_popular', $_DLM_DEFAULT['download_popular'], 'text', 0, 0, 0, $o++, true, $n); $c->add('download_uploadselect', $_DLM_DEFAULT['download_uploadselect'], 'select', 0, 0, 0, $o++, true, $n); $c->add('download_emailoption', $_DLM_DEFAULT['download_emailoption'], 'select', 0, 0, 0, $o++, true, $n); $c->add('filepermissions', $_DLM_DEFAULT['filepermissions'], 'text', 0, 0, 0, $o++, true, $n); $c->add('postmode', $_DLM_DEFAULT['postmode'], 'select', 0, 0, 5, $o++, true, $n); $c->add('enabled_mg_autotag', $_DLM_DEFAULT['enabled_mg_autotag'], 'select', 0, 0, 0, $o++, true, $n); // ---------------------------------- $c->add('fs_tnimage', NULL, 'fieldset', 0, 1, NULL, 0, true, $n); $c->add('show_tn_image', $_DLM_DEFAULT['show_tn_image'], 'select', 0, 1, 0, $o++, true, $n); $c->add('show_tn_only_exists', $_DLM_DEFAULT['show_tn_only_exists'], 'select', 0, 1, 0, $o++, true, $n); $c->add('max_tnimage_width', $_DLM_DEFAULT['max_tnimage_width'], 'text', 0, 1, 0, $o++, true, $n); $c->add('max_tnimage_height', $_DLM_DEFAULT['max_tnimage_height'], 'text', 0, 1, 0, $o++, true, $n); $c->add('tnimage_format', $_DLM_DEFAULT['tnimage_format'], 'select', 0, 1, 30, $o++, true, $n); // ---------------------------------- $c->add('fs_category', NULL, 'fieldset', 0, 2, NULL, 0, true, $n); $c->add('download_useshots', $_DLM_DEFAULT['download_useshots'], 'select', 0, 2, 0, $o++, true, $n); $c->add('download_shotwidth', $_DLM_DEFAULT['download_shotwidth'], 'text', 0, 2, 0, $o++, true, $n); // ---------------------------------- $c->add('fs_whatsnew_block', NULL, 'fieldset', 0, 3, NULL, 0, true, $n); $c->add('download_whatsnew', $_DLM_DEFAULT['download_whatsnew'], 'select', 0, 3, 0, $o++, true, $n); $c->add('download_newdownloads', $_DLM_DEFAULT['download_newdownloads'], 'text', 0, 3, 0, $o++, true, $n); $c->add('whatsnew_perioddays', $_DLM_DEFAULT['whatsnew_perioddays'], 'text', 0, 3, 0, $o++, true, $n); // ---------------------------------- $c->add('fs_history', NULL, 'fieldset', 0, 4, NULL, 0, true, $n); $c->add('download_dlreport', $_DLM_DEFAULT['download_dlreport'], 'select', 0, 4, 20, $o++, true, $n); $c->add('cut_own_download', $_DLM_DEFAULT['cut_own_download'], 'select', 0, 4, 0, $o++, true, $n); $c->add('sg_Miscellaneous', NULL, 'subgroup', 1, 0, NULL, 0, true, $n); // ---------------------------------- $c->add('fs_path', NULL, 'fieldset', 1, 5, NULL, 0, true, $n); $c->add('path_filestore', $_DLM_DEFAULT['path_filestore'], 'text', 1, 5, 0, $o++, true, $n); $c->add('path_snapstore', $_DLM_DEFAULT['path_snapstore'], 'text', 1, 5, 0, $o++, true, $n); $c->add('path_snapcat', $_DLM_DEFAULT['path_snapcat'], 'text', 1, 5, 0, $o++, true, $n); $c->add('path_tnstore', $_DLM_DEFAULT['path_tnstore'], 'text', 1, 5, 0, $o++, true, $n); // ---------------------------------- $c->add('fs_url', NULL, 'fieldset', 1, 6, NULL, 0, true, $n); $c->add('snapstore_url', $_DLM_DEFAULT['snapstore_url'], 'text', 1, 6, 0, $o++, true, $n); $c->add('snapcat_url', $_DLM_DEFAULT['snapcat_url'], 'text', 1, 6, 0, $o++, true, $n); $c->add('tnstore_url', $_DLM_DEFAULT['tnstore_url'], 'text', 1, 6, 0, $o++, true, $n); // ---------------------------------- $c->add('fs_permissions', NULL, 'fieldset', 1, 7, NULL, 0, true, $n); $c->add('default_permissions', $_DLM_DEFAULT['default_permissions'], '@select', 1, 7, 12, $o++, true, $n); if (function_exists('COM_versionCompare')) { DLM_update_ConfValues_addTabs(); } return true; }