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 - pwa

Pages: [1]
1
Mods & Plugins (Releases & Support) / Re: [Mod] User upload limits
« on: November 23, 2011, 01:08:25 PM »
Hi,
Very nice mod. i used it on version 1.7.10 with daily limit option.
I corrected this bug:

Quote
this mod is not working for unvalidated images.
User can upload many photos if there is a validation in that category. MOD only works for validated photos.
new version of check_daily_picture_limit function (file member.php):

function check_daily_picture_limit($user_id) {
	
global 
$site_db$site_template;
  
$sql "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
  
$row $site_db->query_firstrow($sql);
  
$upload_limit = ($row['user_limit']);
  
$site_template->register_vars("upload_limit"$upload_limit);
  
  
$limit_cutoff time() - 60 60 24;
  
  
$sql "SELECT COUNT(image_id) AS num_rows_all
  FROM "
.IMAGES_TABLE."
  WHERE user_id=
$user_id AND image_date > $limit_cutoff";
  
//WHERE image_active = 1 AND user_id=$user_id AND image_date > $limit_cutoff";
  
$row $site_db->query_firstrow($sql);
  
$images_per_user $row['num_rows_all'];
  
  
//look for unvalidated images too
  
$sql "SELECT COUNT(image_id) AS num_rows_all
  FROM "
.IMAGES_TEMP_TABLE."
  WHERE user_id=
$user_id  AND image_date > $limit_cutoff";
  
$row $site_db->query_firstrow($sql);
  
$images_per_user $images_per_user $row['num_rows_all'];  
  
  
$site_template->register_vars("images_per_user"$images_per_user);

  return (
$images_per_user <= $upload_limit);
}



On error page number of already uploaded images is not displayed - I corrected this too:
in lang file main.php:
$lang['show_my_images'] = "Number of submited images (accepted and awaiting for validation): ";

and in over_limit.html:
Code: [Select]
                 
<p>{lang_no_limits_text}</p>
{lang_show_my_images}{images_per_user}
look it is no way to show via search screen unvalidated images (I removed this link)


I used code from first post as base.




2
Hi!

I tested today this mod with 4images 1.7.10 and VB 4.1.7

I have issue regarding redirecting loop after login.
When I log in on 4images I see screeen from vb and when I return to gallery FF return error (too many redirection)
I try clean cookis but without results.


do you have any idea?


For v 1.7.10 modification of session.php is slightly different:
skip step with replacement of:

$user_password 
md5($user_password);


look at oryginal code - this statement is not present :-(:

    $user_id 
= (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    if (
$user_id != GUEST) {
      if (
compare_passwords($user_password$row[$user_table_fields['user_password']])) {
        
$sql "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = 
$user_id
                WHERE session_id = '"
.addslashes($this->session_id)."'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          
$this->set_cookie_data("userpass", ($auto_login) ? md5($row[$user_table_fields['user_password']]) : "");
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    }


replace with:
    if ($user_id != GUEST) {
      if (
compare_passwords($user_password$row[$user_table_fields['user_password']], $do_md5)) {
        
$sql "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = 
$user_id
                WHERE session_id = '"
.addslashes($this->session_id)."'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          if (
$do_md5){
          
$this->set_cookie_data("userpass", ($auto_login) ? md5($row[$user_table_fields['user_password']]) : "");
          } else {
          
$this->set_cookie_data("userpass", ($auto_login) ? $row[$user_table_fields['user_password']] : "");
          }
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    } 


(im not sure with lines about set_cookie_data - please verify)

in file includes/security_utils.php replace function compare_passwords:
function compare_passwords($plain$hashed) {
  
// Backwards compatibility
  
if (strpos($hashed':') === false) {
    return 
secure_compare(md5($plain), $hashed);
  }

  return 
secure_compare(salted_hash($plain$hashed), $hashed);
}

with
function compare_passwords($plain$hashed $do_md5 true) {
  
// Backwards compatibility
  
if  ($do_md5) {
    if (
strpos($hashed':') === false) {
      return 
secure_compare(md5($plain), $hashed);
      }
  } else
  {
    if (
$plain == $hashed) return true;
    else return 
false;
  }

  return 
secure_compare(salted_hash($plain$hashed), $hashed);
}


so, mod works with 4images 4.7.10 and vBulletin 4.1.7 ;-)

3
Hi!
I installed this mod... works fine (4image v1.7.10)
Maybe german speakers notice this before (i dont understand deutch)...

In my galery user activation via email link is active - than I should be better to create WBB account AFTER activation... not just after registration...

I moved your code in other place - after line
      $msg $lang['activation_success'];
in register.php file

easy in concept... some troubles in realisation - there is need of user name, email and password...
and password is i think problem - to put it into WBB we need uncoded version of password, but at this moment pass is coded.

do you have any idea?
mayby store password uncrypted untill activation?


4
you dont afraid of slow down site with high rate visits?

No, 4images is fast if you don't install "wrong" mod's that do big queries. I am also caching almost everything.
4images can handle 1000+ simultaneous users without any problem if your code is good and cache is enabled. 


what you mean "cached"? - at db cache? at php? or content setting cache attr for browser? or all :-)
OK - it ma firs steps with 4image... i test some solutions from over week - this is beggining of me way :-)

i tested your solution with css overlaing text on thums... it is problem with IE...
it needs "left: 0px;" in CSS .imgteaser a:hover .desc   or you know better solve.

Is it working? I don't have trouble with IE7, don't know about future versions 'cause I hate that browser : )
I hate IE too... but some users use it :-(
Yes - working for me (IE8) - but I'm not sure that it is correct solution - I'm programmer but not html/css/php :-(

5
you dont afraid of slow down site with high rate visits?
I test already mod of mini_top (and next mini top of day/week/month)

Big minus is calculating winner list every page load (generating unnecessary DB load)

For me better solution is periodically generating actual 'winner list' - via cron or by user visit every 15minut or sth else...

Mayby this not important... I havnt enough web mastering experience

----
i tested your solution with css overlaing text on thums... it is problem with IE...
it needs "left: 0px;" in CSS .imgteaser a:hover .desc   or you know better solve.



6
great job!
what next?  :-)

how you count "likes" - as lightbox adds?


7
Mods & Plugins (Releases & Support) / Re: [Mod] Mini-Top
« on: November 07, 2011, 09:54:35 PM »
Das würde mich auch sehr interessieren. Hat jemand eine Idee und kann helfen?
MINI TOP of the DAY
MINI TOP of the WEEK
MINI TOP of the MONTH

hi there! no problem. I am willing to share my solution with the world!

I have reworked the entire mini-top mod...

..cut...

I use this solution but it has TRAP :-(
for young gallery, with few images per day it has loop without end:

Code: [Select]
//image 3
$mini_top_images_new .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n"; 
$count = 0;
while (($top_image[2][$count]['image_id'] == $image_r1['image_id']) || ($top_image[2][$count]['image_id'] == $image_r2['image_id'])) {
$count++;
}
$image_r3 = $top_image[2][$count];
show_image($image_r3);
$site_template->register_vars("lang_mini_top_mode", $lang['mini_top_hits']);
$mini_top_images_new .= $site_template->parse_template("mini_top_bit");
$mini_top_images_new .= "\n</td>\n";

Im not php programmer - I just commented out this section.



8
Hi all!

I am preparing own site based on 4images...
Ajax star rating is very nice mod - work properly... but...  :-(
there is some conflict with mod for image text overlaying (http://www.4homepages.de/forum/index.php?topic=29572.0

Ajax Star rating works well but overlay text dont apear over image...
if I remove from detail.html
Code: [Select]
<script type="text/javascript" src="scripts/ajaxrating.js"></script>overlaing works (but ajax stars of course not)

same suggestion? can you help?

edit:
error message from FF console:
 $("div.description") is null @ ....../details.php?image_id=5:63

Code: [Select]
<script type="text/javascript">
$(window).load(function(){
//for each description div...
$('div.description').each(function(){
//...set the opacity to 0...
$(this).css('opacity', 0);
//..set width same as the image...
$(this).css('width', $(this).siblings('img').width());
//...get the parent (the wrapper) and set it's width same as the image width... '
$(this).parent().css('width', $(this).siblings('img').width());
//...set the display to block
$(this).css('display', 'block');
});

$('div.wrapper').hover(function(){
//when mouse hover over the wrapper div
//get it's children elements with class descriptio
//and show it using fadeTo
$(this).children('.description').stop().fadeTo(500, 0.7);
},function(){
//when mouse out of the wrapper div
//use fadeTo to hide the div
$(this).children('.description').stop().fadeTo(500, 0);
});

});
</script>

Pages: [1]