exported from svn

This commit is contained in:
Jeena 2013-10-07 14:46:08 +02:00
commit 03995d3bc6
85 changed files with 14765 additions and 0 deletions

View file

@ -0,0 +1,66 @@
<?php
class JlogUpdate_102To110
{
var $languages = array();
function JlogUpdate_102To110()
{
$dir = opendir(JLOG_BASEPATH.'lang');
while(($file = readdir($dir)) !== false) {
if($file == '.' OR $file == '..') continue;
if(!preg_match('/lang\.([a-zA-z0-9]+)\.inc\.php/', $file, $matches)) continue;
$this->languages[] = $matches[1];
}
}
function getForm($l)
{
$html = "<p><label for='language'>Bitte wählen Sie die gewünschte Sprache für Ihr Weblog:</label><br />
<select class='userdata' id='language' name='j110_language'>";
foreach($this->languages as $lang) {
$html .= "<option>$lang</option>";
}
$html .= "</select>
</p>
<p>Die Zeichenkodierung ihrer Template-Datei <code>personal/template.tpl</code> muss nach UTF-8 umgewandelt werden. Wenn diese Datei
beschreibbar ist (z.B.: chmod 777), wird dies vom Updatescript automatisch für sie erledigt.
Andernfalls müssen Sie die Konvertierung nachträglich manuell vornehmen.</p>
";
return $html;
}
function performUpdate($l, $settings)
{
// convert all settings to utf8
foreach($settings->d as $key => $value) {
$settings->d[$key] = utf8_encode($value);
}
// reset hash of the administrator password
$settings->d['jlog_admin_password'] = md5($_POST['password']);
// store chosen language
$lang = in_array($_POST['j110_language'], $this->languages) ? $_POST['j110_language'] : 'de';
$settings->d['jlog_language'] = $lang;
$update_errors = array();
/**
* On a correct Jlog 1.0.2 installation, the template is saved with an ISO
* encoding, so we're going to try to convert this to UTF-8
*/
$template = JLOG_BASEPATH."personal".DIRECTORY_SEPARATOR."template.tpl";
if(@file_put_contents($template, utf8_encode(@file_get_contents($template))) == false) {
$update_errors[] = 'Die Datei <code>personal/template.tpl</code> konnte nicht in UTF-8 Kodierung konvertiert werden.';
}
if(empty($update_errors)) {
return true;
}
else {
return $update_errors;
}
}
}

View file

@ -0,0 +1,14 @@
<?php
class JlogUpdate_110To111
{
function getForm($l)
{
return '<p>Keine Einstellungen notwendig.</p>';
}
function performUpdate($l, $settings)
{
return true;
}
}

View file

@ -0,0 +1,28 @@
<?php
class JlogUpdate_111To112
{
function getForm($l)
{
return '<p>Dieses Script behebt ein paar fehlerhafte Einstellungen.'
.' Es ist keine Konfiguration notwendig.</p>';
}
function performUpdate($l, $settings)
{
// in jlog versions prior to jlog 1.1.2 we had escaping problems that caused
// a lot of backslashes in front of a double quote
// so we have to replace \" or \\" or \\\" and so on by ".
$data = array(
'jlog_description' => $settings->getValue('jlog_description'),
'jlog_website' => $settings->getValue('jlog_website'),
'jlog_publisher' => $settings->getValue('jlog_publisher')
);
foreach ($data as $key => $value) {
$value = preg_replace('=\\\\+"=', '"', $value);
$settings->setValue($key, $value);
}
return true;
}
}

View file

@ -0,0 +1,15 @@
<?php
class JlogUpdate_112To113
{
function getForm($l)
{
return '<p>Bitte beachten Sie, dass nach Durchführung dieses Updates eventuell einzelne Plugins nicht mehr funktionieren.<br />'
. 'Kontaktieren Sie in einem solchen Fall den Plugin-Autor bzzgl. eines Updates für das Plugin.</p>';
}
function performUpdate($l, $settings)
{
return true;
}
}

View file

@ -0,0 +1,42 @@
<?php
/**
* This is an example file, how update classes have to look like.
*
* Since we want to support PHP 4, unfortunately we can't use
* all the new OOP functions PHP 5 offers. In future this file may
* be a abstract class that all update classes have to extend.
*/
class JlogUpdate_Example
{
/**
* You can do anything you want here
*/
function __construct()
{
}
/**
* This function should prepare parts of the form for the update
*
* It gets the language array as the first parameter and
* must return html for the update form.
*/
function getForm($l)
{
return '<p>Do not need anything to configure for this update.</p>';
}
/**
* This function has to perform the update
*
* Must return true, if everything went well, of an array of error
* messages, if something went wrong.
* The first parameter again in the language array.
*/
function performUpdate($l)
{
return true;
}
}