/** * Detects when settings has changed and if the permalink * feature is activated. * * @param string $dirname <p>Module dirname</p> * @param array $save <p>Settings options saved with values</p> * @param array $add <p>Settings options added with values</p> * @param array $delete <p>Settings options deleted from database table</p> * @return string */ public function eventRmcommonSavedSettings($dirname, $save, $add, $delete) { if ($dirname != 'rmcommon') { return $dirname; } $base = parse_url(XOOPS_URL . '/'); $base = isset($base['path']) ? rtrim($base['path'], '/') . '/' : '/'; $rules = "ErrorDocument 404 " . $base . "modules/rmcommon/404.php\n"; foreach ($save['modules_path'] as $mod => $path) { $path = ltrim($path, "/"); $rules .= "RewriteRule ^{$path}/?(.*)\$ modules/{$mod}/index.php/\$1 [L]\n"; $rules .= "RewriteRule ^admin/{$path}/?(.*)\$ modules/{$mod}/admin/index.php/\$2 [L]\n"; } if ($save['permalinks'] == 0) { $ht = new RMHtaccess('rmcommon'); $htResult = $ht->removeRule(); if ($htResult !== true) { showMessage(__('An error ocurred while trying to delete .htaccess rules!', 'rmcommon') . '<br>' . __('Please delete lines starting with <code># begin rmcommon</code> and ending with <code># end rmcommon</code>', 'rmcommon'), RMMSG_ERROR); } return $dirname; } $rules .= "RewriteRule ^rss/?(.*)\$ modules/rmcommon/rss.php\$1 [L]\n"; $ht = new RMHtaccess('rmcommon'); $htResult = $ht->write($rules); if ($htResult !== true) { showMessage(__('An error ocurred while trying to write .htaccess file!', 'rmcommon') . '<br>' . __('Please try to add manually next lines:', 'rmcommon') . '<br><code>' . nl2br($rules) . '</code>', RMMSG_ERROR); } //RMSettings::write_rewrite_js( $save['modules_path'] ); return null; }
public function eventRmcommonSavedSettings($dirname, $save, $add, $delete) { if ('bxpress' != $dirname) { return $dirname; } // URL rewriting $rule = "RewriteRule ^" . trim($save['htbase'], '/') . "/?(.*)\$ modules/bxpress/\$1 [L]"; if (1 == $save['urlmode']) { $ht = new RMHtaccess('bxpress'); $htResult = $ht->write($rule); if ($htResult !== true) { showMessage(__('An error ocurred while trying to write .htaccess file!', 'bxpress'), RMMSG_ERROR); } } else { $ht = new RMHtaccess('bxpress'); $ht->removeRule(); $ht->write(); } return null; }
$editor->assignVars($row); $editors[] = array('id' => $editor->id(), 'name' => $editor->getVar('name'), 'link' => $editor->permalink(), 'total' => $row['counter']); } unset($editor, $result, $sql); // URL rewriting $rule = "RewriteRule ^" . trim($xoopsModuleConfig['basepath'], '/') . "/?(.*)\$ modules/mywords/index.php [L]"; if ($xoopsModuleConfig['permalinks'] > 1) { $ht = new RMHtaccess('mywords'); $htResult = $ht->write($rule); if ($htResult !== true) { showMessage(__('An error ocurred while trying to write .htaccess file!', 'mywords'), RMMSG_ERROR); } } else { $ht = new RMHtaccess('mywords'); $ht->removeRule(); $ht->write(); } RMBreadCrumb::get()->add_crumb(__('Dashboard', 'mywords')); include 'menu.php'; MWFunctions::include_required_files(); RMTemplate::get()->add_script('../include/js/scripts.php?file=dashboard.js'); RMTemplate::get()->add_help(__('MyWords Documentation', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/introduccion/'); // Other panels for dashboard $dashboardPanels = []; $dashboardPanels = RMEvents::get()->trigger('mywords.dashboard.panels', $dashboardPanels); xoops_cp_header(); // Show Templates RMTemplate::get()->add_body_class('dashboard'); //$tpl->header(); include RMtemplate::get()->get_template('admin/mywords-theindex.php', 'module', 'mywords'); //$tpl->footer();