removing a parse error from the front page

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
TKS
Regular
Posts: 199
Joined: Thu Nov 11, 2004 1:34 am
Location: VA, USA
Contact:

removing a parse error from the front page

Post by TKS »

Ok


So I tried to create a plugin for a sidebar (phpbox plugin) but kept resulting in a parse error. So I deleted the plugin folder from my webserver....

However, now I get the following error from my admin >> configure plugins screen:

Code: Select all

Fatal error: Call to a member function on a non-object in /var/www/html/serendipity_admin_plugins.inc.php on line 127
Also, it is important to note that my 'events' plugins are no longer displaying at all.




There is also a parse error on the front page even though the plugin has been deleted:

The following is displayed on the front page where phpbox used to be:

Code: Select all

Fatal error: Call to a member function on a non-object in /var/www/html/serendipity_plugin_api.php on line 313

Can someone point me in the direction I need to go to solve this? I'd hate to have to reinstall...
Guest

Post by Guest »

First off, in the future, delete the plugin using the s9y interface /first/, then delete the directory.

To solve this, you'll need to manually delete the appropriate entry from the {PREFIX}plugins table in your database--you should be able to figure out which row to get rid of if you were able to get this far ;)
-TKS-

Cool!

Post by -TKS- »

Cool...that's all I needed! I'll track it down.

PS: Immediately upon deleting it...I said to myself...I shouldn't have done it there without going through the s9y interface.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: removing a parse error from the front page

Post by garvinhicking »

Another note: In recent CVS versions of S9y, the interface will not cease to function if you remove a plugin and you will be able to remove it afterwards...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
zpage

Post by zpage »

And can someone correct the script!? HELP!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

To correc the script, we would need to source of your script :-)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

http://www.s9y.org/forums/viewtopic.php ... ght=phpbox

Wie ich gerade sah, seit auch ihr aus Deutschland .. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Achso, um das Plugin geht es. :)

Nun, das korrigiere ich aus Prinzip nicht, weil ich es sicherheitstechnisch für nicht vertretbar halte das Plugin einzusetzen. Sorry, da bin ich konsequent, denn das öffnet Tür und Tor für potentielle Hackattacken. Es ist weitaus besser für jeden Zweck ein eigenes Plugin zu erstellen, oder halt ein zentral Plugin was mehrere Fälle handled.

English version: I won't fix the phpbox plugin. Regarding security it is not recommended to use the plugin, but rather use single plugins for each purpose, or one master plugin with different switches/cases for different outputs. Having a general eval() plugin opens all sorts of possibilites to get your blog hacked...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

Gibt es eine andere Möglichkeit das HTML-Nugget mit PHP zu nutzen, Sire?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Nein, denn alle Möglichkeiten für so etwas generelles sind sehr große Sicherheitslöcher, sowas kann ich leider nicht mit meinem Gewissen vereinbaren. Sorry, dass ich da so korrintenkackerisch bin, das ist nicht böse gemeint. Ich will doch nur euer bestes. :-)

Viele Grüße,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Zpage

Post by Zpage »

Es ist weitaus besser für jeden Zweck ein eigenes Plugin zu erstellen, oder halt ein zentral Plugin was mehrere Fälle handled.
Und wie sollte das funktionieren? Die Seite ist nur zu Testzwecken geeignet, ob sie gehackt wird (potenziell unwahrscheinlich, da nicht public) ist in diesem Falle egal, Master.

Zpage
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

In diesem Fall folgendes Plugin ausprobieren. Ungetestet und es kann Dir Dein Hirn rausragen, den Server zerstören und sämtliche Daten ans BKA schicken:

Code: Select all

<?php
class serendipity_plugin_phpbox extends serendipity_plugin {
    var $title = 'PHP Nugget';

    function introspect(&$propbag)
    {
        $this->title = $this->get_config('title', $this->title);
        $propbag->add('name',          'PHP Nugget');
        $propbag->add('description',   HOLDS_A_BLAHBLAH);
        $propbag->add('stackable',     true);
        $propbag->add('author',        '37331 h4x0rr');
        $propbag->add('version',       '1.0');
        $propbag->add('configuration', array(
                                        'title',
                                        'content',
                                        'markup',
                                        'show_where'
                                       )
        );

        $this->protected = TRUE; // If set to TRUE, only allows the owner of the plugin to modify its configuration
    }

    function introspect_config_item($name, &$propbag)
    {
        switch($name) {
            case 'title':
                $propbag->add('type',        'string');
                $propbag->add('name',        TITLE);
                $propbag->add('description', TITLE_FOR_NUGGET);
                $propbag->add('default',     '');
                break;

            case 'content':
                $propbag->add('type',        'html');
                $propbag->add('name',        CONTENT);
                $propbag->add('description', THE_NUGGET);
                $propbag->add('default',     '');
                break;

            case 'markup':
                $propbag->add('type',        'boolean');
                $propbag->add('name',        DO_MARKUP);
                $propbag->add('description', DO_MARKUP_DESCRIPTION);
                $propbag->add('default',     'true');
                break;

            case 'show_where':
                $select = array('extended' => PLUGIN_ITEM_DISPLAY_EXTENDED, 'overview' => PLUGIN_ITEM_DISPLAY_OVERVIEW, 'both' => PLUGIN_ITEM_DISPLAY_BOTH);
                $propbag->add('type',        'select');
                $propbag->add('select_values', $select);
                $propbag->add('name',        PLUGIN_ITEM_DISPLAY);
                $propbag->add('description', '');
                $propbag->add('default',     'both');
                break;

            default:
                return false;
        }
        return true;
    }

    function generate_content(&$title)
    {
        global $serendipity;

        $title = $this->get_config('title');
        $show_where = $this->get_config('show_where', 'both');

        if ($show_where == 'extended' && (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id']))) {
            return false;
        } else if ($show_where == 'overview' && isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id'])) {
            return false;
        }

        $_content = $this->get_config('content');
        ob_start();
        eval($content);
        $content = ob_get_contents();
        ob_end_clean();
        
        if ($this->get_config('markup', 'true') == 'true') {
            $entry = array('html_nugget' => $content);
            serendipity_plugin_api::hook_event('frontend_display', $entry);
            echo $entry['html_nugget'];
        } else {
            echo $content;
        }
    }
}
?>
(Den Code als /plugins/serendipity_plugin_phpbox.php abspeichern und dann einstellen)

English notice: This plugin may cause serious damage to your server, brain, and friends. It will kill your animals, create a nuclear fallout in the street you're living and will cripple any organs you may have left. You've been warned. This plugin is considered dangerous.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

(Den Code als /plugins/serendipity_plugin_phpbox.php abspeichern und dann einstellen)
Ihr meint bestimmt, als /plugins/serendipity_plugin_phpbox/serendipity_plugin_phpbox.php abspeichern. Richtig?

Aus welchem Grunde ist dieses Script eingebunden in Serendipity so gefährlich? Gibt es keine Möglichkeit dies zu umgehen?

Zu den Plugin: Leider wird bei mir keine Ausgabe geliefert. Egal, ob ich in PHP oder HTML ausgeben.

Zpgae
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Ja, der Pfad muss so genommen werden wie du geschrieben hast, da hab ich den Verzeichnisnamen vergessen :)

Das Script ist daher so gefährlich, weil jeder Serendipity User beliebigen PHP Code ausführen kann, und vielleicht gibt es sogar Exploits die das Einfügen von Daten in die Serendipity Umgebung erlauben, und dann könnte beliebiger PHP Code von Benutzern ausgeführt werden. Eval() ist böse und sollte vermieden werden.

Wir haben eine sehr flexible Plugin API die die Erstellung eines Plugins zu jedem einzelnen Zweck erfüllen kann. Generische PHP plugins sind unnötig, langsamer, unsicherer und können nicht einfach mit anderen Nutzern geteilt werden wie separate Plugins.
Zu den Plugin: Leider wird bei mir keine Ausgabe geliefert. Egal, ob ich in PHP oder HTML ausgeben.
Der PHP Code den Du in das PHP Nugget einträgst sollte ohne WYSIWYG editor erstellt werden und die <?php und ?> Tags enthalten - trifft das zu? Sonst kommt'S auf den PHP Code an, den Du einfügst, vielleicht ist der buggy.

Viele Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

Jeder Serendipity User? Wer sollte das sein? Ich verstehe nicht ganz ... :)
Als Beispiel habe ich den folgenden Code benutzt: <?php echo("Test"); ?>

Er funktionierte nicht.

Zpage
Post Reply