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

Pages: 1 2 3 [4] 5 6 7 8 ... 29
46
Do you have any temporary solution how to fix that problem?

Maybe I should check if image is smaller then minimum size, then don't skip auto resize, if not smaller then check auto resize?

Code: [Select]
    if ($this->auto_image[$this->image_type] && $this->image_size[0] > $this->max_width[$this->image_type] && $this->image_size[1] > $this->min_height[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }

47
@v@no: are you sure that step Step 2.2b   is correct?

Lets look at check_image_size with install mod Auto iamge resize and Min. width...:

Code: [Select]
  function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
     if ($this->auto_image[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }
    $ok = 1;
    if ($this->image_size[0] < $this->min_width[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_width_min']);
    }

    if ($this->image_size[1] < $this->min_height[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_height_min']);
    }
    if ($this->auto_image[$this->image_type] == 1) {
       return $ok;
    }
    if ($this->image_size[0] > $this->max_width[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_width']);
    }

    if ($this->image_size[1] > $this->max_height[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_height']);
    }
    return $ok;
  }

So if mod auto image resize is active it will return 1 even if image is smaller then minimun width in config.

Am I wrong?  :?

48
Mods & Plugins (Releases & Support) / Re: [MOD] Last comments v1.2.0
« on: February 01, 2010, 08:03:36 AM »
@v@no: I just ran your sql sentence and I get this result:

Code: [Select]
# Query_time: 9  Lock_time: 0  Rows_sent: 10  Rows_examined: 730943
SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, u.user_name as user_name, s.user_name as comment_user_name
        FROM 4images_comments c
        LEFT JOIN 4images_images i ON i.image_id = c.image_id
        LEFT JOIN 4images_users u ON u.user_id = i.user_id
        LEFT JOIN 4images_users s ON s.user_id = c.user_id
        WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN (0) AND i.cat_id NOT IN (0) AND i.cat_id NOT IN (0)
        ORDER BY c.comment_date DESC
        LIMIT 0, 10;

What bothers me? Rows_examined: 730943

Do you have any solution for this kind of problem?


49
Mods & Plugins (Releases & Support) / Re: [Mod] Star Rating
« on: November 25, 2009, 07:32:38 AM »
Can someone modify this script so, that I don't have to use the dropdown to rate an image but instead can click on the stars itself?... maybe also with a mouse-over event highlighting the star that the user is about to pick? For a rating with 5 stars, this would reuire 5 seperate stars with 3 conditions.... active / not active and highlighted... This way I can combine showing the rating and the rating process itself into one simple line, just showing the 5 stars.... Would be cool...

Anyone ever tried this?

the only other mode (AJAX rating) rates images in non-rounded figures... most of the users need 1,2,3,4,5... and that's it) therefore this mod would be great if implemented like I quoted above.

I presume that you are looking something like this:
http://orkans-tmp.22web.net/star_rating/

I've implented this is my gallery, but if you look at that code (link above) you'll see that this is not so hard to do ;)

50
Mods & Plugins (Requests & Discussions) / [MOD REQ] User Activity
« on: November 11, 2009, 09:13:34 AM »
For drupal platform I've found interesting mod called activity.
Quote
The Activity module keeps track of the things people do on your site and provides mini-feeds of these activities in blocks, in a specialized table, and via RSS. The module is extensible so that any other module can integrate with it. The messages that are produced are customizable via the admin interface and are context sensitive.

Url: http://drupal.org/project/activity

I'm aware that integrating such mod in 4images system would take some time, but since this looks like very interesting mod, it's worth to.

Is anyone willing to give it a shot?  :roll:

51
In my gallery I've integrated jQuery plugin: Validation, which isn't so hard to do:

http://bassistance.de/jquery-plugins/jquery-plugin-validation/


You can check how it's working in my gallery:
http://www.slo-foto.net/modules.php?name=Galerija&file=register

52
I must say that even I am little surprised how effective is this modification, couse since I've install it none of bad bots have registered in my gallery  :mrgreen:

53
Did anyone tried to add invitation function (like Facebook), where you send invitation by email and when that person register, it will automatically added to your buddy list?

54
in 4images do not use $_GET/$_POST, unless absolutely necessary and unless your code does filtering these inputs by itself. Otherwise use $HTTP_GET_VARS instead.

And I'm curious, how will that code handle words that using non-latin charset?

I alway forgot to use $HTTP_GET_VARS insted of $_GET :) I'll fix that...

Otherwise I have no clue how will this work on non-latin charset - I haven't include this yet in my gallery, but if someone has installed test version of 4images gallery can check this out.

55
It's working, check this again:
Code: [Select]
function checkspammers($input,$inputtype='email'){
    //Load the file, and implode the array.
    $xml = implode('',file("http://www.stopforumspam.com/api?".$inputtype."=".$input));

inputtype is email, so api will check email insted of IP.

56
Okey, here we go, but I must warn you that this is BETA MOD and it should be tested by someone who knows what he's doing :)

1. Open member_uploadform.html in your templates folder:

change:
Code: [Select]
<textarea cols="30" class="textarea" rows="10" wrap="VIRTUAL" name="image_keywords">{image_keywords}</textarea>
to:
Code: [Select]
<textarea cols="30" class="textarea" rows="10" wrap="VIRTUAL" name="image_keywords" id="image_keywords">{image_keywords}</textarea>
if its not working try this:
Code: [Select]
<input type="text" name="image_keywords" id="image_keywords" />
2. Open header.html

after:
Code: [Select]
<link rel="stylesheet" href="{template_url}/style.css" />
add:
Code: [Select]
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="tag.js"></script>
<script type="text/javascript">
<!--
$(function () {

$('#image_keywords').tagSuggest({
url: '{url_tags}',
delay: 250
});
});
//-->
</script>
    <style type="text/css" media="screen">
    <!--
      SPAN.tagMatches {
          margin-left: 10px;
      }
      
      SPAN.tagMatches SPAN {
          padding: 2px;
          margin-right: 4px;
          background-color: #0000AB;
          color: #fff;
          cursor: pointer;
      }
      
      PRE {
          background: #ddd;
          font-family: Courier;
          padding: 5px;
          overflow: auto;
      }
    -->
    </style>

3. Open includes/page_header.php and

after
Code: [Select]
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
add
Code: [Select]
"url_tags" => $site_sess->url(ROOT_PATH."tags.php"),
4. Create new file tags.php and upload it to root folder of your 4images gallery:
Code: [Select]
<?php
$main_template 
0;
$nozip 1;
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
include(
ROOT_PATH.'includes/search_utils.php');

$tag = isset($HTTP_GET_VARS['tag']) ? un_htmlspecialchars(trim($HTTP_GET_VARS['tag'])) : "";
$tag strip_tags(trim($tag));
$tag convert_special($tag);
$tag str_replace("%"""$tag);
if (
$tag !== "") {
  
$sql "SELECT DISTINCT i.word_text
          FROM 4images_wordlist i
          LEFT JOIN 4images_wordmatch c ON i.word_id = c.word_id
          WHERE c.keys_match >= 0 AND i.word_text LIKE '"
.$tag."%'
          ORDER BY RAND()
          LIMIT 5"
;
  
$result $site_db->query($sql);
  echo 
'[';
  while (
$row $site_db->fetch_array($result))
  {
    if (isset(
$word_text))
      echo 
",";
    
$word_text $n str_replace('"''&quot;'$row['word_text']);
    echo 
'"'.$word_text.'"';
  }
  echo 
']';
}
?>

5. Download file:
http://remysharp.com/downloads/tag.js

And upload it to your root directory.

I hope that's all, test it and let me know if it's working...

[EDIT by V@no]
fixed error in tags.php plus added little filter and fixed wrong filename tags.js instead of tag.js in header.html

57
I found interesting website that contains database from different forum spam bots: http://www.stopforumspam.com/

I've integrated their API in 4images gallery to prevent bots to register (even thought I'm using capcha system, bots somehow managed to register).

This mod is taken from their forum so all the credit goes to author:
http://www.stopforumspam.com/forum/t598-Basic-file-read

1. Open includes/functions.php and before:
Code: [Select]
?>
add
Code: [Select]
function checkspammers($input,$inputtype='email'){
    //Load the file, and implode the array.
    $xml = implode('',file("http://www.stopforumspam.com/api?".$inputtype."=".$input));

//Start new xml parser.
    $p = xml_parser_create();
   
    //Get the xml into an array
    xml_parse_into_struct($p, $xml, $vals, $index);
   
    //Free some memory by clearing the xml parser
    xml_parser_free($p);
   
    //We don't need $index or the $xml any more
    unset($index,$xml);
   
   
    //Prepare the return array
    $return = array();
   
    //Now we are going to make the aray useable
    foreach($vals as $array){
        //If it's the opening array we can do it slightly differnetly
        if($array['type'] == 'open'){
            //Just get weather it was sucess or not.
            $return[$array['tag']] = $array['attributes']['SUCCESS'];
        }elseif($array['type'] == 'complete'){
            //Else just get the value
            $return[$array['tag']] = $array['value'];
        }
    }
   
    //Save a bit mroe memory by clearing the vals array
    unset($vals);
   
    //Now make time into a unix timestamp
    if($return['LASTSEEN']){
        //Sepparate the timestamp into the time and the date
        $time = explode(' ',$return['LASTSEEN']);
        //Sepparate the date
        $date = explode("-",$time[0]);
        //Sepparate the time
        $time = explode("-",$time[0]);
       
        //Now make the time, note we times by 1 to remove leading zeros, if we don't then php cansometimes use teh octal system instead of decimal.
        $return['UNIXLASTSEEN'] = gmmktime($time[0]*1,$time[1]*1,$time[2]*1,$date[1]*1,$date[2]*1,$date[0]*1);
    }
   
    //RESPONCE would be better as booleen, not a string
    if($return['RESPONCE'] == 'true'){ $return['RESPONCE'] = true; }else{ $return['RESPONCE'] = false; }
   
    //Now return our array.
    return $return;
}

//Example function to check in ip
function isaspammer($ip){
    //Get the xml results as an array from teh function above
    $result = checkspammers($ip);
    //Is he reported?
    if($result['FREQUENCY'] > 0 && (time() - $result['UNIXLASTSEEN']) < (3600 * 24 * 365)){
        //He is a spammer
        return true;
    }else{
        //He is not reported as a spammer
        return false;
    }
}

2. Open register.php

before:
Code: [Select]
if ($user_password == "") {
add
Code: [Select]
    if (isaspammer($user_email)) {
      $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format']; // or add anything else, bots doesn't understand nothing :)
      $error = 1;
    }

Simple as that  :wink:

PS: it's also possible to check their IP, but email check is working for me (now)

58
On web I've found interesting jquery plugin that suggest you some keywords. To understand it plz check first demo:
http://remysharp.com/wp-content/uploads/2007/12/tagging.php

I was thinking to integrated it with 4images gallery but the everytime I connect it with 4images database my server crashed.

Does anyone have idea how to implent it with database (4images_wordlist table)?

Link: http://remysharp.com/2007/12/28/jquery-tag-suggestion/

UPDATE: after searching on 4images forum I've found great idea. Comming soon ;)

59
Yup it's working just fine :) Thx!

Maybe someone should post this in topic Mods & Plugins (Releases & Support)

60
Thanks for helping me, but I think this isn't working.

Even only with impss's code it doesn't :( This one is working ;)

Can someone else please try it, maybe there is something wrong with my modificated 4images?

v@no, where should I change this:
Code: [Select]
$site_sess->login($user_name, $user_password, 0, 1, 1)
Edited:

I think this is the right one:

Code: [Select]
//Start Auto-login After Activation
    $sql = "SELECT ".get_user_table_field("", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_level")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_activationkey")." = '$activationkey'";
//End Auto-login After Activation

Code: [Select]
if ($site_sess->login($row['user_name'], $row['user_password'], 0, 1, 1)) {
Correct?

Pages: 1 2 3 [4] 5 6 7 8 ... 29