mirror of https://git.dotclear.org/dev/dotclear
Add some people in CREDITS, remove trailing spaces and tabs.
parent
a82d5e6aba
commit
56af5d1600
5
CREDITS
5
CREDITS
|
@ -9,12 +9,15 @@ Noé Cendrier
|
|||
Benoit Clerc
|
||||
Grégory Corvisier
|
||||
Florent Cotton
|
||||
Jean-Christian Denis
|
||||
Philippe Hénaff
|
||||
Bruno Hondelatte
|
||||
Kévin Lepeltier
|
||||
Olivier Meunier
|
||||
Franck Paul
|
||||
Michel Pelletier
|
||||
Xavier Plantefève
|
||||
Nicolas Roudaire
|
||||
Jean-Michel Royer
|
||||
Anne Sophie Tranchet
|
||||
Alain Vagner
|
||||
|
@ -43,4 +46,4 @@ Jan Skrasek
|
|||
Takafumi
|
||||
Regina Timbó
|
||||
|
||||
... and all contributors.
|
||||
... and all contributors.
|
||||
|
|
|
@ -82,17 +82,17 @@ if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email']))
|
|||
try
|
||||
{
|
||||
$recover_key = $core->auth->setRecoverKey($user_id,$user_email);
|
||||
|
||||
|
||||
$subject = mail::B64Header('DotClear '.__('Password reset'));
|
||||
$message =
|
||||
__('Someone has requested to reset the password for the following site and username.')."\n\n".
|
||||
$page_url."\n".__('Username:').' '.$user_id."\n\n".
|
||||
__('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.')."\n".
|
||||
$page_url.'?akey='.$recover_key;
|
||||
|
||||
|
||||
$headers[] = 'From: '.(defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
|
||||
$headers[] = 'Content-Type: text/plain; charset=UTF-8;';
|
||||
|
||||
|
||||
mail::sendMail($user_email,$subject,$message,$headers);
|
||||
$msg = sprintf(__('The e-mail was sent successfully to %s.'),$user_email);
|
||||
}
|
||||
|
@ -107,16 +107,16 @@ elseif ($akey)
|
|||
try
|
||||
{
|
||||
$recover_res = $core->auth->recoverUserPassword($akey);
|
||||
|
||||
|
||||
$subject = mb_encode_mimeheader('DotClear '.__('Your new password'),'UTF-8','B');
|
||||
$message =
|
||||
__('Username:').' '.$recover_res['user_id']."\n".
|
||||
__('Password:').' '.$recover_res['new_pass']."\n\n".
|
||||
preg_replace('/\?(.*)$/','',$page_url);
|
||||
|
||||
|
||||
$headers[] = 'From: dotclear@'.$_SERVER['HTTP_HOST'];
|
||||
$headers[] = 'Content-Type: text/plain; charset=UTF-8;';
|
||||
|
||||
|
||||
mail::sendMail($recover_res['user_email'],$subject,$message,$headers);
|
||||
$msg = __('Your new password is in your mailbox.');
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ elseif ($change_pwd)
|
|||
if ($data['user_id'] === false) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
|
||||
# Check login informations
|
||||
$check_user = false;
|
||||
if (isset($data['cookie_admin']) && strlen($data['cookie_admin']) == 104)
|
||||
|
@ -156,34 +156,34 @@ elseif ($change_pwd)
|
|||
$check_user = $core->auth->checkUser($user_id,null,$user_key) === true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$core->auth->allowPassChange() || !$check_user) {
|
||||
$change_pwd = false;
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['new_pwd'] != $_POST['new_pwd_c']) {
|
||||
throw new Exception(__("Passwords don't match"));
|
||||
}
|
||||
|
||||
|
||||
if ($core->auth->checkUser($user_id,$_POST['new_pwd']) === true) {
|
||||
throw new Exception(__("You didn't change your password."));
|
||||
}
|
||||
|
||||
|
||||
$cur = $core->con->openCursor($core->prefix.'user');
|
||||
$cur->user_change_pwd = 0;
|
||||
$cur->user_pwd = $_POST['new_pwd'];
|
||||
$core->updUser($core->auth->userID(),$cur);
|
||||
|
||||
|
||||
$core->session->start();
|
||||
$_SESSION['sess_user_id'] = $user_id;
|
||||
$_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY);
|
||||
|
||||
|
||||
if ($data['user_remember'])
|
||||
{
|
||||
setcookie('dc_admin',$data['cookie_admin'],strtotime('+15 days'),'','',DC_ADMIN_SSL);
|
||||
}
|
||||
|
||||
|
||||
http::redirect('index.php');
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
@ -201,10 +201,10 @@ elseif ($user_id !== null && ($user_pwd !== null || $user_key !== null))
|
|||
} else {
|
||||
$check_perms = false;
|
||||
}
|
||||
|
||||
|
||||
$cookie_admin = http::browserUID(DC_MASTER_KEY.$user_id.
|
||||
crypt::hmac(DC_MASTER_KEY,$user_pwd)).bin2hex(pack('a32',$user_id));
|
||||
|
||||
|
||||
if ($check_perms && $core->auth->mustChangePassword())
|
||||
{
|
||||
$login_data = join('/',array(
|
||||
|
@ -212,7 +212,7 @@ elseif ($user_id !== null && ($user_pwd !== null || $user_key !== null))
|
|||
$cookie_admin,
|
||||
empty($_POST['user_remember'])?'0':'1'
|
||||
));
|
||||
|
||||
|
||||
if (!$core->auth->allowPassChange()) {
|
||||
$err = __('You have to change your password before you can login.');
|
||||
} else {
|
||||
|
@ -220,7 +220,7 @@ elseif ($user_id !== null && ($user_pwd !== null || $user_key !== null))
|
|||
$change_pwd = true;
|
||||
}
|
||||
}
|
||||
elseif ($check_perms && !empty($_POST['safe_mode']) && !$core->auth->isSuperAdmin())
|
||||
elseif ($check_perms && !empty($_POST['safe_mode']) && !$core->auth->isSuperAdmin())
|
||||
{
|
||||
$err = __('Safe Mode can only be used for super administrators.');
|
||||
}
|
||||
|
@ -229,19 +229,19 @@ elseif ($user_id !== null && ($user_pwd !== null || $user_key !== null))
|
|||
$core->session->start();
|
||||
$_SESSION['sess_user_id'] = $user_id;
|
||||
$_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY);
|
||||
|
||||
|
||||
if (!empty($_POST['blog'])) {
|
||||
$_SESSION['sess_blog_id'] = $_POST['blog'];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['safe_mode']) && $core->auth->isSuperAdmin()) {
|
||||
$_SESSION['sess_safe_mode'] = true;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['user_remember'])) {
|
||||
setcookie('dc_admin',$cookie_admin,strtotime('+15 days'),'','',DC_ADMIN_SSL);
|
||||
}
|
||||
|
||||
|
||||
http::redirect('index.php');
|
||||
}
|
||||
else
|
||||
|
@ -279,28 +279,28 @@ xml:lang="<?php echo $dlang; ?>" lang="<?php echo $dlang; ?>">
|
|||
<link rel="icon" type="image/png" href="images/favicon96-logout.png" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
echo dcPage::jsLoadIE7();
|
||||
echo dcPage::jsCommon();
|
||||
?>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />
|
||||
|
||||
|
||||
<?php
|
||||
# --BEHAVIOR-- loginPageHTMLHead
|
||||
$core->callBehavior('loginPageHTMLHead');
|
||||
?>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(window).load(function() {
|
||||
var uid = $('input[name=user_id]');
|
||||
var upw = $('input[name=user_pwd]');
|
||||
uid.focus();
|
||||
|
||||
|
||||
if (upw.length == 0) { return; }
|
||||
|
||||
|
||||
uid.keypress(processKey);
|
||||
|
||||
function processKey(evt) {
|
||||
|
@ -346,14 +346,14 @@ elseif ($recover)
|
|||
'<div class="fieldset"><h2>'.__('Request a new password').'</h2>'.
|
||||
'<p><label for="user_id">'.__('Username:').'</label> '.
|
||||
form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="user_email">'.__('Email:').'</label> '.
|
||||
form::field(array('user_email','user_email'),20,255,html::escapeHTML($user_email)).'</p>'.
|
||||
|
||||
|
||||
'<p><input type="submit" value="'.__('recover').'" />'.
|
||||
form::hidden(array('recover'),1).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div id="issue">'.
|
||||
'<p><a href="auth.php">'.__('Back to login screen').'</a></p>'.
|
||||
'</div>';
|
||||
|
@ -364,11 +364,11 @@ elseif ($change_pwd)
|
|||
'<div class="fieldset"><h2>'.__('Change your password').'</h2>'.
|
||||
'<p><label for="new_pwd">'.__('New password:').'</label> '.
|
||||
form::password(array('new_pwd','new_pwd'),20,255).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="new_pwd_c">'.__('Confirm password:').'</label> '.
|
||||
form::password(array('new_pwd_c','new_pwd_c'),20,255).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<p><input type="submit" value="'.__('change').'" />'.
|
||||
form::hidden('login_data',$login_data).'</p>';
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ else
|
|||
if ($safe_mode) {
|
||||
echo '<div class="fieldset">';
|
||||
echo '<h2>'.__('Safe mode login').'</h2>';
|
||||
echo
|
||||
echo
|
||||
'<p class="form-note">'.
|
||||
__('This mode allows you to login without activating any of your plugins. This may be useful to solve compatibility problems').' </p>'.
|
||||
'<p class="form-note">'.__('Disable or delete any plugin suspected to cause trouble, then log out and log back in normally.').
|
||||
|
@ -396,22 +396,22 @@ else
|
|||
echo
|
||||
'<p><label for="user_id">'.__('Username:').'</label> '.
|
||||
form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="user_pwd">'.__('Password:').'</label> '.
|
||||
form::password(array('user_pwd','user_pwd'),20,255).'</p>'.
|
||||
|
||||
|
||||
'<p>'.
|
||||
form::checkbox(array('user_remember','user_remember'),1).
|
||||
'<label for="user_remember" class="classic">'.
|
||||
__('Remember my ID on this computer').'</label></p>'.
|
||||
|
||||
|
||||
'<p><input type="submit" value="'.__('log in').'" class="login" /></p>';
|
||||
|
||||
|
||||
if (!empty($_REQUEST['blog'])) {
|
||||
echo form::hidden('blog',html::escapeHTML($_REQUEST['blog']));
|
||||
}
|
||||
if($safe_mode) {
|
||||
echo
|
||||
echo
|
||||
form::hidden('safe_mode',1).
|
||||
'</div>';
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ else
|
|||
'<p id="cookie_help" class="error">'.__('You must accept cookies in order to use the private area.').'</p>';
|
||||
|
||||
echo '<div id="issue">';
|
||||
|
||||
|
||||
if ($safe_mode) {
|
||||
echo
|
||||
'<p><a href="auth.php" id="normal_mode_link">'.__('Get back to normal authentication').'</a></p>';
|
||||
|
@ -433,7 +433,7 @@ else
|
|||
}
|
||||
echo '<p><a href="auth.php?safe_mode=1" id="safe_mode_link">'.__('I want to log in in safe mode').'</a></p>';
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,27 +27,27 @@ if (!isset($_POST['id']) && !empty($_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)));
|
||||
|
@ -74,10 +74,10 @@ else
|
|||
__('New blog') => ''
|
||||
))
|
||||
);
|
||||
|
||||
|
||||
echo
|
||||
'<form action="blog.php" method="post" id="blog-form">'.
|
||||
|
||||
|
||||
'<div>'.$core->formNonce().'</div>'.
|
||||
'<p><label class="required" for="blog_id"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label> '.
|
||||
form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'.
|
||||
|
@ -87,21 +87,20 @@ else
|
|||
echo
|
||||
'<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p><label class="required" for="blog_name"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label> '.
|
||||
form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>'.
|
||||
|
||||
|
||||
'<p><label class="required" for="blog_url"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label> '.
|
||||
form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</p>'.
|
||||
|
||||
|
||||
'<p class="area"><label for="blog_desc">'.__('Blog description:').'</label> '.
|
||||
form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
|
||||
|
||||
|
||||
'<p><input type="submit" accesskey="s" value="'.__('Create').'" /></p>'.
|
||||
'</form>';
|
||||
|
||||
dcPage::helpBlock('core_blog_new');
|
||||
dcPage::close();
|
||||
}
|
||||
?>
|
|
@ -24,7 +24,7 @@ if (!empty($_POST['blog_id']))
|
|||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
$core->error->add(__('No such blog ID'));
|
||||
} else {
|
||||
|
@ -66,7 +66,7 @@ if (!$core->error->flag())
|
|||
'<p>'.sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'),
|
||||
'<strong>'.$blog_id.' ('.$blog_name.')</strong>').'</p></div>'.
|
||||
'<p>'.__('Please give your password to confirm the blog deletion.').'</p>';
|
||||
|
||||
|
||||
echo
|
||||
'<form action="blog_del.php" method="post">'.
|
||||
'<div>'.$core->formNonce().'</div>'.
|
||||
|
@ -78,4 +78,3 @@ if (!$core->error->flag())
|
|||
}
|
||||
|
||||
dcPage::close();
|
||||
?>
|
|
@ -24,7 +24,7 @@ if ($standalone)
|
|||
$blog_desc = $core->blog->desc;
|
||||
$blog_settings = $core->blog->settings;
|
||||
$blog_url = $core->blog->url;
|
||||
|
||||
|
||||
$action = 'blog_pref.php';
|
||||
$redir = 'blog_pref.php';
|
||||
}
|
||||
|
@ -37,23 +37,23 @@ else
|
|||
throw new Exception(__('No given blog id.'));
|
||||
}
|
||||
$rs = $core->getBlog($_REQUEST['id']);
|
||||
|
||||
|
||||
if (!$rs) {
|
||||
throw new Exception(__('No such blog.'));
|
||||
}
|
||||
|
||||
|
||||
$blog_id = $rs->blog_id;
|
||||
$blog_status = $rs->blog_status;
|
||||
$blog_name = $rs->blog_name;
|
||||
$blog_desc = $rs->blog_desc;
|
||||
$blog_settings = new dcSettings($core,$blog_id);
|
||||
$blog_url = $rs->blog_url ;
|
||||
$blog_url = $rs->blog_url ;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
$action = 'blog.php';
|
||||
$redir = 'blog.php?id=%s';
|
||||
}
|
||||
|
@ -149,54 +149,54 @@ if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id))
|
|||
$cur = $core->con->openCursor($core->prefix.'blog');
|
||||
if ($core->auth->isSuperAdmin()) {
|
||||
$cur->blog_id = $_POST['blog_id'];
|
||||
$cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']);
|
||||
$cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']);
|
||||
if (in_array($_POST['blog_status'],$status_combo)) {
|
||||
$cur->blog_status = (integer) $_POST['blog_status'];
|
||||
}
|
||||
}
|
||||
$cur->blog_name = $_POST['blog_name'];
|
||||
$cur->blog_desc = $_POST['blog_desc'];
|
||||
|
||||
|
||||
$media_img_t_size = abs((integer) $_POST['media_img_t_size']);
|
||||
if ($media_img_t_size < 0) { $media_img_t_size = 100; }
|
||||
|
||||
|
||||
$media_img_s_size = abs((integer) $_POST['media_img_s_size']);
|
||||
if ($media_img_s_size < 0) { $media_img_s_size = 240; }
|
||||
|
||||
|
||||
$media_img_m_size = abs((integer) $_POST['media_img_m_size']);
|
||||
if ($media_img_m_size < 0) { $media_img_m_size = 448; }
|
||||
|
||||
|
||||
$nb_post_per_page = abs((integer) $_POST['nb_post_per_page']);
|
||||
if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; }
|
||||
|
||||
|
||||
$nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']);
|
||||
if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; }
|
||||
|
||||
|
||||
$nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']);
|
||||
if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; }
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if ($cur->blog_id != null && $cur->blog_id != $blog_id) {
|
||||
$rs = $core->getBlog($cur->blog_id);
|
||||
|
||||
|
||||
if ($rs) {
|
||||
throw new Exception(__('This blog ID is already used.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# --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);
|
||||
|
@ -205,13 +205,13 @@ if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id))
|
|||
} 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']);
|
||||
|
@ -229,7 +229,7 @@ if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id))
|
|||
$blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments']));
|
||||
$blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc']));
|
||||
$blog_settings->system->put('note_title_tag',$_POST['note_title_tag']);
|
||||
|
||||
|
||||
$blog_settings->system->put('nb_post_per_page',$nb_post_per_page);
|
||||
$blog_settings->system->put('use_smilies',!empty($_POST['use_smilies']));
|
||||
$blog_settings->system->put('inc_subcats',!empty($_POST['inc_subcats']));
|
||||
|
@ -244,14 +244,14 @@ if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id))
|
|||
$blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed);
|
||||
$blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed);
|
||||
$blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items']));
|
||||
|
||||
|
||||
if (isset($_POST['robots_policy'])) {
|
||||
$blog_settings->system->put('robots_policy',$_POST['robots_policy']);
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeBlogSettingsUpdate
|
||||
$core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings);
|
||||
|
||||
|
||||
if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) {
|
||||
$blog_settings->system->put('url_scan',$_POST['url_scan']);
|
||||
}
|
||||
|
@ -292,11 +292,11 @@ dcPage::open(__('Blog settings'),
|
|||
"</script>".
|
||||
dcPage::jsConfirmClose('blog-form').
|
||||
dcPage::jsLoad('js/_blog_pref.js').
|
||||
|
||||
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBlogPreferencesHeaders
|
||||
$core->callBehavior('adminBlogPreferencesHeaders').
|
||||
|
||||
|
||||
dcPage::jsPageTabs(),
|
||||
$breadcrumb
|
||||
);
|
||||
|
@ -306,20 +306,20 @@ if ($blog_id)
|
|||
if (!empty($_GET['add'])) {
|
||||
dcPage::success(__('Blog has been successfully created.'));
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['upd'])) {
|
||||
dcPage::success(__('Blog has been successfully updated.'));
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<div class="multi-part" id="params" title="'.__('Parameters').'">'.
|
||||
'<h3 class="out-of-screen-if-js">'.__('Parameters').'</h3>'.
|
||||
'<form action="'.$action.'" method="post" id="blog-form">';
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4>'.__('Blog details').'</h4>'.
|
||||
$core->formNonce();
|
||||
|
||||
|
||||
if ($core->auth->isSuperAdmin())
|
||||
{
|
||||
echo
|
||||
|
@ -328,20 +328,20 @@ if ($blog_id)
|
|||
'<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '.
|
||||
'<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'.
|
||||
form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>';
|
||||
|
||||
|
||||
if ($core->auth->isSuperAdmin())
|
||||
{
|
||||
echo
|
||||
'<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'.
|
||||
form::field('blog_url',50,255,html::escapeHTML($blog_url)).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="url_scan">'.__('URL scan method:').'</label>'.
|
||||
form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>';
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
# Test URL of blog by testing it's ATOM feed
|
||||
|
@ -384,13 +384,13 @@ if ($blog_id)
|
|||
'<p><label for="blog_status">'.__('Blog status:').'</label>'.
|
||||
form::combo('blog_status',$status_combo,$blog_status).'</p>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'.
|
||||
form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
|
||||
'</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'.
|
||||
'<div class="two-cols">'.
|
||||
|
@ -398,11 +398,11 @@ if ($blog_id)
|
|||
'<p><label for="editor">'.__('Blog editor name:').'</label>'.
|
||||
form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)).
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="lang">'.__('Default language:').'</label>'.
|
||||
form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n').
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="blog_timezone">'.__('Blog timezone:').'</label>'.
|
||||
form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)).
|
||||
'</p>'.
|
||||
|
@ -411,7 +411,7 @@ if ($blog_id)
|
|||
form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)).
|
||||
'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="col">'.
|
||||
'<p><label for="post_url_format">'.__('New post URL format:').'</label>'.
|
||||
form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)).
|
||||
|
@ -420,13 +420,13 @@ if ($blog_id)
|
|||
'<p><label for="note_title_tag">'.__('HTML tag for the title of the notes on the blog:').'</label>'.
|
||||
form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag).
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="enable_xmlrpc" class="classic">'.'</label>'.
|
||||
form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc).
|
||||
__('Enable XML/RPC interface').'</p>';
|
||||
|
||||
echo
|
||||
'<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>';
|
||||
'<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>';
|
||||
|
||||
if ($blog_settings->system->enable_xmlrpc) {
|
||||
echo
|
||||
|
@ -447,7 +447,7 @@ if ($blog_id)
|
|||
'</div>'.
|
||||
'<br class="clear" />'. //Opera sucks
|
||||
'</div>';
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'.
|
||||
|
||||
|
@ -456,29 +456,29 @@ if ($blog_id)
|
|||
'<div class="col">'.
|
||||
'<p><label for="allow_comments" class="classic">'.
|
||||
form::checkbox('allow_comments','1',$blog_settings->system->allow_comments).
|
||||
__('Accept comments').'</label></p>'.
|
||||
__('Accept comments').'</label></p>'.
|
||||
'<p><label for="comments_pub" class="classic">'.
|
||||
form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub).
|
||||
__('Moderate comments').'</label></p>'.
|
||||
__('Moderate comments').'</label></p>'.
|
||||
'<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days').'.',
|
||||
form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.__('No limit: leave blank.').'</p>'.
|
||||
'<p class="form-note">'.__('No limit: leave blank.').'</p>'.
|
||||
'<p><label for="wiki_comments" class="classic">'.
|
||||
form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments).
|
||||
__('Wiki syntax for comments').'</label></p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="col">'.
|
||||
'<p><label for="allow_trackbacks" class="classic">'.
|
||||
form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks).
|
||||
__('Accept trackbacks').'</label></p>'.
|
||||
__('Accept trackbacks').'</label></p>'.
|
||||
'<p><label for="trackbacks_pub" class="classic">'.
|
||||
form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub).
|
||||
__('Moderate trackbacks').'</label></p>'.
|
||||
__('Moderate trackbacks').'</label></p>'.
|
||||
'<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days').'.',
|
||||
form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'.
|
||||
'<p class="form-note">'.__('No limit: leave blank.').'</p>'.
|
||||
'<p class="form-note">'.__('No limit: leave blank.').'</p>'.
|
||||
'<p><label for="comments_nofollow" class="classic">'.
|
||||
form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow).
|
||||
__('Add "nofollow" relation on comments and trackbacks links').'</label></p>'.
|
||||
|
@ -488,7 +488,7 @@ if ($blog_id)
|
|||
'</div>'.
|
||||
'<br class="clear" />'. //Opera sucks
|
||||
'</div>';
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'.
|
||||
'<div class="two-cols">'.
|
||||
|
@ -504,29 +504,29 @@ if ($blog_id)
|
|||
form::combo('time_format_select',$time_formats_combo,'','','',false,'title="'.__('Pattern of time').'"').
|
||||
'</p>'.
|
||||
'<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->time_format)).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="use_smilies" class="classic">'.
|
||||
form::checkbox('use_smilies','1',$blog_settings->system->use_smilies).
|
||||
__('Display smilies on entries and comments').'</label></p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="col">'.
|
||||
'<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'),
|
||||
form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)).
|
||||
'</label></p>'.
|
||||
|
||||
|
||||
'<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'),
|
||||
form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)).
|
||||
'</label></p>'.
|
||||
|
||||
|
||||
'<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'),
|
||||
form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)).
|
||||
'</label></p>'.
|
||||
|
||||
|
||||
'<p><label for="short_feed_items" class="classic">'.
|
||||
form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items).
|
||||
__('Truncate feeds').'</label></p>'.
|
||||
|
||||
|
||||
'<p><label for="inc_subcats" class="classic">'.
|
||||
form::checkbox('inc_subcats','1',$blog_settings->system->inc_subcats).
|
||||
__('Include sub-categories in category page and category posts feed').'</label></p>'.
|
||||
|
@ -534,7 +534,7 @@ if ($blog_id)
|
|||
'</div>'.
|
||||
'<br class="clear" />'. //Opera sucks
|
||||
'</div>';
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4 id="medias-settings">'.__('Media and images').'</h4>'.
|
||||
'<p class="form-note warning">'.
|
||||
|
@ -546,14 +546,14 @@ if ($blog_id)
|
|||
'<h5>'.__('Generated image sizes (in pixels)').'</h5>'.
|
||||
'<p class="field"><label for="media_img_t_size">Thumbnail</label> '.
|
||||
form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</p>'.
|
||||
|
||||
|
||||
'<p class="field"><label for="media_img_s_size">Small</label> '.
|
||||
form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</p>'.
|
||||
|
||||
|
||||
'<p class="field"><label for="media_img_m_size">Medium</label> '.
|
||||
form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="col">'.
|
||||
'<h5>'.__('Default image insertion attributes').'</h5>'.
|
||||
'<p class="vertical-separator"><label for="media_img_title_pattern">'.__('Inserted image title').'</label>'.
|
||||
|
@ -578,10 +578,10 @@ if ($blog_id)
|
|||
'<br class="clear" />'. //Opera sucks
|
||||
|
||||
'</div>';
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>';
|
||||
|
||||
|
||||
$i = 0;
|
||||
foreach ($robots_policy_options as $k => $v)
|
||||
{
|
||||
|
@ -589,19 +589,19 @@ if ($blog_id)
|
|||
form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBlogPreferencesForm
|
||||
$core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings);
|
||||
|
||||
|
||||
echo
|
||||
'<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
|
||||
(!$standalone ? form::hidden('id',$blog_id) : '').
|
||||
'</p>'.
|
||||
'</form>';
|
||||
|
||||
|
||||
if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id)
|
||||
{
|
||||
echo
|
||||
|
@ -617,19 +617,19 @@ if ($blog_id)
|
|||
echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
#
|
||||
# Users on the blog (with permissions)
|
||||
|
||||
|
||||
$blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin());
|
||||
$perm_types = $core->auth->getPermissionsTypes();
|
||||
|
||||
|
||||
echo
|
||||
'<div class="multi-part" id="users" title="'.__('Users').'">'.
|
||||
'<h3 class="out-of-screen-if-js">'.__('Users on this blog').'</h3>';
|
||||
|
||||
|
||||
if (empty($blog_users))
|
||||
{
|
||||
echo '<p>'.__('No users').'</p>';
|
||||
|
@ -663,7 +663,7 @@ if ($blog_id)
|
|||
)).')</h4>';
|
||||
|
||||
if ($core->auth->isSuperAdmin()) {
|
||||
echo
|
||||
echo
|
||||
'<p>'.__('Email:').' '.
|
||||
($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')).
|
||||
'</p>';
|
||||
|
@ -702,11 +702,11 @@ if ($blog_id)
|
|||
echo '</li>';
|
||||
}
|
||||
}
|
||||
echo
|
||||
echo
|
||||
'</ul>';
|
||||
|
||||
|
||||
if (!$v['super'] && $core->auth->isSuperAdmin()) {
|
||||
echo
|
||||
echo
|
||||
'<form action="users_actions.php" method="post">'.
|
||||
'<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'.
|
||||
form::hidden(array('redir'),'blog_pref.php?id='.$k).
|
||||
|
@ -724,10 +724,9 @@ if ($blog_id)
|
|||
$core->setBlog($current_blog_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
dcPage::helpBlock('core_blog_pref');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -20,7 +20,7 @@ $core->themes->loadModules($core->blog->themes_path, null);
|
|||
|
||||
# -- Page helper --
|
||||
$list = new adminThemesList(
|
||||
$core->themes,
|
||||
$core->themes,
|
||||
$core->blog->themes_path,
|
||||
$core->blog->settings->system->store_theme_url
|
||||
);
|
||||
|
@ -112,7 +112,7 @@ if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
|
|||
# Updated modules from repo
|
||||
$modules = $list->store->get(true);
|
||||
if (!empty($modules)) {
|
||||
echo
|
||||
echo
|
||||
'<div class="multi-part" id="update" title="'.html::escapeHTML(__('Update themes')).'">'.
|
||||
'<h3>'.html::escapeHTML(__('Update themes')).'</h3>'.
|
||||
'<p>'.sprintf(
|
||||
|
@ -158,7 +158,7 @@ if (!empty($modules)) {
|
|||
/* actions */ array('select', 'behavior', 'deactivate', 'delete')
|
||||
);
|
||||
|
||||
echo
|
||||
echo
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ if (!empty($modules)) {
|
|||
/* actions */ array('activate', 'delete')
|
||||
);
|
||||
|
||||
echo
|
||||
echo
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
|
|||
}
|
||||
$nb_per_page = (integer) $_GET['nb'];
|
||||
}
|
||||
|
||||
|
||||
# - Search filter
|
||||
if ($q) {
|
||||
$params['q'] = $q;
|
||||
|
@ -53,7 +53,7 @@ if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
|
|||
if ($order !== '' && in_array($order,$order_combo)) {
|
||||
$params['order'] = $sortby.' '.$order;
|
||||
}
|
||||
|
||||
|
||||
if ($sortby != 'blog_upddt' || $order != 'desc') {
|
||||
$show_filters = true;
|
||||
}
|
||||
|
@ -100,25 +100,25 @@ if (!$core->error->flag())
|
|||
if ($core->auth->isSuperAdmin()) {
|
||||
echo '<p class="top-add"><a class="button add" href="blog.php">'.__('Create a new blog').'</a></p>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<form action="blogs.php" method="get" id="filters-form">'.
|
||||
'<h3 class="hidden">'.__('Filter blogs list').'</h3>'.
|
||||
|
||||
|
||||
'<div class="table">'.
|
||||
'<div class="cell">'.
|
||||
'<h4>'.__('Filters').'</h4>'.
|
||||
'<p><label for="q" class="ib">'.__('Search:').'</label> '.
|
||||
form::field('q',20,255,html::escapeHTML($q)).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="cell filters-options">'.
|
||||
'<h4>'.__('Display options').'</h4>'.
|
||||
'<p><label for="sortby" class="ib">'.__('Order by:').'</label> '.
|
||||
form::combo('sortby',$sortby_combo,html::escapeHTML($sortby)).'</p>'.
|
||||
'<p><label for="order" class="ib">'.__('Sort:').'</label> '.
|
||||
form::combo('order',$order_combo,html::escapeHTML($order)).'</p>'.
|
||||
'<p><span class="label ib">'.__('Show').'</span> <label for="nb" class="classic">'.
|
||||
'<p><span class="label ib">'.__('Show').'</span> <label for="nb" class="classic">'.
|
||||
form::field('nb',3,3,$nb_per_page).' '.__('blogs per page').'</label></p>'.
|
||||
'</div>'.
|
||||
'</div>'.
|
||||
|
@ -126,7 +126,7 @@ if (!$core->error->flag())
|
|||
'<p><input type="submit" value="'.__('Apply filters and display options').'" />'.
|
||||
'<br class="clear" /></p>'. //Opera sucks
|
||||
'</form>';
|
||||
|
||||
|
||||
# Show blogs
|
||||
if ($nb_blog == 0)
|
||||
{
|
||||
|
@ -139,20 +139,20 @@ if (!$core->error->flag())
|
|||
else
|
||||
{
|
||||
$pager = new dcPager($page,$nb_blog,$nb_per_page,10);
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
|
||||
|
||||
echo
|
||||
'<div class="table-outer">'.
|
||||
'<table class="clear">';
|
||||
|
||||
|
||||
if( $show_filters ) {
|
||||
echo '<caption>'.sprintf(__('%d blog matches the filter.','%d blogs match the filter.', $nb_blog)).'</caption>';
|
||||
} else {
|
||||
echo '<caption class="hidden">'.__('Blogs list').'</caption>';
|
||||
}
|
||||
|
||||
echo
|
||||
|
||||
echo
|
||||
'<tr>'.
|
||||
'<th scope="col" class="nowrap">'.__('Blog id').'</th>'.
|
||||
'<th scope="col">'.__('Blog name').'</th>'.
|
||||
|
@ -160,13 +160,13 @@ if (!$core->error->flag())
|
|||
'<th scope="col" class="nowrap">'.__('Last update').'</th>'.
|
||||
'<th scope="col" class="nowrap">'.__('Status').'</th>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
while ($rs->fetch()) {
|
||||
echo blogLine($rs);
|
||||
}
|
||||
|
||||
|
||||
echo '</table></div>';
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
@ -176,24 +176,24 @@ dcPage::close();
|
|||
function blogLine($rs)
|
||||
{
|
||||
global $core;
|
||||
|
||||
|
||||
$blog_id = html::escapeHTML($rs->blog_id);
|
||||
$edit_link = '';
|
||||
|
||||
|
||||
if ($GLOBALS['core']->auth->isSuperAdmin()) {
|
||||
$edit_link =
|
||||
$edit_link =
|
||||
'<a href="blog.php?id='.$blog_id.'" title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'.
|
||||
'<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> ';
|
||||
} else {
|
||||
$edit_link = $blog_id;
|
||||
}
|
||||
|
||||
|
||||
$img_status = $rs->blog_status == 1 ? 'check-on' : 'check-off';
|
||||
$txt_status = $GLOBALS['core']->getBlogStatus($rs->blog_status);
|
||||
$img_status = sprintf('<img src="images/%1$s.png" alt="%2$s" title="%2$s" />',$img_status,$txt_status);
|
||||
$offset = dt::getTimeOffset($core->auth->getInfo('user_tz'));
|
||||
$blog_upddt = dt::str(__('%Y-%m-%d %H:%M'),strtotime($rs->blog_upddt) + $offset);
|
||||
|
||||
|
||||
return
|
||||
'<tr class="line">'.
|
||||
'<td class="nowrap">'.$edit_link.'</td>'.
|
||||
|
@ -205,4 +205,3 @@ function blogLine($rs)
|
|||
'<td class="status">'.$img_status.'</td>'.
|
||||
'</tr>';
|
||||
}
|
||||
?>
|
|
@ -222,4 +222,3 @@ echo '</div>';
|
|||
|
||||
dcPage::helpBlock('core_categories');
|
||||
dcPage::close();
|
||||
?>
|
||||
|
|
|
@ -28,7 +28,7 @@ if (!empty($_REQUEST['id']))
|
|||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
if (!$core->error->flag() && !$rs->isEmpty())
|
||||
{
|
||||
$cat_id = (integer) $rs->cat_id;
|
||||
|
@ -37,22 +37,22 @@ if (!empty($_REQUEST['id']))
|
|||
$cat_desc = $rs->cat_desc;
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
|
||||
# Getting hierarchy information
|
||||
$parents = $core->blog->getCategoryParents($cat_id);
|
||||
$rs = $core->blog->getCategoryParent($cat_id);
|
||||
$cat_parent = $rs->isEmpty() ? 0 : (integer) $rs->cat_id;
|
||||
unset($rs);
|
||||
|
||||
|
||||
# Allowed parents list
|
||||
$children = $core->blog->getCategories(array('post_type'=>'post','start'=>$cat_id));
|
||||
$allowed_parents = array(__('Top level')=>0);
|
||||
|
||||
|
||||
$p = array();
|
||||
while ($children->fetch()) {
|
||||
$p[$children->cat_id] = 1;
|
||||
}
|
||||
|
||||
|
||||
$rs = $core->blog->getCategories(array('post_type'=>'post'));
|
||||
while ($rs->fetch()) {
|
||||
if (!isset($p[$rs->cat_id])) {
|
||||
|
@ -63,7 +63,7 @@ if (!empty($_REQUEST['id']))
|
|||
}
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
|
||||
# Allowed siblings list
|
||||
$siblings = array();
|
||||
$rs = $core->blog->getCategoryFirstChildren($cat_parent);
|
||||
|
@ -107,19 +107,19 @@ if ($cat_id && isset($_POST['cat_sibling']))
|
|||
if (isset($_POST['cat_title']))
|
||||
{
|
||||
$cur = $core->con->openCursor($core->prefix.'category');
|
||||
|
||||
|
||||
$cur->cat_title = $cat_title = $_POST['cat_title'];
|
||||
|
||||
|
||||
if (isset($_POST['cat_desc'])) {
|
||||
$cur->cat_desc = $cat_desc = $_POST['cat_desc'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['cat_url'])) {
|
||||
$cur->cat_url = $cat_url = $_POST['cat_url'];
|
||||
} else {
|
||||
$cur->cat_url = $cat_url;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
# Update category
|
||||
|
@ -127,12 +127,12 @@ if (isset($_POST['cat_title']))
|
|||
{
|
||||
# --BEHAVIOR-- adminBeforeCategoryUpdate
|
||||
$core->callBehavior('adminBeforeCategoryUpdate',$cur,$cat_id);
|
||||
|
||||
|
||||
$core->blog->updCategory($_POST['id'],$cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCategoryUpdate
|
||||
$core->callBehavior('adminAfterCategoryUpdate',$cur,$cat_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('The category has been successfully updated.'));
|
||||
|
||||
http::redirect('category.php?id='.$_POST['id']);
|
||||
|
@ -142,12 +142,12 @@ if (isset($_POST['cat_title']))
|
|||
{
|
||||
# --BEHAVIOR-- adminBeforeCategoryCreate
|
||||
$core->callBehavior('adminBeforeCategoryCreate',$cur);
|
||||
|
||||
|
||||
$id = $core->blog->addCategory($cur,(integer) $_POST['new_cat_parent']);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCategoryCreate
|
||||
$core->callBehavior('adminAfterCategoryCreate',$cur,$id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(sprintf(__('The category "%s" has been successfully created.'),
|
||||
html::escapeHTML($cur->cat_title)));
|
||||
http::redirect('categories.php');
|
||||
|
@ -199,7 +199,7 @@ if (!$cat_id)
|
|||
'<option value="0">'.__('(none)').'</option>';
|
||||
while ($rs->fetch()) {
|
||||
echo '<option value="'.$rs->cat_id.'" '.(!empty($_POST['new_cat_parent']) && $_POST['new_cat_parent'] == $rs->cat_id ? 'selected="selected"' : '').'>'.
|
||||
str_repeat(' ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title).'</option>';
|
||||
str_repeat(' ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title).'</option>';
|
||||
}
|
||||
echo
|
||||
'</select></label></p>';
|
||||
|
@ -230,7 +230,7 @@ if ($cat_id)
|
|||
'<h3 class="border-top">'.__('Move this category').'</h3>'.
|
||||
'<div class="two-cols">'.
|
||||
'<div class="col">'.
|
||||
|
||||
|
||||
'<form action="category.php" method="post" class="fieldset">'.
|
||||
'<h4>'.__('Category parent').'</h4>'.
|
||||
'<p><label for="cat_parent" class="classic">'.__('Parent:').'</label> '.
|
||||
|
@ -239,7 +239,7 @@ if ($cat_id)
|
|||
form::hidden(array('id'),$cat_id).$core->formNonce().'</p>'.
|
||||
'</form>'.
|
||||
'</div>';
|
||||
|
||||
|
||||
if (count($siblings) > 0) {
|
||||
echo
|
||||
'<div class="col">'.
|
||||
|
@ -253,10 +253,9 @@ if ($cat_id)
|
|||
'</form>'.
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
dcPage::helpBlock('core_category');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -35,27 +35,27 @@ if (!empty($_POST['add']) && !empty($_POST['post_id']))
|
|||
try
|
||||
{
|
||||
$rs = $core->blog->getPosts(array('post_id' => $_POST['post_id'], 'post_type' => ''));
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception(__('Entry does not exist.'));
|
||||
}
|
||||
|
||||
|
||||
$cur = $core->con->openCursor($core->prefix.'comment');
|
||||
|
||||
|
||||
$cur->comment_author = $_POST['comment_author'];
|
||||
$cur->comment_email = html::clean($_POST['comment_email']);
|
||||
$cur->comment_site = html::clean($_POST['comment_site']);
|
||||
$cur->comment_content = $core->HTMLfilter($_POST['comment_content']);
|
||||
$cur->post_id = (integer) $_POST['post_id'];
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeCommentCreate
|
||||
$core->callBehavior('adminBeforeCommentCreate',$cur);
|
||||
|
||||
|
||||
$comment_id = $core->blog->addComment($cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCommentCreate
|
||||
$core->callBehavior('adminAfterCommentCreate',$cur,$comment_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Comment has been successfully created.'));
|
||||
http::redirect($core->getPostAdminURL($rs->post_type,$rs->post_id,false).'&co=1');
|
||||
} catch (Exception $e) {
|
||||
|
@ -66,7 +66,7 @@ if (!empty($_POST['add']) && !empty($_POST['post_id']))
|
|||
if (!empty($_REQUEST['id']))
|
||||
{
|
||||
$params['comment_id'] = $_REQUEST['id'];
|
||||
|
||||
|
||||
try {
|
||||
$rs = $core->blog->getComments($params);
|
||||
if (!$rs->isEmpty()) {
|
||||
|
@ -96,7 +96,7 @@ if (!$comment_id && !$core->error->flag()) {
|
|||
if (!$core->error->flag() && isset($rs))
|
||||
{
|
||||
$can_edit = $can_delete = $can_publish = $core->auth->check('contentadmin',$core->blog->id);
|
||||
|
||||
|
||||
if (!$core->auth->check('contentadmin',$core->blog->id) && $core->auth->userID() == $rs->user_id) {
|
||||
$can_edit = true;
|
||||
if ($core->auth->check('delete',$core->blog->id)) {
|
||||
|
@ -106,31 +106,31 @@ if (!$core->error->flag() && isset($rs))
|
|||
$can_publish = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# update comment
|
||||
if (!empty($_POST['update']) && $can_edit)
|
||||
{
|
||||
$cur = $core->con->openCursor($core->prefix.'comment');
|
||||
|
||||
|
||||
$cur->comment_author = $_POST['comment_author'];
|
||||
$cur->comment_email = html::clean($_POST['comment_email']);
|
||||
$cur->comment_site = html::clean($_POST['comment_site']);
|
||||
$cur->comment_content = $core->HTMLfilter($_POST['comment_content']);
|
||||
|
||||
|
||||
if (isset($_POST['comment_status'])) {
|
||||
$cur->comment_status = (integer) $_POST['comment_status'];
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
# --BEHAVIOR-- adminBeforeCommentUpdate
|
||||
$core->callBehavior('adminBeforeCommentUpdate',$cur,$comment_id);
|
||||
|
||||
|
||||
$core->blog->updComment($comment_id,$cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCommentUpdate
|
||||
$core->callBehavior('adminAfterCommentUpdate',$cur,$comment_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Comment has been successfully updated.'));
|
||||
http::redirect('comment.php?id='.$comment_id);
|
||||
}
|
||||
|
@ -139,22 +139,22 @@ if (!$core->error->flag() && isset($rs))
|
|||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['delete']) && $can_delete)
|
||||
{
|
||||
try {
|
||||
# --BEHAVIOR-- adminBeforeCommentDelete
|
||||
$core->callBehavior('adminBeforeCommentDelete',$comment_id);
|
||||
|
||||
|
||||
$core->blog->delComment($comment_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Comment has been successfully deleted.'));
|
||||
http::redirect($core->getPostAdminURL($rs->post_type,$rs->post_id).'&co=1',false);
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$can_edit) {
|
||||
$core->error->add(__("You can't edit this comment."));
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ if ($comment_id)
|
|||
if (!empty($_GET['upd'])) {
|
||||
dcPage::success(__('Comment has been successfully updated.'));
|
||||
}
|
||||
|
||||
|
||||
$comment_mailto = '';
|
||||
if ($comment_email)
|
||||
{
|
||||
|
@ -209,40 +209,40 @@ if ($comment_id)
|
|||
'<h3>'.__('Information collected').'</h3>'.
|
||||
'<p>'.__('IP address:').' '.
|
||||
'<a href="comments.php?ip='.$comment_ip.'">'.$comment_ip.'</a></p>'.
|
||||
|
||||
|
||||
'<p>'.__('Date:').' '.
|
||||
dt::dt2str(__('%Y-%m-%d %H:%M'),$comment_dt).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
'<h3>'.__('Comment submitted').'</h3>'.
|
||||
'<h3>'.__('Comment submitted').'</h3>'.
|
||||
'<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr>'.__('Author:').'</label>'.
|
||||
form::field('comment_author',30,255,html::escapeHTML($comment_author)).
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="comment_email">'.__('Email:').'</label>'.
|
||||
form::field('comment_email',30,255,html::escapeHTML($comment_email)).
|
||||
'<span>'.$comment_mailto.'</span>'.
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="comment_site">'.__('Web site:').'</label>'.
|
||||
form::field('comment_site',30,255,html::escapeHTML($comment_site)).
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p><label for="comment_status">'.__('Status:').'</label>'.
|
||||
form::combo('comment_status',$status_combo,$comment_status,'','',!$can_publish).
|
||||
'</p>'.
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCommentDesc
|
||||
$core->callBehavior('adminAfterCommentDesc', $rs).
|
||||
|
||||
|
||||
'<p class="area"><label for="comment_content">'.__('Comment:').'</label> '.
|
||||
form::textarea('comment_content',50,10,html::escapeHTML($comment_content)).
|
||||
'</p>'.
|
||||
|
||||
|
||||
'<p>'.form::hidden('id',$comment_id).
|
||||
$core->formNonce().
|
||||
'<input type="submit" accesskey="s" name="update" value="'.__('Save').'" /> ';
|
||||
|
||||
|
||||
if ($can_delete) {
|
||||
echo '<input type="submit" class="delete" name="delete" value="'.__('Delete').'" />';
|
||||
}
|
||||
|
@ -253,4 +253,3 @@ if ($comment_id)
|
|||
|
||||
dcPage::helpBlock('core_comments');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -118,7 +118,7 @@ if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
|
|||
} else {
|
||||
$order = 'desc';
|
||||
}
|
||||
|
||||
|
||||
if ($sortby != 'comment_dt' || $order != 'desc') {
|
||||
$show_filters = true;
|
||||
}
|
||||
|
@ -185,11 +185,11 @@ if (!$core->error->flag())
|
|||
dcPage::message(__('Spam comments have been successfully deleted.'));
|
||||
unset($_SESSION['comments_del_spam']);
|
||||
}
|
||||
|
||||
|
||||
$spam_count = $core->blog->getComments(array('comment_status'=>-2),true)->f(0);
|
||||
if ($spam_count > 0) {
|
||||
|
||||
echo
|
||||
|
||||
echo
|
||||
'<form action="comments.php" method="post" class="fieldset">';
|
||||
|
||||
if (!$with_spam || ($status != -2)) {
|
||||
|
@ -201,7 +201,7 @@ if (!$core->error->flag())
|
|||
'<a href="comments.php?status=-2">'.__('Show them.').'</a>.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p class="no-margin">'.
|
||||
$core->formNonce().
|
||||
|
@ -212,7 +212,7 @@ if (!$core->error->flag())
|
|||
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<form action="comments.php" method="get" id="filters-form">'.
|
||||
'<h3 class="hidden">'.__('Filter comments and trackbacks list').'</h3>'.
|
||||
|
@ -225,14 +225,14 @@ if (!$core->error->flag())
|
|||
'<p><label for="status" class="ib">'.__('Status:').'</label> '.
|
||||
form::combo('status',$status_combo,$status).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="cell filters-sibling-cell">'.
|
||||
'<p><label for="author" class="ib">'.__('Author:').'</label> '.
|
||||
form::field('author',20,255,html::escapeHTML($author)).'</p>'.
|
||||
'<p><label for="ip" class="ib">'.__('IP address:').'</label> '.
|
||||
form::field('ip',20,39,html::escapeHTML($ip)).'</p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="cell filters-options">'.
|
||||
'<h4>'.__('Display options').'</h4>'.
|
||||
'<p><label for="sortby" class="ib">'.__('Order by:').'</label> '.
|
||||
|
@ -243,21 +243,21 @@ if (!$core->error->flag())
|
|||
form::field('nb',3,3,$nb_per_page).' '.
|
||||
__('comments per page').'</label></p>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'</div>'.
|
||||
'<p><input type="submit" value="'.__('Apply filters and display options').'" />'.
|
||||
'<br class="clear" /></p>'. //Opera sucks
|
||||
'</form>';
|
||||
|
||||
|
||||
# Show comments
|
||||
$comment_list->display($page,$nb_per_page,
|
||||
'<form action="comments.php" method="post" id="form-comments">'.
|
||||
|
||||
|
||||
'%s'.
|
||||
|
||||
|
||||
'<div class="two-cols">'.
|
||||
'<p class="col checkboxes-helpers"></p>'.
|
||||
|
||||
|
||||
'<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '.
|
||||
form::combo('action',$comments_actions_page->getCombo(),$default,'','','','title="'.__('Actions').'"').
|
||||
$core->formNonce().
|
||||
|
@ -271,7 +271,7 @@ if (!$core->error->flag())
|
|||
form::hidden(array('page'),$page).
|
||||
form::hidden(array('nb'),$nb_per_page).
|
||||
'</div>'.
|
||||
|
||||
|
||||
'</form>',
|
||||
$show_filters
|
||||
);
|
||||
|
@ -279,4 +279,3 @@ if (!$core->error->flag())
|
|||
|
||||
dcPage::helpBlock('core_comments');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -33,5 +33,3 @@ $comments_actions_page = new dcCommentsActionsPage($core,$uri,$args);
|
|||
$comments_actions_page->setEnableRedirSelection(false);
|
||||
|
||||
$comments_actions_page->process();
|
||||
|
||||
?>
|
|
@ -22,12 +22,12 @@ function helpPage()
|
|||
if (empty($args)) {
|
||||
return $ret;
|
||||
};
|
||||
|
||||
|
||||
global $__resources;
|
||||
if (empty($__resources['help'])) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
$content = '';
|
||||
$title = '';
|
||||
foreach ($args as $v)
|
||||
|
@ -36,7 +36,7 @@ function helpPage()
|
|||
$content .= $v->content;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($__resources['help'][$v])) {
|
||||
continue;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ function helpPage()
|
|||
if (!file_exists($f) || !is_readable($f)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$fc = file_get_contents($f);
|
||||
if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) {
|
||||
$content .= $matches[1];
|
||||
|
@ -55,11 +55,11 @@ function helpPage()
|
|||
$content .= $fc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (trim($content) == '') {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
$ret['content'] = $content;
|
||||
if ($title != '') {
|
||||
$ret['title'] = $title;
|
||||
|
@ -98,4 +98,3 @@ echo $content_array['content'];
|
|||
$GLOBALS['__resources']['ctxhelp'] = true;
|
||||
|
||||
dcPage::close();
|
||||
?>
|
|
@ -107,7 +107,7 @@ if ($core->auth->user_prefs->dashboard->dcnews) {
|
|||
if (empty($__resources['rss_news'])) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
|
||||
$feed_reader = new feedReader;
|
||||
$feed_reader->setCacheDir(DC_TPL_CACHE);
|
||||
$feed_reader->setTimeout(2);
|
||||
|
@ -121,7 +121,7 @@ if ($core->auth->user_prefs->dashboard->dcnews) {
|
|||
{
|
||||
$dt = isset($item->link) ? '<a href="'.$item->link.'" class="outgoing" title="'.$item->title.'">'.
|
||||
$item->title.' <img src="images/outgoing-blue.png" alt="" /></a>' : $item->title;
|
||||
|
||||
|
||||
if ($i < 3) {
|
||||
$latest_news .=
|
||||
'<dt>'.$dt.'</dt>'.
|
||||
|
@ -148,12 +148,12 @@ if ($core->auth->user_prefs->dashboard->doclinks) {
|
|||
if (!empty($__resources['doc']))
|
||||
{
|
||||
$doc_links = '<div class="box small dc-box"><h3>'.__('Documentation and support').'</h3><ul>';
|
||||
|
||||
|
||||
foreach ($__resources['doc'] as $k => $v) {
|
||||
$doc_links .= '<li><a class="outgoing" href="'.$v.'" title="'.$k.'">'.$k.
|
||||
' <img src="images/outgoing-blue.png" alt="" /></a></li>';
|
||||
}
|
||||
|
||||
|
||||
$doc_links .= '</ul></div>';
|
||||
$__dashboard_items[$dashboardItem][] = $doc_links;
|
||||
$dashboardItem++;
|
||||
|
@ -279,7 +279,7 @@ if ($core->auth->isSuperAdmin())
|
|||
{
|
||||
$list = $core->plugins->getErrors();
|
||||
if (!empty($list)) {
|
||||
echo
|
||||
echo
|
||||
'<div class="error" id="module-errors" class="error"><p>'.__('Errors have occured with following plugins:').'</p> '.
|
||||
'<ul><li>'.implode("</li>\n<li>", $list).'</li></ul></div>';
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ if ($core->auth->isSuperAdmin())
|
|||
$dashboardItems = '';
|
||||
|
||||
foreach ($__dashboard_items as $i)
|
||||
{
|
||||
{
|
||||
if ($i->count() > 0)
|
||||
{
|
||||
$dashboardItems .= '';
|
||||
|
@ -320,7 +320,7 @@ if ($core->auth->user_prefs->dashboard->quickentry) {
|
|||
$categories_combo = dcAdminCombos::getCategoriesCombo(
|
||||
$core->blog->getCategories(array('post_type'=>'post'))
|
||||
);
|
||||
|
||||
|
||||
echo
|
||||
'<div id="quick">'.
|
||||
'<h3>'.__('Quick entry').'</h3>'.
|
||||
|
@ -363,7 +363,7 @@ if ($core->auth->user_prefs->dashboard->quickentry) {
|
|||
}
|
||||
|
||||
foreach ($__dashboard_contents as $i)
|
||||
{
|
||||
{
|
||||
if ($i->count() > 0)
|
||||
{
|
||||
$dashboardContents .= '';
|
||||
|
@ -375,13 +375,12 @@ foreach ($__dashboard_contents as $i)
|
|||
}
|
||||
|
||||
if ($dashboardContents != '' || $dashboardItems != '') {
|
||||
echo
|
||||
echo
|
||||
'<div id="dashboard-boxes">'.
|
||||
'<div class="db-items">'.$dashboardItems.$dashboardContents.'</div>'.
|
||||
'</div>';
|
||||
'</div>';
|
||||
}
|
||||
|
||||
echo '</div>'; #end dashboard-main
|
||||
dcPage::helpBlock('core_dashboard');
|
||||
dcPage::close();
|
||||
?>
|
||||
|
|
|
@ -14,40 +14,40 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
function dcSystemCheck($con,&$err)
|
||||
{
|
||||
$err = array();
|
||||
|
||||
|
||||
if (version_compare(phpversion(),'5.0','<')) {
|
||||
$err[] = sprintf(__('PHP version is %s (5.0 or earlier needed).'),phpversion());
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('mb_detect_encoding')) {
|
||||
$err[] = __('Multibyte string module (mbstring) is not available.');
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('iconv')) {
|
||||
$err[] = __('Iconv module is not available.');
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('ob_start')) {
|
||||
$err[] = __('Output control functions are not available.');
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('simplexml_load_string')) {
|
||||
$err[] = __('SimpleXML module is not available.');
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('dom_import_simplexml')) {
|
||||
$err[] = __('DOM XML module is not available.');
|
||||
}
|
||||
|
||||
|
||||
$pcre_str = base64_decode('w6nDqMOgw6o=');
|
||||
if (!@preg_match('/'.$pcre_str.'/u', $pcre_str)) {
|
||||
$err[] = __('PCRE engine does not support UTF-8 strings.');
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists("spl_classes")) {
|
||||
$err[] = __('SPL module is not available.');
|
||||
}
|
||||
|
||||
|
||||
if ($con->driver() == 'mysql' || $con->driver() == 'mysqli')
|
||||
{
|
||||
if (version_compare($con->version(),'4.1','<'))
|
||||
|
@ -64,7 +64,7 @@ function dcSystemCheck($con,&$err)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$innodb) {
|
||||
$err[] = __('MySQL InnoDB engine is not available.');
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ function dcSystemCheck($con,&$err)
|
|||
$err[] = sprintf(__('PostgreSQL version is %s (8.0 or earlier needed).'),$con->version());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return count($err) == 0;
|
||||
}
|
||||
?>
|
|
@ -71,46 +71,46 @@ if (!empty($_POST))
|
|||
} catch (Exception $e) {
|
||||
throw new Exception('<p>' . __($e->getMessage()) . '</p>');
|
||||
}
|
||||
|
||||
|
||||
# Checks system capabilites
|
||||
require dirname(__FILE__).'/check.php';
|
||||
if (!dcSystemCheck($con,$_e)) {
|
||||
$can_install = false;
|
||||
throw new Exception('<p>'.__('Dotclear cannot be installed.').'</p><ul><li>'.implode('</li><li>',$_e).'</li></ul>');
|
||||
}
|
||||
|
||||
|
||||
# Check if dotclear is already installed
|
||||
$schema = dbSchema::init($con);
|
||||
if (in_array($DBPREFIX.'version',$schema->getTables())) {
|
||||
throw new Exception(__('Dotclear is already installed.'));
|
||||
}
|
||||
|
||||
|
||||
# Does config.php.in exist?
|
||||
$config_in = dirname(__FILE__).'/../../inc/config.php.in';
|
||||
if (!is_file($config_in)) {
|
||||
throw new Exception(sprintf(__('File %s does not exist.'),$config_in));
|
||||
}
|
||||
|
||||
|
||||
# Can we write config.php
|
||||
if (!is_writable(dirname(DC_RC_PATH))) {
|
||||
throw new Exception(sprintf(__('Cannot write %s file.'),DC_RC_PATH));
|
||||
}
|
||||
|
||||
|
||||
# Creates config.php file
|
||||
$full_conf = file_get_contents($config_in);
|
||||
|
||||
|
||||
writeConfigValue('DC_DBDRIVER',$DBDRIVER,$full_conf);
|
||||
writeConfigValue('DC_DBHOST',$DBHOST,$full_conf);
|
||||
writeConfigValue('DC_DBUSER',$DBUSER,$full_conf);
|
||||
writeConfigValue('DC_DBPASSWORD',$DBPASSWORD,$full_conf);
|
||||
writeConfigValue('DC_DBNAME',$DBNAME,$full_conf);
|
||||
writeConfigValue('DC_DBPREFIX',$DBPREFIX,$full_conf);
|
||||
|
||||
|
||||
$admin_url = preg_replace('%install/wizard.php$%','',$_SERVER['REQUEST_URI']);
|
||||
writeConfigValue('DC_ADMIN_URL',http::getHost().$admin_url,$full_conf);
|
||||
writeConfigValue('DC_ADMIN_MAILFROM','dotclear@'.$_SERVER['HTTP_HOST'],$full_conf);
|
||||
writeConfigValue('DC_MASTER_KEY',md5(uniqid()),$full_conf);
|
||||
|
||||
|
||||
$fp = @fopen(DC_RC_PATH,'wb');
|
||||
if ($fp === false) {
|
||||
throw new Exception(sprintf(__('Cannot write %s file.'),DC_RC_PATH));
|
||||
|
@ -118,7 +118,7 @@ if (!empty($_POST))
|
|||
fwrite($fp,$full_conf);
|
||||
fclose($fp);
|
||||
chmod(DC_RC_PATH, 0666);
|
||||
|
||||
|
||||
$con->close();
|
||||
http::redirect('index.php?wiz=1');
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ xml:lang="en" lang="en">
|
|||
<meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />
|
||||
<meta name="GOOGLEBOT" content="NOSNIPPET" />
|
||||
<title><?php echo __('Dotclear installation wizard'); ?></title>
|
||||
<link rel="stylesheet" href="../style/install.css" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="../style/install.css" type="text/css" media="screen" />
|
||||
</head>
|
||||
|
||||
<body id="dotclear-admin" class="install">
|
||||
|
@ -196,4 +196,4 @@ form::field('DBPREFIX',30,255,html::escapeHTML($DBPREFIX)).'</p>'.
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -75,4 +75,4 @@ $(function() {
|
|||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$(function() {
|
||||
dotclear.hideLockable();
|
||||
|
||||
|
||||
var tbCategory = new jsToolBar(document.getElementById('cat_desc'));
|
||||
tbCategory.draw('xhtml');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
$(function() {
|
||||
if (!document.getElementById) { return; }
|
||||
|
||||
|
||||
var tbComment = new jsToolBar(document.getElementById('comment_content'));
|
||||
tbComment.draw('xhtml');
|
||||
|
||||
|
||||
$('#comment-form input[name="delete"]').click(function() {
|
||||
return window.confirm(dotclear.msg.confirm_delete_comment);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
dotclear.viewCommentContent = function(line,action) {
|
||||
var action = action || 'toggle';
|
||||
var commentId = $(line).attr('id').substr(1);
|
||||
var commentId = $(line).attr('id').substr(1);
|
||||
var tr = document.getElementById('ce'+commentId);
|
||||
|
||||
if ( !tr && ( action == 'toggle' || action == 'open' ) ) {
|
||||
|
@ -10,21 +10,21 @@ dotclear.viewCommentContent = function(line,action) {
|
|||
td.colSpan = 6;
|
||||
td.className = 'expand';
|
||||
tr.appendChild(td);
|
||||
|
||||
|
||||
// Get comment content
|
||||
$.get('services.php',{f:'getCommentById',id: commentId},function(data) {
|
||||
var rsp = $(data).children('rsp')[0];
|
||||
|
||||
|
||||
if (rsp.attributes[0].value == 'ok') {
|
||||
var comment = $(rsp).find('comment_display_content').text();
|
||||
|
||||
|
||||
if (comment) {
|
||||
$(td).append(comment);
|
||||
var comment_email = $(rsp).find('comment_email').text();
|
||||
var comment_site = $(rsp).find('comment_site').text();
|
||||
var comment_ip = $(rsp).find('comment_ip').text();
|
||||
var comment_spam_disp = $(rsp).find('comment_spam_disp').text();
|
||||
|
||||
|
||||
$(td).append('<p><strong>' + dotclear.msg.website +
|
||||
'</strong> ' + comment_site + '<br />' +
|
||||
'<strong>' + dotclear.msg.email + '</strong> ' + comment_email + '<br />' +
|
||||
|
@ -36,7 +36,7 @@ dotclear.viewCommentContent = function(line,action) {
|
|||
alert($(rsp).find('message').text());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(line).toggleClass('expand');
|
||||
line.parentNode.insertBefore(tr,line.nextSibling);
|
||||
}
|
||||
|
|
|
@ -3,4 +3,4 @@ $(function() {
|
|||
var l_name = $(this).parents('tr.line').find('td:first').text();
|
||||
return window.confirm(dotclear.msg.confirm_delete_lang.replace('%s',l_name));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,4 +64,4 @@ $(function() {
|
|||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ dotclear.viewPostContent = function(line,action) {
|
|||
var action = action || 'toggle';
|
||||
var postId = $(line).attr('id').substr(1);
|
||||
var tr = document.getElementById('pe'+postId);
|
||||
|
||||
|
||||
if ( !tr && ( action == 'toggle' || action == 'open' ) ) {
|
||||
tr = document.createElement('tr');
|
||||
tr.id = 'pe'+postId;
|
||||
|
@ -10,16 +10,16 @@ dotclear.viewPostContent = function(line,action) {
|
|||
td.colSpan = 8;
|
||||
td.className = 'expand';
|
||||
tr.appendChild(td);
|
||||
|
||||
|
||||
// Get post content
|
||||
$.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) {
|
||||
var rsp = $(data).children('rsp')[0];
|
||||
|
||||
|
||||
if (rsp.attributes[0].value == 'ok') {
|
||||
var post = $(rsp).find('post_display_content').text();
|
||||
var post_excerpt = $(rsp).find('post_display_excerpt').text();
|
||||
var res = '';
|
||||
|
||||
|
||||
if (post) {
|
||||
if (post_excerpt) {
|
||||
res += post_excerpt + '<hr />';
|
||||
|
@ -31,7 +31,7 @@ dotclear.viewPostContent = function(line,action) {
|
|||
alert($(rsp).find('message').text());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(line).addClass('expand');
|
||||
line.parentNode.insertBefore(tr,line.nextSibling);
|
||||
}
|
||||
|
|
|
@ -11,4 +11,4 @@ $(function() {
|
|||
return true;
|
||||
});
|
||||
$("#my-favs ul li input.position").hide();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,9 +2,9 @@ $(function() {
|
|||
if ($('#new_pwd').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var user_email = $('#user_email').val();
|
||||
|
||||
|
||||
$('#user-form').submit(function() {
|
||||
var e = this.elements['cur_pwd'];
|
||||
if (e.value != '') {
|
||||
|
@ -19,4 +19,4 @@ $(function() {
|
|||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,4 +4,4 @@ $(function() {
|
|||
this.value = this.value.substring(0,255);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,14 +8,14 @@ $(function() {
|
|||
var nb_posts = new Array();
|
||||
var i;
|
||||
var msg_cannot_delete = false;
|
||||
|
||||
|
||||
$(this).find('input[name="users[]"]').each(function() {
|
||||
user_ids.push(this);
|
||||
});
|
||||
$(this).find('input[name="nb_post[]"]').each(function() {
|
||||
nb_posts.push(this.value);
|
||||
});
|
||||
|
||||
|
||||
if (action == 'deleteuser') {
|
||||
for (i=0; i<user_ids.length; i++) {
|
||||
if (nb_posts[i] > 0) {
|
||||
|
@ -29,20 +29,20 @@ $(function() {
|
|||
alert(dotclear.msg.cannot_delete_users);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var selectfields = 0;
|
||||
for (i=0; i<user_ids.length; i++) {
|
||||
selectfields += user_ids[i].checked;
|
||||
}
|
||||
|
||||
|
||||
if (selectfields == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (action == 'deleteuser') {
|
||||
return window.confirm(dotclear.msg.confirm_delete_user.replace('%s',$('input[name="users[]"]:checked').size()));
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
jQuery.fn.updatePermissionsForm = function() {
|
||||
return this.each(function() {
|
||||
|
||||
|
||||
var perms = {};
|
||||
var re = /^perm\[(.+?)\]\[(.+?)\]$/;
|
||||
var e,prop;
|
||||
|
||||
|
||||
// Building a nice object of form elements
|
||||
for (var i=0; i<this.elements.length; i++) {
|
||||
e = this.elements[i];
|
||||
|
||||
|
||||
if (e.name == undefined) {
|
||||
continue;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ jQuery.fn.updatePermissionsForm = function() {
|
|||
perms[prop[1]] = {};
|
||||
}
|
||||
perms[prop[1]][prop[2]] = e;
|
||||
|
||||
|
||||
// select related permissions for admin
|
||||
if (prop[2] == 'admin') {
|
||||
if (e.checked) {
|
||||
|
@ -48,10 +48,10 @@ jQuery.fn.updatePermissionsForm = function() {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function admin(E,perms,re) {
|
||||
P = E.name.match(re);
|
||||
|
||||
|
||||
perms[P[1]]['usage'].checked = E.checked;
|
||||
perms[P[1]]['publish'].checked = E.checked;
|
||||
perms[P[1]]['delete'].checked = E.checked;
|
||||
|
@ -67,10 +67,10 @@ jQuery.fn.updatePermissionsForm = function() {
|
|||
perms[P[1]]['media'].disabled = E.checked;
|
||||
perms[P[1]]['media_admin'].disabled = E.checked;
|
||||
}
|
||||
|
||||
|
||||
function contentadmin(E,perms,re) {
|
||||
P = E.name.match(re);
|
||||
|
||||
|
||||
perms[P[1]]['usage'].checked = E.checked;
|
||||
perms[P[1]]['publish'].checked = E.checked;
|
||||
perms[P[1]]['delete'].checked = E.checked;
|
||||
|
@ -78,15 +78,15 @@ jQuery.fn.updatePermissionsForm = function() {
|
|||
perms[P[1]]['publish'].disabled = E.checked;
|
||||
perms[P[1]]['delete'].disabled = E.checked;
|
||||
}
|
||||
|
||||
|
||||
function mediaadmin(E,perms,re) {
|
||||
P = E.name.match(re);
|
||||
|
||||
|
||||
perms[P[1]]['media'].checked = E.checked;
|
||||
perms[P[1]]['media'].disabled = E.checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -95,4 +95,4 @@ $(function() {
|
|||
dotclear.checkboxesHelpers(this);
|
||||
});
|
||||
$('#permissions-form').updatePermissionsForm();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,25 +6,25 @@ jQuery.fn.colorPicker = function() {
|
|||
$(this).each(function() {
|
||||
var colbox, f;
|
||||
var colbox = $('#jquery-colorpicker')[0];
|
||||
|
||||
|
||||
if (colbox == undefined) {
|
||||
colbox = document.createElement('div');
|
||||
colbox.id = 'jquery-colorpicker';
|
||||
colbox.linkedto = null;
|
||||
|
||||
|
||||
$(colbox).addClass('color-color-picker');
|
||||
$(colbox).css({display: 'none', position: 'absolute'});
|
||||
$('body').append(colbox);
|
||||
}
|
||||
f = $.farbtastic(colbox);
|
||||
f.linkTo(this);
|
||||
|
||||
|
||||
var handler = $(document.createElement('img'));
|
||||
handler.attr('src','images/picker.png');
|
||||
handler.attr('alt','');
|
||||
|
||||
|
||||
var span = $(document.createElement('span'));
|
||||
|
||||
|
||||
if ($(this).css('position') == 'absolute') {
|
||||
span.css('position','absolute');
|
||||
span.css('top',$(this).css('top'));
|
||||
|
@ -34,14 +34,14 @@ jQuery.fn.colorPicker = function() {
|
|||
span.css('position','relative');
|
||||
}
|
||||
span.css('display','inline-block');
|
||||
|
||||
|
||||
/*ligne supprimée car elle ne fait pas le calcul
|
||||
du width de l'input et ça fout la merde */
|
||||
//span.css('width',($(this).width()+12)+'px');
|
||||
span.css('padding','0 5px 0 0');
|
||||
$(this).wrap(span);
|
||||
$(this).after(handler);
|
||||
|
||||
|
||||
var offset = $(this).offset();
|
||||
handler.css({
|
||||
position: 'absolute',
|
||||
|
@ -50,9 +50,9 @@ jQuery.fn.colorPicker = function() {
|
|||
right: 0 crée un affichage pourri. On vire. */
|
||||
//right: 0
|
||||
});
|
||||
|
||||
|
||||
handler.css({cursor: 'default'});
|
||||
|
||||
|
||||
var This = this;
|
||||
handler.click(function() {
|
||||
if ($(colbox).css('display') == 'none' || this != colbox.linkedto) {
|
||||
|
@ -67,7 +67,7 @@ jQuery.fn.colorPicker = function() {
|
|||
if (document.all) { $('select').hide(); }
|
||||
$(colbox).show();
|
||||
colbox.linkedto = this;
|
||||
|
||||
|
||||
} else {
|
||||
$(colbox).hide();
|
||||
if (document.all) { $('select').show(); }
|
||||
|
@ -80,4 +80,4 @@ jQuery.fn.colorPicker = function() {
|
|||
});
|
||||
});
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -78,7 +78,7 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
if (p.cookie && jQuery.cookie(p.cookie)) {
|
||||
p.hide = p.reverse_cookie;
|
||||
}
|
||||
|
||||
|
||||
var set_user_pref = p.hide ^ p.reverse_user_pref;
|
||||
if (p.user_pref && p.unfolded_sections !== undefined && (p.user_pref in p.unfolded_sections)) {
|
||||
p.hide = p.reverse_user_pref;
|
||||
|
@ -130,11 +130,11 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
$(ctarget).click(function() {
|
||||
if (p.user_pref && set_user_pref) {
|
||||
if (p.hide ^ p.reverse_user_pref) {
|
||||
jQuery.post('services.php',
|
||||
jQuery.post('services.php',
|
||||
{'f':'setSectionFold','section':p.user_pref,'value':1,xd_check: dotclear.nonce},
|
||||
function(data) {});
|
||||
} else {
|
||||
jQuery.post('services.php',
|
||||
jQuery.post('services.php',
|
||||
{'f':'setSectionFold','section':p.user_pref,'value':0,xd_check: dotclear.nonce},
|
||||
function(data) {});
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
singleExpander(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var singleExpander = function singleExpander(line) {
|
||||
$('<input type="image" src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/>')
|
||||
.click(function(e) {
|
||||
|
@ -177,7 +177,7 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
})
|
||||
.prependTo($(line).children().get(0)); // first td
|
||||
};
|
||||
|
||||
|
||||
var multipleExpander = function multipleExpander(line,lines) {
|
||||
$('<input type="image" src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/>')
|
||||
.click(function(e) {
|
||||
|
@ -202,7 +202,7 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
action = 'close';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (action=='open') {
|
||||
button.src = dotclear.img_minus_src;
|
||||
button.alt = dotclear.img_minus_alt;
|
||||
|
@ -210,7 +210,7 @@ jQuery.fn.toggleWithLegend = function(target,s) {
|
|||
button.src = dotclear.img_plus_src;
|
||||
button.alt = dotclear.img_plus_alt;
|
||||
}
|
||||
|
||||
|
||||
return action;
|
||||
}
|
||||
})(jQuery);
|
||||
|
@ -285,7 +285,7 @@ jQuery.fn.helpViewer = function() {
|
|||
img.click(function() { return toggle(); });
|
||||
|
||||
$('#content').append(img);
|
||||
|
||||
|
||||
// listen for scroll
|
||||
var peInPage = $('#help-button').offset().top;
|
||||
$('#help-button').addClass("floatable");
|
||||
|
@ -427,7 +427,7 @@ var dotclear = {
|
|||
if ( color.charAt(0) === '#') {
|
||||
return color;
|
||||
}
|
||||
var result = /^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(color);
|
||||
var result = /^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(color);
|
||||
if ( result === null) {
|
||||
return '';
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ $(function() {
|
|||
dotclear.initFadeColor();
|
||||
// remove class no-js from html tag; cf style/default.css for examples
|
||||
$('body').removeClass('no-js').addClass('with-js');
|
||||
|
||||
|
||||
$('body').contents().each(function() {
|
||||
if (this.nodeType==8) {
|
||||
var data = this.data;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function confirmClose() {
|
||||
|
||||
|
||||
if (arguments.length > 0) {
|
||||
for (var i=0; i<arguments.length; i++) {
|
||||
this.forms_id.push(arguments[i]);
|
||||
|
@ -12,7 +12,7 @@ confirmClose.prototype = {
|
|||
forms_id: new Array(),
|
||||
forms: new Array(),
|
||||
formSubmit: false,
|
||||
|
||||
|
||||
getCurrentForms: function() {
|
||||
var formsInPage = this.getForms();
|
||||
var f;
|
||||
|
@ -24,18 +24,18 @@ confirmClose.prototype = {
|
|||
tmpForm.push(this.getFormElementValue(f[j]));
|
||||
}
|
||||
this.forms.push(tmpForm);
|
||||
|
||||
|
||||
chainHandler(f,'onsubmit',function() {
|
||||
This.formSubmit = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
compareForms: function() {
|
||||
if (this.forms.length == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
var formsInPage = this.getForms();
|
||||
var f;
|
||||
for (var i=0; i<formsInPage.length; i++) {
|
||||
|
@ -46,15 +46,15 @@ confirmClose.prototype = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
getForms: function() {
|
||||
if (!document.getElementsByTagName || !document.getElementById) {
|
||||
return new Array();
|
||||
}
|
||||
|
||||
|
||||
if (this.forms_id.length > 0) {
|
||||
var res = new Array();
|
||||
var f;
|
||||
|
@ -68,10 +68,10 @@ confirmClose.prototype = {
|
|||
} else {
|
||||
return document.getElementsByTagName('form');
|
||||
}
|
||||
|
||||
|
||||
return new Array();
|
||||
},
|
||||
|
||||
|
||||
getFormElementValue: function(e) {
|
||||
if (e.type != undefined && e.type == 'radio') {
|
||||
return this.getFormRadioValue(e);
|
||||
|
@ -83,14 +83,14 @@ confirmClose.prototype = {
|
|||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getFormCheckValue: function(e) {
|
||||
if (e.checked) {
|
||||
return e.value;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
|
||||
getFormRadioValue: function(e) {
|
||||
for (var i=0; i <e.length; i++) {
|
||||
if (e[i].checked) {
|
||||
|
@ -113,10 +113,10 @@ chainHandler(window,'onbeforeunload',function(event_) {
|
|||
if (event_ == undefined && window.event) {
|
||||
event_ = window.event;
|
||||
}
|
||||
|
||||
|
||||
if (!confirmClosePage.formSubmit && !confirmClosePage.compareForms()) {
|
||||
event_.returnValue = confirmClosePage.prompt;
|
||||
return confirmClosePage.prompt;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function datePicker(target)
|
||||
{
|
||||
if (!document.getElementById) { return; }
|
||||
|
||||
|
||||
if (!target || target.nodeName.toLowerCase() != 'input') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.target = target;
|
||||
this.oTable = document.createElement('table');
|
||||
this.oBody = document.createElement('tbody');
|
||||
|
@ -16,18 +16,18 @@ function datePicker(target)
|
|||
this.oMinute = document.createElement('input');
|
||||
this.oTable.id = 'dc_datepicker_'+target.id;
|
||||
this.oTable.className = 'date-picker';
|
||||
|
||||
|
||||
var cur = 1;
|
||||
var oRow, oHeading, oSpan;
|
||||
|
||||
|
||||
// Set title
|
||||
oRow = document.createElement('tr');
|
||||
|
||||
|
||||
// Month block
|
||||
oHeading = document.createElement('th');
|
||||
oHeading.colSpan = 4;
|
||||
oHeading.className = 'date-picker-month';
|
||||
|
||||
|
||||
var nav = document.createElement('span');
|
||||
nav.appendChild(document.createTextNode(String.fromCharCode(171)));
|
||||
nav.fn = this.changeMonth;
|
||||
|
@ -35,9 +35,9 @@ function datePicker(target)
|
|||
nav.onclick = function() { this.fn.call(this.obj,-1); };
|
||||
nav.className = 'date-picker-control';
|
||||
oHeading.appendChild(nav);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
|
||||
|
||||
nav = document.createElement('span');
|
||||
nav.appendChild(document.createTextNode(String.fromCharCode(187)));
|
||||
nav.fn = this.changeMonth;
|
||||
|
@ -45,22 +45,22 @@ function datePicker(target)
|
|||
nav.onclick = function() { this.fn.call(this.obj,+1); };
|
||||
nav.className = 'date-picker-control';
|
||||
oHeading.appendChild(nav);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
|
||||
|
||||
oHeading.appendChild(this.oMonth);
|
||||
|
||||
|
||||
oRow.appendChild(oHeading);
|
||||
|
||||
|
||||
// Year block
|
||||
oHeading = document.createElement('th');
|
||||
oHeading.colSpan = 3;
|
||||
oHeading.className = 'date-picker-year';
|
||||
|
||||
|
||||
oHeading.appendChild(this.oYear);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
|
||||
|
||||
nav = document.createElement('span');
|
||||
nav.appendChild(document.createTextNode(String.fromCharCode(171)));
|
||||
nav.fn = this.changeYear;
|
||||
|
@ -68,9 +68,9 @@ function datePicker(target)
|
|||
nav.onclick = function() { this.fn.call(this.obj,-1); };
|
||||
nav.className = 'date-picker-control';
|
||||
oHeading.appendChild(nav);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
|
||||
|
||||
nav = document.createElement('span');
|
||||
nav.appendChild(document.createTextNode(String.fromCharCode(187)));
|
||||
nav.fn = this.changeYear;
|
||||
|
@ -78,11 +78,11 @@ function datePicker(target)
|
|||
nav.onclick = function() { this.fn.call(this.obj,+1); };
|
||||
nav.className = 'date-picker-control';
|
||||
oHeading.appendChild(nav);
|
||||
|
||||
|
||||
oRow.appendChild(oHeading);
|
||||
|
||||
|
||||
this.oBody.appendChild(oRow);
|
||||
|
||||
|
||||
// Create legend
|
||||
oRow = document.createElement('tr');
|
||||
var cday;
|
||||
|
@ -94,11 +94,11 @@ function datePicker(target)
|
|||
oRow.appendChild(oHeading);
|
||||
}
|
||||
this.oBody.appendChild(oRow);
|
||||
|
||||
|
||||
// Create 6 rows of 7 cols for days
|
||||
for (var i=0; i<6; i++) {
|
||||
oRow = document.createElement('tr');
|
||||
|
||||
|
||||
for (var j=0; j<7; j++) {
|
||||
this.oDates[cur] = document.createElement('td');
|
||||
this.oDates[cur].appendChild(document.createTextNode(
|
||||
|
@ -106,13 +106,13 @@ function datePicker(target)
|
|||
oRow.appendChild(this.oDates[cur]);
|
||||
cur++;
|
||||
}
|
||||
|
||||
|
||||
this.oBody.appendChild(oRow);
|
||||
}
|
||||
|
||||
|
||||
// Time controls
|
||||
oRow = document.createElement('tr');
|
||||
|
||||
|
||||
oHeading = document.createElement('th');
|
||||
oHeading.className = 'date-picker-control';
|
||||
oHeading.appendChild(document.createTextNode('!'));
|
||||
|
@ -120,12 +120,12 @@ function datePicker(target)
|
|||
oHeading.fn = this.sendNow;
|
||||
oHeading.obj = this;
|
||||
oHeading.onclick = function() { this.fn.call(this.obj); };
|
||||
|
||||
|
||||
oRow.appendChild(oHeading);
|
||||
|
||||
|
||||
oHeading = document.createElement('th');
|
||||
oHeading.colSpan = 5;
|
||||
|
||||
|
||||
oSpan = document.createElement('span');
|
||||
oSpan.className = 'date-picker-control';
|
||||
oSpan.appendChild(document.createTextNode('-'));
|
||||
|
@ -142,15 +142,15 @@ function datePicker(target)
|
|||
oSpan.onclick = function() { this.fn.call(this.obj,+1); };
|
||||
oHeading.appendChild(oSpan);
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
|
||||
|
||||
this.oHour.size = 3;
|
||||
oHeading.appendChild(this.oHour);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(' : '));
|
||||
|
||||
|
||||
this.oMinute.size = 3;
|
||||
oHeading.appendChild(this.oMinute);
|
||||
|
||||
|
||||
oHeading.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
oSpan = document.createElement('span');
|
||||
oSpan.className = 'date-picker-control';
|
||||
|
@ -166,11 +166,11 @@ function datePicker(target)
|
|||
oSpan.fn = this.changeMinute;
|
||||
oSpan.obj = this;
|
||||
oSpan.onclick = function() { this.fn.call(this.obj,+1); };
|
||||
|
||||
|
||||
oHeading.appendChild(oSpan);
|
||||
|
||||
|
||||
oRow.appendChild(oHeading);
|
||||
|
||||
|
||||
// Close control
|
||||
oHeading = document.createElement('th');
|
||||
oHeading.className = 'date-picker-control';
|
||||
|
@ -179,9 +179,9 @@ function datePicker(target)
|
|||
oHeading.fn = this.close;
|
||||
oHeading.obj = this;
|
||||
oHeading.onclick = function() { this.fn.call(this.obj); };
|
||||
|
||||
|
||||
oRow.appendChild(oHeading);
|
||||
|
||||
|
||||
this.oBody.appendChild(oRow);
|
||||
};
|
||||
|
||||
|
@ -191,38 +191,38 @@ datePicker.prototype = {
|
|||
day: 0,
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
|
||||
|
||||
img_src: '',
|
||||
img_top: '0.2em',
|
||||
now_msg: 'now',
|
||||
close_msg: 'close',
|
||||
|
||||
|
||||
days: new Array('Monday','Tuesday','Wednesday','Thursday','Friday',
|
||||
'Saturday','Sunday'),
|
||||
|
||||
|
||||
months: new Array('January','February','March','April','May','June',
|
||||
'July','August','September','October','November','December'),
|
||||
|
||||
|
||||
|
||||
|
||||
setDate: function() {
|
||||
if (this.numberOfDays() < this.day) {
|
||||
this.day = this.numberOfDays();
|
||||
}
|
||||
|
||||
|
||||
while (this.oYear.hasChildNodes()) {
|
||||
this.oYear.removeChild(this.oYear.firstChild)
|
||||
}
|
||||
this.oYear.appendChild(document.createTextNode(this.year));
|
||||
|
||||
|
||||
while (this.oMonth.hasChildNodes()) {
|
||||
this.oMonth.removeChild(this.oMonth.firstChild)
|
||||
}
|
||||
this.oMonth.appendChild(document.createTextNode(
|
||||
this.months[this.month-1]));
|
||||
|
||||
|
||||
var firstDay = this.firstDay();
|
||||
var nbDays = this.numberOfDays();
|
||||
|
||||
|
||||
// Empty days
|
||||
for (var i=1; i<=42; i++) {
|
||||
while (this.oDates[i].hasChildNodes()) {
|
||||
|
@ -232,15 +232,15 @@ datePicker.prototype = {
|
|||
this.oDates[i].className = '';
|
||||
this.oDates[i].onclick = function() { return; };
|
||||
}
|
||||
|
||||
|
||||
// Insert days from the first day to the last
|
||||
for (i=1; i<=nbDays; i++) {
|
||||
var j=firstDay+i-1;
|
||||
|
||||
|
||||
while (this.oDates[j].hasChildNodes()) {
|
||||
this.oDates[j].removeChild(this.oDates[j].firstChild)
|
||||
}
|
||||
|
||||
|
||||
this.oDates[j].appendChild(document.createTextNode(i));
|
||||
this.oDates[j].index = i;
|
||||
this.oDates[j].fn = this.sendDate;
|
||||
|
@ -252,72 +252,72 @@ datePicker.prototype = {
|
|||
this.oDates[j].className = 'date-picker-day';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set time
|
||||
this.setHour(this.hour);
|
||||
this.setMinute(this.minute);
|
||||
},
|
||||
|
||||
|
||||
setHour: function(h) {
|
||||
if (h < 0) { h = 23; }
|
||||
if (h > 23) { h = 0; }
|
||||
if (h < 10) { h = '0'+h; }
|
||||
|
||||
|
||||
this.hour = h*1;
|
||||
this.oHour.value = h;
|
||||
},
|
||||
|
||||
|
||||
setMinute: function(m) {
|
||||
if (m < 0) { m = 59; }
|
||||
if (m > 59) { m = 0; }
|
||||
if (m < 10) { m = '0'+m; }
|
||||
|
||||
|
||||
this.minute = m*1;
|
||||
this.oMinute.value = m;
|
||||
},
|
||||
|
||||
|
||||
changeMonth: function(dir) {
|
||||
var y = this.year;
|
||||
var m = this.month;
|
||||
m = m+dir;
|
||||
|
||||
|
||||
if (m > 12) { this.month = 1; this.year++; }
|
||||
else if ( m < 1) { this.month = 12; this.year--; }
|
||||
else { this.month = m; }
|
||||
|
||||
|
||||
this.setDate();
|
||||
},
|
||||
|
||||
|
||||
changeYear: function(dir) {
|
||||
this.year = this.year + dir;
|
||||
this.setDate();
|
||||
},
|
||||
|
||||
|
||||
changeHour: function(dir) {
|
||||
this.setHour(this.hour*1+dir);
|
||||
},
|
||||
|
||||
|
||||
changeMinute: function(dir) {
|
||||
this.setMinute(this.minute*1+dir);
|
||||
},
|
||||
|
||||
|
||||
sendDate: function(d) {
|
||||
var m = this.month;
|
||||
var hour = this.oHour.value*1;
|
||||
var minute = this.oMinute.value*1;
|
||||
|
||||
|
||||
if (hour < 0 || hour > 23 || isNaN(hour)) { hour = 0; }
|
||||
if (minute < 0 || minute > 59 || isNaN(minute)) { minute = 0; }
|
||||
|
||||
|
||||
if (m < 10) { m = '0'+m; }
|
||||
if (d < 10) { d = '0'+d; }
|
||||
if (hour < 10) { hour = '0'+hour; }
|
||||
if (minute < 10) { minute = '0'+minute; }
|
||||
|
||||
|
||||
this.target.value = this.year+'-'+m+'-'+d+' '+hour+':'+minute;
|
||||
this.close();
|
||||
},
|
||||
|
||||
|
||||
sendNow: function() {
|
||||
var dt = new Date();
|
||||
var y = dt.getFullYear();
|
||||
|
@ -325,20 +325,20 @@ datePicker.prototype = {
|
|||
var d = dt.getDate();
|
||||
var h = dt.getHours();
|
||||
var i = dt.getMinutes();
|
||||
|
||||
|
||||
if (m < 10) { m = '0'+m; }
|
||||
if (d < 10) { d = '0'+d; }
|
||||
if (h < 10) { h = '0'+h; }
|
||||
if (i < 10) { i = '0'+i; }
|
||||
|
||||
|
||||
this.target.value = y+'-'+m+'-'+d+' '+h+':'+i;
|
||||
this.close();
|
||||
},
|
||||
|
||||
|
||||
close: function() {
|
||||
document.body.removeChild(this.oTable);
|
||||
},
|
||||
|
||||
|
||||
numberOfDays: function() {
|
||||
var res = 31;
|
||||
if (this.month == 4 || this.month == 6 || this.month == 9 ||
|
||||
|
@ -351,21 +351,21 @@ datePicker.prototype = {
|
|||
res = 29;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
},
|
||||
|
||||
|
||||
firstDay: function() {
|
||||
var dt = new Date(this.year,this.month-1,1);
|
||||
var res = dt.getDay();
|
||||
|
||||
|
||||
if (res == 0) {
|
||||
res = 7;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
},
|
||||
|
||||
|
||||
show: function() {
|
||||
// Parsing target value
|
||||
var re = /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})/;
|
||||
|
@ -384,26 +384,26 @@ datePicker.prototype = {
|
|||
this.hour = dt.getHours();
|
||||
this.minute = dt.getMinutes();
|
||||
}
|
||||
|
||||
|
||||
this.oTable.appendChild(this.oBody);
|
||||
this.setDate();
|
||||
this.setPosition();
|
||||
document.body.appendChild(this.oTable);
|
||||
this.oHour.focus();
|
||||
},
|
||||
|
||||
|
||||
setPosition: function() {
|
||||
var t_x = this.findPosX(this.target);
|
||||
var t_y = this.findPosY(this.target);
|
||||
var o_h = this.oTable.offsetHeight;
|
||||
var o_w = this.oTable.offsetWidth;
|
||||
|
||||
|
||||
this.oTable.style.position = 'absolute';
|
||||
this.oTable.style.zIndex = '100';
|
||||
this.oTable.style.top = t_y+'px';
|
||||
this.oTable.style.left = t_x+'px';
|
||||
},
|
||||
|
||||
|
||||
findPosX: function(obj) {
|
||||
var curleft = 0;
|
||||
if(obj.offsetParent) {
|
||||
|
@ -419,7 +419,7 @@ datePicker.prototype = {
|
|||
}
|
||||
return curleft;
|
||||
},
|
||||
|
||||
|
||||
findPosY: function(obj) {
|
||||
var curtop = 0;
|
||||
if(obj.offsetParent) {
|
||||
|
@ -435,7 +435,7 @@ datePicker.prototype = {
|
|||
}
|
||||
return curtop;
|
||||
},
|
||||
|
||||
|
||||
draw: function() {
|
||||
var imgE = document.createElement('img');
|
||||
imgE.src = this.img_src;
|
||||
|
@ -445,7 +445,7 @@ datePicker.prototype = {
|
|||
imgE.obj = this;
|
||||
imgE.fn = this.show;
|
||||
imgE.onclick = function() { this.fn.apply(this.obj); };
|
||||
|
||||
|
||||
this.target.parentNode.style.position = 'relative';
|
||||
this.target.parentNode.insertBefore(imgE,this.target.nextSibling);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
ToolMan._dragsortFactory.makeTableSortable = function(table) {
|
||||
if (table == null) return;
|
||||
|
||||
|
||||
var helpers = ToolMan.helpers();
|
||||
var coordinates = ToolMan.coordinates();
|
||||
var items = table.getElementsByTagName("tr");
|
||||
|
||||
|
||||
helpers.map(items, function(item) {
|
||||
var dragGroup = dragsort.makeSortable(item);
|
||||
dragGroup.setThreshold(4);
|
||||
|
@ -27,4 +27,4 @@ ToolMan._dragsortFactory.makeTableSortable = function(table) {
|
|||
}
|
||||
};
|
||||
|
||||
ToolMan._dragsortFactory.registerOrder = function(dest) { };
|
||||
ToolMan._dragsortFactory.registerOrder = function(dest) { };
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$(function() {
|
||||
|
||||
|
||||
$filtersform = $('#filters-form');
|
||||
$filtersform.before('<p><a id="filter-control" class="form-control" href="?" style="display:inline">'+dotclear.msg.filter_posts_list+'</a></p>')
|
||||
|
||||
|
||||
if( dotclear.msg.show_filters == 'false' ) {
|
||||
$filtersform.hide();
|
||||
} else {
|
||||
|
@ -10,7 +10,7 @@ $(function() {
|
|||
.addClass('open')
|
||||
.text(dotclear.msg.cancel_the_filter);
|
||||
}
|
||||
|
||||
|
||||
$('#filter-control').click(function() {
|
||||
if( $(this).hasClass('open') ) {
|
||||
if( dotclear.msg.show_filters == 'true' ) {
|
||||
|
@ -27,4 +27,4 @@ $(function() {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,10 +7,10 @@ jsToolBar.prototype.elements.link.open_url = 'popup_link.php';
|
|||
jsToolBar.prototype.elements.link.popup = function (args) {
|
||||
window.the_toolbar = this;
|
||||
args = args || '';
|
||||
|
||||
|
||||
this.elements.link.data = {};
|
||||
var url = this.elements.link.open_url+args;
|
||||
|
||||
|
||||
var p_win = window.open(url,'dc_popup',
|
||||
'alwaysRaised=yes,dependent=yes,toolbar=yes,height=420,width=520,'+
|
||||
'menubar=no,resizable=yes,scrollbars=yes,status=no');
|
||||
|
@ -21,17 +21,17 @@ jsToolBar.prototype.elements.link.fn.wiki = function() {
|
|||
};
|
||||
jsToolBar.prototype.elements.link.fncall.wiki = function() {
|
||||
var data = this.elements.link.data;
|
||||
|
||||
|
||||
if (data.href == '') { return; }
|
||||
|
||||
|
||||
var etag = '|'+data.href;
|
||||
if (data.hreflang) { etag += '|'+data.hreflang; }
|
||||
|
||||
|
||||
if (data.title) {
|
||||
if (!data.hreflang) { etag += '|'; }
|
||||
etag += '|'+data.title;
|
||||
}
|
||||
|
||||
|
||||
if (data.content) {
|
||||
this.encloseSelection('['+data.content,etag+']');
|
||||
} else {
|
||||
|
@ -44,16 +44,16 @@ jsToolBar.prototype.elements.link.fn.xhtml = function() {
|
|||
};
|
||||
jsToolBar.prototype.elements.link.fncall.xhtml = function() {
|
||||
var data = this.elements.link.data;
|
||||
|
||||
|
||||
if (data.href == '') { return; }
|
||||
|
||||
|
||||
var stag = '<a href="'+data.href+'"';
|
||||
|
||||
|
||||
if (data.hreflang) { stag += ' hreflang="'+data.hreflang+'"'; }
|
||||
if (data.title) { stag += ' title="'+data.title+'"'; }
|
||||
stag += '>';
|
||||
var etag = '</a>';
|
||||
|
||||
|
||||
if (data.content) {
|
||||
this.encloseSelection('','',function() {
|
||||
return stag + data.content + etag;
|
||||
|
@ -67,22 +67,22 @@ jsToolBar.prototype.elements.link.fn.wysiwyg = function() {
|
|||
var href, title, hreflang;
|
||||
href = title = hreflang = '';
|
||||
hreflang = this.elements.link.default_hreflang;
|
||||
|
||||
|
||||
var a = this.getAncestor();
|
||||
|
||||
|
||||
if (a.tagName == 'a') {
|
||||
href= a.tag.href || '';
|
||||
title = a.tag.title || '';
|
||||
hreflang = a.tag.hreflang || '';
|
||||
}
|
||||
|
||||
|
||||
this.elements.link.popup.call(this,'?href='+href+'&hreflang='+hreflang+'&title='+title);
|
||||
};
|
||||
jsToolBar.prototype.elements.link.fncall.wysiwyg = function() {
|
||||
var data = this.elements.link.data;
|
||||
|
||||
|
||||
var a = this.getAncestor();
|
||||
|
||||
|
||||
if (a.tagName == 'a') {
|
||||
if (data.href == '') {
|
||||
// Remove link
|
||||
|
@ -105,7 +105,7 @@ jsToolBar.prototype.elements.link.fncall.wysiwyg = function() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create link
|
||||
if (data.content) {
|
||||
var n = document.createTextNode(data.content);
|
||||
|
@ -122,7 +122,7 @@ jsToolBar.prototype.elements.link.fncall.wysiwyg = function() {
|
|||
jsToolBar.prototype.getAncestor = function() {
|
||||
var res = {};
|
||||
var range, commonAncestorContainer;
|
||||
|
||||
|
||||
if (this.iwin.getSelection) { //gecko
|
||||
var selection = this.iwin.getSelection();
|
||||
range = selection.getRangeAt(0);
|
||||
|
@ -134,16 +134,16 @@ jsToolBar.prototype.getAncestor = function() {
|
|||
range = this.iwin.document.selection.createRange();
|
||||
commonAncestorContainer = range.parentElement();
|
||||
}
|
||||
|
||||
|
||||
var ancestorTagName = commonAncestorContainer.tagName.toLowerCase();
|
||||
while (ancestorTagName!='a' && ancestorTagName!='body') {
|
||||
commonAncestorContainer = commonAncestorContainer.parentNode;
|
||||
ancestorTagName = commonAncestorContainer.tagName.toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
res.tag = commonAncestorContainer;
|
||||
res.tagName = ancestorTagName;
|
||||
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
|
@ -159,7 +159,7 @@ jsToolBar.prototype.elements.img_select = {
|
|||
popup: function() {
|
||||
window.the_toolbar = this;
|
||||
this.elements.img_select.data = {};
|
||||
|
||||
|
||||
var p_win = window.open(this.elements.img_select.open_url,'dc_popup',
|
||||
'alwaysRaised=yes,dependent=yes,toolbar=yes,height=500,width=760,'+
|
||||
'menubar=no,resizable=yes,scrollbars=yes,status=no');
|
||||
|
@ -171,11 +171,11 @@ jsToolBar.prototype.elements.img_select.fn.wiki = function() {
|
|||
jsToolBar.prototype.elements.img_select.fncall.wiki = function() {
|
||||
var d = this.elements.img_select.data;
|
||||
if (d.src == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
var alt = (str) ? str : d.title;
|
||||
var res = '(('+d.src+'|'+alt;
|
||||
|
||||
|
||||
if (d.alignment == 'left') {
|
||||
res += '|L';
|
||||
} else if (d.alignment == 'right') {
|
||||
|
@ -185,18 +185,18 @@ jsToolBar.prototype.elements.img_select.fncall.wiki = function() {
|
|||
} else if (d.description) {
|
||||
res += '|';
|
||||
}
|
||||
|
||||
|
||||
if (d.description) {
|
||||
res += '|'+d.description;
|
||||
}
|
||||
|
||||
|
||||
res += '))';
|
||||
|
||||
|
||||
if (d.link) {
|
||||
var ltitle = (alt) ? '||'+alt : '';
|
||||
res = '['+res+'|'+d.url+ltitle+']';
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
@ -206,11 +206,11 @@ jsToolBar.prototype.elements.img_select.fn.xhtml = function() {
|
|||
jsToolBar.prototype.elements.img_select.fncall.xhtml = function() {
|
||||
var d = this.elements.img_select.data;
|
||||
if (d.src == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
var alt = (str) ? str : d.title;
|
||||
var res = '<img src="'+d.src+'" alt="'+alt.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"';
|
||||
|
||||
|
||||
if (d.alignment == 'left') {
|
||||
res += ' style="float: left; margin: 0 1em 1em 0;"';
|
||||
} else if (d.alignment == 'right') {
|
||||
|
@ -218,18 +218,18 @@ jsToolBar.prototype.elements.img_select.fncall.xhtml = function() {
|
|||
} else if (d.alignment == 'center') {
|
||||
res += ' style="margin: 0 auto; display: block;"';
|
||||
}
|
||||
|
||||
|
||||
if (d.description) {
|
||||
res += ' title="'+d.description.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"';
|
||||
}
|
||||
|
||||
|
||||
res += ' />';
|
||||
|
||||
|
||||
if (d.link) {
|
||||
var ltitle = (alt) ? ' title="'+alt.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"' : '';
|
||||
res = '<a href="'+d.url+'"'+ltitle+'>'+res+'</a>';
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
@ -237,11 +237,11 @@ jsToolBar.prototype.elements.img_select.fncall.xhtml = function() {
|
|||
jsToolBar.prototype.elements.img.fn.wysiwyg = function() {
|
||||
var src = this.elements.img.prompt.call(this);
|
||||
if (!src) { return; }
|
||||
|
||||
|
||||
var img = this.iwin.document.createElement('img');
|
||||
img.src = src;
|
||||
img.setAttribute('alt',this.getSelectedText());
|
||||
|
||||
|
||||
this.insertNode(img);
|
||||
};
|
||||
|
||||
|
@ -252,12 +252,12 @@ jsToolBar.prototype.elements.img_select.fncall.wysiwyg = function() {
|
|||
var d = this.elements.img_select.data;
|
||||
var alt = (this.getSelectedText()) ? this.getSelectedText() : d.title;
|
||||
if (d.src == undefined) { return; }
|
||||
|
||||
|
||||
var img = this.iwin.document.createElement('img');
|
||||
img.src = d.src;
|
||||
img.setAttribute('alt',alt);
|
||||
|
||||
|
||||
|
||||
|
||||
if (d.alignment == 'left') {
|
||||
if (img.style.styleFloat != undefined) {
|
||||
img.style.styleFloat = 'left';
|
||||
|
@ -285,11 +285,11 @@ jsToolBar.prototype.elements.img_select.fncall.wysiwyg = function() {
|
|||
img.style.marginLeft = 'auto';
|
||||
img.style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
if (d.description) {
|
||||
img.setAttribute('title',d.description);
|
||||
}
|
||||
|
||||
|
||||
if (d.link) {
|
||||
var a = this.iwin.document.createElement('a');
|
||||
a.href = d.url;
|
||||
|
@ -308,7 +308,7 @@ jsToolBar.prototype.elements.mp3_insert = { fncall: {}, data: {} };
|
|||
jsToolBar.prototype.elements.mp3_insert.fncall.wiki = function() {
|
||||
var d = this.elements.mp3_insert.data;
|
||||
if (d.player == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
return '\n///html\n' + d.player + '///\n';
|
||||
});
|
||||
|
@ -316,7 +316,7 @@ jsToolBar.prototype.elements.mp3_insert.fncall.wiki = function() {
|
|||
jsToolBar.prototype.elements.mp3_insert.fncall.xhtml = function() {
|
||||
var d = this.elements.mp3_insert.data;
|
||||
if (d.player == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
return '\n' + d.player + '\n';
|
||||
});
|
||||
|
@ -330,7 +330,7 @@ jsToolBar.prototype.elements.flv_insert = { fncall: {}, data: {} };
|
|||
jsToolBar.prototype.elements.flv_insert.fncall.wiki = function() {
|
||||
var d = this.elements.flv_insert.data;
|
||||
if (d.player == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
return '\n///html\n' + d.player + '///\n';
|
||||
});
|
||||
|
@ -338,7 +338,7 @@ jsToolBar.prototype.elements.flv_insert.fncall.wiki = function() {
|
|||
jsToolBar.prototype.elements.flv_insert.fncall.xhtml = function() {
|
||||
var d = this.elements.flv_insert.data;
|
||||
if (d.player == undefined) { return; }
|
||||
|
||||
|
||||
this.encloseSelection('','',function(str) {
|
||||
return '\n' + d.player + '\n';
|
||||
});
|
||||
|
@ -359,7 +359,7 @@ jsToolBar.prototype.elements.post_link = {
|
|||
popup: function() {
|
||||
window.the_toolbar = this;
|
||||
this.elements.img_select.data = {};
|
||||
|
||||
|
||||
var p_win = window.open(this.elements.post_link.open_url,'dc_popup',
|
||||
'alwaysRaised=yes,dependent=yes,toolbar=yes,height=500,width=760,'+
|
||||
'menubar=no,resizable=yes,scrollbars=yes,status=no');
|
||||
|
@ -377,7 +377,7 @@ jsToolBar.prototype.elements.post_link.fn.wysiwyg = function() {
|
|||
|
||||
// Last space element
|
||||
jsToolBar.prototype.elements.space3 = {
|
||||
type:'space',
|
||||
type:'space',
|
||||
format:{
|
||||
wysiwyg:true,
|
||||
wiki:true,
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* DotClear is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DotClear; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
@ -22,31 +22,31 @@
|
|||
|
||||
function jsToolBar(textarea) {
|
||||
if (!document.createElement) { return; }
|
||||
|
||||
|
||||
if (!textarea) { return; }
|
||||
|
||||
|
||||
if ((typeof(document["selection"]) == "undefined")
|
||||
&& (typeof(textarea["setSelectionRange"]) == "undefined")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.textarea = textarea;
|
||||
|
||||
|
||||
this.editor = document.createElement('div');
|
||||
this.editor.className = 'jstEditor';
|
||||
|
||||
|
||||
this.textarea.parentNode.insertBefore(this.editor,this.textarea);
|
||||
this.editor.appendChild(this.textarea);
|
||||
|
||||
|
||||
this.toolbar = document.createElement("div");
|
||||
this.toolbar.className = 'jstElements';
|
||||
this.editor.parentNode.insertBefore(this.toolbar,this.editor);
|
||||
|
||||
|
||||
// Dragable resizing (only for gecko)
|
||||
if (navigator.appName == 'Microsoft Internet Explorer')
|
||||
{
|
||||
if (this.editor.addEventListener)
|
||||
{
|
||||
{
|
||||
this.handle = document.createElement('div');
|
||||
this.handle.className = 'jstHandle';
|
||||
var dragStart = this.resizeDragStart;
|
||||
|
@ -55,9 +55,9 @@ function jsToolBar(textarea) {
|
|||
this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.context = null;
|
||||
this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni
|
||||
this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni
|
||||
// de raccourcis vers les éléments DOM correspondants aux outils.
|
||||
};
|
||||
|
||||
|
@ -69,7 +69,7 @@ function jsButton(title, fn, scope, className) {
|
|||
};
|
||||
jsButton.prototype.draw = function() {
|
||||
if (!this.scope) return null;
|
||||
|
||||
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type','button');
|
||||
if (this.className) button.className = this.className;
|
||||
|
@ -77,7 +77,7 @@ jsButton.prototype.draw = function() {
|
|||
var span = document.createElement('span');
|
||||
span.appendChild(document.createTextNode(this.title));
|
||||
button.appendChild(span);
|
||||
|
||||
|
||||
if (this.icon != undefined) {
|
||||
button.style.backgroundImage = 'url('+this.icon+')';
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ jsSpace.prototype.draw = function() {
|
|||
span.appendChild(document.createTextNode(String.fromCharCode(160)));
|
||||
span.className = 'jstSpacer';
|
||||
if (this.width) span.style.marginRight = this.width+'px';
|
||||
|
||||
|
||||
return span;
|
||||
};
|
||||
|
||||
|
@ -111,11 +111,11 @@ function jsCombo(title, options, scope, fn, className) {
|
|||
};
|
||||
jsCombo.prototype.draw = function() {
|
||||
if (!this.scope || !this.options) return null;
|
||||
|
||||
|
||||
var select = document.createElement('select');
|
||||
if (this.className) select.className = className;
|
||||
select.title = this.title;
|
||||
|
||||
|
||||
for (var o in this.options) {
|
||||
//var opt = this.options[o];
|
||||
var option = document.createElement('option');
|
||||
|
@ -123,16 +123,16 @@ jsCombo.prototype.draw = function() {
|
|||
option.appendChild(document.createTextNode(this.options[o]));
|
||||
select.appendChild(option);
|
||||
}
|
||||
|
||||
|
||||
var This = this;
|
||||
select.onchange = function() {
|
||||
try {
|
||||
try {
|
||||
This.fn.call(This.scope, this.value);
|
||||
} catch (e) { alert(e); }
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
return select;
|
||||
};
|
||||
|
||||
|
@ -141,20 +141,20 @@ jsToolBar.prototype = {
|
|||
base_url: '',
|
||||
mode: 'xhtml',
|
||||
elements: {},
|
||||
|
||||
|
||||
getMode: function() {
|
||||
return this.mode;
|
||||
},
|
||||
|
||||
|
||||
setMode: function(mode) {
|
||||
this.mode = mode || 'xhtml';
|
||||
},
|
||||
|
||||
|
||||
switchMode: function(mode) {
|
||||
mode = mode || 'xhtml';
|
||||
this.draw(mode);
|
||||
},
|
||||
|
||||
|
||||
button: function(toolName) {
|
||||
var tool = this.elements[toolName];
|
||||
if (typeof tool.fn[this.mode] != 'function') return null;
|
||||
|
@ -174,11 +174,11 @@ jsToolBar.prototype = {
|
|||
},
|
||||
combo: function(toolName) {
|
||||
var tool = this.elements[toolName];
|
||||
|
||||
|
||||
if( tool[this.mode] != undefined) {
|
||||
|
||||
|
||||
var length = tool[this.mode].list.length;
|
||||
|
||||
|
||||
if (typeof tool[this.mode].fn != 'function' || length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -189,30 +189,30 @@ jsToolBar.prototype = {
|
|||
}
|
||||
return new jsCombo(tool.title, options, this, tool[this.mode].fn);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
draw: function(mode) {
|
||||
this.setMode(mode);
|
||||
|
||||
|
||||
// Empty toolbar
|
||||
while (this.toolbar.hasChildNodes()) {
|
||||
this.toolbar.removeChild(this.toolbar.firstChild)
|
||||
}
|
||||
this.toolNodes = {}; // vide les raccourcis DOM/**/
|
||||
|
||||
|
||||
// Draw toolbar elements
|
||||
var b, tool, newTool;
|
||||
|
||||
|
||||
for (var i in this.elements) {
|
||||
b = this.elements[i];
|
||||
|
||||
|
||||
var disabled =
|
||||
b.type == undefined || b.type == ''
|
||||
|| (b.disabled != undefined && b.disabled)
|
||||
|| (b.context != undefined && b.context != null && b.context != this.context);
|
||||
|
||||
|
||||
if (!disabled && typeof this[b.type] == 'function') {
|
||||
tool = this[b.type](i);
|
||||
if (tool) newTool = tool.draw();
|
||||
|
@ -223,24 +223,24 @@ jsToolBar.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
singleTag: function(stag,etag) {
|
||||
stag = stag || null;
|
||||
etag = etag || stag;
|
||||
|
||||
|
||||
if (!stag || !etag) { return; }
|
||||
|
||||
|
||||
this.encloseSelection(stag,etag);
|
||||
},
|
||||
|
||||
|
||||
encloseSelection: function(prefix, suffix, fn) {
|
||||
this.textarea.focus();
|
||||
|
||||
|
||||
prefix = prefix || '';
|
||||
suffix = suffix || '';
|
||||
|
||||
|
||||
var start, end, sel, scrollPos, subst, res;
|
||||
|
||||
|
||||
if (typeof(document["selection"]) != "undefined") {
|
||||
sel = document.selection.createRange().text;
|
||||
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
|
||||
|
@ -249,20 +249,20 @@ jsToolBar.prototype = {
|
|||
scrollPos = this.textarea.scrollTop;
|
||||
sel = this.textarea.value.substring(start, end);
|
||||
}
|
||||
|
||||
|
||||
if (sel.match(/ $/)) { // exclude ending space char, if any
|
||||
sel = sel.substring(0, sel.length - 1);
|
||||
suffix = suffix + " ";
|
||||
}
|
||||
|
||||
|
||||
if (typeof(fn) == 'function') {
|
||||
res = (sel) ? fn.call(this,sel) : fn('');
|
||||
} else {
|
||||
res = (sel) ? sel : '';
|
||||
}
|
||||
|
||||
|
||||
subst = prefix + res + suffix;
|
||||
|
||||
|
||||
if (typeof(document["selection"]) != "undefined") {
|
||||
var range = document.selection.createRange().text = subst;
|
||||
this.textarea.caretPos -= suffix.length;
|
||||
|
@ -277,7 +277,7 @@ jsToolBar.prototype = {
|
|||
this.textarea.scrollTop = scrollPos;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stripBaseURL: function(url) {
|
||||
if (this.base_url != '') {
|
||||
var pos = url.indexOf(this.base_url);
|
||||
|
@ -285,7 +285,7 @@ jsToolBar.prototype = {
|
|||
url = url.substr(this.base_url.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
@ -354,7 +354,7 @@ jsToolBar.prototype.elements.blocks = {
|
|||
|
||||
// spacer
|
||||
jsToolBar.prototype.elements.space0 = {
|
||||
type:'space',
|
||||
type:'space',
|
||||
format:{
|
||||
wysiwyg:true,
|
||||
wiki:true,
|
||||
|
@ -424,7 +424,7 @@ jsToolBar.prototype.elements.code = {
|
|||
|
||||
// spacer
|
||||
jsToolBar.prototype.elements.space1 = {
|
||||
type:'space',
|
||||
type:'space',
|
||||
format:{
|
||||
wysiwyg:true,
|
||||
wiki:true,
|
||||
|
@ -444,7 +444,7 @@ jsToolBar.prototype.elements.br = {
|
|||
|
||||
// spacer
|
||||
jsToolBar.prototype.elements.space2 = {
|
||||
type:'space',
|
||||
type:'space',
|
||||
format:{
|
||||
wysiwyg:true,
|
||||
wiki:true,
|
||||
|
@ -522,7 +522,7 @@ jsToolBar.prototype.elements.ol = {
|
|||
|
||||
// spacer
|
||||
jsToolBar.prototype.elements.space3 = {
|
||||
type:'space',
|
||||
type:'space',
|
||||
format:{
|
||||
wysiwyg:true,
|
||||
wiki:true,
|
||||
|
@ -541,13 +541,13 @@ jsToolBar.prototype.elements.link = {
|
|||
prompt: function(href,hreflang) {
|
||||
href = href || '';
|
||||
hreflang = hreflang || this.elements.link.default_hreflang;
|
||||
|
||||
|
||||
href = window.prompt(this.elements.link.href_prompt,href);
|
||||
if (!href) { return false; }
|
||||
|
||||
|
||||
hreflang = window.prompt(this.elements.link.hreflang_prompt,
|
||||
hreflang);
|
||||
|
||||
|
||||
return { href: this.stripBaseURL(href), hreflang: hreflang };
|
||||
}
|
||||
};
|
||||
|
@ -559,7 +559,7 @@ jsToolBar.prototype.elements.link.fn.xhtml = function() {
|
|||
if (link.hreflang) { stag = stag+' hreflang="'+link.hreflang+'"'; }
|
||||
stag = stag+'>';
|
||||
var etag = '</a>';
|
||||
|
||||
|
||||
this.encloseSelection(stag,etag);
|
||||
}
|
||||
};
|
||||
|
@ -570,7 +570,7 @@ jsToolBar.prototype.elements.link.fn.wiki = function() {
|
|||
var etag = '|'+link.href;
|
||||
if (link.hreflang) { etag = etag+'|'+link.hreflang; }
|
||||
etag = etag+']';
|
||||
|
||||
|
||||
this.encloseSelection(stag,etag);
|
||||
}
|
||||
};
|
||||
|
@ -609,4 +609,4 @@ jsToolBar.prototype.elements.img.fn.wiki = function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* DotClear is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DotClear; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
@ -31,7 +31,7 @@ jsToolBar.prototype.iframe_css = null;
|
|||
jsToolBar.prototype.drawToolBar = jsToolBar.prototype.draw;
|
||||
jsToolBar.prototype.draw = function(mode) {
|
||||
mode = mode || 'xhtml';
|
||||
|
||||
|
||||
if (this.can_wwg) {
|
||||
this.mode = 'wysiwyg';
|
||||
this.drawToolBar('wysiwyg');
|
||||
|
@ -43,7 +43,7 @@ jsToolBar.prototype.draw = function(mode) {
|
|||
|
||||
jsToolBar.prototype.switchMode = function(mode) {
|
||||
mode = mode || 'xhtml';
|
||||
|
||||
|
||||
if (mode == 'xhtml') {
|
||||
this.wwg_mode = true;
|
||||
this.draw(mode);
|
||||
|
@ -69,14 +69,14 @@ jsToolBar.prototype.syncContents = function(from) {
|
|||
if (html == '<br />') { html = '<p></p>'; }
|
||||
this.textarea.value = html;
|
||||
}
|
||||
|
||||
|
||||
function initContent() {
|
||||
if (!This.iframe.contentWindow.document || !This.iframe.contentWindow.document.body) {
|
||||
setTimeout(initContent, 1);
|
||||
return;
|
||||
}
|
||||
This.ibody = This.iframe.contentWindow.document.body;
|
||||
|
||||
|
||||
if (This.textarea.value != '' && This.textarea.value != '<p></p>') {
|
||||
This.ibody.innerHTML = This.applyWysiwygFilters(This.textarea.value);
|
||||
if (This.ibody.createTextRange) { //cursor at the begin for IE
|
||||
|
@ -138,28 +138,28 @@ jsToolBar.prototype.switchEdit = function() {
|
|||
*/
|
||||
jsToolBar.prototype.initWindow = function() {
|
||||
var This = this;
|
||||
|
||||
|
||||
this.iframe = document.createElement('iframe');
|
||||
this.textarea.parentNode.insertBefore(this.iframe,this.textarea.nextSibling);
|
||||
|
||||
|
||||
this.switcher = document.createElement('ul');
|
||||
this.switcher.className = 'jstSwitcher';
|
||||
this.editor.appendChild(this.switcher);
|
||||
|
||||
|
||||
this.iframe.height = this.textarea.offsetHeight + 0;
|
||||
this.iframe.width = this.textarea.offsetWidth + 0;
|
||||
|
||||
|
||||
if (this.textarea.tabIndex != undefined) {
|
||||
this.iframe.tabIndex = this.textarea.tabIndex;
|
||||
}
|
||||
|
||||
|
||||
function initIframe() {
|
||||
var doc = This.iframe.contentWindow.document;
|
||||
if (!doc) {
|
||||
setTimeout(initIframe,1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
doc.open();
|
||||
var html =
|
||||
'<html>\n'+
|
||||
|
@ -170,28 +170,28 @@ jsToolBar.prototype.initWindow = function() {
|
|||
'<body>\n'+
|
||||
'</body>\n'+
|
||||
'</html>';
|
||||
|
||||
|
||||
doc.write(html);
|
||||
doc.close();
|
||||
if (document.all) { // for IE
|
||||
doc.designMode = 'on';
|
||||
// warning : doc is now inaccessible for IE6 sp1
|
||||
}
|
||||
|
||||
|
||||
This.iwin = This.iframe.contentWindow;
|
||||
|
||||
|
||||
This.syncContents('textarea');
|
||||
|
||||
|
||||
if (This.wwg_mode == undefined) {
|
||||
This.wwg_mode = true;
|
||||
}
|
||||
|
||||
|
||||
if (This.wwg_mode) {
|
||||
This.textarea.style.display = 'none';
|
||||
} else {
|
||||
This.iframe.style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
// update textarea on submit
|
||||
if (This.textarea.form) {
|
||||
chainHandler(This.textarea.form,'onsubmit', function() {
|
||||
|
@ -200,15 +200,15 @@ jsToolBar.prototype.initWindow = function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (var evt in This.iwinEvents) {
|
||||
var event = This.iwinEvents[evt];
|
||||
This.addIwinEvent(This.iframe.contentWindow.document, event.type, event.fn, This);
|
||||
}
|
||||
|
||||
|
||||
This.setSwitcher();
|
||||
try { This.iwin.document.designMode = 'on'; } catch (e) {}; // Firefox needs this
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
initIframe();
|
||||
|
@ -240,7 +240,7 @@ jsToolBar.prototype.setSwitcher = function() {
|
|||
while (this.switcher.hasChildNodes()) {
|
||||
this.switcher.removeChild(this.switcher.firstChild);
|
||||
}
|
||||
|
||||
|
||||
var This = this;
|
||||
function setLink(title,link) {
|
||||
var li = document.createElement('li');
|
||||
|
@ -254,11 +254,11 @@ jsToolBar.prototype.setSwitcher = function() {
|
|||
li.className = 'jstSwitcherCurrent';
|
||||
a = document.createTextNode(title);
|
||||
}
|
||||
|
||||
|
||||
li.appendChild(a);
|
||||
This.switcher.appendChild(li);
|
||||
}
|
||||
|
||||
|
||||
setLink(this.switcher_visual_title,!this.wwg_mode);
|
||||
setLink(this.switcher_source_title,this.wwg_mode);
|
||||
};
|
||||
|
@ -270,7 +270,7 @@ jsToolBar.prototype.removeEditor = function() {
|
|||
this.iframe.parentNode.removeChild(this.iframe);
|
||||
this.iframe = null;
|
||||
}
|
||||
|
||||
|
||||
if (this.switcher != undefined && this.switcher.parentNode != undefined) {
|
||||
this.switcher.parentNode.removeChild(this.switcher);
|
||||
}
|
||||
|
@ -311,20 +311,20 @@ jsToolBar.prototype.resizeDragMove = function(event) {
|
|||
*/
|
||||
jsToolBar.prototype.insertNode = function(node) {
|
||||
var range;
|
||||
|
||||
|
||||
if (this.iwin.getSelection) { // Gecko
|
||||
var sel = this.iwin.getSelection();
|
||||
range = sel.getRangeAt(0);
|
||||
|
||||
|
||||
// deselect all ranges
|
||||
sel.removeAllRanges();
|
||||
|
||||
|
||||
// empty range
|
||||
range.deleteContents();
|
||||
|
||||
|
||||
// Insert node
|
||||
range.insertNode(node);
|
||||
|
||||
|
||||
range.selectNodeContents(node);
|
||||
range.setEndAfter(node);
|
||||
if (range.endContainer.childNodes.length > range.endOffset &&
|
||||
|
@ -334,7 +334,7 @@ jsToolBar.prototype.insertNode = function(node) {
|
|||
range.setEnd(range.endContainer.childNodes[0]);
|
||||
}
|
||||
sel.addRange(range);
|
||||
|
||||
|
||||
sel.collapseToEnd();
|
||||
} else { // IE
|
||||
// lambda element
|
||||
|
@ -390,7 +390,7 @@ jsToolBar.prototype.replaceNodeByContent = function(node) {
|
|||
|
||||
jsToolBar.prototype.getBlockLevel = function() {
|
||||
var blockElts = ['p','h1','h2','h3','h4','h5','h6'];
|
||||
|
||||
|
||||
var range, commonAncestorContainer;
|
||||
if (this.iwin.getSelection) { //gecko
|
||||
var selection = this.iwin.getSelection();
|
||||
|
@ -403,7 +403,7 @@ jsToolBar.prototype.getBlockLevel = function() {
|
|||
range = this.iwin.document.selection.createRange();
|
||||
commonAncestorContainer = range.parentElement();
|
||||
}
|
||||
|
||||
|
||||
var ancestorTagName = commonAncestorContainer.tagName.toLowerCase();
|
||||
while (arrayIndexOf(blockElts, ancestorTagName)==-1 && ancestorTagName!='body') {
|
||||
commonAncestorContainer = commonAncestorContainer.parentNode;
|
||||
|
@ -429,8 +429,8 @@ jsToolBar.prototype.simpleCleanRegex = new Array(
|
|||
[/<meta[\w\W]*?>/gim,''],
|
||||
[/<style[\w\W]*?>[\w\W]*?<\/style>/gim, ''],
|
||||
[/<\/?font[\w\W]*?>/gim, ''],
|
||||
|
||||
|
||||
|
||||
|
||||
/* Replacements */
|
||||
[/<(\/?)(B|b|STRONG)([\s>\/])/g, "<$1strong$3"],
|
||||
[/<(\/?)(I|i|EM)([\s>\/])/g, "<$1em$3"],
|
||||
|
@ -497,13 +497,13 @@ jsToolBar.prototype.tagsoup2xhtml = function(html) {
|
|||
while ( /(<[^\/!]>|<[^\/!][^>]*[^\/]>)\s*<\/[^>]*[^-]>/.test(html) ) {
|
||||
html = html.replace(/(<[^\/!]>|<[^\/!][^>]*[^\/]>)\s*<\/[^>]*[^-]>/g, "");
|
||||
}
|
||||
|
||||
|
||||
/* tous les tags en minuscule */
|
||||
html = html.replace(/<(\/?)([A-Z0-9]+)/g,
|
||||
function(match0, match1, match2) {
|
||||
return "<" + match1 + match2.toLowerCase();
|
||||
});
|
||||
|
||||
|
||||
/* IE laisse souvent des attributs sans guillemets */
|
||||
var myRegexp = /<[^>]+((\s+\w+\s*=\s*)([^"'][\w~@+$,%\/:.#?=&;!*()-]*))[^>]*?>/;
|
||||
while ( myRegexp.test(html)) {
|
||||
|
@ -515,21 +515,21 @@ jsToolBar.prototype.tagsoup2xhtml = function(html) {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/* les navigateurs rajoutent une unite aux longueurs css nulles */
|
||||
/* note: a ameliorer ! */
|
||||
while ( /(<[^>]+style=(["'])[^>]+[\s:]+)0(pt|px)(\2|\s|;)/.test(html)) {
|
||||
html = html.replace(/(<[^>]+style=(["'])[^>]+[\s:]+)0(pt|px)(\2|\s|;)/gi, "$1"+"0$4");
|
||||
}
|
||||
|
||||
|
||||
/* correction des fins de lignes : le textarea edite contient des \n
|
||||
* le wysiwyg des \r\n , et le textarea mis a jour SANS etre affiche des \r\n ! */
|
||||
html = html.replace(/\r\n/g,"\n");
|
||||
|
||||
|
||||
/* Trim */
|
||||
html = html.replace(/^\s+/gm,'');
|
||||
html = html.replace(/\s+$/gm,'');
|
||||
|
||||
|
||||
return html;
|
||||
};
|
||||
jsToolBar.prototype.validBlockquote = function() {
|
||||
|
@ -537,7 +537,7 @@ jsToolBar.prototype.validBlockquote = function() {
|
|||
'h2','h3','h4','h5','h6','hr','ol','p','pre','table','ul'];
|
||||
var BQs = this.iwin.document.getElementsByTagName('blockquote');
|
||||
var bqChilds;
|
||||
|
||||
|
||||
for (var bq = 0; bq < BQs.length; bq++) {
|
||||
bqChilds = BQs[bq].childNodes;
|
||||
var frag = this.iwin.document.createDocumentFragment();
|
||||
|
@ -571,20 +571,20 @@ jsToolBar.prototype.removeFormatRegexp = new Array(
|
|||
[/(<[a-z][^>]*)margin-left\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)margin-right\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)margin-top\s*:[^;]*;/mg, "$1"],
|
||||
|
||||
|
||||
[/(<[a-z][^>]*)padding\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)padding-bottom\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)padding-left\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)padding-right\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)padding-top\s*:[^;]*;/mg, "$1"],
|
||||
|
||||
|
||||
[/(<[a-z][^>]*)font\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)font-family\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)font-size\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)font-style\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)font-variant\s*:[^;]*;/mg, "$1"],
|
||||
[/(<[a-z][^>]*)font-weight\s*:[^;]*;/mg, "$1"],
|
||||
|
||||
|
||||
[/(<[a-z][^>]*)color\s*:[^;]*;/mg, "$1"]
|
||||
);
|
||||
|
||||
|
@ -592,7 +592,7 @@ jsToolBar.prototype.removeTextFormating = function(html) {
|
|||
for (var reg in this.removeFormatRegexp) {
|
||||
html = html.replace(this.removeFormatRegexp[reg][0], this.removeFormatRegexp[reg][1]);
|
||||
}
|
||||
|
||||
|
||||
html = this.tagsoup2xhtml(html);
|
||||
html = html.replace(/style="\s*?"/mgi,'');
|
||||
return html;
|
||||
|
@ -692,29 +692,29 @@ jsToolBar.prototype.elements.link.fn.wysiwyg = function() {
|
|||
range = this.iwin.document.selection.createRange();
|
||||
commonAncestorContainer = range.parentElement();
|
||||
}
|
||||
|
||||
|
||||
var ancestorTagName = commonAncestorContainer.tagName.toLowerCase();
|
||||
while (ancestorTagName!='a' && ancestorTagName!='body') {
|
||||
commonAncestorContainer = commonAncestorContainer.parentNode;
|
||||
ancestorTagName = commonAncestorContainer.tagName.toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
// Update or remove link?
|
||||
if (ancestorTagName == 'a') {
|
||||
href = commonAncestorContainer.href || '';
|
||||
hreflang = commonAncestorContainer.hreflang || '';
|
||||
}
|
||||
|
||||
|
||||
href = window.prompt(this.elements.link.href_prompt,href);
|
||||
|
||||
|
||||
// Remove link
|
||||
if (ancestorTagName == 'a' && href=='') {
|
||||
this.replaceNodeByContent(commonAncestorContainer);
|
||||
}
|
||||
if (!href) return; // user cancel
|
||||
|
||||
|
||||
hreflang = window.prompt(this.elements.link.hreflang_prompt, hreflang);
|
||||
|
||||
|
||||
// Update link
|
||||
if (ancestorTagName == 'a' && href) {
|
||||
commonAncestorContainer.setAttribute('href', href);
|
||||
|
@ -725,7 +725,7 @@ jsToolBar.prototype.elements.link.fn.wysiwyg = function() {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create link
|
||||
var n = this.getSelectedNode();
|
||||
var a = this.iwin.document.createElement('a');
|
||||
|
@ -795,4 +795,4 @@ function removeEvent(obj, evType, fn, useCapture) {
|
|||
};
|
||||
function regexpEscape(s) {
|
||||
return s.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1")
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,22 +2,22 @@ $(function() {
|
|||
$('#link-insert-cancel').click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
||||
$('#link-insert-ok').click(function() {
|
||||
sendClose();
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
||||
function sendClose() {
|
||||
var insert_form = $('#link-insert-form').get(0);
|
||||
if (insert_form == undefined) { return; }
|
||||
|
||||
|
||||
var tb = window.opener.the_toolbar;
|
||||
var data = tb.elements.link.data;
|
||||
|
||||
|
||||
data.href = tb.stripBaseURL(insert_form.elements.href.value);
|
||||
data.title = insert_form.elements.title.value;
|
||||
data.hreflang = insert_form.elements.hreflang.value;
|
||||
tb.elements.link.fncall[tb.mode].call(tb);
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
$(function() {
|
||||
var toolBar = window.opener.the_toolbar.textarea;
|
||||
|
||||
|
||||
$('#media-insert').onetabload(function() {
|
||||
$('#media-insert-cancel').click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
||||
$('#media-insert-ok').click(function() {
|
||||
sendClose();
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function sendClose() {
|
||||
var insert_form = $('#media-insert-form').get(0);
|
||||
if (insert_form == undefined) { return; }
|
||||
|
||||
|
||||
var tb = window.opener.the_toolbar;
|
||||
var type = insert_form.elements.type.value;
|
||||
|
||||
|
||||
var media_align_grid = {
|
||||
left: 'float: left; margin: 0 1em 1em 0;',
|
||||
right: 'float: right; margin: 0 0 1em 1em;',
|
||||
center: 'text-align: center;'
|
||||
};
|
||||
|
||||
|
||||
if (type == 'image')
|
||||
{
|
||||
tb.elements.img_select.data.src = tb.stripBaseURL($('input[name="src"]:checked',insert_form).val());
|
||||
tb.elements.img_select.data.alignment = $('input[name="alignment"]:checked',insert_form).val();
|
||||
tb.elements.img_select.data.link = $('input[name="insertion"]:checked',insert_form).val() == 'link';
|
||||
|
||||
|
||||
tb.elements.img_select.data.title = insert_form.elements.title.value;
|
||||
tb.elements.img_select.data.description = $('input[name="description"]',insert_form).val();
|
||||
tb.elements.img_select.data.url = tb.stripBaseURL(insert_form.elements.url.value);
|
||||
|
@ -40,11 +40,11 @@ $(function() {
|
|||
{
|
||||
var player = $('#public_player').val();
|
||||
var align = $('input[name="alignment"]:checked',insert_form).val();
|
||||
|
||||
|
||||
if (align != undefined && align != 'none') {
|
||||
player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
|
||||
}
|
||||
|
||||
|
||||
tb.elements.mp3_insert.data.player = player.replace(/>/g,'>\n');
|
||||
tb.elements.mp3_insert.fncall[tb.mode].call(tb);
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ $(function() {
|
|||
{
|
||||
var oplayer = $('<div>'+$('#public_player').val()+'</div>');
|
||||
var flashvars = $("[name=FlashVars]",oplayer).val();
|
||||
|
||||
|
||||
var align = $('input[name="alignment"]:checked',insert_form).val();
|
||||
var title = insert_form.elements.title.value;
|
||||
|
||||
|
||||
if (title) {
|
||||
flashvars = 'title='+encodeURI(title)+'&'+flashvars;
|
||||
}
|
||||
|
@ -63,14 +63,14 @@ $(function() {
|
|||
$('object',oplayer).attr('height',$('#video_h').val());
|
||||
flashvars = flashvars.replace(/(width=\d*)/,'width='+$('#video_w').val());
|
||||
flashvars = flashvars.replace(/(height=\d*)/,'height='+$('#video_h').val());
|
||||
|
||||
|
||||
$("[name=FlashVars]",oplayer).val(flashvars);
|
||||
var player = oplayer.html();
|
||||
|
||||
var player = oplayer.html();
|
||||
|
||||
if (align != undefined && align != 'none') {
|
||||
player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
|
||||
}
|
||||
|
||||
|
||||
tb.elements.flv_insert.data.player = player.replace(/>/g,'>\n');
|
||||
tb.elements.flv_insert.fncall[tb.mode].call(tb);
|
||||
}
|
||||
|
@ -81,12 +81,12 @@ $(function() {
|
|||
tb.elements.link.fncall[tb.mode].call(tb);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function playerFormat(s) {
|
||||
s = s.replace(/</g,'<');
|
||||
s = s.replace(/>/g,'>\n');
|
||||
s = s.replace(/&/g,'&');
|
||||
|
||||
|
||||
return s;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,15 +2,15 @@ $(function() {
|
|||
$('#link-insert-cancel').click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
||||
$('#form-entries tr>td.maximal>a').click(function() {
|
||||
// Get post_id
|
||||
var tb = window.opener.the_toolbar;
|
||||
var data = tb.elements.link.data;
|
||||
|
||||
|
||||
data.href = tb.stripBaseURL($(this).attr('title'));
|
||||
|
||||
|
||||
tb.elements.link.fncall[tb.mode].call(tb);
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ $(function() {
|
|||
$('#prelude a').removeClass('hidden');
|
||||
$('#wrapper, #help-button, #collapser').addClass('with-prelude');
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#prelude a[href="#help"]', function(e) {
|
||||
e.preventDefault();
|
||||
$('#help-button a').focus();
|
||||
|
|
|
@ -39,15 +39,15 @@ if ($is_writable && !empty($_POST['delete']) && !empty($_POST['locale_id']))
|
|||
if (!isset($iso_codes[$locale_id]) || !is_dir(DC_L10N_ROOT.'/'.$locale_id)) {
|
||||
throw new Exception(__('No such installed language'));
|
||||
}
|
||||
|
||||
|
||||
if ($locale_id == 'en') {
|
||||
throw new Exception(__("You can't remove English language."));
|
||||
}
|
||||
|
||||
|
||||
if (!files::deltree(DC_L10N_ROOT.'/'.$locale_id)) {
|
||||
throw new Exception(__('Permissions to delete language denied.'));
|
||||
}
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Language has been successfully deleted.'));
|
||||
http::redirect('langs.php');
|
||||
}
|
||||
|
@ -65,27 +65,27 @@ if ($is_writable && !empty($_POST['pkg_url']))
|
|||
if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) {
|
||||
throw new Exception(__('Password verification failed'));
|
||||
}
|
||||
|
||||
|
||||
$url = html::escapeHTML($_POST['pkg_url']);
|
||||
$dest = DC_L10N_ROOT.'/'.basename($url);
|
||||
if (!preg_match('#^http://[^.]+\.dotclear\.(net|org)/.*\.zip$#',$url)) {
|
||||
throw new Exception(__('Invalid language file URL.'));
|
||||
}
|
||||
|
||||
|
||||
$client = netHttp::initClient($url,$path);
|
||||
$client->setUserAgent('Dotclear - http://www.dotclear.org/');
|
||||
$client->useGzip(false);
|
||||
$client->setPersistReferers(false);
|
||||
$client->setOutput($dest);
|
||||
$client->get($path);
|
||||
|
||||
|
||||
try {
|
||||
$ret_code = dc_lang_install($dest);
|
||||
} catch (Exception $e) {
|
||||
@unlink($dest);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
@unlink($dest);
|
||||
if ($ret_code == 2) {
|
||||
dcPage::addSuccessNotice( __('Language has been successfully upgraded'));
|
||||
|
@ -108,20 +108,20 @@ if ($is_writable && !empty($_POST['upload_pkg']))
|
|||
if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) {
|
||||
throw new Exception(__('Password verification failed'));
|
||||
}
|
||||
|
||||
|
||||
files::uploadStatus($_FILES['pkg_file']);
|
||||
$dest = DC_L10N_ROOT.'/'.$_FILES['pkg_file']['name'];
|
||||
if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'],$dest)) {
|
||||
throw new Exception(__('Unable to move uploaded file.'));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$ret_code = dc_lang_install($dest);
|
||||
} catch (Exception $e) {
|
||||
@unlink($dest);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
@unlink($dest);
|
||||
if ($ret_code == 2) {
|
||||
dcPage::addSuccessNotice( __('Language has been successfully upgraded'));
|
||||
|
@ -169,7 +169,7 @@ $locales_content = scandir(DC_L10N_ROOT);
|
|||
$tmp = array();
|
||||
foreach ($locales_content as $v) {
|
||||
$c = ($v == '.' || $v == '..' || $v == 'en' || !is_dir(DC_L10N_ROOT.'/'.$v) || !isset($iso_codes[$v]));
|
||||
|
||||
|
||||
if (!$c) {
|
||||
$tmp[$v] = DC_L10N_ROOT.'/'.$v;
|
||||
}
|
||||
|
@ -188,17 +188,17 @@ else
|
|||
'<th>'.__('Language').'</th>'.
|
||||
'<th class="nowrap">'.__('Action').'</th>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
foreach ($locales_content as $k => $v)
|
||||
{
|
||||
$is_deletable = $is_writable && is_writable($v);
|
||||
|
||||
|
||||
echo
|
||||
'<tr class="line wide">'.
|
||||
'<td class="maximal nowrap">('.$k.') '.
|
||||
'<strong>'.html::escapeHTML($iso_codes[$k]).'</strong></td>'.
|
||||
'<td class="nowrap action">';
|
||||
|
||||
|
||||
if ($is_deletable)
|
||||
{
|
||||
echo
|
||||
|
@ -210,7 +210,7 @@ else
|
|||
'</div>'.
|
||||
'</form>';
|
||||
}
|
||||
|
||||
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
|
@ -231,7 +231,7 @@ if (!empty($dc_langs) && $is_writable)
|
|||
$dc_langs_combo[html::escapeHTML('('.$v->title.') '.$iso_codes[$v->title])] = html::escapeHTML($v->link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<form method="post" action="langs.php" enctype="multipart/form-data" class="fieldset">'.
|
||||
'<h4>'.__('Available languages').'</h4>'.
|
||||
|
@ -271,28 +271,27 @@ function dc_lang_install($file)
|
|||
{
|
||||
$zip = new fileUnzip($file);
|
||||
$zip->getList(false,'#(^|/)(__MACOSX|\.svn|\.DS_Store|\.directory|Thumbs\.db)(/|$)#');
|
||||
|
||||
|
||||
if (!preg_match('/^[a-z]{2,3}(-[a-z]{2})?$/',$zip->getRootDir())) {
|
||||
throw new Exception(__('Invalid language zip file.'));
|
||||
}
|
||||
|
||||
|
||||
if ($zip->isEmpty() || !$zip->hasFile($zip->getRootDir().'/main.po')) {
|
||||
throw new Exception(__('The zip file does not appear to be a valid Dotclear language pack.'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$target = dirname($file);
|
||||
$destination = $target.'/'.$zip->getRootDir();
|
||||
$res = 1;
|
||||
|
||||
|
||||
if (is_dir($destination)) {
|
||||
if (!files::deltree($destination)) {
|
||||
throw new Exception(__('An error occurred during language upgrade.'));
|
||||
}
|
||||
$res = 2;
|
||||
}
|
||||
|
||||
|
||||
$zip->unzipAll($target);
|
||||
return $res;
|
||||
}
|
||||
?>
|
|
@ -672,4 +672,3 @@ if ($popup) {
|
|||
}
|
||||
|
||||
call_user_func($close_f);
|
||||
?>
|
||||
|
|
|
@ -34,46 +34,46 @@ if (file_exists($p_file))
|
|||
{
|
||||
# Loading plugin
|
||||
$p_info = $core->plugins->getModules($p);
|
||||
|
||||
|
||||
$p_url = 'plugin.php?p='.$p;
|
||||
|
||||
|
||||
$p_title = 'no content - plugin';
|
||||
$p_head = '';
|
||||
$p_content = '<p>'.__('No content found on this plugin.').'</p>';
|
||||
|
||||
|
||||
ob_start();
|
||||
include $p_file;
|
||||
$res = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
if (preg_match('|<head>(.*?)</head|ms',$res,$m)) {
|
||||
if (preg_match('|<title>(.*?)</title>|ms',$m[1],$mt)) {
|
||||
$p_title = $mt[1];
|
||||
}
|
||||
|
||||
|
||||
if (preg_match_all('|(<script.*?>.*?</script>)|ms',$m[1],$ms)) {
|
||||
foreach ($ms[1] as $v) {
|
||||
$p_head .= $v."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (preg_match_all('|(<style.*?>.*?</style>)|ms',$m[1],$ms)) {
|
||||
foreach ($ms[1] as $v) {
|
||||
$p_head .= $v."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (preg_match_all('|(<link.*?/>)|ms',$m[1],$ms)) {
|
||||
foreach ($ms[1] as $v) {
|
||||
$p_head .= $v."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (preg_match('|<body.*?>(.+)</body>|ms',$res,$m)) {
|
||||
$p_content = $m[1];
|
||||
}
|
||||
|
||||
|
||||
call_user_func($open_f,$p_title,$p_head);
|
||||
echo $p_content;
|
||||
call_user_func($close_f);
|
||||
|
@ -87,9 +87,8 @@ else
|
|||
__('Plugin not found') => ''
|
||||
))
|
||||
);
|
||||
|
||||
|
||||
echo '<p>'.__('The plugin you reached does not exist or does not have an admin page.').'</p>';
|
||||
|
||||
|
||||
call_user_func($close_f);
|
||||
}
|
||||
?>
|
|
@ -16,8 +16,8 @@ dcPage::check('admin');
|
|||
|
||||
# -- Page helper --
|
||||
$list = new adminModulesList(
|
||||
$core->plugins,
|
||||
DC_PLUGINS_ROOT,
|
||||
$core->plugins,
|
||||
DC_PLUGINS_ROOT,
|
||||
$core->blog->settings->system->store_plugin_url
|
||||
);
|
||||
|
||||
|
@ -88,27 +88,27 @@ dcPage::open(__('Plugins management'),
|
|||
|
||||
# -- Plugins install messages --
|
||||
if (!empty($plugins_install['success'])) {
|
||||
echo
|
||||
echo
|
||||
'<div class="static-msg">'.__('Following plugins have been installed:').'<ul>';
|
||||
|
||||
foreach ($plugins_install['success'] as $k => $v) {
|
||||
echo
|
||||
echo
|
||||
'<li>'.$k.'</li>';
|
||||
}
|
||||
|
||||
echo
|
||||
echo
|
||||
'</ul></div>';
|
||||
}
|
||||
if (!empty($plugins_install['failure'])) {
|
||||
echo
|
||||
echo
|
||||
'<div class="error">'.__('Following plugins have not been installed:').'<ul>';
|
||||
|
||||
foreach ($plugins_install['failure'] as $k => $v) {
|
||||
echo
|
||||
echo
|
||||
'<li>'.$k.' ('.$v.')</li>';
|
||||
}
|
||||
|
||||
echo
|
||||
echo
|
||||
'</ul></div>';
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
|
|||
# Updated modules from repo
|
||||
$modules = $list->store->get(true);
|
||||
if (!empty($modules)) {
|
||||
echo
|
||||
echo
|
||||
'<div class="multi-part" id="update" title="'.html::escapeHTML(__('Update plugins')).'">'.
|
||||
'<h3>'.html::escapeHTML(__('Update plugins')).'</h3>'.
|
||||
'<p>'.sprintf(
|
||||
|
@ -152,8 +152,8 @@ echo
|
|||
# Activated modules
|
||||
$modules = $list->modules->getModules();
|
||||
if (!empty($modules)) {
|
||||
|
||||
echo
|
||||
|
||||
echo
|
||||
'<h3>'.($core->auth->isSuperAdmin() ?__('Activated plugins') : __('Installed plugins')).'</h3>'.
|
||||
'<p>'.__('You can configure and manage installed plugins from this list.').'</p>';
|
||||
|
||||
|
@ -186,7 +186,7 @@ if ($core->auth->isSuperAdmin()) {
|
|||
}
|
||||
}
|
||||
|
||||
echo
|
||||
echo
|
||||
'</div>';
|
||||
|
||||
if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
|
||||
|
@ -240,7 +240,7 @@ $core->callBehavior('pluginsToolsTabs', $core);
|
|||
|
||||
# -- Notice for super admin --
|
||||
if ($core->auth->isSuperAdmin() && !$list->isWritablePath()) {
|
||||
echo
|
||||
echo
|
||||
'<p class="warning">'.__('Some functions are disabled, please give write access to your plugins directory to enable them.').'</p>';
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ echo
|
|||
'<form id="link-insert-form" action="#" method="get">'.
|
||||
'<p><label class="required" for="href"><abbr title="'.__('Required field').'">*</abbr> '.__('Link URL:').'</label> '.
|
||||
form::field('href',35,512,html::escapeHTML($href)).'</p>'.
|
||||
'<p><label for="title">'.__('Link title:').'</label> '.
|
||||
form::field('title',35,512,html::escapeHTML($title)).'</p>'.
|
||||
'<p><label for="title">'.__('Link title:').'</label> '.
|
||||
form::field('title',35,512,html::escapeHTML($title)).'</p>'.
|
||||
'<p><label for="hreflang">'.__('Link language:').'</label> '.
|
||||
form::combo('hreflang',$lang_combo,$hreflang).
|
||||
'</p>'.
|
||||
|
@ -48,4 +48,3 @@ form::combo('hreflang',$lang_combo,$hreflang).
|
|||
'</script>'."\n";
|
||||
|
||||
dcPage::closePopup();
|
||||
?>
|
|
@ -78,4 +78,3 @@ echo '</div>';
|
|||
echo '<p><a class="button" href="#" id="link-insert-cancel">'.__('cancel').'</a></p>';
|
||||
|
||||
dcPage::closePopup();
|
||||
?>
|
|
@ -883,4 +883,3 @@ function showComments($rs,$has_action,$tb=false)
|
|||
|
||||
dcPage::helpBlock('core_post','core_trackbacks','core_wiki');
|
||||
dcPage::close();
|
||||
?>
|
||||
|
|
|
@ -56,20 +56,20 @@ if (($post_id && $media_id) || $core->error->flag())
|
|||
if (!empty($_POST['remove']))
|
||||
{
|
||||
$core->media->removePostMedia($post_id,$media_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Attachment has been successfully removed.'));
|
||||
http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false));
|
||||
}
|
||||
elseif (isset($_POST['post_id'])) {
|
||||
http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false));
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['remove']))
|
||||
{
|
||||
dcPage::open(__('Remove attachment'));
|
||||
|
||||
|
||||
echo '<h2>'.__('Attachment').' › <span class="page-title">'.__('confirm removal').'</span></h2>';
|
||||
|
||||
|
||||
echo
|
||||
'<form action="post_media.php" method="post">'.
|
||||
'<p>'.__('Are you sure you want to remove this attachment?').'</p>'.
|
||||
|
@ -79,7 +79,7 @@ if (($post_id && $media_id) || $core->error->flag())
|
|||
form::hidden('media_id',$media_id).
|
||||
$core->formNonce().'</p>'.
|
||||
'</form>';
|
||||
|
||||
|
||||
dcPage::close();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ if (!$core->error->flag())
|
|||
$categories_combo = array_merge(
|
||||
array(
|
||||
new formSelectOption('-',''),
|
||||
new formSelectOption(__('(No cat)'),'NULL')),
|
||||
new formSelectOption(__('(No cat)'),'NULL')),
|
||||
dcAdminCombos::getCategoriesCombo($categories,false)
|
||||
);
|
||||
$categories_values = array();
|
||||
|
@ -63,18 +63,18 @@ if (!$core->error->flag())
|
|||
$categories_values[$cat->value]=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$status_combo = array_merge(
|
||||
array('-' => ''),
|
||||
dcAdminCombos::getPostStatusesCombo()
|
||||
dcAdminCombos::getPostStatusesCombo()
|
||||
);
|
||||
|
||||
|
||||
$selected_combo = array(
|
||||
'-' => '',
|
||||
__('Selected') => '1',
|
||||
__('Not selected') => '0'
|
||||
);
|
||||
|
||||
|
||||
$attachment_combo = array(
|
||||
'-' => '',
|
||||
__('With attachments') => '1',
|
||||
|
@ -86,12 +86,12 @@ if (!$core->error->flag())
|
|||
array('-' => ''),
|
||||
dcAdminCombos::getDatesCombo($dates)
|
||||
);
|
||||
|
||||
|
||||
$lang_combo = array_merge(
|
||||
array('-' => ''),
|
||||
dcAdminCombos::getLangsCombo($langs,false)
|
||||
dcAdminCombos::getLangsCombo($langs,false)
|
||||
);
|
||||
|
||||
|
||||
$sortby_combo = array(
|
||||
__('Date') => 'post_dt',
|
||||
__('Title') => 'post_title',
|
||||
|
@ -102,7 +102,7 @@ if (!$core->error->flag())
|
|||
__('Number of comments') => 'nb_comment',
|
||||
__('Number of trackbacks') => 'nb_trackback'
|
||||
);
|
||||
|
||||
|
||||
$order_combo = array(
|
||||
__('Descending') => 'desc',
|
||||
__('Ascending') => 'asc'
|
||||
|
@ -209,7 +209,7 @@ if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
|
|||
} else {
|
||||
$order='desc';
|
||||
}
|
||||
|
||||
|
||||
if ($sortby != 'post_dt' || $order != 'desc') {
|
||||
$show_filters = true;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ if (!$core->error->flag())
|
|||
'<p><label for="status" class="ib">'.__('Status:').'</label> ' .
|
||||
form::combo('status',$status_combo,$status).'</p> '.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="cell filters-sibling-cell">'.
|
||||
'<p><label for="selected" class="ib">'.__('Selected:').'</label> '.
|
||||
form::combo('selected',$selected_combo,$selected).'</p>'.
|
||||
|
@ -282,7 +282,7 @@ if (!$core->error->flag())
|
|||
'<p><label for="lang" class="ib">'.__('Lang:').'</label> '.
|
||||
form::combo('lang',$lang_combo,$lang).'</p> '.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<div class="cell filters-options">'.
|
||||
'<h4>'.__('Display options').'</h4>'.
|
||||
'<p><label for="sortby" class="ib">'.__('Order by:').'</label> '.
|
||||
|
@ -298,16 +298,16 @@ if (!$core->error->flag())
|
|||
'<p><input type="submit" value="'.__('Apply filters and display options').'" />'.
|
||||
'<br class="clear" /></p>'. //Opera sucks
|
||||
'</form>';
|
||||
|
||||
|
||||
# Show posts
|
||||
$post_list->display($page,$nb_per_page,
|
||||
'<form action="posts.php" method="post" id="form-entries">'.
|
||||
|
||||
|
||||
'%s'.
|
||||
|
||||
|
||||
'<div class="two-cols">'.
|
||||
'<p class="col checkboxes-helpers"></p>'.
|
||||
|
||||
|
||||
'<p class="col right"><label for="action" class="classic">'.__('Selected entries action:').'</label> '.
|
||||
form::combo('action',$posts_actions_page->getCombo()).
|
||||
'<input type="submit" value="'.__('ok').'" /></p>'.
|
||||
|
@ -331,5 +331,3 @@ if (!$core->error->flag())
|
|||
|
||||
dcPage::helpBlock('core_posts');
|
||||
dcPage::close();
|
||||
|
||||
?>
|
||||
|
|
|
@ -32,5 +32,3 @@ if (isset($_REQUEST['redir'])) {
|
|||
$posts_actions_page = new dcPostsActionsPage($core,$uri,$args);
|
||||
$posts_actions_page->setEnableRedirSelection(false);
|
||||
$posts_actions_page->process();
|
||||
|
||||
?>
|
|
@ -46,8 +46,8 @@ $user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ? $c
|
|||
|
||||
$default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile';
|
||||
|
||||
if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) ||
|
||||
!empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) ||
|
||||
if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) ||
|
||||
!empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) ||
|
||||
!empty($_GET['db-updated'])) {
|
||||
$default_tab = 'user-favorites';
|
||||
} elseif (!empty($_GET['updated'])) {
|
||||
|
@ -83,13 +83,13 @@ if (isset($_POST['user_name']))
|
|||
try
|
||||
{
|
||||
$pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd']));
|
||||
|
||||
|
||||
if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) {
|
||||
throw new Exception(__('If you want to change your email or password you must provide your current password.'));
|
||||
}
|
||||
|
||||
|
||||
$cur = $core->con->openCursor($core->prefix.'user');
|
||||
|
||||
|
||||
$cur->user_name = $user_name = $_POST['user_name'];
|
||||
$cur->user_firstname = $user_firstname = $_POST['user_firstname'];
|
||||
$cur->user_displayname = $user_displayname = $_POST['user_displayname'];
|
||||
|
@ -99,29 +99,29 @@ if (isset($_POST['user_name']))
|
|||
$cur->user_tz = $user_tz = $_POST['user_tz'];
|
||||
|
||||
$cur->user_options = new ArrayObject($user_options);
|
||||
|
||||
|
||||
if ($core->auth->allowPassChange() && !empty($_POST['new_pwd']))
|
||||
{
|
||||
if (!$pwd_check) {
|
||||
throw new Exception(__('If you want to change your email or password you must provide your current password.'));
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['new_pwd'] != $_POST['new_pwd_c']) {
|
||||
throw new Exception(__("Passwords don't match"));
|
||||
}
|
||||
|
||||
|
||||
$cur->user_pwd = $_POST['new_pwd'];
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeUserUpdate
|
||||
$core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID());
|
||||
|
||||
|
||||
# Udate user
|
||||
$core->updUser($core->auth->userID(),$cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterUserUpdate
|
||||
$core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID());
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Personal information has been successfully updated.'));
|
||||
|
||||
http::redirect('preferences.php');
|
||||
|
@ -133,12 +133,12 @@ if (isset($_POST['user_name']))
|
|||
}
|
||||
|
||||
# Update user options
|
||||
if (isset($_POST['user_post_format']))
|
||||
if (isset($_POST['user_post_format']))
|
||||
{
|
||||
try
|
||||
{
|
||||
$cur = $core->con->openCursor($core->prefix.'user');
|
||||
|
||||
|
||||
$cur->user_name = $user_name;
|
||||
$cur->user_firstname = $user_firstname;
|
||||
$cur->user_displayname = $user_displayname;
|
||||
|
@ -148,19 +148,19 @@ if (isset($_POST['user_post_format']))
|
|||
$cur->user_tz = $user_tz;
|
||||
|
||||
$cur->user_post_status = $user_post_status = $_POST['user_post_status'];
|
||||
|
||||
|
||||
$user_options['edit_size'] = (integer) $_POST['user_edit_size'];
|
||||
if ($user_options['edit_size'] < 1) {
|
||||
$user_options['edit_size'] = 10;
|
||||
}
|
||||
$user_options['post_format'] = $_POST['user_post_format'];
|
||||
$user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']);
|
||||
|
||||
|
||||
$cur->user_options = new ArrayObject($user_options);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeUserOptionsUpdate
|
||||
$core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID());
|
||||
|
||||
|
||||
# Update user prefs
|
||||
$core->auth->user_prefs->accessibility->put('nodragdrop',!empty($_POST['user_acc_nodragdrop']),'boolean');
|
||||
$core->auth->user_prefs->interface->put('enhanceduploader',!empty($_POST['user_ui_enhanceduploader']),'boolean');
|
||||
|
@ -169,13 +169,13 @@ if (isset($_POST['user_post_format']))
|
|||
$core->auth->user_prefs->interface->put('hide_std_favicon',!empty($_POST['user_ui_hide_std_favicon']),'boolean',null,true,true);
|
||||
}
|
||||
$core->auth->user_prefs->interface->put('media_by_page',(integer)$_POST['user_ui_media_by_page'],'integer');
|
||||
|
||||
|
||||
# Udate user
|
||||
$core->updUser($core->auth->userID(),$cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterUserOptionsUpdate
|
||||
$core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID());
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Personal options has been successfully updated.'));
|
||||
http::redirect('preferences.php#user-options');
|
||||
}
|
||||
|
@ -191,17 +191,17 @@ if (isset($_POST['db-options'])) {
|
|||
{
|
||||
# --BEHAVIOR-- adminBeforeUserOptionsUpdate
|
||||
$core->callBehavior('adminBeforeDashboardOptionsUpdate',$core->auth->userID());
|
||||
|
||||
|
||||
# Update user prefs
|
||||
$core->auth->user_prefs->dashboard->put('doclinks',!empty($_POST['user_dm_doclinks']),'boolean');
|
||||
$core->auth->user_prefs->dashboard->put('dcnews',!empty($_POST['user_dm_dcnews']),'boolean');
|
||||
$core->auth->user_prefs->dashboard->put('quickentry',!empty($_POST['user_dm_quickentry']),'boolean');
|
||||
$core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : ''));
|
||||
$core->auth->user_prefs->interface->put('nofavmenu',empty($_POST['user_ui_nofavmenu']),'boolean');
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterUserOptionsUpdate
|
||||
$core->callBehavior('adminAfterDashboardOptionsUpdate',$core->auth->userID());
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('Dashboard options has been successfully updated.'));
|
||||
http::redirect('preferences.php#user-favorites');
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ if (isset($_POST['db-options'])) {
|
|||
}
|
||||
|
||||
# Add selected favorites
|
||||
if (!empty($_POST['appendaction']))
|
||||
if (!empty($_POST['appendaction']))
|
||||
{
|
||||
try {
|
||||
if (empty($_POST['append'])) {
|
||||
|
@ -279,7 +279,7 @@ if (!empty($_POST['saveorder']) && !empty($order))
|
|||
if (!$core->favs->exists($v)) {
|
||||
unset($order[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$core->favs->setFavoriteIDs($order,false);
|
||||
if (!$core->error->flag()) {
|
||||
dcPage::addSuccessNotice(__('Favorites have been successfully updated.'));
|
||||
|
@ -319,7 +319,7 @@ dcPage::open($page_title,
|
|||
"</script>\n".
|
||||
dcPage::jsPageTabs($default_tab).
|
||||
dcPage::jsConfirmClose('user-form').
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminPreferencesHeaders
|
||||
$core->callBehavior('adminPreferencesHeaders'),
|
||||
|
||||
|
@ -385,7 +385,7 @@ if ($core->auth->allowPassChange())
|
|||
{
|
||||
echo
|
||||
'<h4 class="vertical-separator pretty-title">'.__('Change my password').'</h4>'.
|
||||
|
||||
|
||||
'<div class="pw-table">'.
|
||||
'<p class="pw-cell"><label for="new_pwd">'.__('New password:').'</label>'.
|
||||
form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" ').'</p>'.
|
||||
|
@ -394,10 +394,10 @@ if ($core->auth->allowPassChange())
|
|||
' <p class="label no-margin"></p>'.
|
||||
'</div>'.
|
||||
'</div>'.
|
||||
|
||||
|
||||
'<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'.
|
||||
form::password('new_pwd_c',20,255).'</p>'.
|
||||
|
||||
|
||||
'<p><label for="cur_pwd">'.__('Your current password:').'</label>'.
|
||||
form::password('cur_pwd',20,255).'</p>'.
|
||||
'<p class="form-note warn">'.
|
||||
|
@ -588,7 +588,7 @@ form::checkbox('user_ui_nofavmenu',1,!$user_ui_nofavmenu).' '.
|
|||
__('Display favorites at the top of the menu').'</label></p></div>';
|
||||
|
||||
if (count($iconsets_combo) > 1) {
|
||||
echo
|
||||
echo
|
||||
'<div class="fieldset">'.
|
||||
'<h4>'.__('Dashboard icons').'</h4>'.
|
||||
'<p><label for="user_ui_iconset" class="classic">'.__('Iconset:').'</label> '.
|
||||
|
@ -630,4 +630,3 @@ echo '</div>'; # /multipart-user-favorites
|
|||
|
||||
dcPage::helpBlock('core_user_pref');
|
||||
dcPage::close();
|
||||
?>
|
||||
|
|
|
@ -29,17 +29,17 @@ $nb_per_page = 30;
|
|||
if ($q)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
|
||||
# Get posts
|
||||
if ($qtype == 'p')
|
||||
{
|
||||
$starting_scripts .= dcPage::jsLoad('js/_posts_list.js');
|
||||
|
||||
|
||||
$params['search'] = $q;
|
||||
$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
|
||||
$params['no_content'] = true;
|
||||
$params['order'] = 'post_dt DESC';
|
||||
|
||||
|
||||
try {
|
||||
$posts = $core->blog->getPosts($params);
|
||||
$counter = $core->blog->getPosts($params,true);
|
||||
|
@ -52,12 +52,12 @@ if ($q)
|
|||
elseif ($qtype == 'c')
|
||||
{
|
||||
$starting_scripts .= dcPage::jsLoad('js/_comments.js');
|
||||
|
||||
|
||||
$params['search'] = $q;
|
||||
$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
|
||||
$params['no_content'] = true;
|
||||
$params['order'] = 'comment_dt DESC';
|
||||
|
||||
|
||||
try {
|
||||
$comments = $core->blog->getComments($params);
|
||||
$counter = $core->blog->getComments($params,true);
|
||||
|
@ -103,25 +103,25 @@ echo
|
|||
if ($q && !$core->error->flag())
|
||||
{
|
||||
$redir = html::escapeHTML($_SERVER['REQUEST_URI']);
|
||||
|
||||
|
||||
# Show posts
|
||||
if ($qtype == 'p')
|
||||
{
|
||||
|
||||
|
||||
if ($counter->f(0) > 0) {
|
||||
printf('<h3>'.
|
||||
($counter->f(0) == 1 ? __('%d entry found') : __('%d entries found')).
|
||||
'</h3>',$counter->f(0));
|
||||
}
|
||||
|
||||
|
||||
$post_list->display($page,$nb_per_page,
|
||||
'<form action="search.php" method="post" id="form-entries">'.
|
||||
|
||||
|
||||
'%s'.
|
||||
|
||||
|
||||
'<div class="two-cols">'.
|
||||
'<p class="col checkboxes-helpers"></p>'.
|
||||
|
||||
|
||||
'<p class="col right"><label for="action1" class="classic">'.__('Selected entries action:').'</label> '.
|
||||
form::combo(array('action','action1'),$posts_actions_page->getCombo()).
|
||||
'<input type="submit" value="'.__('ok').'" /></p>'.
|
||||
|
@ -135,21 +135,21 @@ if ($q && !$core->error->flag())
|
|||
elseif ($qtype == 'c')
|
||||
{
|
||||
# Actions combo box
|
||||
|
||||
|
||||
if ($counter->f(0) > 0) {
|
||||
printf('<h3>'.
|
||||
($counter->f(0) == 1 ? __('%d comment found') : __('%d comments found')).
|
||||
'</h3>',$counter->f(0));
|
||||
}
|
||||
|
||||
|
||||
$comment_list->display($page,$nb_per_page,
|
||||
'<form action="search.php" method="post" id="form-comments">'.
|
||||
|
||||
|
||||
'%s'.
|
||||
|
||||
|
||||
'<div class="two-cols">'.
|
||||
'<p class="col checkboxes-helpers"></p>'.
|
||||
|
||||
|
||||
'<p class="col right"><label for="action2" class="classic">'.__('Selected comments action:').'</label> '.
|
||||
form::combo(array('action','action2'),$comments_actions_page->getCombo()).
|
||||
'<input type="submit" value="'.__('ok').'" /></p>'.
|
||||
|
@ -163,4 +163,3 @@ if ($q && !$core->error->flag())
|
|||
|
||||
dcPage::helpBlock('core_search');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -38,22 +38,22 @@ class dcRestMethods
|
|||
if (empty($get['id'])) {
|
||||
throw new Exception('No post ID');
|
||||
}
|
||||
|
||||
|
||||
$params = array('post_id' => (integer) $get['id']);
|
||||
|
||||
|
||||
if (isset($get['post_type'])) {
|
||||
$params['post_type'] = $get['post_type'];
|
||||
}
|
||||
|
||||
|
||||
$rs = $core->blog->getPosts($params);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('No post for this ID');
|
||||
}
|
||||
|
||||
|
||||
$rsp = new xmlTag('post');
|
||||
$rsp->id = $rs->post_id;
|
||||
|
||||
|
||||
$rsp->blog_id($rs->blog_id);
|
||||
$rsp->user_id($rs->user_id);
|
||||
$rsp->cat_id($rs->cat_id);
|
||||
|
@ -82,10 +82,10 @@ class dcRestMethods
|
|||
$rsp->user_url($rs->user_url);
|
||||
$rsp->cat_title($rs->cat_title);
|
||||
$rsp->cat_url($rs->cat_url);
|
||||
|
||||
|
||||
$rsp->post_display_content($rs->getContent(true));
|
||||
$rsp->post_display_excerpt($rs->getExcerpt(true));
|
||||
|
||||
|
||||
$metaTag = new xmlTag('meta');
|
||||
if (($meta = @unserialize($rs->post_meta)) !== false)
|
||||
{
|
||||
|
@ -97,25 +97,25 @@ class dcRestMethods
|
|||
}
|
||||
}
|
||||
$rsp->post_meta($metaTag);
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function getCommentById($core,$get)
|
||||
{
|
||||
if (empty($get['id'])) {
|
||||
throw new Exception('No comment ID');
|
||||
}
|
||||
|
||||
|
||||
$rs = $core->blog->getComments(array('comment_id' => (integer) $get['id']));
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('No comment for this ID');
|
||||
}
|
||||
|
||||
|
||||
$rsp = new xmlTag('post');
|
||||
$rsp->id = $rs->comment_id;
|
||||
|
||||
|
||||
$rsp->comment_dt($rs->comment_dt);
|
||||
$rsp->comment_upddt($rs->comment_upddt);
|
||||
$rsp->comment_author($rs->comment_author);
|
||||
|
@ -128,40 +128,40 @@ class dcRestMethods
|
|||
$rsp->post_id($rs->post_id);
|
||||
$rsp->post_dt($rs->post_dt);
|
||||
$rsp->user_id($rs->user_id);
|
||||
|
||||
|
||||
$rsp->comment_display_content($rs->getContent(true));
|
||||
|
||||
|
||||
if ($core->auth->userID()) {
|
||||
$rsp->comment_ip($rs->comment_ip);
|
||||
$rsp->comment_email($rs->comment_email);
|
||||
$rsp->comment_spam_disp(dcAntispam::statusMessage($rs));
|
||||
}
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function quickPost($core,$get,$post)
|
||||
{
|
||||
# Create category
|
||||
if (!empty($post['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) {
|
||||
|
||||
|
||||
$cur_cat = $core->con->openCursor($core->prefix.'category');
|
||||
$cur_cat->cat_title = $post['new_cat_title'];
|
||||
$cur_cat->cat_url = '';
|
||||
|
||||
|
||||
$parent_cat = !empty($post['new_cat_parent']) ? $post['new_cat_parent'] : '';
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeCategoryCreate
|
||||
$core->callBehavior('adminBeforeCategoryCreate', $cur_cat);
|
||||
|
||||
|
||||
$post['cat_id'] = $core->blog->addCategory($cur_cat, (integer) $parent_cat);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterCategoryCreate
|
||||
$core->callBehavior('adminAfterCategoryCreate', $cur_cat, $post['cat_id']);
|
||||
}
|
||||
|
||||
|
||||
$cur = $core->con->openCursor($core->prefix.'post');
|
||||
|
||||
|
||||
$cur->post_title = !empty($post['post_title']) ? $post['post_title'] : '';
|
||||
$cur->user_id = $core->auth->userID();
|
||||
$cur->post_content = !empty($post['post_content']) ? $post['post_content'] : '';
|
||||
|
@ -171,113 +171,113 @@ class dcRestMethods
|
|||
$cur->post_status = !empty($post['post_status']) ? (integer) $post['post_status'] : 0;
|
||||
$cur->post_open_comment = (integer) $core->blog->settings->system->allow_comments;
|
||||
$cur->post_open_tb = (integer) $core->blog->settings->system->allow_trackbacks;
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforePostCreate
|
||||
$core->callBehavior('adminBeforePostCreate',$cur);
|
||||
|
||||
|
||||
$return_id = $core->blog->addPost($cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterPostCreate
|
||||
$core->callBehavior('adminAfterPostCreate',$cur,$return_id);
|
||||
|
||||
|
||||
$rsp = new xmlTag('post');
|
||||
$rsp->id = $return_id;
|
||||
|
||||
|
||||
$post = $core->blog->getPosts(array('post_id' => $return_id));
|
||||
|
||||
|
||||
$rsp->post_status = $post->post_status;
|
||||
$rsp->post_url = $post->getURL();
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function validatePostMarkup($core,$get,$post)
|
||||
{
|
||||
if (!isset($post['excerpt'])) {
|
||||
throw new Exception('No entry excerpt');
|
||||
}
|
||||
|
||||
|
||||
if (!isset($post['content'])) {
|
||||
throw new Exception('No entry content');
|
||||
}
|
||||
|
||||
|
||||
if (empty($post['format'])) {
|
||||
throw new Exception('No entry format');
|
||||
}
|
||||
|
||||
|
||||
if (!isset($post['lang'])) {
|
||||
throw new Exception('No entry lang');
|
||||
}
|
||||
|
||||
|
||||
$excerpt = $post['excerpt'];
|
||||
$excerpt_xhtml = '';
|
||||
$content = $post['content'];
|
||||
$content_xhtml = '';
|
||||
$format = $post['format'];
|
||||
$lang = $post['lang'];
|
||||
|
||||
|
||||
$core->blog->setPostContent(0,$format,$lang,$excerpt,$excerpt_xhtml,$content,$content_xhtml);
|
||||
|
||||
|
||||
$rsp = new xmlTag('result');
|
||||
|
||||
|
||||
$v = htmlValidator::validate($excerpt_xhtml.$content_xhtml);
|
||||
|
||||
|
||||
$rsp->valid($v['valid']);
|
||||
$rsp->errors($v['errors']);
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function getZipMediaContent($core,$get,$post)
|
||||
{
|
||||
if (empty($get['id'])) {
|
||||
throw new Exception('No media ID');
|
||||
}
|
||||
|
||||
|
||||
$id = (integer) $get['id'];
|
||||
|
||||
|
||||
if (!$core->auth->check('media,media_admin',$core->blog)) {
|
||||
throw new Exception('Permission denied');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$core->media = new dcMedia($core);
|
||||
$file = $core->media->getFile($id);
|
||||
} catch (Exception $e) {}
|
||||
|
||||
|
||||
if ($file === null || $file->type != 'application/zip' || !$file->editable) {
|
||||
throw new Exception('Not a valid file');
|
||||
}
|
||||
|
||||
|
||||
$rsp = new xmlTag('result');
|
||||
$content = $core->media->getZipContent($file);
|
||||
|
||||
|
||||
foreach ($content as $k => $v) {
|
||||
$rsp->file($k);
|
||||
}
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function getMeta($core,$get)
|
||||
{
|
||||
$postid = !empty($get['postId']) ? $get['postId'] : null;
|
||||
$limit = !empty($get['limit']) ? $get['limit'] : null;
|
||||
$metaId = !empty($get['metaId']) ? $get['metaId'] : null;
|
||||
$metaType = !empty($get['metaType']) ? $get['metaType'] : null;
|
||||
|
||||
|
||||
$sortby = !empty($get['sortby']) ? $get['sortby'] : 'meta_type,asc';
|
||||
|
||||
|
||||
$rs = $core->meta->getMetadata(array(
|
||||
'meta_type' => $metaType,
|
||||
'limit' => $limit,
|
||||
'meta_id' => $metaId,
|
||||
'post_id' => $postid));
|
||||
$rs = $core->meta->computeMetaStats($rs);
|
||||
|
||||
|
||||
$sortby = explode(',',$sortby);
|
||||
$sort = $sortby[0];
|
||||
$order = isset($sortby[1]) ? $sortby[1] : 'asc';
|
||||
|
||||
|
||||
switch ($sort) {
|
||||
case 'metaId':
|
||||
$sort = 'meta_id_lower';
|
||||
|
@ -291,11 +291,11 @@ class dcRestMethods
|
|||
default:
|
||||
$sort = 'meta_type';
|
||||
}
|
||||
|
||||
|
||||
$rs->sort($sort,$order);
|
||||
|
||||
|
||||
$rsp = new xmlTag();
|
||||
|
||||
|
||||
while ($rs->fetch())
|
||||
{
|
||||
$metaTag = new xmlTag('meta');
|
||||
|
@ -305,27 +305,27 @@ class dcRestMethods
|
|||
$metaTag->percent = $rs->percent;
|
||||
$metaTag->roundpercent = $rs->roundpercent;
|
||||
$metaTag->CDATA($rs->meta_id);
|
||||
|
||||
|
||||
$rsp->insertNode($metaTag);
|
||||
}
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function setPostMeta($core,$get,$post)
|
||||
{
|
||||
if (empty($post['postId'])) {
|
||||
throw new Exception('No post ID');
|
||||
}
|
||||
|
||||
|
||||
if (empty($post['meta']) && $post['meta'] != '0') {
|
||||
throw new Exception('No meta');
|
||||
}
|
||||
|
||||
|
||||
if (empty($post['metaType'])) {
|
||||
throw new Exception('No meta type');
|
||||
}
|
||||
|
||||
|
||||
# Get previous meta for post
|
||||
$post_meta = $core->meta->getMetadata(array(
|
||||
'meta_type' => $post['metaType'],
|
||||
|
@ -334,50 +334,50 @@ class dcRestMethods
|
|||
while ($post_meta->fetch()) {
|
||||
$pm[] = $post_meta->meta_id;
|
||||
}
|
||||
|
||||
|
||||
foreach ($core->meta->splitMetaValues($post['meta']) as $m)
|
||||
{
|
||||
if (!in_array($m,$pm)) {
|
||||
$core->meta->setPostMeta($post['postId'],$post['metaType'],$m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function delMeta($core,$get,$post)
|
||||
{
|
||||
if (empty($post['postId'])) {
|
||||
throw new Exception('No post ID');
|
||||
}
|
||||
|
||||
|
||||
if (empty($post['metaId']) && $post['metaId'] != '0') {
|
||||
throw new Exception('No meta ID');
|
||||
}
|
||||
|
||||
|
||||
if (empty($post['metaType'])) {
|
||||
throw new Exception('No meta type');
|
||||
}
|
||||
|
||||
|
||||
$core->meta->delPostMeta($post['postId'],$post['metaType'],$post['metaId']);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function searchMeta($core,$get)
|
||||
{
|
||||
$q = !empty($get['q']) ? $get['q'] : null;
|
||||
$metaType = !empty($get['metaType']) ? $get['metaType'] : null;
|
||||
|
||||
|
||||
$sortby = !empty($get['sortby']) ? $get['sortby'] : 'meta_type,asc';
|
||||
|
||||
|
||||
$rs = $core->meta->getMetadata(array('meta_type' => $metaType));
|
||||
$rs = $core->meta->computeMetaStats($rs);
|
||||
|
||||
|
||||
$sortby = explode(',',$sortby);
|
||||
$sort = $sortby[0];
|
||||
$order = isset($sortby[1]) ? $sortby[1] : 'asc';
|
||||
|
||||
|
||||
switch ($sort) {
|
||||
case 'metaId':
|
||||
$sort = 'meta_id_lower';
|
||||
|
@ -391,11 +391,11 @@ class dcRestMethods
|
|||
default:
|
||||
$sort = 'meta_type';
|
||||
}
|
||||
|
||||
|
||||
$rs->sort($sort,$order);
|
||||
|
||||
|
||||
$rsp = new xmlTag();
|
||||
|
||||
|
||||
while ($rs->fetch())
|
||||
{
|
||||
if (preg_match('/'.$q.'/i',$rs->meta_id)) {
|
||||
|
@ -406,14 +406,14 @@ class dcRestMethods
|
|||
$metaTag->percent = $rs->percent;
|
||||
$metaTag->roundpercent = $rs->roundpercent;
|
||||
$metaTag->CDATA($rs->meta_id);
|
||||
|
||||
|
||||
$rsp->insertNode($metaTag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
|
||||
public static function setSectionFold($core,$get,$post)
|
||||
{
|
||||
if (empty($post['section'])) {
|
||||
|
@ -433,16 +433,16 @@ class dcRestMethods
|
|||
if ($status) { // true == Fold section ==> remove it from unfolded list
|
||||
if ($k !== false) {
|
||||
unset($toggles[$k]);
|
||||
}
|
||||
}
|
||||
} else { // false == unfold section ==> add it to unfolded list
|
||||
if ($k === false) {
|
||||
$toggles[]=$section;
|
||||
};
|
||||
};
|
||||
}
|
||||
$core->auth->user_prefs->toggles->put('unfolded_sections',join(',',$toggles));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function getModuleById($core, $get, $post)
|
||||
{
|
||||
if (empty($get['id'])) {
|
||||
|
@ -465,7 +465,7 @@ class dcRestMethods
|
|||
}
|
||||
elseif ($list == 'plugin-new') {
|
||||
$store = new dcStore(
|
||||
$core->plugins,
|
||||
$core->plugins,
|
||||
$core->blog->settings->system->store_plugin_url
|
||||
);
|
||||
$store->check();
|
||||
|
@ -496,4 +496,3 @@ class dcRestMethods
|
|||
return $rsp;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -33,4 +33,4 @@ th.date-picker-year {
|
|||
}
|
||||
.date-picker-today {
|
||||
background: #ccc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ body {
|
|||
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -468,9 +468,9 @@ a:focus, a:focus img {
|
|||
/* ----------------------------------------------------------------------------
|
||||
FORMULAIRES
|
||||
---------------------------------------------------------------------------- */
|
||||
input[type=text], input[type=password], input[type=submit],
|
||||
input[type=text], input[type=password], input[type=submit],
|
||||
input[type=button], input[type=reset], a.button, button, textarea, select, legend {
|
||||
border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
max-width: 100%;
|
||||
}
|
||||
form {
|
||||
|
@ -696,7 +696,7 @@ input[type=submit]:hover, input[type=submit]:focus,
|
|||
}
|
||||
/* suppression, reset, "neutres" fond gris */
|
||||
button, input[type=button], input.button,
|
||||
input[type=reset], input[type=submit].reset, input.reset,
|
||||
input[type=reset], input[type=submit].reset, input.reset,
|
||||
input[type=submit].delete, input.delete,
|
||||
a.button, a.button.delete, a.button.reset {
|
||||
color: #000;
|
||||
|
@ -709,8 +709,8 @@ input[type=submit].delete, input.delete,
|
|||
}
|
||||
button:hover, input[type=button]:hover, input.button:hover,
|
||||
button:focus, input[type=button]:focus, input.button:focus,
|
||||
input[type=reset]:hover, input[type=submit].reset:hover, input.reset:hover,
|
||||
input[type=reset]:focus, input[type=submit].reset:focus, input.reset:focus,
|
||||
input[type=reset]:hover, input[type=submit].reset:hover, input.reset:hover,
|
||||
input[type=reset]:focus, input[type=submit].reset:focus, input.reset:focus,
|
||||
input[type=submit].delete:hover, input.delete:hover,
|
||||
input[type=submit].delete:focus, input.delete:focus,
|
||||
a.button.delete:hover, a.button.reset:hover, a.button:hover,
|
||||
|
@ -1504,7 +1504,7 @@ a.form-control.open {
|
|||
}
|
||||
#icons a:focus {
|
||||
outline: 0;
|
||||
border-color: #fff;
|
||||
border-color: #fff;
|
||||
}
|
||||
#icons a:hover span, #icons a:focus span {
|
||||
border-bottom-style: solid;
|
||||
|
@ -1693,7 +1693,7 @@ span.module-version:before {
|
|||
Les screenshots des thèmes ont deux tailles possibles :
|
||||
- dans Ajouter des thèmes : 240px (+ 10 padding image + 20 padding boîte + 6 bordure + 2 ombrage = 278)
|
||||
- dans Thèmes installés : 280px (+ 10 padding-image + 20 padding-boîte + 2 ombrage = 318)
|
||||
On adapte largeur et hauteur en fonction
|
||||
On adapte largeur et hauteur en fonction
|
||||
*/
|
||||
#theme-new .box.theme, #theme-update .box.theme { /* Ajouter un thème */
|
||||
width: 278px;
|
||||
|
@ -1936,7 +1936,7 @@ li.media-action input {
|
|||
text-align: right;
|
||||
}
|
||||
/* upload multiple */
|
||||
.enhanced_uploader .choose_files, .enhanced_uploader .cancel,
|
||||
.enhanced_uploader .choose_files, .enhanced_uploader .cancel,
|
||||
.enhanced_uploader .clean, .enhanced_uploader .start {
|
||||
margin-right: .4em;
|
||||
}
|
||||
|
@ -2598,27 +2598,27 @@ input[type=submit].delete.debug:hover, a.delete.debug:hover {
|
|||
color: #900;
|
||||
border-color: #ffd478;
|
||||
}
|
||||
/* ---------------------------------------------- Couleurs ajoutées via javascript
|
||||
/* ---------------------------------------------- Couleurs ajoutées via javascript
|
||||
/* color-picker.js */
|
||||
.color-color-picker {
|
||||
.color-color-picker {
|
||||
border: 1px solid #000;
|
||||
width: 195px;
|
||||
background: #fff;
|
||||
width: 195px;
|
||||
background: #fff;
|
||||
}
|
||||
/* _media_item.js */
|
||||
.color-div {
|
||||
.color-div {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
/* fadings ('color' est utilisé comme variable, pas comme text color) */
|
||||
.colorBeginPassword,
|
||||
.colorBeginValidatorErr,
|
||||
.colorBeginPassword,
|
||||
.colorBeginValidatorErr,
|
||||
.colorBeginUserMail { color: #fff; }
|
||||
.colorEndPassword,
|
||||
.colorEndError,
|
||||
.colorEndValidatorErr,
|
||||
.colorEndPassword,
|
||||
.colorEndError,
|
||||
.colorEndValidatorErr,
|
||||
.colorEndUserMail { color: #ffbaba; }
|
||||
.colorBeginMessage { color: #ccc; }
|
||||
.colorEndMessage,
|
||||
.colorEndMessage,
|
||||
.colorBeginValidatorMsg { color: #676e78; }
|
||||
.colorBeginError { color: #fefacd; }
|
||||
.colorBeginSuccess { color: #9BCA1C; }
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
width: 17px;
|
||||
height: 17px;
|
||||
margin: -8px 0 0 -8px;
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
background: url(marker.png) no-repeat;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
loader.css
|
||||
Simple CSS rules for NetInstall
|
||||
|
||||
|
||||
(c) 2008 - Olivier Meunier & contributors - All rights reserved.
|
||||
Please see http://dotclear.net/ for more details.
|
||||
*/
|
||||
|
@ -196,4 +196,4 @@ input[type=submit]:focus {
|
|||
.pw-very-strong .bar {
|
||||
background: #0c0;
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
.jstEditor textarea, .jstEditor iframe {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
border: 1px solid #fbfbfb;
|
||||
width: 100%;
|
||||
|
@ -29,12 +29,12 @@
|
|||
.jstElements {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding: 0 32px 0 1rem;
|
||||
box-sizing: border-box;
|
||||
padding: 0 32px 0 1rem;
|
||||
border: 1px solid #dfdfdf;
|
||||
overflow: hidden;
|
||||
background: #f5f5f5;
|
||||
border-radius: 4px 4px 0 0;
|
||||
overflow: hidden;
|
||||
background: #f5f5f5;
|
||||
border-radius: 4px 4px 0 0;
|
||||
position: relative;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
|||
.jstElements select {
|
||||
width: 12em;
|
||||
margin-right: .6rem;
|
||||
border: 1px solid #ddd;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.jstElements button {
|
||||
width: 30px;
|
||||
|
@ -63,7 +63,7 @@
|
|||
background-color: #fff;
|
||||
}
|
||||
.jstElements button span {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
.jstElements span {
|
||||
display : inline-block;
|
||||
|
@ -181,4 +181,4 @@ body.wysiwygDoc {
|
|||
}
|
||||
body.wysiwygDoc > p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,4 +49,4 @@ a.jq-modal-next {
|
|||
}
|
||||
a.jq-modal-prev {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ if (!empty($_REQUEST['id']))
|
|||
{
|
||||
try {
|
||||
$rs = $core->getUser($_REQUEST['id']);
|
||||
|
||||
|
||||
$user_id = $rs->user_id;
|
||||
$user_super = $rs->user_super;
|
||||
$user_pwd = $rs->user_pwd;
|
||||
|
@ -57,9 +57,9 @@ if (!empty($_REQUEST['id']))
|
|||
$user_lang = $rs->user_lang;
|
||||
$user_tz = $rs->user_tz;
|
||||
$user_post_status = $rs->user_post_status;
|
||||
|
||||
|
||||
$user_options = array_merge($user_options,$rs->options());
|
||||
|
||||
|
||||
$page_title = $user_id;
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
|
@ -74,9 +74,9 @@ if (isset($_POST['user_name']))
|
|||
if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) {
|
||||
throw new Exception(__('Password verification failed'));
|
||||
}
|
||||
|
||||
|
||||
$cur = $core->con->openCursor($core->prefix.'user');
|
||||
|
||||
|
||||
$cur->user_id = $_POST['user_id'];
|
||||
$cur->user_super = $user_super = !empty($_POST['user_super']) ? 1 : 0;
|
||||
$cur->user_name = $user_name = $_POST['user_name'];
|
||||
|
@ -87,7 +87,7 @@ if (isset($_POST['user_name']))
|
|||
$cur->user_lang = $user_lang = $_POST['user_lang'];
|
||||
$cur->user_tz = $user_tz = $_POST['user_tz'];
|
||||
$cur->user_post_status = $user_post_status = $_POST['user_post_status'];
|
||||
|
||||
|
||||
if ($cur->user_id == $core->auth->userID() && $core->auth->isSuperAdmin()) {
|
||||
// force super_user to true if current user
|
||||
$cur->user_super = $user_super = true;
|
||||
|
@ -95,7 +95,7 @@ if (isset($_POST['user_name']))
|
|||
if ($core->auth->allowPassChange()) {
|
||||
$cur->user_change_pwd = !empty($_POST['user_change_pwd']) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['new_pwd'])) {
|
||||
if ($_POST['new_pwd'] != $_POST['new_pwd_c']) {
|
||||
throw new Exception(__("Passwords don't match"));
|
||||
|
@ -103,32 +103,32 @@ if (isset($_POST['user_name']))
|
|||
$cur->user_pwd = $_POST['new_pwd'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$user_options['post_format'] = $_POST['user_post_format'];
|
||||
$user_options['edit_size'] = (integer) $_POST['user_edit_size'];
|
||||
|
||||
|
||||
if ($user_options['edit_size'] < 1) {
|
||||
$user_options['edit_size'] = 10;
|
||||
}
|
||||
|
||||
|
||||
$cur->user_options = new ArrayObject($user_options);
|
||||
|
||||
|
||||
# Udate user
|
||||
if ($user_id)
|
||||
{
|
||||
# --BEHAVIOR-- adminBeforeUserUpdate
|
||||
$core->callBehavior('adminBeforeUserUpdate',$cur,$user_id);
|
||||
|
||||
|
||||
$new_id = $core->updUser($user_id,$cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterUserUpdate
|
||||
$core->callBehavior('adminAfterUserUpdate',$cur,$new_id);
|
||||
|
||||
|
||||
if ($user_id == $core->auth->userID() &&
|
||||
$user_id != $new_id) {
|
||||
$core->session->destroy();
|
||||
}
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('User has been successfully updated.'));
|
||||
http::redirect('user.php?id='.$new_id);
|
||||
}
|
||||
|
@ -138,15 +138,15 @@ if (isset($_POST['user_name']))
|
|||
if ($core->getUsers(array('user_id' => $cur->user_id),true)->f(0) > 0) {
|
||||
throw new Exception(sprintf(__('User "%s" already exists.'),html::escapeHTML($cur->user_id)));
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeUserCreate
|
||||
$core->callBehavior('adminBeforeUserCreate',$cur);
|
||||
|
||||
|
||||
$new_id = $core->addUser($cur);
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminAfterUserCreate
|
||||
$core->callBehavior('adminAfterUserCreate',$cur,$new_id);
|
||||
|
||||
|
||||
dcPage::addSuccessNotice(__('User has been successfully created.'));
|
||||
if (!empty($_POST['saveplus'])) {
|
||||
http::redirect('user.php');
|
||||
|
@ -179,7 +179,7 @@ dcPage::open($page_title,
|
|||
"});\n".
|
||||
"\n//]]>\n".
|
||||
"</script>\n".
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminUserHeaders
|
||||
$core->callBehavior('adminUserHeaders'),
|
||||
|
||||
|
@ -298,7 +298,7 @@ form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).
|
|||
# --BEHAVIOR-- adminUserForm
|
||||
$core->callBehavior('adminUserForm',isset($rs) ? $rs : null);
|
||||
|
||||
echo
|
||||
echo
|
||||
'</div>'.
|
||||
'</div>';
|
||||
|
||||
|
@ -331,10 +331,10 @@ if ($user_id)
|
|||
$core->formNonce().
|
||||
'</p>'.
|
||||
'</form>';
|
||||
|
||||
|
||||
$permissions = $core->getUserPermissions($user_id);
|
||||
$perm_types = $core->auth->getPermissionsTypes();
|
||||
|
||||
|
||||
if (count($permissions) == 0)
|
||||
{
|
||||
echo '<p>'.__('No permissions so far.').'</p>';
|
||||
|
@ -345,11 +345,11 @@ if ($user_id)
|
|||
{
|
||||
if (count($v['p']) > 0)
|
||||
{
|
||||
echo
|
||||
echo
|
||||
'<form action="users_actions.php" method="post" class="perm-block">'.
|
||||
'<p class="blog-perm">'.__('Blog:').' <a href="blog.php?id='.html::escapeHTML($k).'">'.
|
||||
html::escapeHTML($v['name']).'</a> ('.html::escapeHTML($k).')</p>';
|
||||
|
||||
|
||||
echo '<ul class="ul-perm">';
|
||||
foreach ($v['p'] as $p => $V) {
|
||||
if (isset($perm_types[$p])) {
|
||||
|
@ -368,15 +368,14 @@ if ($user_id)
|
|||
'</form>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<p>'.sprintf(__('%s is super admin (all rights on all blogs).'),'<strong>'.$user_id.'</strong>').'</p>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
dcPage::helpBlock('core_user');
|
||||
dcPage::close();
|
||||
?>
|
||||
|
|
|
@ -70,7 +70,7 @@ if ($sortby !== '' && in_array($sortby,$sortby_combo)) {
|
|||
} else {
|
||||
$order='asc';
|
||||
}
|
||||
|
||||
|
||||
if ($sortby != 'user_id' || $order != 'asc') {
|
||||
$show_filters = true;
|
||||
}
|
||||
|
@ -120,12 +120,12 @@ if (!$core->error->flag())
|
|||
if (!empty($_GET['upd'])) {
|
||||
dcPage::message(__('The permissions have been successfully updated.'));
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p class="top-add"><strong><a class="button add" href="user.php">'.__('New user').'</a></strong></p>'.
|
||||
'<form action="users.php" method="get" id="filters-form">'.
|
||||
'<h3 class="out-of-screen-if-js">'.$form_filter_title.'</h3>'.
|
||||
|
||||
|
||||
'<div class="table">'.
|
||||
'<div class="cell">'.
|
||||
'<h4>'.__('Filters').'</h4>'.
|
||||
|
@ -139,24 +139,24 @@ if (!$core->error->flag())
|
|||
form::combo('sortby',$sortby_combo,$sortby).'</p> '.
|
||||
'<p><label for="order" class="ib">'.__('Sort:').'</label> '.
|
||||
form::combo('order',$order_combo,$order).'</p>'.
|
||||
'<p><span class="label ib">'.__('Show').'</span> <label for="nb" class="classic">'.
|
||||
'<p><span class="label ib">'.__('Show').'</span> <label for="nb" class="classic">'.
|
||||
form::field('nb',3,3,$nb_per_page).' '.__('users per page').'</label></p> '.
|
||||
'</div>'.
|
||||
'</div>'.
|
||||
|
||||
'<p><input type="submit" value="'.__('Apply filters and display options').'" />'.
|
||||
'<p><input type="submit" value="'.__('Apply filters and display options').'" />'.
|
||||
'<br class="clear" /></p>'. //Opera sucks
|
||||
'</form>';
|
||||
|
||||
|
||||
# Show users
|
||||
$user_list->display($page,$nb_per_page,
|
||||
'<form action="users_actions.php" method="post" id="form-users">'.
|
||||
|
||||
|
||||
'%s'.
|
||||
|
||||
|
||||
'<div class="two-cols">'.
|
||||
'<p class="col checkboxes-helpers"></p>'.
|
||||
|
||||
|
||||
'<p class="col right"><label for="action" class="classic">'.
|
||||
__('Selected users action:').' '.
|
||||
form::combo('action',$combo_action).
|
||||
|
@ -176,4 +176,3 @@ if (!$core->error->flag())
|
|||
}
|
||||
dcPage::helpBlock('core_users');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -41,7 +41,7 @@ if (!empty($_POST['blogs']) && is_array($_POST['blogs']))
|
|||
if (!empty($_POST['action']) && !empty($_POST['users']))
|
||||
{
|
||||
$action = $_POST['action'];
|
||||
|
||||
|
||||
if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false)
|
||||
{
|
||||
$redir = $_POST['redir'];
|
||||
|
@ -55,14 +55,14 @@ if (!empty($_POST['action']) && !empty($_POST['users']))
|
|||
'&page='.$_POST['page'].
|
||||
'&nb='.$_POST['nb'];
|
||||
}
|
||||
|
||||
|
||||
if (empty($users)) {
|
||||
$core->error->add(__('No blog or user given.'));
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminUsersActions
|
||||
$core->callBehavior('adminUsersActions',$core,$users,$blogs,$action,$redir);
|
||||
|
||||
|
||||
# Delete users
|
||||
if ($action == 'deleteuser' && !empty($users))
|
||||
{
|
||||
|
@ -73,10 +73,10 @@ if (!empty($_POST['action']) && !empty($_POST['users']))
|
|||
if ($u == $core->auth->userID()) {
|
||||
throw new Exception(__('You cannot delete yourself.'));
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- adminBeforeUserDelete
|
||||
$core->callBehavior('adminBeforeUserDelete',$u);
|
||||
|
||||
|
||||
$core->delUser($u);
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
@ -89,7 +89,7 @@ if (!empty($_POST['action']) && !empty($_POST['users']))
|
|||
http::redirect($redir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Update users perms
|
||||
if ($action == 'updateperm' && !empty($users) && !empty($blogs))
|
||||
{
|
||||
|
@ -98,13 +98,13 @@ if (!empty($_POST['action']) && !empty($_POST['users']))
|
|||
if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) {
|
||||
throw new Exception(__('Password verification failed'));
|
||||
}
|
||||
|
||||
|
||||
foreach ($users as $u)
|
||||
{
|
||||
foreach ($blogs as $b)
|
||||
{
|
||||
$set_perms = array();
|
||||
|
||||
|
||||
if (!empty($_POST['perm'][$b]))
|
||||
{
|
||||
foreach ($_POST['perm'][$b] as $perm_id => $v)
|
||||
|
@ -114,7 +114,7 @@ if (!empty($_POST['action']) && !empty($_POST['users']))
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$core->setUserBlogPermissions($u,$b,$set_perms,true);
|
||||
}
|
||||
}
|
||||
|
@ -192,17 +192,17 @@ if (!empty($users) && empty($blogs) && $action == 'blogs')
|
|||
$rs = $core->getBlogs();
|
||||
$nb_blog = $rs->count();
|
||||
} catch (Exception $e) { }
|
||||
|
||||
|
||||
foreach ($users as $u) {
|
||||
$user_list[] = '<a href="user.php?id='.$u.'">'.$u.'</a>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p>'.sprintf(
|
||||
__('Choose one or more blogs to which you want to give permissions to users %s.'),
|
||||
implode(', ',$user_list)
|
||||
).'</p>';
|
||||
|
||||
|
||||
if ($nb_blog == 0)
|
||||
{
|
||||
echo '<p><strong>'.__('No blog').'</strong></p>';
|
||||
|
@ -218,13 +218,13 @@ if (!empty($users) && empty($blogs) && $action == 'blogs')
|
|||
'<th class="nowrap">'.__('Entries').'</th>'.
|
||||
'<th class="nowrap">'.__('Status').'</th>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
while ($rs->fetch())
|
||||
{
|
||||
$img_status = $rs->blog_status == 1 ? 'check-on' : 'check-off';
|
||||
$txt_status = $core->getBlogStatus($rs->blog_status);
|
||||
$img_status = sprintf('<img src="images/%1$s.png" alt="%2$s" title="%2$s" />',$img_status,$txt_status);
|
||||
|
||||
|
||||
echo
|
||||
'<tr class="line">'.
|
||||
'<td class="nowrap">'.
|
||||
|
@ -235,7 +235,7 @@ if (!empty($users) && empty($blogs) && $action == 'blogs')
|
|||
'<td class="status">'.$img_status.'</td>'.
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'</table></div>'.
|
||||
'<p class="checkboxes-helpers"></p>'.
|
||||
|
@ -251,20 +251,20 @@ elseif (!empty($blogs) && !empty($users) && $action == 'perms')
|
|||
{
|
||||
$user_perm = array();
|
||||
if (count($users) == 1) {
|
||||
$user_perm = $core->getUserPermissions($users[0]);
|
||||
$user_perm = $core->getUserPermissions($users[0]);
|
||||
}
|
||||
|
||||
|
||||
foreach ($users as $u) {
|
||||
$user_list[] = '<a href="user.php?id='.$u.'">'.$u.'</a>';
|
||||
}
|
||||
|
||||
echo
|
||||
|
||||
echo
|
||||
'<p>'.sprintf(
|
||||
__('You are about to change permissions on the following blogs for users %s.'),
|
||||
implode(', ',$user_list)
|
||||
).'</p>'.
|
||||
'<form id="permissions-form" action="users_actions.php" method="post">';
|
||||
|
||||
|
||||
foreach ($blogs as $b)
|
||||
{
|
||||
echo '<h3>'.('Blog:').' <a href="blog.php?id='.html::escapeHTML($b).'">'.html::escapeHTML($b).'</a>'.
|
||||
|
@ -273,14 +273,14 @@ elseif (!empty($blogs) && !empty($users) && $action == 'perms')
|
|||
foreach ($core->auth->getPermissionsTypes() as $perm_id => $perm)
|
||||
{
|
||||
$checked = false;
|
||||
|
||||
|
||||
if (count($users) == 1) {
|
||||
$checked = isset($user_perm[$b]['p'][$perm_id]) && $user_perm[$b]['p'][$perm_id];
|
||||
}
|
||||
if (isset($unknown_perms[$b]['p'][$perm_id])) {
|
||||
unset ($unknown_perms[$b]['p'][$perm_id]);
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<p><label for="perm'.html::escapeHTML($b).html::escapeHTML($perm_id).'" class="classic">'.
|
||||
form::checkbox(array('perm['.html::escapeHTML($b).']['.html::escapeHTML($perm_id).']','perm'.html::escapeHTML($b).html::escapeHTML($perm_id)),
|
||||
|
@ -288,7 +288,7 @@ elseif (!empty($blogs) && !empty($users) && $action == 'perms')
|
|||
__($perm).'</label></p>';
|
||||
}
|
||||
if (isset($unknown_perms[$b])) {
|
||||
|
||||
|
||||
foreach ($unknown_perms[$b]['p'] as $perm_id => $v) {
|
||||
$checked = isset($user_perm[$b]['p'][$perm_id]) && $user_perm[$b]['p'][$perm_id];
|
||||
echo
|
||||
|
@ -301,7 +301,7 @@ elseif (!empty($blogs) && !empty($users) && $action == 'perms')
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
'<div class="fieldset">'.
|
||||
'<h3>'.__('Validate permissions').'</h3>'.
|
||||
|
@ -317,4 +317,3 @@ elseif (!empty($blogs) && !empty($users) && $action == 'perms')
|
|||
|
||||
dcPage::helpBlock('core_users');
|
||||
dcPage::close();
|
||||
?>
|
|
@ -32,4 +32,3 @@ $core->plugins->loadModules(DC_PLUGINS_ROOT);
|
|||
# Start XML-RPC server
|
||||
$server = new dcXmlRpc($core,$blog_id);
|
||||
$server->serve();
|
||||
?>
|
|
@ -5,43 +5,43 @@ class lambdaModule
|
|||
private $deb;
|
||||
private $type;
|
||||
private $today;
|
||||
|
||||
|
||||
private $id;
|
||||
private $package_name;
|
||||
private $name;
|
||||
private $desc;
|
||||
private $author;
|
||||
private $version;
|
||||
|
||||
|
||||
public function __construct($module,$type)
|
||||
{
|
||||
if ($type != 'plugin' && $type != 'theme') {
|
||||
throw new Exception('Invalid module type');
|
||||
}
|
||||
$this->type = $type;
|
||||
|
||||
|
||||
if (!$module || !is_dir($module)) {
|
||||
throw new Exception(sprintf('Module %s does not exist',$module));
|
||||
}
|
||||
|
||||
|
||||
$mod_define = $module.'/_define.php';
|
||||
|
||||
|
||||
if (!is_file($mod_define)) {
|
||||
throw new Exception(sprintf('Module %s does not have _define.php file',$module));
|
||||
}
|
||||
|
||||
|
||||
if (is_dir($module.'/debian')) {
|
||||
throw new Exception(sprintf('Module %s already have a debian directory',$module));
|
||||
}
|
||||
|
||||
|
||||
include $mod_define;
|
||||
$this->id = strtolower(basename(realpath($module)));
|
||||
$this->package_name = 'libdotclear-'.$this->type.'-'.$this->id;
|
||||
|
||||
|
||||
# Creating debian directory
|
||||
$this->deb = $module.'/debian';
|
||||
mkdir($this->deb);
|
||||
|
||||
|
||||
$this->createFile('changelog',$this->changelogTPL());
|
||||
$this->createFile('compat',"4\n");
|
||||
$this->createFile('control',$this->controlTPL());
|
||||
|
@ -50,7 +50,7 @@ class lambdaModule
|
|||
$this->createFile('rules',$this->rulesTPL());
|
||||
chmod($this->deb.'/rules',0755);
|
||||
}
|
||||
|
||||
|
||||
private function registerModule($name,$desc,$author,$version)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
@ -58,14 +58,14 @@ class lambdaModule
|
|||
$this->author = $author;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
|
||||
private function createFile($name,$content='')
|
||||
{
|
||||
$fp = fopen($this->deb.'/'.$name,'wb');
|
||||
fwrite($fp,$content);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
private function changelogTPL()
|
||||
{
|
||||
return
|
||||
|
@ -75,7 +75,7 @@ class lambdaModule
|
|||
"\n".
|
||||
" -- ".$this->author." <email@example.com> ".date('r')."\n\n";
|
||||
}
|
||||
|
||||
|
||||
private function controlTPL()
|
||||
{
|
||||
return
|
||||
|
@ -95,7 +95,7 @@ class lambdaModule
|
|||
" ".$this->desc."\n".
|
||||
"\n";
|
||||
}
|
||||
|
||||
|
||||
private function copyrightTPL()
|
||||
{
|
||||
return
|
||||
|
@ -125,13 +125,13 @@ class lambdaModule
|
|||
"Public License can be found in `/usr/share/common-licenses/GPL'.".
|
||||
"\n";
|
||||
}
|
||||
|
||||
|
||||
private function dirsTPL()
|
||||
{
|
||||
return
|
||||
'/usr/share/dotclear/'.$this->type.'s/'.$this->id."\n";
|
||||
}
|
||||
|
||||
|
||||
private function rulesTPL()
|
||||
{
|
||||
return
|
||||
|
@ -221,4 +221,4 @@ catch (Exception $e)
|
|||
fwrite(STDERR,$e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -288,4 +288,4 @@ class JSMin {
|
|||
|
||||
// -- Exceptions ---------------------------------------------------------------
|
||||
class JSMinException extends Exception {}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -27,7 +27,7 @@ foreach ($eres as $f)
|
|||
{
|
||||
$dest = dirname($f).'/'.basename($f,'.po').'.lang.php';
|
||||
echo "l10n file ".$dest.": ";
|
||||
|
||||
|
||||
if (l10n::generatePhpFileFromPo(dirname($f).'/'.basename($f,'.po'),$license_block)) {
|
||||
echo 'OK';
|
||||
} else {
|
||||
|
@ -35,4 +35,4 @@ foreach ($eres as $f)
|
|||
}
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
try
|
||||
{
|
||||
$js = (!empty($_SERVER['argv'][1])) ? $_SERVER['argv'][1] : null;
|
||||
|
||||
|
||||
if (!$js || !is_file($js)) {
|
||||
throw new Exception(sprintf("File %s does not exist",$js));
|
||||
}
|
||||
|
||||
|
||||
require dirname(__FILE__).'/jsmin-1.1.1.php';
|
||||
|
||||
|
||||
$content = file_get_contents($js);
|
||||
$res = JSMin::minify($content);
|
||||
|
||||
|
||||
if (($fp = fopen($js,'wb')) === false) {
|
||||
throw new Exception(sprintf('Unable to open file %s',$js));
|
||||
}
|
||||
|
@ -35,4 +35,4 @@ catch (Exception $e)
|
|||
fwrite(STDERR,$e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -67,7 +67,7 @@ extract_strings()
|
|||
extract_html_strings()
|
||||
{
|
||||
tee -
|
||||
|
||||
|
||||
$XGETTEXT \
|
||||
- \
|
||||
--sort-by-file \
|
||||
|
@ -83,16 +83,16 @@ update_po()
|
|||
pot_file=$2
|
||||
po_dir=`dirname $1`
|
||||
po_tmp=$po_dir/tmp.po~
|
||||
|
||||
|
||||
if [ ! -d $po_dir ]; then
|
||||
mkdir $po_dir
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f $po_file ]; then
|
||||
cp $pot_file $po_file
|
||||
perl -pi -e "s|; charset=CHARSET|; charset=UTF-8|sgi;" $po_file $po_file
|
||||
fi
|
||||
|
||||
|
||||
$MSGMERGE --no-location --no-wrap -o $po_tmp $po_file $pot_file
|
||||
mv $po_tmp $po_file
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ if [ -z "$PO_MODULE" ]; then
|
|||
--package-name="Dotclear 2" \
|
||||
-o locales/_pot/main.pot \
|
||||
-x locales/_pot/date.pot
|
||||
|
||||
|
||||
echo "DONE"
|
||||
|
||||
|
||||
# plugins.pot
|
||||
echo "Building plugins PO template..."
|
||||
for p in $PLUGINS; do
|
||||
|
@ -122,20 +122,20 @@ if [ -z "$PO_MODULE" ]; then
|
|||
-o locales/_pot/plugins.pot \
|
||||
-x locales/_pot/date.pot \
|
||||
-x locales/_pot/main.pot
|
||||
|
||||
|
||||
echo "DONE"
|
||||
|
||||
|
||||
#
|
||||
# Update locales/<lang> if needed
|
||||
#
|
||||
if [ -z "$PO_LANG" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
|
||||
# Init locale if not present
|
||||
if [ ! -d locales/$PO_LANG ]; then
|
||||
mkdir -p locales/$PO_LANG/help
|
||||
|
||||
|
||||
# Base help files
|
||||
for i in locales/en/help/*.html; do
|
||||
cp $i locales/$PO_LANG/help/core_`basename $i`
|
||||
|
@ -146,7 +146,7 @@ if [ -z "$PO_MODULE" ]; then
|
|||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# update main.po
|
||||
echo "Updating <$PO_LANG> po files..."
|
||||
update_po ./locales/$PO_LANG/main.po ./locales/_pot/main.pot
|
||||
|
@ -157,14 +157,14 @@ else
|
|||
#
|
||||
# Plugin language update
|
||||
#
|
||||
|
||||
|
||||
if [ ! -d $PO_MODULE ]; then
|
||||
echo "Module $PO_MODULE does not exist"
|
||||
exit 1
|
||||
fi
|
||||
echo "Module $PO_MODULE language update"
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Building po template file
|
||||
#
|
||||
|
@ -172,21 +172,21 @@ else
|
|||
mkdir -p $PO_MODULE/locales/_pot
|
||||
fi
|
||||
echo "Building main PO template..."
|
||||
echo '<?php' >$PO_MODULE/__html_tpl_dummy.php
|
||||
echo '<?php' >$PO_MODULE/__html_tpl_dummy.php
|
||||
find $PO_MODULE -name '*.html' -exec grep -o '{{tpl:lang [^}]*}}' {} \; | sed 's/{{tpl:lang \(.*\)}}$/__\("\1")/' | sort -u \
|
||||
>> $PO_MODULE/__html_tpl_dummy.php
|
||||
sed -i "" 's/\$/\\\$/g' $PO_MODULE/__html_tpl_dummy.php
|
||||
|
||||
sed -i "" 's/\$/\\\$/g' $PO_MODULE/__html_tpl_dummy.php
|
||||
|
||||
find $PO_MODULE -name '*.php' -print | \
|
||||
extract_strings \
|
||||
--package-name="Dotclear 2 `basename $PO_MODULE` module" \
|
||||
-o $PO_MODULE/locales/_pot/main.pot \
|
||||
-x locales/_pot/date.pot -x locales/_pot/main.pot -x locales/_pot/public.pot -x locales/_pot/plugins.pot
|
||||
|
||||
|
||||
rm -f $PO_MODULE/__html_tpl_dummy.php
|
||||
|
||||
|
||||
echo "DONE"
|
||||
|
||||
|
||||
#
|
||||
# Update locale/<lang>
|
||||
#
|
||||
|
|
|
@ -19,4 +19,4 @@ Depends: ${misc:Depends}, dotclear (>= 2.0)
|
|||
Description: DotClear 2
|
||||
Dotclear 2 Japanese language pack
|
||||
Dotclear 2 is a blog engine written in PHP 5.
|
||||
More information on http://www.dotclear.org/
|
||||
More information on http://www.dotclear.org/
|
||||
|
|
|
@ -4,31 +4,31 @@
|
|||
class debianChangelog
|
||||
{
|
||||
public $f = 'debian/changelog';
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (!is_file($this->f)) {
|
||||
throw new Exception('No changelog file found');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function readLastRevision()
|
||||
{
|
||||
$f = file($this->f);
|
||||
$res = array();
|
||||
$done = false;
|
||||
|
||||
|
||||
foreach ($f as $v)
|
||||
{
|
||||
$v = rtrim($v,"\n");
|
||||
|
||||
|
||||
# First line of a change
|
||||
if (strpos($v,' ') !== 0 && trim($v) != '')
|
||||
{
|
||||
if ($done) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$done = true;
|
||||
$res = $this->getPackageInfo($v,$res[$i]);
|
||||
}
|
||||
|
@ -43,14 +43,14 @@ class debianChangelog
|
|||
$res['changelog'] .= $v."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public function writeChangelog()
|
||||
{
|
||||
$ch = $this->readLastRevision();
|
||||
|
||||
|
||||
# Get debian revision
|
||||
$rev = 1;
|
||||
if (preg_match('/^(.*)-(\d+)$/',$ch['version'],$m)) {
|
||||
|
@ -58,16 +58,16 @@ class debianChangelog
|
|||
$rev = $m[2];
|
||||
}
|
||||
$rev++;
|
||||
|
||||
|
||||
# Get SVN revision
|
||||
$svnrev = isset($ch['keywords']['svnrev']) ? (integer) $ch['keywords']['svnrev'] : 1;
|
||||
|
||||
|
||||
# Get current SVN revision
|
||||
$currev = svnInfo::getCurrentRevision();
|
||||
if ($currev <= $svnrev) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$changelog = '';
|
||||
$changes = svnInfo::getChangeLog($svnrev+1,$currev);
|
||||
foreach ($changes as $k => $v)
|
||||
|
@ -76,9 +76,9 @@ class debianChangelog
|
|||
' * SVN Revision '.$k.' - '.$v['author'].
|
||||
', on '.date('r',strtotime($v['date']))."\n".
|
||||
' '.trim(preg_replace('/\n/ms',"\n ",$v['msg']))."\n\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$res =
|
||||
$ch['package'].' ('.$ch['version'].'-'.$rev.') '.$ch['dist'].'; urgency='.$ch['keywords']['urgency'].
|
||||
' ; svnrev='.$currev.
|
||||
|
@ -86,13 +86,13 @@ class debianChangelog
|
|||
rtrim($changelog)."\n\n".
|
||||
' -- '.$ch['maintainer']['name'].' <'.$ch['maintainer']['email'].'> '.date('r')."\n".
|
||||
"\n";
|
||||
|
||||
|
||||
$old_changelog = file_get_contents($this->f);
|
||||
$fp = fopen($this->f,'wb');
|
||||
fwrite($fp,$res.$old_changelog);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
private function getPackageInfo($l)
|
||||
{
|
||||
$res = array(
|
||||
|
@ -103,15 +103,15 @@ class debianChangelog
|
|||
'changelog' => '',
|
||||
'maintainer' => array()
|
||||
);
|
||||
|
||||
|
||||
$l = explode(';',$l);
|
||||
|
||||
|
||||
# Info
|
||||
$info = array_shift($l);
|
||||
$res['package'] = strtok($info,' ');
|
||||
$res['version'] = strtok('()');
|
||||
$res['dist'] = trim(strtok(';'));
|
||||
|
||||
|
||||
# Keywords
|
||||
foreach ($l as $v) {
|
||||
$v = explode('=',$v);
|
||||
|
@ -119,10 +119,10 @@ class debianChangelog
|
|||
$res['keywords'][trim($v[0])] = trim($v[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
private function getMaintainerInfo($l)
|
||||
{
|
||||
$res = array(
|
||||
|
@ -130,13 +130,13 @@ class debianChangelog
|
|||
'email' => '',
|
||||
'date' => ''
|
||||
);
|
||||
|
||||
|
||||
if (preg_match('/^ -- (.+?) <(.+?)> (.+?)$/',$l,$m)) {
|
||||
$res['name'] = $m[1];
|
||||
$res['email'] = $m[2];
|
||||
$res['date'] = $m[3];
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -146,30 +146,30 @@ class svnInfo
|
|||
public static function getCurrentRevision()
|
||||
{
|
||||
$info = `LANG=C svn info --xml`;
|
||||
|
||||
|
||||
$x = @simplexml_load_string($info);
|
||||
if (!$x) {
|
||||
throw new Exception('Unable to get current SVN revision');
|
||||
}
|
||||
|
||||
|
||||
$rev = $x->entry->commit['revision'];
|
||||
|
||||
|
||||
if (!$rev) {
|
||||
throw new Exception('Last revision number is invalid');
|
||||
}
|
||||
|
||||
|
||||
return (integer) $rev;
|
||||
}
|
||||
|
||||
|
||||
public static function getChangeLog($fromrev,$torev)
|
||||
{
|
||||
$log = `LANG=C svn log --xml -r $fromrev:$torev`;
|
||||
|
||||
|
||||
$x = @simplexml_load_string($log);
|
||||
if (!$x) {
|
||||
throw new Exception('Unable to open SVN log');
|
||||
}
|
||||
|
||||
|
||||
$res = array();
|
||||
foreach ($x->logentry as $change)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ class svnInfo
|
|||
'msg' => trim((string) $change->msg)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -195,4 +195,4 @@ catch (Exception $e)
|
|||
fwrite(STDERR,$e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -14,14 +14,14 @@ configure: configure-stamp
|
|||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
|
||||
touch configure-stamp
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE) config
|
||||
touch build-stamp
|
||||
|
@ -30,10 +30,10 @@ clean:
|
|||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
|
@ -41,20 +41,20 @@ install: build
|
|||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
|
||||
# Add here commands to install the package into debian/dotclear.
|
||||
cp -af $(CURDIR)/_dist/dotclear $(CURDIR)/debian/dotclear/usr/share/
|
||||
mkdir -p $(CURDIR)/debian/dotclear/etc/dotclear
|
||||
mv $(DEST)/inc/config.php.in $(CURDIR)/debian/dotclear/etc/dotclear/config.php
|
||||
|
||||
|
||||
# Clearbricks is in libclearbricks
|
||||
rm -rf $(CURDIR)/debian/dotclear/usr/share/dotclear/inc/clearbricks
|
||||
|
||||
|
||||
# Language packs
|
||||
mkdir -p $(CURDIR)/debian/dotclear-l10n-ja/usr/share/dotclear/locales
|
||||
cp -af $(CURDIR)/locales/ja $(CURDIR)/debian/dotclear-l10n-ja/usr/share/dotclear/locales/
|
||||
find $(CURDIR)/debian/dotclear-l10n-ja/usr/share/dotclear/locales/ -type d -name '.svn' | xargs rm -rf
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
|
|
@ -376,4 +376,3 @@ abstract class dcActionsPage
|
|||
abstract protected function fetchEntries($from);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,25 +19,25 @@ class dcFavorites
|
|||
{
|
||||
/** @var dcCore dotclear core instance */
|
||||
protected $core;
|
||||
|
||||
|
||||
/** @var array list of favorite definitions */
|
||||
protected $fav_defs;
|
||||
|
||||
|
||||
/** @var dcWorkspace current favorite landing workspace */
|
||||
protected $ws;
|
||||
|
||||
|
||||
/** @var array list of user-defined favorite ids */
|
||||
protected $local_prefs;
|
||||
|
||||
/** @var array list of globally-defined favorite ids */
|
||||
protected $global_prefs;
|
||||
|
||||
/** @var array list of user preferences (either one of the 2 above, or not!) */
|
||||
|
||||
/** @var array list of user preferences (either one of the 2 above, or not!) */
|
||||
protected $user_prefs;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
*
|
||||
* @param mixed $core dotclear core
|
||||
*
|
||||
* @access public
|
||||
|
@ -49,7 +49,7 @@ class dcFavorites
|
|||
$this->fav_defs = new ArrayObject();
|
||||
$this->ws = $core->auth->user_prefs->addWorkspace('dashboard');
|
||||
$this->user_prefs = array();
|
||||
|
||||
|
||||
if ($this->ws->prefExists('favorites')) {
|
||||
$this->local_prefs = @unserialize($this->ws->getLocal('favorites'));
|
||||
$this->global_prefs = @unserialize($this->ws->getGlobal('favorites'));
|
||||
|
@ -63,11 +63,11 @@ class dcFavorites
|
|||
} else {
|
||||
// No favorite defined ? Huhu, let's go for a migration
|
||||
$this->migrateFavorites();
|
||||
}
|
||||
}
|
||||
defaultFavorites::initDefaultFavorites($this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* setup - sets up favorites, fetch user favorites (against his permissions)
|
||||
* This method is to be called after loading plugins
|
||||
|
@ -83,7 +83,7 @@ class dcFavorites
|
|||
|
||||
/**
|
||||
* getFavorite - retrieves a favorite (complete description) from its id.
|
||||
*
|
||||
*
|
||||
* @param string $id the favorite id, or an array having 1 key 'name' set to id, ther keys are merged to favorite.
|
||||
*
|
||||
* @access public
|
||||
|
@ -116,10 +116,10 @@ class dcFavorites
|
|||
}
|
||||
return $fattr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getFavorites - retrieves a list of favorites.
|
||||
*
|
||||
*
|
||||
* @param string $ids an array of ids, as defined in getFavorite.
|
||||
*
|
||||
* @access public
|
||||
|
@ -136,7 +136,7 @@ class dcFavorites
|
|||
}
|
||||
return $prefs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setUserPrefs - get user favorites from settings. These are complete favorites, not ids only
|
||||
* returned favorites are the first non-empty list from :
|
||||
|
@ -179,9 +179,9 @@ class dcFavorites
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* migrateFavorites - migrate dc < 2.6 favorites to new format
|
||||
*
|
||||
|
@ -207,8 +207,8 @@ class dcFavorites
|
|||
$this->user_prefs = $this->getFavorites($this->local_prefs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* legacyFavorites - handle legacy favorites using adminDashboardFavs behavior
|
||||
*
|
||||
|
@ -230,9 +230,9 @@ class dcFavorites
|
|||
);
|
||||
$this->register ($v[0], $fav);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getUserFavorites - returns favorites that correspond to current user
|
||||
* (may be local, global, or failback favorites)
|
||||
|
@ -244,7 +244,7 @@ class dcFavorites
|
|||
public function getUserFavorites() {
|
||||
return $this->user_prefs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* getFavoriteIDs - returns user-defined or global favorites ids list
|
||||
|
@ -272,7 +272,7 @@ class dcFavorites
|
|||
public function setFavoriteIDs($ids,$global=false) {
|
||||
$this->ws->put('favorites',serialize($ids),null,null,true,$global);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getAvailableFavoritesIDs - returns all available fav ids
|
||||
*
|
||||
|
@ -318,7 +318,7 @@ class dcFavorites
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* appendDashboardIcons - adds favorites icons to index page
|
||||
* shall not be called outside admin/index.php...
|
||||
|
@ -335,9 +335,9 @@ class dcFavorites
|
|||
}
|
||||
$icons[$k]=new ArrayObject(array($v['title'],$v['url'],$v['large-icon']));
|
||||
$this->core->callBehavior('adminDashboardFavsIcon',$this->core,$k,$icons[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* register - registers a new favorite definition
|
||||
*
|
||||
|
@ -357,21 +357,21 @@ class dcFavorites
|
|||
$this->fav_defs[$id] = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* registerMultiple - registers a list of favorites definition
|
||||
*
|
||||
* @param array an array defining all favorites key is the id, value is the data.
|
||||
* @param array an array defining all favorites key is the id, value is the data.
|
||||
* see register method for data format
|
||||
* @access public
|
||||
*/
|
||||
*/
|
||||
public function registerMultiple($data) {
|
||||
foreach ($data as $k=>$v) {
|
||||
$this->register($k,$v);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* exists - tells whether a fav definition exists or not
|
||||
*
|
||||
|
@ -380,11 +380,11 @@ class dcFavorites
|
|||
* @access public
|
||||
*
|
||||
* @return true if the fav definition exists, false otherwise
|
||||
*/
|
||||
*/
|
||||
public function exists($id) {
|
||||
return isset($this->fav_defs[$id]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -493,4 +493,4 @@ class defaultFavorites
|
|||
$str_comments = __('%d comment', '%d comments',$comment_count);
|
||||
$v['title']= sprintf($str_comments,$comment_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class dcMenu
|
|||
{
|
||||
private $id;
|
||||
public $title;
|
||||
|
||||
|
||||
public function __construct($id,$title,$itemSpace='')
|
||||
{
|
||||
$this->id = $id;
|
||||
|
@ -23,32 +23,32 @@ class dcMenu
|
|||
$this->itemSpace = $itemSpace;
|
||||
$this->items = array();
|
||||
}
|
||||
|
||||
|
||||
public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null)
|
||||
{
|
||||
if($show) {
|
||||
$this->items[] = $this->itemDef($title,$url,$img,$active,$id,$class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null)
|
||||
{
|
||||
if ($show) {
|
||||
array_unshift($this->items,$this->itemDef($title,$url,$img,$active,$id,$class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function draw()
|
||||
{
|
||||
if (count($this->items) == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$res =
|
||||
'<div id="'.$this->id.'">'.
|
||||
($this->title ? '<h3>'.$this->title.'</h3>' : '').
|
||||
'<ul>'."\n";
|
||||
|
||||
|
||||
for ($i=0; $i<count($this->items); $i++)
|
||||
{
|
||||
if ($i+1 < count($this->items) && $this->itemSpace != '') {
|
||||
|
@ -58,12 +58,12 @@ class dcMenu
|
|||
$res .= $this->items[$i]."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$res .= '</ul></div>'."\n";
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
protected function itemDef($title,$url,$img,$active,$id=null,$class=null)
|
||||
{
|
||||
if (is_array($url)) {
|
||||
|
@ -73,16 +73,15 @@ class dcMenu
|
|||
$link = $url;
|
||||
$ahtml = '';
|
||||
}
|
||||
|
||||
|
||||
$img = dc_admin_icon_url($img);
|
||||
|
||||
|
||||
return
|
||||
'<li'.(($active || $class) ? ' class="'.(($active) ? 'active ' : '').(($class) ? $class : '').'"' : '').
|
||||
(($id) ? ' id="'.$id.'"' : '').
|
||||
(($img) ? ' style="background-image: url('.$img.');"' : '').
|
||||
'>'.
|
||||
|
||||
|
||||
'<a href="'.$link.'"'.$ahtml.'>'.$title.'</a></li>'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -13,7 +13,7 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
/**
|
||||
@ingroup DC_CORE
|
||||
@nosubgrouping
|
||||
@brief Admin combo library
|
||||
@brief Admin combo library
|
||||
|
||||
Dotclear utility class that provides reuseable combos across all admin
|
||||
|
||||
|
@ -22,10 +22,10 @@ class dcAdminCombos {
|
|||
|
||||
/** @var dcCore dcCore instance */
|
||||
public static $core;
|
||||
|
||||
|
||||
/**
|
||||
Returns an hierarchical categories combo from a category record
|
||||
|
||||
|
||||
@param categories <b>record</b> the category record
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
|
@ -43,10 +43,10 @@ class dcAdminCombos {
|
|||
}
|
||||
return $categories_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns available post status combo
|
||||
|
||||
Returns available post status combo
|
||||
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
public static function getPostStatusesCombo() {
|
||||
|
@ -56,10 +56,10 @@ class dcAdminCombos {
|
|||
}
|
||||
return $status_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns an users combo from a users record
|
||||
|
||||
|
||||
@param users <b>record</b> the users record
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
|
@ -69,38 +69,38 @@ class dcAdminCombos {
|
|||
{
|
||||
$user_cn = dcUtils::getUserCN($users->user_id,$users->user_name,
|
||||
$users->user_firstname,$users->user_displayname);
|
||||
|
||||
|
||||
if ($user_cn != $users->user_id) {
|
||||
$user_cn .= ' ('.$users->user_id.')';
|
||||
}
|
||||
|
||||
$users_combo[$user_cn] = $users->user_id;
|
||||
|
||||
$users_combo[$user_cn] = $users->user_id;
|
||||
}
|
||||
return $users_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns an date combo from a date record
|
||||
|
||||
|
||||
@param dates <b>record</b> the dates record
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getDatesCombo($dates) {
|
||||
$dt_m_combo= array();
|
||||
while ($dates->fetch()) {
|
||||
$dt_m_combo[dt::str('%B %Y',$dates->ts())] = $dates->year().$dates->month();
|
||||
}
|
||||
}
|
||||
return $dt_m_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns an lang combo from a lang record
|
||||
|
||||
|
||||
@param langs <b>record</b> the langs record
|
||||
@param with_available <b>boolean</b> if false, only list items from record
|
||||
if true, also list available languages
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getLangsCombo($langs,$with_available=false) {
|
||||
$all_langs = l10n::getISOcodes(0,1);
|
||||
if ($with_available) {
|
||||
|
@ -123,12 +123,12 @@ class dcAdminCombos {
|
|||
unset($all_langs);
|
||||
return $langs_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a combo containing all available and installed languages for administration pages
|
||||
|
||||
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getAdminLangsCombo() {
|
||||
$lang_combo = array();
|
||||
$langs = l10n::getISOcodes(1,1);
|
||||
|
@ -138,24 +138,24 @@ class dcAdminCombos {
|
|||
}
|
||||
return $lang_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a combo containing all available formaters in admin
|
||||
|
||||
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getFormatersCombo() {
|
||||
foreach (self::$core->getFormaters() as $v) {
|
||||
$formaters_combo[$v] = $v;
|
||||
}
|
||||
return $formaters_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a combo containing available blog statuses
|
||||
|
||||
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getBlogStatusesCombo() {
|
||||
$status_combo = array();
|
||||
foreach (self::$core->getAllBlogStatus() as $k => $v) {
|
||||
|
@ -163,12 +163,12 @@ class dcAdminCombos {
|
|||
}
|
||||
return $status_combo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a combo containing available comment statuses
|
||||
|
||||
|
||||
@return <b>array</b> the combo box (form::combo -compatible format)
|
||||
*/
|
||||
*/
|
||||
public static function getCommentStatusescombo() {
|
||||
$status_combo = array();
|
||||
foreach (self::$core->blog->getAllCommentStatus() as $k => $v) {
|
||||
|
@ -177,4 +177,4 @@ class dcAdminCombos {
|
|||
return $status_combo;
|
||||
}
|
||||
}
|
||||
dcAdminCombos::$core = $GLOBALS['core'];
|
||||
dcAdminCombos::$core = $GLOBALS['core'];
|
||||
|
|
|
@ -764,14 +764,14 @@ class adminModulesList
|
|||
|
||||
if (!empty($buttons)) {
|
||||
if (in_array('checkbox', $cols)) {
|
||||
echo
|
||||
echo
|
||||
'<p class="checkboxes-helpers"></p>';
|
||||
}
|
||||
echo
|
||||
'<div>'.implode(' ', $buttons).'</div>';
|
||||
}
|
||||
}
|
||||
echo
|
||||
echo
|
||||
'</form>';
|
||||
|
||||
return $this;
|
||||
|
@ -1591,7 +1591,7 @@ class adminThemesList extends adminModulesList
|
|||
|
||||
if (!empty($buttons)) {
|
||||
if (in_array('checkbox', $cols)) {
|
||||
echo
|
||||
echo
|
||||
'<p class="checkboxes-helpers"></p>';
|
||||
}
|
||||
echo '<div>'.implode(' ', $buttons).'</div>';
|
||||
|
|
|
@ -15,7 +15,7 @@ class dcPager extends pager
|
|||
{
|
||||
protected $form_action;
|
||||
protected $form_hidden;
|
||||
|
||||
|
||||
protected function getLink($li_class,$href,$img_src,$img_src_nolink,$img_alt,$enable_link) {
|
||||
if ($enable_link) {
|
||||
$formatter = '<li class="%s btn"><a href="%s"><img src="%s" alt="%s"/></a><span class="hidden">%s</span></li>';
|
||||
|
@ -59,7 +59,7 @@ class dcPager extends pager
|
|||
}
|
||||
$this->form_action = $url['path'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pager Links
|
||||
*
|
||||
|
@ -102,19 +102,19 @@ class dcPager extends pager
|
|||
__('Last page'),
|
||||
($this->env < $this->nb_pages)
|
||||
);
|
||||
$htmlCurrent =
|
||||
$htmlCurrent =
|
||||
'<li class="active"><strong>'.
|
||||
sprintf(__('Page %s / %s'),$this->env,$this->nb_pages).
|
||||
'</strong></li>';
|
||||
|
||||
$htmlDirect =
|
||||
|
||||
$htmlDirect =
|
||||
($this->nb_pages > 1 ?
|
||||
sprintf('<li class="direct-access">'.__('Direct access page %s'),
|
||||
form::field(array($this->var_page),3,10)).
|
||||
'<input type="submit" value="'.__('ok').'" class="reset" '.
|
||||
'name="ok" />'.$this->form_hidden.'</li>' : '');
|
||||
|
||||
$res =
|
||||
|
||||
$res =
|
||||
'<form action="'.$this->form_action.'" method="get">'.
|
||||
'<div class="pager"><ul>'.
|
||||
$htmlFirst.
|
||||
|
@ -127,7 +127,7 @@ class dcPager extends pager
|
|||
'</div>'.
|
||||
'</form>'
|
||||
;
|
||||
|
||||
|
||||
return $this->nb_elements > 0 ? $res : '';
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class adminGenericList
|
|||
protected $core;
|
||||
protected $rs;
|
||||
protected $rs_count;
|
||||
|
||||
|
||||
public function __construct($core,$rs,$rs_count)
|
||||
{
|
||||
$this->core =& $core;
|
||||
|
@ -172,13 +172,13 @@ class adminPostList extends adminGenericList
|
|||
$html_block =
|
||||
'<div class="table-outer">'.
|
||||
'<table>';
|
||||
|
||||
|
||||
if( $filter ) {
|
||||
$html_block .= '<caption>'.sprintf(__('List of %s entries match the filter.'), $this->rs_count).'</caption>';
|
||||
} else {
|
||||
$html_block .= '<caption class="hidden">'.__('Entries list').'</caption>';
|
||||
}
|
||||
|
||||
|
||||
$html_block .= '<tr>'.
|
||||
'<th colspan="2" class="first">'.__('Title').'</th>'.
|
||||
'<th scope="col">'.__('Date').'</th>'.
|
||||
|
@ -188,28 +188,28 @@ class adminPostList extends adminGenericList
|
|||
'<th scope="col"><img src="images/trackbacks.png" alt="" title="'.__('Trackbacks').'" /><span class="hidden">'.__('Trackbacks').'</span></th>'.
|
||||
'<th scope="col">'.__('Status').'</th>'.
|
||||
'</tr>%s</table></div>';
|
||||
|
||||
|
||||
if ($enclose_block) {
|
||||
$html_block = sprintf($enclose_block,$html_block);
|
||||
}
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
|
||||
|
||||
$blocks = explode('%s',$html_block);
|
||||
|
||||
|
||||
echo $blocks[0];
|
||||
|
||||
|
||||
while ($this->rs->fetch())
|
||||
{
|
||||
echo $this->postLine(isset($entries[$this->rs->post_id]));
|
||||
}
|
||||
|
||||
|
||||
echo $blocks[1];
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function postLine($checked)
|
||||
{
|
||||
if ($this->core->auth->check('categories',$this->core->blog->id)) {
|
||||
|
@ -217,14 +217,14 @@ class adminPostList extends adminGenericList
|
|||
} else {
|
||||
$cat_link = '%2$s';
|
||||
}
|
||||
|
||||
|
||||
if ($this->rs->cat_title) {
|
||||
$cat_title = sprintf($cat_link,$this->rs->cat_id,
|
||||
html::escapeHTML($this->rs->cat_title));
|
||||
} else {
|
||||
$cat_title = __('(No cat)');
|
||||
}
|
||||
|
||||
|
||||
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
|
||||
switch ($this->rs->post_status) {
|
||||
case 1:
|
||||
|
@ -240,27 +240,27 @@ class adminPostList extends adminGenericList
|
|||
$img_status = sprintf($img,__('Pending'),'check-wrn.png');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$protected = '';
|
||||
if ($this->rs->post_password) {
|
||||
$protected = sprintf($img,__('Protected'),'locker.png');
|
||||
}
|
||||
|
||||
|
||||
$selected = '';
|
||||
if ($this->rs->post_selected) {
|
||||
$selected = sprintf($img,__('Selected'),'selected.png');
|
||||
}
|
||||
|
||||
|
||||
$attach = '';
|
||||
$nb_media = $this->rs->countMedia();
|
||||
if ($nb_media > 0) {
|
||||
$attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments');
|
||||
$attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png');
|
||||
}
|
||||
|
||||
|
||||
$res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'.
|
||||
' id="p'.$this->rs->post_id.'">';
|
||||
|
||||
|
||||
$res .=
|
||||
'<td class="nowrap">'.
|
||||
form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()).'</td>'.
|
||||
|
@ -273,7 +273,7 @@ class adminPostList extends adminGenericList
|
|||
'<td class="nowrap count">'.$this->rs->nb_trackback.'</td>'.
|
||||
'<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ class adminPostMiniList extends adminGenericList
|
|||
else
|
||||
{
|
||||
$pager = new dcPager($page,$this->rs_count,$nb_per_page,10);
|
||||
|
||||
|
||||
$html_block =
|
||||
'<div class="table-outer clear">'.
|
||||
'<table><caption class="hidden">'.__('Entries list').'</caption><tr>'.
|
||||
|
@ -298,28 +298,28 @@ class adminPostMiniList extends adminGenericList
|
|||
'<th scope="col">'.__('Author').'</th>'.
|
||||
'<th scope="col">'.__('Status').'</th>'.
|
||||
'</tr>%s</table></div>';
|
||||
|
||||
|
||||
if ($enclose_block) {
|
||||
$html_block = sprintf($enclose_block,$html_block);
|
||||
}
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
|
||||
|
||||
$blocks = explode('%s',$html_block);
|
||||
|
||||
|
||||
echo $blocks[0];
|
||||
|
||||
|
||||
while ($this->rs->fetch())
|
||||
{
|
||||
echo $this->postLine();
|
||||
}
|
||||
|
||||
|
||||
echo $blocks[1];
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function postLine()
|
||||
{
|
||||
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
|
||||
|
@ -337,27 +337,27 @@ class adminPostMiniList extends adminGenericList
|
|||
$img_status = sprintf($img,__('Pending'),'check-wrn.png');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$protected = '';
|
||||
if ($this->rs->post_password) {
|
||||
$protected = sprintf($img,__('Protected'),'locker.png');
|
||||
}
|
||||
|
||||
|
||||
$selected = '';
|
||||
if ($this->rs->post_selected) {
|
||||
$selected = sprintf($img,__('Selected'),'selected.png');
|
||||
}
|
||||
|
||||
|
||||
$attach = '';
|
||||
$nb_media = $this->rs->countMedia();
|
||||
if ($nb_media > 0) {
|
||||
$attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments');
|
||||
$attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png');
|
||||
}
|
||||
|
||||
|
||||
$res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'.
|
||||
' id="p'.$this->rs->post_id.'">';
|
||||
|
||||
|
||||
$res .=
|
||||
'<td scope="row" class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'" '.
|
||||
'title="'.html::escapeHTML($this->rs->getURL()).'">'.
|
||||
|
@ -366,7 +366,7 @@ class adminPostMiniList extends adminGenericList
|
|||
'<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'.
|
||||
'<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -386,17 +386,17 @@ class adminCommentList extends adminGenericList
|
|||
else
|
||||
{
|
||||
$pager = new dcPager($page,$this->rs_count,$nb_per_page,10);
|
||||
|
||||
|
||||
$comments = array();
|
||||
if (isset($_REQUEST['comments'])) {
|
||||
foreach ($_REQUEST['comments'] as $v) {
|
||||
$comments[(integer)$v]=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$html_block =
|
||||
'<div class="table-outer">'.
|
||||
'<table>';
|
||||
|
||||
|
||||
if( $filter ) {
|
||||
$html_block .= '<caption>'.
|
||||
sprintf(__(
|
||||
|
@ -407,7 +407,7 @@ class adminCommentList extends adminGenericList
|
|||
} else {
|
||||
$html_block .= '<caption class="hidden">'.__('Comments and trackbacks list').'</caption>';
|
||||
}
|
||||
|
||||
|
||||
$html_block .= '<tr>'.
|
||||
'<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>'.
|
||||
'<th scope="col">'.__('Author').'</th>'.
|
||||
|
@ -419,43 +419,43 @@ class adminCommentList extends adminGenericList
|
|||
if ($enclose_block) {
|
||||
$html_block = sprintf($enclose_block,$html_block);
|
||||
}
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
|
||||
|
||||
$blocks = explode('%s',$html_block);
|
||||
|
||||
|
||||
echo $blocks[0];
|
||||
|
||||
|
||||
while ($this->rs->fetch())
|
||||
{
|
||||
echo $this->commentLine(isset($comments[$this->rs->comment_id]));
|
||||
}
|
||||
|
||||
|
||||
echo $blocks[1];
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function commentLine($checked=false)
|
||||
{
|
||||
global $author, $status, $sortby, $order, $nb_per_page;
|
||||
|
||||
|
||||
$author_url =
|
||||
'comments.php?n='.$nb_per_page.
|
||||
'&status='.$status.
|
||||
'&sortby='.$sortby.
|
||||
'&order='.$order.
|
||||
'&author='.rawurlencode($this->rs->comment_author);
|
||||
|
||||
|
||||
$post_url = $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id);
|
||||
|
||||
|
||||
$comment_url = 'comment.php?id='.$this->rs->comment_id;
|
||||
|
||||
|
||||
$comment_dt =
|
||||
dt::dt2str($this->core->blog->settings->system->date_format.' - '.
|
||||
$this->core->blog->settings->system->time_format,$this->rs->comment_dt);
|
||||
|
||||
|
||||
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
|
||||
switch ($this->rs->comment_status) {
|
||||
case 1:
|
||||
|
@ -471,7 +471,7 @@ class adminCommentList extends adminGenericList
|
|||
$img_status = sprintf($img,__('Junk'),'junk.png');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$post_title = html::escapeHTML($this->rs->post_title);
|
||||
if (mb_strlen($post_title) > 70) {
|
||||
$post_title = mb_strcut($post_title,0,67).'...';
|
||||
|
@ -479,10 +479,10 @@ class adminCommentList extends adminGenericList
|
|||
$comment_title = sprintf(__('Edit the %1$s from %2$s'),
|
||||
$this->rs->comment_trackback ? __('trackback') : __('comment'),
|
||||
html::escapeHTML($this->rs->comment_author));
|
||||
|
||||
|
||||
$res = '<tr class="line'.($this->rs->comment_status != 1 ? ' offline' : '').'"'.
|
||||
' id="c'.$this->rs->comment_id.'">';
|
||||
|
||||
|
||||
$res .=
|
||||
'<td class="nowrap">'.
|
||||
form::checkbox(array('comments[]'),$this->rs->comment_id,$checked,'','',0).'</td>'.
|
||||
|
@ -496,9 +496,9 @@ class adminCommentList extends adminGenericList
|
|||
'<td class="nowrap discrete"><a href="'.$post_url.'">'.
|
||||
html::escapeHTML($post_title).'</a>'.
|
||||
($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').'</td>';
|
||||
|
||||
|
||||
$res .= '</tr>';
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -518,17 +518,17 @@ class adminUserList extends adminGenericList
|
|||
else
|
||||
{
|
||||
$pager = new dcPager($page,$this->rs_count,$nb_per_page,10);
|
||||
|
||||
|
||||
$html_block =
|
||||
'<div class="table-outer clear">'.
|
||||
'<table>';
|
||||
|
||||
|
||||
if( $filter ) {
|
||||
$html_block .= '<caption>'.sprintf(__('List of %s users match the filter.'), $this->rs_count).'</caption>';
|
||||
} else {
|
||||
$html_block .= '<caption class="hidden">'.__('Users list').'</caption>';
|
||||
}
|
||||
|
||||
|
||||
$html_block .= '<tr>'.
|
||||
'<th colspan="2" scope="col" class="first">'.__('Username').'</th>'.
|
||||
'<th scope="col">'.__('First Name').'</th>'.
|
||||
|
@ -536,35 +536,35 @@ class adminUserList extends adminGenericList
|
|||
'<th scope="col">'.__('Display name').'</th>'.
|
||||
'<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'.
|
||||
'</tr>%s</table></div>';
|
||||
|
||||
|
||||
if ($enclose_block) {
|
||||
$html_block = sprintf($enclose_block,$html_block);
|
||||
}
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
|
||||
|
||||
$blocks = explode('%s',$html_block);
|
||||
|
||||
|
||||
echo $blocks[0];
|
||||
|
||||
|
||||
while ($this->rs->fetch())
|
||||
{
|
||||
echo $this->userLine();
|
||||
}
|
||||
|
||||
|
||||
echo $blocks[1];
|
||||
|
||||
|
||||
echo $pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function userLine()
|
||||
{
|
||||
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
|
||||
$img_status = '';
|
||||
|
||||
|
||||
$p = $this->core->getUserPermissions($this->rs->user_id);
|
||||
|
||||
|
||||
if (isset($p[$this->core->blog->id]['p']['admin'])) {
|
||||
$img_status = sprintf($img,__('admin'),'admin.png');
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ header("Pragma: no-cache");
|
|||
|
||||
function dc_load_locales() {
|
||||
global $_lang, $core;
|
||||
|
||||
|
||||
$_lang = $core->auth->getInfo('user_lang');
|
||||
$_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en';
|
||||
|
||||
|
||||
l10n::lang($_lang);
|
||||
if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') {
|
||||
l10n::set(dirname(__FILE__).'/../../locales/en/date');
|
||||
|
@ -39,12 +39,12 @@ function dc_load_locales() {
|
|||
function dc_admin_icon_url($img)
|
||||
{
|
||||
global $core;
|
||||
|
||||
|
||||
$core->auth->user_prefs->addWorkspace('interface');
|
||||
$user_ui_iconset = @$core->auth->user_prefs->interface->iconset;
|
||||
if (($user_ui_iconset) && ($img)) {
|
||||
$icon = false;
|
||||
if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) ||
|
||||
if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) ||
|
||||
(preg_match('/^index\.php\?pf=(.+)$/',$img,$m))) {
|
||||
if ($m[1]) {
|
||||
$icon = path::real(dirname(__FILE__).'/../../admin/images/iconset/'.$user_ui_iconset.'/'.$m[1],false);
|
||||
|
@ -64,11 +64,11 @@ if (defined('DC_AUTH_SESS_ID') && defined('DC_AUTH_SESS_UID'))
|
|||
{
|
||||
# We have session information in constants
|
||||
$_COOKIE[DC_SESSION_NAME] = DC_AUTH_SESS_ID;
|
||||
|
||||
|
||||
if (!$core->auth->checkSession(DC_AUTH_SESS_UID)) {
|
||||
throw new Exception('Invalid session data.');
|
||||
}
|
||||
|
||||
|
||||
# Check nonce from POST requests
|
||||
if (!empty($_POST))
|
||||
{
|
||||
|
@ -76,14 +76,14 @@ if (defined('DC_AUTH_SESS_ID') && defined('DC_AUTH_SESS_UID'))
|
|||
throw new Exception('Precondition Failed.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($_SESSION['sess_blog_id'])) {
|
||||
throw new Exception('Permission denied.');
|
||||
}
|
||||
|
||||
|
||||
# Loading locales
|
||||
dc_load_locales();
|
||||
|
||||
|
||||
$core->setBlog($_SESSION['sess_blog_id']);
|
||||
if (!$core->blog->id) {
|
||||
throw new Exception('Permission denied.');
|
||||
|
@ -99,7 +99,7 @@ elseif ($core->auth->sessionExists())
|
|||
$p = $core->session->getCookieParameters(false,-600);
|
||||
$p[3] = '/';
|
||||
call_user_func_array('setcookie',$p);
|
||||
|
||||
|
||||
http::redirect('auth.php');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
@ -107,7 +107,7 @@ elseif ($core->auth->sessionExists())
|
|||
,__('There seems to be no Session table in your database. Is Dotclear completly installed?')
|
||||
,20);
|
||||
}
|
||||
|
||||
|
||||
# Check nonce from POST requests
|
||||
if (!empty($_POST))
|
||||
{
|
||||
|
@ -118,8 +118,8 @@ elseif ($core->auth->sessionExists())
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!empty($_REQUEST['switchblog'])
|
||||
&& $core->auth->getPermissions($_REQUEST['switchblog']) !== false)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ elseif ($core->auth->sessionExists())
|
|||
if (isset($_SESSION['media_manager_page'])) {
|
||||
unset($_SESSION['media_manager_page']);
|
||||
}
|
||||
|
||||
|
||||
# Removing switchblog from URL
|
||||
$redir = $_SERVER['REQUEST_URI'];
|
||||
$redir = preg_replace('/switchblog=(.*?)(&|$)/','',$redir);
|
||||
|
@ -138,7 +138,7 @@ elseif ($core->auth->sessionExists())
|
|||
http::redirect($redir);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
# Check blog to use and log out if no result
|
||||
if (isset($_SESSION['sess_blog_id']))
|
||||
{
|
||||
|
@ -153,10 +153,10 @@ elseif ($core->auth->sessionExists())
|
|||
unset($b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Loading locales
|
||||
dc_load_locales();
|
||||
|
||||
|
||||
if (isset($_SESSION['sess_blog_id'])) {
|
||||
$core->setBlog($_SESSION['sess_blog_id']);
|
||||
} else {
|
||||
|
@ -164,7 +164,7 @@ elseif ($core->auth->sessionExists())
|
|||
http::redirect('auth.php');
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
# Check add to my fav fired
|
||||
if (!empty($_REQUEST['add-favorite'])) {
|
||||
$redir = $_SERVER['REQUEST_URI'];
|
||||
|
@ -183,7 +183,7 @@ if ($core->auth->userID() && $core->blog !== null)
|
|||
require $f;
|
||||
}
|
||||
unset($f);
|
||||
|
||||
|
||||
if (($hfiles = @scandir($locales_root.$_lang.'/help')) !== false)
|
||||
{
|
||||
foreach ($hfiles as $hfile) {
|
||||
|
@ -204,8 +204,8 @@ if ($core->auth->userID() && $core->blog !== null)
|
|||
|
||||
# [] : Title, URL, small icon, large icon, permissions, id, class
|
||||
# NB : '*' in permissions means any, null means super admin only
|
||||
|
||||
|
||||
|
||||
|
||||
# Menus creation
|
||||
$_menu = new ArrayObject();
|
||||
$_menu['Dashboard'] = new dcMenu('dashboard-menu',null);
|
||||
|
@ -218,14 +218,14 @@ if ($core->auth->userID() && $core->blog !== null)
|
|||
# Loading plugins
|
||||
$core->plugins->loadModules(DC_PLUGINS_ROOT,'admin',$_lang);
|
||||
$core->favs->setup();
|
||||
|
||||
|
||||
if (!$user_ui_nofavmenu) {
|
||||
$core->favs->appendMenu($_menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Set menu titles
|
||||
|
||||
|
||||
$_menu['System']->title = __('System settings');
|
||||
$_menu['Blog']->title = __('Blog');
|
||||
$_menu['Plugins']->title = __('Plugins');
|
||||
|
@ -255,7 +255,7 @@ if ($core->auth->userID() && $core->blog !== null)
|
|||
$_menu['Blog']->prependItem(__('New entry'),'post.php','images/menu/edit.png',
|
||||
preg_match('/post.php$/',$_SERVER['REQUEST_URI']),
|
||||
$core->auth->check('usage,contentadmin',$core->blog->id));
|
||||
|
||||
|
||||
$_menu['System']->prependItem(__('Update'),'update.php','images/menu/update.png',
|
||||
preg_match('/update.php(\?.*)?$/',$_SERVER['REQUEST_URI']),
|
||||
$core->auth->isSuperAdmin() && is_readable(DC_DIGESTS));
|
||||
|
@ -272,9 +272,8 @@ if ($core->auth->userID() && $core->blog !== null)
|
|||
preg_match('/blogs.php$/',$_SERVER['REQUEST_URI']),
|
||||
$core->auth->isSuperAdmin() ||
|
||||
$core->auth->check('usage,contentadmin',$core->blog->id) && $core->auth->getBlogCount() > 1);
|
||||
|
||||
|
||||
if (empty($core->blog->settings->system->jquery_migrate_mute)) {
|
||||
$core->blog->settings->system->put('jquery_migrate_mute', true, 'boolean', 'Mute warnings for jquery migrate plugin ?', false);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -66,5 +66,3 @@ define('DC_TPL_CACHE',path::real(dirname(__FILE__).'/..').'/cache');
|
|||
// socketMail::$smtp_relay = 'my.smtp.relay.org';
|
||||
// socketMail::mail($to,$subject,$message,$headers);
|
||||
//}
|
||||
|
||||
?>
|
|
@ -15,7 +15,7 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
* @ingroup DC_CORE
|
||||
* @nosubgrouping
|
||||
* @brief Authentication and user credentials management
|
||||
*
|
||||
*
|
||||
* dcAuth is a class used to handle everything related to user authentication
|
||||
* and credentials. Object is provided by dcCore $auth property.
|
||||
*/
|
||||
|
@ -25,12 +25,12 @@ class dcAuth
|
|||
protected $core;
|
||||
/** @var connection Database connection object */
|
||||
protected $con;
|
||||
|
||||
|
||||
/** @var string User table name */
|
||||
protected $user_table;
|
||||
/** @var string Perm table name */
|
||||
protected $perm_table;
|
||||
|
||||
|
||||
/** @var string Current user ID */
|
||||
protected $user_id;
|
||||
/** @var array Array with user information */
|
||||
|
@ -49,16 +49,16 @@ class dcAuth
|
|||
protected $blogs = array();
|
||||
/** @var integer Count of user blogs */
|
||||
public $blog_count = null;
|
||||
|
||||
|
||||
/** @var array Permission types */
|
||||
protected $perm_types;
|
||||
|
||||
|
||||
/** @var dcPrefs dcPrefs object */
|
||||
public $user_prefs;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor. Takes dcCore object as single argument.
|
||||
*
|
||||
*
|
||||
* @param dcCore $core dcCore object
|
||||
*/
|
||||
public function __construct($core)
|
||||
|
@ -68,7 +68,7 @@ class dcAuth
|
|||
$this->blog_table = $core->prefix.'blog';
|
||||
$this->user_table = $core->prefix.'user';
|
||||
$this->perm_table = $core->prefix.'permissions';
|
||||
|
||||
|
||||
$this->perm_types = array(
|
||||
'admin' => __('administrator'),
|
||||
'usage' => __('manage their own entries and comments'),
|
||||
|
@ -80,14 +80,14 @@ class dcAuth
|
|||
'media_admin' => __('manage all media items')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// @name Credentials and user permissions
|
||||
//@{
|
||||
/**
|
||||
* Checks if user exists and can log in. <var>$pwd</var> argument is optionnal
|
||||
* while you may need to check user without password. This method will create
|
||||
* credentials and populate all needed object properties.
|
||||
*
|
||||
*
|
||||
* @param string $user_id User ID
|
||||
* @param string $pwd User password
|
||||
* @param string $user_key User key check
|
||||
|
@ -103,21 +103,21 @@ class dcAuth
|
|||
'user_lang, user_tz, user_post_status, user_creadt, user_upddt '.
|
||||
'FROM '.$this->con->escapeSystem($this->user_table).' '.
|
||||
"WHERE user_id = '".$this->con->escape($user_id)."' ";
|
||||
|
||||
|
||||
try {
|
||||
$rs = $this->con->select($strReq);
|
||||
} catch (Exception $e) {
|
||||
$err = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
sleep(rand(2,5));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$rs->extend('rsExtUser');
|
||||
|
||||
|
||||
if ($pwd != '')
|
||||
{
|
||||
if (crypt::hmac(DC_MASTER_KEY,$pwd) != $rs->user_pwd) {
|
||||
|
@ -131,11 +131,11 @@ class dcAuth
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->user_id = $rs->user_id;
|
||||
$this->user_change_pwd = (boolean) $rs->user_change_pwd;
|
||||
$this->user_admin = (boolean) $rs->user_super;
|
||||
|
||||
|
||||
$this->user_info['user_pwd'] = $rs->user_pwd;
|
||||
$this->user_info['user_name'] = $rs->user_name;
|
||||
$this->user_info['user_firstname'] = $rs->user_firstname;
|
||||
|
@ -148,24 +148,24 @@ class dcAuth
|
|||
$this->user_info['user_post_status'] = $rs->user_post_status;
|
||||
$this->user_info['user_creadt'] = $rs->user_creadt;
|
||||
$this->user_info['user_upddt'] = $rs->user_upddt;
|
||||
|
||||
|
||||
$this->user_info['user_cn'] = dcUtils::getUserCN($rs->user_id, $rs->user_name,
|
||||
$rs->user_firstname, $rs->user_displayname);
|
||||
|
||||
|
||||
$this->user_options = array_merge($this->core->userDefaults(),$rs->options());
|
||||
|
||||
|
||||
$this->user_prefs = new dcPrefs($this->core,$this->user_id);
|
||||
|
||||
|
||||
# Get permissions on blogs
|
||||
if ($check_blog && ($this->findUserBlog() === false)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method only check current user password.
|
||||
*
|
||||
*
|
||||
* @param string $pwd User password
|
||||
* @return boolean
|
||||
*/
|
||||
|
@ -174,49 +174,49 @@ class dcAuth
|
|||
if (!empty($this->user_info['user_pwd'])) {
|
||||
return $pwd == $this->user_info['user_pwd'];
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method checks if user session cookie exists
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function sessionExists()
|
||||
{
|
||||
return isset($_COOKIE[DC_SESSION_NAME]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method checks user session validity.
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkSession($uid=null)
|
||||
{
|
||||
$this->core->session->start();
|
||||
|
||||
|
||||
# If session does not exist, logout.
|
||||
if (!isset($_SESSION['sess_user_id'])) {
|
||||
$this->core->session->destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
# Check here for user and IP address
|
||||
$this->checkUser($_SESSION['sess_user_id']);
|
||||
$uid = $uid ? $uid : http::browserUID(DC_MASTER_KEY);
|
||||
|
||||
|
||||
$user_can_log = $this->userID() !== null && $uid == $_SESSION['sess_browser_uid'];
|
||||
|
||||
|
||||
if (!$user_can_log) {
|
||||
$this->core->session->destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if user must change his password in order to login.
|
||||
*
|
||||
|
@ -226,22 +226,22 @@ class dcAuth
|
|||
{
|
||||
return $this->user_change_pwd;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if user is super admin
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSuperAdmin()
|
||||
{
|
||||
return $this->user_admin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if user has permissions given in <var>$permissions</var> for blog
|
||||
* <var>$blog_id</var>. <var>$permissions</var> is a coma separated list of
|
||||
* permissions.
|
||||
*
|
||||
*
|
||||
* @param string $permissions Permissions list
|
||||
* @param string $blog_id Blog ID
|
||||
* @return boolean
|
||||
|
@ -251,16 +251,16 @@ class dcAuth
|
|||
if ($this->user_admin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$p = explode(',',$permissions);
|
||||
$b = $this->getPermissions($blog_id);
|
||||
|
||||
|
||||
if ($b != false)
|
||||
{
|
||||
if (isset($b['admin'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
foreach ($p as $v)
|
||||
{
|
||||
if (isset($b[$v])) {
|
||||
|
@ -268,13 +268,13 @@ class dcAuth
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if user is allowed to change its password.
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function allowPassChange()
|
||||
|
@ -282,7 +282,7 @@ class dcAuth
|
|||
return $this->allow_pass_change;
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/// @name User code handlers
|
||||
//@{
|
||||
public function getUserCode()
|
||||
|
@ -292,45 +292,45 @@ class dcAuth
|
|||
pack('H*',crypt::hmac(DC_MASTER_KEY,$this->getInfo('user_pwd')));
|
||||
return bin2hex($code);
|
||||
}
|
||||
|
||||
|
||||
public function checkUserCode($code)
|
||||
{
|
||||
$code = @pack('H*',$code);
|
||||
|
||||
|
||||
$user_id = trim(@pack('a32',substr($code,0,32)));
|
||||
$pwd = @unpack('H40hex',substr($code,32,40));
|
||||
|
||||
|
||||
if ($user_id === false || $pwd === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$pwd = $pwd['hex'];
|
||||
|
||||
|
||||
$strReq = 'SELECT user_id, user_pwd '.
|
||||
'FROM '.$this->user_table.' '.
|
||||
"WHERE user_id = '".$this->con->escape($user_id)."' ";
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (crypt::hmac(DC_MASTER_KEY,$rs->user_pwd) != $pwd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $rs->user_id;
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @name Sudo
|
||||
//@{
|
||||
/**
|
||||
* Calls $f function with super admin rights.
|
||||
* Returns the function result.
|
||||
*
|
||||
*
|
||||
* @param callback $f Callback function
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -339,10 +339,10 @@ class dcAuth
|
|||
if (!is_callable($f)) {
|
||||
throw new Exception($f.' function doest not exist');
|
||||
}
|
||||
|
||||
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
|
||||
if ($this->user_admin) {
|
||||
$res = call_user_func_array($f,$args);
|
||||
} else {
|
||||
|
@ -355,20 +355,20 @@ class dcAuth
|
|||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/// @name User information and options
|
||||
//@{
|
||||
/**
|
||||
* Returns user permissions for a blog as an array which looks like:
|
||||
*
|
||||
*
|
||||
* - [blog_id]
|
||||
* - [permission] => true
|
||||
* - ...
|
||||
*
|
||||
*
|
||||
* @param string $blog_id Blog ID
|
||||
* @return array
|
||||
*/
|
||||
|
@ -383,21 +383,21 @@ class dcAuth
|
|||
'from '.$this->blog_table.' '.
|
||||
"WHERE blog_id = '".$this->con->escape($blog_id)."' ";
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
$this->blogs[$blog_id] = $rs->isEmpty() ? false : array('admin' => true);
|
||||
|
||||
|
||||
return $this->blogs[$blog_id];
|
||||
}
|
||||
|
||||
|
||||
$strReq = 'SELECT permissions '.
|
||||
'FROM '.$this->perm_table.' '.
|
||||
"WHERE user_id = '".$this->con->escape($this->user_id)."' ".
|
||||
"AND blog_id = '".$this->con->escape($blog_id)."' ".
|
||||
"AND (permissions LIKE '%|usage|%' OR permissions LIKE '%|admin|%' OR permissions LIKE '%|contentadmin|%') ";
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
$this->blogs[$blog_id] = $rs->isEmpty() ? false : $this->parsePermissions($rs->permissions);
|
||||
|
||||
|
||||
return $this->blogs[$blog_id];
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ class dcAuth
|
|||
|
||||
return $this->blog_count;
|
||||
}
|
||||
|
||||
|
||||
public function findUserBlog($blog_id=null)
|
||||
{
|
||||
if ($blog_id && $this->getPermissions($blog_id) !== false)
|
||||
|
@ -433,29 +433,29 @@ class dcAuth
|
|||
'ORDER BY blog_id ASC '.
|
||||
$this->con->limit(1);
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
if (!$rs->isEmpty()) {
|
||||
return $rs->blog_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns current user ID
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function userID()
|
||||
{
|
||||
return $this->user_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns information about a user .
|
||||
*
|
||||
*
|
||||
* @param string $n Information name
|
||||
* @return string
|
||||
*/
|
||||
|
@ -464,13 +464,13 @@ class dcAuth
|
|||
if (isset($this->user_info[$n])) {
|
||||
return $this->user_info[$n];
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a specific user option
|
||||
*
|
||||
*
|
||||
* @param string $n Option name
|
||||
* @return string
|
||||
*/
|
||||
|
@ -481,10 +481,10 @@ class dcAuth
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all user options in an associative array.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
|
@ -492,12 +492,12 @@ class dcAuth
|
|||
return $this->user_options;
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/// @name Permissions
|
||||
//@{
|
||||
/**
|
||||
* Returns an array with permissions parsed from the string <var>$level</var>
|
||||
*
|
||||
*
|
||||
* @param string $level Permissions string
|
||||
* @return array
|
||||
*/
|
||||
|
@ -505,27 +505,27 @@ class dcAuth
|
|||
{
|
||||
$level = preg_replace('/^\|/','',$level);
|
||||
$level = preg_replace('/\|$/','',$level);
|
||||
|
||||
|
||||
$res = array();
|
||||
foreach (explode('|',$level) as $v) {
|
||||
$res[$v] = true;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <var>perm_types</var> property content.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPermissionsTypes()
|
||||
{
|
||||
return $this->perm_types;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new permission type.
|
||||
*
|
||||
*
|
||||
* @param string $name Permission name
|
||||
* @param string $title Permission title
|
||||
*/
|
||||
|
@ -534,13 +534,13 @@ class dcAuth
|
|||
$this->perm_types[$name] = $title;
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/// @name Password recovery
|
||||
//@{
|
||||
/**
|
||||
* Add a recover key to a specific user identified by its email and
|
||||
* password.
|
||||
*
|
||||
*
|
||||
* @param string $user_id User ID
|
||||
* @param string $user_email User Email
|
||||
* @return string
|
||||
|
@ -551,30 +551,30 @@ class dcAuth
|
|||
'FROM '.$this->user_table.' '.
|
||||
"WHERE user_id = '".$this->con->escape($user_id)."' ".
|
||||
"AND user_email = '".$this->con->escape($user_email)."' ";
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception(__('That user does not exist in the database.'));
|
||||
}
|
||||
|
||||
|
||||
$key = md5(uniqid());
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->user_table);
|
||||
$cur->user_recover_key = $key;
|
||||
|
||||
|
||||
$cur->update("WHERE user_id = '".$this->con->escape($user_id)."'");
|
||||
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new user password using recovery key. Returns an array:
|
||||
*
|
||||
*
|
||||
* - user_email
|
||||
* - user_id
|
||||
* - new_pass
|
||||
*
|
||||
*
|
||||
* @param string $recover_key Recovery key
|
||||
* @return array
|
||||
*/
|
||||
|
@ -583,25 +583,25 @@ class dcAuth
|
|||
$strReq = 'SELECT user_id, user_email '.
|
||||
'FROM '.$this->user_table.' '.
|
||||
"WHERE user_recover_key = '".$this->con->escape($recover_key)."' ";
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception(__('That key does not exist in the database.'));
|
||||
}
|
||||
|
||||
|
||||
$new_pass = crypt::createPassword();
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->user_table);
|
||||
$cur->user_pwd = crypt::hmac(DC_MASTER_KEY,$new_pass);
|
||||
$cur->user_recover_key = null;
|
||||
|
||||
|
||||
$cur->update("WHERE user_recover_key = '".$this->con->escape($recover_key)."'");
|
||||
|
||||
|
||||
return array('user_email' => $rs->user_email, 'user_id' => $rs->user_id, 'new_pass' => $new_pass);
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/** @name User management callbacks
|
||||
This 3 functions only matter if you extend this class and use
|
||||
DC_AUTH_CLASS constant.
|
||||
|
@ -610,14 +610,14 @@ class dcAuth
|
|||
LDAP directory or other third party authentication database.
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
* Called after core->addUser
|
||||
* @see dcCore::addUser
|
||||
* @param cursor $cur User cursor
|
||||
*/
|
||||
public function afterAddUser($cur) {}
|
||||
|
||||
|
||||
/**
|
||||
* Called after core->updUser
|
||||
* @see dcCore::updUser
|
||||
|
@ -625,7 +625,7 @@ class dcAuth
|
|||
* @param cursor $cur User cursor
|
||||
*/
|
||||
public function afterUpdUser($id,$cur) {}
|
||||
|
||||
|
||||
/**
|
||||
* Called after core->delUser
|
||||
* @see dcCore::delUser
|
||||
|
@ -634,4 +634,3 @@ class dcAuth
|
|||
public function afterDelUser($id) {}
|
||||
//@}
|
||||
}
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
|
@ -21,10 +21,10 @@ class dcCategories extends nestedTree
|
|||
protected $f_left = 'cat_lft';
|
||||
protected $f_right = 'cat_rgt';
|
||||
protected $f_id = 'cat_id';
|
||||
|
||||
|
||||
protected $core;
|
||||
protected $blog_id;
|
||||
|
||||
|
||||
public function __construct($core)
|
||||
{
|
||||
$this->core =& $core;
|
||||
|
@ -33,19 +33,19 @@ class dcCategories extends nestedTree
|
|||
$this->table = $core->prefix.'category';
|
||||
$this->add_condition = array('blog_id' => "'".$this->con->escape($this->blog_id)."'");
|
||||
}
|
||||
|
||||
|
||||
public function getChildren($start=0,$id=null,$sort='asc',$fields=array())
|
||||
{
|
||||
$fields = array_merge(array('cat_title','cat_url','cat_desc'),$fields);
|
||||
return parent::getChildren($start,$id,$sort,$fields);
|
||||
}
|
||||
|
||||
|
||||
public function getParents($id,$fields=array())
|
||||
{
|
||||
$fields = array_merge(array('cat_title','cat_url','cat_desc'),$fields);
|
||||
return parent::getParents($id,$fields);
|
||||
}
|
||||
|
||||
|
||||
public function getParent($id,$fields=array())
|
||||
{
|
||||
$fields = array_merge(array('cat_title','cat_url','cat_desc'),$fields);
|
||||
|
@ -56,27 +56,27 @@ class dcCategories extends nestedTree
|
|||
abstract class nestedTree
|
||||
{
|
||||
protected $con;
|
||||
|
||||
|
||||
protected $table;
|
||||
protected $f_left;
|
||||
protected $f_right;
|
||||
protected $f_id;
|
||||
|
||||
|
||||
protected $add_condition = array();
|
||||
|
||||
|
||||
protected $parents;
|
||||
|
||||
|
||||
public function __construct($con)
|
||||
{
|
||||
$this->con =& $con;
|
||||
}
|
||||
|
||||
|
||||
public function getChildren($start=0,$id=null,$sort='asc',$fields=array())
|
||||
{
|
||||
$fields = count($fields) > 0 ? ', C2.'.implode(', C2.',$fields) : '';
|
||||
|
||||
|
||||
$sql = 'SELECT C2.'.$this->f_id.', C2.'.$this->f_left.', C2.'.$this->f_right.', COUNT(C1.'.$this->f_id.') AS level '
|
||||
. $fields.' '
|
||||
. $fields.' '
|
||||
. 'FROM '.$this->table.' AS C1, '.$this->table.' AS C2 %s '
|
||||
. 'WHERE C2.'.$this->f_left.' BETWEEN C1.'.$this->f_left.' AND C1.'.$this->f_right.' '
|
||||
. ' %s '
|
||||
|
@ -85,28 +85,28 @@ abstract class nestedTree
|
|||
. 'GROUP BY C2.'.$this->f_id.', C2.'.$this->f_left.', C2.'.$this->f_right.' '.$fields.' '
|
||||
. ' %s '
|
||||
. 'ORDER BY C2.'.$this->f_left.' '.($sort == 'asc' ? 'ASC' : 'DESC').' ';
|
||||
|
||||
|
||||
$from = $where = '';
|
||||
if ($start > 0) {
|
||||
$from = ', '.$this->table.' AS C3';
|
||||
$where = 'AND C3.'.$this->f_id.' = '.(integer) $start.' AND C1.'.$this->f_left.' >= C3.'.$this->f_left.' AND C1.'.$this->f_right.' <= C3.'.$this->f_right;
|
||||
$where .= $this->getCondition('AND','C3.');
|
||||
}
|
||||
|
||||
|
||||
$having = '';
|
||||
if ($id !== null) {
|
||||
$having = ' HAVING C2.'.$this->f_id.' = '.(integer) $id;
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf($sql,$from,$where,$having);
|
||||
|
||||
|
||||
return $this->con->select($sql);
|
||||
}
|
||||
|
||||
|
||||
public function getParents($id,$fields=array())
|
||||
{
|
||||
$fields = count($fields) > 0 ? ', C1.'.implode(', C1.',$fields) : '';
|
||||
|
||||
|
||||
return $this->con->select(
|
||||
'SELECT C1.'.$this->f_id.' '.$fields.' '
|
||||
. 'FROM '.$this->table.' C1, '.$this->table.' C2 '
|
||||
|
@ -118,11 +118,11 @@ abstract class nestedTree
|
|||
. 'ORDER BY C1.'.$this->f_left.' ASC '
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getParent($id,$fields=array())
|
||||
{
|
||||
$fields = count($fields) > 0 ? ', C1.'.implode(', C1.',$fields) : '';
|
||||
|
||||
|
||||
return $this->con->select(
|
||||
'SELECT C1.'.$this->f_id.' '.$fields.' '
|
||||
. 'FROM '.$this->table.' C1, '.$this->table.' C2 '
|
||||
|
@ -135,7 +135,7 @@ abstract class nestedTree
|
|||
. $this->con->limit(1)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------
|
||||
* Tree manipulations
|
||||
* ---------------------------------------------- */
|
||||
|
@ -144,7 +144,7 @@ abstract class nestedTree
|
|||
if (!is_array($data) && !($data instanceof cursor)) {
|
||||
throw new Exception('Invalid data block');
|
||||
}
|
||||
|
||||
|
||||
if (is_array($data))
|
||||
{
|
||||
$D = $data;
|
||||
|
@ -154,25 +154,25 @@ abstract class nestedTree
|
|||
}
|
||||
unset($D);
|
||||
}
|
||||
|
||||
|
||||
# We want to put it at the end
|
||||
$this->con->writeLock($this->table);
|
||||
try
|
||||
{
|
||||
$rs = $this->con->select('SELECT MAX('.$this->f_id.') as n_id FROM '.$this->table);
|
||||
$id = $rs->n_id;
|
||||
|
||||
|
||||
$rs = $this->con->select(
|
||||
'SELECT MAX('.$this->f_right.') as n_r '.
|
||||
'FROM '.$this->table.
|
||||
$this->getCondition('WHERE')
|
||||
);
|
||||
$last = $rs->n_r == 0 ? 1 : $rs->n_r;
|
||||
|
||||
|
||||
$data->{$this->f_id} = $id+1;
|
||||
$data->{$this->f_left} = $last+1;
|
||||
$data->{$this->f_right} = $last+2;
|
||||
|
||||
|
||||
$data->insert();
|
||||
$this->con->unlock();
|
||||
try {
|
||||
|
@ -186,7 +186,7 @@ abstract class nestedTree
|
|||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updatePosition($id,$left,$right)
|
||||
{
|
||||
$sql = 'UPDATE '.$this->table.' SET '
|
||||
|
@ -208,22 +208,22 @@ abstract class nestedTree
|
|||
public function deleteNode($node,$keep_children=true)
|
||||
{
|
||||
$node = (integer) $node;
|
||||
|
||||
|
||||
$rs = $this->getChildren(0,$node);
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('Node does not exist.');
|
||||
}
|
||||
$node_left = (integer) $rs->{$this->f_left};
|
||||
$node_right = (integer) $rs->{$this->f_right};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$this->con->begin();
|
||||
|
||||
|
||||
if ($keep_children)
|
||||
{
|
||||
$this->con->execute('DELETE FROM '.$this->table.' WHERE '.$this->f_id.' = '.$node);
|
||||
|
||||
|
||||
$sql = 'UPDATE '.$this->table.' SET '
|
||||
. $this->f_right.' = CASE '
|
||||
. 'WHEN '.$this->f_right.' BETWEEN '.$node_left.' AND '.$node_right.' '
|
||||
|
@ -241,13 +241,13 @@ abstract class nestedTree
|
|||
. 'END '
|
||||
. 'WHERE '.$this->f_right.' > '.$node_left
|
||||
. $this->getCondition();
|
||||
|
||||
|
||||
$this->con->execute($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->con->execute('DELETE FROM '.$this->table.' WHERE '.$this->f_left.' BETWEEN '.$node_left.' AND '.$node_right);
|
||||
|
||||
|
||||
$node_delta = $node_right - $node_left + 1;
|
||||
$sql = 'UPDATE '.$this->table.' SET '
|
||||
. $this->f_left.' = CASE '
|
||||
|
@ -263,7 +263,7 @@ abstract class nestedTree
|
|||
. 'WHERE '.$this->f_right.' > '.$node_right
|
||||
. $this->getCondition();
|
||||
}
|
||||
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
@ -272,7 +272,7 @@ abstract class nestedTree
|
|||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function resetOrder()
|
||||
{
|
||||
$rs = $this->con->select(
|
||||
|
@ -281,7 +281,7 @@ abstract class nestedTree
|
|||
.$this->getCondition('WHERE')
|
||||
.'ORDER BY '.$this->f_left.' ASC '
|
||||
);
|
||||
|
||||
|
||||
$lft = 2;
|
||||
$this->con->begin();
|
||||
try
|
||||
|
@ -303,7 +303,7 @@ abstract class nestedTree
|
|||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function setNodeParent($node,$target=0)
|
||||
{
|
||||
if ($node == $target) {
|
||||
|
@ -311,7 +311,7 @@ abstract class nestedTree
|
|||
}
|
||||
$node = (integer) $node;
|
||||
$target = (integer) $target;
|
||||
|
||||
|
||||
$rs = $this->getChildren(0,$node);
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('Node does not exist.');
|
||||
|
@ -319,7 +319,7 @@ abstract class nestedTree
|
|||
$node_left = (integer) $rs->{$this->f_left};
|
||||
$node_right = (integer) $rs->{$this->f_right};
|
||||
$node_level = (integer) $rs->level;
|
||||
|
||||
|
||||
if ($target > 0)
|
||||
{
|
||||
$rs = $this->getChildren(0,$target);
|
||||
|
@ -335,7 +335,7 @@ abstract class nestedTree
|
|||
$target_left = (integer) $rs->{$this->f_left};
|
||||
$target_right = (integer) $rs->{$this->f_right};
|
||||
$target_level = (integer) $rs->level;
|
||||
|
||||
|
||||
if ($node_left == $target_left
|
||||
|| ($target_left >= $node_left && $target_left <= $node_right)
|
||||
|| ($node_level == $target_level+1 && $node_left > $target_left && $node_right < $target_right)
|
||||
|
@ -343,7 +343,7 @@ abstract class nestedTree
|
|||
{
|
||||
throw new Exception('Cannot move tree');
|
||||
}
|
||||
|
||||
|
||||
if ($target_left < $node_left && $target_right > $node_right && $target_level < $node_level -1)
|
||||
{
|
||||
$sql = 'UPDATE '.$this->table.' SET '
|
||||
|
@ -404,17 +404,17 @@ abstract class nestedTree
|
|||
. 'WHERE ('.$this->f_left.' BETWEEN '.$node_left.' AND '.$target_right.' '
|
||||
. 'OR '.$this->f_right.' BETWEEN '.$node_left.' AND '.$target_right.')';
|
||||
}
|
||||
|
||||
|
||||
$sql .= ' '.$this->getCondition();
|
||||
|
||||
|
||||
$this->con->execute($sql);
|
||||
}
|
||||
|
||||
|
||||
public function setNodePosition($nodeA,$nodeB,$position='after')
|
||||
{
|
||||
$nodeA = (integer) $nodeA;
|
||||
$nodeB = (integer) $nodeB;
|
||||
|
||||
|
||||
$rs = $this->getChildren(0,$nodeA);
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('Node does not exist.');
|
||||
|
@ -422,7 +422,7 @@ abstract class nestedTree
|
|||
$A_left = $rs->{$this->f_left};
|
||||
$A_right = $rs->{$this->f_right};
|
||||
$A_level = $rs->level;
|
||||
|
||||
|
||||
$rs = $this->getChildren(0,$nodeB);
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception('Node does not exist.');
|
||||
|
@ -430,20 +430,20 @@ abstract class nestedTree
|
|||
$B_left = $rs->{$this->f_left};
|
||||
$B_right = $rs->{$this->f_right};
|
||||
$B_level = $rs->level;
|
||||
|
||||
|
||||
if ($A_level != $B_level) {
|
||||
throw new Exception('Cannot change position');
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->getParents($nodeA);
|
||||
$parentA = $rs->isEmpty() ? 0 : $rs->{$this->f_id};
|
||||
$rs = $this->getParents($nodeB);
|
||||
$parentB = $rs->isEmpty() ? 0 : $rs->{$this->f_id};
|
||||
|
||||
|
||||
if ($parentA != $parentB) {
|
||||
throw new Exception('Cannot change position');
|
||||
}
|
||||
|
||||
|
||||
if ($position == 'before')
|
||||
{
|
||||
if ($A_left > $B_left) {
|
||||
|
@ -480,17 +480,17 @@ abstract class nestedTree
|
|||
. 'WHERE '.$this->f_left.' BETWEEN '.$A_left.' AND '.$B_right;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql .= $this->getCondition();
|
||||
$this->con->execute($sql);
|
||||
}
|
||||
|
||||
|
||||
protected function getCondition($start='AND',$prefix='')
|
||||
{
|
||||
if (empty($this->add_condition)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$w = array();
|
||||
foreach ($this->add_condition as $c => $n) {
|
||||
$w[] = $prefix.$c.' = '.$n;
|
||||
|
@ -498,4 +498,3 @@ abstract class nestedTree
|
|||
return ' '.$start.' '.implode(' AND ',$w).' ';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,7 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
/**
|
||||
* @ingroup DC_CORE
|
||||
* @brief Error class
|
||||
*
|
||||
*
|
||||
* dcError is a very simple error class, with a stack. Call dcError::add to
|
||||
* add an error in stack. In administration area, errors are automatically
|
||||
* displayed.
|
||||
|
@ -29,7 +29,7 @@ class dcError
|
|||
protected $html_list = "<ul>\n%s</ul>\n";
|
||||
/** @var string HTML error item pattern */
|
||||
protected $html_item = "<li>%s</li>\n";
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*/
|
||||
|
@ -38,27 +38,27 @@ class dcError
|
|||
$this->code = 0;
|
||||
$this->msg = '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Object string representation. Returns errors stack.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$res = '';
|
||||
|
||||
|
||||
foreach ($this->errors as $msg)
|
||||
{
|
||||
$res .= $msg."\n";
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds an error to stack.
|
||||
*
|
||||
*
|
||||
* @param string $msg Error message
|
||||
*/
|
||||
public function add($msg)
|
||||
|
@ -66,17 +66,17 @@ class dcError
|
|||
$this->flag = true;
|
||||
$this->errors[] = $msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value of <var>flag</var> property. True if errors stack is not empty
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function flag()
|
||||
{
|
||||
return $this->flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets errors stack.
|
||||
*/
|
||||
|
@ -85,20 +85,20 @@ class dcError
|
|||
$this->flag = false;
|
||||
$this->errors = array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <var>errors</var> property.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets <var>list</var> and <var>item</var> properties.
|
||||
*
|
||||
*
|
||||
* @param string $list HTML errors list pattern
|
||||
* @param string $item HTML error item pattern
|
||||
*/
|
||||
|
@ -107,27 +107,26 @@ class dcError
|
|||
$this->html_list = $list;
|
||||
$this->html_item = $item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns errors stack as HTML.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHTML()
|
||||
{
|
||||
$res = '';
|
||||
|
||||
|
||||
if ($this->flag)
|
||||
{
|
||||
foreach ($this->errors as $msg)
|
||||
{
|
||||
$res .= sprintf($this->html_item,$msg);
|
||||
}
|
||||
|
||||
|
||||
$res = sprintf($this->html_list,$res);
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -15,10 +15,10 @@ class dcLog
|
|||
{
|
||||
protected $core;
|
||||
protected $prefix;
|
||||
|
||||
|
||||
/**
|
||||
Object constructor.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
*/
|
||||
public function __construct($core)
|
||||
|
@ -26,18 +26,18 @@ class dcLog
|
|||
$this->core =& $core;
|
||||
$this->prefix = $core->prefix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves logs. <b>$params</b> is an array taking the following
|
||||
optionnal parameters:
|
||||
|
||||
|
||||
- blog_id: Get logs belonging to given blog ID
|
||||
- user_id: Get logs belonging to given user ID
|
||||
- log_ip: Get logs belonging to given IP address
|
||||
- log_table: Get logs belonging to given log table
|
||||
- order: Order of results (default "ORDER BY log_dt DESC")
|
||||
- limit: Limit parameter
|
||||
|
||||
|
||||
@param params <b>array</b> Parameters
|
||||
@param count_only <b>boolean</b> Only counts results
|
||||
@return <b>record</b> A record with some more capabilities
|
||||
|
@ -53,15 +53,15 @@ class dcLog
|
|||
'L.log_ip, L.log_msg, L.blog_id, U.user_name, '.
|
||||
'U.user_firstname, U.user_displayname, U.user_url';
|
||||
}
|
||||
|
||||
|
||||
$strReq = 'SELECT '.$f.' FROM '.$this->prefix.'log L ';
|
||||
|
||||
|
||||
if (!$count_only) {
|
||||
$strReq .=
|
||||
'LEFT JOIN '.$this->prefix.'user U '.
|
||||
'ON U.user_id = L.user_id ';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params['blog_id'])) {
|
||||
if ($params['blog_id'] === 'all') {
|
||||
$strReq .= "WHERE NULL IS NULL ";
|
||||
|
@ -73,7 +73,7 @@ class dcLog
|
|||
else {
|
||||
$strReq .= "WHERE L.blog_id = '".$this->core->blog->id."' ";
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params['user_id'])) {
|
||||
$strReq .= 'AND L.user_id'.$this->core->con->in($params['user_id']);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class dcLog
|
|||
if (!empty($params['log_table'])) {
|
||||
$strReq .= 'AND log_table'.$this->core->con->in($params['log_table']);
|
||||
}
|
||||
|
||||
|
||||
if (!$count_only)
|
||||
{
|
||||
if (!empty($params['order'])) {
|
||||
|
@ -92,45 +92,45 @@ class dcLog
|
|||
$strReq .= 'ORDER BY log_dt DESC ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params['limit'])) {
|
||||
$strReq .= $this->core->con->limit($params['limit']);
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->core->con->select($strReq);
|
||||
$rs->extend('rsExtLog');
|
||||
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Creates a new log. Takes a cursor as input and returns the new log
|
||||
ID.
|
||||
|
||||
|
||||
@param cur <b>cursor</b> Log cursor
|
||||
@return <b>integer</b> New log ID
|
||||
*/
|
||||
public function addLog($cur)
|
||||
{
|
||||
$this->core->con->writeLock($this->prefix.'log');
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
# Get ID
|
||||
$rs = $this->core->con->select(
|
||||
'SELECT MAX(log_id) '.
|
||||
'FROM '.$this->prefix.'log '
|
||||
'FROM '.$this->prefix.'log '
|
||||
);
|
||||
|
||||
|
||||
$cur->log_id = (integer) $rs->f(0) + 1;
|
||||
$cur->blog_id = (string) $this->core->blog->id;
|
||||
$cur->log_dt = date('Y-m-d H:i:s');
|
||||
|
||||
|
||||
$this->getLogCursor($cur,$cur->log_id);
|
||||
|
||||
|
||||
# --BEHAVIOR-- coreBeforeLogCreate
|
||||
$this->core->callBehavior('coreBeforeLogCreate',$this,$cur);
|
||||
|
||||
|
||||
$cur->insert();
|
||||
$this->core->con->unlock();
|
||||
}
|
||||
|
@ -139,16 +139,16 @@ class dcLog
|
|||
$this->core->con->unlock();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
# --BEHAVIOR-- coreAfterLogCreate
|
||||
$this->core->callBehavior('coreAfterLogCreate',$this,$cur);
|
||||
|
||||
|
||||
return $cur->log_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Deletes a log.
|
||||
|
||||
|
||||
@param id <b>integer</b> Log ID
|
||||
*/
|
||||
public function delLogs($id,$all = false)
|
||||
|
@ -156,32 +156,32 @@ class dcLog
|
|||
$strReq = $all ?
|
||||
'TRUNCATE TABLE '.$this->prefix.'log' :
|
||||
'DELETE FROM '.$this->prefix.'log WHERE log_id'.$this->core->con->in($id);
|
||||
|
||||
|
||||
$this->core->con->execute($strReq);
|
||||
}
|
||||
|
||||
|
||||
private function getLogCursor($cur,$log_id = null)
|
||||
{
|
||||
if ($cur->log_msg === '') {
|
||||
throw new Exception(__('No log message'));
|
||||
}
|
||||
|
||||
|
||||
if ($cur->log_table === null) {
|
||||
$cur->log_table = 'none';
|
||||
}
|
||||
|
||||
|
||||
if ($cur->user_id === null) {
|
||||
$cur->user_id = 'unknown';
|
||||
}
|
||||
|
||||
|
||||
if ($cur->log_dt === '' || $cur->log_dt === null) {
|
||||
$cur->log_dt = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
|
||||
if ($cur->log_ip === null) {
|
||||
$cur->log_ip = http::realIP();
|
||||
}
|
||||
|
||||
|
||||
$log_id = is_int($log_id) ? $log_id : $cur->log_id;
|
||||
}
|
||||
}
|
||||
|
@ -192,13 +192,11 @@ class rsExtLog
|
|||
{
|
||||
$user = dcUtils::getUserCN($rs->user_id, $rs->user_name,
|
||||
$rs->user_firstname, $rs->user_displayname);
|
||||
|
||||
|
||||
if ($user === 'unknown') {
|
||||
$user = __('unknown');
|
||||
}
|
||||
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
|
@ -23,10 +23,10 @@ class dcMeta
|
|||
private $core; ///< <b>dcCore</b> dcCore instance
|
||||
private $con; ///< <b>connection</b> Database connection object
|
||||
private $table; ///< <b>string</b> Media table name
|
||||
|
||||
|
||||
/**
|
||||
Object constructor.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
*/
|
||||
public function __construct($core)
|
||||
|
@ -35,13 +35,13 @@ class dcMeta
|
|||
$this->con =& $this->core->con;
|
||||
$this->table = $this->core->prefix.'meta';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Splits up comma-separated values into an array of
|
||||
unique, URL-proof metadata values.
|
||||
|
||||
|
||||
@param str <b>string</b> Comma-separated metadata.
|
||||
|
||||
|
||||
@return <b>Array</b> The array of sanitized metadata
|
||||
*/
|
||||
public function splitMetaValues($str)
|
||||
|
@ -51,80 +51,80 @@ class dcMeta
|
|||
{
|
||||
$tag = trim($tag);
|
||||
$tag = self::sanitizeMetaID($tag);
|
||||
|
||||
|
||||
if ($tag != false) {
|
||||
$res[$i] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return array_unique($res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Make a metadata ID URL-proof.
|
||||
|
||||
|
||||
@param str <b>string</b> the metadata ID.
|
||||
|
||||
|
||||
@return <b>string</b> The sanitized metadata
|
||||
*/
|
||||
public static function sanitizeMetaID($str)
|
||||
{
|
||||
return text::tidyURL($str,false,true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts serialized metadata (for instance in dc_post post_meta)
|
||||
into a meta array.
|
||||
|
||||
|
||||
@param str <b>string</b> the serialized metadata.
|
||||
|
||||
|
||||
@return <b>Array</b> the resulting array of post meta
|
||||
*/
|
||||
public function getMetaArray($str)
|
||||
{
|
||||
$meta = @unserialize($str);
|
||||
|
||||
|
||||
if (!is_array($meta)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
return $meta;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts serialized metadata (for instance in dc_post post_meta)
|
||||
into a comma-separated meta list for a given type.
|
||||
|
||||
|
||||
@param str <b>string</b> the serialized metadata.
|
||||
@param type <b>string</b> meta type to retrieve metaIDs from.
|
||||
|
||||
|
||||
@return <b>string</b> the comma-separated list of meta
|
||||
*/
|
||||
public function getMetaStr($str,$type)
|
||||
{
|
||||
$meta = $this->getMetaArray($str);
|
||||
|
||||
|
||||
if (!isset($meta[$type])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
return implode(', ',$meta[$type]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts serialized metadata (for instance in dc_post post_meta)
|
||||
into a "fetchable" metadata record.
|
||||
|
||||
|
||||
@param str <b>string</b> the serialized metadata.
|
||||
@param type <b>string</b> meta type to retrieve metaIDs from.
|
||||
|
||||
|
||||
@return <b>record</b> the meta recordset
|
||||
*/
|
||||
public function getMetaRecordset($str,$type)
|
||||
{
|
||||
$meta = $this->getMetaArray($str);
|
||||
$data = array();
|
||||
|
||||
|
||||
if (isset($meta[$type]))
|
||||
{
|
||||
foreach ($meta[$type] as $v)
|
||||
|
@ -139,10 +139,10 @@ class dcMeta
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return staticRecord::newFromArray($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated since version 2.2 : $core->meta is always defined
|
||||
@see getMetaRecordset
|
||||
|
@ -153,21 +153,21 @@ class dcMeta
|
|||
$meta = new self($core);
|
||||
return $meta->getMetaRecordset($str,$type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Checks whether the current user is allowed to change post meta
|
||||
Checks whether the current user is allowed to change post meta
|
||||
An exception is thrown if user is not allowed.
|
||||
|
||||
|
||||
@param post_id <b>string</b> the post_id to check.
|
||||
*/
|
||||
private function checkPermissionsOnPost($post_id)
|
||||
{
|
||||
$post_id = (integer) $post_id;
|
||||
|
||||
|
||||
if (!$this->core->auth->check('usage,contentadmin',$this->core->blog->id)) {
|
||||
throw new Exception(__('You are not allowed to change this entry status'));
|
||||
}
|
||||
|
||||
|
||||
#<23>If user can only publish, we need to check the post's owner
|
||||
if (!$this->core->auth->check('contentadmin',$this->core->blog->id))
|
||||
{
|
||||
|
@ -175,53 +175,53 @@ class dcMeta
|
|||
'FROM '.$this->core->prefix.'post '.
|
||||
'WHERE post_id = '.$post_id.' '.
|
||||
"AND user_id = '".$this->con->escape($this->core->auth->userID())."' ";
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) {
|
||||
throw new Exception(__('You are not allowed to change this entry status'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Updates serialized post_meta information with dc_meta table information.
|
||||
|
||||
|
||||
@param post_id <b>string</b> the post_id to update.
|
||||
*/
|
||||
private function updatePostMeta($post_id)
|
||||
{
|
||||
$post_id = (integer) $post_id;
|
||||
|
||||
|
||||
$strReq = 'SELECT meta_id, meta_type '.
|
||||
'FROM '.$this->table.' '.
|
||||
'WHERE post_id = '.$post_id.' ';
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
$meta = array();
|
||||
while ($rs->fetch()) {
|
||||
$meta[$rs->meta_type][] = $rs->meta_id;
|
||||
}
|
||||
|
||||
|
||||
$post_meta = serialize($meta);
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->core->prefix.'post');
|
||||
$cur->post_meta = $post_meta;
|
||||
|
||||
|
||||
$cur->update('WHERE post_id = '.$post_id);
|
||||
$this->core->blog->triggerBlog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves posts corresponding to given meta criteria.
|
||||
<b>$params</b> is an array taking the following optional parameters:
|
||||
- meta_id : get posts having meta id
|
||||
- meta_id : get posts having meta id
|
||||
- meta_type : get posts having meta type
|
||||
|
||||
|
||||
@param params <b>array</b> Parameters
|
||||
@param count_only <b>boolean</b> Only counts results
|
||||
|
||||
|
||||
@return <b>record</b> the resulting posts record
|
||||
*/
|
||||
public function getPostsByMeta($params=array(),$count_only=false)
|
||||
|
@ -229,31 +229,31 @@ class dcMeta
|
|||
if (!isset($params['meta_id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$params['from'] = ', '.$this->table.' META ';
|
||||
$params['sql'] = 'AND META.post_id = P.post_id ';
|
||||
|
||||
|
||||
$params['sql'] .= "AND META.meta_id = '".$this->con->escape($params['meta_id'])."' ";
|
||||
|
||||
|
||||
if (!empty($params['meta_type'])) {
|
||||
$params['sql'] .= "AND META.meta_type = '".$this->con->escape($params['meta_type'])."' ";
|
||||
unset($params['meta_type']);
|
||||
}
|
||||
|
||||
|
||||
unset($params['meta_id']);
|
||||
|
||||
|
||||
return $this->core->blog->getPosts($params,$count_only);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves comments to posts corresponding to given meta criteria.
|
||||
<b>$params</b> is an array taking the following optional parameters:
|
||||
- meta_id : get comments to posts having meta id
|
||||
- meta_id : get comments to posts having meta id
|
||||
- meta_type : get comments to posts having meta type
|
||||
|
||||
|
||||
@param params <b>array</b> Parameters
|
||||
@param count_only <b>boolean</b> Only counts results
|
||||
|
||||
|
||||
@return <b>record</b> the resulting comments record
|
||||
*/
|
||||
public function getCommentsByMeta($params=array(),$count_only=false)
|
||||
|
@ -261,36 +261,36 @@ class dcMeta
|
|||
if (!isset($params['meta_id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$params['from'] = ', '.$this->table.' META ';
|
||||
$params['sql'] = 'AND META.post_id = P.post_id ';
|
||||
$params['sql'] .= "AND META.meta_id = '".$this->con->escape($params['meta_id'])."' ";
|
||||
|
||||
|
||||
if (!empty($params['meta_type'])) {
|
||||
$params['sql'] .= "AND META.meta_type = '".$this->con->escape($params['meta_type'])."' ";
|
||||
unset($params['meta_type']);
|
||||
}
|
||||
|
||||
|
||||
return $this->core->blog->getComments($params,$count_only);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated since 2.2. Use getMetadata and computeMetaStats instead.
|
||||
Generic-purpose metadata retrieval : gets metadatas according to given
|
||||
criteria. Metadata get enriched with stastistics columns (only relevant
|
||||
if limit parameter is not set). Metadata are sorted by post count
|
||||
criteria. Metadata get enriched with stastistics columns (only relevant
|
||||
if limit parameter is not set). Metadata are sorted by post count
|
||||
descending
|
||||
|
||||
|
||||
@param type <b>string</b> if not null, get metas having the given type
|
||||
@param limit <b>string</b> if not null, number of max fetched metas
|
||||
@param meta_id <b>string</b> if not null, get metas having the given id
|
||||
@param post_id <b>string</b> if not null, get metas for the given post id
|
||||
|
||||
|
||||
@return <b>record</b> the meta recordset
|
||||
*/
|
||||
public function getMeta($type=null,$limit=null,$meta_id=null,$post_id=null) {
|
||||
$params = array();
|
||||
|
||||
|
||||
if ($type != null)
|
||||
$params['meta_type'] = $type;
|
||||
if ($limit != null)
|
||||
|
@ -302,21 +302,21 @@ class dcMeta
|
|||
$rs = $this->getMetadata($params, false);
|
||||
return $this->computeMetaStats($rs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Generic-purpose metadata retrieval : gets metadatas according to given
|
||||
criteria. <b>$params</b> is an array taking the following
|
||||
optionnal parameters:
|
||||
|
||||
|
||||
- type: get metas having the given type
|
||||
- meta_id: if not null, get metas having the given id
|
||||
- post_id: get metas for the given post id
|
||||
- limit: number of max fetched metas
|
||||
- order: results order (default : posts count DESC)
|
||||
|
||||
|
||||
@param params <b>array</b> Parameters
|
||||
@param count_only <b>boolean</b> Only counts results
|
||||
|
||||
|
||||
@return <b>record</b> the resulting comments record
|
||||
*/
|
||||
public function getMetadata($params=array(), $count_only=false)
|
||||
|
@ -326,68 +326,68 @@ class dcMeta
|
|||
} else {
|
||||
$strReq = 'SELECT M.meta_id, M.meta_type, COUNT(M.post_id) as count ';
|
||||
}
|
||||
|
||||
|
||||
$strReq .=
|
||||
'FROM '.$this->table.' M LEFT JOIN '.$this->core->prefix.'post P '.
|
||||
'ON M.post_id = P.post_id '.
|
||||
"WHERE P.blog_id = '".$this->con->escape($this->core->blog->id)."' ";
|
||||
|
||||
|
||||
if (isset($params['meta_type'])) {
|
||||
$strReq .= " AND meta_type = '".$this->con->escape($params['meta_type'])."' ";
|
||||
}
|
||||
|
||||
|
||||
if (isset($params['meta_id'])) {
|
||||
$strReq .= " AND meta_id = '".$this->con->escape($params['meta_id'])."' ";
|
||||
}
|
||||
|
||||
|
||||
if (isset($params['post_id'])) {
|
||||
$strReq .= ' AND P.post_id '.$this->con->in($params['post_id']).' ';
|
||||
}
|
||||
|
||||
|
||||
if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) {
|
||||
$strReq .= 'AND ((post_status = 1 ';
|
||||
|
||||
|
||||
if ($this->core->blog->without_password) {
|
||||
$strReq .= 'AND post_password IS NULL ';
|
||||
}
|
||||
$strReq .= ') ';
|
||||
|
||||
|
||||
if ($this->core->auth->userID()) {
|
||||
$strReq .= "OR P.user_id = '".$this->con->escape($this->core->auth->userID())."')";
|
||||
} else {
|
||||
$strReq .= ') ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$count_only) {
|
||||
if (!isset($params['order'])) {
|
||||
$params['order'] = 'count DESC';
|
||||
}
|
||||
|
||||
|
||||
$strReq .=
|
||||
'GROUP BY meta_id,meta_type,P.blog_id '.
|
||||
'ORDER BY '.$params['order'];
|
||||
|
||||
|
||||
if (isset($params['limit'])) {
|
||||
$strReq .= $this->con->limit($params['limit']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Computes statistics from a metadata recordset.
|
||||
Each record gets enriched with lowercase name, percent and roundpercent columns
|
||||
|
||||
|
||||
@param rs <b>record</b> recordset to enrich
|
||||
|
||||
|
||||
@return <b>record</b> the enriched recordset
|
||||
*/
|
||||
public function computeMetaStats($rs) {
|
||||
$rs_static = $rs->toStatic();
|
||||
|
||||
|
||||
$max = array();
|
||||
while ($rs_static->fetch())
|
||||
{
|
||||
|
@ -400,24 +400,24 @@ class dcMeta
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while ($rs_static->fetch())
|
||||
{
|
||||
$rs_static->set('meta_id_lower',mb_strtolower($rs_static->meta_id));
|
||||
|
||||
|
||||
$count = $rs_static->count;
|
||||
$percent = ((integer) $rs_static->count) * 100 / $max[$rs_static->meta_type];
|
||||
|
||||
|
||||
$rs_static->set('percent',(integer) round($percent));
|
||||
$rs_static->set('roundpercent',round($percent/10)*10);
|
||||
}
|
||||
|
||||
|
||||
return $rs_static;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Adds a metadata to a post.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> the post id
|
||||
@param type <b>string</b> meta type
|
||||
@param value <b>integer</b> meta value
|
||||
|
@ -425,23 +425,23 @@ class dcMeta
|
|||
public function setPostMeta($post_id,$type,$value)
|
||||
{
|
||||
$this->checkPermissionsOnPost($post_id);
|
||||
|
||||
|
||||
$value = trim($value);
|
||||
if ($value === false) { return; }
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->table);
|
||||
|
||||
|
||||
$cur->post_id = (integer) $post_id;
|
||||
$cur->meta_id = (string) $value;
|
||||
$cur->meta_type = (string) $type;
|
||||
|
||||
|
||||
$cur->insert();
|
||||
$this->updatePostMeta((integer) $post_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Removes metadata from a post.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> the post id
|
||||
@param type <b>string</b> meta type (if null, delete all types)
|
||||
@param value <b>integer</b> meta value (if null, delete all values)
|
||||
|
@ -449,27 +449,27 @@ class dcMeta
|
|||
public function delPostMeta($post_id,$type=null,$meta_id=null)
|
||||
{
|
||||
$post_id = (integer) $post_id;
|
||||
|
||||
|
||||
$this->checkPermissionsOnPost($post_id);
|
||||
|
||||
|
||||
$strReq = 'DELETE FROM '.$this->table.' '.
|
||||
'WHERE post_id = '.$post_id;
|
||||
|
||||
|
||||
if ($type !== null) {
|
||||
$strReq .= " AND meta_type = '".$this->con->escape($type)."' ";
|
||||
}
|
||||
|
||||
|
||||
if ($meta_id !== null) {
|
||||
$strReq .= " AND meta_id = '".$this->con->escape($meta_id)."' ";
|
||||
}
|
||||
|
||||
|
||||
$this->con->execute($strReq);
|
||||
$this->updatePostMeta((integer) $post_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Mass updates metadata for a given post_type.
|
||||
|
||||
|
||||
@param meta_id <b>integer</b> old value
|
||||
@param new_meta <b>integer</b> new value
|
||||
@param type <b>string</b> meta type (if null, select all types)
|
||||
|
@ -479,53 +479,53 @@ class dcMeta
|
|||
public function updateMeta($meta_id,$new_meta_id,$type=null,$post_type=null)
|
||||
{
|
||||
$new_meta_id = self::sanitizeMetaID($new_meta_id);
|
||||
|
||||
|
||||
if ($new_meta_id == $meta_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$getReq = 'SELECT M.post_id '.
|
||||
'FROM '.$this->table.' M, '.$this->core->prefix.'post P '.
|
||||
'WHERE P.post_id = M.post_id '.
|
||||
"AND P.blog_id = '".$this->con->escape($this->core->blog->id)."' ".
|
||||
"AND meta_id = '%s' ";
|
||||
|
||||
|
||||
if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) {
|
||||
$getReq .= "AND P.user_id = '".$this->con->escape($this->core->auth->userID())."' ";
|
||||
}
|
||||
if ($post_type !== null) {
|
||||
$getReq .= "AND P.post_type = '".$this->con->escape($post_type)."' ";
|
||||
}
|
||||
|
||||
|
||||
$delReq = 'DELETE FROM '.$this->table.' '.
|
||||
'WHERE post_id IN (%s) '.
|
||||
"AND meta_id = '%s' ";
|
||||
|
||||
|
||||
$updReq = 'UPDATE '.$this->table.' '.
|
||||
"SET meta_id = '%s' ".
|
||||
'WHERE post_id IN (%s) '.
|
||||
"AND meta_id = '%s' ";
|
||||
|
||||
|
||||
if ($type !== null) {
|
||||
$plus = " AND meta_type = '%s' ";
|
||||
$getReq .= $plus;
|
||||
$delReq .= $plus;
|
||||
$updReq .= $plus;
|
||||
}
|
||||
|
||||
|
||||
$to_update = $to_remove = array();
|
||||
|
||||
|
||||
$rs = $this->con->select(sprintf($getReq,$this->con->escape($meta_id),
|
||||
$this->con->escape($type)));
|
||||
|
||||
|
||||
while ($rs->fetch()) {
|
||||
$to_update[] = $rs->post_id;
|
||||
}
|
||||
|
||||
|
||||
if (empty($to_update)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->select(sprintf($getReq,$new_meta_id,$type));
|
||||
while ($rs->fetch()) {
|
||||
if (in_array($rs->post_id,$to_update)) {
|
||||
|
@ -533,19 +533,19 @@ class dcMeta
|
|||
unset($to_update[array_search($rs->post_id,$to_update)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Delete duplicate meta
|
||||
if (!empty($to_remove))
|
||||
{
|
||||
$this->con->execute(sprintf($delReq,implode(',',$to_remove),
|
||||
$this->con->escape($meta_id),
|
||||
$this->con->escape($type)));
|
||||
|
||||
|
||||
foreach ($to_remove as $post_id) {
|
||||
$this->updatePostMeta($post_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Update meta
|
||||
if (!empty($to_update))
|
||||
{
|
||||
|
@ -553,18 +553,18 @@ class dcMeta
|
|||
implode(',',$to_update),
|
||||
$this->con->escape($meta_id),
|
||||
$this->con->escape($type)));
|
||||
|
||||
|
||||
foreach ($to_update as $post_id) {
|
||||
$this->updatePostMeta($post_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Mass delete metadata for a given post_type.
|
||||
|
||||
|
||||
@param meta_id <b>integer</b> meta value
|
||||
@param type <b>string</b> meta type (if null, select all types)
|
||||
@param post_type <b>integer</b> impacted post_type (if null, select all types)
|
||||
|
@ -577,39 +577,38 @@ class dcMeta
|
|||
'WHERE P.post_id = M.post_id '.
|
||||
"AND P.blog_id = '".$this->con->escape($this->core->blog->id)."' ".
|
||||
"AND meta_id = '".$this->con->escape($meta_id)."' ";
|
||||
|
||||
|
||||
if ($type !== null) {
|
||||
$strReq .= " AND meta_type = '".$this->con->escape($type)."' ";
|
||||
}
|
||||
|
||||
|
||||
if ($post_type !== null) {
|
||||
$strReq .= " AND P.post_type = '".$this->con->escape($post_type)."' ";
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
if ($rs->isEmpty()) return array();
|
||||
|
||||
|
||||
$ids = array();
|
||||
while ($rs->fetch()) {
|
||||
$ids[] = $rs->post_id;
|
||||
}
|
||||
|
||||
|
||||
$strReq = 'DELETE FROM '.$this->table.' '.
|
||||
'WHERE post_id IN ('.implode(',',$ids).') '.
|
||||
"AND meta_id = '".$this->con->escape($meta_id)."' ";
|
||||
|
||||
|
||||
if ($type !== null) {
|
||||
$strReq .= " AND meta_type = '".$this->con->escape($type)."' ";
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->execute($strReq);
|
||||
|
||||
|
||||
foreach ($ids as $post_id) {
|
||||
$this->updatePostMeta($post_id);
|
||||
}
|
||||
|
||||
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -15,7 +15,7 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
@ingroup DC_CORE
|
||||
@brief Modules handler
|
||||
|
||||
Provides an object to handle modules (themes or plugins).
|
||||
Provides an object to handle modules (themes or plugins).
|
||||
*/
|
||||
class dcModules
|
||||
{
|
||||
|
@ -25,39 +25,39 @@ class dcModules
|
|||
protected $disabled = array();
|
||||
protected $errors = array();
|
||||
protected $modules_names = array();
|
||||
|
||||
|
||||
protected $id;
|
||||
protected $mroot;
|
||||
|
||||
|
||||
# Inclusion variables
|
||||
protected static $superglobals = array('GLOBALS','_SERVER','_GET','_POST','_COOKIE','_FILES','_ENV','_REQUEST','_SESSION');
|
||||
protected static $_k;
|
||||
protected static $_n;
|
||||
|
||||
protected static $type = null;
|
||||
|
||||
|
||||
public $core; ///< <b>dcCore</b> dcCore instance
|
||||
|
||||
|
||||
/**
|
||||
Object constructor.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
*/
|
||||
public function __construct($core)
|
||||
{
|
||||
$this->core =& $core;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Loads modules. <var>$path</var> could be a separated list of paths
|
||||
(path separator depends on your OS).
|
||||
|
||||
|
||||
<var>$ns</var> indicates if an additionnal file needs to be loaded on plugin
|
||||
load, value could be:
|
||||
- admin (loads module's _admin.php)
|
||||
- public (loads module's _public.php)
|
||||
- xmlrpc (loads module's _xmlrpc.php)
|
||||
|
||||
|
||||
<var>$lang</var> indicates if we need to load a lang file on plugin
|
||||
loading.
|
||||
*/
|
||||
|
@ -65,28 +65,28 @@ class dcModules
|
|||
{
|
||||
$this->path = explode(PATH_SEPARATOR,$path);
|
||||
$this->ns = $ns;
|
||||
|
||||
|
||||
$disabled = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'];
|
||||
$disabled = $disabled && !get_parent_class($this) ? true : false;
|
||||
|
||||
|
||||
foreach ($this->path as $root)
|
||||
{
|
||||
if (!is_dir($root) || !is_readable($root)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (substr($root,-1) != '/') {
|
||||
$root .= '/';
|
||||
}
|
||||
|
||||
|
||||
if (($d = @dir($root)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
while (($entry = $d->read()) !== false)
|
||||
{
|
||||
$full_entry = $root.$entry;
|
||||
|
||||
|
||||
if ($entry != '.' && $entry != '..' && is_dir($full_entry)
|
||||
&& file_exists($full_entry.'/_define.php'))
|
||||
{
|
||||
|
@ -109,24 +109,24 @@ class dcModules
|
|||
}
|
||||
$d->close();
|
||||
}
|
||||
|
||||
|
||||
# Sort plugins
|
||||
uasort($this->modules,array($this,'sortModules'));
|
||||
|
||||
|
||||
# Load translation, _prepend and ns_file
|
||||
foreach ($this->modules as $id => $m)
|
||||
{
|
||||
if (file_exists($m['root'].'/_prepend.php'))
|
||||
{
|
||||
$r = $this->loadModuleFile($m['root'].'/_prepend.php');
|
||||
|
||||
|
||||
# If _prepend.php file returns null (ie. it has a void return statement)
|
||||
if (is_null($r)) {
|
||||
continue;
|
||||
}
|
||||
unset($r);
|
||||
}
|
||||
|
||||
|
||||
$this->loadModuleL10N($id,$lang,'main');
|
||||
if ($ns == 'admin') {
|
||||
$this->loadModuleL10Nresources($id,$lang);
|
||||
|
@ -134,7 +134,7 @@ class dcModules
|
|||
$this->loadNsFile($id,$ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function requireDefine($dir,$id)
|
||||
{
|
||||
if (file_exists($dir.'/_define.php')) {
|
||||
|
@ -142,24 +142,24 @@ class dcModules
|
|||
require $dir.'/_define.php';
|
||||
$this->id = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
This method registers a module in modules list. You should use this to
|
||||
register a new module.
|
||||
|
||||
|
||||
<var>$permissions</var> is a comma separated list of permissions for your
|
||||
module. If <var>$permissions</var> is null, only super admin has access to
|
||||
this module.
|
||||
|
||||
|
||||
<var>$priority</var> is an integer. Modules are sorted by priority and name.
|
||||
Lowest priority comes first.
|
||||
|
||||
|
||||
@param name <b>string</b> Module name
|
||||
@param desc <b>string</b> Module description
|
||||
@param author <b>string</b> Module author name
|
||||
@param version <b>string</b> Module version
|
||||
@param properties <b>array</b> extra properties
|
||||
@param properties <b>array</b> extra properties
|
||||
(currently available keys : permissions, priority, type)
|
||||
*/
|
||||
public function registerModule($name,$desc,$author,$version, $properties = array())
|
||||
|
@ -206,7 +206,7 @@ class dcModules
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Check module install on multiple path
|
||||
if ($this->id) {
|
||||
$module_exists = array_key_exists($name,$this->modules_names);
|
||||
|
@ -237,19 +237,19 @@ class dcModules
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function resetModulesList()
|
||||
{
|
||||
$this->modules = array();
|
||||
$this->modules_names = array();
|
||||
$this->errors = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function installPackage($zip_file,dcModules &$modules)
|
||||
{
|
||||
$zip = new fileUnzip($zip_file);
|
||||
$zip->getList(false,'#(^|/)(__MACOSX|\.svn|\.hg|\.git|\.DS_Store|\.directory|Thumbs\.db)(/|$)#');
|
||||
|
||||
|
||||
$zip_root_dir = $zip->getRootDir();
|
||||
$define = '';
|
||||
if ($zip_root_dir != false) {
|
||||
|
@ -263,39 +263,39 @@ class dcModules
|
|||
$define = '_define.php';
|
||||
$has_define = $zip->hasFile($define);
|
||||
}
|
||||
|
||||
|
||||
if ($zip->isEmpty()) {
|
||||
$zip->close();
|
||||
unlink($zip_file);
|
||||
throw new Exception(__('Empty module zip file.'));
|
||||
}
|
||||
|
||||
|
||||
if (!$has_define) {
|
||||
$zip->close();
|
||||
unlink($zip_file);
|
||||
throw new Exception(__('The zip file does not appear to be a valid Dotclear module.'));
|
||||
}
|
||||
|
||||
|
||||
$ret_code = 1;
|
||||
|
||||
|
||||
if (!is_dir($destination))
|
||||
{
|
||||
try {
|
||||
files::makeDir($destination,true);
|
||||
|
||||
|
||||
$sandbox = clone $modules;
|
||||
$zip->unzip($define, $target.'/_define.php');
|
||||
|
||||
|
||||
$sandbox->resetModulesList();
|
||||
$sandbox->requireDefine($target,basename($destination));
|
||||
unlink($target.'/_define.php');
|
||||
|
||||
|
||||
$new_errors = $sandbox->getErrors();
|
||||
if (!empty($new_errors)) {
|
||||
$new_errors = is_array($new_errors) ? implode(" \n",$new_errors) : $new_errors;
|
||||
throw new Exception($new_errors);
|
||||
}
|
||||
|
||||
|
||||
files::deltree($destination);
|
||||
}
|
||||
catch(Exception $e)
|
||||
|
@ -303,7 +303,7 @@ class dcModules
|
|||
$zip->close();
|
||||
unlink($zip_file);
|
||||
files::deltree($destination);
|
||||
throw new Exception($e->getMessage());
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -311,12 +311,12 @@ class dcModules
|
|||
# test for update
|
||||
$sandbox = clone $modules;
|
||||
$zip->unzip($define, $target.'/_define.php');
|
||||
|
||||
|
||||
$sandbox->resetModulesList();
|
||||
$sandbox->requireDefine($target,basename($destination));
|
||||
unlink($target.'/_define.php');
|
||||
$new_modules = $sandbox->getModules();
|
||||
|
||||
|
||||
if (!empty($new_modules))
|
||||
{
|
||||
$tmp = array_keys($new_modules);
|
||||
|
@ -334,14 +334,14 @@ class dcModules
|
|||
{
|
||||
$zip->close();
|
||||
unlink($zip_file);
|
||||
throw new Exception(sprintf(__('Unable to upgrade "%s". (older or same version)'),basename($destination)));
|
||||
throw new Exception(sprintf(__('Unable to upgrade "%s". (older or same version)'),basename($destination)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$zip->close();
|
||||
unlink($zip_file);
|
||||
throw new Exception(sprintf(__('Unable to read new _define.php file')));
|
||||
throw new Exception(sprintf(__('Unable to read new _define.php file')));
|
||||
}
|
||||
}
|
||||
$zip->unzipAll($target);
|
||||
|
@ -349,10 +349,10 @@ class dcModules
|
|||
unlink($zip_file);
|
||||
return $ret_code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This method installs all modules having a _install file.
|
||||
|
||||
|
||||
@see dcModules::installModule
|
||||
*/
|
||||
public function installModules()
|
||||
|
@ -367,17 +367,17 @@ class dcModules
|
|||
$res['failure'][$id] = $msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This method installs module with ID <var>$id</var> and having a _install
|
||||
file. This file should throw exception on failure or true if it installs
|
||||
successfully.
|
||||
|
||||
|
||||
<var>$msg</var> is an out parameter that handle installer message.
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@param msg <b>string</b> Module installer message
|
||||
@return <b>boolean</b>
|
||||
|
@ -393,10 +393,10 @@ class dcModules
|
|||
$msg = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function deleteModule($id,$disabled=false)
|
||||
{
|
||||
if ($disabled) {
|
||||
|
@ -404,52 +404,52 @@ class dcModules
|
|||
} else {
|
||||
$p =& $this->modules;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($p[$id])) {
|
||||
throw new Exception(__('No such module.'));
|
||||
}
|
||||
|
||||
|
||||
if (!files::deltree($p[$id]['root'])) {
|
||||
throw new Exception(__('Cannot remove module files'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deactivateModule($id)
|
||||
{
|
||||
if (!isset($this->modules[$id])) {
|
||||
throw new Exception(__('No such module.'));
|
||||
}
|
||||
|
||||
|
||||
if (!$this->modules[$id]['root_writable']) {
|
||||
throw new Exception(__('Cannot deactivate plugin.'));
|
||||
}
|
||||
|
||||
|
||||
if (@file_put_contents($this->modules[$id]['root'].'/_disabled','')) {
|
||||
throw new Exception(__('Cannot deactivate plugin.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function activateModule($id)
|
||||
{
|
||||
if (!isset($this->disabled[$id])) {
|
||||
throw new Exception(__('No such module.'));
|
||||
}
|
||||
|
||||
|
||||
if (!$this->disabled[$id]['root_writable']) {
|
||||
throw new Exception(__('Cannot activate plugin.'));
|
||||
}
|
||||
|
||||
|
||||
if (@unlink($this->disabled[$id]['root'].'/_disabled') === false) {
|
||||
throw new Exception(__('Cannot activate plugin.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This method will search for file <var>$file</var> in language
|
||||
<var>$lang</var> for module <var>$id</var>.
|
||||
|
||||
|
||||
<var>$file</var> should not have any extension.
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@param lang <b>string</b> Language code
|
||||
@param file <b>string</b> File name (without extension)
|
||||
|
@ -459,29 +459,29 @@ class dcModules
|
|||
if (!$lang || !isset($this->modules[$id])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$lfile = $this->modules[$id]['root'].'/locales/%s/%s';
|
||||
if (l10n::set(sprintf($lfile,$lang,$file)) === false && $lang != 'en') {
|
||||
l10n::set(sprintf($lfile,'en',$file));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function loadModuleL10Nresources($id,$lang)
|
||||
{
|
||||
if (!$lang || !isset($this->modules[$id])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$f = l10n::getFilePath($this->modules[$id]['root'].'/locales','resources.php',$lang);
|
||||
if ($f) {
|
||||
$this->loadModuleFile($f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns all modules associative array or only one module if <var>$id</var>
|
||||
is present.
|
||||
|
||||
|
||||
@param id <b>string</b> Optionnal module ID
|
||||
@return <b>array</b>
|
||||
*/
|
||||
|
@ -492,10 +492,10 @@ class dcModules
|
|||
}
|
||||
return $this->modules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns true if the module with ID <var>$id</var> exists.
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -503,20 +503,20 @@ class dcModules
|
|||
{
|
||||
return isset($this->modules[$id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns all disabled modules in an array
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function getDisabledModules()
|
||||
{
|
||||
return $this->disabled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns root path for module with ID <var>$id</var>.
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -524,7 +524,7 @@ class dcModules
|
|||
{
|
||||
return $this->moduleInfo($id,'root');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a module information that could be:
|
||||
- root
|
||||
|
@ -534,7 +534,7 @@ class dcModules
|
|||
- version
|
||||
- permissions
|
||||
- priority
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@param info <b>string</b> Information to retrieve
|
||||
@return <b>string</b>
|
||||
|
@ -543,10 +543,10 @@ class dcModules
|
|||
{
|
||||
return isset($this->modules[$id][$info]) ? $this->modules[$id][$info] : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Loads namespace <var>$ns</var> specific files for all modules.
|
||||
|
||||
|
||||
@param ns <b>string</b> Namespace name
|
||||
*/
|
||||
public function loadNsFiles($ns=null)
|
||||
|
@ -555,11 +555,11 @@ class dcModules
|
|||
$this->loadNsFile($k,$ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Loads namespace <var>$ns</var> specific file for module with ID
|
||||
<var>$id</var>
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@param ns <b>string</b> Namespace name
|
||||
*/
|
||||
|
@ -577,36 +577,35 @@ class dcModules
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
|
||||
protected function loadModuleFile($________)
|
||||
{
|
||||
if (!file_exists($________)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
self::$_k = array_keys($GLOBALS);
|
||||
|
||||
|
||||
foreach (self::$_k as self::$_n) {
|
||||
if (!in_array(self::$_n,self::$superglobals)) {
|
||||
global ${self::$_n};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return require $________;
|
||||
}
|
||||
|
||||
|
||||
private function sortModules($a,$b)
|
||||
{
|
||||
if ($a['priority'] == $b['priority']) {
|
||||
return strcasecmp($a['name'],$b['name']);
|
||||
}
|
||||
|
||||
|
||||
return ($a['priority'] < $b['priority']) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -21,16 +21,16 @@ class dcNamespace
|
|||
protected $con; ///< <b>connection</b> Database connection object
|
||||
protected $table; ///< <b>string</b> Settings table name
|
||||
protected $blog_id; ///< <b>string</b> Blog ID
|
||||
|
||||
|
||||
protected $global_settings = array(); ///< <b>array</b> Global settings array
|
||||
protected $local_settings = array(); ///< <b>array</b> Local settings array
|
||||
protected $settings = array(); ///< <b>array</b> Associative settings array
|
||||
protected $ns; ///< <b>string</b> Current namespace
|
||||
|
||||
|
||||
/**
|
||||
Object constructor. Retrieves blog settings and puts them in $settings
|
||||
array. Local (blog) settings have a highest priority than global settings.
|
||||
|
||||
|
||||
@param name <b>string</b> ID for this namespace
|
||||
*/
|
||||
public function __construct(&$core, $blog_id, $name, $rs=null)
|
||||
|
@ -40,16 +40,16 @@ class dcNamespace
|
|||
} else {
|
||||
throw new Exception(sprintf(__('Invalid setting dcNamespace: %s'),$name));
|
||||
}
|
||||
|
||||
|
||||
$this->con =& $core->con;
|
||||
$this->table = $core->prefix.'setting';
|
||||
$this->blog_id =& $blog_id;
|
||||
|
||||
|
||||
$this->getSettings($rs);
|
||||
}
|
||||
|
||||
|
||||
private function getSettings($rs=null)
|
||||
{
|
||||
{
|
||||
if ($rs == null) {
|
||||
$strReq = 'SELECT blog_id, setting_id, setting_value, '.
|
||||
'setting_type, setting_label, setting_ns '.
|
||||
|
@ -58,7 +58,7 @@ class dcNamespace
|
|||
'OR blog_id IS NULL) '.
|
||||
"AND setting_ns = '".$this->con->escape($this->ns)."' ".
|
||||
'ORDER BY setting_id DESC ';
|
||||
|
||||
|
||||
try {
|
||||
$rs = $this->con->select($strReq);
|
||||
} catch (Exception $e) {
|
||||
|
@ -73,17 +73,17 @@ class dcNamespace
|
|||
$id = trim($rs->f('setting_id'));
|
||||
$value = $rs->f('setting_value');
|
||||
$type = $rs->f('setting_type');
|
||||
|
||||
|
||||
if ($type == 'float' || $type == 'double') {
|
||||
$type = 'float';
|
||||
} elseif ($type != 'boolean' && $type != 'integer') {
|
||||
$type = 'string';
|
||||
}
|
||||
|
||||
|
||||
settype($value,$type);
|
||||
|
||||
|
||||
$array = $rs->blog_id ? 'local' : 'global';
|
||||
|
||||
|
||||
$this->{$array.'_settings'}[$id] = array(
|
||||
'ns' => $this->ns,
|
||||
'value' => $value,
|
||||
|
@ -92,25 +92,25 @@ class dcNamespace
|
|||
'global' => $rs->blog_id == ''
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->settings = $this->global_settings;
|
||||
|
||||
|
||||
foreach ($this->local_settings as $id => $v) {
|
||||
$this->settings[$id] = $v;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private function settingExists($id,$global=false)
|
||||
{
|
||||
$array = $global ? 'global' : 'local';
|
||||
return isset($this->{$array.'_settings'}[$id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns setting value if exists.
|
||||
|
||||
|
||||
@param n <b>string</b> Setting name
|
||||
@return <b>mixed</b>
|
||||
*/
|
||||
|
@ -119,10 +119,10 @@ class dcNamespace
|
|||
if (isset($this->settings[$n]['value'])) {
|
||||
return $this->settings[$n]['value'];
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Magic __get method.
|
||||
@copydoc ::get
|
||||
|
@ -131,11 +131,11 @@ class dcNamespace
|
|||
{
|
||||
return $this->get($n);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Sets a setting in $settings property. This sets the setting for script
|
||||
execution time only and if setting exists.
|
||||
|
||||
|
||||
@param n <b>string</b> Setting name
|
||||
@param v <b>mixed</b> Setting value
|
||||
*/
|
||||
|
@ -145,7 +145,7 @@ class dcNamespace
|
|||
$this->settings[$n]['value'] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Magic __set method.
|
||||
@copydoc ::set
|
||||
|
@ -154,16 +154,16 @@ class dcNamespace
|
|||
{
|
||||
$this->set($n,$v);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Creates or updates a setting.
|
||||
|
||||
|
||||
$type could be 'string', 'integer', 'float', 'boolean' or null. If $type is
|
||||
null and setting exists, it will keep current setting type.
|
||||
|
||||
|
||||
$value_change allow you to not change setting. Useful if you need to change
|
||||
a setting label or type and don't want to change its value.
|
||||
|
||||
|
||||
@param id <b>string</b> Setting ID
|
||||
@param value <b>mixed</b> Setting value
|
||||
@param type <b>string</b> Setting type
|
||||
|
@ -176,7 +176,7 @@ class dcNamespace
|
|||
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_]+$/',$id)) {
|
||||
throw new Exception(sprintf(__('%s is not a valid setting id'),$id));
|
||||
}
|
||||
|
||||
|
||||
# We don't want to change setting value
|
||||
if (!$value_change)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ class dcNamespace
|
|||
$value = $this->global_settings[$id]['value'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Setting type
|
||||
if ($type == 'double')
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ class dcNamespace
|
|||
{
|
||||
$type = 'string';
|
||||
}
|
||||
|
||||
|
||||
# We don't change label
|
||||
if ($label == null)
|
||||
{
|
||||
|
@ -216,21 +216,21 @@ class dcNamespace
|
|||
$label = $this->global_settings[$id]['label'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
settype($value,$type);
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->table);
|
||||
$cur->setting_value = ($type == 'boolean') ? (string) (integer) $value : (string) $value;
|
||||
$cur->setting_type = $type;
|
||||
$cur->setting_label = $label;
|
||||
|
||||
|
||||
#If we are local, compare to global value
|
||||
if (!$global && $this->settingExists($id,true))
|
||||
{
|
||||
$g = $this->global_settings[$id];
|
||||
$same_setting = $g['ns'] == $this->ns && $g['value'] == $value
|
||||
&& $g['type'] == $type && $g['label'] == $label;
|
||||
|
||||
|
||||
# Drop setting if same value as global
|
||||
if ($same_setting && $this->settingExists($id,false)) {
|
||||
$this->drop($id);
|
||||
|
@ -238,7 +238,7 @@ class dcNamespace
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->settingExists($id,$global) && $this->ns == $this->settings[$id]['ns'])
|
||||
{
|
||||
if ($global) {
|
||||
|
@ -246,7 +246,7 @@ class dcNamespace
|
|||
} else {
|
||||
$where = "WHERE blog_id = '".$this->con->escape($this->blog_id)."' ";
|
||||
}
|
||||
|
||||
|
||||
$cur->update($where."AND setting_id = '".$this->con->escape($id)."' AND setting_ns = '".$this->con->escape($this->ns)."' ");
|
||||
}
|
||||
else
|
||||
|
@ -254,7 +254,7 @@ class dcNamespace
|
|||
$cur->setting_id = $id;
|
||||
$cur->blog_id = $global ? null : $this->blog_id;
|
||||
$cur->setting_ns = $this->ns;
|
||||
|
||||
|
||||
$cur->insert();
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ class dcNamespace
|
|||
if (!$this->ns) {
|
||||
throw new Exception(__('No namespace specified'));
|
||||
}
|
||||
|
||||
|
||||
if (!array_key_exists($oldId,$this->settings) || array_key_exists($newId,$this->settings)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -290,8 +290,8 @@ class dcNamespace
|
|||
}
|
||||
|
||||
/**
|
||||
Removes an existing setting in a Namespace
|
||||
|
||||
Removes an existing setting in a Namespace
|
||||
|
||||
@param id <b>string</b> Setting ID
|
||||
*/
|
||||
public function drop($id)
|
||||
|
@ -299,24 +299,24 @@ class dcNamespace
|
|||
if (!$this->ns) {
|
||||
throw new Exception(__('No namespace specified'));
|
||||
}
|
||||
|
||||
|
||||
$strReq = 'DELETE FROM '.$this->table.' ';
|
||||
|
||||
|
||||
if ($this->blog_id === null) {
|
||||
$strReq .= 'WHERE blog_id IS NULL ';
|
||||
} else {
|
||||
$strReq .= "WHERE blog_id = '".$this->con->escape($this->blog_id)."' ";
|
||||
}
|
||||
|
||||
|
||||
$strReq .= "AND setting_id = '".$this->con->escape($id)."' ";
|
||||
$strReq .= "AND setting_ns = '".$this->con->escape($this->ns)."' ";
|
||||
|
||||
|
||||
$this->con->execute($strReq);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Removes all existing settings in a Namespace
|
||||
|
||||
Removes all existing settings in a Namespace
|
||||
|
||||
@param force_global <b>boolean</b> Force global pref drop
|
||||
*/
|
||||
public function dropAll($force_global=false)
|
||||
|
@ -324,9 +324,9 @@ class dcNamespace
|
|||
if (!$this->ns) {
|
||||
throw new Exception(__('No namespace specified'));
|
||||
}
|
||||
|
||||
|
||||
$strReq = 'DELETE FROM '.$this->table.' ';
|
||||
|
||||
|
||||
if (($force_global) || ($this->blog_id === null)) {
|
||||
$strReq .= 'WHERE blog_id IS NULL ';
|
||||
$global = true;
|
||||
|
@ -334,32 +334,32 @@ class dcNamespace
|
|||
$strReq .= "WHERE blog_id = '".$this->con->escape($this->blog_id)."' ";
|
||||
$global = false;
|
||||
}
|
||||
|
||||
|
||||
$strReq .= "AND setting_ns = '".$this->con->escape($this->ns)."' ";
|
||||
|
||||
|
||||
$this->con->execute($strReq);
|
||||
|
||||
|
||||
$array = $global ? 'global' : 'local';
|
||||
unset($this->{$array.'_settings'});
|
||||
$this->{$array.'_settings'} = array();
|
||||
|
||||
|
||||
$array = $global ? 'local' : 'global';
|
||||
$this->settings = $this->{$array.'_settings'};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns $settings property content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpSettings()
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns $global_settings property content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpGlobalSettings()
|
||||
|
@ -368,4 +368,3 @@ class dcNamespace
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -16,23 +16,23 @@ if (!defined('DC_RC_PATH')) { return; }
|
|||
@brief Plugins specific handler
|
||||
@since 2.6
|
||||
|
||||
An instance of this class is provided by dcCore $plugins property
|
||||
An instance of this class is provided by dcCore $plugins property
|
||||
and used for plugins.
|
||||
|
||||
This class extends dcModules.
|
||||
*/
|
||||
class dcPlugins extends dcModules
|
||||
{
|
||||
{
|
||||
protected static $type = 'plugin';
|
||||
|
||||
/**
|
||||
This method registers a plugin in modules list. You should use this to
|
||||
register a new plugin.
|
||||
|
||||
|
||||
<var>$priority</var> is an integer. Modules are sorted by priority and name.
|
||||
Lowest priority comes first. This property is currently ignored when dealing
|
||||
with themes.
|
||||
|
||||
|
||||
@param name <b>string</b> Module name
|
||||
@param desc <b>string</b> Module description
|
||||
@param author <b>string</b> Module author name
|
||||
|
|
|
@ -16,10 +16,10 @@ class dcPostMedia
|
|||
protected $core; ///< <b>dcCore</b> dcCore instance
|
||||
protected $con; ///< <b>connection</b> Database connection
|
||||
protected $table; ///< <b>string</b> Post-Media table name
|
||||
|
||||
|
||||
/**
|
||||
Object constructor.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
@param type <b>string</b> Media type filter
|
||||
*/
|
||||
|
@ -29,11 +29,11 @@ class dcPostMedia
|
|||
$this->con =& $core->con;
|
||||
$this->table = $this->core->prefix.'post_media';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns media items attached to a blog post. Result is an array containing
|
||||
fileItems objects.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> Post ID
|
||||
@param media_id <b>integer</b> Optionnal media ID
|
||||
@return <b>array</b> Array of fileItems
|
||||
|
@ -43,19 +43,19 @@ class dcPostMedia
|
|||
$strReq =
|
||||
'SELECT M.media_file, M.media_id, M.media_path, M.media_title, M.media_meta, M.media_dt, '.
|
||||
'M.media_creadt, M.media_upddt, M.media_private, M.user_id, PM.post_id ';
|
||||
|
||||
|
||||
if (!empty($params['columns']) && is_array($params['columns'])) {
|
||||
$strReq .= implode(', ',$params['columns']).', ';
|
||||
}
|
||||
|
||||
|
||||
$strReq .=
|
||||
'FROM '.$this->core->prefix.'media M '.
|
||||
'INNER JOIN '.$this->table.' PM ON (M.media_id = PM.media_id) ';
|
||||
|
||||
|
||||
if (!empty($params['from'])) {
|
||||
$strReq .= $params['from'].' ';
|
||||
}
|
||||
|
||||
|
||||
$where='';
|
||||
if (isset($params['post_id'])) {
|
||||
$where[]="PM.post_id ".$this->con->in($params['post_id']);
|
||||
|
@ -79,13 +79,13 @@ class dcPostMedia
|
|||
}
|
||||
//echo $strReq; exit;
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
Attaches a media to a post.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> Post ID
|
||||
@param media_id <b>integer</b> Optionnal media ID
|
||||
*/
|
||||
|
@ -93,25 +93,25 @@ class dcPostMedia
|
|||
{
|
||||
$post_id = (integer) $post_id;
|
||||
$media_id = (integer) $media_id;
|
||||
|
||||
|
||||
$f = $this->getPostMedia(array('post_id'=>$post_id,'media_id'=>$media_id,'link_type'=>$link_type));
|
||||
|
||||
|
||||
if (!$f->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$cur = $this->con->openCursor($this->table);
|
||||
$cur->post_id = $post_id;
|
||||
$cur->media_id = $media_id;
|
||||
$cur->link_type = $link_type;
|
||||
|
||||
|
||||
$cur->insert();
|
||||
$this->core->blog->triggerBlog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Detaches a media from a post.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> Post ID
|
||||
@param media_id <b>integer</b> Optionnal media ID
|
||||
*/
|
||||
|
@ -119,7 +119,7 @@ class dcPostMedia
|
|||
{
|
||||
$post_id = (integer) $post_id;
|
||||
$media_id = (integer) $media_id;
|
||||
|
||||
|
||||
$strReq = 'DELETE FROM '.$this->table.' '.
|
||||
'WHERE post_id = '.$post_id.' '.
|
||||
'AND media_id = '.$media_id.' ';
|
||||
|
@ -129,11 +129,11 @@ class dcPostMedia
|
|||
$this->con->execute($strReq);
|
||||
$this->core->blog->triggerBlog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns media items attached to a blog post. Result is an array containing
|
||||
fileItems objects.
|
||||
|
||||
|
||||
@param post_id <b>integer</b> Post ID
|
||||
@param media_id <b>integer</b> Optionnal media ID
|
||||
@return <b>array</b> Array of fileItems
|
||||
|
@ -141,7 +141,7 @@ class dcPostMedia
|
|||
public function getLegacyPostMedia($post_id,$media_id=null)
|
||||
{
|
||||
$post_id = (integer) $post_id;
|
||||
|
||||
|
||||
$strReq =
|
||||
'SELECT media_file, M.media_id, media_path, media_title, media_meta, media_dt, '.
|
||||
'media_creadt, media_upddt, media_private, user_id '.
|
||||
|
@ -149,24 +149,23 @@ class dcPostMedia
|
|||
'INNER JOIN '.$this->table_ref.' PM ON (M.media_id = PM.media_id) '.
|
||||
"WHERE media_path = '".$this->path."' ".
|
||||
'AND post_id = '.$post_id.' ';
|
||||
|
||||
|
||||
if ($media_id) {
|
||||
$strReq .= 'AND M.media_id = '.(integer) $media_id.' ';
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->con->select($strReq);
|
||||
|
||||
|
||||
$res = array();
|
||||
|
||||
|
||||
while ($rs->fetch()) {
|
||||
$f = $this->fileRecord($rs);
|
||||
if ($f !== null) {
|
||||
$res[] = $f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
|
@ -24,15 +24,15 @@ class dcPrefs
|
|||
protected $con; ///< <b>connection</b> Database connection object
|
||||
protected $table; ///< <b>string</b> Prefs table name
|
||||
protected $user_id; ///< <b>string</b> User ID
|
||||
|
||||
|
||||
protected $workspaces = array(); ///< <b>array</b> Associative workspaces array
|
||||
|
||||
|
||||
protected $ws; ///< <b>string</b> Current workspace
|
||||
|
||||
|
||||
/**
|
||||
Object constructor. Retrieves user prefs and puts them in $workspaces
|
||||
array. Local (user) prefs have a highest priority than global prefs.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore object
|
||||
@param user_id <b>string</b> User ID
|
||||
*/
|
||||
|
@ -47,9 +47,9 @@ class dcPrefs
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves all workspaces (and their prefs) from database, with one query.
|
||||
Retrieves all workspaces (and their prefs) from database, with one query.
|
||||
*/
|
||||
private function loadPrefs()
|
||||
{
|
||||
|
@ -64,12 +64,12 @@ class dcPrefs
|
|||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
/* Prevent empty tables (install phase, for instance) */
|
||||
if ($rs->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
$ws = trim($rs->f('pref_ws'));
|
||||
if (!$rs->isStart()) {
|
||||
|
@ -80,11 +80,11 @@ class dcPrefs
|
|||
$this->workspaces[$ws] = new dcWorkspace($GLOBALS['core'], $this->user_id, $ws,$rs);
|
||||
} while(!$rs->isStart());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create a new workspace. If the workspace already exists, return it without modification.
|
||||
|
||||
|
||||
@param ws <b>string</b> Workspace name
|
||||
@return <b>dcWorkspace</b> The workspace created
|
||||
*/
|
||||
|
@ -95,7 +95,7 @@ class dcPrefs
|
|||
}
|
||||
return $this->workspaces[$ws];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Rename a workspace.
|
||||
|
||||
|
@ -142,10 +142,10 @@ class dcPrefs
|
|||
$this->con->execute($strReq);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns full workspace with all prefs pertaining to it.
|
||||
|
||||
|
||||
@param ws <b>string</b> Workspace name
|
||||
@return <b>dcWorkspace</b>
|
||||
*/
|
||||
|
@ -154,10 +154,10 @@ class dcPrefs
|
|||
if (array_key_exists($ws, $this->workspaces)) {
|
||||
return $this->workspaces[$ws];
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Magic __get method.
|
||||
@copydoc ::get
|
||||
|
@ -166,16 +166,15 @@ class dcPrefs
|
|||
{
|
||||
return $this->get($n);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns $workspaces property content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpWorkspaces()
|
||||
{
|
||||
return $this->workspaces;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
|
@ -21,22 +21,22 @@ Instance of this class is provided by dcCore $rest.
|
|||
class dcRestServer extends restServer
|
||||
{
|
||||
public $core; ///< dcCore instance
|
||||
|
||||
|
||||
/**
|
||||
Object constructor.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
*/
|
||||
public function __construct($core)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
$this->core =& $core;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Rest method call.
|
||||
|
||||
|
||||
@param name <b>string</b> Method name
|
||||
@param get <b>array</b> GET parameters copy
|
||||
@param post <b>array</b> POST parameters copy
|
||||
|
@ -49,4 +49,3 @@ class dcRestServer extends restServer
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -25,7 +25,7 @@ class rsExtPost
|
|||
{
|
||||
/**
|
||||
Returns whether post is editable.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -35,24 +35,24 @@ class rsExtPost
|
|||
if ($rs->core->auth->check('contentadmin',$rs->core->blog->id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
# No user id in result ? false
|
||||
if (!$rs->exists('user_id')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
# If user is usage and owner of the entrie
|
||||
if ($rs->core->auth->check('usage',$rs->core->blog->id)
|
||||
&& $rs->user_id == $rs->core->auth->userID()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post is deletable
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -62,24 +62,24 @@ class rsExtPost
|
|||
if ($rs->core->auth->check('contentadmin',$rs->core->blog->id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
# No user id in result ? false
|
||||
if (!$rs->exists('user_id')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
# If user has delete rights and is owner of the entrie
|
||||
if ($rs->core->auth->check('delete',$rs->core->blog->id)
|
||||
&& $rs->user_id == $rs->core->auth->userID()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post is the first one of its day.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -88,17 +88,17 @@ class rsExtPost
|
|||
if ($rs->isStart()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$cdate = date('Ymd',strtotime($rs->post_dt));
|
||||
$rs->movePrev();
|
||||
$ndate = date('Ymd',strtotime($rs->post_dt));
|
||||
$rs->moveNext();
|
||||
return $ndate != $cdate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post is the last one of its day.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -107,17 +107,17 @@ class rsExtPost
|
|||
if ($rs->isEnd()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$cdate = date('Ymd',strtotime($rs->post_dt));
|
||||
$rs->moveNext();
|
||||
$ndate = date('Ymd',strtotime($rs->post_dt));
|
||||
$rs->movePrev();
|
||||
return $ndate != $cdate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether comments are enabled on post.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -129,10 +129,10 @@ class rsExtPost
|
|||
&& ($rs->core->blog->settings->system->comments_ttl == 0 ||
|
||||
time()-($rs->core->blog->settings->system->comments_ttl*86400) < $rs->getTS());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether trackbacks are enabled on post.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -144,10 +144,10 @@ class rsExtPost
|
|||
&& ($rs->core->blog->settings->system->trackbacks_ttl == 0 ||
|
||||
time()-($rs->core->blog->settings->system->trackbacks_ttl*86400) < $rs->getTS());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post has at least one comment.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -155,10 +155,10 @@ class rsExtPost
|
|||
{
|
||||
return $rs->nb_comment > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post has at least one trackbacks.
|
||||
|
||||
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
public static function hasTrackbacks($rs)
|
||||
|
@ -175,10 +175,10 @@ class rsExtPost
|
|||
{
|
||||
return ($rs->getTS('upddt') + dt::getTimeOffset($rs->post_tz)) > $rs->getTS();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns full post URL.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -188,10 +188,10 @@ class rsExtPost
|
|||
$rs->post_type,html::sanitizeURL($rs->post_url)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns full post category URL.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -199,10 +199,10 @@ class rsExtPost
|
|||
{
|
||||
return $rs->core->blog->url.$rs->core->url->getURLFor('category',html::sanitizeURL($rs->cat_url));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether post has an excerpt.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -210,10 +210,10 @@ class rsExtPost
|
|||
{
|
||||
return $rs->post_excerpt_xhtml != '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post timestamp.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt|creadt) defaults to post_dt
|
||||
@return <b>integer</b>
|
||||
|
@ -228,10 +228,10 @@ class rsExtPost
|
|||
return strtotime($rs->post_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post date formating according to the ISO 8601 standard.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt|creadt) defaults to post_dt
|
||||
@return <b>string</b>
|
||||
|
@ -244,10 +244,10 @@ class rsExtPost
|
|||
return dt::iso8601($rs->getTS(),$rs->post_tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post date formating according to RFC 822.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt|creadt) defaults to post_dt
|
||||
@return <b>string</b>
|
||||
|
@ -260,11 +260,11 @@ class rsExtPost
|
|||
return dt::rfc822($rs->getTS($type),$rs->post_tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post date with <var>$format</var> as formatting pattern. If format
|
||||
is empty, uses <var>date_format</var> blog setting.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param format <b>string</b> Date format pattern
|
||||
@param type <b>string</b> (dt|upddt|creadt) defaults to post_dt
|
||||
|
@ -275,7 +275,7 @@ class rsExtPost
|
|||
if (!$format) {
|
||||
$format = $rs->core->blog->settings->system->date_format;
|
||||
}
|
||||
|
||||
|
||||
if ($type == 'upddt') {
|
||||
return dt::dt2str($format,$rs->post_upddt,$rs->post_tz);
|
||||
} elseif ($type == 'creadt') {
|
||||
|
@ -284,11 +284,11 @@ class rsExtPost
|
|||
return dt::dt2str($format,$rs->post_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post time with <var>$format</var> as formatting pattern. If format
|
||||
is empty, uses <var>time_format</var> blog setting.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param format <b>string</b> Time format pattern
|
||||
@param type <b>string</b> (dt|upddt|creadt) defaults to post_dt
|
||||
|
@ -299,7 +299,7 @@ class rsExtPost
|
|||
if (!$format) {
|
||||
$format = $rs->core->blog->settings->system->time_format;
|
||||
}
|
||||
|
||||
|
||||
if ($type == 'upddt') {
|
||||
return dt::dt2str($format,$rs->post_upddt,$rs->post_tz);
|
||||
} elseif ($type == 'creadt') {
|
||||
|
@ -308,11 +308,11 @@ class rsExtPost
|
|||
return dt::dt2str($format,$rs->post_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns author common name using user_id, user_name, user_firstname and
|
||||
user_displayname fields.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -321,11 +321,11 @@ class rsExtPost
|
|||
return dcUtils::getUserCN($rs->user_id, $rs->user_name,
|
||||
$rs->user_firstname, $rs->user_displayname);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns author common name with a link if he specified one in its
|
||||
preferences.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -336,14 +336,14 @@ class rsExtPost
|
|||
if ($url) {
|
||||
$res = '<a href="%2$s">%1$s</a>';
|
||||
}
|
||||
|
||||
|
||||
return sprintf($res,html::escapeHTML($rs->getAuthorCN()),html::escapeHTML($url));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns author e-mail address. If <var>$encoded</var> is true, "@" sign is
|
||||
replaced by "%40" and "." by "%2e".
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param encoded <b>boolean</b> Encode address.
|
||||
@return <b>string</b>
|
||||
|
@ -355,26 +355,26 @@ class rsExtPost
|
|||
}
|
||||
return $rs->user_email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post feed unique ID.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
public static function getFeedID($rs)
|
||||
{
|
||||
return 'urn:md5:'.md5($rs->core->blog->uid.$rs->post_id);
|
||||
|
||||
|
||||
$url = parse_url($rs->core->blog->url);
|
||||
$date_part = date('Y-m-d',strtotime($rs->post_creadt));
|
||||
|
||||
|
||||
return 'tag:'.$url['host'].','.$date_part.':'.$rs->post_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns trackback RDF information block in HTML comment.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -394,10 +394,10 @@ class rsExtPost
|
|||
"</rdf:RDF>\n".
|
||||
"<!]]><!---->\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post trackback full URL.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -405,11 +405,11 @@ class rsExtPost
|
|||
{
|
||||
return $rs->core->blog->url.$rs->core->url->getURLFor('trackback',$rs->post_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post content. If <var>$absolute_urls</var> is true, appends full
|
||||
blog URL to each relative post URLs.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param absolute_urls <b>boolean</b> With absolute URLs
|
||||
@return <b>string</b>
|
||||
|
@ -422,11 +422,11 @@ class rsExtPost
|
|||
return $rs->post_content_xhtml;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post excerpt. If <var>$absolute_urls</var> is true, appends full
|
||||
blog URL to each relative post URLs.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param absolute_urls <b>boolean</b> With absolute URLs
|
||||
@return <b>string</b>
|
||||
|
@ -439,10 +439,10 @@ class rsExtPost
|
|||
return $rs->post_excerpt_xhtml;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns post media count using a subquery.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>integer</b>
|
||||
*/
|
||||
|
@ -458,7 +458,7 @@ class rsExtPost
|
|||
'SELECT count(media_id) '.
|
||||
'FROM '.$rs->core->prefix.'post_media '.
|
||||
'WHERE post_id = '.(integer) $rs->post_id.' ';
|
||||
|
||||
|
||||
$res = (integer) $rs->core->con->select($strReq)->f(0);
|
||||
$rs->_nb_media[$rs->index()] = $res;
|
||||
return $res;
|
||||
|
@ -482,7 +482,7 @@ class rsExtComment
|
|||
/**
|
||||
Returns comment date with <var>$format</var> as formatting pattern. If
|
||||
format is empty, uses <var>date_format</var> blog setting.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param format <b>string</b> Date format pattern
|
||||
@param type <b>string</b> (dt|upddt) defaults to comment_dt
|
||||
|
@ -493,18 +493,18 @@ class rsExtComment
|
|||
if (!$format) {
|
||||
$format = $rs->core->blog->settings->system->date_format;
|
||||
}
|
||||
|
||||
|
||||
if ($type == 'upddt') {
|
||||
return dt::dt2str($format,$rs->comment_upddt,$rs->comment_tz);
|
||||
} else {
|
||||
return dt::dt2str($format,$rs->comment_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment time with <var>$format</var> as formatting pattern. If
|
||||
format is empty, uses <var>time_format</var> blog setting.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param format <b>string</b> Date format pattern
|
||||
@param type <b>string</b> (dt|upddt) defaults to comment_dt
|
||||
|
@ -515,17 +515,17 @@ class rsExtComment
|
|||
if (!$format) {
|
||||
$format = $rs->core->blog->settings->system->time_format;
|
||||
}
|
||||
|
||||
|
||||
if ($type == 'upddt') {
|
||||
return dt::dt2str($format,$rs->comment_updt,$rs->comment_tz);
|
||||
} else {
|
||||
return dt::dt2str($format,$rs->comment_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment timestamp.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt) defaults to comment_dt
|
||||
@return <b>integer</b>
|
||||
|
@ -538,10 +538,10 @@ class rsExtComment
|
|||
return strtotime($rs->comment_dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment date formating according to the ISO 8601 standard.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt) defaults to comment_dt
|
||||
@return <b>string</b>
|
||||
|
@ -554,10 +554,10 @@ class rsExtComment
|
|||
return dt::iso8601($rs->getTS(),$rs->comment_tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment date formating according to RFC 822.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param type <b>string</b> (dt|upddt) defaults to comment_dt
|
||||
@return <b>string</b>
|
||||
|
@ -570,11 +570,11 @@ class rsExtComment
|
|||
return dt::rfc822($rs->getTS(),$rs->comment_tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment content. If <var>$absolute_urls</var> is true, appends full
|
||||
blog URL to each relative post URLs.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param absolute_urls <b>boolean</b> With absolute URLs
|
||||
@return <b>string</b>
|
||||
|
@ -582,30 +582,30 @@ class rsExtComment
|
|||
public static function getContent($rs,$absolute_urls=false)
|
||||
{
|
||||
$res = $rs->comment_content;
|
||||
|
||||
|
||||
if ($rs->core->blog->settings->system->comments_nofollow) {
|
||||
$res = preg_replace_callback('#<a(.*?href=".*?".*?)>#ms',array('self','noFollowURL'),$res);
|
||||
}
|
||||
|
||||
|
||||
if ($absolute_urls) {
|
||||
$res = html::absoluteURLs($res,$rs->getPostURL());
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
private static function noFollowURL($m)
|
||||
{
|
||||
if (preg_match('/rel="nofollow"/',$m[1])) {
|
||||
return $m[0];
|
||||
}
|
||||
|
||||
|
||||
return '<a'.$m[1].' rel="nofollow">';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment author link to his website if he specified one.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -615,10 +615,10 @@ class rsExtComment
|
|||
return trim($rs->comment_site);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment post full URL.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -628,10 +628,10 @@ class rsExtComment
|
|||
$rs->post_type,html::sanitizeURL($rs->post_url)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment author name in a link to his website if he specified one.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -642,19 +642,19 @@ class rsExtComment
|
|||
if ($url) {
|
||||
$res = '<a href="%2$s"%3$s>%1$s</a>';
|
||||
}
|
||||
|
||||
|
||||
$nofollow = '';
|
||||
if ($rs->core->blog->settings->system->comments_nofollow) {
|
||||
$nofollow = ' rel="nofollow"';
|
||||
}
|
||||
|
||||
|
||||
return sprintf($res,html::escapeHTML($rs->comment_author),html::escapeHTML($url),$nofollow);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment author e-mail address. If <var>$encoded</var> is true,
|
||||
"@" sign is replaced by "%40" and "." by "%2e".
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param encoded <b>boolean</b> Encode address.
|
||||
@return <b>string</b>
|
||||
|
@ -666,10 +666,10 @@ class rsExtComment
|
|||
}
|
||||
return $rs->comment_email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns trackback site title if comment is a trackback.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -681,10 +681,10 @@ class rsExtComment
|
|||
return html::decodeEntities($match[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns trackback content if comment is a trackback.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
|
@ -695,26 +695,26 @@ class rsExtComment
|
|||
$rs->comment_content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns comment feed unique ID.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b>
|
||||
*/
|
||||
public static function getFeedID($rs)
|
||||
{
|
||||
return 'urn:md5:'.md5($rs->core->blog->uid.$rs->comment_id);
|
||||
|
||||
|
||||
$url = parse_url($rs->core->blog->url);
|
||||
$date_part = date('Y-m-d',strtotime($rs->comment_dt));
|
||||
|
||||
|
||||
return 'tag:'.$url['host'].','.$date_part.':'.$rs->comment_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether comment is from the post author.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -747,7 +747,7 @@ class rsExtDates
|
|||
{
|
||||
return strtotime($rs->dt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b> Date year
|
||||
|
@ -756,7 +756,7 @@ class rsExtDates
|
|||
{
|
||||
return date('Y',strtotime($rs->dt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@param rs Invisible parameter
|
||||
@return <b>string</b> Date month
|
||||
|
@ -765,7 +765,7 @@ class rsExtDates
|
|||
{
|
||||
return date('m',strtotime($rs->dt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@param rs Invisible parameter
|
||||
@return <b>integer</b> Date day
|
||||
|
@ -774,10 +774,10 @@ class rsExtDates
|
|||
{
|
||||
return date('d',strtotime($rs->dt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns date month archive full URL.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param core <b>dcCore</b> dcCore instance
|
||||
@return <b>integer</b>
|
||||
|
@ -785,13 +785,13 @@ class rsExtDates
|
|||
public static function url($rs,$core)
|
||||
{
|
||||
$url = date('Y/m',strtotime($rs->dt));
|
||||
|
||||
|
||||
return $core->blog->url.$core->url->getURLFor('archive',$url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether date is the first of year.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -800,18 +800,18 @@ class rsExtDates
|
|||
if ($rs->isStart()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$y = $rs->year();
|
||||
$rs->movePrev();
|
||||
$py = $rs->year();
|
||||
$rs->moveNext();
|
||||
|
||||
|
||||
return $y != $py;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns whether date is the last of year.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>boolean</b>
|
||||
*/
|
||||
|
@ -820,7 +820,7 @@ class rsExtDates
|
|||
if ($rs->isEnd()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$y = $rs->year();
|
||||
if ($rs->moveNext()) {
|
||||
$ny = $rs->year();
|
||||
|
@ -828,7 +828,7 @@ class rsExtDates
|
|||
return $y != $ny;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,7 +847,7 @@ class rsExtUser
|
|||
{
|
||||
/**
|
||||
Returns a user option.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@param name <b>string</b> Option name
|
||||
@return <b>string</b>
|
||||
|
@ -855,16 +855,16 @@ class rsExtUser
|
|||
public static function option($rs,$name)
|
||||
{
|
||||
$options = self::options($rs);
|
||||
|
||||
|
||||
if (isset($options[$name])) {
|
||||
return $options[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns all user options.
|
||||
|
||||
|
||||
@param rs Invisible parameter
|
||||
@return <b>array</b>
|
||||
*/
|
||||
|
@ -877,4 +877,3 @@ class rsExtUser
|
|||
return array();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -24,15 +24,15 @@ class dcSettings
|
|||
protected $con; ///< <b>connection</b> Database connection object
|
||||
protected $table; ///< <b>string</b> Settings table name
|
||||
protected $blog_id; ///< <b>string</b> Blog ID
|
||||
|
||||
|
||||
protected $namespaces = array(); ///< <b>array</b> Associative namespaces array
|
||||
|
||||
|
||||
protected $ns; ///< <b>string</b> Current namespace
|
||||
|
||||
|
||||
/**
|
||||
Object constructor. Retrieves blog settings and puts them in $namespaces
|
||||
array. Local (blog) settings have a highest priority than global settings.
|
||||
|
||||
|
||||
@param core <b>dcCore</b> dcCore object
|
||||
@param blog_id <b>string</b> Blog ID
|
||||
*/
|
||||
|
@ -43,9 +43,9 @@ class dcSettings
|
|||
$this->blog_id =& $blog_id;
|
||||
$this->loadSettings();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves all namespaces (and their settings) from database, with one query.
|
||||
Retrieves all namespaces (and their settings) from database, with one query.
|
||||
*/
|
||||
private function loadSettings()
|
||||
{
|
||||
|
@ -60,12 +60,12 @@ class dcSettings
|
|||
} catch (Exception $e) {
|
||||
trigger_error(__('Unable to retrieve namespaces:').' '.$this->con->error(), E_USER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/* Prevent empty tables (install phase, for instance) */
|
||||
if ($rs->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
$ns = trim($rs->f('setting_ns'));
|
||||
if (!$rs->isStart()) {
|
||||
|
@ -76,11 +76,11 @@ class dcSettings
|
|||
$this->namespaces[$ns] = new dcNamespace($GLOBALS['core'], $this->blog_id, $ns,$rs);
|
||||
} while(!$rs->isStart());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create a new namespace. If the namespace already exists, return it without modification.
|
||||
|
||||
|
||||
@param ns <b>string</b> Namespace name
|
||||
@return <b>dcNamespace</b> The namespace created
|
||||
*/
|
||||
|
@ -138,10 +138,10 @@ class dcSettings
|
|||
$this->con->execute($strReq);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns full namespace with all settings pertaining to it.
|
||||
|
||||
|
||||
@param ns <b>string</b> Namespace name
|
||||
@return <b>dcNamespace</b>
|
||||
*/
|
||||
|
@ -149,7 +149,7 @@ class dcSettings
|
|||
{
|
||||
return $this->namespaces[$ns];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Magic __get method.
|
||||
@copydoc ::get
|
||||
|
@ -164,7 +164,7 @@ class dcSettings
|
|||
}
|
||||
return $this->get($n);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Magic __set method.
|
||||
@copydoc ::set
|
||||
|
@ -173,21 +173,21 @@ class dcSettings
|
|||
{
|
||||
$this->set($n,$v);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns $namespaces property content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpNamespaces()
|
||||
{
|
||||
return $this->namespaces;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Raises a E_USER_NOTICE errror for deprecated functions.
|
||||
Raises a E_USER_NOTICE errror for deprecated functions.
|
||||
This allows the developer to know he's been using deprecated functions.
|
||||
|
||||
|
||||
@param name <b>string</b> Name of the deprecated function that was called.
|
||||
*/
|
||||
private function raiseDeprecated($name)
|
||||
|
@ -201,13 +201,13 @@ class dcSettings
|
|||
trigger_error($msg, E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please set your settings via $core->blog->settings->{namespace}->{setting}
|
||||
|
||||
|
||||
Sets a setting in $settings property. This sets the setting for script
|
||||
execution time only and if setting exists.
|
||||
|
||||
|
||||
@param n <b>string</b> Setting name
|
||||
@param v <b>mixed</b> Setting value
|
||||
*/
|
||||
|
@ -216,11 +216,11 @@ class dcSettings
|
|||
// For backward compatibility only: the developer tried to access
|
||||
// a setting directly, without passing via a namespace.
|
||||
$this->raiseDeprecated('old_style_set');
|
||||
|
||||
|
||||
if (!$this->ns) {
|
||||
throw new Exception(__('No namespace specified'));
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->namespaces[$this->ns]->$n)) {
|
||||
$this->namespaces[$this->ns]->$n['value'] = $v;
|
||||
} else {
|
||||
|
@ -233,12 +233,12 @@ class dcSettings
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please access your settings via $core->blog->settings->{namespace}->...
|
||||
|
||||
|
||||
Sets a working namespace. You should do this before accessing any setting.
|
||||
|
||||
|
||||
@param ns <b>string</b> Namespace name
|
||||
*/
|
||||
public function setNamespace($ns)
|
||||
|
@ -250,20 +250,20 @@ class dcSettings
|
|||
throw new Exception(sprintf(__('Invalid setting namespace: %s'),$ns));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please set your settings via $core->blog->settings->{namespace}->put()
|
||||
|
||||
|
||||
Creates or updates a setting.
|
||||
|
||||
|
||||
$type could be 'string', 'integer', 'float', 'boolean' or null. If $type is
|
||||
null and setting exists, it will keep current setting type.
|
||||
|
||||
|
||||
$value_change allow you to not change setting. Useful if you need to change
|
||||
a setting label or type and don't want to change its value.
|
||||
|
||||
|
||||
Don't forget to set namespace before calling this method.
|
||||
|
||||
|
||||
@param id <b>string</b> Setting ID
|
||||
@param value <b>mixed</b> Setting value
|
||||
@param type <b>string</b> Setting type
|
||||
|
@ -283,12 +283,12 @@ class dcSettings
|
|||
}
|
||||
$this->namespaces[$this->ns]->put($id, $value, $type, $label, $value_change, $global);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please get your settings via $core->blog->settings->{namespace}->{setting}
|
||||
|
||||
|
||||
Returns setting value if exists.
|
||||
|
||||
|
||||
@param n <b>string</b> Setting name
|
||||
@return <b>mixed</b>
|
||||
*/
|
||||
|
@ -306,15 +306,15 @@ class dcSettings
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please get your settings via $core->blog->settings->{namespace}->dumpSettings
|
||||
|
||||
|
||||
Returns all settings content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpSettings()
|
||||
|
@ -322,21 +322,21 @@ class dcSettings
|
|||
// For backward compatibility only: the developer tried to access
|
||||
// the settings directly, without passing via a namespace.
|
||||
$this->raiseDeprecated('dumpSettings');
|
||||
|
||||
|
||||
$settings = array();
|
||||
// Parse all the namespaces
|
||||
foreach (array_keys($this->namespaces) as $id => $ns) {
|
||||
$settings = array_merge($settings, $this->namespaces[$ns]->dumpSettings());
|
||||
}
|
||||
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@deprecated Please get your settings via $core->blog->settings->{namespace}->dumpGlobalSettings
|
||||
|
||||
|
||||
Returns all global settings content.
|
||||
|
||||
|
||||
@return <b>array</b>
|
||||
*/
|
||||
public function dumpGlobalSettings()
|
||||
|
@ -344,13 +344,13 @@ class dcSettings
|
|||
// For backward compatibility only: the developer tried to access
|
||||
// the settings directly, without passing via a namespace.
|
||||
$this->raiseDeprecated('dumpGlobalSettings');
|
||||
|
||||
|
||||
$settings = array();
|
||||
// Parse all the namespaces
|
||||
foreach (array_keys($this->namespaces) as $id => $ns) {
|
||||
$settings = array_merge($settings, $this->namespaces[$ns]->dumpGlobalSettings());
|
||||
}
|
||||
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
@ -358,12 +358,12 @@ class dcSettings
|
|||
Returns a list of settings matching given criteria, for any blog.
|
||||
<b>$params</b> is an array taking the following
|
||||
optionnal parameters:
|
||||
|
||||
|
||||
- ns : retrieve setting from given namespace
|
||||
- id : retrieve only settings corresponding to the given id
|
||||
|
||||
|
||||
@param params <b>array</b> Parameters
|
||||
@return <b>record</b> A record
|
||||
@return <b>record</b> A record
|
||||
*/
|
||||
public function getGlobalSettings($params=array())
|
||||
{
|
||||
|
@ -391,10 +391,10 @@ class dcSettings
|
|||
|
||||
/**
|
||||
Updates a setting from a given record
|
||||
|
||||
|
||||
@param rs <b>record</b> the setting to update
|
||||
*/
|
||||
public function updateSetting($rs)
|
||||
public function updateSetting($rs)
|
||||
{
|
||||
$cur = $this->con->openCursor($this->table);
|
||||
$cur->setting_id = $rs->setting_id;
|
||||
|
@ -410,10 +410,10 @@ class dcSettings
|
|||
}
|
||||
$cur->update($where."AND setting_id = '".$this->con->escape($cur->setting_id)."' AND setting_ns = '".$this->con->escape($cur->setting_ns)."' ");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Drops a setting from a given record
|
||||
|
||||
|
||||
@param rs <b>record</b> the setting to drop
|
||||
@return int number of deleted records (0 if setting does not exist)
|
||||
*/
|
||||
|
@ -428,4 +428,3 @@ class dcSettings
|
|||
return $this->con->execute($strReq);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -86,7 +86,7 @@ class dcStoreParser
|
|||
$tags[] = (string) $t->tag;
|
||||
}
|
||||
$item['tags'] = implode(', ',$tags);
|
||||
|
||||
|
||||
# First filter right now. If DC_DEV is set all modules are parse
|
||||
if (defined('DC_DEV') && DC_DEV === true || dcUtils::versionsCompare(DC_VERSION, $item['dc_min'], '>=', false)) {
|
||||
$this->items[$item['id']] = $item;
|
||||
|
|
|
@ -262,13 +262,13 @@ class dcStore
|
|||
private static function compare($v1, $v2, $op)
|
||||
{
|
||||
return version_compare(
|
||||
preg_replace('!-r(\d+)$!', '-p$1', $v1),
|
||||
preg_replace('!-r(\d+)$!', '-p$1', $v2),
|
||||
preg_replace('!-r(\d+)$!', '-p$1', $v1),
|
||||
preg_replace('!-r(\d+)$!', '-p$1', $v2),
|
||||
$op
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sort modules list.
|
||||
*
|
||||
* @param array $a A module
|
||||
|
@ -277,11 +277,11 @@ class dcStore
|
|||
*/
|
||||
private static function sort($a,$b)
|
||||
{
|
||||
$c = strtolower($a['id']);
|
||||
$d = strtolower($b['id']);
|
||||
if ($c == $d) {
|
||||
return 0;
|
||||
}
|
||||
return ($c < $d) ? -1 : 1;
|
||||
$c = strtolower($a['id']);
|
||||
$d = strtolower($b['id']);
|
||||
if ($c == $d) {
|
||||
return 0;
|
||||
}
|
||||
return ($c < $d) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,26 +21,26 @@ class should be created when needed.
|
|||
This class extends dcModules.
|
||||
*/
|
||||
class dcThemes extends dcModules
|
||||
{
|
||||
{
|
||||
protected static $type = 'theme';
|
||||
|
||||
/**
|
||||
This method registers a theme in modules list. You should use this to
|
||||
register a new theme.
|
||||
|
||||
|
||||
<var>$parent</var> is a optional value to indicate them inheritance.
|
||||
If <var>$parent</var> is null / not set, we simply fall back to
|
||||
If <var>$parent</var> is null / not set, we simply fall back to
|
||||
the standard behavior, by using 'default'.
|
||||
|
||||
|
||||
<var>$priority</var> is an integer. Modules are sorted by priority and name.
|
||||
Lowest priority comes first. This property is currently ignored when dealing
|
||||
with themes.
|
||||
|
||||
|
||||
@param name <b>string</b> Module name
|
||||
@param desc <b>string</b> Module description
|
||||
@param author <b>string</b> Module author name
|
||||
@param version <b>string</b> Module version
|
||||
@param properties <b>array</b> extra properties
|
||||
@param properties <b>array</b> extra properties
|
||||
(currently available keys : parent, priority, standalone_config, type)
|
||||
*/
|
||||
public function registerModule($name,$desc,$author,$version,$properties = array())
|
||||
|
@ -64,13 +64,13 @@ class dcThemes extends dcModules
|
|||
);
|
||||
|
||||
parent::registerModule($name, $desc, $author, $version, $properties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Loads namespace <var>$ns</var> specific file for module with ID
|
||||
<var>$id</var>
|
||||
Note : actually, only 'public' namespace is supported with themes.
|
||||
|
||||
|
||||
@param id <b>string</b> Module ID
|
||||
@param ns <b>string</b> Namespace name
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue