Permalink
Browse files

Merge branch 'dev' into master

  • Loading branch information...
remrem committed Apr 28, 2017
2 parents 020dd25 + 5b4fc49 commit 7fcebc1ad3dbc2c7e80ff425f2905c9ca9724b49
Showing with 114 additions and 13 deletions.
  1. +1 −1 VERSION
  2. +1 −0 admin/inc/lang/en_en.php
  3. +1 −0 admin/inc/lang/fr_fr.php
  4. +6 −1 admin/install.php
  5. +0 −1 admin/update/update-to-3.7.php
  6. +0 −1 inc/boot.php
  7. +9 −0 inc/lang/en_en.php
  8. +9 −0 inc/lang/fr_fr.php
  9. +10 −9 inc/util.php
  10. +77 −0 sitemap.php
@@ -1 +1 @@
3.7.3
3.7.3
@@ -25,6 +25,7 @@
'install_err_mysql_hst_empty' => 'MySQL Hostname is empty.',
'install_err_mysql_dba_empty' => 'MySQL DB-name is empty',
'install_err_mysql_connect' => 'BlogoText is unable to connect to MySQL with these informations.',
'install_datas' => 'Add default data (article, links, comment ...)',
'first_titre' => 'My first Blogpost',
'first_edit' => 'Edit me',
// Navigation
@@ -25,6 +25,7 @@
'install_err_mysql_hst_empty' => 'Le « hostname » MySQL n’a pas été indiqué.',
'install_err_mysql_dba_empty' => 'Le nom de la base de donnée MySQL n’a pas été indiqué.',
'install_err_mysql_connect' => 'Échec lors de la connexion à MySQL avec ces informations.',
'install_datas' => 'Ajouter les données par défaut (article, liens, commentaire...)',
'first_titre' => 'Mon premier article',
'first_edit' => 'Éditez-moi',
// Navigation
@@ -77,6 +77,9 @@ function install_form_1_echo($errors = '')
if (!is_writable('../')) {
$confErrors[] = '<li>BlogoText has no write rights (chmod of home folder must be 644 at least, 777 recommended).</li>';
}
if (!function_exists('idn_to_ascii') || defined('INTL_FAIL')) {
$confErrors[] = '<li>BlogoText requires that the PHP intl extension be installed and activated.</li>';
}
if ($confErrors) {
echo '<div id="install"><h3>:(</h3>';
echo '<ul class="erreurs">'.implode($confErrors, '').'</ul>';
@@ -180,6 +183,8 @@ function install_form_3_echo($errors = '')
}
echo '</div>';
echo '<p><input type="checkbox" id="install_datas" name="install_datas" value="1" checked class="checkbox" /><label for="install_datas" style="line-height: 1;">'.$GLOBALS['lang']['install_datas'].'</label></p>';
echo hidden_input('langue', $GLOBALS['lang']['id']);
echo hidden_input('install_form_3_sended', 1);
echo '<button class="submit button-submit" type="submit" name="enregistrer">Ok</button>';
@@ -245,7 +250,7 @@ function install_form_3_proceed()
fichier_adv_conf();
if ($totalPosts != 0) {
if ($totalPosts != 0 || !isset($_POST['install_datas'])) {
return;
}
@@ -178,7 +178,6 @@
</ul>
<p><a class="btn" href="?proceed">Ok !</a></p>
</div>';
echo $html_foot;
exit();
}
@@ -141,7 +141,6 @@ function idn_to_ascii($string)
}
}
/**
* @param string $http_host, like : example.tld || https://toto.example.tld/blog1/
* @return string||array, if array, see array['message'] for more information
@@ -198,4 +198,13 @@
'9' => 'nine',
'derniere_connexion_le' => 'Last connection from',
'cet_ordi' => 'this computer',
// Formulaire mail
'mail_subject' => 'New comment on "',
'mail_message1' => 'A new comment by ',
'mail_message2' => ' has been posted on ',
'mail_message3' => ' from ',
'mail_link' => 'You can see it by following this link: ',
'mail_unsub' => 'To unsubscribe from the comments on that post, you can follow this link: ',
'mail_unsuball' => 'To unsubscribe from the comments on all the posts, follow this link: ',
'mail_end' => 'Also, do not reply to this email, since it is an automatic generated email.\nRegards',
);
@@ -198,4 +198,13 @@
'9' => 'neuf',
'derniere_connexion_le' => 'Dernière connexion depuis',
'cet_ordi' => 'cet ordinateur',
'mail_subject' => 'Nouveau commentaire sur "',
'mail_message1' => 'Un nouveau commentaire par ',
'mail_message2' => ' a été posté sur le sujet ',
'mail_message3' => ' depuis ',
'mail_link' => 'Vous pouvez le consulter via ce lien: ',
'mail_unsub' => 'Pour vous désinscrire des commentaires de ce billet, suivez ce lien: ',
'mail_unsuball' => 'Pour vous désinscrire des commentaires de tous les billets, suivez ce lien: ',
'mail_end' => 'Merci de ne pas répondre à ce message automatique.',
);
@@ -424,21 +424,22 @@ function send_emails($id_comment)
return true;
}
$subject = 'New comment on "'.$article_title.'" - '.$GLOBALS['nom_du_site'];
$subject = $GLOBALS['lang']['mail_subject'].$article_title.'" - '.$GLOBALS['nom_du_site'];
$headers = 'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset="UTF-8"'."\r\n";
$headers .= 'From: no.reply_'.$GLOBALS['email']."\r\n".'X-Mailer: BlogoText - PHP/'.phpversion();
// send emails
foreach ($to_send_mail as $mail) {
$unsublink = get_blogpath($article_id, '').'&amp;unsub=1&amp;mail='.base64_encode($mail).'&amp;article='.$article_id;
$message = '<html>';
$message .= '<head><title>'.$subject.'</title></head>';
$message .= '<body><p>A new comment by <b>'.$comm_author.'</b> has been posted on <b>'.$article_title.'</b> form '.$GLOBALS['nom_du_site'].'.<br/>';
$message .= 'You can see it by following <a href="'.get_blogpath($article_id, '').'#'.article_anchor($id_comment).'">this link</a>.</p>';
$message .= '<p>To unsubscribe from the comments on that post, you can follow this link:<br/><a href="'.$unsublink.'">'.$unsublink.'</a>.</p>';
$message .= '<p>To unsubscribe from the comments on all the posts, follow this link:<br/> <a href="'.$unsublink.'&amp;all=1">'.$unsublink.'&amp;all=1</a>.</p>';
$message .= '<p>Also, do not reply to this email, since it is an automatic generated email.</p><p>Regards</p></body>';
$message .= '</html>';
$message = $subject."\r\n";
$message .= str_repeat('=', strlen($subject)) ."\r\n\n";
$message .= $GLOBALS['lang']['mail_message1'].$comm_author.$GLOBALS['lang']['mail_message2'].$article_title.$GLOBALS['lang']['mail_message3'].$GLOBALS['nom_du_site']."\r\n";
$message .= $GLOBALS['lang']['mail_link'].get_blogpath($article_id, '').'#'.article_anchor($id_comment)."\r\n\n";
$message .= "---\r\n\n";
$message .= $GLOBALS['lang']['mail_unsub']."\r\n".$unsublink.'">'.$unsublink."\r\n\n";
$message .= $GLOBALS['lang']['mail_unsuball']."\r\n".$unsublink.'&amp;all=1">'.$unsublink.'&amp;all=1'."\r\n";
$message .= "\r\n";
$message .= $GLOBALS['lang']['mail_end'];
mail($mail, $subject, $message, $headers);
}
return true;
@@ -0,0 +1,77 @@
<?php
require_once 'inc/boot.php';
// sitemap cache
$sitemap_cache = DIR_VHOST_CACHE.'sitemap.xml';
// set 2 hours cache, must be replace by an hook or something else...
if (file_exists($sitemap_cache) && filemtime($sitemap_cache) > time()-(7200)) {
$cached = file_get_contents($sitemap_cache);
if ($cached !== false) {
header('Content-Type: text/xml; charset=UTF-8');
echo $cached;
exit();
}
}
// dependancy
require_once BT_ROOT.'inc/addons.php';
// launch addons
addons_init_public();
// launch hook
hook_trigger('system-start');
$GLOBALS['db_handle'] = open_base();
header('Content-Type: text/xml; charset=UTF-8');
$xml = '';
$xml .= '<?xml version="1.0" encoding="utf-8" ?>'."\n";
$xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
$priority = 1.0;
// Set main URL
$xml .= ' <url>'."\n";
$xml .= ' <loc>'.$GLOBALS['racine'].'</loc>'."\n";
$xml .= ' <changefreq>weekly</changefreq>'."\n";
$xml .= ' <priority>'.$priority.'</priority>'."\n";
$xml .= ' </url>'."\n";
$query = 'SELECT bt_date,bt_id,bt_title,bt_link FROM articles WHERE bt_date <= '.date('YmdHis').' AND bt_statut=1 ORDER BY bt_date DESC';
$tableau = liste_elements($query, array(), 'articles');
// set hook
$tmp_hook = hook_trigger_and_check('sitemap_datas', $tableau);
if ($tmp_hook !== false) {
$tableau = $tmp_hook['1'];
}
if ($tableau) {
foreach ($tableau as $e) {
$short_date = substr($e['bt_date'], 0, 4).'/'.substr($e['bt_date'], 4, 2).'/'.substr($e['bt_date'], 6, 2);
// Set main URL
$xml .= ' <url>'."\n";
$xml .= ' <loc>'.$e['bt_link'].'</loc>'."\n";
$xml .= ' <lastmod>'.$short_date.'</lastmod>'."\n";
$xml .= ' <changefreq>monthly</changefreq>'."\n";
$xml .= ' <priority>'.$priority.'</priority>'."\n";
$xml .= ' </url>'."\n";
if ($priority > 0.5) {
$priority -= 0.05;
}
}
}
$xml .= '</urlset>';
if (create_folder(DIR_VHOST_CACHE)) {
file_put_contents($sitemap_cache, $xml);
}
echo $xml;

0 comments on commit 7fcebc1

Please sign in to comment.