$value){
$wpg2_option[$key] = $value;
}
update_option('wpg2_options', $wpg2_option);
if ($wpg2_option['g2_rewriteactive'] == 'active') {
// Rebuild Rules
wpg2_rebuildrewriterules();
?>
';
$environment_html .= __('Wordpress Permalinks Active?' , 'wpg2') . ' | ';
$wppagestruct = $wp_rewrite->get_page_permastruct();
if ( '' != $wppagestruct )
$environment_html .= '' . __('Yes', 'wpg2') . '';
else {
$environment_html .= '' . __('No', 'wpg2') . '';
$validate_err = 1;
define("WPNOPERMALINKS", "True");
}
$environment_html .= " | ";
// Verify WPG2 Internal g2_embeduri setting
wpg2_template_page();
if (!defined('G2INIT')) {
$ret = g2_login();
if ($ret) {
echo '' . __('Fatal G2 error', 'wpg2') . '
' . __("Here's the error from G2: ", 'wpg2') . $ret->getAsHtml();
exit;
}
}
// Is the Rewrite Plugin Installed?
$environment_html .= '| ';
$environment_html .= __('Does Gallery2 Rewrite Plugin Exists?' , 'wpg2') . ' | ';
if (!$validate_err) {
$g2_moduleid = 'rewrite';
list ($ret, $g2_modulestatus ) = GalleryCoreApi::fetchPluginStatus('module');
if (!$ret) {
if (isset($g2_modulestatus[$g2_moduleid]))
$environment_html .= '' . __('Yes', 'wpg2') . '';
else {
$environment_html .= '' . __('No', 'wpg2') . '';
$validate_err = 1;
define("G2REWRITEMODULEMISSING", "True");
}
} else {
$environment_html .= '' . __('No', 'wpg2') . '';
$validate_err = 1;
}
} else {
$environment_html .= '' . __('Skipped Due to Previous Failure', 'wpg2') . '';
}
$environment_html .= " |
";
$environment_html .= '| ';
// Test Activating Rewrite Plugin
$environment_html .= __('Can Gallery2 Rewrite Plugin be Activated?' , 'wpg2') . ' | ';
if (!$validate_err) {
// Test Activate G2 Rewrite Module.
list ($ret, $g2_modulestatus ) = GalleryCoreApi::fetchPluginStatus('module');
if (!$ret) {
if (isset($g2_modulestatus[$g2_moduleid]) && empty($g2_modulestatus[$g2_moduleid]['active']) && !$g2_modulestatus[$g2_moduleid]['active']) {
list ($ret, $ignored) = GalleryCoreApi::activatePlugin('module', 'rewrite');
}
list ($ret, $rewriteApi) = GalleryCoreApi::newFactoryInstance('RewriteApi');
if ($rewriteApi) { // Module Active
$environment_html .= '' . __('Yes', 'wpg2') . '';
} else {
$environment_html .= '' . __('No', 'wpg2') . '';
$validate_err = 1;
define("G2REWRITEMODULEERR", "True");
}
} else {
$environment_html .= '' . __('No', 'wpg2') . '';
$validate_err = 1;
define("G2REWRITEMODULEERR", "True");
}
} else $environment_html .= '' . __('Skipped Due to Previous Failure', 'wpg2') . '';
$environment_html .= " |
";
// Check For Pathinfo
$environment_html .= '| ';
$environment_html .= __('Is Gallery2 Rewrite using Apache Mod_Rewrite?' , 'wpg2') . ' | ';
if (!$validate_err) {
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
list ($ret, $rewriteParser) = RewriteHelper::getRewriteParser();
if ('modrewrite' == $rewriteParser->getParserId())
$environment_html .= '' . __('Yes', 'wpg2') . '';
else {
$environment_html .= '' . __('No', 'wpg2') . '';
define("G2REWRITEPATHINFO", "True");
$validate_err=1;
}
} else $environment_html .= '' . __('Skipped Due to Previous Failure', 'wpg2') . '';
$environment_html .= " |
";
// Gallery2 Rewrite Rules Update
$environment_html .= '| ';
$environment_html .= __('Wordpress .htaccess can be updated?' , 'wpg2') . ' | ';
if (!$validate_err) {
$required = array(1, 0);
$errreturn = g2_configurerewrites(); // Call the Auto-configuration Function
if (empty($errreturn)) {
list ($ret, $configrequired) = $rewriteApi->needsEmbedConfig();
if ($configrequired) {
$environment_html .= '' . __('Failed', 'wpg2') . '';
$errstr = __('Failed due to incomplete configuration. Please finish the installation of the rewrite plugin via the Gallery2 Site Admin -> Rewrite panel.', 'wpg2');
define("G2REWRITERULESERR", "True");
$validate_err=1;
} else {
$environment_html .= '' . __('Yes', 'wpg2') . '';
}
} else {
$environment_html .= '' . __('No', 'wpg2') . '';
$errstr = __('Failed to update because ', 'wpg2').$errreturn;
define("G2REWRITERULESERR", "True");
$validate_err=1;
}
} else $environment_html .= '' . __('Skipped Due to Previous Failure', 'wpg2') . '';
$environment_html .= " |
";
$environment_html .= "
";
if ($validate_err || $wpg2_option['g2_rewriteactive'] != 'active') {
// Check G2 Rewrite Module, it should be deactivated
$g2_moduleid = 'rewrite';
list ($ret, $g2_modulestatus ) = GalleryCoreApi::fetchPluginStatus('module');
if (isset($g2_modulestatus[$g2_moduleid]) && !empty($g2_modulestatus[$g2_moduleid]['active']) && $g2_modulestatus[$g2_moduleid]['active']) {
list ($ret, $ignored) = GalleryCoreApi::deactivatePlugin('module', 'rewrite');
}
}
//Close Gallery Connection
GalleryEmbed::done();
//Output Status
if ($wpg2_outputtype != "silent") {
echo "";
echo $environment_html;
if (defined('WPNOPERMALINKS')) {
echo '';
echo '
'. __('Error: Wordpress Permalinks are not Active','wpg2').'
'. __("In order to support Gallery2 Rewrite rules, you must have a Wordpress Permalinks Active, please Configure Wordpress Permalinks from the Wordpres Options Panel.", 'wpg2').'
';
echo $ret;
echo '';
}
if (defined('G2REWRITEMODULEMISSING')) {
echo '';
echo '
'. __('Error: Gallery2 Rewrite Plugin does not Exist','wpg2').'
'. __("You must have not installed the Gallery2 Rewrite Plugin, please download/install the rewrite plugin from the Gallery2 Site Admin Plugin Get More Plugins Panel.", 'wpg2').'
';
echo '';
}
if (defined('G2REWRITEMODULEERR')) {
echo '';
echo '
'. __('Error: Gallery2 Rewrite Plugin cannot be activated','wpg2').'
'. __("WPG2 cannot remotely activate the Gallery2 Rewrite Plugin. Please manually configure the Gallery2 Rewrite Plugin from the Gallery2 Site Admin Plugin Panel.", 'wpg2').'
';
echo '';
}
if (defined('G2REWRITERULESERR')) {
echo '';
echo '
'. __('Error: Gallery2 Rewrite Rules Failed to be updated','wpg2').'
'. $errstr.'
';
echo $ret;
echo '';
}
if (defined('G2REWRITEPATHINFO')) {
echo '';
echo '
'. __('Error: Gallery2 Rewrite is not using mod_rewrite','wpg2').'
'. __("Gallery2 Rewrite module is not using Apache mod_rewrite and cannot be supported within the Wordpress Environment, please configure the Gallery2 Rewrite Module to use Apache Mod_Write.", 'wpg2').'
';
echo $ret;
echo '';
}
}
return $validate_err;
}
?>