vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   New Posting Features - Maximum Embedded Image (File) Size Restriction by BOP5 (https://vborg.vbsupport.ru/showthread.php?t=281600)

Acido 11-19-2012 04:56 PM

I'm not sure why, but the function that you are using doesn't work right on my server.

I solve the issue changing the function getSizeFileBOP by this one:

PHP Code:

function remotefsize($url) {
        
$sch parse_url($urlPHP_URL_SCHEME);
        if ((
$sch != "http") && ($sch != "https") && ($sch != "ftp") && ($sch != "ftps")) {
            return 
false;
        }
        if ((
$sch == "http") || ($sch == "https")) {
            
$headers get_headers($url1);
            if ((!
array_key_exists("Content-Length"$headers))) { return false; }
            return 
$headers["Content-Length"];
        }
        if ((
$sch == "ftp") || ($sch == "ftps")) {
            
$server parse_url($urlPHP_URL_HOST);
            
$port parse_url($urlPHP_URL_PORT);
            
$path parse_url($urlPHP_URL_PATH);
            
$user parse_url($urlPHP_URL_USER);
            
$pass parse_url($urlPHP_URL_PASS);
            if ((!
$server) || (!$path)) { return false; }
            if (!
$port) { $port 21; }
            if (!
$user) { $user "anonymous"; }
            if (!
$pass) { $pass "phpos@"; }
            switch (
$sch) {
                case 
"ftp":
                    
$ftpid ftp_connect($server$port);
                    break;
                case 
"ftps":
                    
$ftpid ftp_ssl_connect($server$port);
                    break;
            }
            if (!
$ftpid) { return false; }
            
$login ftp_login($ftpid$user$pass);
            if (!
$login) { return false; }
            
$ftpsize ftp_size($ftpid$path);
            
ftp_close($ftpid);
            if (
$ftpsize == -1) { return false; }
            return 
$ftpsize;
        }
    } 

It's also posted on http://php.net/manual/en/function.filesize.php

Using that function this add-on works perfect on my installation. Hope it help.

datoneer 07-22-2013 02:04 PM

Thanks BOP5 you're the best


All times are GMT. The time now is 03:30 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01215 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete