1
1
Fork 0

db update mail via notification()

remove last template
This commit is contained in:
fabrixxm 2014-09-07 14:23:03 +02:00
parent 5861bdd6e9
commit a8c90155f8
27 changed files with 113 additions and 337 deletions

124
boot.php
View file

@ -789,7 +789,7 @@ if(! class_exists('App')) {
}
if ($name===""){
echo "template engine <tt>$class</tt> cannot be registered without a name.\n";
killme();
killme();
}
$this->template_engines[$name] = $class;
}
@ -797,7 +797,7 @@ if(! class_exists('App')) {
/**
* return template engine instance. If $name is not defined,
* return engine defined by theme, or default
*
*
* @param strin $name Template engine name
* @return object Template Engine instance
*/
@ -1025,26 +1025,14 @@ if(! function_exists('update_db')) {
require_once("include/dbstructure.php");
$retval = update_structure(false, true);
if($retval) {
//send the administrator an e-mail
$email_tpl = get_intltext_template("update_fail_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$update' => DB_UPDATE_VERSION,
'$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
));
$subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
require_once('include/email.php');
$subject = email_header_encode($subject,'UTF-8');
mail($a->config['admin_email'], $subject, $email_msg,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
.'Content-type: text/plain; charset=UTF-8'."\n"
.'Content-transfer-encoding: 8bit');
//try the logger
logger("CRITICAL: Database structure update failed: ".$retval);
update_fail(
DB_UPDATE_VERSION,
sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
);
break;
} else
} else {
set_config('database','dbupdate_'.DB_UPDATE_VERSION, 'success');
}
for($x = $stored; $x < $current; $x ++) {
if(function_exists('update_' . $x)) {
@ -1068,22 +1056,10 @@ if(! function_exists('update_db')) {
$retval = $func();
if($retval) {
//send the administrator an e-mail
$email_tpl = get_intltext_template("update_fail_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$update' => $x,
'$error' => sprintf( t('Update %s failed. See error logs.'), $x)
));
$subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
require_once('include/email.php');
$subject = email_header_encode($subject,'UTF-8');
mail($a->config['admin_email'], $subject, $email_msg,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit' );
//try the logger
logger('CRITICAL: Update Failed: '. $x);
update_fail(
$x,
sprintf(t('Update %s failed. See error logs.'), $x)
);
break;
} else {
set_config('database','update_' . $x, 'success');
@ -1209,7 +1185,7 @@ if(! function_exists('login')) {
}
$noid = get_config('system','no_openid');
$dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
if(local_user()) {
@ -1230,18 +1206,18 @@ if(! function_exists('login')) {
'$dest_url' => $dest_url,
'$logout' => t('Logout'),
'$login' => t('Login'),
'$lname' => array('username', t('Nickname or Email address: ') , '', ''),
'$lpassword' => array('password', t('Password: '), '', ''),
'$lremember' => array('remember', t('Remember me'), 0, ''),
'$openid' => !$noid,
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
'$hiddens' => $hiddens,
'$register' => $reg,
'$lostpass' => t('Forgot your password?'),
'$lostlink' => t('Password Reset'),
@ -1304,9 +1280,9 @@ if(! function_exists('remote_user')) {
if(! function_exists('notice')) {
/**
* Show an error message to user.
*
*
* This function save text in session, to be shown to the user at next page load
*
*
* @param string $s - Text of notice
*/
function notice($s) {
@ -1319,9 +1295,9 @@ if(! function_exists('notice')) {
if(! function_exists('info')) {
/**
* Show an info message to user.
*
*
* This function save text in session, to be shown to the user at next page load
*
*
* @param string $s - Text of notice
*/
function info($s) {
@ -1745,7 +1721,7 @@ if(! function_exists('get_birthdays')) {
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
$rr['startime'] = Null;
$rr['today'] = $today;
}
}
}
@ -1820,7 +1796,7 @@ if(! function_exists('get_events')) {
$strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start']);
$today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false);
$rr['link'] = $md;
$rr['title'] = $title;
$rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
@ -1880,7 +1856,7 @@ if(! function_exists('proc_run')) {
}
$args = $newargs;
$arr = array('args' => $args, 'run_cmd' => true);
call_hooks("proc_run", $arr);
@ -1889,14 +1865,14 @@ if(! function_exists('proc_run')) {
if(count($args) && $args[0] === 'php')
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
// add baseurl to args. cli scripts can't construct it
$args[] = $a->get_baseurl();
for($x = 0; $x < count($args); $x ++)
$args[$x] = escapeshellarg($args[$x]);
$cmdline = implode($args," ");
if(get_config('system','proc_windows'))
@ -1909,9 +1885,9 @@ if(! function_exists('proc_run')) {
if(! function_exists('current_theme')) {
function current_theme(){
$app_base_themes = array('duepuntozero', 'dispy', 'quattro');
$a = get_app();
// $mobile_detect = new Mobile_Detect();
// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
$is_mobile = $a->is_mobile || $a->is_tablet;
@ -1941,17 +1917,17 @@ if(! function_exists('current_theme')) {
(file_exists('view/theme/' . $theme_name . '/style.css') ||
file_exists('view/theme/' . $theme_name . '/style.php')))
return($theme_name);
foreach($app_base_themes as $t) {
if(file_exists('view/theme/' . $t . '/style.css')||
file_exists('view/theme/' . $t . '/style.php'))
return($t);
}
$fallback = array_merge(glob('view/theme/*/style.css'),glob('view/theme/*/style.php'));
if(count($fallback))
return (str_replace('view/theme/','', substr($fallback[0],0,-10)));
}
}
@ -1991,7 +1967,7 @@ if(! function_exists('feed_birthday')) {
*
*/
$birthday = '';
if(! strlen($tz))
@ -2061,13 +2037,13 @@ if(! function_exists('load_contact_links')) {
if(! function_exists('profile_tabs')){
function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme();
if (is_null($nickname))
$nickname = $a->user['nickname'];
if(x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
$url = $a->get_baseurl() . '/profile/' . $nickname;
$tabs = array(
@ -2100,7 +2076,7 @@ if(! function_exists('profile_tabs')){
'id' => 'video-tab',
),
);
if ($is_owner){
$tabs[] = array(
'label' => t('Events'),
@ -2121,7 +2097,7 @@ if(! function_exists('profile_tabs')){
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
call_hooks('profile_tabs', $arr);
$tpl = get_markup_template('common_tabs.tpl');
return replace_macros($tpl,array('$tabs' => $arr['tabs']));
@ -2160,28 +2136,28 @@ function zrl($s,$force = false) {
/**
* returns querystring as string from a mapped array
*
* @param params Array
* @param params Array
* @return string
*/
function build_querystring($params, $name=null) {
$ret = "";
function build_querystring($params, $name=null) {
$ret = "";
foreach($params as $key=>$val) {
if(is_array($val)) {
if(is_array($val)) {
if($name==null) {
$ret .= build_querystring($val, $key);
$ret .= build_querystring($val, $key);
} else {
$ret .= build_querystring($val, $name."[$key]");
$ret .= build_querystring($val, $name."[$key]");
}
} else {
$val = urlencode($val);
if($name!=null) {
$ret.=$name."[$key]"."=$val&";
$ret.=$name."[$key]"."=$val&";
} else {
$ret.= "$key=$val&";
$ret.= "$key=$val&";
}
}
}
return $ret;
}
}
return $ret;
}
function explode_querystring($query) {

View file

@ -1,5 +1,66 @@
<?php
require_once("boot.php");
require_once("include/text.php");
/*
* send the email and do what is needed to do on update fails
*
* @param update_id (int) number of failed update
* @param error_message (str) error message
*/
function update_fail($update_id, $error_message){
//send the administrators an e-mail
$admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
$admin_mail_list
);
// every admin could had different language
foreach ($adminlist as $admin) {
$lang = (($admin['language'])?$admin['language']:'en');
push_lang($lang);
$preamble = deindent(t("
The friendica developers released update %s recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid.");
$body = t("The error message is\n[pre]%s[/pre]");
$preamble = sprintf($preamble, $update_id);
$body = sprintf($body, $error_message);
notification(array(
'type' => "SYSTEM_EMAIL",
'to_email' => $admin['email'],
'preamble' => $preamble,
'body' => $body,
'language' => $lang,
));
}
/*
$email_tpl = get_intltext_template("update_fail_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$update' => DB_UPDATE_VERSION,
'$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
));
$subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
require_once('include/email.php');
$subject = email_header_encode($subject,'UTF-8');
mail($a->config['admin_email'], $subject, $email_msg,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
.'Content-type: text/plain; charset=UTF-8'."\n"
.'Content-transfer-encoding: 8bit');
*/
//try the logger
logger("CRITICAL: Database structure update failed: ".$retval);
break;
}
function dbstructure_run(&$argv, &$argc) {
global $a, $db;

View file

@ -312,7 +312,7 @@ function notification($params) {
case "SYSTEM_REGISTER_REQUEST":
$subject = sprintf( t('[Friendica System:Notify] registration request'));
$preamble = sprintf( t('You\'ve received a registration request from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
$epreamble = sprintf( t('You\'ve received a registration request [url=%1$s]an introduction[/url] from %2$s.'),
$epreamble = sprintf( t('You\'ve received a [url=%1$s]registration request[/url] from %2$s.'),
$itemlink,
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
$body = sprintf( t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s (%4$s)'),

View file

@ -120,7 +120,7 @@ function register_post(&$a) {
// send email to admins
$admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s) LIMIT 1",
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
$admin_mail_list
);

View file

@ -1,11 +0,0 @@
Cheic,
Jo soc a $sitename.
Els desenvolupadors de Friendica han alliberat una actualització $update recentment,
però quan vaig intentar actualitzar, quelcom terrible va anar malament.
Això necessita ser reparat aviat i no ho puc fer sol. Per favor, contacta amb
un desenvolupador de Friendica si no em pots ajudar per tu mateix. La meva base de dades es pot corrompre.
El missatge d'error va ser '$error'.
Ho lamento.
El teu servidor friendica a $siteurl

View file

@ -1,11 +0,0 @@
Ahoj,
Já jsem $sitename.
Vývojáři friendica nednávno uvolnili aktualizaci $update,
ale když jsem se ji snažil nainstalovat, nepovedlo se mi to.
Je to třeba rychle opravit a já to sám nedokážu. Prosím kontaktuj
vývojáře friendica, pokud mi nemůžeš pomoct ty sám. Moje databáze může být nekonzistentní.
Chybová zpráva je '$error'.
Je mi líto,
Tvůj web friendica na $siteurl

View file

@ -1,12 +0,0 @@
Hi,
ich bin {{$sitename}}.
Die friendica Entwickler haben jüngst Update {{$update}} veröffentlicht,
aber als ich versucht habe es zu installieren ist etwas schrecklich schief gegangen.
Das sollte schnellst möglichst behoben werden und ich kann das nicht alleine machen.
Bitte wende dich an einen friendica Entwickler, falls du mir nicht alleine helfen kannst. Meine Datenbank könnte unbrauchbar sein.
Die Fehlermeldung lautet '{{$error}}'.
Tut mir Leid!
Deine friendica Instanz auf {{$siteurl}}

View file

@ -1,11 +0,0 @@
Hi,
$sitename
Die friendica Entwickler haben jüngst Update $update veröffentlicht,
aber als ich versucht habe es zu installieren ist etwas schrecklich schief gegangen.
Das sollte schnellst möglich behoben werden und ich kann das nicht alleine machen.
Bitte wende dich an einen friendica Entwickler, falls du mir nicht alleine helfen kannst. Meine Datenbank könnte unbrauchbar sein.
Die Fehlermeldung lautet '$error'.
Tut mir Leid!
Deine friendica Instanz auf $siteurl

View file

@ -1,12 +0,0 @@
Hey,
I'm {{$sitename}};
The friendica developers released update {{$update}} recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid.
The error message is '{{$error}}'.
I'm sorry,
your friendica server at {{$siteurl}}

View file

@ -1,11 +0,0 @@
Hey,
I'm $sitename;
The friendica developers released update $update recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid.
The error message is '$error'.
I'm sorry,
your friendica server at $siteurl

View file

@ -1,12 +0,0 @@
Saluton!
Mi estas {{$sitename}}.
La programistoj de Frienda eldonis ĝisdatigon {{$update}} antaŭ ne longe,
sed kiam mi provis instali ĝin, io terure malsukcesis.
Tio tuj bezonas riparon kaj mi ne povas fari ĝin sole. Bonvolu kontakti
Friendica programistion se vi ne povas helpi vin mem. Mia datumbazo eble ne plu validas.
La erarmesaĝo estas '{{$error}}'.
Mi bedaŭras,
via Friendica servilo ĉe {{$siteurl}}

View file

@ -1,11 +0,0 @@
Saluton!
Mi estas $sitename.
La programistoj de Frienda eldonis ĝisdatigon $update antaŭ ne longe,
sed kiam mi provis instali ĝin, io terure malsukcesis.
Tio tuj bezonas riparon kaj mi ne povas fari ĝin sole. Bonvolu kontakti
Friendica programistion se vi ne povas helpi vin mem. Mia datumbazo eble ne plu validas.
La erarmesaĝo estas '$error'.
Mi bedaŭras,
via Friendica servilo ĉe $siteurl

View file

@ -1,11 +0,0 @@
Hola,
Estoy en $sitename;
Los desarrolladores actualizaron a $update recientemente,
pero cuando intento instalarlo, algo falla.
Este error debe ser corregido, pero no puedo hacerlo solo. Por favor,
avisa a algún desarrollador si no puedes ayudarme tú mismo. Mi
base de datos puede estar corrupta. El error que me da es '$error'.
Lo siento,
tu servidor de Friendica en $siteurl

View file

@ -1,11 +0,0 @@
Salut,
Je suis $sitename;
Les développeurs de Friendica ont publié la mise-à-jour $update récemment,
mais quand j'essaye de l'installer, quelque-chose merdoie violemment.
Il faudrait réparer ça rapidement, et je ne peux le faire tout seul. Merci de contacter un développeur Friendica
si vous ne pensez pas pouvoir m'aider tout seul. Ma base de données pourrait tout à fait être corrompue.
Le message d'erreur est '$error'.
Je suis vraiment désolé,
votre dévoué serveur friendica, situé à $siteurl

View file

@ -1,12 +0,0 @@
Hæ,
Ég er {{$sitename}}.
Þróunarteymi friendica gáfu nýlega út uppfærslu {{$update}},
En þegar ég reyndi að uppfæra, gerist eitthvað hræðilegt.
Þetta þarf að laga strax og ég get það ekki ein. Hafðu samband við
þróunarteymi friendica ef þú getur ekki hjálpað mér. Gagnagrunnurinn minn gæti verið skemmdur
Villuskilaboðin eru '{{$error}}'.
Fyrirgefðu,
þinn friendica þjónn á {{$siteurl}}

View file

@ -1,11 +0,0 @@
Hæ,
Ég er $sitename;
Þróunarteymi friendica gáfu nýlega út uppfærslu $update,
En þegar ég reyndi að uppfæra, gerist eitthvað hræðilegt.
Þetta þarf að laga strax og ég get það ekki ein. Hafðu samband við
þróunarteymi friendica ef þú getur ekki hjálpað mér. Gagnagrunnurinn minn gæti verið skemmdur
Villuskilaboðin eru '$error'.
Fyrirgefðu,
þinn friendica þjónn á $siteurl

View file

@ -1,11 +0,0 @@
Ehi,
Sono {{$sitename}};
Gli sviluppatori di Friendica hanno appena rilasciato la nuova versione {{$update}},
ma appena ho provato ad installarla qualcosa è andato tremendamente storto.
Le cose vanno messe a posto al più presto e non riesco a farlo da solo. Contatta uno
sviluppatore di friendica se non riesci ad aiutarmi da solo. Il mio database potrebbe non essere più a posto.
Il messaggio di errore è: '{{$error}}'.
Mi dispiace,
il tuo server friendica su {{$siteurl}}

View file

@ -1,12 +0,0 @@
Hei,
jeg er {{$sitename}}.
Friendica-utviklerne slapp nylig oppdateringen {{$update}},
men da jeg prøvde å installere den, gikk noe forferdelig galt.
Dette trenger å bli fikset raskt og jeg kan ikke gjøre det alene. Vennligst kontakt en
Friendica-utvikler hvis du ikke kan hjelpe meg på egenhånd. Databasen min er kanskje ugyldig.
Feilmeldingen er '{{$error}}'.
Jeg beklager,
din Friendica-tjener hos {{$siteurl}}

View file

@ -1,11 +0,0 @@
Hei,
Jeg er $sitename;
Friendica-utviklerne slapp nylig oppdateringen $update,
men da jeg prøvde å installere den, gikk noe forferdelig galt.
Dette trenger å bli fikset raskt og jeg kan ikke gjøre det alene. Vennligst kontakt en
Friendica-utvikler hvis du ikke kan hjelpe meg på egenhånd. Databasen min er kanskje ugyldig.
Feilmeldingen er '$error'.
Jeg beklager,
din Friendica-tjener hos $siteurl

View file

@ -1,11 +0,0 @@
Hallo,
Ik ben $sitename;
De friendica ontwikkelaars hebben update $update vrijgegeven.
Maar toen ik probeerde te installeren ging het vreselijk fout
Dit moet snel gerepareerd worden maar dat kan ik niet alleen, Contacteer a.u.b.
een Friendica ontwikkelaar als je me niet zelf kunt helpen. Mijn database kan ongeldig zijn.
De foutmeldimg is '$error'.
Sorry,
je Friendica server op $siteurl

View file

@ -1,12 +0,0 @@
Hey,
Jestem {{$sitename}}.
Deweloperzy friendica wydali ostatnio aktualizację {{$update}},
ale kiedy próbowałem ją zainstalować, coś poszło nie tak.
To musi być szybko poprawione, ale nie mogę zrobić tego sam. Proszę o kontakt z
deweloperami friendica, jeśli nie możesz mi pomóc na własną rękę. Moja baza danych może być uszkodzona.
Komunikat o błędzie: '{{$error}}'.
Przepraszam,
twój serwer friendica w {{$siteurl}}

View file

@ -1,11 +0,0 @@
Hey,
Jestem $sitename;
Deweloperzy friendica wydali ostatnio aktualizację $update,
ale kiedy próbowałem ją zainstalować, coś poszło nie tak.
To musi być szybko poprawione, ale nie mogę zrobić tego sam. Proszę o kontakt z
deweloperami friendica, jeśli nie możesz mi pomóc na własną rękę. Moja baza danych może być uszkodzona.
Komunikat o błędzie: '$error'.
Przepraszam,
twój serwer friendica w $siteurl

View file

@ -1,12 +0,0 @@
Oi,
Eu sou {{$sitename}}
Os desenvolvedores do friendica lançaram uma atualização {{$update}} recentemente,
mas quando tentei instalá-la algo de errado aconeteceu.
Isso precisa ser corrigido logo e não posso fazê-lo sozinho. Por favor contacte um
desenvolvedor do friendica se você não puder fazer a correção. Meu banco de dados pode estar inválido.
A mensagem de erro é : '{{$error}}'.
Lamento.
Seu servidor friendica em {{$siteurl}}

View file

@ -1,11 +0,0 @@
Oi,
Eu sou $sitename
Os desenvolvedores do friendica lançaram uma atualização $update recentemente,
mas quando tentei instalá-la algo de errado aconeteceu.
Isso precisa ser corrigido logo e não posso fazê-lo sozinho. Por favor contacte um
desenvolvedor do friendica se você não puder fazer a correção. Meu banco de dados pode estar inválido.
A mensagem de erro é : '$error'.
Lamento.
Seu servidor friendica em $siteurl

View file

@ -1,11 +0,0 @@
Bună,
Sunt $sitename;
Dezvoltatorii friendica au lansat actualizarea $update recent,
dar când am incercat s-o instalez, ceva a mers teribil de prost.
Aceasta trebuie fixată curând . Nu o pot face singur. Vă rog contactaţi-mă la
friendica dezvoltator dacă nu mă pot ajuta pe cont propriu. Baza mea de date ar putea fi invalidă.
Mesajul de eraoare este '$error'.
Îmi pare rău.
serverul dvs. friendica la $siteurl

View file

@ -1,12 +0,0 @@
Hey,
I'm {{$sitename}}.
The friendica developers released update {{$update}} recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid.
The error message is '{{$error}}'.
I'm sorry,
your friendica server at {{$siteurl}}

View file

@ -1,11 +0,0 @@
你好,
我是$sitename
Friendica开发者最近出版更新$update
可我安装的时候,遇到什么灾害,
这要紧急地维修,可我不会自己做。请联系
一个Friendica开发者如果你不会自己帮我。我的数据库会不效。
错误通信是「$error」
不好意思,
你Friendica服务器在$siteurl