示例#1
0
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
$version = $core->plugins->moduleInfo('antispam', 'version');
if (version_compare($core->getVersion('antispam'), $version, '>=')) {
    return;
}
/* Database schema
-------------------------------------------------------- */
$s = new dbStruct($core->con, $core->prefix);
$s->spamrule->rule_id('bigint', 0, false)->blog_id('varchar', 32, true)->rule_type('varchar', 16, false, "'word'")->rule_content('varchar', 128, false)->primary('pk_spamrule', 'rule_id');
$s->spamrule->index('idx_spamrule_blog_id', 'btree', 'blog_id');
$s->spamrule->reference('fk_spamrule_blog', 'blog_id', 'blog', 'blog_id', 'cascade', 'cascade');
if ($s->driver() == 'pgsql') {
    $s->spamrule->index('idx_spamrule_blog_id_null', 'btree', '(blog_id IS NULL)');
}
# Schema installation
$si = new dbStruct($core->con, $core->prefix);
$changes = $si->synchronize($s);
# Creating default wordslist
if ($core->getVersion('antispam') === null) {
    $_o = new dcFilterWords($core);
    $_o->defaultWordsList();
    unset($_o);
}
$settings = new dcSettings($core, null);
$settings->addNamespace('antispam');
$settings->antispam->put('antispam_moderation_ttl', 0, 'integer', 'Antispam Moderation TTL (days)', false);
$core->setVersion('antispam', $version);
return true;
 /**
 Creates default settings for active blog. Optionnal parameter
 <var>defaults</var> replaces default params while needed.
 
 @param	defaults		<b>array</b>	Default parameters
 */
 public function blogDefaults($defaults = null)
 {
     if (!is_array($defaults)) {
         $defaults = array(array('allow_comments', 'boolean', true, 'Allow comments on blog'), array('allow_trackbacks', 'boolean', true, 'Allow trackbacks on blog'), array('blog_timezone', 'string', 'Europe/London', 'Blog timezone'), array('comments_nofollow', 'boolean', true, 'Add rel="nofollow" to comments URLs'), array('comments_pub', 'boolean', true, 'Publish comments immediatly'), array('comments_ttl', 'integer', 0, 'Number of days to keep comments open (0 means no ttl)'), array('copyright_notice', 'string', '', 'Copyright notice (simple text)'), array('date_format', 'string', '%A, %B %e %Y', 'Date format. See PHP strftime function for patterns'), array('editor', 'string', '', 'Person responsible of the content'), array('enable_html_filter', 'boolean', 0, 'Enable HTML filter'), array('enable_xmlrpc', 'boolean', 0, 'Enable XML/RPC interface'), array('lang', 'string', 'en', 'Default blog language'), array('media_exclusion', 'string', '', 'File name exclusion pattern in media manager. (PCRE value)'), array('media_img_m_size', 'integer', 448, 'Image medium size in media manager'), array('media_img_s_size', 'integer', 240, 'Image small size in media manager'), array('media_img_t_size', 'integer', 100, 'Image thumbnail size in media manager'), array('media_img_title_pattern', 'string', 'Title ;; Date(%b %Y) ;; separator(, )', 'Pattern to set image title when you insert it in a post'), array('nb_post_per_page', 'integer', 20, 'Number of entries on home page and category pages'), array('nb_post_per_feed', 'integer', 20, 'Number of entries on feeds'), array('nb_comment_per_feed', 'integer', 20, 'Number of comments on feeds'), array('post_url_format', 'string', '{y}/{m}/{d}/{t}', 'Post URL format. {y}: year, {m}: month, {d}: day, {id}: post id, {t}: entry title'), array('public_path', 'string', 'public', 'Path to public directory, begins with a / for a full system path'), array('public_url', 'string', '/public', 'URL to public directory'), array('robots_policy', 'string', 'INDEX,FOLLOW', 'Search engines robots policy'), array('short_feed_items', 'boolean', false, 'Display short feed items'), array('theme', 'string', 'default', 'Blog theme'), array('themes_path', 'string', 'themes', 'Themes root path'), array('themes_url', 'string', '/themes', 'Themes root URL'), array('time_format', 'string', '%H:%M', 'Time format. See PHP strftime function for patterns'), array('tpl_allow_php', 'boolean', false, 'Allow PHP code in templates'), array('tpl_use_cache', 'boolean', true, 'Use template caching'), array('trackbacks_pub', 'boolean', true, 'Publish trackbacks immediatly'), array('trackbacks_ttl', 'integer', 0, 'Number of days to keep trackbacks open (0 means no ttl)'), array('url_scan', 'string', 'query_string', 'URL handle mode (path_info or query_string)'), array('use_smilies', 'boolean', false, 'Show smilies on entries and comments'), array('wiki_comments', 'boolean', false, 'Allow commenters to use a subset of wiki syntax'));
     }
     $settings = new dcSettings($this, null);
     $settings->setNameSpace('system');
     foreach ($defaults as $v) {
         $settings->put($v[0], $v[2], $v[1], $v[3], false, true);
     }
 }
示例#3
0
文件: blog.php 项目: HackerMajor/root
$blog_name = '';
$blog_desc = '';
# Create a blog
if (!isset($_POST['id']) && !empty($_POST['blog_id'])) {
    $cur = $core->con->openCursor($core->prefix . 'blog');
    $blog_id = $cur->blog_id = $_POST['blog_id'];
    $blog_url = $cur->blog_url = $_POST['blog_url'];
    $blog_name = $cur->blog_name = $_POST['blog_name'];
    $blog_desc = $cur->blog_desc = $_POST['blog_desc'];
    try {
        # --BEHAVIOR-- adminBeforeBlogCreate
        $core->callBehavior('adminBeforeBlogCreate', $cur, $blog_id);
        $core->addBlog($cur);
        # Default settings and override some
        $core->blogDefaults($cur->blog_id);
        $blog_settings = new dcSettings($core, $cur->blog_id);
        $blog_settings->setNameSpace('system');
        $blog_settings->put('lang', $core->auth->getInfo('user_lang'));
        $blog_settings->put('blog_timezone', $core->auth->getInfo('user_tz'));
        if (substr($blog_url, -1) == '?') {
            $blog_settings->put('url_scan', 'query_string');
        } else {
            $blog_settings->put('url_scan', 'path_info');
        }
        # --BEHAVIOR-- adminAfterBlogCreate
        $core->callBehavior('adminAfterBlogCreate', $cur, $blog_id, $blog_settings);
        http::redirect('blog.php?id=' . $cur->blog_id . '&add=1');
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }
}
示例#4
0
 $cur->user_tz = $default_tz;
 $cur->user_creadt = array('NOW()');
 $cur->user_upddt = array('NOW()');
 $cur->user_options = serialize($core->userDefaults());
 $cur->insert();
 $core->auth->checkUser($u_login);
 $admin_url = preg_replace('%install/index.php$%', '', $_SERVER['REQUEST_URI']);
 $root_url = preg_replace('%/admin/install/index.php$%', '', $_SERVER['REQUEST_URI']);
 # Create blog
 $cur = $core->con->openCursor($core->prefix . 'blog');
 $cur->blog_id = 'default';
 $cur->blog_url = http::getHost() . $root_url . '/index.php?';
 $cur->blog_name = __('My first blog');
 $core->addBlog($cur);
 $core->blogDefaults($cur->blog_id);
 $blog_settings = new dcSettings($core, 'default');
 $blog_settings->setNameSpace('system');
 $blog_settings->put('blog_timezone', $default_tz);
 $blog_settings->put('lang', $dlang);
 $blog_settings->put('public_url', $root_url . '/public');
 $blog_settings->put('themes_url', $root_url . '/themes');
 # Add Dotclear version
 $cur = $core->con->openCursor($core->prefix . 'version');
 $cur->module = 'core';
 $cur->version = (string) DC_VERSION;
 $cur->insert();
 # Create first post
 $core->setBlog('default');
 $cur = $core->con->openCursor($core->prefix . 'post');
 $cur->user_id = $u_login;
 $cur->post_format = 'xhtml';
示例#5
0
文件: index.php 项目: nikrou/dotclear
 $cur->user_tz = $default_tz;
 $cur->user_creadt = date('Y-m-d H:i:s');
 $cur->user_upddt = date('Y-m-d H:i:s');
 $cur->user_options = serialize($core->userDefaults());
 $cur->insert();
 $core->auth->checkUser($u_login);
 $admin_url = preg_replace('%install/index.php$%', '', $_SERVER['REQUEST_URI']);
 $root_url = preg_replace('%/admin/install/index.php$%', '', $_SERVER['REQUEST_URI']);
 # Create blog
 $cur = $core->con->openCursor($core->prefix . 'blog');
 $cur->blog_id = 'default';
 $cur->blog_url = http::getHost() . $root_url . '/index.php?';
 $cur->blog_name = __('My first blog');
 $core->addBlog($cur);
 $core->blogDefaults($cur->blog_id);
 $blog_settings = new dcSettings($core, 'default');
 $blog_settings->addNamespace('system');
 $blog_settings->system->put('blog_timezone', $default_tz);
 $blog_settings->system->put('lang', $dlang);
 $blog_settings->system->put('public_url', $root_url . '/public');
 $blog_settings->system->put('themes_url', $root_url . '/themes');
 # date and time formats
 $formatDate = __('%A, %B %e %Y');
 $date_formats = array('%Y-%m-%d', '%m/%d/%Y', '%d/%m/%Y', '%Y/%m/%d', '%d.%m.%Y', '%b %e %Y', '%e %b %Y', '%Y %b %e', '%a, %Y-%m-%d', '%a, %m/%d/%Y', '%a, %d/%m/%Y', '%a, %Y/%m/%d', '%B %e, %Y', '%e %B, %Y', '%Y, %B %e', '%e. %B %Y', '%A, %B %e, %Y', '%A, %e %B, %Y', '%A, %Y, %B %e', '%A, %Y, %B %e', '%A, %e. %B %Y');
 $time_formats = array('%H:%M', '%I:%M', '%l:%M', '%Hh%M', '%Ih%M', '%lh%M');
 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
     $formatDate = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $formatDate);
     $date_formats = array_map(create_function('$f', 'return str_replace(\'%e\',\'%#d\',$f);'), $date_formats);
 }
 $blog_settings->system->put('date_format', $formatDate);
 $blog_settings->system->put('date_formats', serialize($date_formats), 'string', 'Date formats examples', true, true);
示例#6
0
<?php

# -- BEGIN LICENSE BLOCK ---------------------------------------
#
# This file is part of blowupConfig, a plugin for Dotclear 2.
#
# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
$version = $core->plugins->moduleInfo('blowupConfig', 'version');
if (version_compare($core->getVersion('blowupConfig'), $version, '>=')) {
    return;
}
$settings = new dcSettings($core, null);
$settings->addNamespace('themes');
$settings->themes->put('blowup_style', '', 'string', 'Blow Up  custom style', false);
$core->setVersion('blowupConfig', $version);
return true;
示例#7
0
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
# On lit la version du plugin
$m_version = $core->plugins->moduleInfo('mobileThemeSwitcher', 'version');
# On lit la version du plugin dans la table des versions
$i_version = $core->getVersion('mobileThemeSwitcher');
# La version dans la table est supérieure ou égale à
# celle du module, on ne fait rien puisque celui-ci
# est installé
if (version_compare($i_version, $m_version, '>=')) {
    return;
}
# Création du setting (s'il existe, il ne sera pas écrasé)
$settings = new dcSettings($core, null);
$settings->setNamespace('mobileThemeSwitcher');
$settings->put('mobileThemeSwitcher_theme', null, 'string', 'mobileThemeSwitcher theme', false, true);
# La procédure d'installation commence vraiment là
$core->setVersion('mobileThemeSwitcher', $m_version);
示例#8
0
 }
 # --BEHAVIOR-- adminBeforeBlogUpdate
 $core->callBehavior('adminBeforeBlogUpdate', $cur, $blog_id);
 if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_POST['lang'])) {
     throw new Exception(__('Invalid language code'));
 }
 $core->updBlog($blog_id, $cur);
 # --BEHAVIOR-- adminAfterBlogUpdate
 $core->callBehavior('adminAfterBlogUpdate', $cur, $blog_id);
 if ($cur->blog_id != null && $cur->blog_id != $blog_id) {
     if ($blog_id == $core->blog->id) {
         $core->setBlog($cur->blog_id);
         $_SESSION['sess_blog_id'] = $cur->blog_id;
         $blog_settings = $core->blog->settings;
     } else {
         $blog_settings = new dcSettings($core, $cur->blog_id);
     }
     $blog_id = $cur->blog_id;
 }
 $blog_settings->addNameSpace('system');
 $blog_settings->system->put('editor', $_POST['editor']);
 $blog_settings->system->put('copyright_notice', $_POST['copyright_notice']);
 $blog_settings->system->put('post_url_format', $_POST['post_url_format']);
 $blog_settings->system->put('lang', $_POST['lang']);
 $blog_settings->system->put('blog_timezone', $_POST['blog_timezone']);
 $blog_settings->system->put('date_format', $_POST['date_format']);
 $blog_settings->system->put('time_format', $_POST['time_format']);
 $blog_settings->system->put('comments_ttl', abs((int) $_POST['comments_ttl']));
 $blog_settings->system->put('trackbacks_ttl', abs((int) $_POST['trackbacks_ttl']));
 $blog_settings->system->put('allow_comments', !empty($_POST['allow_comments']));
 $blog_settings->system->put('allow_trackbacks', !empty($_POST['allow_trackbacks']));
示例#9
0
文件: blog.php 项目: nikrou/dotclear
$blog_name = '';
$blog_desc = '';
# Create a blog
if (!isset($_POST['id']) && isset($_POST['create'])) {
    $cur = $core->con->openCursor($core->prefix . 'blog');
    $blog_id = $cur->blog_id = $_POST['blog_id'];
    $blog_url = $cur->blog_url = $_POST['blog_url'];
    $blog_name = $cur->blog_name = $_POST['blog_name'];
    $blog_desc = $cur->blog_desc = $_POST['blog_desc'];
    try {
        # --BEHAVIOR-- adminBeforeBlogCreate
        $core->callBehavior('adminBeforeBlogCreate', $cur, $blog_id);
        $core->addBlog($cur);
        # Default settings and override some
        $core->blogDefaults($cur->blog_id);
        $blog_settings = new dcSettings($core, $cur->blog_id);
        $blog_settings->addNamespace('system');
        $blog_settings->system->put('lang', $core->auth->getInfo('user_lang'));
        $blog_settings->system->put('blog_timezone', $core->auth->getInfo('user_tz'));
        if (substr($blog_url, -1) == '?') {
            $blog_settings->system->put('url_scan', 'query_string');
        } else {
            $blog_settings->system->put('url_scan', 'path_info');
        }
        # --BEHAVIOR-- adminAfterBlogCreate
        $core->callBehavior('adminAfterBlogCreate', $cur, $blog_id, $blog_settings);
        dcPage::addSuccessNotice(sprintf(__('Blog "%s" successfully created'), html::escapeHTML($cur->blog_name)));
        $core->adminurl->redirect("admin.blog", array('id' => $cur->blog_id));
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }