Commit 7d47a0be authored by JosephK's avatar JosephK
Browse files

Fix pluginadmin (but need a refresh after saving - bug from shaarli) + move...

Fix pluginadmin (but need a refresh after saving - bug from shaarli) + move myframa.js (ready for i18n and nav IO) + msg sign in after sign up
parent 45d5e47b
......@@ -87,12 +87,11 @@ function create_account($account, $password, $email) {
$account_path = join_path(PATH_ACCOUNTS, strtolower($account));
mkdir($account_path);
$userData = array('data', 'tmp', 'cache', 'pagecache');
$userData = array('data', 'tmp', 'cache', 'pagecache');
$blacklist = array('.', '..', '.git',);
// Relative symlink to shaarli's content
if ($handle = opendir('shaarli')) {
$blacklist = array('.', '..', '.git');
$blacklist = array_merge($blacklist, $userData);
while (false !== ($file = readdir($handle))) {
......@@ -102,16 +101,13 @@ function create_account($account, $password, $email) {
}
closedir($handle);
}
// Create userData folders
foreach ($userData as $file) {
mkdir($account_path . '/' . $file);
chmod('u/' . $account . '/' . $file , 0777);
chmod('u/' . $account . '/' . $file , 0755);
copy('shaarli/' . $file . '/.htaccess', 'u/' . $account . '/' . $file . '/.htaccess');
copy('shaarli/plugins/tags_advanced/example.php', 'u/' . $account . '/data/tags_advanced.php');
}
//~~> (vérifier s'il y a plus secure que 777 :-/ )
//--Config writing (from shaarli/index.php install() )--------------
$GLOBALS['timezone'] = 'Europe/Paris'; // There is no reliable way to guess timezone so we force Paris.;
// Everything is ok, let's create config file.
......@@ -128,23 +124,23 @@ function create_account($account, $password, $email) {
$GLOBALS['config']['ENABLE_UPDATECHECK'] = false;
$GLOBALS['config']['ENABLED_PLUGINS'] = array(
0 => 'i18n',
1 => 'qrcode',
2 => 'addlink_toolbar',
3 => 'markdown',
4 => 'recovery',
5 => 'tags_advanced'
1 => 'myframa',
2 => 'recovery',
3 => 'tags_advanced',
4 => 'addlink_toolbar',
5 => 'qrcode',
6 => 'markdown',
);
writeConfig($GLOBALS, true, $account_path . '/data/config.php');
//~~> Config ok
//------------------------------------------------------------------
}
$test_values = true;
if (!is_writable(PATH_ACCOUNTS)) {
$error = 'Le répertoire contenant les données doit pouvoir être écrit par le serveur web.';
//~~> Dossier /u/ ok !
} elseif (isset($_POST['subdomain_redirect'])) {
// Handle account redirection.
$account = strtolower($_POST['subdomain_redirect']);
......@@ -153,7 +149,7 @@ if (!is_writable(PATH_ACCOUNTS)) {
} else {
$error_redirection = 'Ce compte ne semble pas exister. Êtes-vous sûr du nom de votre compte ?';
}
//~~> Redirection vers la page de login ok !
} elseif (!empty($_POST)) {
$test_values = values_are_valid($_POST);
......@@ -187,7 +183,7 @@ if (!is_writable(PATH_ACCOUNTS)) {
$test_values = 'account';
} elseif (is_null($error)) {
// Everything is fine, we can redirect user to its new board!
header('Location: u/' . $account . '?do=login');
header('Location: u/' . $account . '?do=login&r');
}
}
......
......@@ -124,11 +124,11 @@ $t['page'] = 'page';
// loginform.html
$t['You have been banned from login after too many failed attempts. Try later.'] = '';
$t['Connection form'] = '';
$t['Connection form'] = 'Se connecter';
$t['Username'] = 'Utilisateur';
$t['username'] = 'Votre nom'; // placeholder
$t['Password'] = 'Mot de passe';
$t['password'] = '********'; // placeholder
$t['password'] = ' '; // placeholder
$t['Stay signed in (Do not check on public computers)'] = 'Rester connecté (Ne pas cocher sur un ordinateur public)';
$t['Login'] = 'Connexion';
......@@ -137,7 +137,9 @@ $t['Shaarli search'] = 'Recherche Shaarli';
$t['Shaarli Community'] = 'Communauté Shaarli';
// page.footer.html
$t['<strong><a href="https://github.com/shaarli/Shaarli">Shaarli</a></strong> - The personal, minimalist, super-fast, database free, bookmarking service<br>by the Shaarli community - <a href="doc/Home.html" rel="nofollow">Help/documentation</a>'] = '';
$t['Shaarli'] = '';
$t['The personal, minimalist, super-fast, database free, bookmarking service<br>by the Shaarli community'] = '';
$t['Help/documentation'] = '';
$t[' is'] = ' est';
$t['available'] = 'disponible';
$t['Error:'] = 'Erreur :';
......@@ -169,13 +171,14 @@ $t['Filter by tag'] = 'Filtrer par tag';
// pluginsadmin.html
$t['You need to enable Javascript to change plugin loading order.'] = 'Vous devez activer le javascript pour changer l’ordre de chargement des plugins';
$t['Enabled Plugins'] = 'Pluggins activés';
$t['Enabled Plugins'] = 'Plugins activés';
$t['No plugin enabled.'] = 'Pas de plugin activé';
$t['No requiered config parameters for any enabled plugins.'] = 'Les plugins activés ne requièrent pas de paramètre de configuration.';
$t['Disable'] = 'Désactivé';
$t['Order'] = 'Ordre';
$t['Name'] = 'Nom';
$t['Description'] = 'Description';
$t['Parameters'] = 'Paramètres';
$t['Plugins parameters'] = 'Paramètres des plugins';
$t['Save'] = 'Enregistrer';
$t['Disabled Plugins'] = 'Plugins désactivés';
$t['No plugin disabled.'] = 'Pas de plugin désactivé';
......
<?php
require_once str_replace('/plugins/myframa', '', dirname($_SERVER['SCRIPT_FILENAME'])) . '/data/config.php';
// I18n
if(!in_array('i18n',$GLOBALS['config']['ENABLED_PLUGINS']) && !function_exists(t)) {
function t($txt) { return $txt; }
}
// Pré-remplissage Login
$account = explode('/', str_replace('/plugins/myframa', '', dirname($_SERVER['SCRIPT_FILENAME'])));
?>
jQuery(document).ready(function(){
// Button Show/Hide link description ~~> to move in link filter menu
if(/do=daily|login/i.test(window.location.href) || !(/=/i.test(window.location.href))) {
jQuery('.sl-menu .list-inline.pull-right').prepend(
'<li><a id="descToggle" href="javascript:void(0);" title="Hide links descriptions">'+
'<i class="fa fa-fw fa-lg fa-toggle-on"></i><span class="sr-only">Hide links descriptions</span>'+
'</a></li>'
);
jQuery('#descToggle').click(
function(){
if(jQuery(this).children('i').hasClass('fa-toggle-on')) {
jQuery('.link-description').hide();
jQuery('#descToggle').attr('title', 'Show links descriptions');
jQuery('#descToggle').children('i').addClass('fa-toggle-off').removeClass('fa-toggle-on');
jQuery('#descToggle').children('.sr-only').text('Show links descriptions');
} else {
jQuery('.link-description').show();
jQuery('#descToggle').attr('title', 'Hide links descriptions');
jQuery('#descToggle').children('i').removeClass('fa-toggle-off').addClass('fa-toggle-on');
jQuery('#descToggle').children('.sr-only').text('Hide links descriptions');
}
}
);
}
// Styling addlink_toolbar
jQuery('#addlink_toolbar form')
.wrapInner('<div class="input-group"></div>')
.addClass('col-sm-8 col-sm-offset-2');
jQuery('#addlink_toolbar input[type="submit"]')
.after(
'<span class="input-group-btn"><button class="btn btn-default" value="'+jQuery('.navbar a[href="?do=addlink"]').text()+'" type="submit">'+
'<i class="fa fa-fw fa-lg fa-plus text-success"></i> '+jQuery('.navbar a[href="?do=addlink"]').text()+
'</button></span>')
.remove();
jQuery('#addlink_toolbar input[type="text"]')
.addClass('form-control')
.attr('placeholder','http(s)://…');
if(/do=addlink|login/i.test(window.location.href) || !(/=/i.test(window.location.href))) {
jQuery('.navbar a[href="?do=addlink"]').parent().hide();
}
// Locked plugins
if(/do=pluginadmin/i.test(window.location.href)) {
jQuery('#i18n, #myframa, #recovery, #tags_advanced').attr('disabled', 'true');
}
// Login MyFrama
if(/do=login/i.test(window.location.href)) {
// After registration
if(/do=login\&r/i.test(window.location.href)) {
jQuery('#loginform').prepend('<div class="alert alert-info text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><b>Votre compte MyFrama a bien été créé. Vous pouvez à présent vous y connecter.</b></div>');
jQuery('[name="returnurl"]').val('');
}
<?php
if($GLOBALS['login'] == $account[count($account)-1]) {
echo "
jQuery('#login').val('".$GLOBALS['login']."');";
}
?>
}
});
description="Tools in multi-user context like on https://my.framasoft.org"
<?php
function hook_myframa_render_footer($data)
{
$data['js_files'][] = PluginManager::$PLUGINS_PATH . '/myframa/myframa.js.php';
return $data;
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ if(/do=login/i.test(window.location.href)) {
rForm.style = 'display:none;';
rForm.id = 'rForm';
rForm.innerHTML =
'<form class="col-md-6 col-md-offset-3 ombre">'+
'<form class="col-md-6 col-md-offset-3 ombre clearfix">'+
'<h2>Password recovery</h2>'+
'<div class="form-group">'+
'<label for="email">Email</label>'+
......
<?php
// I18n
if(!in_array('i18n',$GLOBALS['config']['ENABLED_PLUGINS'])) {
if(!in_array('i18n',$GLOBALS['config']['ENABLED_PLUGINS']) && !function_exists(t)) {
function t($txt) { return $txt; }
}
......
<?php
// I18n
if(!in_array('i18n',$GLOBALS['config']['ENABLED_PLUGINS'])) {
if(!in_array('i18n',$GLOBALS['config']['ENABLED_PLUGINS']) && !function_exists(t)) {
function t($txt) { return $txt; }
}
......
......@@ -15,7 +15,7 @@
<tr>
<th scope="col"><span class="sr-only">{'Order'|t}</span></th>
<th scope="col">{'Name'|t}</th>
<th scope="col" class="text-center hidden">{'Icon'|t}</th><!-- Class FontAwesome + color frama.css -->
<th scope="col" class="text-center hidden">{''|t}Icon</th><!-- Class FontAwesome + color frama.css -->
<th scope="col"><i class="fa fa-fw fa-lg fa-filter"></i>{'Filter'|t}</th>
<th scope="col" class="text-center"><i class="fa fa-fw fa-lg fa-map-pin"></i><span class="sr-only">{'Pined?'|t}</span></th>
<th scope="col" class="text-center"><i class="fa fa-fw fa-lg fa-key text-warning"></i><span class="sr-only">{'Private?'|t}</span></th>
......
......@@ -1295,4 +1295,13 @@ a.link-url:hover{ color: #333; }
}
#taList i.fa {
cursor: hand;
}
#editlinkform {
padding:20px 30px;
}
/* Plugins admin */
#pluginsadmin {
padding-bottom:20px;
}
\ No newline at end of file
<?php
// Pré-remplissage Login
require_once str_replace('/tpl/frama/inc', '', dirname($_SERVER['SCRIPT_FILENAME'])) . '/data/config.php';
$account = explode('/', str_replace('/tpl/frama/inc', '', dirname($_SERVER['SCRIPT_FILENAME'])));
?>
jQuery(document).ready(function(){
// Bouton afficher/masquer la description
if(/do=daily|login/i.test(window.location.href) || !(/=/i.test(window.location.href))) {
jQuery('.sl-menu .list-inline.pull-right').prepend(
'<li><a id="descToggle" href="javascript:void(0);" title="Hide links descriptions">'+
'<i class="fa fa-fw fa-lg fa-toggle-on"></i><span class="sr-only">Hide links descriptions</span>'+
'</a></li>'
);
jQuery('#descToggle').click(
function(){
if(jQuery(this).children('i').hasClass('fa-toggle-on')) {
jQuery('.link-description').hide();
jQuery('#descToggle').attr('title', 'Show links descriptions');
jQuery('#descToggle').children('i').addClass('fa-toggle-off').removeClass('fa-toggle-on');
jQuery('#descToggle').children('.sr-only').text('Show links descriptions');
} else {
jQuery('.link-description').show();
jQuery('#descToggle').attr('title', 'Hide links descriptions');
jQuery('#descToggle').children('i').removeClass('fa-toggle-off').addClass('fa-toggle-on');
jQuery('#descToggle').children('.sr-only').text('Hide links descriptions');
}
}
);
}
// Mise en forme addlink_toolbar
jQuery('#addlink_toolbar form')
.wrapInner('<div class="input-group"></div>')
.addClass('col-sm-8 col-sm-offset-2');
jQuery('#addlink_toolbar input[type="submit"]')
.after(
'<span class="input-group-btn"><button class="btn btn-default" value="'+jQuery('.navbar a[href="?do=addlink"]').text()+'" type="submit">'+
'<i class="fa fa-fw fa-lg fa-plus text-success"></i> '+jQuery('.navbar a[href="?do=addlink"]').text()+
'</button></span>')
.remove();
jQuery('#addlink_toolbar input[type="text"]')
.addClass('form-control')
.attr('placeholder','http(s)://…');
if(/do=addlink|login/i.test(window.location.href) || !(/=/i.test(window.location.href))) {
jQuery('.navbar a[href="?do=addlink"]').parent().hide();
}
// Login MyFrama
if(/do=login/i.test(window.location.href)) {
// After registration
if(/do=login\&r/i.test(window.location.href)) {
jQuery('#loginform').prepend('<div class="alert alert-info text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><b>Votre compte MyFrama a bien été créé. Vous pouvez à présent vous y connecter.</b></div>');
jQuery('[name="returnurl"]').val('');
}
<?php
if($GLOBALS['login'] == $account[count($account)-1]) {
echo "
jQuery('#login').val('".$GLOBALS['login']."');";
}
?>
}
});
......@@ -18,7 +18,7 @@
{'You have been banned from login after too many failed attempts. Try later.'|t}
{else}
<div class="row">
<form method="post" name="loginform" class="col-md-6 col-md-offset-3 ombre">
<form method="post" name="loginform" class="col-md-6 col-md-offset-3 ombre clearfix">
<h2>{'Connection form'|t}</h2>
<div class="form-group">
<label for="login">{'Username'|t}</label>
......
<div id="footer" class="container text-center">
{'<strong><a href="https://github.com/shaarli/Shaarli">Shaarli</a></strong> - The personal, minimalist, super-fast, database free, bookmarking service<br>by the Shaarli community - <a href="doc/Home.html" rel="nofollow">Help/documentation</a>'|t}
<strong><a href="https://github.com/shaarli/Shaarli">{'Shaarli'|t}</a></strong> - {'The personal, minimalist, super-fast, database free, bookmarking service<br>by the Shaarli community'|t} - <a href="doc/Home.html" rel="nofollow">{'Help/documentation'|t}</a>
{loop="$plugins_footer.text"}
{$value}
{/loop}
......@@ -28,7 +28,6 @@
<script type="text/javascript" src="inc/jquery/jquery.min.js"></script>
<script type="text/javascript" src="inc/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="inc/myframa.js"></script>
{loop="$plugins_footer.js_files"}
<script src="{$value}#"></script>
{/loop}
......@@ -91,9 +91,9 @@
<div class="row">
<div class="container">
{if="!empty($plugin_errors) && isLoggedIn()"}
<ul class="errors">
<ul class="errors list-unstyled">
{loop="plugin_errors"}
<li>{$value}</li>
<li class="alert alert-warning">{$value}</li>
{/loop}
</ul>
{/if}
......
......@@ -8,8 +8,8 @@
<noscript>
<div>
<ul class="errors">
<li>{'You need to enable Javascript to change plugin loading order.'|t}</li>
<ul class="errors list-unstyled">
<li class="alert alert-warning">{'You need to enable Javascript to change plugin loading order.'|t}</li>
</ul>
</div>
<div class="clear"></div>
......@@ -58,41 +58,6 @@
</div>
</section>
<form action="?do=save_pluginadmin" method="POST">
<section id="plugin_parameters">
<h2>{'Parameters'|t}</h2>
<div>
{if="count($enabledPlugins)==0"}
<p>{'No plugin enabled.'|t}</p>
{else}
{loop="$enabledPlugins"}
{if="count($value.parameters) > 0"}
<div class="plugin_parameters">
<h2>{function="str_replace('_', ' ', $key)"}</h2>
{loop="$value.parameters"}
<div class="plugin_parameter">
<div class="float_label">
<label for="{$key}">
<code>{$key}</code>
</label>
</div>
<div class="float_input">
<input name="{$key}" value="{$value}" id="{$key}"/>
</div>
</div>
{/loop}
</div>
{/if}
{/loop}
{/if}
<div class="text-right">
<input type="submit" name="parameters_form" value="{'Save'|t}" class="btn btn-success"/>
</div>
</div>
</section>
</form>
<section id="disabled_plugins">
<h1>{'Disabled Plugins'|t}</h1>
......@@ -122,6 +87,46 @@
</div>
</section>
</form>
<hr>
<form action="?do=save_pluginadmin" method="POST">
<section id="plugin_parameters">
<h1>{'Plugins parameters'|t}</h1>
<div>
{if="count($enabledPlugins)==0"}
<p>{'No plugin enabled.'|t}</p>
{else}{$param=0}
{loop="$enabledPlugins"}
{if="count($value.parameters) > 0"}
{$param=$param+1}
<div class="plugin_parameters">
<h2>{function="str_replace('_', ' ', $key)"}</h2>
{loop="$value.parameters"}
<div class="plugin_parameter">
<div class="float_label">
<label for="{$key}">
<code>{$key}</code>
</label>
</div>
<div class="float_input">
<input name="{$key}" value="{$value}" id="{$key}"/>
</div>
</div>
{/loop}
</div>
{/if}
{/loop}
{if="$param==0"}
<p>{'No requiered config parameters for any enabled plugins.'|t}</p>
{else}
<div class="text-right">
<input type="submit" name="parameters_form" value="{'Save'|t}" class="btn btn-success"/>
</div>
{/if}
{/if}
</div>
</section>
</form>
</div>
</div>
......
......@@ -58,7 +58,7 @@
);
}
)();">
<b class="text-success"></b>{'Shaare link'|t}</b>
{'Shaare link'|t}
</a>
</p>
</div>
......@@ -73,7 +73,7 @@
<a class="btn btn-default"
onclick="return alertBookmarklet();"
href="?private=1&amp;post=">
<b class="text-success"></b>{'Add Note'|t}</b>
{'Add Note'|t}
</a>
</p>
</div>
......@@ -86,7 +86,7 @@
<div class="col-sm-3">
<p class="text-center">
<a class="btn btn-default" onclick="activateFirefoxSocial(this)">
<b class="text-success"></b>{'Add to<br>Firefox social'|t}</b>
{'Add to<br>Firefox social'|t}
</a>
</p>
</div>
......@@ -97,7 +97,7 @@
<hr class="trait">
{if="count($tools_plugin)!=0"}
<h2>Plugins settings</h2>
<h2>{'Plugins settings'|t}</h2>
<div class="list-group">
{loop="$tools_plugin"}
{$value}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment