Tema: Bloque Anonimos
jpeeri
avatar
Posteador de Oro
Posteador de Oro
Mensajes: 1809

Enviado:
17.ene 2005 - 15:46

Queridos quiero crear un bloque para anónimos de echo este es el código:

// PostNuke Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file: count number of guests/members online
// 20/09/2001 - modified sql to cope with there being 0 members online
// ----------------------------------------------------------------------

if (strpos($_SERVER['PHP_SELF'], 'online.php')) {
die ("You can't access this file directly...");
}

$blocks_modules['online'] = array(
'func_display' => 'blocks_online_block',
'text_type' => 'Online',
'text_type_long' => 'Online',
'allow_multiple' => false,
'form_content' => false,
'form_refresh' => false,
// 'support_xhtml' => true,
'show_preview' => true
);

// Security
pnSecAddSchema('Onlineblock::', 'Block title::');

function blocks_online_block($row)
{
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();

if (!pnSecAuthAction(0, 'Onlineblock::', "$row[title]::", ACCESS_READ)) {
return;
}

$sessioninfocolumn = &$pntable['session_info_column'];
$sessioninfotable = $pntable['session_info'];

$sessioninfocolumn = &$pntable['session_info_column'];
$sessioninfotable = $pntable['session_info'];
$activetime = time() - (pnConfigGetVar('secinactivemins') * 60);
$query = "SELECT count( 1 )
FROM $sessioninfotable
WHERE $sessioninfocolumn[lastused] > $activetime AND $sessioninfocolumn[uid] >0
GROUP BY $sessioninfocolumn[uid]
";
$result =& $dbconn->Execute($query);
$numusers = $result->RecordCount();
$result->Close();
$query2 = "SELECT count( 1 )
FROM $sessioninfotable
WHERE $sessioninfocolumn[lastused] > $activetime AND $sessioninfocolumn[uid] = '0'
GROUP BY $sessioninfocolumn[ipaddr]
";
$result2 =& $dbconn->Execute($query2);
$numguests = $result2->RecordCount();
$result2->Close();
// Pluralise
if ($numguests == 1) {
$guests = _GUEST;
} else {
$guests = _GUESTS;
}
if ($numusers == 1) {
$users = _MEMBER;
} else {
$users = _MEMBERS;
}
$content = "<span class=\"pn-normal\">"._CURRENTLY." ".pnVarPrepForDisplay($numguests)." ".pnVarPrepForDisplay($guests)." "._AND." ".pnVarPrepForDisplay($numusers)." ".pnVarPrepForDisplay($users)." "._ONLINE.".
\n";

if (pnUserLoggedIn()) {
$content .= '
'._YOUARELOGGED.' ' .pnUserGetVar('uname') . '.
';
if (pnModAvailable('Messages')) {
// display private messages only when module is active
$column = &$pntable['priv_msgs_column'];
$result2 =& $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]=" . pnUserGetVar('uid'));
list($numrow) = $result2->fields;
// get unread messages
$result3 =& $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]=" . pnUserGetVar('uid') . " AND $column[read_msg]='0'");
list($unreadrow) = $result3->fields;

if ($numrow == 0) {
$content .= '
';
} else {
$content .= "
"._YOUHAVE." (<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Messages&file=index\" title=\""._PRIVATEMSGS."\">".pnVarPrepForDisplay($numrow)."|<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Messages&file=index\" title=\""._PRIVATEMSGNEW."\">".pnVarPrepForDisplay($unreadrow).") ";
if ($numrow==1) {
$content .= _PRIVATEMSG ;
}
elseif ($numrow>1) {
$content .= _PRIVATEMSGS ;
}
$content .= "
";
}
}
} else {
$content .= '
'._YOUAREANON.'
';
}
if (empty($row['title'])) {
$row['title'] = _WHOSONLINE;
}
$row['content'] = $content;
return themesideblock($row);
}
?>

si os dais cuenta es el que se da por defecto en Postnuke.

Bueno pues quiero ponerle los siguientes permisos:

Users | Tipo del Bloque:: | Nombre del Bloque:: | Ninguno
No Registrado | Tipo del Bloque:: | Nombre del Bloque:: | Leer

Pero no se que poner en tipo de bloque ni en nombre de bloque. Alguna respuesta???

PD: Puse uno muy parecido a este pero esque nadie me contestaba.





<
achica
avatar
Posteador de Oro
Posteador de Oro
Mensajes: 1049

Enviado:
17.ene 2005 - 16:21

[php]// Security
pnSecAddSchema('Onlineblock::', 'Block title::'); [/php]
El permiso para los No Registrados no te hace falta ya que estos lo pueden leer todo (así es como viene en postnuke). Para los demas te lo pone en esas dos lineas al principio del archivo, de todas formas siempre lo puedes mirar para cualquier otro contenido de tu web en el cuadro de permisos, click en Componente e Instancia , ahí puedes ver todos los permisos para tus módulos y bloques.

Grupo | Componente | Instancia | Permiso
Users | Onlineblock:: | Titulo_de_tu_bloque:: | Ninguno
Salu2.




Usa la búsqueda :: Lee las normas