Exemplo n.º 1
0
/**
 * settings_rewrite 
 * 
 * Used to change any of the variables written in the
 * settings.php file, executes htaccess_rewrite also as
 * it is possible within settings_rewrite that the active
 * plugins are changed.
 *
 * @param mixed $SETTINGS
 * @param mixed $DB
 * @param mixed $PLUGINS
 * @param mixed $constants optional
 * @access public
 * @return void
 */
function settings_rewrite($SETTINGS, $DB, $PLUGINS, $constants = array())
{
    require_once HOME . '_inc/function/defaults.php';
    $constants = defaults_constants($constants);
    $Plugins = Plugins::getInstance();
    /**
     * calculate plugin dependencies
     */
    $plugins = array();
    foreach ($PLUGINS as $p_name => $version) {
        $plugin = $Plugins->plugins($p_name);
        if (!$plugin) {
            require HOME . '_plugins/' . $p_name . '/plugin.php';
        }
        array_push($plugins, array('sys_name' => $p_name, 'name' => $plugin['name'], 'version' => $plugin['version'], 'dependencies' => @$plugin['dependencies']));
    }
    $PLUGINS = resolve_dependencies($plugins, $PLUGINS);
    /**
     * plugins - filter the settings, constants and plugins arrays 
     */
    list($SETTINGS, $constants, $PLUGINS) = $Plugins->filter('general', 'filter_settings', array($SETTINGS, $constants, $PLUGINS));
    $filecontents = defaults_settings_content($SETTINGS, $DB, $PLUGINS, $constants);
    /**
     * write file or throw error
     */
    file_put_contents(HOME . '.settings.php', $filecontents) or error('You must grant <i>0777</i> write access to the <i>' . HOME . '</i> directory for <a href="http://furasta.org">Furasta.Org</a> to function correctly.' . 'Please do so then reload this page to save the settings.', 'Runtime Error');
    return htaccess_rewrite();
}
Exemplo n.º 2
0
function htaccess_activate()
{
    htaccess_rewrite();
    flush_rewrite_rules();
}
Exemplo n.º 3
0
     */
    if ($blog == '---') {
        // store content in $post array to emulate real post info
        $post['title'] = $title;
        $post['body'] = $body;
        $post['tags'] = $tags;
        $Template->runtimeError($Template->e('blog_admin_error_no_blog'));
    } elseif ($id == 0) {
        // create new page
        query('insert into ' . DB_PREFIX . 'blog_posts values' . '( "", ' . $blog . ', "' . $title . '", "' . $body . '", "' . $date . '", ' . $user . ',"' . $tags . '")');
        $id = mysql_insert_id();
        htaccess_rewrite();
        header('location: plugin.php?p_name=Blog&blog_id=' . $blog . '&post=' . $id . '&error=13');
    } else {
        query('update ' . DB_PREFIX . 'blog_posts set title="' . $title . '", body="' . $body . '", tags="' . $tags . '" where id=' . $id);
        htaccess_rewrite();
        $Template->runtimeError('13');
    }
}
if ($id != 0) {
    $post = row('select * from ' . DB_PREFIX . 'blog_posts where id=' . $id);
    if ($blog_id == 0) {
        $blog_id = $post['blog_id'];
    }
}
$blogs = rows('select id, name from ' . DB_PAGES . ' where type="Blog"');
$content = '
<span class="header-img"><img src="' . SITE_URL . '_plugins/Blog/img/post.png"/></span>
<h1 class="image-left">' . $Template->e('blog_admin_post') . '</h1>
<br style="clear:both"/>
<form id="blog-form" method="post">