Avatar billede nikky Nybegynder
16. august 2003 - 12:10 Der er 5 kommentarer

unexpected T_STRING

Når jeg skal sende en mail fra min side får jeg denne fejl:

Parse error: parse error, unexpected T_STRING in /customers/nikky.dk/nikky.dk/httpd.www/add/gorum/notification.php(188) : eval()'d code on line 13

Notice: Undefined variable: mailText in /customers/nikky.dk/nikky.dk/httpd.www/add/gorum/notification.php on line 189

Jeg modtager godt nok e-mailen, men der er ingen tekst i bodyen, men subject er udfyldt?

Mit script ser sådan her ud:

<?php
// A notificationok applikacionkent fixek. Az installibben kell oket
// letrehozni. A user nem hozhat letre ujat es nem torolhet ki egyet
// sem, maximum modosithatja oket

$dbClasses[]="notification";

$notification_typ = 
    array(
        "attributes"=>array( 
            "id"=>array(
                "type"=>"INT",
                "form hidden",
            ),   
            "fixRecipent"=>array(
                "type"=>"INT",
                "bool",
                "default"=>"0",
                "form hidden"
            ),   
            "fixCC"=>array(
                "type"=>"INT",
                "bool",
                "default"=>"1",
                "form hidden"
            ),           
            "recipent"=>array(
                "type"=>"VARCHAR",
                "max" =>"255",
                "text",
                "mandatory",
            ),           
            "cc"=>array(
                "type"=>"VARCHAR",
                "max" =>"255",
                "text",
                "details",
            ),           
            "title"=>array(
                "type"=>"VARCHAR",
                "max" =>"120",
                "list",
                "details",
                "form readonly"
            ),
            "subject"=>array(
                "type"=>"VARCHAR",
                "max" =>"120",
                "min" =>"1",
                "text",
                "mandatory",
                "details",
            ),
            "variables"=>array(
                "type"=>"TEXT",
                "details",
                "form readonly",
            ),
            "body"=>array( 
                "type"=>"TEXT",
                "textarea",
                "cols"=>50,
                "rows"=>5,
                "mandatory",
                "details",
            ),   
            "active"=>array(
                "type"=>"INT",
                "bool",
                "default"=>"1",
                "list",
                "details",
            )
        ),   
        "primary_key"=>"id",
        "sort_criteria_attr"=>"id",
        "sort_criteria_dir"=>"d"
    );

class Notification extends Object
{
    function hasObjectRights(&$hasRight, $method, $giveError=FALSE)
    {
        global $generalRight, $lll;
        hasAdminRights($isAdm);
        $hasRight = ($isAdm && $method==Priv_modify) || $method==Priv_load;
        $generalRight = TRUE;
        if( !$hasRight && $giveError )
        {
            handleError($lll["permission_denied"]);
        }
        return ok;
    }
   
    function showDetailsTool()
    {
        return "";
    } 
   
    function showListVal($attr)
    {
        global $gorumroll, $lll;
   
        $s="";
        if( $attr=="active" ) {
            if ($this->active) $s=$lll["yes"];
            else $s=$lll["no"];
        }
        elseif ($attr=="title") {
            if( $gorumroll->method=="showhtmllist" )
            {
                $tempRoll = new Roll;
                $tempRoll->method = "showdetails";
                $tempRoll->list = "notification";
                $tempRoll->rollid = $this->id;
                saveInFromFrom($tempRoll);
                $s.=$tempRoll->generAnchor($this->title, "itemtitle");
            }
            else $s=htmlspecialchars($this->{$attr});
        }   
        elseif ($attr=="body") {
            $s=nl2br(htmlspecialchars($this->{$attr}));
        }   
        else
        {
            $s=htmlspecialchars($this->{$attr});
        }
        return $s;
    }   
   
    function showDetails(&$s, $whereFields="", $withLoad=TRUE,$headText="")
    {
        global $notification_typ, $gorumroll;
       
        $this->id = $gorumroll->rollid;
        load($this);
        if( $this->fixRecipent )
        {
            $notification_typ["attributes"]["recipent"][]="details";
        }
        else
        {
            $notification_typ["attributes"]["recipent"][]="form invisible";
        }
        showDetails($this, $s, $whereFields, FALSE);
    }
   
    function generForm(&$s)
    {
        global $notification_typ, $gorumroll;
       
        if( $this->fixRecipent )
        {
            $notification_typ["attributes"]["recipent"][]="details";
        }
        else
        {
            $notification_typ["attributes"]["recipent"][]="form invisible";
        }
        generForm($this, $s);
    }
   
    function modify()
    {
        global $notification_typ;
       
        if( $this->fixRecipent )
        {
            $notification_typ["attributes"]["recipent"]["min"]=1;
        }
        privilegeModify($this);
    }
   
    function send()
    {
        global $adminEmail, $htmlNotifications;
       
        $from = $adminEmail ? "From: $adminEmail" : "";
        $variableNames = explode(", ", $this->variables);
        $variables = func_get_args();
        if( $this->fixRecipent ) $to = $this->recipent;
        else $to = array_shift($variables); // levagjuk a to-t
        if( $this->fixCC ) $cc = $this->cc;
        else $cc = array_shift($variables); // levagjuk a cc-t
        // Ha programozott cc is van es db-bol jovo cc is van:
        if( !$this->fixCC && $this->cc ) $cc = array($cc, $this->cc);
        foreach( $variableNames as $v ) $$v=array_shift($variables);
        eval ("\$mailText = \"$this->body\";");
        $err = gmail($adminEmail, $to, $this->subject, $mailText,
                    $htmlNotifications, "", "", $cc);           
        if( $err )
        {
        }
    }
}
?>



HJÆLPPPP.........!!!!!!!!!!!!!!
Avatar billede marduk666 Nybegynder
16. august 2003 - 13:12 #1
Du har vist en ; for meget på linje 188.

eval ("\$mailText = \"$this->body\";");


Den skal se sådan her ud:

eval ("\$mailText = \"$this->body\"");
Avatar billede nikky Nybegynder
16. august 2003 - 13:30 #2
Det har jeg prøvet, det giver det samme..
Avatar billede r.a.f. Nybegynder
16. august 2003 - 13:33 #3
Et $ tegn for meget i 187

  foreach( $variableNames as $v ) $$v=array_shift($variables);

bliver til:
  foreach( $variableNames as $v ) $v=array_shift($variables);
;-)
Avatar billede nikky Nybegynder
16. august 2003 - 13:39 #4
Har selv fundet ud af det..

Det var sku to "" i min templet.php

Jubii!!!!
Avatar billede marduk666 Nybegynder
16. august 2003 - 13:54 #5
:-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester