ID: 13110
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Closed
Bug Type: Scripting Engine problem
Operating System: Solaris8
PHP Version: 4.0.6
New Comment:

<?
    include("$DOCUMENT_ROOT/lib/template.inc");
    include("$DOCUMENT_ROOT/lib/cst.inc");
    include("$DOCUMENT_ROOT/lib/profilingtoolkit.inc");
    include("$DOCUMENT_ROOT/lib/fonctions.inc");

    //********************************* Connexion à la base de données et requetes 
*********************************
    // creation de la connexion
    $conn = new DB_oracle;
    $conn->Init(BASE,USER,PASS);

    // selection de l'id_cat de la categories ACTUALITES
    // afin de retrouver le parent des rubriques qui se trouvent sous ACTUALITES
    $select = "select id_cat from CATEGORIES where name='".CATEGORIE_ACTU."'";
    $id_cat = $conn->QueryItem($select);

    if ($mode == 'edition' || $mode == 'copie')
    {
        $select = "SELECT name, TO_CHAR(Objects.first_publish, 'DD/MM/RRRR') AS 
first_publish
                           FROM objects
                           WHERE id_obj = $id_obj";
        $tab = $conn->QueryTab($select);

        // recuperation de tous les attributs de l'article à afficher
        $tab_attributs = BuildTabAttributs($id_obj);
        $id_newsletter = "?id_newsletter=$id_obj";
    }

    //********************************************* TEMPLATES 
*************************************************
    // creation du template
    $tmpl = new Template("$DOCUMENT_ROOT/Backoffice/templates", "keep");

    // definition des variables referencant les fichiers
    $tmpl->set_file(array("main" => "newsletterN1.tpl"));

    // definition du bloc des newsletter recuperées
    $tmpl->set_block("main", "rub", "rubriques");

    // recuperation de la liste des themes
    $select = "SELECT id_themes, name FROM themes WHERE themes_cat = 
'".THEME_NEWSLETTER."'";
    $themes = $conn->QueryTab($select);
    $nb_news = $conn->rows;

    for ($rub=0; $rub<$nb_news; $rub++)
    {
        
        // dans le cas ou cette rubrique est selectionnee
        if 
(isset($tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]]) and 
$tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]] != "")
            $check = "CHECKED";
        else
            $check = "";

        $liste_elem = 
GetListElements($tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]]);


        for ($i=0; $i<sizeof($liste_elem); $i++)
        {
                if ($i==0)
                        $elemrub = $liste_elem[$i]["value"];
                else
                        $elemrub .= ",".$liste_elem[$i]["value"];
        }

        $tmpl->set_var( array("ID_THEME"       => $themes[$rub]["id_themes"],
                              "NUM_RUB"        => $rub,
                              "LISTE_RUB"      => $elemrub,
                              "ACCROCHE_THEME" => 
afficherTexte($tab_attributs["accrochethemes_".$themes[$rub]["id_themes"]]),
                              "THEME_CHECKED"  => $check,
                              "THEME_NAME"     => 
afficherTexte($themes[$rub]["name"])) );
        $tmpl->parse("rubriques", "rub", true);
    }

    if ($mode == 'edition')
    {
        // on regarde si on doit afficher ou non le bandeau de pub
        if (isset($tab_attributs["img_bandeau"]) and $tab_attributs["img_bandeau"] != 
"")
        {
            $supp_img1 = "";
            $display_bandeau = "true";
        }
        else
            $display_bandeau = "false";
    }
    else
    {
        $display_bandeau = "false";
    }

    if ($tab[0]["first_publish"] != "")
    {
        $parse_date = explode ("/", $tab[0]["first_publish"]);
    }

    // definition des valeurs par defaut
    $signature_mail = ($tab_attributs["signature_mail"] != "") ? 
$tab_attributs["signature_mail"] : "L'équipe LocalMundi";

    // definition des images
    if ($status == EN_ATTENTE)
    {
        $bouton_nouvelle = "/img/b_nouvelle_off.gif";
        $bouton_attente = "/img/b_en_attent_on.gif";
        $bouton_archive = "/img/b_archivee_off.gif";
    }
    elseif ($status == ARCHIVE)
    {
        $bouton_nouvelle = "/img/b_nouvelle_off.gif";
        $bouton_attente = "/img/b_en_attent_off.gif";
        $bouton_archive = "/img/b_archivee_on.gif";
    }
    else
    {
        $bouton_nouvelle = "/img/b_nouvelle_on.gif";
        $bouton_attente = "/img/b_en_attent_off.gif";
        $bouton_archive = "/img/b_archivee_off.gif";
    }

    // affectation des autres variables
    $tmpl->set_var( array("FIRST_PUBLISH"       => "".$tab[0]["first_publish"],
                                  "J_DATE"                  => "".$parse_date[0],
                                  "M_DATE"                  => "".$parse_date[1],
                                  "A_DATE"                  => "".$parse_date[2],
                                  "OBJET_MAIL"      => 
"".afficherTexte($tab_attributs["objet_mail"], true),
                                  "URL_BANDEAU"     => 
"".afficherTexte($tab_attributs["url_bandeau"]),
                                  "BANDEAU_PUB"     => 
"".afficherTexte($tab_attributs["bandeau_pub"]),
                                  "TITRE"                   => 
"".afficherTexte($tab[0]["name"], true),
                                  "OLD_TITRE"       => 
"".afficherTexte($tab[0]["name"], true),
                                  "EDITO"           => 
"".afficherTexte($tab_attributs["edito"], true),
                                  "NOUVEAUTE"       => 
"".afficherTexte($tab_attributs["nouveaute"], true),
                                  "SIGNATURE_MAIL"  => afficherTexte($signature_mail, 
true),
                                  "IMG_NOUVELLE"    => $bouton_nouvelle,
                                  "IMG_ATTENTE"     => $bouton_attente,
                                  "IMG_ARCHIVE"     => $bouton_archive,
                                  "MODE"            => $mode,
                                  "NB_NEWS"                 => $nb_news,
                                  "DISPLAY_BANDEAU" => $display_bandeau,
                                  "SRC_BANNIERE"    => 
"/images/bannieres/".$tab_attributs["img_bandeau"],
                                  "ID_NEWSLETTER"   => $id_newsletter,
                                  "ID_OBJ"          => ($mode != "copie") ? $id_obj : 
""));

    // construction du fichier
    $tmpl->parse("out", "main");

    // affichage du fichier
    $tmpl->p("out");

    // fermeture de la connexion
    $conn->Close();
?>


Previous Comments:
------------------------------------------------------------------------

[2001-11-11 06:14:18] [EMAIL PROTECTED]

No feedback. Closing.

------------------------------------------------------------------------

[2001-10-21 00:48:33] [EMAIL PROTECTED]

Please include a _short_ and _complete_ script that can just
be cut'n'pasted and which shows the problem.


------------------------------------------------------------------------

[2001-09-03 11:29:07] [EMAIL PROTECTED]

for ($rub=0; $rub<$nb_news; $rub++)
    {
        
        // dans le cas ou cette rubrique est selectionnee
        if 
(isset($tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]]) and 
$tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]] != "")
            $check = "CHECKED";
        else
            $check = "";

        $liste_elem = 
GetListElements($tab_attributs["id_liste_newletterthemes_".$themes[$rub]["id_themes"]]);

        debug(sizeof($liste_elem));
        for ($i=0; $i<sizeof($liste_elem); $i++)
        {
                if ($i==0)
                        $elemrub = $liste_elem[$i]["value"];
                else
                        $elemrub .= ",".$liste_elem[$i]["value"];
        }

        $tmpl->set_var( array("ID_THEME"       => $themes[$rub]["id_themes"],
                              "NUM_RUB"        => $rub,
                              "LISTE_RUB"      => $elemrub,
                              "ACCROCHE_THEME" => 
afficherTexte($tab_attributs["accrochethemes_".$themes[$rub]["id_themes"]]),
                              "THEME_CHECKED"  => $check,
                              "THEME_NAME"     => 
afficherTexte($themes[$rub]["name"])) );
        $tmpl->parse("rubriques", "rub", true);
    }

if in this loop the number of element is $nb_news = 1.
here 20,1,138 before enter loop an Bus error or a segmentation fault is generate in 
Apache log under Solaris8



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13110&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to