COMENTARIO DE LA AUTORAMi segundo aporte a 4images y sus usuarios
Este ha sido un mod que siempre he querido y aun faltan algunos retoques que ire añadiendo a este topic. Espero que me podais ayudar a pincelarlo y si es necesario optimizarlo. Como soy un poco principiantes y no conozco muy en profundidad 4images quizas necesite ayuda a la hora de dar soporte. Asique se lo agradecere a todos quien aporten y ayuden a que el mod se perfeccione mas y mas.
DESCRIPCION DEL MODEste mod crea una lista de amigos que solo podra ser visualizada por el usuario. En cualquier momento se podra eliminar a un amigo de la lista o incluso eliminar la lista completa. Por el momento se podra añadir como amigo a un usuario desde los comentarios de este o desde su respectivo perfil. Este mod ha sido
testeado con las versiones 1.7 y 1.7.3 de 4imagesDEMO: http://www.myart.es user:test pass: test
[MOD]FriendsList_english_install.txt Attached DESCARGAR MODDentro del archivo comprimido encontraras la explicacion en
inglesARCHIVOS NUEVOS
- friendslist.php
- includes/user_paging.php
- templates/tus_plantillas/friendslist.html
- templates/tus_plantillas/friendslist_sort.html
- templates/tus_plantillas/images_tuidioma/
friendslist.html- templates/tus_plantillas/images_tuidioma/
friendslist.html- templates/tus_plantillas/images_tuidioma/
friendslist_sort.html
[/b]
ARCHIVOS A EDITAR- lang/ti_idioma/
main.php- includes/
page_header.php- includes/
functions.php-
details.php-
member.php- templates/tus_plantillas/
memberprofile.html- templates/tus_plantillas/
comment_bit.html- templates/tus_plantillas/
user_logininfo.htmlHAGA UNA COPIA DE SEGURIDAD DE SU BASE DE DATOS Y GUARDE TODOS LOS ARCHIVOS QUE VAYA A MODIFICAR EN UN SITIO A PARTEEjecuta en phpmyadmin en SQL de tu tabla donde tengas 4images las 2 siguientes sentencias
ALTER TABLE 4images_users ADD user_friend_ids text DEFAULT 'NULL' NULL;
ATENCION: Si ya tienes instalado memberlist no ejecutes la siguiente sentencia, porque ya esta creado user_t_images
ALTER TABLE 4images_users ADD user_t_images SMALLINT( 6 ) DEFAULT '0' NOT NULL;
Abrir main.phpBuscar:
?>
Añadir arriba:
//-----------------------------------------------------
//--- Friendslist -------------------------------------
//-----------------------------------------------------
$lang['lang_friendslist_title'] = "Lista de Amigos";
$lang['lang_friendslist_add'] = "Añade {user_name} a tu Lista de Amigos";
$lang['lang_friendslist_friend'] = "Amigo:";
$lang['lang_friendslist_page'] = "Pagina ";
$lang['lang_friendslist_pm'] = "PM:";
$lang['lang_total_user_images'] = "Imagenes:";
$lang['lang_total_user_comments'] = "Comentarios:";
$lang['paging_user_stats'] = "Encontrado: {total_cat_images} usuario/s en {total_pages} pagina/s. Mostrado: usuario {first_page} a {last_page}.";
$lang['lang_sort_homepage'] = "Web";
$lang['lang_sort_username'] = "Usuario";
$lang['lang_sort_useremail'] = "Email";
$lang['lang_sort_comments'] = "Comentarios";
$lang['lang_sort_pictures'] = "Imagenes";
$lang['lang_sort_joindate'] = "Fecha de Registro";
$lang['lang_sort_asc'] = "Acendente";
$lang['lang_sort_desc'] = "Descendente";
$lang['lang_select_sort_method'] = "Método ordenado";
$lang['lang_select_sort_order'] = "Orden";
$lang['lang_all'] = "Todo";
$lang['lang_sort_gender'] = "Sexo";
$lang['friendslist_no_images'] = "No tienes amigos almacenados. Para guardarlos haz clic en la imagen Amigo en los comentarios.";
$lang['friendslist_add_success'] = "Amigo guardado.";
$lang['friendslist_add_error'] = "¡Error agregando amigo a la lista!";
$lang['friendslist_remove_success'] = "Amigo eliminado.";
$lang['friendslist_remove_error'] = "¡Error borrando amigo!";
$lang['friendslist_register'] = "Para poder usar su listado de amigos, debe registrarse.<br />» <a href=\"{url_register}\">Registrarse ahora</a>";
$lang['friendslist_delete_success'] = "Lista de amigos eliminada.";
$lang['friendslist_delete_error'] = "¡Error eliminando lista de amigos!";
$lang['delete_friendslist'] = "Eliminar lista de amigos";
$lang['friendslist_lastaction'] = "Última actualización en su lista de amigos:";
$lang['delete_friendslist_confirm'] = "¿Esta seguro de eliminar su lista de amigos?";
Abrir includes/page_header.phpBuscar:
if ($action == "clearlightbox") {
if ($user_info['user_level'] >= USER) {
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
Insertar Debajo:
//-----------------------------------------------------
//--- Add & Delete from Friends Lists -----------------
//-----------------------------------------------------
if ($action == "addtofriendslist" && $id) {
if ($user_info['user_level'] >= USER) {
$msg = (add_to_friendslist($id)) ? $lang['friendslist_add_success'] : $lang['friendslist_add_error'];
}
else {
$msg = $lang['friendslist_register'];
}
}
if ($action == "removefromfriendslist" && $id) {
if ($user_info['user_level'] >= USER) {
$msg = (remove_from_friendslist($id)) ? $lang['friendslist_remove_success'] : $lang['friendslist_remove_error'];
}
else {
$msg = $lang['friendslist_register'];
}
}
if ($action == "clearfriendslist") {
if ($user_info['user_level'] >= USER) {
$msg = (clear_friendslist()) ? $lang['friendslist_delete_success'] : $lang['friendslist_delete_error'];
}
else {
$msg = $lang['friendslist_register'];
}
}
Buscar en el mismo archivo:
"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),
Añadir debajo:
"url_friendslist" => $site_sess->url(ROOT_PATH."friendslist.php"),
Buscar:
"lang_lightbox" => $lang['lightbox'],
Añadir debajo:
"lang_friendslist_title" => $lang['lang_friendslist_title'],
Abrir includes/functions.phpBuscar:
function check_lightbox($id) {
global $user_info;
$lightbox_array = explode(" ", $user_info['lightbox_image_ids']);
return in_array($id, $lightbox_array);
}
Añadir Debajo:
////////////////////////////
//BEGIN friendslist
function add_to_friendslist($id) {
global $user_info, $site_db;
$id = intval($id);
if (!$id) {
return false;
}
$friendslist_ids = $user_info['user_friend_ids'];
$friendslist_array = explode(" ", $friendslist_ids);
if (!in_array($id, $friendslist_array)) {
$friendslist_ids .= " ".$id;
}
$user_info['user_friend_ids'] = trim($friendslist_ids);
$sql = "UPDATE ".USERS_TABLE."
SET user_friend_ids = '".$user_info['user_friend_ids']."'
WHERE user_id = ".$user_info['user_id'];
return ($site_db->query($sql)) ? 1 : 0;
}
function remove_from_friendslist($id) {
global $user_info, $site_db;
$friendslist_array = explode(" ",$user_info['user_friend_ids']);
foreach ($friendslist_array as $key => $val) {
if ($val == $id) {
unset($friendslist_array[$key]);
}
}
$user_info['user_friend_ids'] = trim(implode(" ", $friendslist_array));
$sql = "UPDATE ".USERS_TABLE."
SET user_friend_ids = '".$user_info['user_friend_ids']."'
WHERE user_id = ".$user_info['user_id'];
return ($site_db->query($sql)) ? 1 : 0;
}
function clear_friendslist() {
global $user_info, $site_db;
$sql = "UPDATE ".USERS_TABLE."
SET user_friend_ids = ''
WHERE user_id = ".$user_info['user_id'];
if ($site_db->query($sql)) {
$user_info['user_friend_ids'] = "";
return true;
}
else {
return false;
}
}
function check_friendslist($id) {
global $user_info;
$friendslist_array = explode(" ", $user_info['user_friend_ids']);
return in_array($id, $friendslist_array);
}
/////////////////
//END FRIENDSLIST
/////////////////
Si quieres que los usuarios añadan a los amigos desde los comentarios:
Abrir details.php
Buscar:
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
Añadir debajo:
"friendslist_button" => $friendslist_button, //FRIENDSLIST MOD
Buscar:
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
Añadir Arriba:
//FRIENDS LIST MOD
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $comment_user_id)) {
$friendslist_url = $self_url;
$friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&" : "?")."mode=".$mode : "";
$friendslist_url .= strpos($friendslist_url, '?') !== false ? "&" : "?";
if (check_friendslist($comment_user_id)) {
$friendslist_url .= "action=removefromfriendslist&id=".$comment_user_id;
$friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$friendslist_url .= "action=addtofriendslist&id=".$comment_user_id;
$friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
}
}
else {
$friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
}
Abrir templates/tu_plantilla/comment_bit.htmlPuedes poner donde quieras la etiqueta {friendslist_button}
Si tambien quieres poder agregar a tu lista a usuarios desde sus respectivos perfiles
Abre member.phpBusca:
if (!empty($user_row['user_email']) && (!isset($user_row['user_showemail']) || (isset($user_row['user_showemail']) && $user_row['user_showemail'] == 1))) {
$user_email = $user_row['user_email'];
Insertar Arriba:
//-----------------------------------------------------
//--- BEGIN FRIENDSLIST MOD ---------------------------
//-----------------------------------------------------
//FRIENDS LIST MOD
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $user_row['user_id'])) {
$friendslist_url = $self_url;
$friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&" : "?")."mode=".$mode : "";
$friendslist_url .= strpos($friendslist_url, '?') !== false ? "&" : "?";
if (check_friendslist($user_row['user_id'])) {
$friendslist_url .= "action=removefromfriendslist&id=".$user_row['user_id']."";
$friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$friendslist_url .= "action=addtofriendslist&id=".$user_row['user_id']."";
$friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_no.gif")."\" border=\"0\" alt=\"\" /></a>";
}
}
else {
$friendslist_button = "<img src=\"".get_gallery_image("friendslist_off.gif")."\" border=\"0\" alt=\"\" />";
}
$site_template->register_vars("lang_friendslist_add", $lang['lang_friendslist_add']);
//--- END FRIENDSLIST MOD ---
Buscar:
"user_homepage" => $user_homepage,
Añadir Debajo:
"friendslist_button" => $friendslist_button, //Friend list mod
Abrir templates/tu_plantilla/member_profile.htmlPon donde quieras la etiqueta {friendslist_button}
Abrir templates/tus_plantillas/user_logininfo.htmlBuscar:
<a href="{url_lightbox}">{lang_lightbox}</a><br />
Añadir Debajo:
<a href="{url_friendslist}">{lang_friendslist_title}</a><br />
Crear un nuevo archivo llamado templates/tus_plantillas/
friendslist.html con el diseño de tu galeria (ejemplo error.html cambia el nombre y pon en el contenido lo siguiente). Y añadir en la parte del contenido de tu web:
<p> <b><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</b></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="title">{lang_friendslist_title}</span></td>
<td align="right">
<script language="JavaScript">
function clearfriendslist() {
if (confirm('{lang_delete_friendslist_confirm}')) {
location.href = "{url_delete_friendslist}";
}
}
</script>
<a href="javascript:clearfriendslist()"><b>{lang_delete_friendslist}</b></a>
</td>
</tr>
<br />
<hr size="1" /><div align="right"><form method="post" action="{filter_url}">
Buscar Usuario: <input name="filter" value="{filter}" class="searchinput"> <input type="submit" name="submit" value="{lang_go}" class="button" /><br>
<span class="smalltext">Puedes usar * como comodín cuando no estés seguro.</span>
</form></div>
{paging_stats}
{if friendslist}
<table width="450" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="row2" valign="top">{friendslist}</td>
</tr>
</table>
</td>
</tr>
</table>
{endif friendslist}
<br />
<br />
{paging}
<br /><div align="center"> Mod Friends List created by <a hreft="http://www.myart.es" target="_blank">CCSakuweb</a></div><br>
Crea un archivo templates/tu_plantilla/
friendslist_sort.html<form method="post" action="{mode_action}">
<table width="100%" cellspacing="0" cellpadding="1" border="0" align="center">
<tr>
<td align="right" class="head2" nowrap="nowrap">{lang_select_sort_method}: {select_sort_method} {lang_select_sort_order} {select_sort_order_form}
<input type="submit" name="submit" value="{lang_go}" class="button" />
</td>
</tr>
</table>
</form>
Crea un archivo llamado
friendslist.php y subelo a la raiz de tu galeria (donde esta config.php)
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: friendslist.php (MOD) *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 2.0 for 4images 1.7 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
//--------------------------------------------------------
//-- USER FRIENDS LIST by CCSAKUWEB : http://www.myart.es
//--------------------------------------------------------
$templates_used = 'friendslist,friendslist_sort';
$main_template = 'friendslist';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
//----------------------------
//---- Set user per page -----
//----------------------------
$user_per_page = 20; //Modificalo para cambiar el numero de usuarios mostrados por pagina
//-----------------------------------------------------------
//---- Uncomment to show friendslist only to registered users
//-----------------------------------------------------------
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {
show_error_page($lang['no_permission']);
exit;
}
//--------------------------------
// DON'T CHANGE ANYTHING FROM HERE
//--------------------------------
//FRIENDS LIST
//----------------------------
//---- Sort ------------------
//----------------------------
if(isset($HTTP_POST_VARS['order']))
{
$sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
}
else if(isset($HTTP_GET_VARS['order']))
{
$sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
}
else
{
$sort_order = 'ASC';
}
$mode_types_text = array($lang['lang_sort_username'], $lang['lang_sort_joindate'], $lang['lang_sort_useremail'], $lang['lang_sort_homepage'], $lang['lang_sort_comments'], $lang['lang_sort_pictures']);
$mode_types = array('user_name', 'user_joindate', 'user_email', 'user_homepage', 'user_comments', 'user_t_images');
$select_sort_mode = '<select class="select" name="mode">';
for($i = 0; $i < count($mode_types_text); $i++)
{
$selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
}
$select_sort_mode .= '</select>';
$select_sort_order = '<select class="select" name="order">';
if($sort_order == 'ASC')
{
$select_sort_order .= '<option value="ASC" selected="selected">' . $lang['lang_sort_asc'] . '</option><option value="DESC">' . $lang['lang_sort_desc'] . '</option>';
}
else
{
$select_sort_order .= '<option value="ASC">' . $lang['lang_sort_asc'] . '</option><option value="DESC" selected="selected">' . $lang['lang_sort_desc'] . '</option>';
}
$select_sort_order .= '</select>';
$site_template->register_vars(array(
'lang_select_sort_method' => $lang['lang_select_sort_method'],
'lang_select_sort_order' => $lang['lang_select_sort_order'],
'select_sort_method' => $select_sort_mode,
'select_sort_order_form' => $select_sort_order,
'mode_action' => $site_sess->url(ROOT_PATH."friendslist.php".(($user_search) ? "?$user_search" : "")))
);
$userlist = $site_template->parse_template(friendslist_sort);
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
switch( $mode )
{
case 'user_joindate':
$order_by = "user_joindate $sort_order";
break;
case 'user_name':
$order_by = "user_name $sort_order";
break;
case 'user_email':
$order_by = "user_email $sort_order";
break;
case 'user_homepage':
$order_by = "user_homepage $sort_order";
break;
case 'user_comments':
$order_by = "user_comments $sort_order";
break;
case 'user_t_images':
$order_by = "user_t_images $sort_order";
break;
default:
$order_by = "user_name $sort_order";
break;
}
}
else
{
$order_by = "user_name $sort_order";
}
//--------------------------------------------
//--------------------------------------------
//--------------------------------
//------ User Search -------------
//--------------------------------
$filter = "";
if ((isset($HTTP_GET_VARS['search']) && $HTTP_GET_VARS['search']) || (isset($HTTP_POST_VARS['search']) && $HTTP_POST_VARS['search']))
{
$filter = $site_sess->get_session_var("friendslistfilter");
}
else
{
$site_sess->drop_session_var("friendslistfilter");
}
if (isset($HTTP_GET_VARS['filter']) || isset($HTTP_POST_VARS['filter']))
{
$filter = (isset($HTTP_POST_VARS['filter'])) ? $HTTP_POST_VARS['filter'] : $HTTP_GET_VARS['filter'];
}
if ($filter)
{
$filter_db = str_replace("*", "%", str_replace("**", "*", $filter));
if ($filter_db && $filter_db != "%")
{
$condition = " AND ".get_user_table_field("", "user_name")." LIKE '".addslashes($filter_db)."'";
$ltr = "";
$user_search = "search=1";
$site_sess->set_session_var("friendslistfilter", $filter);
}
}
$site_template->register_vars(array(
"filter" => $filter,
"filter_url" => $site_sess->url(ROOT_PATH."friendslist.php"),
"lang_filter" => $lang['search']
));
//--------------------------------
//------ End User Search ---------
//--------------------------------
$user_id = $user_info['user_id'];
$user_row = get_user_info($user_id);
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE user_id = $user_id";
$user_friends_info = $site_db->query_firstrow($sql);
$num_rows_all = 0;
if (!empty($user_friends_info['user_friend_ids'])) {
$friends_id_sql = str_replace(" ", ",", trim($user_friends_info['user_friend_ids']));
}else{
$friends_id_sql=0;
}
$sql = "SELECT COUNT(user_id) AS total_friends
FROM ".USERS_TABLE."
WHERE user_id IN ($friends_id_sql)";
$result = $site_db->query_firstrow($sql);
$user_total_friends = $result['total_friends'];
$num_rows_all = (isset($user_total_friends)) ? $user_total_friends : 0;
$site_template->register_vars("user_total_friends", $num_rows_all);
unset($user_total_friends);
$site_db->free_result();
$link_arg = $site_sess->url(ROOT_PATH."friendslist.php?mode=$mode&order=$sort_order".(($user_search) ? "&$user_search" : ""));
include(ROOT_PATH.'includes/user_paging.php');
$getpaging = new Paging($page, $user_per_page, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE user_id IN ($friends_id_sql)
ORDER BY $order_by
LIMIT $offset, $user_per_page";
$result = $site_db->query($sql);
$userlist .="\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tr>\n<td class=\"bordercolor\">\n";
$userlist .="<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">\n";
$userlist .="<tr>\n<td class=\"head2\" align=\"center\">".$lang['user_name']."</td>\n<td class=\"head2\" align=\"center\">".$lang['email']."</td>\n<td class=\"head2\" align=\"center\">".$lang['homepage']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_comments']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_total_user_images']."</td>\n<td class=\"head2\" align=\"center\">".$lang['lang_friendslist_friend']."</td>\n</tr>\n";
$count = 0;
$bgcolor = 0;
while ($user_row = $site_db->fetch_array($result)){
$user_id = "";
$user_name = "";
$user_join_date = "";
$user_email = "";
$user_email_save = "";
$user_mailform_link = "";
$friendslist_url="";
$friendslist_button="";
$user_email_button = "";
$total_user_images = "";
$total_user_comments = "";
$user_id = $user_row['user_id'];
// --------------------------
// COUNT users pics
// --------------------------
$sql = "SELECT COUNT(image_id) AS t_images
FROM ".IMAGES_TABLE."
WHERE user_id = $user_id";
$count_t_images = $site_db->query_firstrow($sql);
// --------------------------
// UPDATE user_t_images field
// --------------------------
$sql = "UPDATE ".USERS_TABLE."
SET user_t_images = ".$count_t_images['t_images']."
WHERE user_id = $user_id";
// --------------------------
$site_db->query($sql);
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $user_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_row['user_id'];
$user_name = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($user_row['user_name'])."</a>";
$user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;
if (!empty($user_homepage) && $user_homepage != REPLACE_EMPTY) {
$user_homepage_button = "<a href=\"".$user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$user_homepage."\" /></a>";
}
else {
$user_homepage_button = REPLACE_EMPTY;
}
$friendslist_url = $self_url;
$friendslist_url .= (!empty($mode)) ? ((strpos($friendslist_url, '?') !== false) ? "&" : "?")."mode=".$mode : "";
$friendslist_url .= strpos($friendslist_url, '?') !== false ? "&" : "?";
$friendslist_url .= "action=removefromfriendslist&id=".$user_id;
$friendslist_button = "<a href=\"".$site_sess->url($friendslist_url)."\"><img src=\"".get_gallery_image("friendslist_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
if (!empty($user_row['user_email']) && (!isset($user_row['user_showemail']) || (isset($user_row['user_showemail']) && $user_row['user_showemail'] == 1))) {
$user_email = $user_row['user_email'];
$user_email_save = str_replace("@", " at ", $user_row['user_email']);
if (!empty($url_mailform)) {
$user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $user_row['user_id'], $url_mailform));
}
else {
$user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&".URL_USER_ID."=".$user_row['user_id']);
}
$user_email_button = "<a href=\"".$user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$user_email_save."\" /></a>";
}
$user_join_date = (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY;
$total_user_comments = $user_row['user_comments'];
$total_user_images = $user_row['user_t_images'];
if ($total_user_images > 0) {
$total_images_link = $site_sess->url(ROOT_PATH."search.php?search_user=".$user_row['user_name']);
$total_user_images_link = "<a href=\"".$total_images_link."\">".$total_user_images."</a>";
} else {
$total_user_images_link = $total_user_images;
}
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$userlist .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$userlist .= "<td valign=\"center\" align=\"left\">".$session_ip." ".$user_name."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$user_email_button."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$user_homepage_button."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$total_user_comments."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$total_user_images_link."</td>\n";
$userlist .= "<td valign=\"center\" align=\"center\">".$friendslist_button."</td>";
$userlist .= "\n</tr>\n";
}
$userlist .= "</table>\n";
$userlist .= "</td>\n</tr>\n</table>\n";
$site_template->register_vars("friendslist", $userlist);
unset($userlist);
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
$clickstream .= $lang['lang_friendslist_title'];
$clickstream .= $config['category_separator'].$lang['lang_friendslist_page'].$page."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream,
"lang_friendslist_title" => $lang['lang_friendslist_title'],
"lang_friendslist" => $lang['friendslist'],
"lang_delete_friendslist" => $lang['delete_friendslist'],
"url_delete_friendslist" => $site_sess->url(ROOT_PATH."friendslist.php?action=clearfriendslist"),
"lang_delete_friendslist_confirm" => $lang['delete_friendslist_confirm'],
"lang_friendslist_lastaction" => $lang['lighbox_lastaction'],
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
Nuevo archivo:
includes/user_paging.php<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: user_paging.php (MOD) *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 2.0 for 4images 1.7 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
class Paging {
var $page,$offset,$user_per_page,$num_rows_all,$link_args;
var $first,$last,$total_pages,$config,$desc,$next,$back;
function Paging($page = 1, $user_per_page = 0, $num_rows_all = 0, $link_args = "") {
global $lang, $config;
$this->page = $page;
$this->perpage = $user_per_page;
$this->num_rows_all = $num_rows_all;
if (!isset($this->page) || !intval($this->page)) {
$this->page = 1;
}
if (!$this->num_rows_all) {
$this->total_pages = 0;
}
elseif ($this->num_rows_all <= $this->perpage) {
$this->total_pages = 1;
}
elseif ($this->num_rows_all % $this->perpage == 0) {
$this->total_pages = $this->num_rows_all / $this->perpage;
}
else {
$this->total_pages = ceil($this->num_rows_all / $this->perpage);
}
if ($this->page > $this->total_pages) {
$this->page = 1;
}
if (!$this->num_rows_all) {
$this->first = 0;
}
else {
$this->first = $this->perpage * $this->page - $this->perpage + 1;
}
if (!$this->num_rows_all) {
$this->last = 0;
}
elseif ($this->page == $this->total_pages) {
$this->last = $this->num_rows_all;
}
else {
$this->last = $this->perpage * $this->page;
}
$this->offset = $this->perpage * $this->page - $this->perpage;
$link_args = ereg_replace("&page=[0-9]*", "", $link_args);
$link_args = ereg_replace("page=[0-9]*&", "", $link_args);
$this->link_args = basename($link_args);
$this->link_args .= preg_match("/\?/",$this->link_args) ? "&" : "?";
$this->desc = $lang['paging_user_stats'];
$this->paging_next = $lang['paging_next'];
$this->paging_back = $lang['paging_previous'];
$this->paging_lastpage = $lang['paging_lastpage'];
$this->paging_firstpage = $lang['paging_firstpage'];
$this->range = $config['paging_range'];
}
function get_paging() {
$html = "";
if ($this->total_pages > 1) {
$page_back = $this->page - 1;
$page_next = $this->page + 1;
if ($page_back > 0) {
$html .= "<a href=\"".$this->link_args."page=1\" class=\"paging\">".$this->paging_firstpage."</a> ";
$html .= "<a href=\"".$this->link_args."page=$page_back\" class=\"paging\">".$this->paging_back."</a> ";
}
for ($page_num = 1; $page_num <= $this->total_pages; $page_num++) {
if ($page_num >= ($this->page-$this->range) && $page_num <= ($this->page+$this->range)) {
if ($this->page == $page_num) {
$html .= "<b class=\"pagingon\">$page_num</b> ";
}
else {
$html .= "<a href=\"".$this->link_args."page=$page_num\" class=\"paging\">$page_num</a> ";
}
}
}
if ($page_next <= $this->total_pages) {
$html .= "<a href=\"".$this->link_args."page=$page_next\" class=\"paging\">".$this->paging_next."</a> ";
$html .= "<a href=\"".$this->link_args."page=$this->total_pages\" class=\"paging\">".$this->paging_lastpage."</a>";
}
}
return $html;
}
function get_offset() {
return $this->offset;
}
function get_paging_stats() {
global $site_template;
$search_array = array(
"/".$site_template->start."total_cat_images".$site_template->end."/iU",
"/".$site_template->start."total_pages".$site_template->end."/iU",
"/".$site_template->start."first_page".$site_template->end."/iU",
"/".$site_template->start."last_page".$site_template->end."/iU"
);
$replace_array = array(
$this->num_rows_all,
$this->total_pages,
$this->first,
$this->last
);
$this->desc = preg_replace($search_array, $replace_array, $this->desc);
return $this->desc;
}
} //end of class
?>
Y por el momento ya esta ^^ En mi web trabaja a la perfeccion. Si haceis alguna modificacion para mejorarlo estaria encantada de que lo postearais mas abajo . Aprovecho para dar las gracias a todos aquellos que me han ayudado con 4images, gracias a ellos he seguido adelante con mi web en 4images. Tambien animo a todos los usuarios a que empiecen a hacer sus modificaciones para aprender mas y mas y por supuesto compartirlas XD
Disfrutar del MOD!