Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/09/2008, 02:31
lobo negro
 
Fecha de Ingreso: abril-2006
Mensajes: 34
Antigüedad: 18 años, 7 meses
Puntos: 0
Ayuda con modificación para PHPnews

En realidad mi problema consiste en lograr que los link de full news (noticia completa) y comments (comentarios), habran un popup como hace sendtof y me permitan mostrarlos en una venana distinta, ya que en este momento lo muestran en la misma ventana. Adjunto el codigo de news.php original. En los anteriores intentos copie el javascript de sendtof, cambiandolo por supuesto, para q e sirviera para los dos y despues cambiandolo tambien en la parte que dice: "/* Display link to show comments & news if enabled */" pero aun asi no muestra cambio alguno en la forma de mostrar las noticias. Gracias adelantadas.

Código:
<!-- (c) 2003 PHPNews - http://newsphp.sourceforge.net/ -->
<?php
error_reporting (E_ALL ^ E_NOTICE);
/*********************************************
* ------------                               *
* | News.php |                               *
* ------------                               *
* PHPNews - Beta 1.2.0                       *
* Open Source Project started by Pierce Ward *
*                                            *
* Software Distributed at:                   *
* http://newsphp.sourceforge.net             *
* ========================================== *
* (c) 2003 Pierce Ward (Big P)               *
* All rights reserved.                       *
* ========================================== *
* This program has been written under the    *
* terms of the GNU General Public Licence as *
* published by the Free Software Foundation. *
*                                            *
* The GNU GPL can be found in gpl.txt        *
*********************************************/

/* Get the absolute path for including files */
$path = __FILE__;
$path = str_replace('news.php', '', $path);

include_once($path . 'settings.php');

/* Don't edit - Connects to DB */
$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name);

/* Grabs Settings and puts it in an Array */
$result = mysql_query('SELECT variable,value FROM ' . $db_prefix . 'settings');

$Settings = array();
while ($row = mysql_fetch_array($result))
{
    $Settings[$row['0']] = $row['1'];
}

$lang = $Settings['language'];

/* Opens language file */
if(!file_exists($path . 'languages/' . $lang . '.news.lng'))
{
    include_once($path . 'languages/en_GB.news.lng');
}
else
{
    include_once($path . 'languages/' . $lang . '.news.lng');
}
$language = $lng;

if(!isset($_GET['action']))
{
    news();
}
else if($_GET['action'] == 'fullnews')
{
    fullNews();
}
else if($_GET['action'] == 'post')
{
    post();
}
else if($_GET['action'] == 'showcat' && isset($_GET['catid']))
{
    showCat();
}

function news()
{
  global $Settings, $language, $_SERVER, $path, $db_prefix;

/* Prints JavaScript for Send to Friend Link */
if ($Settings['enablestf'] == 1)
{
?>
<script type="text/javascript">
<!--
        function sendtof(desktopURL)
        {
          desktop = window.open(desktopURL, "SendToFriend", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=400,height=275,resizable=no");
        }
// -->
</script>
<?
}
  /* Set up Previous/Next links if enabled */
  if ($Settings['enableprevnext'] == 1)
  {
    /* If we're on the first page set defaults */
    if (!isset($_GET['prevnext']) || $_GET['prevnext'] == 0)
    {
      $_GET['prevnext'] = 0;
      $nextpage = $_GET['prevnext'] + $Settings['numtoshow'];
      $previouspage = $_GET['prevnext'];
      
      /* Find total number of News Posts */
      $numPosts = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'news');
      $var = mysql_fetch_assoc($numPosts);

      if ($var['total'] > $Settings['numtoshow'])
      {
        $include = 1;
      }
    }
    /* Otherwise calculate prev/next links */
    else if (isset($_GET['prevnext']) && is_Numeric($_GET['prevnext']))
    {
      $previouspage = $_GET['prevnext'] - $Settings['numtoshow'];

      /* Find total number of News Posts */
      $numPosts = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'news');
      $var = mysql_fetch_assoc($numPosts);

      /* If the number of posts is greater, there's enough room for another page */
      if ($var['total'] > ($_GET['prevnext'] + $Settings['numtoshow']))
      {
        $nextpage = $_GET['prevnext'] + $Settings['numtoshow'];
      }
      else
      {
        $nextpage = 0;
      }
      
      /* Include Previous/Next Template */
      $include = 1;
    }
  }
  else
  {
    $_GET['prevnext'] = 0;
  }
  
  /* Get information about the News Post */
  $SQL_query = mysql_query('SELECT n.id,n.posterid,n.postername,n.time,n.subject,n.titletext,n.maintext,n.catid,p.username,p.email,p.avatar,c.catname,c.caticon'
                           . ' FROM ' . $db_prefix . 'news AS n'
                           . ' LEFT JOIN ' . $db_prefix . 'posters AS p ON(n.posterid=p.id)'
                           . ' LEFT JOIN ' . $db_prefix . 'categories AS c ON(n.catid=c.id)'
                           . ' WHERE n.trusted = 1'
                           . ' ORDER by n.id DESC'
                           . ' LIMIT ' . $_GET['prevnext'] . ', ' . $Settings['numtoshow'] . '');

  while($news = mysql_fetch_assoc($SQL_query))
  {
    /* Set Variables */
    $time = strftime($Settings['timeformat'], $news['time']);
    $subject = stripslashes($news['subject']);
    $titletext = stripslashes($news['titletext']);
    $maintext = stripslashes($news['maintext']);

    /* Print Comments if enabled */
    if ($Settings['enablecomments'] == 1)
    {
      $query2 = mysql_query('SELECT count(*) as total FROM ' . $db_prefix . 'comments WHERE mid = ' . $news['id'] . '');
      $var = mysql_fetch_assoc($query2);
      $comments = '<a href="' . $_SERVER['PHP_SELF'] . '?action=fullnews&amp;showcomments=1&amp;id=' . $news['id'] . '">' . $language['CONTENT_NEWSCOMMENTS'] . ' (' . $var['total'] . ')</a>';
    }

    /* If Categories are enabled... */
    if ($Settings['enablecats'] == 1)
    {
      if ($news['catid'] != 0)
      {
        if ($news['catname'] != '')
        {
          $category = '<a href="' . $_SERVER['PHP_SELF'] . '?action=showcat&amp;catid=' . $news['catid'] . '">' . $news['catname'] . '</a>';
        }
        
        if ($news['caticon'] != '')
        {
          $caticon = '<img src="' . $news['caticon'] . '" border="0" alt="' . $news['catname'] . '" />';
        }
      }
    }
    
    /* Set the News Posters Username */
    $username = $news['username'];

    if (!$username)
    {
      $username = $news['postername'];
    }

    /* Get the Posters Avatar */
    if ($Settings['enableavatars'] == 1)
    {
      if($news['avatar'] != '')
      {
        $avatar = '<img src="' . $news['avatar'] . '" border="0" alt="' . $username . '\'s avatar" />';
      }
      else
      {
        $avatar = '';
      }
    }

    /* Set an email address? Apply it to the Username */
    if ($news['email'] != '')
    {
      $username = '<a href="mailto:' . $news['email'] . '">' . $username . '</a>';
    }
    else
    {
      $username = $username;
    }

    /* Display link to show comments & news if enabled */
    if ($maintext != '' && $Settings['showcominnews'] == 1 && $Settings['enablecomments'] == 1)
    {
      $maintext = '<a href="' . $_SERVER['PHP_SELF'] . '?action=fullnews&amp;showcomments=1&amp;id=' . $news['id'] . '">' . $language['CONTENT_NEWSFULLSTORY'] . '</a>';
    }
    else if ($maintext != '')
    {
      $maintext = '<a href="' . $_SERVER['PHP_SELF'] . '?action=fullnews&amp;id=' . $news['id'] . '">' . $language['CONTENT_NEWSFULLSTORY'] . '</a>';
    }
    else
    {
      $maintext = '';
    }

    if ($Settings['enablestf'] == 1)
    {
      $sendtofriend = '<a href="javascript:sendtof(\'' . $Settings['phpnewsurl'] . 'sendtofriend.php?mid=' . $news['id'] . '\')">' . $language['CONTENT_NEWSSTFLINK'] . '</a>';
    }
    
    /* Parse the code / smilies */
    $maintext = parseCode($maintext);
    $titletext = parseCode($titletext);

    include($path . 'templates/news_temp.php');
    echo "\n";
    
    /* Clear Variables */
    $category = '';
    $caticon = '';
  }

  /* If previous/next links are enabled */
  if ($Settings['enableprevnext'] == 1 && $include == 1)
  {
    echo '<br />' , "\n";
  
    /* Show Previous Page link? */
    if($_GET['prevnext'] != NULL && $_GET['prevnext'] != 0)
    {
      echo '<span style="margin-right:5px;"><a href="' , $_SERVER['PHP_SELF'] , '?prevnext=' , $previouspage , '">' , $language['CONTENT_PREVIOUS'] , '</a></span>';
      echo "\n";
    }