XFileSharing Pro - <TMPL_VAR thumb_url>

Message
Author
flowcubano
Posts: 25
Joined: Dec 15, 2010 12:26 am

<TMPL_VAR thumb_url>

#1 Postby flowcubano » Sep 19, 2012 7:20 pm

Hello,

How can I use this code "<TMPL_VAR image_url> <TMPL_VAR thumb_url>"

In this template: my_files.html

It only work here: download1.html

Thanks!

afdah
Posts: 147
Joined: Jan 27, 2012 2:23 pm

#2 Postby afdah » Sep 20, 2012 12:21 am

you need a perl coder to take a look at index.cgi
sub MyFiles is where he need to add the variables

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#3 Postby trinsic » Sep 20, 2012 1:52 am

Alright my free piece of code for the day.

The video variables are located in index_dl.pm line 609-637.

The two important lines are:

Code: Select all

      $file->{video_img_url}="$1/i/$dx/$file->{file_real}.jpg";
      $file->{video_thumb_url}="$1/i/$dx/$file->{file_real}_t.jpg";
Take whatever other variables you need like vid_height, vid_width. They're optional as you don't need these and can hard set them in your template (default is 400x300).

In index.cgi go to line 2934

Code: Select all

      $files = $db->SelectARef("SELECT f.*, DATE(f.file_created) as created, 
                                (SELECT COUNT(*) FROM Comments WHERE cmt_type=1 AND file_id=cmt_ext_id) as comments
                                FROM Files f 
                                WHERE f.usr_id=? 
                                AND f.file_fld_id=? 
                                ".&makeSortSQLcode($f,'file_created').$ses->makePagingSQLSuffix($f->{page}),$ses->getUserId,$f->{fld_id});
and replace with:

Code: Select all

      $files = $db->SelectARef("SELECT f.*, DATE(f.file_created) as created, s.srv_htdocs_url,
                                (SELECT COUNT(*) FROM Comments WHERE cmt_type=1 AND file_id=cmt_ext_id) as comments
                                FROM Files f, Servers s
                                WHERE f.usr_id=? 
                                AND f.file_fld_id=? 
                                AND f.srv_id=s.srv_id
                                ".&makeSortSQLcode($f,'file_created').$ses->makePagingSQLSuffix($f->{page}),$ses->getUserId,$f->{fld_id});

Go to line 2973:

Code: Select all

      $_->{comments}||='';

Underneath it add:

Code: Select all

      if( ($c->{m_v} && $_->{file_name}=~/\.(avi|divx|flv|mp4|wmv|mkv)$/i) )
      {
         my $iurl = $_->{srv_htdocs_url};
         $iurl=~s/^(.+)\/.+$/$1\/i/;
         my $dx = sprintf("%05d",($_->{file_real_id}||$_->{file_id})/$c->{files_per_folder});
         $_->{video_img_url}="$iurl/$dx/$_->{file_real}.jpg";
         $_->{video_thumb_url}="$iurl/$dx/$_->{file_real}_t.jpg";     
      }
Congratulations, you've now got template variables video_img_url and video_thumb_url available in my_files. I've tested this as working.

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#4 Postby trinsic » Sep 20, 2012 1:57 am

Because the forum stuffed up the formatting I recommend copying the code from here: http://pastebin.com/raw.php?i=yB0Q20QC

afdah
Posts: 147
Joined: Jan 27, 2012 2:23 pm

#5 Postby afdah » Sep 20, 2012 2:02 am

cool. any idea how to add solvemedia captcha?

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#6 Postby trinsic » Sep 20, 2012 2:06 am

afdah wrote:cool. any idea how to add solvemedia captcha?
Sorry I can't do anything about solve media till they accept me. I signed up last week and have heard nothing. Which is rather strange as I own a high rank file host with good traffic. I may give them an email/call just to see what's up with my application.

afdah
Posts: 147
Joined: Jan 27, 2012 2:23 pm

#7 Postby afdah » Sep 20, 2012 2:16 am

trinsic wrote:
afdah wrote:cool. any idea how to add solvemedia captcha?
Sorry I can't do anything about solve media till they accept me. I signed up last week and have heard nothing. Which is rather strange as I own a high rank file host with good traffic. I may give them an email/call just to see what's up with my application.
i signed up last week too and use their php library to power up my other site. i heard nothing from them too. within 24hours after my site send them traffic, then i can see my dashboard with the statistics.

flowcubano
Posts: 25
Joined: Dec 15, 2010 12:26 am

#8 Postby flowcubano » Sep 20, 2012 7:47 am

Thank you for share it,
but I mean the imagen mod not the video mod but I think it is the same thing.

afdah
Posts: 147
Joined: Jan 27, 2012 2:23 pm

#9 Postby afdah » Sep 20, 2012 2:49 pm

trinsic wrote:
afdah wrote:cool. any idea how to add solvemedia captcha?
Sorry I can't do anything about solve media till they accept me. I signed up last week and have heard nothing. Which is rather strange as I own a high rank file host with good traffic. I may give them an email/call just to see what's up with my application.
i purposely choose recaptcha and remove recaptcha modules.
this is the error i get.
we need to edit session.pm which is encrypted. in other word, only sibsoft can add solvemedia captcha correctly.

Can't locate Captcha/reCAPTCHA.pm in @INC (@INC contains: Plugins Modules . /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at Modules/Session.pm line 749.

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#10 Postby trinsic » Sep 20, 2012 10:23 pm

I'll have a look at it today.
flowcubano wrote:Thank you for share it,
but I mean the imagen mod not the video mod but I think it is the same thing.
I'll do that later today.

trinsic
Posts: 149
Joined: Dec 21, 2009 9:24 am

#11 Postby trinsic » Sep 22, 2012 12:10 am

Looks like you're right about image mod and video mod being the same which is good.

If you only want image mod use:

Code: Select all

      if( ($c->{m_i} && $_->{file_name}=~/\.(jpg|jpeg|gif|png|bmp)$/i )
If you only want video mod use:

Code: Select all

      if( ($c->{m_v} && $_->{file_name}=~/\.(avi|divx|flv|mp4|wmv|mkv)$/i) )
If you want both use:

Code: Select all

      if( ($c->{m_i} && $_->{file_name}=~/\.(jpg|jpeg|gif|png|bmp)$/i )
          || ($c->{m_v} && $_->{file_name}=~/\.(avi|divx|flv|mp4|wmv|mkv)$/i) )

alexalex
Posts: 5
Joined: Sep 26, 2012 12:37 pm

News on homepage

#12 Postby alexalex » Sep 26, 2012 12:39 pm

Hey man,

I followed this thread, hoping it my provide me with some clues on how to add news on the homepage, But couldn't figure it out.

Would be highly appreciated if you've already done so - or you can assist on how to bring those variables on to homepage so I can use the TMPL tag associated with news page.

Thanks a lot in advance! :)