• User Attivo

    includere stato topic aperto/chiuso

    ciao ragazzi mi rivolgo a chi conosce bene phpbb2 e php :sbonk:

    ho un po di problemini a includere una funzione gia presente da web nella mia versione wap.mi spiego meglio:

    ho la lista dinamica del topic aperti.
    vorrei che a seconda dello stato comparisse una * prima del titolo se è un topic aperto oppure una X prima del titolo se il topic fosse chiuso...

    questa è la pagina alla quale vorrei applicare tale funzione:

    
    <?php
    
    require 'pmheader.php';
    
    echo($header);
    
    echo "</p><p align = \"center\">";
    
    echo "<img src=\"http://hiwap3.net/forum/wap/icone/forums.png\" alt=\"bacheca\"/>";
    echo "<br/>";
    
    echo '<i>Bacheca</i><br/><br/>';
    
    if(!$userdata['session_logged_in'])
    {
    	echo "Accesso Alla Bacheca Impedito Agli Ospiti. Se Non Lo Sei Registrati O Fai Il Login Da <anchor>qui<go href=\"" . append_sid("index.$phpEx") . "\" /></anchor>";
    }
    else
    {
    
    
    $i = 0;
    
    $topics = array();
    
    $start = ((!isset($_GET['start'])) || (!is_numeric($_GET['start']))) ? "0" : $_GET['start'];
    
    $user_forum = (!isset($_GET['forum'])) ? "-1" : $_GET['forum'];
    
    if($user_forum != "-1")
    
    {
    
    	$sql = "select forum_name from " . FORUMS_TABLE . " where forum_id = \"$user_forum\"";
    
    	$query = $db->sql_query($sql);
    
            if ($forum_name = $db->sql_fetchrowset($query))
    
            {
    
                    $auth = auth(AUTH_VIEW, $user_forum, $userdata);
    
                    if($auth['auth_view'])
    
                    {
    
    						$forum_header = sprintf($lang['wap_viewing_posts'],"<b>" . str_replace("&","&amp;",$forum_name[0][0]) . "</b>\n<br/>");
    
                            $forum_where = " where forum_id = \"$user_forum\"";
    
                    }
    
                    else
    
                    {
    
                            echo $lang['wap_not_authorised_forum'];
    
                            exit(" " . $footer);
    
                    }
    
             }
    
             else
    
             {	
    
             	echo $lang['wap_forum_not_exist'];
    
                    exit(" " . $footer);
    
             }
    
    }
    
    else 
    
    {
    
    	$forum_header = "";
    
            $forum_where = "";
    
    }
    
    $i = 0;
    
    $query = $db->sql_query("select forum_id, topic_id from " . POSTS_TABLE . "$forum_where order by post_time desc limit 2000");
    
    if(!$latestposts = $db->sql_fetchrowset($query))
    
    {
    
        echo $lang['wap_no_posts'];
    
    	echo $footer;
    
    	exit("<br/><br/>" . $footer);
    
    }
    
    foreach($latestposts as $val)
    
    {
    
    	$tid = $val['topic_id'];
    
    	if(preg_match("/\b$tid\b/","$list"))
    
    	{
    
    		continue;
    
    	}
    
    	$auth = auth(AUTH_READ,$val['forum_id'],$userdata);
    
    	if($auth['auth_read'] == "1")
    
    	{
    
    		$sql = "select topic_title, topic_moved_id, topic_replies from " . TOPICS_TABLE . " where topic_id = \"".$val['topic_id']."\"";
    
    		$query = $db->sql_query($sql);
    
    		$topic_title = $db->sql_fetchrow($query);
    
    		if(empty($topic_title['topic_moved_id']))
    
    		{
    
    			// if all is well, add the text to the topic
    
    
    
    			$topics[] = "<anchor>".wap_validate($topic_title['topic_title'],0,0)."<go href=\"" . append_sid("waptopic.$phpEx?s=0&amp;topic=".$val['topic_id']."&amp;forum=".$val['forum_id']) . "\" /></anchor> (".$topic_title['topic_replies'].")<br/>\n";
    
    			$list .= $val['topic_id']."|";
    
    			$i++;
    
    		}
    
    	}
    
    
    
    }
    
    $list = explode("|",$list);
    
    $list = count($list);
    
    if($list == 1)
    
    {
    
    	echo $lang['wap_no_posts'];
    
    	exit("<br/><br/>" . $footer);
    
    }
    
    
    
    //-------------------------------------------------------------------------------------------------------------------------
    
    //---[ build navigation ]--------------------------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------------------------------------------------
    
    
    
    $final = $i;
    
    $next = $start;
    
    $prev = $start;
    
    $next = $next + 10;
    
    $prev = $prev - 10;
    
    
    
    if($start == 0)
    
    {
    
    	if($i > $next)
    
    	{
    
    		$nav = "<anchor>Avanti&gt;&gt;<go href=\"" . append_sid("wap.php?start=$next&amp;forum=$user_forum") . "\" /></anchor>";
    
    	}
    
    }
    
    
    
    else
    
    {
    
    	if($i > $next)
    
    	{
    
    		$nav = "<anchor>&lt;&lt;Precedenti<go href=\"" . append_sid("wap.php?start=$prev&amp;forum=$user_forum") . "\" /></anchor> <anchor>Avanti&gt;&gt;<go href=\"" . append_sid("wap.php?start=$next&amp;forum=$user_forum") . "\" /></anchor>";
    
    	}
    
    	else
    
    	{
    
    		$nav = "<anchor>&lt;&lt;Precedenti<go href=\"" . append_sid("wap.php?start=$prev&amp;forum=$user_forum") . "\" /></anchor>";
    
    	}
    
    }
    
    
    
    //Build the page which the user is viewing
    
    $i = 0;
    
    echo $forum_header;
    
    foreach($topics as $key => $val)
    
    {
    
    	if($i == 10)
    
    
    
    	{
    
    		break;
    
    	}
    
    	if($start != 0)
    
    	{
    
    		if($key < $start)
    
    		{
    
    			continue;
    
    		}
    
    	}
    
    	$post_text = $val;
    
    	$post_text = preg_replace('/\:[0-9a-z\:]+]/si', ']', $post_text);
    
    	$post_text = stripslashes($post_text);
    
    	echo $post_text;
    
    	$i++;
    
    }
    
    echo "<br/>";
    
    echo $nav;
    
    echo "<br/><br/>";
    
    }
    
    if($userdata['session_logged_in'])
    { 
    echo 'Nuovo:';
    echo "<anchor>" . $lang['wap_new_topic'] . "<go href=\"" . append_sid("wapnew.$phpEx") . "\" />Topic</anchor>\n";
    echo '/';
    echo "<anchor>" . $lang['wap_write_new_pm'] . "<go href=\"" . append_sid("wappm.$phpEx?action=new") . "\" /> Inbox</anchor><br/>\n";
    }
    
    echo "</p><p align = \"center\">";
    
    echo $footer;
    
    ?>
    
    

    qualcuno mi aiutiii 😞