function check_writable_r($dir, $chmod = 0666, $func = CHMOD_FILE, $first = false) { $dh = opendir($dir); if (!$first) { check_writable($dir, $chmod, false, $func); } while ($file = readdir($dh)) { if ($file != '.' && $file != '..') { $fullpath = $dir . DIRECTORY_SEPARATOR . $file; if (is_file($fullpath)) { check_writable($fullpath, $chmod, false, $func); } elseif (is_dir($fullpath)) { check_writable_r($fullpath, $chmod, $func, true); } } } closedir($dh); }
<?php if (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) == "function.viscacha_backend.php") { die('Error: Hacking Attempt'); } // Gets a file with php-functions @(include_once "classes/function.phpcore.php"); require_once "classes/class.filesystem.php"; $filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']); $filesystem->set_wd($config['ftp_path']); @(include_once "classes/function.chmod.php"); if ($config['check_filesystem'] == 1) { check_writable('admin/data/notes.php'); check_writable_r('docs'); check_writable_r('language'); check_executable_r('admin/backup'); check_executable_r('admin/data'); check_executable_r('designs'); check_executable_r('docs'); check_executable_r('images'); check_executable_r('templates'); check_executable_r('components'); check_executable_r('language'); check_executable('classes/cron/jobs'); check_executable('classes/feedcreator'); check_executable('classes/fonts'); check_executable('classes/geshi'); check_executable('classes/graphic/noises'); check_writable_r('templates'); } @ini_set('default_charset', '');
/** * This function displays the requirements for installing Chamilo. * * @param string $installType * @param boolean $badUpdatePath * @param boolean $badUpdatePath * @param string $updatePath The updatePath given (if given) * @param array $update_from_version_8 The different subversions from version 1.9 * * @author unknow * @author Patrick Cool <*****@*****.**>, Ghent University */ function display_requirements($installType, $badUpdatePath, $updatePath = '', $update_from_version_8 = array()) { global $_setting; echo '<div class="RequirementHeading"><h2>' . display_step_sequence() . get_lang('Requirements') . "</h2></div>"; echo '<div class="RequirementText">'; echo '<strong>' . get_lang('ReadThoroughly') . '</strong><br />'; echo get_lang('MoreDetails') . ' <a href="../../documentation/installation_guide.html" target="_blank">' . get_lang('ReadTheInstallationGuide') . '</a>.<br />' . "\n"; if ($installType == 'update') { echo get_lang('IfYouPlanToUpgradeFromOlderVersionYouMightWantToHaveAlookAtTheChangelog') . '<br />'; } echo '</div>'; // SERVER REQUIREMENTS echo '<div class="RequirementHeading"><h4>' . get_lang('ServerRequirements') . '</h4>'; $timezone = checkPhpSettingExists("date.timezone"); if (!$timezone) { echo "<div class='warning-message'>" . Display::return_icon('warning.png', get_lang('Warning'), '', ICON_SIZE_MEDIUM) . get_lang("DateTimezoneSettingNotSet") . "</div>"; } echo '<div class="RequirementText">' . get_lang('ServerRequirementsInfo') . '</div>'; echo '<div class="RequirementContent">'; echo '<table class="table"> <tr> <td class="requirements-item">' . get_lang('PHPVersion') . ' >= ' . REQUIRED_PHP_VERSION . '</td> <td class="requirements-value">'; if (phpversion() < REQUIRED_PHP_VERSION) { echo '<strong><font color="red">' . get_lang('PHPVersionError') . '</font></strong>'; } else { echo '<strong><font color="green">' . get_lang('PHPVersionOK') . ' ' . phpversion() . '</font></strong>'; } echo '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.session.php" target="_blank">Session</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('session', get_lang('Yes'), get_lang('ExtensionSessionsNotAvailable')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.mysql.php" target="_blank">MySQL</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('mysql', get_lang('Yes'), get_lang('ExtensionMySQLNotAvailable')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.zlib.php" target="_blank">Zlib</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('zlib', get_lang('Yes'), get_lang('ExtensionZlibNotAvailable')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.pcre.php" target="_blank">Perl-compatible regular expressions</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('pcre', get_lang('Yes'), get_lang('ExtensionPCRENotAvailable')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.xml.php" target="_blank">XML</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('xml', get_lang('Yes'), get_lang('No')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.intl.php" target="_blank">Internationalization</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('intl', get_lang('Yes'), get_lang('No')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.json.php" target="_blank">JSON</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('json', get_lang('Yes'), get_lang('No')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.image.php" target="_blank">GD</a> ' . get_lang('support') . '</td> <td class="requirements-value">' . checkExtension('gd', get_lang('Yes'), get_lang('ExtensionGDNotAvailable')) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.mbstring.php" target="_blank">Multibyte string</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td> <td class="requirements-value">' . checkExtension('mbstring', get_lang('Yes'), get_lang('ExtensionMBStringNotAvailable'), true) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.iconv.php" target="_blank">Iconv</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td> <td class="requirements-value">' . checkExtension('iconv', get_lang('Yes'), get_lang('No'), true) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.ldap.php" target="_blank">LDAP</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td> <td class="requirements-value">' . checkExtension('ldap', get_lang('Yes'), get_lang('ExtensionLDAPNotAvailable'), true) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://xapian.org/" target="_blank">Xapian</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td> <td class="requirements-value">' . checkExtension('xapian', get_lang('Yes'), get_lang('No'), true) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/en/book.curl.php" target="_blank">cURL</a> ' . get_lang('support') . ' (' . get_lang('Optional') . ')</td> <td class="requirements-value">' . checkExtension('curl', get_lang('Yes'), get_lang('No'), true) . '</td> </tr> </table>'; echo ' </div>'; echo '</div>'; // RECOMMENDED SETTINGS // Note: these are the settings for Joomla, does this also apply for Chamilo? // Note: also add upload_max_filesize here so that large uploads are possible echo '<div class="RequirementHeading"><h4>' . get_lang('RecommendedSettings') . '</h4>'; echo '<div class="RequirementText">' . get_lang('RecommendedSettingsInfo') . '</div>'; echo '<div class="RequirementContent">'; echo '<table class="table"> <tr> <th>' . get_lang('Setting') . '</th> <th>' . get_lang('Recommended') . '</th> <th>' . get_lang('Actual') . '</th> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/features.safe-mode.php">Safe Mode</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('safe_mode', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ref.errorfunc.php#ini.display-errors">Display Errors</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('display_errors', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.file-uploads">File Uploads</a></td> <td class="requirements-recommended">' . Display::label('ON', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('file_uploads', 'ON') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ref.info.php#ini.magic-quotes-gpc">Magic Quotes GPC</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('magic_quotes_gpc', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ref.info.php#ini.magic-quotes-runtime">Magic Quotes Runtime</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('magic_quotes_runtime', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/security.globals.php">Register Globals</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('register_globals', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ref.session.php#ini.session.auto-start">Session auto start</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('session.auto_start', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.short-open-tag">Short Open Tag</a></td> <td class="requirements-recommended">' . Display::label('OFF', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('short_open_tag', 'OFF') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly">Cookie HTTP Only</a></td> <td class="requirements-recommended">' . Display::label('ON', 'success') . '</td> <td class="requirements-value">' . checkPhpSetting('session.cookie_httponly', 'ON') . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.upload-max-filesize">Maximum upload file size</a></td> <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_UPLOAD_MAX_FILESIZE . 'M', 'success') . '</td> <td class="requirements-value">' . compare_setting_values(ini_get('upload_max_filesize'), REQUIRED_MIN_UPLOAD_MAX_FILESIZE) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://php.net/manual/ini.core.php#ini.post-max-size">Maximum post size</a></td> <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_POST_MAX_SIZE . 'M', 'success') . '</td> <td class="requirements-value">' . compare_setting_values(ini_get('post_max_size'), REQUIRED_MIN_POST_MAX_SIZE) . '</td> </tr> <tr> <td class="requirements-item"><a href="http://www.php.net/manual/en/ini.core.php#ini.memory-limit">Memory Limit</a></td> <td class="requirements-recommended">' . Display::label('>= ' . REQUIRED_MIN_MEMORY_LIMIT . 'M', 'success') . '</td> <td class="requirements-value">' . compare_setting_values(ini_get('memory_limit'), REQUIRED_MIN_MEMORY_LIMIT) . '</td> </tr> </table>'; echo ' </div>'; echo '</div>'; // DIRECTORY AND FILE PERMISSIONS echo '<div class="RequirementHeading"><h4>' . get_lang('DirectoryAndFilePermissions') . '</h4>'; echo '<div class="RequirementText">' . get_lang('DirectoryAndFilePermissionsInfo') . '</div>'; echo '<div class="RequirementContent">'; $course_attempt_name = '__XxTestxX__'; $course_dir = api_get_path(SYS_COURSE_PATH) . $course_attempt_name; //Just in case @unlink($course_dir . '/test.php'); @rmdir($course_dir); $perms_dir = array(0777, 0755, 0775, 0770, 0750, 0700); $perms_fil = array(0666, 0644, 0664, 0660, 0640, 0600); $course_test_was_created = false; $dir_perm_verified = 0777; foreach ($perms_dir as $perm) { $r = @mkdir($course_dir, $perm); if ($r === true) { $dir_perm_verified = $perm; $course_test_was_created = true; break; } } $fil_perm_verified = 0666; $file_course_test_was_created = false; if (is_dir($course_dir)) { foreach ($perms_fil as $perm) { if ($file_course_test_was_created == true) { break; } $r = @touch($course_dir . '/test.php', $perm); if ($r === true) { $fil_perm_verified = $perm; if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) { $file_course_test_was_created = true; } } } } @unlink($course_dir . '/test.php'); @rmdir($course_dir); $_SESSION['permissions_for_new_directories'] = $_setting['permissions_for_new_directories'] = $dir_perm_verified; $_SESSION['permissions_for_new_files'] = $_setting['permissions_for_new_files'] = $fil_perm_verified; $dir_perm = Display::label('0' . decoct($dir_perm_verified), 'info'); $file_perm = Display::label('0' . decoct($fil_perm_verified), 'info'); $courseTestLabel = Display::label(get_lang('No'), 'important'); if ($course_test_was_created && $file_course_test_was_created) { $courseTestLabel = Display::label(get_lang('Yes'), 'success'); } if ($course_test_was_created && !$file_course_test_was_created) { $courseTestLabel = Display::label(sprintf(get_lang('InstallWarningCouldNotInterpretPHP'), api_get_path(WEB_COURSE_PATH) . $course_attempt_name . '/test.php'), 'warning'); } if (!$course_test_was_created && !$file_course_test_was_created) { $courseTestLabel = Display::label(get_lang('No'), 'important'); } $oldConf = ''; if (file_exists(api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php')) { $oldConf = '<tr> <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'inc/conf</td> <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'inc/conf') . '</td> </tr>'; } echo '<table class="table"> ' . $oldConf . ' <tr> <td class="requirements-item">' . api_get_path(SYS_APP_PATH) . '</td> <td class="requirements-value">' . check_writable(api_get_path(SYS_APP_PATH)) . '</td> </tr> <tr> <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'default_course_document/images/</td> <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'default_course_document/images/') . '</td> </tr> <tr> <td class="requirements-item">' . api_get_path(SYS_CODE_PATH) . 'lang/</td> <td class="requirements-value">' . check_writable(api_get_path(SYS_CODE_PATH) . 'lang/', true) . ' <br />(' . get_lang('SuggestionOnlyToEnableSubLanguageFeature') . ')</td> </tr> <tr> <td class="requirements-item">' . api_get_path(SYS_PATH) . 'vendor/</td> <td class="requirements-value">' . checkReadable(api_get_path(SYS_PATH) . 'vendor') . '</td> </tr> <tr> <td class="requirements-item">' . api_get_path(SYS_PUBLIC_PATH) . '</td> <td class="requirements-value">' . check_writable(api_get_path(SYS_PUBLIC_PATH)) . '</td> </tr> <tr> <td class="requirements-item">' . get_lang('CourseTestWasCreated') . '</td> <td class="requirements-value">' . $courseTestLabel . ' </td> </tr> <tr> <td class="requirements-item">' . get_lang('PermissionsForNewDirs') . '</td> <td class="requirements-value">' . $dir_perm . ' </td> </tr> <tr> <td class="requirements-item">' . get_lang('PermissionsForNewFiles') . '</td> <td class="requirements-value">' . $file_perm . ' </td> </tr> '; echo ' </table>'; echo ' </div>'; echo '</div>'; if ($installType == 'update' && (empty($updatePath) || $badUpdatePath)) { if ($badUpdatePath) { ?> <div class="alert alert-warning"> <?php echo get_lang('Error'); ?> !<br /> Chamilo <?php echo implode('|', $update_from_version_8) . ' ' . get_lang('HasNotBeenFoundInThatDir'); ?> . </div> <?php } else { echo '<br />'; } ?> <div class="row"> <div class="col-md-12"> <p><?php echo get_lang('OldVersionRootPath'); ?> : <input type="text" name="updatePath" size="50" value="<?php echo $badUpdatePath && !empty($updatePath) ? htmlentities($updatePath) : api_get_path(SYS_SERVER_ROOT_PATH) . 'old_version/'; ?> " /> </p> <p> <button type="submit" class="btn btn-default" name="step1" value="<?php echo get_lang('Back'); ?> " > <i class="fa fa-backward"> <?php echo get_lang('Back'); ?> </i> </button> <input type="hidden" name="is_executable" id="is_executable" value="-" /> <button type="submit" class="btn btn-success" name="<?php echo isset($_POST['step2_update_6']) ? 'step2_update_6' : 'step2_update_8'; ?> " value="<?php echo get_lang('Next'); ?> >" > <i class="fa fa-forward"> </i> <?php echo get_lang('Next'); ?> </button> </p> </div> </div> <?php } else { $error = false; // First, attempt to set writing permissions if we don't have them yet $perm = api_get_permissions_for_new_directories(); $perm_file = api_get_permissions_for_new_files(); $notWritable = array(); $checked_writable = api_get_path(SYS_APP_PATH); if (!is_writable($checked_writable)) { $notWritable[] = $checked_writable; @chmod($checked_writable, $perm); } $checked_writable = api_get_path(SYS_PUBLIC_PATH); if (!is_writable($checked_writable)) { $notWritable[] = $checked_writable; @chmod($checked_writable, $perm); } $checked_writable = api_get_path(SYS_CODE_PATH) . 'default_course_document/images/'; if (!is_writable($checked_writable)) { $notWritable[] = $checked_writable; @chmod($checked_writable, $perm); } if ($course_test_was_created == false) { $error = true; } $checked_writable = api_get_path(CONFIGURATION_PATH) . 'configuration.php'; if (file_exists($checked_writable) && !is_writable($checked_writable)) { $notWritable[] = $checked_writable; @chmod($checked_writable, $perm_file); } // Second, if this fails, report an error //--> The user would have to adjust the permissions manually if (count($notWritable) > 0) { $error = true; echo '<div class="error-message">'; echo '<center><h3>' . get_lang('Warning') . '</h3></center>'; printf(get_lang('NoWritePermissionPleaseReadInstallGuide'), '</font> <a href="../../documentation/installation_guide.html" target="blank">', '</a> <font color="red">'); echo '</div>'; echo '<ul>'; foreach ($notWritable as $value) { echo '<li>' . $value . '</li>'; } echo '</ul>'; } elseif (file_exists(api_get_path(CONFIGURATION_PATH) . 'configuration.php')) { // Check wether a Chamilo configuration file already exists. echo '<div class="alert alert-warning"><h4><center>'; echo get_lang('WarningExistingLMSInstallationDetected'); echo '</center></h4></div>'; } // And now display the choice buttons (go back or install) ?> <p align="center" style="padding-top:15px"> <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?> " > <i class="fa fa-backward"> </i> <?php echo get_lang('Previous'); ?> </button> <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?> " <?php if ($error) { echo 'disabled="disabled"'; } ?> > <i class="fa fa-forward"> </i> <?php echo get_lang('NewInstallation'); ?> </button> <input type="hidden" name="is_executable" id="is_executable" value="-" /> <?php // Real code echo '<button type="submit" class="btn btn-default" name="step2_update_8" value="Upgrade from Chamilo 1.9.x"'; if ($error) { echo ' disabled="disabled"'; } echo ' ><i class="fa fa-forward"> </i> ' . get_lang('UpgradeFromLMS19x') . '</button>'; echo '</p>'; } }
include BASE_DIR . '/inc/config.php'; include BASE_DIR . '/functions/func.common.php'; include BASE_DIR . '/class/class.template.php'; $AVE_Template = new AVE_Template(BASE_DIR . '/install/tpl/'); $ver = APP_NAME . ' ' . APP_VERSION; $AVE_Template->assign('version_setup', $lang_i['install_name'] . ' ' . $ver); $AVE_Template->assign('app_info', APP_INFO); $AVE_Template->assign('la', $lang_i); $db_connect = check_db_connect($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']); if ($db_connect && $_REQUEST['step'] != 'finish' && check_installed($config['dbpref'])) { echo '<pre>' . $lang_i['installed'] . '</pre>'; exit; } $error_is_required = array(); check_required(); check_writable(); $count_error = sizeof((array) $error_is_required); if (1 == $count_error) { $AVE_Template->assign('error_header', $lang_i['erroro']); } elseif ($count_error > 1) { $AVE_Template->assign('error_header', $lang_i['erroro_more']); } if ($count_error > 0 && !(isset($_REQUEST['force']) && 1 == $_REQUEST['force'])) { $AVE_Template->assign('error_is_required', $error_is_required); $AVE_Template->display('error.tpl'); exit; } $_REQUEST['step'] = isset($_REQUEST['step']) ? $_REQUEST['step'] : ''; switch ($_REQUEST['step']) { case '': case '1':
echo foot(); } elseif ($job == "delete2") { $path = urldecode($gpc->get('path', none)); $type = $gpc->get('type', str); $name = iif($type == 'dir', 'directory', 'file'); echo head(); $repath = urlencode(extract_dir($path, false)); if (@rmdirr($path)) { ok('admin.php?action=explorer&path=' . $repath, ucfirst($name) . ' successfully deleted!'); } else { error('admin.php?action=explorer&path=' . $repath); } } elseif ($job == "edit") { echo head(); $file = urldecode($gpc->get('path', none)); check_writable($file); if (!$ServerNavigator->checkEdit($file)) { error('admin.php?action=explorer&path=' . urlencode(extract_dir($file, false)), 'File is not editable.'); } $content = file_get_contents($file); ?> <form name="form" method="post" action="admin.php?action=explorer&job=edit2&path=<?php echo urlencode($file); ?> "> <table class="border" border="0" cellspacing="0" cellpadding="4" align="center"> <tr> <td class="obox" colspan="2"><b>Edit a File</b></td> </tr> <tr> <td class="mbox" width="15%">Content:</td>
// or upgrading from another one. case 1: if (isset($config['install_type']) && $config['install_type'] == 'upgrade') { echo "<h3>Upgrading</h3>"; $intro_func = 'upgrade_from_' . $config['upgrade_from'] . '_intro'; if (function_exists($intro_func)) { $intro_func(); } } ?> <h3>File Permissions</h3> <p>bBlog need to be able to write to disk to store it's cache of templates, and if you want to use the blo.gs favorites functionality.</p> <p>We will now check the permissions of the 'cache' folder, the 'compiled_templates' folder, and the 'cache/favorites.xml' file. They all need to be writable by the webserver. This will involve chmodding the folders and files with your ftp client ( if you're not using ftp you probally know what do do here ). Permissions should either be 775. If that doesn't work, 777 will. </p> <p>Additionally, ./config.php should be writable during the install. At the end of the install when the config file is written to disk, you should change the permissions back so it is not writable by the webserver.</p> <?php $test = check_writable(); if ($test) { echo "<p>Great, all working. <input type='submit' name='continue' value='Click here to continue' /></p>"; } else { echo "<p>Please fix above errors, then <input type='submit' name='continue' value='Click here to try again' /></p>"; } break; //Case 2, If user is installing from scratch, // provide the DB & Blog settings page //Case 2, If user is installing from scratch, // provide the DB & Blog settings page case 2: ?> <h3>Database and blog settings</h3> <?php if (isset($message)) {
if (isset($_POST['install_type'])) { $config['install_type'] = $_POST['install_type']; if ($_POST['install_type'] == 'upgrade') { $config['upgrade_from'] = $_POST['upgrade_from']; } } else { break; } $step = 1; break; case 1: // tests to get to next level // 1 - things need to be writable ob_start(); // we don't want any errors if (check_writable()) { $step = 2; } ob_end_clean(); break; case 2: // tests : // 1 - mysql connects // 2 - everything is set $allfilled = TRUE; if (isset($_POST['blogname'])) { $config['blogname'] = $_POST['blogname']; } else { $missing_fields = "'Blog name' "; } if (isset($_POST['blogdescription'])) {
function dmsguestbook_meta_description_option_page() { $dmsguestbook_options = isset($dmsguestbook_options) ? $dmsguestbook_options : ''; $num_rows_option = isset($num_rows_option) ? $num_rows_option : ''; $_SESSION['missing_options'] = isset($_SESSION['missing_options']) ? $_SESSION['missing_options'] : ''; $_SESSION['fixed_update'] = isset($_SESSION['fixed_update']) ? $_SESSION['fixed_update'] : ''; $_REQUEST['dbs'] = isset($_REQUEST['dbs']) ? $_REQUEST['dbs'] : ''; $_REQUEST['basic'] = isset($_REQUEST['basic']) ? $_REQUEST['basic'] : ''; $_REQUEST['advanced'] = isset($_REQUEST['advanced']) ? $_REQUEST['advanced'] : ''; $_REQUEST['action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; $location = isset($location) ? $location : ''; $fixed_update = isset($fixed_update) ? $fixed_update : ''; $url = get_bloginfo('wpurl'); /* initialize */ $options = create_options(); $options_name = default_options_array(); /* global var for DMSGuestbook and option database */ global $wpdb; $table_name = $wpdb->prefix . "dmsguestbook"; $table_option = $wpdb->prefix . "options"; $table_posts = $wpdb->prefix . "posts"; update_db_fields(); ?> <!-- header --> <div class="wrap"> <h2>DMSGuestbook Option</h2> <ul> <li>1.) <?php echo __("Create a page where you want to display the DMSGuestbook.", "dmsguestbook"); ?> </li> <li>2.) <?php echo __("Save the page and assign it under \"Guestbook settings\" -> \"Basic\".", "dmsguestbook"); ?> </li> <li>3.) <?php echo __("Customize the guestbook to your desire!", "dmsguestbook"); ?> </li> </ul> <br /> <?php /* if option(s) are missing */ if (strlen($_SESSION['missing_options']) > 0) { $_SESSION['fixed_update'] = get_option("DMSGuestbook_options") . $_SESSION["missing_options_fixed_update"]; echo "<b style='width:100%;color:#cc0000;'>" . __("One or more options are missing.", "dmsguestbook") . "</b><br />"; echo "<form name='form0' method='post' action='{$location}'>\n \t\t\t<input name='action' value='fix_update' type='hidden' />\n \t\t\t<input name='fixed' value='{$fixed_update}' type='hidden' />\n \t\t\t<input class='button-secondary action' style='font-weight:bold; margin:10px 0px; width:250px;' type='submit' value='" . __("Update options database", "dmsguestbook") . "' />\n\t\t\t</form>"; missing_options(); unset($_SESSION["missing_options"]); } /* save the fixed options */ if ($_REQUEST['action'] == "fix_update") { $restore = str_replace("\r\n", "[br]", $_SESSION['fixed_update']); update_option("DMSGuestbook_options", $restore); message("<b>" . __("Update database", "dmsguestbook") . "...</b>", 300, 800); echo "<meta http-equiv='refresh' content='0; URL={$location}'>"; } /* user can create new DMSGuestbook database if these failed during the installation. */ if ($_REQUEST['action'] == "createnew") { $sql = $wpdb->query("CREATE TABLE " . $table_name . " (\n\t \tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t \tname varchar(50) DEFAULT '' NOT NULL,\n\t \temail varchar(50) DEFAULT '' NOT NULL,\n\t \tgravatar varchar(32) DEFAULT '' NOT NULL,\n\t \turl varchar(50) DEFAULT '' NOT NULL,\n\t \tdate int(10) NOT NULL,\n\t \tip varchar(15) DEFAULT '' NOT NULL,\n\t \tmessage longtext NOT NULL,\n\t \tguestbook int(2) DEFAULT '0' NOT NULL,\n\t \tspam int(1) DEFAULT '0' NOT NULL,\n\t \tadditional varchar(50) NOT NULL,\n\t \tflag int(2) NOT NULL,\n\t \tUNIQUE KEY id (id)\n\t \t)" . mysql_real_escape_string($_REQUEST['collate']) . ""); $abspath = str_replace("\\", "/", ABSPATH); require_once $abspath . 'wp-admin/upgrade-functions.php'; dbDelta($sql); message("<b>{$table_name} " . __("was created", "dmsguestbook") . "...</b>", 300, 800); } /* user can delete DMSGuestbook database after the confirmation */ if ($_REQUEST['action'] == "delete" && $_REQUEST['delete'] == "yes, i am sure") { $wpdb->query('DROP TABLE IF EXISTS ' . $table_name); $abspath = str_replace("\\", "/", ABSPATH); require_once $abspath . 'wp-admin/upgrade-functions.php'; message("<b>{$table_name} " . __("was deleted", "dmsguestbook") . "...</b>", 300, 800); } /* user can create DMSGuestbook option if the failed during the installation. */ if ($_REQUEST['action'] == "createoption") { initialize_option(); message("<b>" . __("DMSGuestbook options", "dmsguestbook") . "<br /></b><br />" . __("Don't forget to set the page id.", "dmsguestbook"), 260, 800); echo "<meta http-equiv='refresh' content='0; URL={$location}'>"; } /* user can delete all DMSGuestbook_ entries in DMSGuestbook option after confirmation. */ if ($_REQUEST['action'] == "deleteoption" && $_REQUEST['confirm_delete_option'] == "delete") { $wpdb->query('DELETE FROM ' . $table_option . ' WHERE option_name LIKE "DMSGuestbook_%"'); $abspath = str_replace("\\", "/", ABSPATH); require_once $abspath . 'wp-admin/upgrade-functions.php'; message("<b>" . __("All DMSGuestbook options were deleted", "dmsguestbook") . "...</b>", 300, 800); } ?> <script type="text/javascript"> //<![CDATA[ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} //]]> </script> <script type="text/javascript" src="../wp-content/plugins/dmsguestbook/js/jquery-1.7.2.js"></script> <link rel="stylesheet" media="screen" type="text/css" href="../wp-content/plugins/dmsguestbook/js/colorpicker/css/colorpicker.css" /> <script type="text/javascript" src="../wp-content/plugins/dmsguestbook/js/colorpicker/js/colorpicker.js"></script> <link type="text/css" href="../wp-content/plugins/dmsguestbook/js/jquery-ui/css/custom-theme/jquery-ui-1.8.5.custom.css" rel="Stylesheet" /> <link type="text/css" href="../wp-content/plugins/dmsguestbook/js/jquery-simple-tooltip-0.9.1/style.css" rel="Stylesheet" /> <script type="text/javascript" src="../wp-content/plugins/dmsguestbook/js/jquery-ui/js/jquery-ui-1.8.5.custom.min.js"></script> <script type="text/javascript" src="../wp-content/plugins/dmsguestbook/js/jquery-simple-tooltip-0.9.1/jquery.simpletooltip-min.js"></script> <script> jQuery(document).ready(function(){ jQuery( "#dmsguestbook-menu" ).accordion({ clearStyle:true, collapsible:true, active:-1 }); jQuery("a.tooltiplink").simpletooltip({ margin: 10 }); jQuery('#bordercolor1').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color2_div').css('background-color', '#' + hex); jQuery('#bordercolor1').val(hex); } }) jQuery('#bordercolor2').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color3_div').css('background-color', '#' + hex); jQuery('#bordercolor2').val(hex); } }) jQuery('#navigationcolor').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color4_div').css('background-color', '#' + hex); jQuery('#navigationcolor').val(hex); } }) jQuery('#separatorcolor').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color1_div').css('background-color', '#' + hex); jQuery('#separatorcolor').val(hex); } }) jQuery('#fontcolor1').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color5_div').css('background-color', '#' + hex); jQuery('#fontcolor1').val(hex); } }) jQuery('#captcha_color').ColorPicker({ onChange: function (hsb, hex, rgb) { jQuery('#Color6_div').css('background-color', '#' + hex); jQuery('#captcha_color').val(hex); } }) }); </script> <?php $collaps_dashboard = "<a href='admin.php?page=dmsguestbook'>\n<img src='../wp-content/plugins/dmsguestbook/img/dashboard.png'><b>" . __("Dashboard", "dmsguestbook") . "</b></a>"; $collaps_dbs = "<a href='admin.php?page=dmsguestbook&dbs=1'>\n<img src='../wp-content/plugins/dmsguestbook/img/server.png'><b>" . __("Database settings", "dmsguestbook") . "</b></a>"; $collaps_basic = "<a href='admin.php?page=dmsguestbook&basic=1'>\n<img src='../wp-content/plugins/dmsguestbook/img/basic.png'><b>" . __("Guestbook settings", "dmsguestbook") . "</b></a>"; $collaps_advanced = "<a href='admin.php?page=dmsguestbook&advanced=1'>\n<img src='../wp-content/plugins/dmsguestbook/img/language.png'><b>" . __("Language settings", "dmsguestbook") . "</b></a>"; ?> <!-- table for DMSGuestbook and DMSGuestbook option environment--> <table style="width:100%;"> <tr> <td><?php echo $collaps_dashboard; ?> </td> <td><?php echo $collaps_dbs; ?> </td> <td><?php echo $collaps_basic; ?> </td> <td><?php echo $collaps_advanced; ?> </td> </tr> </table> <br /><br /><br /> <?php /* dashboard */ if ($_REQUEST['page'] == "dmsguestbook" && ($_REQUEST['dbs'] != 1 && $_REQUEST['basic'] != 1 && $_REQUEST['advanced'] != 1)) { $dashcolor = "#21759B"; function convert($convert) { if ($convert == 1) { return "Yes"; } else { return "No"; } } if (function_exists("gd_info")) { $gd_array = gd_info(); $gd_version = $gd_array["GD Version"]; $gd_freetype = convert($gd_array["FreeType Support"]); $gd_freetype_linkage = $gd_array["FreeType Linkage"]; $gd_png = convert($gd_array["PNG Support"]); } if (CheckAkismet() != "") { $akismet_notify = "Akismet: <span style='color:{$dashcolor};'>" . __("Yes", "dmsguestbook") . "</span>"; } else { $akismet_notify = "Akismet: <span style='color:{$dashcolor};'>" . __("No", "dmsguestbook") . "</span>"; } $abspath = str_replace("\\", "/", ABSPATH); $sqlversion = $wpdb->get_var("SELECT VERSION()"); $css_writable = convert(is_writable($abspath . "wp-content/plugins/dmsguestbook/dmsguestbook.css")); $ttf_readable = convert(is_readable($abspath . "wp-content/plugins/dmsguestbook/captcha/xfiles.ttf")); if (ini_get('memory_limit')) { $memory_limit = ini_get('memory_limit'); } else { $memory_limit = ""; } $result_spam = $wpdb->query("SELECT * FROM {$table_name} WHERE spam = '1'"); $result_post = $wpdb->query("SELECT * FROM {$table_name} WHERE spam = '0'"); $result_approval = $wpdb->query("SELECT * FROM {$table_name} WHERE flag = '1'"); echo "<table style='width:100%;' class='widefat comments' cellspacing='0'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='padding:5px 5px 5px 5px;width:25%;'>" . __("Dashboard", "dmsguestbook") . "</th>\n\t\t<th style='padding:0px 5px 0px 5px;width:25%;'></th>\n\t\t<th style='padding:0px 5px 0px 5px;width:50%;'></th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tr>\n\t\t\t<td style='padding:20px;'>\n\t\t\t<b style='font-size:16px;'><a href='admin.php?page=Entries'>{$result_post}</a> <span style='color:#008000;'>" . __("entries", "dmsguestbook") . "</span></b><br />\n\t\t\t<b style='font-size:16px;'><a href='admin.php?page=Entries&approval=1'>{$result_approval}</a> <span style='color:#ffa500;'>" . __("waiting for approval", "dmsguestbook") . "</span></b><br />\n\t\t\t<b style='font-size:16px;'><a href='admin.php?page=Spam'>{$result_spam}</a> <span style='color:#ff0000;'>" . __("spam", "dmsguestbook") . "</span></b><br />\n\t\t\t<div style='height:40px;'></div>\n\t\t\t<b style='font-size:14px;text-decoration:underline;'>" . __("Server Settings", "dmsguestbook") . "</b>\n\t\t\t<br />" . __("Server", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$_SERVER['SERVER_SOFTWARE']}</span><br />" . __("MYSQL Server", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$sqlversion}</span><br />" . __("Memory Limit", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$memory_limit}</span><br />\n\t\t\t<br />\n\t\t\t<b style='font-size:14px;text-decoration:underline;'>" . __("Graphic Settings", "dmsguestbook") . "</b>\n\t\t\t<br />" . __("GD Version", "dmsguestbook") . ": </b><span style='color:{$dashcolor};'>{$gd_version}</span><br />" . __("Freetype Support", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$gd_freetype}</span><br />" . __("Freetype Linkage", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$gd_freetype_linkage}</span><br />" . __("PNG Support", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$gd_png}</span><br />\n\t\t\t<br />\n\t\t\t<b style='font-size:14px;text-decoration:underline;'>" . __("Permissions", "dmsguestbook") . "</b>\n\t\t\t<br />" . __("Database settings", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role1']}</span><br />" . __("Guestbook settings", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role1']}</span><br />" . __("Language settings", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role1']}</span><br />" . __("Post settings", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role2']}</span><br />" . __("Spam settings", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role3']}</span><br />" . __("phpinfo", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$options['role1']}</span><br />\n\t\t\t</td>\n\n\t\t\t<td style='padding:20px'>\n\t\t\t<b style='font-size:14px;text-decoration:underline;'>" . __("Miscellaneous", "dmsguestbook") . "</b><br />\n\t\t\t{$akismet_notify}<br />" . __("CSS file writable", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$css_writable}</span> <span style='font-size:8px;'>1)</span><br />" . __("xfiles.ttf readable", "dmsguestbook") . ": <span style='color:{$dashcolor};'>{$ttf_readable}</span><br />\n\t\t\t<br />" . __("Captcha Image", "dmsguestbook") . ":<br /><img src='../wp-content/plugins/dmsguestbook/captcha/captcha.php' /> <span style='font-size:8px;'>2)</span><br />\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<div style='background-color:#eeeeee;padding:5px;'>\n\t\t\t<span style='font-size:8px;'>1)</span>" . __("If dmsguestbook.css exists and is writable, all CSS settings will be read from it.<br />Otherwise these settings will be loaded from the database.", "dmsguestbook") . "\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<span style='font-size:8px;'>2)</span>" . __("If you don't see the image here, check the xfiles.ttf and captcha.png permission in your captcha folder.", "dmsguestbook") . "</div>\n\t\t\t</td>\n\n\t\t\t<td style='padding:20px;'>"; echo "<b style='font-size:14px;text-decoration:underline;'>" . __("News", "dmsguestbook") . "</b><br />"; include_once ABSPATH . WPINC . '/rss.php'; unset($rss1); unset($items); $rss1 = fetch_rss('http://www.danielschurter.net/mainsite/category/DMSGuestbook/feed/'); $maxitems = 3; @($items = array_slice($rss1->items, 0, $maxitems)); echo "<ul>"; if (empty($items)) { echo "<li>" . __("No items", "dmsguestbook") . "</li>"; } else { foreach ($items as $item) { echo "<li><a href='{$item['link']}' title='{$item['title']}' target='_blank'>{$item['title']}</a> <span style='color:#666666;font-size:10px;'>" . mb_substr($item['pubdate'], 5, 12) . "</span><br />\n\t\t\t\t\t" . mb_substr($item['description'], 0, 80) . " [...]</li>"; } } echo "</ul>\n\t\t\t<br /><b style='font-size:14px;text-decoration:underline;'>" . __("Infos", "dmsguestbook") . "</b><br />\n\t\t\t<ul>\n\t\t\t\t<li><a href='http://www.danielschurter.net/mainsite/2009/03/05/dmsguestbook-faq/' target='_blank'>" . __("FAQ", "dmsguestbook") . "</a></li>\n\t\t\t\t<li><a href='http://www.danielschurter.net/mainsite/2007/07/28/dmsguestbook-10/' target='_blank'>" . __("Changelog", "dmsguestbook") . "</a></li>\n\t\t\t</ul>\n\n\t\t\t</td>\n\n\t\t</tr>\n\t</table>"; } if ($_REQUEST['dbs'] == 1) { $Role1 = CheckRole($options["role1"], 0); if (!current_user_can("level_" . $Role1) && ROLE != 0) { CheckRole($options["role1"], 1); exit; } /* dmsguestbook datatbase*/ // search prefix_dmsguestbook $result = $wpdb->query("SHOW TABLES LIKE '{$table_name}'"); if ($result > 0) { /* if prefix_dmsguestbook does exist */ $return_dmsguestbook_database = "<b style='color:#00bb00;'>" . sprintf(__("[Status OK] %s does exist.", "dmsguestbook"), $table_name) . "</b><br /><br />" . sprintf(__("Type \"yes, i am sure\" in this textfield if you want delete %s", "dmsguestbook"), $table_name) . "<br />\n \t\t\t<b>" . __("All guestbook data will be lost!", "dmsguestbook") . "</b><br />\n \t\t\t<form name='form0' method='post' action='{$location}'>\n \t\t\t<input type='text' name='delete' value='' /><br />\n \t\t\t<input name='action' value='delete' type='hidden' />\n \t\t\t<input class='button-secondary action' style='font-weight:bold; margin:10px 0px; width:250px;' type='submit' value='" . sprintf(__("delete %s", "dmsguestbook"), $table_name) . "' />\n\t\t\t</form>"; } else { /* if prefix_dmsguestbook isn't exist */ $return_dmsguestbook_database = "<b style='color:#bb0000;padding:5px;'>" . sprintf(__("%s isn't exist.", "dmsguestbook"), $table_name) . "</b><br /><br />\n\t\t\t<form name='form0' method='post' action='{$location}'>\n\t\t\t\t <select name='collate'>\n\t\t\t\t \t<option value='DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'>utf8_unicode_ci</option>\n\t\t\t\t\t<option value='DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'>utf8_general_ci</option>\n\t\t\t\t\t<option value=''>" . __("if you use mySQL 4.0.xx or lower", "dmsguestbook") . "</option>\n\t\t\t\t</select><br />\n\t\t\t\t<input name='action' value='createnew' type='hidden' />\n\t\t\t\t<input class='button-primary action' style='font-weight:bold; margin:10px 0px; width:300px;' type='submit' value='" . __("Create", "dmsguestbook") . " {$table_name})' />\n\t\t\t</form>" . __("If you want use char like ä,ü,ö... and your mysql version is lower than 4.1, be sure the language\n\t\t\tsetting is e.g. \"de-iso-8859-1\" or similar. Check this with your mysql graphical frontenend like phpmyadmin.", "dmsguestbook") . "<br />"; } $return_dmsguestbook_database_error = "<br />" . sprintf(__("If there is something wrong with my %s table:", "dmsguestbook"), $table_name) . " <a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='../wp-content/plugins/dmsguestbook/default_sql.txt' target='_blank'>" . __("Help", "dmsguestbook") . "</a>"; /* dmsguestbook options*/ /* search all DMSGuestbook option (inform the user about the old dmsguestbook entries) */ $query_options = $wpdb->get_results("SELECT * FROM {$table_option} WHERE option_name LIKE 'DMSGuestbook_%'"); $num_rows_option = $wpdb->num_rows; /* search to DMSGuestbook_options */ $query_options1 = $wpdb->get_results("SELECT * FROM {$table_option} WHERE option_name LIKE 'DMSGuestbook_options'"); $num_rows_option1 = $wpdb->num_rows; if ($num_rows_option1 == 1) { $return_dmsguestbook_options = "<b style='color:#00bb00'>" . sprintf(__("[Status OK] \"DMSGuestbook_options\" found in %s.", "dmsguestbook"), $table_option) . "</b><br />"; } if ($num_rows_option1 == 0) { $return_dmsguestbook_options = "<b style='color:#bb0000'>" . sprintf(__("No \"DMSGuestbook_options\" found in %s.", "dmsguestbook"), $table_option) . "</b><br />"; } if ($num_rows_option >= 2) { $return_dmsguestbook_options = "<b style='color:#bb0000'>" . sprintf(__("Notice: You have some old \"DMSGuestbook_xxxx\" rows in your %s, but this have no functionality impact.", "dmsguestbook"), $table_option) . "</b>"; } $return_dmsguestbook_options .= "<form name='form0' method='post' action='{$location}'\n\t\t\t<input name='action' value='createoption' type='hidden' />\n\t\t\t<input class='button-secondary action' style='font-weight:bold; margin:10px 0px; width:400px;' type='submit' value='" . __("Create new DMSGuestbook options", "dmsguestbook") . "' />\n\t\t</form>\n\t\t<br /><br />\n\t\t<form name='form0' method='post' action='{$location}'>" . sprintf(__("Type \"delete\" to remove all DMSGuestbook option entries from the %s table.", "dmsguestbook"), $table_option) . "<br />\n\t\t\t\t<input type='text' name='confirm_delete_option' value='' /><br />\n\t\t\t\t<input name='action' value='deleteoption' type='hidden' />\n\t\t\t\t<input class='button-secondary action' style='font-weight:bold; margin:10px 0px; width:400px;' type='submit' value='" . __("Delete DMSGuestbook options from the database", "dmsguestbook") . "' />\n\t\t\t</form>\n\t<br />" . sprintf(__("If there is something wrong with my<br />DMSGuestbook_options in %s:", "dmsguestbook"), $table_option) . " <a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='../wp-content/plugins/dmsguestbook/default_options.txt' target='_blank'>" . __("Help", "dmsguestbook") . "</a>"; /* backup */ $return_dmsguestbook_options_backup = __("Copy this content to a text file in case if you need a backup.", "dmsguestbook") . "<br />\n\t\t<textarea style='width:450px; height:200px;' name='save_data'>" . get_option("DMSGuestbook_options") . "</textarea><br />\n\t\t<br />\n\t\t<br />" . __("Restore DMSGuestbook_options:<br />\n\t\tOpen your DMSGuestbook option backup text file and put the content in the textfield below.<br />\n\t\tAll data will be overwrite!", "dmsguestbook") . "\n\t\t<form action='{$location}' method='post'>\n\t\t<textarea style='width:450px; height:200px;' name='restore_data'></textarea><br />\n\t\t<input type='hidden' name='restore_options' value='1' />\n\t\t<input class='button-secondary action' style='font-weight:bold;' type='submit' value='" . __("Restore", "dmsguestbook") . "' onclick=\"return confirm('" . __("Would you really like to restore all data?", "dmsguestbook") . "');\" />\n\t\t</form>"; echo "<b style='font-size:20px;'>" . __("Database settings", "dmsguestbook") . "</b><br />"; echo "<table width='100%' border='0'>"; echo "<tr><td>"; ?> <div id="dmsguestbook-menu"> <h3 style="font-weight:bold;"><a href="#"><?php echo __("DMSGuestbook Database", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_dmsguestbook_database; ?> </li> <li><?php echo $return_dmsguestbook_database_error; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("DMSGuestbook options", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_dmsguestbook_options; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("DMSGuestbook options backup", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_dmsguestbook_options_backup; ?> <li> </ul> </p> </div> </div> <?php echo "</div>\n\t</div>"; echo "</td></tr></table>"; ?> <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> <?php } ?> <!-- end table for DMSGuestbook and DMSGuestbook option environment --> <!-- main table with all DMSGuestbook options --> <?php $submitbutton = "<input class='button-primary action' style='font-weight:bold;margin:10px 0px; width:100px;'\n\t\ttype='submit' value='" . __("Save", "dmsguestbook") . "' name='csssave' onclick=\"document.getElementById('save')\" />"; if ($num_rows_option == $dmsguestbook_options) { if ($_REQUEST['basic'] == 1) { $Role1 = CheckRole($options["role1"], 0); if (!current_user_can("level_" . $Role1) && ROLE != 0) { CheckRole($options["role1"], 1); exit; } reset($options); while (list($key, $val) = each($options)) { if ($key == "page_id") { $query_posts = $wpdb->get_results("SELECT ID, post_title, post_status FROM {$table_posts} WHERE post_type = 'page' ORDER BY id ASC"); $num_rows_posts = $wpdb->num_rows; $part_page_id = explode(",", $options["page_id"]); $part_language = explode(",", $options["language"]); if ($options["supergb"] == "" || $options["supergb"] == 0) { $checked = "checked"; } $c = 0; $data = isset($data) ? $data : ''; $data .= "<b style='color:#bb0000;'>" . __("You have to delete the assigned guestbooks by clicking on \"Clear all\" before you can set this again. Assigned guestbooks will not be released until you press the \"Save\" button.", "dmsguestbook") . "</b>"; $data .= "<br /><br />" . __("To assign guestbook(s)", "dmsguestbook") . ":"; $data .= "<table style='width:95%;' border:0px;><tr><td>"; ### Language unset($tmp); $tmp = isset($tmp) ? $tmp : ''; $abspath = str_replace("\\", "/", ABSPATH); if ($handle = opendir($abspath . 'wp-content/plugins/dmsguestbook/language/')) { $tmp .= "<select name='langselect' id='langselect'>"; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "README.txt" && $file != "mo") { $tmp_a[] = $file; } } sort($tmp_a); for ($x = 0; $x < count($tmp_a); $x++) { $tmp .= "<option value='{$tmp_a[$x]}'>{$tmp_a[$x]}</option>"; } $tmp .= "</select>"; closedir($handle); } ### $data .= "<table><tr>"; $data .= "<th style='font-size:9px;background-color:#cccccc;padding:2px;'>" . __("ID", "dmsguestbook") . "</th>"; $data .= "<th style='font-size:9px;background-color:#cccccc;padding:2px;'>" . __("Page", "dmsguestbook") . "</th>"; $data .= "<th style='font-size:9px;background-color:#cccccc;padding:2px;'>" . __("Page status", "dmsguestbook") . "</th>"; $data .= "<th style='font-size:9px;background-color:#cccccc;padding:2px;'>" . __("Guestbook", "dmsguestbook") . "<br /><br />" . __("Deactivate super guestbook ", "dmsguestbook") . "*<br /><input type='radio' name='supergb' value='0' {$checked}> </th>"; $data .= "<th style='font-size:9px;background-color:#cccccc;padding:2px;'>" . __("Language", "dmsguestbook") . "<br />{$tmp}</th></tr>"; foreach ($query_posts as $result) { $data .= "<tr><td style='font-size:9px;background-color:#dddddd;padding:2px;'>{$result->ID}</td><td style='font-size:9px;background-color:#eeeeee;padding:2px;'>" . $result->post_title . "</td> "; $data .= "<td style='font-size:9px;background-color:#dddddd;padding:2px;'><a href='page.php?action=edit&post={$result->ID}'>{$result->post_status}</a></td>"; for ($v = 0; $v < count($part_page_id); $v++) { unset($lang); $lang = isset($lang) ? $lang : ''; if ($result->ID == $part_page_id[$v]) { $vv = $v + 1; $set = "#" . $vv; $setnr = $vv; $disabled = "disabled"; $v = count($part_page_id); $lang = $part_language[$vv - 1]; } else { $set = __("not selected", "dmsguestbook"); $setnr = ''; $disabled = "disabled"; } } if ($setnr == $options["supergb"] && ($options["supergb"] != 0 || $options["supergb"] != "")) { $checked = "checked"; } else { $checked = 0; } $data .= "<td style='font-size:9px;background-color:#dddddd;padding:2px;'><input class='button-secondary action' style='width:70px;' id='pageid{$c}' name='pageid{$c}' type='action' value='{$set}' {$disabled} onclick=\"PageID('{$result->ID}', '{$c}')\"><br /><br />" . __("Activate this guestbook as super guestbook", "dmsguestbook") . "*<br /><input type='radio' name='supergb' value='{$setnr}' {$checked}></td>"; $data .= "<td style='font-size:9px;background-color:#dddddd;padding:2px;'><input style='width:120px;font-size:9px;background-color:#dddddd;border:1px;padding:2px;' type='text' id='language{$c}' name='language{$c}' value='{$lang}' readonly></td></tr>"; $c++; } $data .= "</table>"; $data .= "<input type='hidden' name='page_id' id='page_id' value='{$options['page_id']}'>"; $data .= "<input type='hidden' name='language' id='language' value='{$options['language']}'>"; $data .= "<input type='hidden' name='countpageid' id='countpageid' value='1'>"; $data .= "<input id='page_id_clear' name='page_id_clear' class='button-secondary action' style='width:150px;color:#bb0000;' type='action' value='" . __("Clear all", "dmsguestbook") . "' onclick=\"PageID_Clear('{$num_rows_posts}')\">"; $data .= "<span style='color:#bb0000;'><br />* " . __("Would you like to display one particular guestbook in a different languages? Select your desired guestbook and mark the radio button. After that all pages with the assigned language will be bound with the guestbook that you've selected.", "dmsguestbook") . "</span></td>"; $data .= "<script type='text/javascript'>"; $data .= "\n\t\t\t\tfunction PageID(id, c) {\n\t\t\t\tvar m = document.getElementById('countpageid').value;\n \t\t\t\tvar newpageid = document.getElementById('page_id').value;\n \t\t\t\tnewpageid = newpageid.concat(id + ',');\n \t\t\t\tdocument.getElementById('page_id').value = newpageid;\n \t\t\t\tdocument.getElementById('pageid' + c).value = '#' + m;\n \t\t\t\tdocument.getElementById('pageid' + c).disabled = true;\n\n \t\t\t\tdocument.getElementById('language' + c).value = document.getElementById('langselect').value;\n\n \t\t\t\tvar newlanguage = document.getElementById('language').value;\n \t\t\t\tnewlanguage = newlanguage.concat(document.getElementById('langselect').value + ',');\n \t\t\t\tdocument.getElementById('language').value = newlanguage;\n\n \t\t\t\tm++;\n \t\t\t\tdocument.getElementById('countpageid').value = m;\n \t\t\t\t}\n\n \t\t\t\tfunction PageID_Clear(c) {\n \t\t\t\t \tfor (var i = 0; i < c; i++) {\n \t\t\t \tdocument.getElementById('pageid' + i).disabled = false;\n \t\t\t\t \tdocument.getElementById('pageid' + i).value = '" . __("Set", "dmsguestbook") . "';\n \t\t\t\t \tdocument.getElementById('language' + i).value = '';\n \t\t\t\t \t}\n \t\t\t\tdocument.getElementById('page_id').value = '';\n \t\t\t\tdocument.getElementById('language').value = '';\n \t\t\t\tdocument.getElementById('countpageid').value = '1';\n \t\t\t\t}\n \t\t\t\t"; $data .= "</script>"; $tooltip = __("How to use:<br />1.) Reset all assigned guestbooks by clicking on \"Clear all\"<br />2.) Select your desired language<br /> 3.) Select your guestbook(s) by clicking \"Set\" in ascending order.<br />4.) Press the \"Save\" button", "dmsguestbook"); $data .= "<td style='text-align:right;'><a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='#tooltip_{$key}' class='tooltiplink'>?</a><div id='tooltip_{$key}' class='tooltip'>{$tooltip}</div></td>"; $data .= "</tr></table><br />"; $return_page_id = $data; } if ($key == "step") { $label = __("Post per page", "dmsguestbook") . ":"; $option = "1@3@5@10@15@20@25@30@35@40@45@50@60@70@80@90@100@"; $value = $options["step"]; $additional = ""; $style = ""; $tooltip = __("Number of entry in each page", "dmsguestbook"); $jscript = ""; $return_step = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "messagetext_length") { $label = __("Message text length", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["messagetext_length"]; $char_lenght = ""; $additional = __(" chars", "dmsguestbook"); $style = "width:50px;"; $tooltip = __("Define the maximum allowed lenght each message text<br />Deactivate this feature to set 0", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_messagetext_length = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "width1") { $label = __("Guestbook width", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["width1"]; $char_lenght = ""; $additional = "%"; $style = "width:50px;"; $tooltip = __("Guestbook width in percent<br /><br />Variable: {width1}", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_width1 = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "width2") { $label = __("Separator width", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["width2"]; $char_lenght = ""; $additional = "%"; $style = "width:50px;"; $tooltip = __("Separator width in percent<br /><br />Variable: {width2}", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_width2 = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "position1") { $label = __("Guestbook position (x-axis)", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["position1"]; $char_lenght = ""; $additional = "px"; $style = "width:50px;"; $tooltip = __("Absolute guestbook position in pixel horizontal (x-axis)<br /><br />Variable: {position1}", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_position1 = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "position2") { $label = __("Guestbook position (y-axis)", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["position2"]; $char_lenght = ""; $additional = "px"; $style = "width:50px;"; $tooltip = __("Absolute guestbook position in pixel vertical (y-axis)<br /><br />Variable: {position2}", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_position2 = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "forwardchar") { $tooltip = __("Navigation char style<br /><br />e.g. < >", "dmsguestbook"); $showtooltip = "<b style='background-color:#bb1100;color:#fff;padding:3px;' onmouseover=\"Tip('{$tooltip}')\" onclick=\"UnTip()\">?</b>"; $base64 = 1; /* If base64 is active */ if (BASE64 == 1 && $base64 == 1) { $forwardchar = base64_decode($options['forwardchar']); $backwardchar = base64_decode($options['backwardchar']); } else { $forwardchar = $options['forwardchar']; $backwardchar = $options['backwardchar']; } $return_forwardchar = "<li><table style='width:95%;' border='0'><colgroup><col width='40%'><col width='55%'><col width='5%'><colgroup><tr><td>" . __("Navigation char style", "dmsguestbook") . ":</td>\n\t\t<td><input style='width:50px;' type='text' name='backwardchar' value='{$backwardchar}' />\n\t\t<input style='width:50px;' type='text' name='forwardchar' value='{$forwardchar}' />\n\t\t<input type='hidden' name='base64-forwardchar' value='{$base64}' />\n\t\t<input type='hidden' name='base64-backwardchar' value='{$base64}' />\n\t\t</td>\n\t\t<td style='text-align:right;'>{$showtooltip}</td></tr></table>"; } if ($key == "navigationsize") { $label = __("Navigation char size", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["navigationsize"]; $char_lenght = ""; $additional = "px"; $style = "width:50px;"; $tooltip = __("Navigation font size in pixel<br /><br />Variable: {navigationsize}", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_navigationsize = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "formpos") { $label = __("Guestbook form position", "dmsguestbook") . ":"; $option = "top@bottom@"; $value = $options["formpos"]; $additional = ""; $style = ""; $tooltip = __("Visible the guestbook input form on top or bottom", "dmsguestbook"); $jscript = ""; $return_formpos = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "formposlink") { $label = __("Link text", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["formposlink"]; $char_lenght = ""; $additional = ""; $style = "width:150px;"; $tooltip = __("Define a link text if you selected \"bottom\"", "dmsguestbook"); $jscript = ""; $base64 = 1; $return_formposlink = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "sortitem") { $label = __("Sort guestbook items", "dmsguestbook") . ":"; $option = "ASC@DESC@"; $value = $options["sortitem"]; $additional = ""; $style = ""; $tooltip = __("DESC = Newer post first<br />ASC = Older post first", "dmsguestbook"); $jscript = ""; $return_sortitem = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "dbid") { $label = __("Database id", "dmsguestbook") . ":"; $entries = "0"; $value = $options["dbid"]; $additional = ""; $style = ""; $tooltip = __("Use the database id to consecutively numbered each guestbook entry", "dmsguestbook"); $jscript = ""; $return_dbid = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "form_template") { unset($tmp); $tmp = isset($tmp) ? $tmp : ''; $abspath = str_replace("\\", "/", ABSPATH); if ($handle = opendir($abspath . 'wp-content/plugins/dmsguestbook/template/form/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $tmp .= "{$file}" . "@"; } } closedir($handle); } $label = __("Form template", "dmsguestbook") . ":"; $option = $tmp; $value = $options["form_template"]; $additional = ""; $style = ""; $tooltip = __("Create your own input form template and use it is on your guestbook site<br /><br />See an examle in \"/template/form/default.tpl\"", "dmsguestbook"); $jscript = ""; $return_form_template = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "post_template") { unset($tmp); $tmp = isset($tmp) ? $tmp : ''; $abspath = str_replace("\\", "/", ABSPATH); if ($handle = opendir($abspath . 'wp-content/plugins/dmsguestbook/template/post/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $tmp .= "{$file}" . "@"; } } closedir($handle); } $label = __("Post template", "dmsguestbook") . ":"; $option = $tmp; $value = $options["post_template"]; $additional = ""; $style = ""; $tooltip = __("Create your own guestbook post template and use it is on your guestbook site<br /><br />See an examle in \"/template/post/default.tpl\"", "dmsguestbook"); $jscript = ""; $return_post_template = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "nofollow") { $label = __("rel=\"nofollow\" tag for posted url's", "dmsguestbook") . ":"; $entries = "0"; $value = $options["nofollow"]; $additional = ""; $style = ""; $tooltip = __("Activate the nofollow tag for posted url's<br /><a href=\"http://en.wikipedia.org/wiki/Nofollow\" target=\"_blank\">http://en.wikipedia.org/wiki/Nofollow</a>", "dmsguestbook"); $jscript = ""; $return_nofollow = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "additional_option") { unset($tmp); $tmp = isset($tmp) ? $tmp : ''; $abspath = str_replace("\\", "/", ABSPATH); if ($handle = opendir($abspath . 'wp-content/plugins/dmsguestbook/module/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "README.txt") { $tmp .= "{$file}" . "@"; } } closedir($handle); } $label = __("Additional selectbox", "dmsguestbook") . ":"; $option = "none@" . $tmp; $value = $options["additional_option"]; $additional = ""; $style = ""; $tooltip = __("Define a selectbox and fill this with your own values.<br />See some examples in your \"dmsguestbook/module\" folder.", "dmsguestbook"); $jscript = ""; $return_additional_option = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "additional_option_title") { $label = __("Additional selectbox title", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["additional_option_title"]; $char_lenght = ""; $additional = ""; $style = "width:150px;"; $tooltip = __("This text will be shown on your input form guestbook page.<br />You could leave this textfield blank by using space character.", "dmsguestbook"); $jscript = ""; $base64 = 1; $return_additional_option_title = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "show_additional_option") { $label = __("Show additional value", "dmsguestbook") . ":"; $entries = "0"; $value = $options["show_additional_option"]; $additional = ""; $style = ""; $tooltip = __("Show additional text in each guestbook post.<br />You could edit the appearance in \"template/post/default.tpl\"<br />The default setting will be set the additional text on the footer of guestbook post.", "dmsguestbook"); $jscript = ""; $return_show_additional_option = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "separatorcolor") { $label = __("Separator color", "dmsguestbook") . ":"; $value = $options["separatorcolor"]; $char_lenght = 6; $id = 1; $additional = ""; $style = "width:150px;"; $tooltip = __("Separator between header and body in each entry<br /><br />Variable: {separatorcolor}", "dmsguestbook"); $return_separatorcolor = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "bordercolor1") { $label = __("Outside border color", "dmsguestbook") . ":"; $value = $options["bordercolor1"]; $char_lenght = 6; $id = 2; $additional = ""; $style = "width:150px;"; $tooltip = __("Color of the outside box<br /><br />Variable: {bordercolor1}", "dmsguestbook"); $jscript = ""; $return_bordercolor1 = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "bordercolor2") { $label = __("Textfield border color", "dmsguestbook") . ":"; $value = $options["bordercolor2"]; $char_lenght = 6; $id = 3; $additional = ""; $style = "width:150px;"; $tooltip = __("Color of all textfield borders<br /><br />Variable: {bordercolor2}", "dmsguestbook"); $jscript = ""; $return_bordercolor2 = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "navigationcolor") { $label = __("Navigation char color", "dmsguestbook") . ":"; $value = $options["navigationcolor"]; $char_lenght = 6; $id = 4; $additional = ""; $style = "width:150px;"; $tooltip = __("Define the navigation color<br /><br />Variable: {navigationcolor}", "dmsguestbook"); $jscript = ""; $return_navigationcolor = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "fontcolor1") { $label = __("Font color", "dmsguestbook") . ":"; $value = $options["fontcolor1"]; $char_lenght = 6; $id = 5; $additional = ""; $style = "width:150px;"; $tooltip = __("Overall font color<br /><br />Variable: {fontcolor1}", "dmsguestbook"); $jscript = ""; $return_fontcolor1 = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "captcha_color") { $label = __("Antispam image text color", "dmsguestbook") . ":"; $value = $options["captcha_color"]; $char_lenght = 6; $id = 6; $additional = ""; $style = "width:150px;"; $tooltip = __("Antispam image text color<br /><br />Variable: {captcha_color}", "dmsguestbook"); $jscript = ""; $return_captcha_color = ColorInput($key, $label, $id, $value, $additional, $style, $tooltip, $jscript); } if ($key == "dateformat") { $label = __("Date / Time format", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["dateformat"]; $char_lenght = ""; $additional = ""; $style = "width:200px;"; $tooltip = __("More infos", "dmsguestbook") . ": <a href=\"http://www.php.net/manual/en/function.strftime.php\" target=\"_blank\">http://www.php.net/manual/en/function.strftime.php</a>"; $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_dateformat = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "setlocale") { $label = __("Setlocale", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["setlocale"]; $char_lenght = ""; $additional = ""; $style = "width:80px;"; $tooltip = __("Set your language: e.g. en_EN, de_DE, fr_FR, it_IT, de, ge ...<br />(must be installed on your system)", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_setlocale = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "offset") { $label = __("Offset", "dmsguestbook") . ":"; $option = "-12@-11@-10@-9@-8@-7@-6@-5@-4@-3@-2@-1@0@+1@+2@+3@+4@+5@+6@+7@+8@+9@+10@+11@+12@"; $value = $options["offset"]; $additional = ""; $style = ""; $tooltip = __("Time offset: Use this offset if your Wordpress installation is not in the same country where you live.<br />e.g. You live in London and the Wordpress installation is on a server in Chicago.<br />If You want to show the date in GMT (Greenwich Mean Time), set the offset -6 and check the correct time below.<br /><br /> Notice: Don't use the %z or %Z parameter if your offset isn\"t 0.", "dmsguestbook"); $jscript = ""; $return_offset = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "send_mail") { $label = __("Send a mail", "dmsguestbook") . ":"; $entries = "0"; $value = $options["send_mail"]; $additional = ""; $style = ""; $tooltip = __("Receive a notification email when user write an new guestbook post", "dmsguestbook"); $jscript = ""; $return_send_mail = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "mail_adress") { $label = __("Email address", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["mail_adress"]; $char_lenght = ""; $additional = ""; $style = "width:150px;"; $tooltip = __("The email address which the message to be sent is<br />Multiple email adresses are allowed, split these with the \";\" separator.<br />e.g. test1@example.com;test2@example.com;test3@example.com", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_mail_adress = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "mail_method") { $label = __("Send method", "dmsguestbook") . ":"; $option = "Mail@SMTP@"; $value = $options["mail_method"]; $additional = ""; $style = ""; $tooltip = __("Use PHP internal mail function if your server supporting this.<br />A SMTP server could be need username and password as authentification which you must known.", "dmsguestbook"); $jscript = "onChange=\"smtpContainer();\""; $return_mail_send_method = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "smtp_host") { $label = __("SMTP host", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["smtp_host"]; $char_lenght = ""; $additional = ""; $style = "width:150px;"; $tooltip = __("The SMTP server which do you want to connect.", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_smtp_host = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "smtp_port") { $label = __("SMTP port", "dmsguestbook") . ":"; $option = "25@465@587@"; $value = $options["smtp_port"]; $additional = ""; $style = ""; $tooltip = __("25 = standard port<br />465 = SMTP over SSL port<br />587 = Alternative SMTP port<br /><br />Check your mail documentation for further information.", "dmsguestbook"); $jscript = ""; $return_smtp_port = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "smtp_username") { $label = __("SMTP username", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["smtp_username"]; $char_lenght = ""; $additional = ""; $style = "width:150px;"; $tooltip = __("SMTP username if is needed.<br /><br />Check your mail documentation for further information.", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_smtp_username = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "smtp_password") { $label = __("SMTP password", "dmsguestbook") . ":"; $type = "password"; $entries = 0; $value = $options["smtp_password"]; $char_lenght = ""; $additional = ""; $style = "width:140px;"; $tooltip = __("SMTP password if is needed.<br /><br />Check your mail documentation for further information.", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_smtp_password = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "smtp_auth") { $label = __("SMTP authentification", "dmsguestbook") . ":"; $entries = "0"; $value = $options["smtp_auth"]; $additional = ""; $style = ""; $tooltip = __("SMTP authentification if is needed. <br /><br />Check your mail documentation for further information.", "dmsguestbook"); $jscript = ""; $return_smtp_auth = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "smtp_ssl") { $label = __("SMTP SSL", "dmsguestbook") . ":"; $entries = "0"; $value = $options["smtp_ssl"]; $additional = ""; $style = ""; $tooltip = __("SMTP SSL (secure socket layer) if is needed.<br /><br />Check your mail documentation for further information.", "dmsguestbook"); $jscript = ""; $return_smtp_ssl = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "akismet") { $CheckAkismet = CheckAkismet(); if ($CheckAkismet != "") { $akismet_description = sprintf(__("DMSGuestbook has found an Akismet key %s", "dmsguestbook"), $CheckAkismet); } else { $akismet_description = __("No WordPress API key for Akismet was found! Activate the Akismet plugin and create a key. More information under: <a href=\"http://akismet.com/\" target=\"_blank\">http://akismet.com/</a> and <a href=\"http://en.wordpress.com/api-keys/\" target=\"_blank\">http://en.wordpress.com/api-keys/</a>", "dmsguestbook"); } $label = __("Akismet", "dmsguestbook") . ":"; $entries = "0"; $value = $options["akismet"]; $additional = ""; $style = ""; $tooltip = __("More infos", "dmsguestbook") . ":<a href=\"http://akismet.com/\" target=\"_blank\">http://akismet.com</a>"; $jscript = "onClick=\"akismetContainer();\""; $return_akismet = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); $return_akismet_key = "{$akismet_description}"; } if ($key == "akismet_action") { $label = __("Move spam to the spam folder@Block guestbook post if spam is found on it@", "dmsguestbook") . ":"; $entries = "1"; $value = $options["akismet_action"]; $additional = ""; $style = ""; $tooltip = __("What should Akismet do if spam are detected?", "dmsguestbook"); $jscript = ""; $return_akismet_action = RadioBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "require_antispam") { $label = __("Antispam off:@Antispam image:@Antispam mathematic figures:@reCAPTCHA:@", "dmsguestbook"); $entries = "3"; $value = $options["require_antispam"]; $additional = ""; $style = ""; $tooltip = __("Image:<br /><img src=\"../wp-content/plugins/dmsguestbook/captcha/captcha.php\" /><br />If you don't see the image here, check the xfiles.ttf and captcha.png permission in your captcha folder<br /><br />Mathematic figures:<br />4 + 9 = 13<br /><br />reCAPTCHA: <a href=\"http://recaptcha.net\" target=\"_blank\">learn more about reCAPTCHA</a>", "dmsguestbook"); $jscript = "onClick=\"recaptchaKeys();\""; $return_require_antispam = RadioBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "recaptcha_publickey") { $label = __("reCAPTCHA public key", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["recaptcha_publickey"]; $char_lenght = ""; $additional = ""; $style = "width:140px;"; $tooltip = __("Enter here you reCAPTCHA public key.", "dmsguestbook") . "<br /><a href=\"http://recaptcha.net/\" target=\"_blank\">" . __("Learn more about reCAPTCHA", "dmsguestbook") . "</a>"; $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_recaptcha_publickey = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "recaptcha_privatekey") { $label = __("reCAPTCHA private key", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["recaptcha_privatekey"]; $char_lenght = ""; $additional = ""; $style = "width:140px;"; $tooltip = __("Enter here you reCAPTCHA private key.", "dmsguestbook") . "<br /><a href=\"http://recaptcha.net/\" target=\"_blank\">" . __("Learn more about reCAPTCHA", "dmsguestbook") . "</a>"; $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_recaptcha_privatekey = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "antispam_key") { $value = RandomAntispamKey(); $label = __("Antispam key", "dmsguestbook") . ":"; $type = "hidden"; $entries = 0; $value = RandomAntispamKey(); $char_lenght = 20; $additional = $value; $style = "width:0px;"; $tooltip = __("Set a random key to prevent spam.<br />Every page refresh will create a new key which can be saved.<br />It's used for: Antispam image & Antispam mathematic figures.", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_antispam_key = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "require_email") { $label = __("Email", "dmsguestbook") . ":"; $entries = "0"; $value = $options["require_email"]; $additional = ""; $style = ""; $tooltip = __("User must fill out the email text field", "dmsguestbook"); $jscript = ""; $return_require_email = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "require_url") { $label = __("Website", "dmsguestbook") . ":"; $entries = "0"; $value = $options["require_url"]; $additional = ""; $style = ""; $tooltip = __("User must fill out the website text field", "dmsguestbook"); $jscript = ""; $return_require_url = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "mandatory_char") { $label = __("Mandatory char", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["mandatory_char"]; $char_lenght = 1; $additional = ""; $style = "width:20px;"; $tooltip = __("Mandatory char were to display on guestbook input form", "dmsguestbook"); $jscript = ""; $base64 = 1; $return_mandatory_char = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "show_email") { $label = __("Show email", "dmsguestbook") . ":"; $entries = "0"; $value = $options["show_email"]; $additional = ""; $style = ""; $tooltip = __("Visible email for everyone in each post", "dmsguestbook"); $jscript = ""; $return_show_email = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "show_url") { $label = __("Show website", "dmsguestbook") . ":"; $entries = "0"; $value = $options["show_url"]; $additional = ""; $style = ""; $tooltip = __("Visible website for everyone in each post", "dmsguestbook"); $jscript = ""; $return_show_url = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "show_ip") { $label = __("Show ip address", "dmsguestbook") . ":"; $entries = "0"; $value = $options["show_ip"]; $additional = ""; $style = ""; $tooltip = __("Visible ip for everyone in each post", "dmsguestbook"); $jscript = ""; $return_show_ip = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "ip_mask") { $label = __("Mask ip address", "dmsguestbook") . ":"; $option = "*.123.123.123@*.*.123.123@*.*.*.123@123.123.123.*@123.123.*.*@123.*.*.*@"; $value = $options["ip_mask"]; $additional = ""; $style = ""; $tooltip = __("Mask ip adress if this is visible", "dmsguestbook"); $jscript = ""; $return_ip_mask = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "email_image_path") { $part1 = explode("/", $options["email_image_path"]); $image = end($part1); $label = __("Email image path", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["email_image_path"]; $char_lenght = ""; $additional = ""; $style = "width:200px;"; $tooltip = __("Email image path", "dmsguestbook") . "<br /><a href=\"{$options['email_image_path']}\" target=\"_blank\">{$options['email_image_path']}</a><br /><br />" . __("Actually image:", "dmsguestbook") . "<img src=\"{$options['email_image_path']} \">"; $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_email_image_path = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "website_image_path") { $part1 = explode("/", $options["website_image_path"]); $image = end($part1); $label = __("Website image path", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["website_image_path"]; $char_lenght = ""; $additional = ""; $style = "width:200px;"; $tooltip = __("Website image path", "dmsguestbook") . " :<br /><a href=\"{$options['website_image_path']}\" target=\"_blank\">{$options['website_image_path']}</a><br /><br />" . __("Actually image:", "dmsguestbook") . "<img src=\"{$options['website_image_path']} \">"; $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_website_image_path = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "admin_review") { $label = __("Admin must every post review", "dmsguestbook") . ":"; $entries = "0"; $value = $options["admin_review"]; $additional = ""; $style = ""; $tooltip = __("Admin must review every post before this can display on the page.<br />You can edit the guestbook review status under \"Entries\".", "dmsguestbook"); $jscript = ""; $return_admin_review = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "url_overruled") { $label = __("URL overrule", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $value = $options["url_overruled"]; $additional = ""; $style = "width:200px;"; $tooltip = __("You can overrule this link if you have trouble with the guestbook form submit.", "dmsguestbook") . "<br /><br />" . __("Example", "dmsguestbook") . ":<br />{$url}/?p=3<br />{$url}/?page_id=3<br />{$url}/3/<br />{$url}/" . __("YourGuestBookName", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_url_overruled = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "gravatar") { $label = __("User can use Gravatar", "dmsguestbook") . ":"; $entries = "0"; $value = $options["gravatar"]; $additional = ""; $style = ""; $tooltip = __("More infos", "dmsguestbook") . ":<a href=\\'http://en.gravatar.com\\' target=\\'_blank\\'>http://en.gravatar.com</a>"; $jscript = ""; $return_gravatar = CheckBoxes($key, $label, $value, $entries, $additional, $style, $tooltip, $jscript); } if ($key == "gravatar_rating") { $label = __("Gravatar rating", "dmsguestbook") . ":"; $option = "G@PG@R@X@"; $value = $options["gravatar_rating"]; $additional = ""; $style = ""; $tooltip = __("You can specify a rating of G, PG, R, or X.<br />[G] A G rated gravatar is suitable for display on all websites with any audience type.<br />[PG] PG rated gravatars may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.<br />[R] R rated gravatars may contain such things as harsh profanity, intense violence, nudity, or hard drug use.<br />[X] X rated gravatars may contain hardcore sexual imagery or extremely disturbing violence.", "dmsguestbook"); $jscript = ""; $return_gravatar_rating = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "gravatar_size") { $label = __("Gravatar size", "dmsguestbook") . ":"; $type = "text"; $entries = 0; $char_lenght = 3; $value = $options["gravatar_size"]; $additional = "px"; $style = "width:30px;"; $tooltip = __("Image size in pixel", "dmsguestbook"); $jscript = ""; $base64 = 0; /* Do not use this unless you edit the preg_replace() in the create_options() function and $var_* in dmsguestbook.php */ $return_gravatar_size = OneInput($key, $label, $type, $entries, $value, $char_lenght, $additional, $style, $tooltip, $jscript, $base64); } if ($key == "role1") { $label = __("DMSGuestbook settings", "dmsguestbook") . ":"; $option = "Administrator@Editor@Author@Contributor@Subscriber@"; $value = $options["role1"]; $additional = ""; $style = ""; $tooltip = __("This role affects with", "dmsguestbook") . ":<br />-" . __("Database settings", "dmsguestbook") . "<br />-" . __("Guestbook settings", "dmsguestbook") . "<br />-" . __("Language settings", "dmsguestbook") . "<br />-" . __("phpinfo", "dmsguestbook"); $jscript = ""; $return_role1 = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "role2") { $label = __("Entries", "dmsguestbook") . ":"; $option = "Administrator@Editor@Author@Contributor@Subscriber@"; $value = $options["role2"]; $additional = ""; $style = ""; $tooltip = __("This role affects with", "dmsguestbook") . ":<br />-" . __("Guestbook entries (show, edit, delete)", "dmsguestbook"); $jscript = ""; $return_role2 = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "role3") { $label = __("Spam") . ":"; $option = "Administrator@Editor@Author@Contributor@Subscriber@"; $value = $options["role3"]; $additional = ""; $style = ""; $tooltip = __("This role affects with", "dmsguestbook") . ":<br />-" . __("Spam entries (show, edit, delete)", "dmsguestbook"); $jscript = ""; $return_role3 = SelectBox($key, $label, $option, $value, $additional, $style, $tooltip, $jscript); } if ($key == "css") { $part1 = explode("@", $options["css"]); $options["css"] = str_replace("[br]", "\r\n", $options["css"]); $part1 = explode("@", $options["css"]); $part11 = explode("@", $_SESSION['csscontainer']); if (count($part11) > count($part1)) { $newone = "<b style='color:#bb1100;'>" . __("NEW!", "dmsguestbook") . "</b><br />"; echo "<b style='font-size:12px;color:#bb1100;'>\n\t\t--------------------------------------------------<br />"; echo __("New CSS entries found, press the save button to save it.", "dmsguestbook") . "<br />"; echo "--------------------------------------------------</b><br /><br />"; } $restore_css = isset($restore_css) ? $restore_css : ''; $t = isset($t) ? $t : ''; if (count($part11) < count($part1)) { $restore_css = 1; echo "<b style='font-size:12px;color:#bb1100;'>\n\t\t--------------------------------------------------<br />"; echo _("Some CSS entries are missing!", "dmsguestbook") . "<br />" . __("Press the save button to restore CSS settings.", "dmsguestbook") . "<br />"; echo "--------------------------------------------------</b><br /><br />"; } $tooltip = "{width1} = " . __("Guestbook width", "dmsguestbook") . "<br />{width2} = " . __("Separator width", "dmsguestbook") . "<br />{position1} = " . __("Relative guestbook position (left to right)", "dmsguestbook") . "<br />{separatorcolor} = " . __("Separator between header and body in each entry", "dmsguestbook") . "<br />{bordercolor1} = " . __("Border of the outside box") . "<br />{bordercolor2} = " . __("Color of all textfield border", "dmsguestbook") . "<br />{navigationcolor} = " . __("Navigation color", "dmsguestbook") . "<br />{fontcolor1} = " . __("Overall font color", "dmsguestbook") . "<br />{navigationsize} = " . __("Navigation char size", "dmsguestbook") . "<br />{captcha_color} = " . __("Antispam image text color", "dmsguestbook") . "<br /><br />" . __("Stylesheet (CSS) Help & Tutorials:<br />English: <a href=\"http://www.html.net/tutorials/css/\" target=\"_blank\">http://www.html.net/tutorials/css/</a><br />German: <a href=\"http://www.css4you.de/\" target=\"_blank\">http://www.css4you.de/</a><br />Or ask Google and friends :-)", "dmsguestbook"); $return_css = isset($return_css) ? $return_css : ''; $return_css .= "<table border='0'><colgroup><col width='50'><col width='210'><col width='50'><colgroup>"; $xx = 0; for ($x = 0; $x < count($part11) - 1; $x++) { $part2 = explode("|", $part1[$xx]); $part22 = explode("|", $part11[$x]); if (trim($part2[1]) == trim($part22[1])) { $yxc[$x] = "<div style='font-size:0.9em;'>Description: {$part2['0']}<br />\n \t\t\t\t\tCSS class: {$part2['1']}</div><input type='hidden' name='cssdescription{$x}' value='{$part2['0']}' />\n \t\t\t\t\t<input type='hidden' name='cssname{$x}' value='{$part2['1']}' />"; $xx++; } else { if ($restore_css != 1) { $yxc[$x] = "<div style='font-size:0.9em;'>" . __("Description", "dmsguestbook") . ": {$part22['0']}<br />\n \t\t\t\t\t\t\tCSS class: {$part22['1']}</div><input type='hidden' name='cssdescription{$x}' value='{$part22['0']}' />\n \t\t\t\t\t\t\t<input type='hidden' name='cssname{$x}' value='{$part22['1']}' />"; $xx - 1; $t[] = $x; } } } $xx = 0; for ($x = 0; $x < count($part11) - 1; $x++) { $part2 = explode("|", $part1[$xx]); $part22 = explode("|", $part11[$x]); $y = $x + 1; $showtooltip = "<a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='#tooltip_css_{$x}' class='tooltiplink'>?</a><div id='tooltip_css_{$x}' class='tooltip'>{$tooltip}</div>"; if (!$t) { $t[] = 99999; } if (!in_array($x, $t) && $restore_css != 1) { $return_css .= "<tr><td style='background-color:#fff;text-align:center;'>({$y})</td>\n \t\t<td>{$yxc[$x]}<textarea name='css{$x}' cols='50' rows='5' >{$part2['2']}</textarea></td><td>{$showtooltip}</td></tr>"; unset($css_submitbutton); $css_submitbutton = isset($css_submitbutton) ? $css_submitbutton : ''; if ($x == 4 or $x == 9 or $x == 14 or $x == 19 or $x == 24 or $x == 29) { $css_submitbutton = "<br /><br />" . $submitbutton . "<br /><br />"; } $return_css .= "<tr><td></td><td>{$css_submitbutton}</td></tr>"; $xx++; } else { if ($restore_css != 1) { $return_css .= "<tr><td style='text-align:center;'><br />({$y})</td>\n \t\t\t \t<td>{$yxc[$x]}<textarea name='css{$x}' cols='50' rows='5' >{$part22['2']}</textarea></td><td>{$showtooltip}</td></tr>"; unset($css_submitbutton); if ($x == 4 or $x == 9 or $x == 14 or $x == 19 or $x == 24 or $x == 29) { $css_submitbutton = "<br /><br />" . $submitbutton . "<br /><br />"; } $return_css .= "<tr><td></td><td>{$css_submitbutton}</td></tr>"; $xx - 1; } } if ($restore_css == 1) { $return_css .= "<input type='hidden' name='cssdescription{$x}' value='{$part22['0']}' />"; $return_css .= "<input type='hidden' name='cssname{$x}' value='{$part22['1']}' />"; $return_css .= "<input type='hidden' name='css{$x}' value='{$part22['2']}' />"; } } $return_css .= "</table>"; } if ($key == "css_customize") { $options["css_customize"] = str_replace("[br]", "\r\n", $options["css_customize"]); $return_css_customize = "<table style='width:95%;' border='0'>"; $yxc = "<div style='font-size:0.9em;'>" . __("Custom CSS", "dmsguestbook") . ":</div>"; $tooltip = __("Class heredity:<br /><br />e.g.<br /><b>a.</b>css_navigation_char<b>:hover</b> {color:#ff0000;}<br />All url link with css_navigation_char (navigation link)<br />become hover color red when user drag over it<br /><br /><b>td</b>.css_guestbook_message_nr_name {background-color:#00ff00;}<br />All td with css_guestbook_message_nr_name (guestbook name & id)<br />become background color green<br /><br />", "dmsguestbook"); $showtooltip = "<b style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;' onmouseover=\"Tip('{$tooltip}')\" onclick=\"UnTip()\">?</b>"; $return_css_customize .= "<tr><td>{$yxc} <textarea name='css_customize' cols='55' rows='15' >{$options['css_customize']}</textarea></td><td>{$showtooltip}</td></tr>"; $return_css_customize .= "</table>"; } } echo "<b style='font-size:20px;'>" . __("Guestbook settings", "dmsguestbook") . "</b><br />"; echo "<table width='100%' border='0'>"; echo "<tr><td>"; echo "<form name='form1' method='post' action='{$location}'>"; echo $submitbutton; echo "<div id='outer'>"; ?> <div id="dmsguestbook-menu"> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Basic", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_page_id; ?> </li> <li><?php echo $return_step; ?> </li> <li><?php echo $return_formpos; ?> </li> <li><?php echo $return_formposlink; ?> </li> <li><?php echo $return_messagetext_length; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Extended"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_position1; ?> </li> <li><?php echo $return_position2; ?> </li> <li><?php echo $return_width1; ?> </li> <li><?php echo $return_width2; ?> </li> <li><?php echo $return_forwardchar; ?> </li> <li><?php echo $return_navigationsize; ?> </li> <li><?php echo $return_show_email; ?> </li> <li><?php echo $return_show_url; ?> </li> <li><?php echo $return_show_ip; ?> </li> <li><?php echo $return_ip_mask; ?> </li> <li> </li> <li><?php echo $return_sortitem; ?> </li> <li><?php echo $return_dbid; ?> </li> <li><?php echo $return_form_template; ?> </li> <li><?php echo $return_post_template; ?> </li> <li><?php echo $return_nofollow; ?> </li> <li><?php echo $return_additional_option; ?> </li> <li><?php echo $return_additional_option_title; ?> </li> <li><?php echo $return_show_additional_option; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Color", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_bordercolor1; ?> </li> <li><?php echo $return_bordercolor2; ?> </li> <li><?php echo $return_navigationcolor; ?> </li> <li><?php echo $return_separatorcolor; ?> </li> <li><?php echo $return_fontcolor1; ?> </li> <li><?php echo $return_captcha_color; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Time / Date", "dmsguestbook"); ?> </a></h3> <?php setlocale(LC_TIME, $options["setlocale"]); $offset = mktime(date("H") + $options["offset"], date("i"), date("s"), date("m"), date("d"), date("Y")); $time_example = htmlentities(strftime($options["dateformat"], $offset), ENT_QUOTES); ?> <div> <p> <ul> <li><?php echo $return_dateformat; ?> </li> <li><?php echo $return_setlocale; ?> </li> <li><?php echo $return_offset; ?> </li> <li> </li> <li><?php echo __("Example", "dmsguestbook") . " : {$time_example}"; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Email Notification", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_send_mail; ?> </li> <li><?php echo $return_mail_adress; ?> </li> <li><?php echo $return_mail_send_method; ?> </li> <li> </li> <span style='display:none;' id='smtp_container'> <li><?php echo $return_smtp_host; ?> </li> <li><?php echo $return_smtp_port; ?> </li> <li> </li> <li><?php echo $return_smtp_auth; ?> </li> <li><?php echo $return_smtp_ssl; ?> </li> <li><?php echo $return_smtp_username; ?> </li> <li><?php echo $return_smtp_password; ?> </li> </span> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Captcha / Akismet", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_require_antispam; ?> </li> <span style='display:none;' id='recaptcha_keys'> <li><?php echo $return_recaptcha_publickey; ?> </li> <li><?php echo $return_recaptcha_privatekey; ?> </li> <li> </li> </span> <li><?php echo $return_antispam_key; ?> </li> <li> </li> <li> </li> <li><?php echo $return_akismet; ?> </li> <span style='display:none;' id='akismet_container'> <li><?php echo $return_akismet_key; ?> </li> <li> </li> <li><?php echo $return_akismet_action; ?> </li> </span> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Mandatory", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><table style='width:95%;' border='0'><colgroup><col width='40%'><col width='55%'><col width='5%'><colgroup><tr><td><?php echo __("Name", "dmsguestbook"); ?> :</td> <td><input type='checkbox' checked disabled></td><td style='text-align:right;'><a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='#tooltip_mandatory_name' class='tooltiplink'>?</a><div id='tooltip_mandatory_name' class='tooltip'><?php echo __("User must fill out name text field", "dmsguestbook"); ?> </div></td></tr></li> <li><table style='width:95%;' border='0'><colgroup><col width='40%'><col width='55%'><col width='5%'><colgroup><tr><td><?php echo __("Message", "dmsguestbook"); ?> :</td> <td><input type='checkbox' checked disabled></td><td style='text-align:right;'><a style='font-weight:bold;background-color:#bb1100;color:#fff;padding:3px;text-decoration:none;' href='#tooltip_mandatory_message' class='tooltiplink'>?</a><div id='tooltip_mandatory_message' class='tooltip'><?php echo __("User must fill out message text field", "dmsguestbook"); ?> </div></td></tr></li> <li><?php echo $return_require_email; ?> </li> <li><?php echo $return_require_url; ?> </li> <li><?php echo $return_mandatory_char; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Gravatar", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_gravatar; ?> </li> <li><?php echo $return_gravatar_rating; ?> </li> <li><?php echo $return_gravatar_size; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Miscellaneous", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_email_image_path; ?> </li> <li><?php echo $return_website_image_path; ?> </li> <li><?php echo $return_admin_review; ?> </li> <li><?php echo $return_url_overruled; ?> </li> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("Role", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo $return_role1; ?> </li> <li><?php echo $return_role2; ?> </li> <li><?php echo $return_role3; ?> </li> <?php $abspath = str_replace("\\", "/", ABSPATH); if (is_writable($abspath . "wp-content/plugins/dmsguestbook/dmsguestbook.css")) { $css_notice = "<b>dmsguestbook.css </b><i style='color:#00bb00;font-style:normal;'>" . __("is writable", "dmsguestbook") . ".</i>"; } else { $css_notice = "<b>dmsguestbook.css </b><i style='color:#bb0000;font-style:normal;'>" . __("is not writable or doesn't exist", "dmsguestbook") . ".</i>"; } ?> </ul> </p> </div> <h3 style="font-weight:bold;"><a href="#"><?php echo __("CSS", "dmsguestbook"); ?> </a></h3> <div> <p> <ul> <li><?php echo __("If dmsguestbook.css exist and is writable, all CSS settings will be read from it.<br />Otherwise these settings will be loaded from the database.", "dmsguestbook"); ?> <br /><?php echo $css_notice; ?> <br /><br /> </li> <li><?php echo $return_css; ?> </li> <li><?php echo $return_css_customize; ?> </li> <li> <b><?php echo __("Settings for custom CSS", "dmsguestbook"); ?> </b><br /> <br /> <i><?php echo __("Mouse hover color", "dmsguestbook"); ?> </i><br /> a.css_navigation_char:hover {text-decoration:none; color:#{navigationcolor};}<br /> a.css_navigation_select:hover {text-decoration:none; color:#bb1100;}<br /> a.css_navigation_notselect:hover {text-decoration:none; color:#000000;}<br /> <br /> <i><?php echo __("Email and url image properties", "dmsguestbook"); ?> </i><br /> img.css_post_url_image {border:0px;}<br /> img.css_post_email_image {border:0px;}<br /> </li> </ul> </p> </div> </div> <!-- Check SMTP is on or not--> <script type="text/javascript"> smtpContainer(); function smtpContainer() { var mail_method = document.getElementById('mail_method').value; if(mail_method == "SMTP") { document.getElementById('smtp_container').style.display="block"; } if(mail_method == "Mail") { document.getElementById('smtp_container').style.display="none"; } } </script> <!-- Check reCAPTCHA is on or not--> <script type="text/javascript"> recaptchaKeys(); function recaptchaKeys() { if(document.form1.require_antispam[3].checked == true) { document.getElementById('recaptcha_keys').style.display="block"; } if(document.form1.require_antispam[3].checked == false) { document.getElementById('recaptcha_keys').style.display="none"; } } </script> <!-- Check Akismet is on or not--> <script type="text/javascript"> akismetContainer(); function akismetContainer() { var akismet = document.getElementById('akismet').checked; if(akismet == "1") { document.getElementById('akismet_container').style.display="block"; } if(akismet == "0") { document.getElementById('akismet_container').style.display="none"; } } </script> <?php echo "</div>\n\t</div>"; echo "</td></tr></table>"; echo "<table border='0'><colgroup><col width='100%' span='2'></colgroup><tr>"; echo "<td><input id='save' name='action' value='insert' type='hidden' />"; echo "<input class='button-primary action' style='font-weight:bold; margin:10px 0px; width:100px;' type='submit' value='" . __("Save", "dmsguestbook") . "' />"; echo "</form></td>"; #restore default settings button --> echo "<td><form name='form3' method='post' action='{$location}'>\n\t\t<input name='action' value='default_settings' type='hidden' />\n\t\t<input class='button-secondary action' style='font-weight:bold; margin:10px 0px;' type='submit'\n\t\tvalue='" . __("Restore default settings - All data will be replaced", "dmsguestbook") . "' onclick=\"return confirm('" . __("Would you really like to restore all data?", "dmsguestbook") . "');\" />\n \t</form></td>"; echo "</tr></table>"; ?> <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> <?php } ?> <!-- language --> <?php if ($_REQUEST['advanced'] == 1) { $Role1 = CheckRole($options["role1"], 0); if (!current_user_can("level_" . $Role1) && ROLE != 0) { CheckRole($options["role1"], 1); exit; } clearstatcache(); $color3 = settablecolor(3, 0); unset($buffer); $buffer = isset($buffer) ? $buffer : ''; $save_advanced_button = isset($save_advanced_button) ? $save_advanced_button : ''; $valid_file = isset($valid_file) ? $valid_file : ''; $_REQUEST['file'] = isset($_REQUEST['file']) ? $_REQUEST['file'] : ''; echo "<b style='font-size:20px;'>" . __("Language settings", "dmsguestbook") . "</b><br />"; $abspath = str_replace("\\", "/", ABSPATH); if ($handle = opendir($abspath . 'wp-content/plugins/dmsguestbook/language/')) { /* language */ while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "mo") { if ($file == "README.txt") { echo "<a style='color:#bb0000;' href='admin.php?page=dmsguestbook&advanced=1&folder=language/&file={$file}'>{$file}</a>, "; } else { echo "<a href='admin.php?page=dmsguestbook&advanced=1&folder=language/&file={$file}'>{$file}</a>, "; } } } echo "<br />"; closedir($handle); } if ($_REQUEST['file'] != "") { clearstatcache(); /* check the file variable for language text file */ if (preg_match('/^[a-z0-9_]+\\.+(txt)/i', "{$_REQUEST['file']}") == 1) { $file = $_REQUEST['file']; if (file_exists($abspath . "wp-content/plugins/dmsguestbook/language/" . $file)) { $folder = "language/"; $valid_file = 1; $save_advanced_button = check_writable($folder, $file); } else { $valid_file = 0; echo "<br /><b>" . __("File not found!", "dmsguestbook") . "</b>"; } } /* error handling */ if ($file == "") { echo "<br /><b>" . __("Not a valid file, must be a language file with .txt prefix.") . "</b>"; } if ($valid_file == 1) { $handle = @fopen($abspath . "wp-content/plugins/dmsguestbook/" . $folder . $file, "r"); while (!feof($handle)) { $buffer .= fgets($handle, 4096); } fclose($handle); } } $showfiledata = htmlentities($buffer, ENT_QUOTES); ?> <br /> <table style="border:0px solid #000000; width:100%;background-color:#<?php echo $color3; ?> ;" cellspacing="0" cellpadding="0"> <tr> <form name="form0" method="post" action="<?php echo $location; ?> "> <td><textarea style="width:99%; height:500px;" name="advanced_data"><?php echo $showfiledata; ?> </textarea></td> </tr> <input name="action" value="save_advanced_data" type="hidden" /> <input name="folder" value="<?php echo $folder; ?> " type="hidden" /> <input name="file" value="<?php echo $file; ?> " type="hidden" /> <tr> <td style="text-align:center;"><?php echo $save_advanced_button; ?> </td> </tr> </form> </tr> </table> <?php } ?> </div> <?php } }
continue; } $constant = $match[1]; $padding = $match[2]; switch ($constant) { case 'SIZE_URL': case 'DB_HOST': case 'DB_NAME': case 'DB_USERNAME': case 'DB_PASSWORD': case 'IM_SERVER': $config_file[$line_num] = "define('" . $constant . "'," . $padding . "'" . addcslashes($sets[$constant], "\\'") . "');\n"; break; } } if (check_writable(ROOT)) { $path_to_config = ROOT . 'config.php'; $handle = fopen($path_to_config, 'w'); foreach ($config_file as $line) { fwrite($handle, $line); } fclose($handle); chmod($path_to_config, 0666); $app->render("install/setup_2.html", array('config' => implode("", $config_file), 'writable' => true)); } else { $app->render("install/setup_2.html", array('config' => implode("", $config_file), 'size' => count($config_file) + 1)); } })->name('setup_2'); $app->get("/build_1", function () use($app) { if (!check_file(ROOT . 'config.php')) { $app->render("install/log.html", array('log' => "no_config"));
if (@file_get_contents($dir . "/dummy-file.tmp") != $data) { $errors[] = "<p>У скрипта нет прав записи в директорию <code>{$dir}</code>. Пожалуйста, смените её права командой «<code>chmod 777 {$dir}</code>».</p>"; } @unlink($dir . "/dummy-file.tmp"); } } if (!isset($_REQUEST['modeok'])) { $errors = array(); check_writable("tmp", $errors); check_writable("tmp/haml", $errors); check_writable("tmp/uploads", $errors); check_writable("data", $errors); check_writable("data/designs", $errors); check_writable("data/finishers", $errors); check_writable("data/handlers", $errors); check_writable("data/images", $errors); if ($errors) { die("<h1>Настройте права доступа к директориям</h1>" . "<p>Для работы скрипту необходимо записывать файлы в некоторые директории. Пожалуйста, настройте права доступа согласно следующим инструкциям.</p>" . implode("\n", $errors) . "<p><a href='/setup.php?" . htmlentities(propagate_query_string()) . "'>Повторить проверку</a></p>"); } else { $PROPAGATE['modeok'] = '1'; redirect(); } } $PROPAGATE['modeok'] = '1'; ////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (!isset($_REQUEST['confirm'])) { if (!isset($_REQUEST['connecterr'])) { echo "<h1>Конфигурация</h1>" . "<p>Пожалуйста, проверьте базовые настройки скрипта.</p>"; } else { echo "<h1>Ошибочная конфигурация</h1>" . "<p>Не удалось подключиться к MySQL-серверу. Пожалуйста, проверьте настройки еще раз.</p>"; }
function install_step2() { global $integria_footertext; global $integria_version; echo "\n\t<div align='center'>\n\t<div id='wizard' >\n\t\t<div id='install_box'>"; echo "<h1>Checking software dependencies</h1>"; echo "<table border='0' width='330' cellpadding='5' cellspacing='5'>"; $res = 0; $res += check_variable(phpversion(), "4.3", "PHP version >= 4.3.x", 1); $res += check_extension("mysql", "PHP MySQL extension"); $res += check_extension("gd", "PHP gd extension"); $res += check_extension("session", "PHP session extension"); $res += check_extension("mbstring", "PHP multibyte extension"); $res += check_extension("ldap", "PHP ldap extension"); $res += check_extension("gettext", "PHP gettext extension"); $res += check_extension("imap", "PHP IMAP extension"); $res += check_extension("gettext", "PHP gettext extension"); $res += check_extension("phar", "PHP Phar extension"); //$res += check_include("PEAR.php","PEAR PHP Library"); $res += check_writable("./include", "./include writable by HTTP server"); $res += check_writable("./attachment/tmp", "./attachment/tmp writable by HTTP server"); echo "</table>\n\t\t</div>\n\t\t<div class='box'>\n\t\t\t<img src='images/integria_white.png' alt=''>\n\t\t\t<br><br>\n\t\t\t<font size=1px>" . $integria_version . "</font>\n\t\t</div>\n\t\t<div class='box'>\n\t\t\t<img src='images/step1.png' alt=''>\n\t\t</div>\n\t\t<div id='install_box' style='margin-bottom: 0px;margin-left: 25px; '>"; if ($res > 0) { echo "<p><img src='images/info.png'> You have some uncomplete \n\t\t\t\tdependencies. Please correct it or this installer \n\t\t\t\tcould not finish your installation.\n\t\t\t\t</p>\n\t\t\t\tIgnore it. <a href='install.php?step=3'>Force install Step #3</a>"; } else { echo "<a href='install.php?step=3'><img align='right' src='images/arrow_next.png' alt=''></a>"; } echo "</div></div>"; }
* Pluck is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * See docs/COPYING for the complete license. */ //Make sure the file isn't accessed directly. defined('IN_PLUCK') or exit('Access denied!'); ?> <p> <strong><?php echo $lang['writable']['check']; ?> </strong> </p> <?php //Writable checks. foreach (array('images', 'files', 'data/modules', 'data/trash', 'data/themes', 'data/themes/default', 'data/themes/oldstyle', 'data/settings', 'data/settings/langpref.php') as $check) { check_writable($check); } unset($check); ?> <p> <a href="javascript:refresh()"><?php echo $lang['install']['refresh']; ?> </a> </p>