/** * create the options form, using the {@link TableEditor} * * {@link TableEditor} is able to handle saving of the data himself * @uses TableEditor * @return string html-content * @global array country acronyms and names * @global DB used for database access */ function createOptionsForm() { global $country, $db, $CONFIG_INSTALL_SUBDIR; $x = PageAdminPanel::scanSubdirectories($CONFIG_INSTALL_SUBDIR . 'styles'); $styles = array(); foreach ($x as $q) { $styles[$q] = $q; } $cont = '<fieldset class="options-options">'; $cont .= '<legend>Change Global Options</legend>'; $tEdit = new TableEditor($db, TABLE_OPTIONS, 'optID', array('optID' => 'hidden', 'interfaceStyle' => $styles, 'requireLogin' => array('0' => 'no', '1' => 'yes'), 'msgLogin' => 'textarea-4-30', 'allowUserReg' => array('no' => 'no', 'everyone' => 'allow for everyone', 'contactOnly' => 'only allow for contacts', 'contactOnlyNoConfirm' => 'only allow for contacts, no confirmation'), 'msgWelcome' => 'textarea-4-30', 'defaultGroup' => 'text-30', 'limitEntries' => 'text-5', 'autocompleteLimit' => 'text-3', 'bdayDisplay' => array('0' => 'no', '1' => 'yes'), 'recentlyChangedDisplay' => array('0' => 'no', '1' => 'yes'), 'recentlyChangedLimit' => 'text-3', 'bdayInterval' => 'text-3', 'picAlwaysDisplay' => array('0' => 'no', '1' => 'yes'), 'picWidth' => 'text-5', 'picHeight' => 'text-5', 'deleteTrashMode' => array('0' => 'no', '1' => 'yes'), 'picAllowUpload' => array('0' => 'no', '1' => 'yes'), 'picCrop' => array('0' => 'Resize', '1' => 'Resize and Crop', '2' => 'Resize and Fit'), 'picForceWidth' => array('0' => 'no', '1' => 'yes'), 'picForceHeight' => array('0' => 'no', '1' => 'yes'), 'countryDefault' => $country, 'language' => array_merge(array('NULL' => 'autodetect'), Localizer::getSingleton()->availableLanguages()), 'eMailAdmin' => array('0' => 'no', '1' => 'yes'), 'adminEmailSubject' => 'text-40', 'adminEmailFooter' => 'textarea-4-30', 'administrativeLock' => array('0' => 'no', '1' => 'yes'), 'telURI' => 'hidden', 'faxURI' => 'hidden', 'TABversion' => 'hidden', 'useMailScript' => array('0' => 'no', '1' => 'yes')), array('interfaceStyle' => 'User interface: CSS style', 'bdayDisplay' => 'Main list: display dates', 'recentlyChangedDisplay' => 'Main list: display recently changed contacts', 'recentlyChangedLimit' => 'Main list: maximum number for recently changed contacts and dates', 'bdayInterval' => 'Main list: display dates/recently changed contacts n days forward/backward', 'limitEntries' => 'Main list: limit entries per page', 'autocompleteLimit' => 'Main list: maximum number of autocomplete search results', 'msgWelcome' => 'Main list: welcome message', 'defaultGroup' => 'Main list: default group', 'picAlwaysDisplay' => 'Contact: always display picture', 'picWidth' => 'Contact: picture width', 'picHeight' => 'Contact: picture height', 'picForceWidth' => 'Contact: force picture width by html', 'picForceHeight' => 'Contact: force picture height by html', 'deleteTrashMode' => 'Edit: trash mode (only admin deletes contacts permanently)', 'countryDefault' => 'Edit: default country', 'picAllowUpload' => 'Edit: allow picture upload', 'picCrop' => 'Edit: picture clip mode', 'picDupeMode' => 'Edit: duplicate picture mode', 'msgLogin' => 'Login: login message', 'allowUserReg' => 'Login: allow self registration', 'requireLogin' => 'Login: require login to access contacts', 'eMailAdmin' => 'Login: BCC email to all admins upon self registration (admin can confirm)', 'useMailScript' => 'Users can send email with a web interface from the server (feature will be dropped if not in demand - post to discussion forums if you need this)', 'language' => 'User interface language', 'adminEmailSubject' => 'ADMIN: email subject', 'adminEmailFooter' => 'ADMIN: email signature', 'administrativeLock' => 'ADMIN: lock modifications (edit and delete)'), null, 'text', true); $cont .= $tEdit->create('', ''); $cont .= '</fieldset>'; return $cont; }
$classname = StringHelper::cleanGPC($_GET['plugin']); $plugin = new $classname(); $plugin->installPlugin(); $db->query('UPDATE ' . TABLE_PLUGINS . ' SET state = ' . $db->escape('activated') . ' WHERE name = ' . $db->escape(StringHelper::cleanGPC($_GET['plugin']))); } break; case 'upgrade': if (isset($_GET['plugin'])) { $classname = StringHelper::cleanGPC($_GET['plugin']); $db->query('SELECT version FROM ' . TABLE_PLUGINS . ' WHERE name="' . $classname . '"'); // retrieve old version $r = $db->next(); $plugin = new $classname(); $plugin->upgradePlugin($r['version']); } break; case 'uninstall': if (isset($_GET['plugin'])) { $classname = StringHelper::cleanGPC($_GET['plugin']); $plugin = new $classname(); $plugin->uninstallPlugin(); $db->query('UPDATE ' . TABLE_PLUGINS . ' SET state = ' . $db->escape('not installed') . ' WHERE name = ' . $db->escape(StringHelper::cleanGPC($_GET['plugin']))); } break; } // show admin panel $page = new PageAdminPanel(); echo $page->create(); exit;