4images Forum & Community
International => Español / Castellano => Topic started by: Induma on August 14, 2005, 12:49:55 AM
-
he conseguido este mod navegando por los foros, lo he instalado y todo correcto menos una cosilla, no muestra el enlace para la descarga via mms (movil)
os dejo el mod, por si podeis ayudarme
==========================================
Well a new tecnologie is born. MMS! I think you can get more users on your gallery if you have a mms service on it.
Overview:
You can recieve all images on your mms mobilphone.
Changed files:
- includes/functions.php
- includes/constants.php
- templates/<dein Template>/details.html
- lang/<deine Sprache>/main.php
New files:
- mms.php
- getmms.php
- templates/<dein Template>/mms.html
- templates/<dein Template>/images/mms.gif
Installation
Important: Backup all files
1.)
Open includes/functions.php find:
Code:
else {
$user_name = $lang['userlevel_guest'];
$user_name_link = $user_name;
}
add after:
Code:
$mms = '<a href="javascript:mms(\''.$site_sess->url(ROOT_PATH."mms.php?id=".$image_row['image_id']."").'\')"><img border="0" src="'.get_gallery_image("mms.gif").'"></a>';
suche nach:
Code:
"image_file_name" => $image_row['image_media_file'],
füge dahinter ein:
Code:
"mms" => $mms,
2.)
open includes/constants.php
find:
Code:
// If 4images has problems to find out the right URL, define it here.
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
replace with:
Code:
// If 4images has problems to find out the right URL, define it here.
define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
Don't foget 2 edit the line. Your must set your domain!!!
3.)
open templates/<dein Template>/details.html
find:
Code:
{header}
add after
Code:
<script language="javascript">
function mms(url) {
var winWidth = 500;
var winHeight = 350;
var w = (screen.width - winWidth)/2;
var h = (screen.height - winHeight)/2 - 60;
var name = 'MMS';
var features = 'scrollbars=no,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
window.open(url,name,features);
}
</script>
You can use the {mms} tag in your details template in order to let users recieve mms.
4.)
open lang/<deine Sprache>/main.php
add:
Code:
//-----------------------------------------------------
//--- Send MMS ----------------------------------------
//-----------------------------------------------------
$lang['mmsheadline'] = "Recieve image over mms";
$lang['imagewidth'] = "Width:";
$lang['imageheight'] = "Height:";
$lang['download'] = "Downlaod";
$lang['id'] = "ID:";
$lang['mmstext'] = "<b>This picture on your mobile</b><br>
<ul>
<li> Choose in the Services-menu 'Go to address'<li> Put the following in the gap:<br> <B>
{url_mms_id}</B><li> Then you see this:<BR> ID: <b>{mms_id}</b><br><b>Ok, Download</b><li> Choose 'Ok, download'<li> The picture will be loaded. Please be patient.<li> After the download you see the following:<br> <b>File recieved</b><br>Options - back<li> Choose <br> <b>Options > Save</b><li> Rename the picture and choose a folder.<li> <b>Now is the picture on your mobile :-)</b>
</ul>";
5.)
create mms.php add the following code:
Code:
<?php
define('ROOT_PATH', './');
$main_template = 'mms';
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
$sql = "SELECT image_id, cat_id, image_thumb_file, image_media_file FROM ".IMAGES_TABLE."
WHERE image_id = ".$id."";
$image_row = $site_db->query_firstrow($sql);
$file_size = "n/a";
if ($file_size = @filesize("data/thumbnails/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
$file_size = format_file_size($file_size);
}
$size = @getimagesize("data/thumbnails/".$image_row['cat_id']."/".$image_row['image_thumb_file']."");
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $mode, $show_link),
"file_size" => $lang['file_size']." ".$file_size,
"width" => $lang['imagewidth']." ".$size[0]." ".$lang['px'],
"height" => $lang['imageheight']." ".$size[1]." ".$lang['px'],
"mmsheadline" => $lang['mmsheadline'],
"text" => $lang['mmstext'],
"mms_id" => $id,
"url_mms_id" => "".SCRIPT_URL."/getmms.php?id=".$id.""
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
6.)
create getmms.php add the following code:
Code:
<?php
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
if (!$id) {
echo $lang['error'];
exit;
}
$sql = "SELECT image_id, cat_id, image_thumb_file, image_media_file FROM ".IMAGES_TABLE."
WHERE image_id = ".$id."";
$image_row = $site_db->query_firstrow($sql);
echo $lang['id']." ".$id;
echo "
<br>
<a href=\"".SCRIPT_URL."/data/thumbnails/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\">".$lang['download']."</a>";
?>
7.)
create templates/<dein Template>/mms.html
you can use the following tags:
- {mmsheadline} to show the headline
- {text} to show the helptext
- {thumbnail} to show the image
- {width} to show the width
- {height} to show the height
- {file_size} to show the file size
Possible example of the template:Code:
<html>
<head>
<title>{site_name}</title>
<link rel="stylesheet" href="{template_url}/style.css">
</head>
<body bgcolor="#001B8B" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF">
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="head1" height="19">{mmsheadline}</td>
</tr>
<tr>
<td class="head1">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="row2">{text}</td>
</tr>
</table>
</td>
<td class="head1">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="row2" align="center">{thumbnail}<p>{file_size}<p>{widh}<p>{height}</td>
</tr>
</table>
</body>
</html>
create a new button templates/<dein Template>/images/mms.gif
Done!
Some information about the mod:
The thumbnails must be max. 128x128 px and the file size shouldn't be heigher than von 18 kb..
-
Saludos,,,
Has realizado alguna modificación en el MOD a la hora de instalarlo?
Si no has modificado nada,, repasa todo nuevamente, porque tendrás algún error de copia,, yo lo tengo instalado y funciona perfectamente,,, aunque se de otros usuarios que también tenían el mismo problema,, y estubimos haciendo algunas modificaciones,, pero no recuerdo si se solucionaron con dichas modificaciones,,, si alguno de ellos lee este post que contesten ellos y pongan las modificaciones si con ellas se resolvió el problema.
excitex2
-
gracias por contestar
pues solo he modificado lo que pide el mod, del resto no he tocado nada, salvo la traduccion del texto que sale en el pop-up.
a ver si alguien puede hechar una mano, que me gustaria tenerlo funcionando en mis galerias.
yo creo que el fallo esta en el main.php, en esta parte:
<li> En el menú de servicios elige :'ir a una dirección '<li> Escribe la siguiente dirección :<br> <B>
[color=Red]{url_mms_id}[/color]</B><li> Entonces verás en la pantalla de tu movil lo siguiente:<BR> ID: <b>[color=Red]{mms_id}[/color]</b><br><b>Ok, Descargar</b><li> Elige 'Ok, descargar'<li> La imagen será cargada. Tardará un poquito.<li> Una vez descargada la imagen verás lo siguiente:<br> <b>Archivo Recibido</b><br>Opciones - Atrás <li> Elige <br> <b>Opciones > Guardar </b><li> Renombra la imagen y ponla en un directorio.<li> <b>Ahora tienes la imagen en tu movil :-)</b>
</ul>";
lo teneis igual??
os funciona asi??
un saludo
INDUMA
-
Saludos,,,
En principio e mail.php no tendría porque dar ese tipo de problemas.
Has realizao el punto 2 ????
2.)
open includes/constants.php
find:
Code:
// If 4images has problems to find out the right URL, define it here.
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
replace with:
Code:
// If 4images has problems to find out the right URL, define it here.
define('SCRIPT_URL', 'http://www.yourdomain.com/tu_galería'); //no trailing slash
Las líneas del main.php que tu has puesto,,,yo las tengo casi igual :
<li> En el menú de servicios elige :<b>'<font color=\"#FF0000\"> ir a una dirección </font> '</b><li> Escribe la siguiente dirección :<br> <B>
<font color=\"#FF0000\"> {url_mms_id} </font></B><li> Entonces verás en la pantalla de tu movil lo siguiente:<BR><font color=\"#FFFF00\"> ID: <b>{mms_id}</b><br><b>Ok, Descargar </font></b><li> Elige <b>'<font color=\"#FF0000\"> Ok, Descargar</font> '</b><li> La imagen será cargada. Tardará un poquito.<li> Una vez descargada la imagen verás lo siguiente:<br>
<b><font color=\"#FFFF00\"> Archivo Recibido<br>Opciones - Atrás </b></font><li> Elige <br> <b><font color=\"#FF0000\"> Opciones > Guardar </font></b><li> Renombra la imagen y ponla en un directorio.<li> <b>Ahora tienes la imagen en tu movil </b> </ul>";
excitex2
-
he vuelto a revisar todo el codigo de nuevo y esta todo correcto, como viene en las instrucciones
es posible que el problema lo pueda ocasionar que el host sea windows y no linux??
gracias por el tiempo dedicado y por responder
un saludo
INDUMA
-
Saludos,,,
Pero has vrificado el punto 2 :
2.)
open includes/constants.php
find:
Code:
// If 4images has problems to find out the right URL, define it here.
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
replace with:
Code:
// If 4images has problems to find out the right URL, define it here.
define('SCRIPT_URL', 'http://www.yourdomain.com/tu_galería '); //no trailing slash
Fijate que delante de define('SCRIPT_URL'........ en la modificación no lleva la dos barra // (slash) para activar la línea de comandos
excitex2
-
si, lo he realizado
te dejo la direccion de la web, necesitas registrarte, pero ahora mismo abro la categoria de humor grafico para que entre todo el mundo
esta es la dieccion:
http://induma.servepics.com/4images/index.php
la seccion abierta es esta humor grafico:
http://induma.servepics.com/4images/categories.php?cat_id=255
tambien he probado en un servidor linux y tampoco me funciona
de nuevo gracias
-
Saludos,,,
Pués la verdad que lo he revisado tres veces y no veo nada anormal,, seguro que está delante de las narices,,,,
Haz esta modificación :
En el código que has insertado en lang/tu_idioma/main.php localiza :
ID: <b>[ color=Red]{mms_id}[/color]</b>
Cambia a :
<font color=\"#FFFF00\"> ID: <b>{mms_id}</b>
excitex2
-
lo he cambiado y sigue igual, incluso he puesto el tuyo, que has puesto arriba y nada
de donde saca los valores {url_mms_id} y {mms_id} ?
a lo mejor es de ahi el fallo, ya que no los muestra nunca
-
revisando el post me he fijado en este trozo
Open includes/functions.php find:
suche nach:
Code:
"image_file_name" => $image_row['image_media_file'],
füge dahinter ein:
Code:
"mms" => $mms,
esto como va exactamente, por que me ha creado la duda, mi functions.php es este:
[code]
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: functions.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.1 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
function get_gallery_image($image_name) {
global $config;
if (file_exists(TEMPLATE_PATH."/images_".$config['language_dir']."/".$image_name)) {
return TEMPLATE_PATH."/images_".$config['language_dir']."/".$image_name;
}
else {
return TEMPLATE_PATH."/images/".$image_name;
}
}
function is_remote($file_name) {
return strpos($file_name, '://') > 0 ? 1 : 0;
}
function is_remote_file($file_name) {
return is_remote($file_name) && preg_match("#\.[a-zA-Z0-9]{1,4}$#", $file_name) ? 1 : 0;
}
function is_local_file($file_name) {
return !is_remote($file_name) && strpos($file_name, '/') !== false && preg_match("#\.[a-zA-Z0-9]{1,4}$#", $file_name) ? 1 : 0;
}
function check_remote_media($remote_media_file) {
global $config;
return is_remote($remote_media_file) && preg_match("#\.[".$config['allowed_mediatypes_match']."]+$#i", $remote_media_file) ? 1 : 0;
}
function check_local_media($local_media_file) {
global $config;
return !is_remote($local_media_file) && strpos($local_media_file, '/') !== false && preg_match("#\.[".$config['allowed_mediatypes_match']."]+$#i", $local_media_file) ? 1 : 0;
}
function check_remote_thumb($remote_thumb_file) {
return is_remote($remote_thumb_file) && preg_match("#\.[gif|jpg|jpeg|png]+$#is", $remote_thumb_file) ? 1 : 0;
}
function check_local_thumb($remote_thumb_file) {
return !is_remote($local_thumb_file) && strpos($local_thumb_file, '/') !== false && preg_match("#\.[gif|jpg|jpeg|png]+$#i", $local_thumb_file) ? 1 : 0;
}
function get_file_extension($file_name) {
ereg("(.+)\.(.+)", basename($file_name), $regs);
return strtolower($regs[2]);
}
function get_file_name($file_name) {
ereg("(.+)\.(.+)", basename($file_name), $regs);
return $regs[1];
}
function check_media_type($file_name) {
global $config;
return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
function check_thumb_type($file_name) {
return (preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? 1 : 0;
}
function check_executable($file_name) {
if (substr(PHP_OS, 0, 3) == "WIN" && !eregi("\.exe$", $file_name)) {
$file_name .= ".exe";
}
elseif (substr(PHP_OS, 0, 3) != "WIN") {
$file_name = eregi_replace("\.exe$", "", $file_name);
}
return $file_name;
}
function get_file_path($file_name = "", $image_type = "media", $cat_id = 0, $in_admin = 0, $return_icon = 1, $check_remote = CHECK_REMOTE_FILES) {
$return_code = ($return_icon) ? ICON_PATH."/404.gif" : 0;
if (empty($file_name)) {
return $return_code;
}
if (is_remote($file_name)) {
$check_handle = "check_remote_".$image_type;
return ($check_handle($file_name) && remote_file_exists($file_name, $check_remote)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
}
elseif (is_local_file($file_name)) {
$check_handle = "check_local_".$image_type;
$file_name = ($in_admin && preg_match("/^([\.]+|[^\/])/", $file_name)) ? "../".$file_name : $file_name;
if (!file_exists($file_name)) {
$file_path = preg_replace("/\/{2,}/", "/", get_document_root()."/".$file_name);
return ($check_handle($file_name) && file_exists($file_path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
}
else {
return $file_name;
}
}
else {
$check_handle = "check_".$image_type."_type";
$path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
}
}
function safe_htmlspecialchars($chars) {
// Translate all non-unicode entities
$chars = preg_replace('/&(?!#[0-9]+;)/si', '&', $chars);
$chars = str_replace(">", ">", $chars);
$chars = str_replace("<", "<", $chars);
$chars = str_replace("\"", """, $chars);
return $chars;
}
function un_htmlspecialchars($chars) {
//$chars = preg_replace("/(&#)([0-9]*)(;)/esiU", "chr(intval('\\2'))", $chars);
$chars = str_replace(">", ">", $chars);
$chars = str_replace("<", "<", $chars);
$chars = str_replace(""", "\"", $chars);
$chars = str_replace("&", "&", $chars);
return $chars;
}
function get_iptc_info($info) {
$iptc_match = array();
$iptc_match['2#120'] = "caption";
$iptc_match['2#122'] = "caption_writer";
$iptc_match['2#105'] = "headline";
$iptc_match['2#040'] = "special_instructions";
$iptc_match['2#080'] = "byline";
$iptc_match['2#085'] = "byline_title";
$iptc_match['2#110'] = "credit";
$iptc_match['2#115'] = "source";
$iptc_match['2#005'] = "object_name";
$iptc_match['2#055'] = "date_created";
$iptc_match['2#090'] = "city";
$iptc_match['2#095'] = "state";
$iptc_match['2#101'] = "country";
$iptc_match['2#103'] = "original_transmission_reference";
$iptc_match['2#015'] = "category";
$iptc_match['2#020'] = "supplemental_category";
$iptc_match['2#025'] = "keyword";
$iptc_match['2#116'] = "copyright_notice";
$iptc = iptcparse($info);
$iptc_array = array();
if (is_array($iptc)) {
foreach ($iptc as $key => $val) {
if (isset($iptc_match[$key])) {
$iptc_info = "";
foreach ($val as $val2) {
$iptc_info .= (($iptc_info != "" ) ? ", " : "").$val2;
}
if ($key == "2#055") {
$iptc_array[$iptc_match[$key]] = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\3.\\2.\\1", $iptc_info);
}
else {
$iptc_array[$iptc_match[$key]] = replace_url($iptc_info);
}
}
}
}
return $iptc_array;
}
function show_image($image_row, $mode = "", $show_link = 1, $detailed_view = 0) {
global $self_url, $site_template, $site_sess, $user_info, $config, $cat_cache, $lang, $additional_image_fields, $user_table_fields, $url_show_profile;
$is_new = ($image_row['image_date'] >= (time() - 60 * 60 * 24 * $config['new_cutoff'])) ? 1 : 0;
$description = (!empty($image_row['image_description'])) ? format_text($image_row['image_description'], 1) : REPLACE_EMPTY;
if (!empty($image_row['image_keywords'])) {
$split_keywords = explode(" ", $image_row['image_keywords']);
$keywords = "";
foreach ($split_keywords as $key => $val) {
$keywords .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".urlencode($val))."\">$val</a>";
}
}
else {
$keywords = REPLACE_EMPTY;
}
if (!check_permission("auth_readcomment", $image_row['cat_id'])) {
$image_row['image_allow_comments'] = 0;
}
$num_comments = ($image_row['image_allow_comments'] == 1) ? $image_row['image_comments'] : "";
if ($user_info['user_level'] != GUEST) {
$lightbox_url = $self_url;
$lightbox_url .= (!empty($mode)) ? ((strpos($lightbox_url, '?') !== false) ? "&" : "?")."mode=".$mode : "";
$lightbox_url .= strpos($lightbox_url, '?') !== false ? "&" : "?";
if (check_lightbox($image_row['image_id'])) {
$lightbox_url .= "action=removefromlightbox&id=".$image_row['image_id'];
$lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$lightbox_url .= "action=addtolightbox&id=".$image_row['image_id'];
$lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";
}
}
else {
$lightbox_button = "<img src=\"".get_gallery_image("lightbox_off.gif")."\" border=\"0\" alt=\"\" />";
}
if (!check_permission("auth_download", $image_row['cat_id'])) {
$download_button = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$download_zip_button = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
$allow_download = 0;
}
else {
$target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url'])) ? "target=\"_blank\"" : "";
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
$download_zip_button = ($target == "" && function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
$allow_download = 1;
}
if (!check_permission("auth_sendpostcard", $image_row['cat_id'])) {
$postcard_button = "<img src=\"".get_gallery_image("postcard_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$postcard_button = "<a href=\"".$site_sess->url(ROOT_PATH."postcards.php?".URL_IMAGE_ID."=".$image_row['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".get_gallery_image("postcard.gif")."\" border=\"0\" alt=\"\" /></a>";
}
if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
$show_link = 0;
}
$file_size = "n/a";
if (!is_remote($image_row['image_media_file'])) {
if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
$file_size = format_file_size($file_size);
}
}
elseif ($detailed_view) {
$file_size = get_remote_file_size($image_row['image_media_file']);
}
if (isset($image_row[$user_table_fields['user_name']]) && $image_row['user_id'] != GUEST) {
$user_name = $image_row[$user_table_fields['user_name']];
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $image_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$image_row['user_id'];
$user_name_link = "<a href=\"".$site_sess->url($user_profile_link)."\">".$user_name."</a>";
}
else {
$user_name = $lang['userlevel_guest'];
$user_name_link = $user_name;
}
$mms = '<a href="javascript:mms(\''.$site_sess->url(ROOT_PATH."mms.php?id=".$image_row['image_id']."").'\')"><img border="0" src="'.get_gallery_image("mms.gif").'"></a>';
$site_template->register_vars(array(
"image_id" => $image_row['image_id'],
"user_id" => $image_row['user_id'],
"user_name" => $user_name,
"user_name_link" => $user_name_link,
"image_name" => $image_row['image_name'],
"image_description" => $description,
"image_keywords" => $keywords,
"image_date" => format_date($config['date_format']." ".$config['time_format'],$image_row['image_date']),
"image_is_new" => $is_new,
"lang_new" => $lang['new'],
"image_active" => $image_row['image_active'],
"cat_id" => $image_row['cat_id'],
"cat_name" => $image_row['cat_name'],
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id']),
"image_downloads" => $image_row['image_downloads'],
"image_votes" => $image_row['image_votes'],
"image_rating" => $image_row['image_rating'],
"image_hits" => $image_row['image_hits'],
"allow_comments" => $image_row['image_allow_comments'],
"lang_comments" => $lang['comments'],
"image_comments" => $num_comments,
"lightbox_button" => $lightbox_button,
"postcard_button" => $postcard_button,
"download_button" => $download_button,
"download_zip_button" => $download_zip_button,
"image_download_url" => $image_row['image_download_url'],
"allow_download" => $allow_download,
"url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),
"image_file_size" => $file_size,
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link),
"thumbnail_openwindow" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, 1),
"image_file_name" => $image_row['image_media_file'],
"mms" => $mms,
"thumbnail_file_name" => $image_row['image_thumb_file']
));
if (!empty($additional_image_fields)) {
$additional_field_array = array();
foreach ($additional_image_fields as $key => $val) {
$additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
$rate_form = "";
if (check_permission("auth_vote", $image_row['cat_id'])) {
$site_template->register_vars("rate", $lang['rate']);
$rate_form = $site_template->parse_template("rate_form");
}
$site_template->register_vars("rate_form", $rate_form);
return true;
}
function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {
global $site_sess, $config;
if (!check_media_type($media_file_name)) {
$thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
}
else {
if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
$file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
$image_info = @getimagesize($dummy);
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
$thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
}
else {
$file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
$image_info = @getimagesize($file_src);
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
}
}
if ($show_link) {
if ($open_window) {
$thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
}
else {
$thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$thumb."</a>";
}
}
return $thumb;
}
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) {
global $site_template, $site_sess, $lang, $mode;
if (!get_file_path($media_file_name, "media", $cat_id, 0, 0)) {
$media = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
$site_template->register_vars("iptc_info", "");
}
else {
$media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);
$file_extension = get_file_extension($media_file_name);
$media_icon = "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"".$image_name."\" />";
if ($show_link) {
$media_icon = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$media_icon."</a>";
}
$width_height = "";
$width = "";
$height = "";
$iptc_info = "";
$src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src) : $media_src;
if ($image_info = @getimagesize($src, $info)) {
$width_height = " ".$image_info[3];
$width = $image_info[0];
$height = $image_info[1];
if ($detailed_view && isset($info['APP13'])) {
$iptc_array = get_iptc_info($info['APP13']);
$bgcounter = 0;
foreach ($iptc_array as $key => $val) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$site_template->register_vars(array(
"iptc_value" => $val,
"iptc_name" => $lang['iptc_'.$key],
"row_bg_number" => $row_bg_number
));
$iptc_info .= $site_template->parse_template("iptc_bit");
}
}
}
$site_template->register_vars(array(
"media_src" => $media_src,
"media_icon" => $media_icon,
"image_name" => $image_name,
"width_height" => $width_height,
"width" => $width,
"height" => $height,
"iptc_info" => $iptc_info
));
$media = $site_template->parse_template("media/".$file_extension);
}
return $media;
}
function get_random_image_cache() {
global $site_db, $cat_cache, $total_images;
$random_image_cache = array();
$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
if (SHOW_RANDOM_CAT_IMAGE) {
$sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
ORDER BY RAND()";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$random_image_cache[$row['cat_id']] = $row;
}
}
else {
if (empty($total_images)) {
$sql = "SELECT COUNT(*) as total_images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];
}
if (empty($total_images)) {
return $random_image_cache;
}
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
LIMIT $number, 1";
$random_image_cache[0] = $site_db->query_firstrow($sql);
}
return $random_image_cache;
}
function get_random_image($cat_id = 0, $show_link = 1, $return_file = 0) {
global $site_template, $random_image_cache;
if (!isset($random_image_cache)) {
$random_image_cache = get_random_image_cache();
}
if ($cat_id && SHOW_RANDOM_CAT_IMAGE) {
$template = 'random_cat_image';
$category_id = $cat_id;
}
else {
$template = 'random_image';
if (SHOW_RANDOM_CAT_IMAGE) {
srand((float)microtime() * 1000000);
$category_id = array_rand($random_image_cache);
}
else {
$category_id = 0;
}
}
if (!empty($random_image_cache[$category_id])) {
if (!$return_file) {
show_image($random_image_cache[$category_id], "", $show_link);
$random_image = $site_template->parse_template($template);
return $random_image;
}
else {
return get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $category_id, 0, 1);
}
}
}
function format_file_size($file_size = 0) {
$file_size = intval($file_size);
if (!$file_size) {
return "n/a";
}
if (strlen($file_size) <= 9 && strlen($file_size) >= 7) {
$file_size = number_format($file_size / 1048576,1);
return $file_size." MB";
}
elseif (strlen($file_size) >= 10) {
$file_size = number_format($file_size / 1073741824,1);
return $file_size." GB";
}
else {
$file_size = number_format($file_size / 1024,1);
return $file_size." KB";
}
}
function get_remote_file_size($file_path) {
if (!CHECK_REMOTE_FILES) {
return 'n/a';
}
ob_start();
@readfile($file_path);
$file_data = ob_get_contents();
ob_end_clean();
return format_file_size(strlen($file_data));
}
function update_comment_count($image_id = 0, $user_id = 0) {
global $site_db, $user_table_fields;
if ($image_id) {
$sql = "SELECT COUNT(comment_id) AS comments
FROM ".COMMENTS_TABLE."
WHERE image_id = $image_id";
$countcomments = $site_db->query_firstrow($sql);
$sql = "UPDATE ".IMAGES_TABLE."
SET image_comments = ".$countcomments['comments']."
WHERE image_id = $image_id";
$site_db->query($sql);
}
if ($user_id != GUEST && $user_id && !empty($user_table_fields['user_comments'])) {
$sql = "SELECT COUNT(comment_id) AS comments
FROM ".COMMENTS_TABLE."
WHERE user_id = $user_id";
$countcomments = $site_db->query_firstrow($sql);
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_comments")." = ".$countcomments['comments']."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
$site_db->query($sql);
}
}
function update_image_rating($image_id, $rating) {
global $site_db;
$sql = "SELECT cat_id, image_votes, image_rating
FROM ".IMAGES_TABLE."
WHERE image_id = $image_id";
$image_row = $site_db->query_firstrow($sql);
if (check_permission("auth_vote", $image_row['cat_id'])) {
$old_votes = $image_row['image_votes'];
$old_rating = $image_row['image_rating'];
$new_rating = (($old_rating * $old_votes) + $rating) / ($old_votes + 1);
$new_rating = sprintf("%.2f", $new_rating);
$sql = "UPDATE ".IMAGES_TABLE."
SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
WHERE image_id = $image_id";
$site_db->query($sql);
}
}
function check_email($email) {
return (preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $email)) ? 1 : 0;
}
function format_date($format, $timestamp) {
global $user_info;
$timezone_offset = (defined("TIME_OFFSET")) ? TIME_OFFSET : 0;
return date($format, $timestamp + (3600 * $timezone_offset));
}
function format_url($url) {
if (!preg_match("/^http:\/\//i", $url)) {
$url = "http://".$url;
}
if (!preg_match("/^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+/i", $url)) {
$url = "";
}
return $url;
}
function replace_url($text) {
$text = " ".$text." ";
$url_search_array = array(
"#([^]_a-z0-9-=\"'\/])([a-z]+?)://([^, \(\)<>\n\r]+)#si",
"#([^]_a-z0-9-=\"'\/])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \(\)<>\n\r]*)?)#si"
);
$url_replace_array = array(
"\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>",
"\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>"
);
$text = preg_replace($url_search_array, $url_replace_array, $text);
if (strpos($text, "@")) {
$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text);
}
return trim($text);
}
function replace_badwords($text) {
global $config, $split_badwords;
if ($config['badword_list'] != "") {
if (!isset($split_badwords)) {
$badwords = trim($config['badword_list']);
$badwords = preg_replace("/[\n\r]/is", " ", $badwords);
$badwords = str_replace(","," ",$badwords);
$badwords = preg_quote($badwords);
$badwords = str_replace('/', '\\/', $badwords);
$split_badwords = preg_split("/\s+/", $badwords);
}
foreach ($split_badwords as $key => $val) {
if ($val != "") {
if (substr($val, 0, 2) == "\\{") {
$val = substr($val, 2, -2);
$text = trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si", "\\1".str_repeat($config['badword_replace_char'], strlen($val)), " $text "));
}
else {
$text = trim(preg_replace("/$val/si", str_repeat($config['badword_replace_char'], strlen($val)), " $text "));
}
}
}
}
return $text;
}
function format_text($text, $html = 0, $word_wrap = 0, $bbcode = 0, $bbcode_img = 0) {
$text = trim($text);
if ($word_wrap && $text != "") {
$text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
}
if ($html == 0) {
$text = str_replace("<", "&lt;", $text);
$text = str_replace(">", "&gt;", $text);
$text = str_replace("<", "<", $text);
$text = str_replace(">", ">", $text);
}
$text = str_replace("\n", "<br />", $text);
$text = replace_url($text);
if ($bbcode == 1) {
$search_array = array(
"/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU",
"/(\[)(list)(])(.*)(\[\/list\])/siU",
"/(\[\*\])/siU",
"/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU",
"/(\[)(url)(])([^\"]*)(\[\/url\])/siU",
"/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU",
"/javascript:/si",
"/about:/si"
);
$replace_array = array(
"<ol type=\"\\5\">\\7</ol>",
"<ul>\\4</ul>",
"<li>",
"<a href=\"http://www.\\6\" target=\"_blank\">\\8</a>",
"<a href=\"\\5\" target=\"_blank\">\\7</a>",
"<a href=\"http://www.\\5\" target=\"_blank\">www.\\5</a>",
"<a href=\"\\4\" target=\"_blank\">\\4</a>",
"<pre>Code:<hr size=1>\\5<hr size=1></pre>",
"java script:",
"about :"
);
$text = preg_replace($search_array, $replace_array, $text);
if (!$bbcode_img) {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<a href=\"\\5\" target=\"_blank\">\\5</a>", $text);
}
else {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<img src=\"\\5\">", $text);
}
$text = preg_replace("/(\[)(b)(])(\r\n)*([^\"]*)(\[\/b\])/siU", "<b>\\5</b>", $text);
$text = preg_replace("/(\[)(i)(])(\r\n)*([^\"]*)(\[\/i\])/siU", "<i>\\5</i>", $text);
$text = preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU", "<u>\\5</u>", $text);
}
$text = str_replace("\\'", "'", $text);
return replace_badwords($text);
}
function get_user_info($user_id = 0) {
global $site_db, $user_table_fields;
$user_info = 0;
if ($user_id != 0 && $user_id != GUEST) {
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
if ($user_info = $site_db->query_firstrow($sql)) {
foreach ($user_table_fields as $key => $val) {
if (isset($user_info[$val])) {
$user_info[$key] = $user_info[$val];
}
elseif (!isset($user_info[$key])) {
$user_info[$key] = "";
}
}
}
}
return $user_info;
}
function get_icq_status($uin) {
// From: http://www.koehntopp.de/php/snippets.html#code-icq
if (!is_numeric($uin)) return FALSE;
$fp = @fsockopen('wwp.icq.com', 80, $errno, $errstr, 8);
if (!$fp) return FALSE;
$request = "HEAD /scripts/online.dll?icq=$uin&img=5 HTTP/1.0\r\n"
."Host: wwp.icq.com\r\n"
."Connection: close\r\n\r\n";
fputs($fp, $request);
do {
$response = fgets($fp, 1024);
}
while (!feof($fp) && !stristr($response, 'Location'));
fclose($fp);
if (strstr($response, '4367')) return 'online';
if (strstr($response, '4349')) return 'offline';
if (strstr($response, '4386')) return 'disabled';
return FALSE;
}
function add_to_lightbox($id) {
global $user_info, $site_db;
$id = intval($id);
if (!$id) {
return false;
}
$lightbox_ids = $user_info['lightbox_image_ids'];
$lightbox_array = explode(" ", $lightbox_ids);
if (!in_array($id, $lightbox_array)) {
$lightbox_ids .= " ".$id;
}
$user_info['lightbox_image_ids'] = trim($lightbox_ids);
$user_info['lightbox_lastaction'] = time();
$sql = "UPDATE ".LIGHTBOXES_TABLE."
SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
WHERE user_id = ".$user_info['user_id'];
return ($site_db->query($sql)) ? 1 : 0;
}
function remove_from_lightbox($id) {
global $user_info, $site_db;
$lightbox_array = explode(" ",$user_info['lightbox_image_ids']);
foreach ($lightbox_array as $key => $val) {
if ($val == $id) {
unset($lightbox_array[$key]);
}
}
$user_info['lightbox_image_ids'] = trim(implode(" ", $lightbox_array));
$user_info['lightbox_lastaction'] = time();
$sql = "UPDATE ".LIGHTBOXES_TABLE."
SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
WHERE user_id = ".$user_info['user_id'];
return ($site_db->query($sql)) ? 1 : 0;
}
function clear_lightbox() {
global $user_info, $site_db;
$current_time = time();
$sql = "UPDATE ".LIGHTBOXES_TABLE."
SET lightbox_image_ids = '', lightbox_lastaction = $current_time
WHERE user_id = ".$user_info['user_id'];
if ($site_db->query($sql)) {
$user_info['lightbox_image_ids'] = "";
$user_info['lightbox_lastaction'] = $current_time;
return true;
}
else {
return false;
}
}
function check_lightbox($id) {
global $user_info;
$lightbox_array = explode(" ", $user_info['lightbox_image_ids']);
return in_array($id, $lightbox_array);
}
function get_random_key($db_table = "", $db_column = "") {
global $site_db;
$key = md5(uniqid(microtime()));
if ($db_table != "" && $db_column != "") {
$i = 0;
while ($i == 0) {
$sql = "SELECT ".$db_column."
FROM ".$db_table."
WHERE ".$db_column." = '$key'";
if ($site_db->is_empty($sql)) {
$i = 1;
}
else {
$i = 0;
$key = md5(uniqid(microtime()));
}
}
}
return $key;
}
function get_subcat_ids($cid = 0, $cat_id = 0, $cat_parent_cache) {
global $subcat_ids;
if (!isset($cat_parent_cache[$cid])) {
return false;
}
foreach ($cat_parent_cache[$cid] as $key => $val) {
if (check_permission("auth_viewcat", $val)) {
$subcat_ids[$cat_id][] = $val;
get_subcat_ids($val, $cat_id, $cat_parent_cache);
}
}
return $subcat_ids;
}
function get_subcategories($parent_id) {
global $cat_parent_cache, $cat_cache, $site_sess, $config;
if (!isset($cat_parent_cache[$parent_id]) || $config['num_subcats'] < 1) {
return "";
}
$visible_cat_cache = array();
foreach ($cat_parent_cache[$parent_id] as $key => $val) {
if (check_permission("auth_viewcat", $val)) {
$visible_cat_cache[$key] = $val;
}
}
$num_subs = sizeof($visible_cat_cache);
$sub_cat_list = "";
$i = 1;
foreach ($visible_cat_cache as $subcat_id) {
if ($i <= $num_subs && $i <= $config['num_subcats']) {
$sub_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$subcat_id);
$sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".$cat_cache[$subcat_id]['cat_name']."</a>";
if ($i != $config['num_subcats'] && $i < $config['num_subcats'] && $i < $num_subs) {
$sub_cat_list .= ", ";
}
if ($i == $config['num_subcats'] && $i < $num_subs) {
$sub_cat_list .= " ...\n";
}
}
$i++;
}
return $sub_cat_list;
}
function get_categories($cat_id = 0) {
global $site_template, $site_db, $site_sess, $config, $lang;
global $cat_cache, $cat_parent_cache, $new_image_cache, $subcat_ids;
$cattable_width = ceil((intval($config['cat_table_width'])) / $config['cat_cells']);
if ((substr($config['cat_table_width'],-1)) == "%") {
$cattable_width .= "%";
}
if (!isset($cat_parent_cache[$cat_id])) {
return "";
}
$visible_cat_cache = array();
foreach ($cat_parent_cache[$cat_id] as $key => $val) {
if (check_permission("auth_viewcat", $val)) {
$visible_cat_cache[$key] = $val;
}
}
if (empty($visible_cat_cache)) {
return "";
}
$total = sizeof($visible_cat_cache);
$table_columns = (intval($config['cat_cells'])) ? intval($config['cat_cells']) : 2;
if ($total <= $table_columns) {
$table_rows = 1;
}
else {
$table_rows = $total / $table_columns;
if ($total >= $table_columns && !is_integer($table_rows)) {
$table_rows = intval($table_rows) + 1;
}
}
$categories = "\n<table width=\"".$config['cat_table_width']."\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
$categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";
$count = 0;
$count2 = 0;
foreach ($visible_cat_cache as $key => $category_id) {
$categories .= "<tr>\n<td valign=\"top\">\n";
$is_new = (isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0) ? 1 : 0;
$num_images = (isset($cat_cache[$category_id]['num_images'])) ? $cat_cache[$category_id]['num_images'] : 0;
$subcat_ids = array();
get_subcat_ids($category_id, $category_id, $cat_parent_cache);
if (isset($subcat_ids[$category_id])) {
foreach ($subcat_ids[$category_id] as $val) {
if (isset($new_image_cache[$val]) && $new_image_cache[$val] > 0) {
$is_new = 1;
}
if (isset($cat_cache[$val]['num_images'])) {
$num_images += $cat_cache[$val]['num_images'];
}
}
}
if (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 || defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0) {
$random_cat_image_file = "";
}
else {
$random_cat_image_file = get_random_image($category_id, 0, 1);
}
$site_template->register_vars(array(
"cat_id" => $category_id,
"cat_name" => $cat_cache[$category_id]['cat_name'],
"cat_description" => $cat_cache[$category_id]['cat_description'],
"cat_hits" => $cat_cache[$category_id]['cat_hits'],
"cat_is_new" => $is_new,
"lang_new" => $lang['new'],
"sub_cats" => get_subcategories($category_id),
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id),
"random_cat_image_file" => $random_cat_image_file,
"num_images" => $num_images
));
$categories .= $site_template->parse_template("category_bit");
$count++;
$count2++;
$categories .= "</td>\n</tr>\n";
if ($count == $table_rows && $count2 < sizeof($visible_cat_cache)) {
$categories .= "</table></td>\n";
$categories .= "<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
$categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";
$total = $total - $count2;
$table_columns = $table_columns - 1;
/*if ($total <= $table_columns && $table_columns > 1) {
$table_rows = 1;
}
else {
$table_rows = $total / $table_columns;
if ($total >= $table_columns && !is_integer($table_rows)) {
$table_rows = intval($table_rows) + 1;
}
}*/
$count = 0;
}
}
$categories .= "</table>\n</td>\n</tr>\n</table>\n";
return $categories;
}
function get_category_path($cat_id = 0, $detail_path = 0) {
global $site_sess, $config, $cat_cache, $url;
$parent_id = 1;
while ($parent_id) {
if (!isset($cat_cache[$cat_id]['cat_parent_id'])) {
return false;
}
$parent_id = $cat_cache[$cat_id]['cat_parent_id'];
if (empty($path)) {
if ($detail_path) {
$cat_url = ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id;
if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
if (!empty($regs[1]) && $regs[1] != 1) {
$cat_url .= "&".URL_PAGE."=".$regs[1];
}
}
$path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".$cat_cache[$cat_id]['cat_name']."</a>";
}
else {
$path = $cat_cache[$cat_id]['cat_name'];
}
}
else {
$path = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\" class=\"clickstream\">".$cat_cache[$cat_id]['cat_name']."</a>".$config['category_separator'].$path;
}
$cat_id = $parent_id;
} // end while
return $path;
}
function get_category_dropdown_bits($cat_id, $cid = 0, $depth = 1) {
global $site_db, $drop_down_cat_cache, $cat_cache;
if (!isset($drop_down_cat_cache[$cid])) {
return "";
}
$category_list = "";
foreach ($drop_down_cat_cache[$cid] as $key => $category_id) {
if (check_permission("auth_viewcat", $category_id)) {
$category_list .= "<option value=\"".$category_id."\"";
if ($cat_id == $category_id) {
$category_list .= " selected=\"selected\"";
}
if ($cat_cache[$category_id]['cat_parent_id'] == 0) {
$category_list .= " class=\"dropdownmarker\"";
}
if ($depth > 1) {
$category_lis
-
Saludos,,,
functions.php lo tienes correcto,,,, inserta el constans.php para pegarle un vistazo. :roll: :roll:
excitex2
-
este es el constants.php que tengo:
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: constants.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.1 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
// If 4images has problems to find out the right URL, define it here.
define('SCRIPT_URL', 'http://induma.servepics.com/4images'); //no trailing slash
// Table names
define('CATEGORIES_TABLE', $table_prefix.'categories');
define('COMMENTS_TABLE', $table_prefix.'comments');
define('ENCUESTAS_TABLE', $table_prefix.'encuestas');
define('GROUP_ACCESS_TABLE', $table_prefix.'groupaccess');
define('GROUP_MATCH_TABLE', $table_prefix.'groupmatch');
define('GROUPS_TABLE', $table_prefix.'groups');
define('IMAGES_TABLE', $table_prefix.'images');
define('IMAGES_TEMP_TABLE', $table_prefix.'images_temp');
define('LIGHTBOXES_TABLE', $table_prefix.'lightboxes');
define('POSTCARDS_TABLE', $table_prefix.'postcards');
define('SESSIONS_TABLE', $table_prefix.'sessions');
define('SESSIONVARS_TABLE', $table_prefix.'sessionvars');
define('SETTINGS_TABLE', $table_prefix.'settings');
define('USERS_TABLE', $table_prefix.'users');
define('WORDLIST_TABLE', $table_prefix.'wordlist');
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');
// URL Parameters
define('URL_IMAGE_ID', 'image_id');
define('URL_CAT_ID', 'cat_id');
define('URL_USER_ID', 'user_id');
define('URL_POSTCARD_ID', 'postcard_id');
define('URL_COMMENT_ID', 'comment_id');
define('URL_PAGE', 'page');
define('URL_ID', 'id');
// User levels
define('GUEST', -1);
define('USER_AWAITING', 1);
define('USER', 2);
define('ADMIN', 9);
// Permission levels
define('AUTH_ALL', 0);
define('AUTH_USER', 2);
define('AUTH_ACL', 3);
define('AUTH_ADMIN', 9);
// Group types
define('GROUPTYPE_GROUP', 1);
define('GROUPTYPE_SINGLE', 2);
// Chmod for files and directories created by 4images
define('CHMOD_FILES', 0666);
define('CHMOD_DIRS', 0777);
// Will be used to replace the {xxx} tage if the value is empty.
// Netscape Browser sometimes need this to display table cell background colors.
define('REPLACE_EMPTY', ' ');
// Max rating value
define('MAX_RATING', 10);
// Days postcards will be held in the database
define('POSTCARD_EXPIRY', 10);
// Time offset for your website. Sometimes usefull if your server is located
// in other timezones.
define('TIME_OFFSET', 0);
// All words <= MIN_SEARCH_KEYWORD_LENGTH and >= MAX_SEARCH_KEYWORD_LENGTH
// are not added to the search index
define('MIN_SEARCH_KEYWORD_LENGTH', 3);
define('MAX_SEARCH_KEYWORD_LENGTH', 25);
// If you set this to 1, admins will authenticated additionally with cookies.
// If you use "User Integration", you should set this to 0.
define('ADMIN_SAFE_LOGIN', 0);
// If you use GD higher 2.0.1 and PHP higher 4.0.6 set this to 1.
// Your thumbnails will be created with better quality
define('CONVERT_IS_GD2', 0);
// If you have a lot of images in your database,
// the random image function could make your programm slow.
// Try first to set "SHOW_RANDOM_CAT_IMAGE" to 0.
define('SHOW_RANDOM_IMAGE', 1);
define('SHOW_RANDOM_CAT_IMAGE', 0);
// Check existence of remote image files.
// If you choose 1, you could get sometimes timeout errors
define('CHECK_REMOTE_FILES', 0);
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);
// Data paths
define('MEDIA_DIR', 'data/media');
define('THUMB_DIR', 'data/thumbnails');
define('MEDIA_TEMP_DIR', 'data/tmp_media');
define('THUMB_TEMP_DIR', 'data/tmp_thumbnails');
define('DATABASE_DIR', 'data/database');
define('TEMPLATE_DIR', 'templates');
// Script version
define('SCRIPT_VERSION', '1.7.1');
// Debug contants
// define("PRINT_STATS", 1);
// define("PRINT_QUERIES", 1);
// define('PRINT_CACHE_MESSAGES', 1);
?>
por cierto, deberia quitar los ultimos "//" para activar lo de debug?
-
excitex2, me podrias seguir ayudando? o es que no ves la solucion?
un saludo
INDUMA
-
A weakness has been discovered from the $user_profile_link string.
In your includes/functions.php file,
find :
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $image_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$image_row['user_id'];
with :
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $image_row['user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$image_row['user_id']);
Merry Christmas.
-
Saludos amigo Induma,,,
Perdona por el retraso en contestarte,,, ( bueno solo han sido 4 meses 8O 8O ,, pero se me olvidó el contestar)
He visto en tu web,, que aun no has solucionado el problema que expusistes antaño :(
Bien,,, localiza en lang/tu_idioma/main.php todo lo relacionado con los MMS,, en el MOD es lo siguiente :
//-----------------------------------------------------
//--- Send MMS ----------------------------------------
//-----------------------------------------------------
$lang['mmsheadline'] = "Bild als MMS schicken";
$lang['imagewidth'] = "Bildbreite:";
$lang['imageheight'] = "Bildhöhe:";
$lang['download'] = "Downlaod";
$lang['id'] = "ID:";
$lang['mmstext'] = "<b>So kommt dieses Bild auf Ihr Handy</b><br>
<ul>
<li> Rufen Sie im WAP-Menu \"Zur Adresse\" auf<li> Geben Sie dort folgendes ein:
<br> <b>{url_mms_id}</b><li> Es erscheint folgendes:<br>
ID: <b>{mms_id}</b><br><b>Ok, Download</b>
<li> Wählen Sie \"Download\"<li>
Das Bild wird nun auf Ihr Handy geladen. Bitte gedulden Sie sich einen Augenblick.<li>
Beim abgeschlossenen Download erscheint:<br> <b>Datei empfangen</b><br>Optionen - zurück<li> Wählen Sie <BR> <b>Optionen > Speichern</b><li> Geben Sie dem Bild nun noch einen Namen und wählen Sie einen Ordner aus.<li> <b>Jetzt ist das Bild in auf Ihrem Handy abgespeichert!</b>
</ul>";
Cambia a :
//-----------------------------------------------------
//--- Send MMS ----------------------------------------
//-----------------------------------------------------
$lang['mmsheadline'] = "<b><center>Para descargar esta imagen en tu movil,<br> sigue las siguientes instrucciones :</center></b>";
$lang['imagewidth'] = "Alto:";
$lang['imageheight'] = "Ancho:";
$lang['download'] = "Downlaod";
$lang['id'] = "ID:";
$lang['mmstext'] = "<br> <li> En el menú de servicios elige :<b>' ir a una dirección '</b><li> Escribe la siguiente dirección :<br> <B>";
$lang['mmstext2'] = "</B><li> Entonces verás en la pantalla de tu movil lo siguiente:<BR> ID: <b>";
$lang['mmstext3'] = "</b><br><b>Ok, Descargar </b><li> Elige <b>' Ok, Descargar '</b><li> La imagen será cargada. Tardará un poquito.<li> Una vez descargada la imagen verás lo siguiente:<br>
<b> Archivo Recibido<br>Opciones - Atrás </b><li> Elige <br> <b> Opciones > Guardar </font></b><li> Renombra la imagen y ponla en un directorio.<li> <b>Ahora tienes la imagen en tu movil </b> </ul>";
Cerrar y guardar cambios
Modifica el contenido de templates/tus_plantillas/mms.html por este otro :
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="head1" >{mmsheadline}</td>
</tr>
<tr>
<td class="head1">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="row2">{text} {url_mms_id}{text2}{mms_id}{text3}</td>
</tr>
</table>
</td>
<td class="head1">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="row2" align="center">{thumbnail}<p>{file_size}</p>
<p>{widh}</p>
<p>{height}</td>
</tr>
</table>
</td>
</tr>
</table>
Cerrar y guardar cambios
Localiza en mms.php :
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $mode, $show_link),
"file_size" => $lang['file_size']." ".$file_size,
"width" => $lang['imagewidth']." ".$size[0]." ".$lang['px'],
"height" => $lang['imageheight']." ".$size[1]." ".$lang['px'],
"mmsheadline" => $lang['mmsheadline'],
"text" => $lang['mmstext'],
"mms_id" => $id,
"url_mms_id" => "".SCRIPT_URL."/getmms.php?id=".$id.""
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
Modificar a :
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $mode, $show_link),
"file_size" => $lang['file_size']." ".$file_size,
"width" => $lang['imagewidth']." ".$size[0]." ".$lang['px'],
"height" => $lang['imageheight']." ".$size[1]." ".$lang['px'],
"mmsheadline" => $lang['mmsheadline'],
"text" => $lang['mmstext'],
"text2" => $lang['mmstext2'],
"text3" => $lang['mmstext3'],
"mms_id" => $id,
"url_mms_id" => "".SCRIPT_URL."/getmms.php?id=".$id.""
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
Cerrar y guardar cambios
Luego modifica el código JavaScript que has insertado en templates/tus_plantillas/details.html a tu gusto para adaptar las medidas de la plantilla mms.html.
Espero que aunque tarde,, te sirva.
excitex2
-
I don't get it, so it's only for 1.7, right?
-
Greetings,,
This modification are for version 1.7.1.
For version 1,7 it is not necessary to make no modification to the MOD.
excitex2
-
Hi There!
Thank you for your reply,
So this is for 1.7.1?
I found in this topic english version of it, but you said that it is necessary to make modification in it for 1.7.1, right?
I don't know spanish or german and I'ts hard for me to understand everything.
-
muchisimas gracias por acordarte de mi, aunque hayas tardado 4 meses, jajajaja
en serio, muchisimas gracias por la solucion (aun no lo he probado) en cuanto pueda hago las correcciones y te digo como va
de nuevo, mil gracias
un saludo
INDUMA
-
pues funciona a la perfeccion
de nuevo mil gracias
un saludo
INDUMA
-
Saludos a todos, oigan, no puedo encontrar este MOD por ningún lado... saben por qué? :(
Alguien podría agregar un ZIP con los archivos o una serie para instalarlo en 1.7.1? :p
No quiero nada, :D
Al menos un poco de ayuda me caería muy bien... gracias.
-
Saludos,,,,
Que no encuentras el MOD ???????? 8O :?
Mira en el primer post de este mismo topic. aqui (http://www.4homepages.de/forum/index.php?topic=9291.msg43927#msg43927)
excitex2
-
¿En serio? 8O ...porqué no está en la sección de MODs? :P
-
Saludos,,,
En serio,,,, está donde te he dicho,,, :| :|
excitex2
-
Gracias, ya lo leo con cuidado. :P
-
Hi!
How can I download other files? (mid)
When I try download the mid files my mobil the mobile send 403 error.
-
hi..
does this mod work with version 1.7.2 ???
Thanks
Akshay
-
Im getting the following error .. Can anyone help please ??
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in \4images\mms.php on line 3
Parse error: syntax error, unexpected T_STRING in \4images\mms.php on line 3
Thanks
Akshay
-
este mod trabaja para 1.7.3?? qué guía tendría que seguir? la de 1.7 o 1.7.1 ??
estaría genial tenerlo instalado en mi galeria!! :D
-
Saludos,,,
Pues la verdad que no lo he probado en la vewrsion 1.7.3.
La instalación la tienes que hacer como pone el MOD,, que es para la versión 1.7,,, y si falla tendras que aplicar la modificación que hay después.
excitex2
-
ok ^^ gracias, ya pondré por aqui los resultados cuando lo pruebe, asi sabremos con exactud si sirve para la 1.7.3 :wink:
-
hola, solo revisa, el codigo que vas a modificar, por el que pondras, de esta manera, vas actualizando el MOD, para nuevas versiones, algunos MOD requieren que hagas leves cambios, como los que he realizado e el de birthday para 1.7.2 y la de avatars para la 1.7.2, y alguno que no recuero, pero son pocos
bay
-
ufff... el problema es q no se de php.. weno algo entiendo porque se c++ y los bucles, funciones y tal puede que entienda algo, pero no mucho. Ok! si hago algún cambio lo pondré aqui ^^
-
si va! :D aunq un poco tarde xD pense q sería mucho mas dificil.. gracias excitex por los arreglos, me pasaba lo mismo q en la version 1.7.1 en la 1.7.3
pero... no se te bajan las imágenes muuuuuy muuuuy enanas?
-
Saludos,,,,
Muy,muy enanas ????????? 8O 8O
Dame más pistas que ahora mismo estoy desorientado 8O 8O
Pon una dirección donde se pueda ver el funcionamiento del MOD con el problema de las imágenes enanas.
excitex2
-
xDDD
cuando recibo la imagen en mi movil no rellena la pantalla entera, no es ni de ancha la mitad de la anchura de la pantalla de mi movil y con la altura igual. me preguntaba si se podría enviar la imagen un poco mas grande.. supongo que depende del tamaño del thumbnail.. mmm o quizas es culpa de mi movil q no la expande.. pero aun asi estoy muy contenta por este mod. Gracias a quien lo haya hecho. ^^
Mi galeria es: http://www.myart.es/img75.htm ahi te pongo una de las imagenes q he probado a enviarme xD
y gracias por tu atencion :wink:
-
Saludos,,,
El MOD,, manda la imagen del mismo tamaño que está registrada en la galería,,, igual no sale en el movil con la misma dimensión que la original,, a causa que le baja los pixeles para poder mostrar la imagen con la resolución que tiene.
excitex2
-
hola de renuevo
trabaja para la 1.7.4, solo que en la ventana de java no me muestra el theme, sale en blanco el fondo
gracias