Page 1 of 1

Plugin for Dev. on Live Systems

Posted: Thu Apr 24, 2008 6:13 pm
by notyyy
Hello,

Sorry for my bad english, i don't speak it, i just try to.

i wrote a very small plugin which stop the blog and just display a message or a template. so you can update the blog and than the blog can activatet.

has somebody ideas for this plugin, or want to try it ? (just german)

thanks for this great blog,
tim

Re: Plugin for Dev. on Live Systems

Posted: Fri Apr 25, 2008 10:28 am
by garvinhicking
Hi!

I'd be interested in this plugin, can you post a link or show the sourcecode? :)

Regards,
Garvin

Re: Plugin for Dev. on Live Systems

Posted: Fri Apr 25, 2008 1:26 pm
by Steffen
notyyy wrote:Hello,

Sorry for my bad english, i don't speak it, i just try to.

i wrote a very small plugin which stop the blog and just display a message or a template. so you can update the blog and than the blog can activatet.

has somebody ideas for this plugin, or want to try it ? (just german)

thanks for this great blog,
tim
Ich würde Dein Plugin gerne ausprobieren. Bin nämlich gerade dabei ein Blog einzurichten und würde liebend gerne die Startseite abklemmen.

<my english isn't really better>
I would like to try your plugin. A the moment I'm just installing a blog and would love to switch off the mainpage.
</my english isn't really better>

Steffen

Posted: Fri Apr 25, 2008 9:35 pm
by notyyy
the source:

It's very small, easy and unperformance.
if some blogger really want to use a plugin like that, i'll write a real plugin with some features.

Code: Select all

<?php
class serendipity_event_anywartung extends serendipity_event
{
	// Einstellungen
	function introspect(&$propbag)
    {
        global $serendipity;

        $propbag->add('name',          "anyWartungsarbeiten");
        $propbag->add('description',   "Dieses Plugin deaktiviert Teile des Blockes für kleinere Änderungen am Layout. ACHTUNG: Alle CSS Dateien werden geblockt!");
        $propbag->add('stackable',     false);
        $propbag->add('configuration', array('active','IP','errorTxt','tplpath','adminlock'));
        $propbag->add('author',        'Tim Glabisch');
        $propbag->add('requirements',  array(
            'serendipity' => '0.8',
            'smarty'      => '2.6.7',
            'php'         => '4.1.0'
        ));
        $hooks =  array('frontend_configure'=>true);
        $hooks['css'] = $this->get_config('cssHook');
        $propbag->add('version',       '1.0');
        $propbag->add('event_hooks',   $hooks);
        $propbag->add('groups', array('BACKEND_TEMPLATES'));
    }
    
    // Ende der Einstellungen
    
   function generate_content(&$title) {
   	 global $serendipity;
        $title = "anyWartungsarbeiten";
        if($this->get_config('active') && $this->get_config('IP') != $_SERVER['REMOTE_ADDR'])
        {
        	if(basename($_SERVER['PHP_SELF']) == "serendipity_admin.php" && !$this->get_config('adminlock'))
        	{
        		return true;
        	}
        	
        	if(file_exists($this->get_config('tplpath')) && is_readable($this->get_config('tplpath')))
        	{
        		die(file_get_contents($this->get_config('tplpath')));
        	}
        	else
        	{
        		die($this->get_config('errorTxt'));
        	}
        }
    }
    
  function introspect_config_item($name, &$propbag)
    {
        global $serendipity;

        switch($name) {
            case 'IP':
                $propbag->add('type',        'string');
                $propbag->add('name',        "IP");
                $propbag->add('description', "Diese IP wird nicht in den Wartungsmodus versetzt. Diese Funktion ermöglicht ein \"Testen\" während der Wartungsmodus aktiviert ist.");
                $propbag->add('default',     $_SERVER['REMOTE_ADDR']);
                break;			
  			case 'active':
                $propbag->add('type',        'boolean');
                $propbag->add('name',        "Aktivieren");
                $propbag->add('description', "Soll die Seite in den Wartungszustand gesetzt werden ?");
                $propbag->add('default',     'false');
                break;
            case 'errorTxt':
                $propbag->add('type',        'string');
                $propbag->add('name',        "Text");
                $propbag->add('description', "Dieser Text/Html-Code wird angezeigt falls die Die Templatedatei nicht existiert.");
                $propbag->add('default',     "Dieser Blog wird derzeit gewartet, bitte geben Sie uns noch eine Tasse Kaffee lang Zeit, um Updates auf den Blog zu spielen. Vielen Dank.");
                break;	
            case 'tplpath':
                $propbag->add('type',        'string');
                $propbag->add('name',        "Template");
                $propbag->add('description', "Diese Datei wird aufgerufen, wenn der Wartungsmodus aktiviert wurde.");
                $propbag->add('default',     realpath(__FILE__.'/../../../').DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR);
                break;			
            case 'adminlock':
                $propbag->add('type',        'boolean');
                $propbag->add('name',        "AdminLock");
                $propbag->add('description', "Mit dieser Funktion kann der Admin-Planel in den Wartungsmodus versetzt werden. Man sollte darauf achten, dass man sich nicht aussperrt!");
                $propbag->add('default',     'false');
                break;
            default:
                return false;
        }
        return true;
    }
}

?>
if someone has ideas, please post.
may i rewrite the plugin.

Posted: Wed Apr 30, 2008 9:08 pm
by Steffen
Ich habe beim Testen folgende Fehlermeldungen bekommen. Daraufhin habe ich es erstmal unterlassen, das Ganze zu aktivieren. ;-)

-------------------
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w009d7a6/plugins/serendipity_event_anywartung/serendipity_event_anywartung.php:91) in /www/htdocs/w009d7a6/include/functions_config.inc.php on line 627

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w009d7a6/plugins/serendipity_event_anywartung/serendipity_event_anywartung.php:91) in /www/htdocs/w009d7a6/include/functions_config.inc.php on line 627

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w009d7a6/plugins/serendipity_event_anywartung/serendipity_event_anywartung.php:91) in /www/htdocs/w009d7a6/serendipity_admin.php on line 11
--------------------

Keine Ahnung, was das im einzelnen bedeutet.

Steffen

Posted: Sun Jul 06, 2008 1:37 am
by notyyy
seltsam, werde ich fixen.