Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    [php][phpBB]Script messaggio in home

    ciao a tutti.
    Premessa: se ho sbagliato forum non me ne vogliate ma non sono ancora pratico di questo forum

    allora devo realizzare uno script che prenda da uno specifico forum (ID indicato nella variabile $forum) il primo messaggio, solo il primo, dell' ultimo 3D inserito... ora, io questo sono riuscito a farlo(nn è poi così difficile) quello che non riesco a fare è far si che il BBcode e gli smile vengano interpertati bene

    vi posti il codice che ho scritto io:
    Codice PHP:
    <?php
    /**********************************/
    /*    Script Author: Frenko                    */
    /*    Script Name: phpbbViewer  */
    /**********************************/

    //conf
    define('IN_PHPBB'true);
    $phpbb_root_path 'phpBB2/'//ES:PATH_FORUM/ (con slash finale "/")
    include($phpbb_root_path 'extension.inc');
    include(
    $phpbb_root_path 'common.'.$phpEx);
    include(
    $phpbb_root_path 'includes/bbcode.'.$phpEx);

    // configurazione script
    $dbname '';  //Nome del database dove risiedono le tabelle del forum
    $dbhost '';    //Host del database
    $dbuser '';    //User per accedere al database
    $dbpasswd '';    //Pass per accedere al database
    $prefix 'phpbb_';     //Prefisso tabelle nel database con la "_" finale (es: phpbb_)

    $forum "1"//inserisci qui l' id relativo al forum dove inserirai le news
    $n_topic 1//Numero massimo di topic visualizzati in home page


    //connessione al mysql
    $connect mysql_connect($dbhost$dbuser$dbpasswd) or die ("Errore Db Conn");
    $db mysql_select_db($dbname$connect) or die ("Errore Db select");

    //Recupero dati dal mysql



    $query "SELECT a.topic_id as tid, a.topic_title as name, a.topic_last_post_id as pid, d.post_text as message
    FROM "
    .$prefix."topics a, ".$prefix."posts b, ".$prefix."forums c, ".$prefix."posts_text d
    WHERE a.forum_id in ("
    .$forum.")
    and a.topic_id = b.topic_id
    and a.forum_id = c.forum_id
    and a.topic_time = b.post_time
    and d.post_id = b.post_id
    ORDER BY b.post_time desc
    LIMIT 0, 
    $n_topic"

    $risultati mysql_query($query$connect);

    while(
    $row mysql_fetch_array($risultatiMYSQL_ASSOC)) {

    $message $row[message];
    $message smilies_pass($message);
    $message nl2br($message);

    echo 
    "<a href=\"".$phpbb_root_path."viewtopic.php?t=".$row[tid]."\">".$row[name]."</a>
    \n"
    ;
    echo 
    "".$message."
    \n"
    ;
    echo 
    "<a href=\"".$phpbb_root_path."posting.php?mode=reply&t=".$row[tid]."\">Scrivi</a>
    \n"
    ;

    }
    mysql_close();
    ?>
    ho incluso nello script queste pagine
    Codice PHP:
    //conf
    define('IN_PHPBB'true);
    $phpbb_root_path 'phpBB2/'//ES:PATH_FORUM/ (con slash finale "/")
    include($phpbb_root_path 'extension.inc');
    include(
    $phpbb_root_path 'common.'.$phpEx);
    include(
    $phpbb_root_path 'includes/bbcode.'.$phpEx); 
    per far si che le funzioni relative al bbcode vengano inserite... ho passato la variabile $message attraverso la funzione smilies_pass(); (che è stata definita nel file bbcode.php)
    il problema è che mi da questo errore

    Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/sitoutile.net/httpdocs/phpBB2/includes/bbcode.php on line 753
    a quella riga c'è questo
    Codice PHP:
    if( !$result $db->sql_query($sql) )
            {
                
    message_die(GENERAL_ERROR"Couldn't obtain smilies data"""__LINE____FILE__$sql);
            } 
    mi potete aiutare a risolvere questo problema e a far si che mi converta il bbcode in html?

    grazie tante
    cià!

  2. #2
    ti teletrasporto in php

  3. #3
    Originariamente inviato da ringo_mato
    ti teletrasporto in php
    ecco lo sapevo.. scusa

  4. #4

  5. #5
    Originariamente inviato da margherite
    Per convertire gli smiles io uso questa presa in parte dal file bbcode.php di phpbb.
    grazie della risposta... ho fatto quello che c'era scritto ed ora funziona..
    ora resta solo il bbcode... mi potete aiutare? in bbcode.php ho trovato questa funzione che xò chiede un secondo argomento che non so cosa sia e come si ricavi
    Codice PHP:
    function bbencode_second_pass($text$uid)
    {
        global 
    $lang$bbcode_tpl;

        
    $text preg_replace('#(script|about|applet|activex|chrome):#is'"\\1:"$text);

        
    // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
        // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
        
    $text " " $text;

        
    // First: If there isn't a "[" and a "]" in the message, don't bother.
        
    if (! (strpos($text"[") && strpos($text"]")) )
        {
            
    // Remove padding, return.
            
    $text substr($text1);
            return 
    $text;
        }

        
    // Only load the templates ONCE..
        
    if (!defined("BBCODE_TPL_READY"))
        {
            
    // load templates from file into array.
            
    $bbcode_tpl load_bbcode_template();

            
    // prepare array for use in regexps.
            
    $bbcode_tpl prepare_bbcode_template($bbcode_tpl);
        }

        
    // [CODE*] and [/CODE*] for posting code (HTML, PHP, C etc etc) in your posts.
        
    $text bbencode_second_pass_code($text$uid$bbcode_tpl);

        
    // [QUOTE*] and [/QUOTE*] for posting replies with quote, or just for quoting stuff.
        
    $text str_replace("[quote:$uid]"$bbcode_tpl['quote_open'], $text);
        
    $text str_replace("[/quote:$uid]"$bbcode_tpl['quote_close'], $text);

        
    // New one liner to deal with opening quotes with usernames...
        // replaces the two line version that I had here before..
        
    $text preg_replace("/\[quote:$uid=\"(.*?)\"\]/si"$bbcode_tpl['quote_username_open'], $text);

        
    // [list*] and [list=x*] for (un)ordered lists.
        // unordered lists
        
    $text str_replace("[list:$uid]"$bbcode_tpl['ulist_open'], $text);
        
    // li tags
        
    $text str_replace("[*:$uid]"$bbcode_tpl['listitem'], $text);
        
    // ending tags
        
    $text str_replace("[/list:u:$uid]"$bbcode_tpl['ulist_close'], $text);
        
    $text str_replace("[/list:o:$uid]"$bbcode_tpl['olist_close'], $text);
        
    // Ordered lists
        
    $text preg_replace("/\[list=([a1]):$uid\]/si"$bbcode_tpl['olist_open'], $text);

        
    // colours
        
    $text preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$uid\]/si"$bbcode_tpl['color_open'], $text);
        
    $text str_replace("[/color:$uid]"$bbcode_tpl['color_close'], $text);

        
    // size
        
    $text preg_replace("/\[size=([1-2]?[0-9]):$uid\]/si"$bbcode_tpl['size_open'], $text);
        
    $text str_replace("[/size:$uid]"$bbcode_tpl['size_close'], $text);

        
    // [b*] and [/b*] for bolding text.
        
    $text str_replace("[b:$uid]"$bbcode_tpl['b_open'], $text);
        
    $text str_replace("[/b:$uid]"$bbcode_tpl['b_close'], $text);

        
    // [u*] and [/u*] for underlining text.
        
    $text str_replace("[u:$uid]"$bbcode_tpl['u_open'], $text);
        
    $text str_replace("[/u:$uid]"$bbcode_tpl['u_close'], $text);

        
    // [i*] and [/i*] for italicizing text.
        
    $text str_replace("[i:$uid]"$bbcode_tpl['i_open'], $text);
        
    $text str_replace("[/i:$uid]"$bbcode_tpl['i_close'], $text);

        
    // Patterns and replacements for URL and email tags..
        
    $patterns = array();
        
    $replacements = array();

        
    // [img*]image_url_here[/img*] code..
        // This one gets first-passed..
        
    $patterns[] = "#\[img:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/img:$uid\]#i";
        
    $replacements[] = $bbcode_tpl['img'];

        
    // matches a [url*]xxxx://www.phpbb.com[/url*] code..
        
    $patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url1'];

        
    // [url*]www.phpbb.com[/url*] code.. (no xxxx:// prefix).
        
    $patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url2'];

        
    // [url=xxxx://www.phpbb.com*]phpBB[/url*] code..
        
    $patterns[] = "#\[url=([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url3'];

        
    // [url=www.phpbb.com*]phpBB[/url*] code.. (no xxxx:// prefix).
        
    $patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url4'];

        
    // [\email]user@domain.tld[\/email] code..
        
    $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
        
    $replacements[] = $bbcode_tpl['email'];

        
    $text preg_replace($patterns$replacements$text);

        
    // Remove our padding from the string..
        
    $text substr($text1);

        return 
    $text;


    cià!

  6. #6
    Originariamente inviato da Frenko
    grazie della risposta... ho fatto quello che c'era scritto ed ora funziona..
    ora resta solo il bbcode... mi potete aiutare? in bbcode.php ho trovato questa funzione che xò chiede un secondo argomento che non so cosa sia e come si ricavi
    Codice PHP:
    function bbencode_second_pass($text$uid)
    {
        global 
    $lang$bbcode_tpl;

        
    $text preg_replace('#(script|about|applet|activex|chrome):#is'"\\1:"$text);

        
    // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
        // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
        
    $text " " $text;

        
    // First: If there isn't a "[" and a "]" in the message, don't bother.
        
    if (! (strpos($text"[") && strpos($text"]")) )
        {
            
    // Remove padding, return.
            
    $text substr($text1);
            return 
    $text;
        }

        
    // Only load the templates ONCE..
        
    if (!defined("BBCODE_TPL_READY"))
        {
            
    // load templates from file into array.
            
    $bbcode_tpl load_bbcode_template();

            
    // prepare array for use in regexps.
            
    $bbcode_tpl prepare_bbcode_template($bbcode_tpl);
        }

        
    // [CODE*] and [/CODE*] for posting code (HTML, PHP, C etc etc) in your posts.
        
    $text bbencode_second_pass_code($text$uid$bbcode_tpl);

        
    // [QUOTE*] and [/QUOTE*] for posting replies with quote, or just for quoting stuff.
        
    $text str_replace("[quote:$uid]"$bbcode_tpl['quote_open'], $text);
        
    $text str_replace("[/quote:$uid]"$bbcode_tpl['quote_close'], $text);

        
    // New one liner to deal with opening quotes with usernames...
        // replaces the two line version that I had here before..
        
    $text preg_replace("/\[quote:$uid=\"(.*?)\"\]/si"$bbcode_tpl['quote_username_open'], $text);

        
    // [list*] and [list=x*] for (un)ordered lists.
        // unordered lists
        
    $text str_replace("[list:$uid]"$bbcode_tpl['ulist_open'], $text);
        
    // li tags
        
    $text str_replace("[*:$uid]"$bbcode_tpl['listitem'], $text);
        
    // ending tags
        
    $text str_replace("[/list:u:$uid]"$bbcode_tpl['ulist_close'], $text);
        
    $text str_replace("[/list:o:$uid]"$bbcode_tpl['olist_close'], $text);
        
    // Ordered lists
        
    $text preg_replace("/\[list=([a1]):$uid\]/si"$bbcode_tpl['olist_open'], $text);

        
    // colours
        
    $text preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$uid\]/si"$bbcode_tpl['color_open'], $text);
        
    $text str_replace("[/color:$uid]"$bbcode_tpl['color_close'], $text);

        
    // size
        
    $text preg_replace("/\[size=([1-2]?[0-9]):$uid\]/si"$bbcode_tpl['size_open'], $text);
        
    $text str_replace("[/size:$uid]"$bbcode_tpl['size_close'], $text);

        
    // [b*] and [/b*] for bolding text.
        
    $text str_replace("[b:$uid]"$bbcode_tpl['b_open'], $text);
        
    $text str_replace("[/b:$uid]"$bbcode_tpl['b_close'], $text);

        
    // [u*] and [/u*] for underlining text.
        
    $text str_replace("[u:$uid]"$bbcode_tpl['u_open'], $text);
        
    $text str_replace("[/u:$uid]"$bbcode_tpl['u_close'], $text);

        
    // [i*] and [/i*] for italicizing text.
        
    $text str_replace("[i:$uid]"$bbcode_tpl['i_open'], $text);
        
    $text str_replace("[/i:$uid]"$bbcode_tpl['i_close'], $text);

        
    // Patterns and replacements for URL and email tags..
        
    $patterns = array();
        
    $replacements = array();

        
    // [img*]image_url_here[/img*] code..
        // This one gets first-passed..
        
    $patterns[] = "#\[img:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/img:$uid\]#i";
        
    $replacements[] = $bbcode_tpl['img'];

        
    // matches a [url*]xxxx://www.phpbb.com[/url*] code..
        
    $patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url1'];

        
    // [url*]www.phpbb.com[/url*] code.. (no xxxx:// prefix).
        
    $patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,?@\]+]+|\[(?!url=))*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url2'];

        
    // [url=xxxx://www.phpbb.com*]phpBB[/url*] code..
        
    $patterns[] = "#\[url=([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url3'];

        
    // [url=www.phpbb.com*]phpBB[/url*] code.. (no xxxx:// prefix).
        
    $patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
        
    $replacements[] = $bbcode_tpl['url4'];

        
    // [\email]user@domain.tld[\/email] code..
        
    $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
        
    $replacements[] = $bbcode_tpl['email'];

        
    $text preg_replace($patterns$replacements$text);

        
    // Remove our padding from the string..
        
    $text substr($text1);

        return 
    $text;


    cià!
    se bypassi il problema attribuendo a $uid a false nella funzione ??

  7. #7
    Dal nome $uid farebbe pensare all'id dell'utente. Dovresti trovarlo in $userdata['user_id']
    Prova e dicci i risultati!

  8. #8
    ho provato ad attribuire alla variabile $uid FALSE ma praticamente nenche arriva ad eseguire la funzione dando questo errore
    Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/sitoutile.net/httpdocs/phpBB2/includes/bbcode.php on line 46
    nn so cosa fare

  9. #9
    sentite, ho provato in ogni modo ma nn riesco...
    potete aiutarmi?

  10. #10
    Utente di HTML.it
    Registrato dal
    Apr 2006
    Messaggi
    46
    Ragazzi anche io utilizzando questo script nn so come trasformare il phpbb in html qualcuno può aiutarmi????

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.