function fix_constants($action) { global $db, $lang, $language; $lang_append = '&lang=' . $language; $img_ok = str_replace('alt="" title=""', 'alt="' . $lang['Fixed'] . '" title="' . $lang['Fixed'] . '"', $this->img_ok); $img_error = str_replace('alt="" title=""', 'alt="' . $lang['NotFixed'] . '" title="' . $lang['NotFixed'] . '"', $this->img_error); $content_output = ''; $table_output = ''; switch ($action) { case 'fix_all': $filename_tmp = IP_ROOT_PATH . 'config.' . PHP_EXT; $content = ip_functions::file_read($filename_tmp); $content = str_replace('PHPBB_INSTALLED', 'IP_INSTALLED', $content); $result = ip_functions::file_write($filename_tmp, $content); $color = ($result !== false) ? $this->color_ok : $this->color_error; $img = ($result !== false) ? $img_ok : $img_error; $content_output .= '<li><span class="genmed"><b style="color:' . $color . '">' . $filename_tmp . '</b> ' . $img . '</span></li>'; case 'fix_cms': if (defined('CMS_LAYOUT_TABLE')) { $sql = "SELECT filename FROM " . CMS_LAYOUT_TABLE . " WHERE filename <> '' ORDER BY filename ASC"; if (!($result = $db->sql_query($sql))) { die('Could not query CMS Pages'); } $files_array = array(); while ($row = $db->sql_fetchrow($result)) { $filename_path = IP_ROOT_PATH . $row['filename']; if (is_writable($filename_path)) { $files_array[] = $filename_path; } } for ($i = 0; $i < sizeof($files_array); $i++) { $filename_tmp = $files_array[$i]; $content = ip_functions::cms_page_content(); $result = ip_functions::file_write($filename_tmp, $content); $color = ($result !== false) ? $this->color_ok : $this->color_error; $img = ($result !== false) ? $img_ok : $img_error; $content_output .= '<li><span class="genmed"><b style="color:' . $color . '">' . $filename_tmp . '</b> ' . $img . '</span></li>' . "\n"; } } $content_output = ($content_output == '') ? ('<li><span class="genmed"><b style="color: ' . $this->color_ok . '">' . $lang['None'] . '</b></span></li>' . "\n") : $content_output; $table_output .= '<div class="post-text">' . "\n"; $table_output .= '<b>' . $lang['FilesProcessed'] . '</b><br /><ul>' . $content_output . '</ul><br /><br />' . "\n"; $table_output .= '</div>' . "\n"; break; default: if (is_writable(IP_ROOT_PATH . 'config.' . PHP_EXT)) { $table_output .= '<div class="post-text">' . "\n"; $table_output .= '<br /><span class="text_red"><b><span class="gen">' . $lang['ClickToFix'] . '</span></b></span><br /><br />' . "\n"; $table_output .= '<ul type="circle">' . "\n"; $table_output .= '<li><a href="' . ip_functions::append_sid(THIS_FILE . '?mode=fix_constants&action=fix_all' . $lang_append) . '"><b>' . $lang['FixAllFiles'] . '</b></a></li>' . "\n"; $table_output .= '<li><a href="' . ip_functions::append_sid(THIS_FILE . '?mode=fix_constants&action=fix_cms' . $lang_append) . '"><b>' . $lang['FixCMSPages'] . '</b></a></li>' . "\n"; $table_output .= '</ul>' . "\n"; $table_output .= '</div>' . "\n"; } else { $table_output .= '<div class="text_cont_center" style="width:400px;"><div class="text_red_cont"><span class="text_red">' . $lang['FileCreation_ERROR_Explain'] . '</span></div></div>' . "\n"; } } return $table_output; }