Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cloe

Pages: [1] 2 3 4 5 ... 8
1
Mods & Plugins (Releases & Support) / Re: [Mod] Photo Of The Day
« on: January 23, 2008, 10:01:23 PM »
Isnt it anyone here that can make this mod work?? the way I have descibed over here??

Pleeease.. It would really make my day :)

2
Mods & Plugins (Releases & Support) / Re: Mebbernind!
« on: January 23, 2008, 03:23:44 AM »
Mebbernind!

I think I have it figured out with the help of a couple of friends....

Code: [Select]
<?php

/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: potd.php                                           *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.0 for 4images 1.7                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net) and SLL (;   *
*                                                                        *
**************************************************************************
*                                                                        *
*    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.                                                        *
*                                                                        *
*************************************************************************/
//Based on the Photo of the Day mod by SLL and V@no
//additional tweaking by Omnirayf 9-5-2003

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''./4images/');
//include(ROOT_PATH.'global.php');
include(ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}
    switch (
POTD_SELECT_MODE) {
   case 
"by_rating"     $select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
   case 
"by_votes"      $select_mode "i.image_votes"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_comments"   $select_mode "i.image_comments"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_downloads"  $select_mode "i.image_downloads"$select_mode2 ", i.image_name ASC"; break;
   case 
"by_hits"                $select_mode "i.image_hits"$select_mode2 ", i.image_name ASC"; break;
   default                             : 
$select_mode "i.image_rating"$select_mode2 ", i.image_votes DESC"; break;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand(mktime(000date("m"), date("d"), date("y")));
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_date<"
.mktime(000date("m"), date("d"), date("y"))."
AND a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments: $image_comments</center></td></tr></table>\n";
?>

Copy this code to Notepad or Homesite or UltraEdit, rename to potd.php, toss it in your root directory, and then test it by direct url call. You should get any old pic in your 4images database, regardless of stats. Refresh, and the pic should remain the same. After midnight of the date you implement the mod, the pic should change to another random pic for another 24 hours.

This mod has been optimized for people who are using Postnuke or PhpNuke and want a Photo of the Day block. Just make a new php script block and put this into it:
Code: [Select]
include("http://www.your-own-site.com/potd.php");
?>
It works, believe me, especially if you are using Postnuke. Otherwise, if you are having problems with it, add the opening <?php tag.

Let me know if it works for you, as it works for me. This way I can go and slap my friends for their help. :wink:


Hi,

i wanted to have the REAL Photo of the day for 24 hours, too.

How to do that on an extern page was told in the thread i mention. It isnt much do do, if u want to have it in your template.

Replace the code in the functions.php with:

Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

    switch (POTD_SELECT_MODE) {
   case "by_rating"     : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
   case "by_votes"      : $select_mode = "i.image_votes"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_comments"   : $select_mode = "i.image_comments"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_downloads"  : $select_mode = "i.image_downloads"; $select_mode2 = ", i.image_name ASC"; break;
   case "by_hits"                : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
   default                             : $select_mode = "i.image_rating"; $select_mode2 = ", i.image_votes DESC"; break;
}

$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand(mktime(0, 0, 0, date("m"), date("d"), date("y")));
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_date<".mktime(0, 0, 0, date("m"), date("d"), date("y"))."
AND a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments</center></td></tr></table>\n";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
}

//-----------------------------------------------------


Now it is shown in the template, but i dont know yet, how to use it with the {potd_image}


---EDIT---

ok I tried to add the following code and it works almost:

Code: [Select]
$potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;

any idea?

If I understand this right is this the way to make the real Photo Og The Day... so the higest rated image will be shown even if another image is higher rated.. And it will reset things at 12 o'clock every night.. And find the next image that has been submitted the last 24 hour that has the highest rating??

I really hope that this is the answer.. and that someone can figure out what to do to make this work.. That would really make this Photo Of The Day a perfect MOD..

And that is what I need for my site.. Please can someone help?? 

If it is so... I wolud really get this to work... I really hope that someone can help me here.. ???

3
So - like say - I work it later.

Oki :) .... I will wait pacently ;)

You are the best thunderstrike  :D

4
Quote
if I create a new user, and upload images... It will work??
With comments and thumbnail to??

Try it ? :?

Quote
I see that you have fixed random image on my site

Correct.

Created new user (Lille Fille) Uploaded a new image from this account: Imagename: testttttttttttttttt Post a comment on it... And it still displaying guest under thumbnail and in comments :(
se here: http://www.fotoonline.no/details.php?image_id=4

5
No idea why do that ... will check later when time ... now - have MODs code. ;)

For now, restore backup . . .

Oki.. ;)

If u want just go in a fix it.. But is ut like this now, if I create a new user, and upload images... It will work??
With comments and thumbnail to??
I see that you have fixed random image on my site

6
Ok, no perm for upload image so upload new. Check image_id + user_id in IMAGES_TABLE (phpmyadmin) of last upload image ...

I send you login to my phpadmin on PM.. and you can se it yourself ;)
Made an acount for you to on my gallery

username: thunder
Password: test

Its better if you se it because you understand it better :)

7
Like say ... need work direct from server to see what be wrong ... PM me access if like ... other - can no lot ...

oki... I send u a personal message :)

8
Quote
Do you mean I should edit all this files before I upload and install 4images on my server?

I mean: I should to see direct. :?

If you mean what I think you mean ;)
I have removed the password to enter my site..
Open now: http://www.fotoonline.no/

9
No, I mean work on site direct ...

Ok.. I edit my files direct from server... Shoudent I do that?

Do you mean I should edit all this files before I upload and install 4images on my server?

10
If only I test live with code from server your ... might see defect . . .

I have my site live, (not local)... but it dosent work :( sorry

11
Quote
if (isset($comment_row[$i]['user_firstname']) && isset($comment_row[$i]['user_lastname']) && $comment_user_id != GUEST) {
        $comment_user_name = format_text(stripslashes($comment_row[$i]['user_firstname']), 2) . REPLACE_EMPTY . format_text(stripslashes($comment_row[$i]['user_lastname']), 2);
} elseif (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        $comment_user_name = format_text(stripslashes($comment_row[$i][$user_table_fields['user_name']]), 2);

change:

Quote

if (!isset($comment_row[$i][$user_table_fields['user_name']]) && isset($comment_row[$i]['user_firstname']) && isset($comment_row[$i]['user_lastname']) && $comment_user_id != GUEST) {
$comment_user_name = (isset($comment_row[$i]['user_firstname']) && isset($comment_row[$i]['user_lastname'])) ? format_text(stripslashes($comment_row[$i]['user_firstname']), 2) . REPLACE_EMPTY . format_text(stripslashes($comment_row[$i]['user_lastname']), 2) : format_text(stripslashes($comment_row[$i][$user_table_fields['user_name']]), 2);

Try (details.php)

Nope... Still says guest.. Maybe this is a no can do :(

12
Maybe something in comment_bit.html??

13
If upload only users - no guest allow. Will show user ID ?

I have the setting that ONLY members can upload.. But still it shows guest

14
Then no good ... user ID no capture.

Hmmm... thats strange..
Is there a fix for this??

Maybe thats the problem under thumbnails to?

15
Comment user id show GUEST level (-1) ?

I guess it does that yes...

Pages: [1] 2 3 4 5 ... 8