» Xtgem Coding Help » View post
<!--parser:xtscript-->
# Get the search query
get search
# Trim any spaces
var $search = call trim $val=$search
# No search query
if not $search
var $disable_js = //
goto @skip_1
endif
# Search query length check
var $len = call strlen $val=$search
if $len < 2
del $search
var $disable_js = //
print <b>Search query too short min 2 chars</b> <br />
goto @skip_1
endif
# Search query health check
# uncomment the next 3 lines to ban wildcards and negation in the search query
# var $neg = call strpos $haystack=#$search;$needle=-
# var $star = call strpos $haystack=#$search;$needle=*
# var $query = call strpos $haystack=#$search;$needle=?
var $dquot = call strpos $haystack=#$search;$needle="
var $squot = call strpos $haystack=#$search;$needle='
if $star or $query or $dquot or $squot or $neg==1
del $search
var $disable_js = //
print <b>Search query contains invalid chars</b> <br />
goto @skip_1
endif
# Set up the search
# Check for "anywhere"
get anywhere
if $anywhere
var $checked = checked="checked"
var $any = *
endif
# Filelist template that creates a javascript array
var $template = ['.file_name_parsed.','.file_url.','.file_size.','.file_datetime.','.file_mime.','.file_type.'],
# Filelist parameters
var $params = template="$template" filter="$any$search*" per_page="0"
# Filelist patterns
var $list1 = xt:filelist folder="/2go/2gov5" $params
var $list2 = xt:filelist folder="/2go/2gov4" $params
var $list3 = xt:filelist folder="/2go/2gov3" $params
var $list4 = xt:filelist folder="/2go/2gov6" $params
var $list5 = xt:filelist folder="/2go/2gomusics" $params
var $list6 = xt:filelist folder="/Games/128x128" $params
var $list7 = xt:filelist folder="/Games/128x160" $params
var $list8 = xt:filelist folder="/Games/240x320" $params
var $list9 = xt:filelist folder="/Games/320x240" $params
var $list10 = xt:filelist folder="/Games/Android" $params
var $list11 = xt:filelist folder="/Apps/Android" $params
var $list12 = xt:filelist folder="/Apps/Java" $params
var $list13 = xt:filelist folder="/Apps/Modding" $params
var $list14 = xt:filelist folder="/Apps/Browsing" $params
var $list15 = xt:filelist folder="/Musics/Upcoming" $params
var $list16 = xt:filelist folder="/Musics/9jahippop" $params
var $list17 = xt:filelist folder="/Themes/Nokia_S40" $params
var $list18 = xt:filelist folder="/Themes/Nokia_S60" $params
var $list19 = xt:filelist folder="/Themes/SonyEricsson" $params
var $list20 = xt:filelist folder="/Images/Animations/Xmas" $params
# Dummy array entry to use up the last , in the filelist template
var $dummy = ['dummy']
# skip_1 landing point
@skip_1
# The search form
print {{
<center><div class="search_form" id="srch"><div class="zxfourborder" style="align:center"
id="srch">
<form action="<xt:url/>#srch" method="post">
<input type="search" name="search" value="$search" pattern=".{2,}" title="Minimum 2 characters required" placeholder="Enter search query"/>
<input type="submit" value="Search" /><br />
<label></label>Anywhere in filename <input type="checkbox" name="anywhere" value="1" checked="checked" />
</form></div></div></center>}}
# The actual filelist functions are created outside the xtscript to avoid timeouts
# Create an array of the filelist arrays
<!--/parser:xtscript-->
<script type="text/javascript">
// Results array
{_$$disable_js|}var list=[<{_$$list1|}><{_$$list2|}><{_$$list3|}><{_$$list4|}><{_$$list5|}><{_$$list6|}><{_$$list7|}><{_$$list8|}><{_$$list9|}><{_$$list10|}><{_$$list11|}><{_$$list12|}><{_$$list13|}><{_$$list14|}><{_$$list15|}><{_$$list16|}><{_$$list17|}><{_$$list18|}><{_$$list19|}><{_$$list20|}>{_$$dummy|}];
<!--parser:xtscript-->
if $search
# Get page number
get_or_default results_page;0
# Results per page
var $per_page=10
# Create javascript
print {{list.length=list.length-1;
var length=list.length;
if (length){
var total_pages=Math.floor(}}
print {{list.length/$per_page);
var results_page=$results_page;
var search='$search';
var per_page=$per_page}}
print_raw {{;
var offset=(results_page*per_page);
var page_end=(offset + per_page);
if (page_end >= length)page_end=length;
// Output results
list.sort();
document.write('<div class="zxfourborder">');
if (length >= 1)document.write('<div class="zxfourborder" style="text-align:left">'+(offset+1)+' to '+page_end+' of ');
document.write( length+' Result');
if (length > 1) document.write('s');
document.write(' For "<span> '+search+' </span>"</div>');
var baze='http://weezywap.xtgem.com/';
for(i=offset;i < page_end;i++){
document.write('<div class="full" style="background:url('+baze+'/B/Bg/download.png);">\
<table cellspacing="0"><tr style="text-align:center"><td align="left">');
lastDot = list[i][0].lastIndexOf('.') ;
if (lastDot > 0){
ext= list[i][0].slice(lastDot+1);
document.write('<img src="'+baze+'/images/mimes/'+ext+'.png" alt="'+list[i][0]+'" class="ico" width="47px" height="50px" />');}
document.write('</td><td align="left"><img src="'+baze+'/images/rating.gif" /><br/><b>Name:</b><font color="green"> '+list[i][0]+'</font><br/><b>Size:</b> '+list[i][2]+'<br/>• <a href="/download?file='+list[i][5]+'&name='+list[i][0]+'&type='+list[i][4]+'&size='+list[i][2]+'&ext='+list[i][6]+'&link='+list[i][1]+'&date='+list[i][7]+'&time='+list[i][8]+'"><b>Download</b></a></td></tr></table></div><hr style="border: 1px dotted red;"/>');}
}}
# Pagination
var $common_part = document.write('<form style="display:inline" action="<xt:url />#srch" method="post"><input type="hidden" name="search" value="$search" /><input type="hidden" name="anywhere" value="$anywhere" /><input type="hidden" name="results_page" value="'+(results_page
print_raw {{
if (length > per_page){
document.write('<div class="pagination">');
if (offset > per_page){}}
print $common_part
print_raw {{-2)+'" /><span><input type="submit" value="'+(results_page-1)+'" /></span></form>');}
if (offset){}}
print $common_part
print_raw {{-1)+'" /><span><input type="submit" value="'+results_page+'" /></span></form>');}
document.write('<form style="display:inline"><span><input type="button" value="'+(results_page+1)+'" /></span></form>');
if (page_end < length){}}
print $common_part
print_raw {{+1)+'" /><span><input type="submit" value="'+(results_page+2)+'" /></span></form>');}
if (page_end < (length-per_page)){}}
print $common_part
print_raw {{+2)+'" /><span><input type="submit" value="'+(results_page+3)+'" /></span></form>');}
document.write('</div>');}
document.write('</div>');}}
# No search results
print } else {document.write('<div class="zxfourborder"> No results for "<b>$search</b>"
print ;</div>');}
endif
<!--/parser:xtscript-->
</script>
Copy code
# Get the search query
get search
# Trim any spaces
var $search = call trim $val=$search
# No search query
if not $search
var $disable_js = //
goto @skip_1
endif
# Search query length check
var $len = call strlen $val=$search
if $len < 2
del $search
var $disable_js = //
print <b>Search query too short min 2 chars</b> <br />
goto @skip_1
endif
# Search query health check
# uncomment the next 3 lines to ban wildcards and negation in the search query
# var $neg = call strpos $haystack=#$search;$needle=-
# var $star = call strpos $haystack=#$search;$needle=*
# var $query = call strpos $haystack=#$search;$needle=?
var $dquot = call strpos $haystack=#$search;$needle="
var $squot = call strpos $haystack=#$search;$needle='
if $star or $query or $dquot or $squot or $neg==1
del $search
var $disable_js = //
print <b>Search query contains invalid chars</b> <br />
goto @skip_1
endif
# Set up the search
# Check for "anywhere"
get anywhere
if $anywhere
var $checked = checked="checked"
var $any = *
endif
# Filelist template that creates a javascript array
var $template = ['.file_name_parsed.','.file_url.','.file_size.','.file_datetime.','.file_mime.','.file_type.'],
# Filelist parameters
var $params = template="$template" filter="$any$search*" per_page="0"
# Filelist patterns
var $list1 = xt:filelist folder="/2go/2gov5" $params
var $list2 = xt:filelist folder="/2go/2gov4" $params
var $list3 = xt:filelist folder="/2go/2gov3" $params
var $list4 = xt:filelist folder="/2go/2gov6" $params
var $list5 = xt:filelist folder="/2go/2gomusics" $params
var $list6 = xt:filelist folder="/Games/128x128" $params
var $list7 = xt:filelist folder="/Games/128x160" $params
var $list8 = xt:filelist folder="/Games/240x320" $params
var $list9 = xt:filelist folder="/Games/320x240" $params
var $list10 = xt:filelist folder="/Games/Android" $params
var $list11 = xt:filelist folder="/Apps/Android" $params
var $list12 = xt:filelist folder="/Apps/Java" $params
var $list13 = xt:filelist folder="/Apps/Modding" $params
var $list14 = xt:filelist folder="/Apps/Browsing" $params
var $list15 = xt:filelist folder="/Musics/Upcoming" $params
var $list16 = xt:filelist folder="/Musics/9jahippop" $params
var $list17 = xt:filelist folder="/Themes/Nokia_S40" $params
var $list18 = xt:filelist folder="/Themes/Nokia_S60" $params
var $list19 = xt:filelist folder="/Themes/SonyEricsson" $params
var $list20 = xt:filelist folder="/Images/Animations/Xmas" $params
# Dummy array entry to use up the last , in the filelist template
var $dummy = ['dummy']
# skip_1 landing point
@skip_1
# The search form
print {{
<center><div class="search_form" id="srch"><div class="zxfourborder" style="align:center"
id="srch">
<form action="<xt:url/>#srch" method="post">
<input type="search" name="search" value="$search" pattern=".{2,}" title="Minimum 2 characters required" placeholder="Enter search query"/>
<input type="submit" value="Search" /><br />
<label></label>Anywhere in filename <input type="checkbox" name="anywhere" value="1" checked="checked" />
</form></div></div></center>}}
# The actual filelist functions are created outside the xtscript to avoid timeouts
# Create an array of the filelist arrays
<!--/parser:xtscript-->
<script type="text/javascript">
// Results array
{_$$disable_js|}var list=[<{_$$list1|}><{_$$list2|}><{_$$list3|}><{_$$list4|}><{_$$list5|}><{_$$list6|}><{_$$list7|}><{_$$list8|}><{_$$list9|}><{_$$list10|}><{_$$list11|}><{_$$list12|}><{_$$list13|}><{_$$list14|}><{_$$list15|}><{_$$list16|}><{_$$list17|}><{_$$list18|}><{_$$list19|}><{_$$list20|}>{_$$dummy|}];
<!--parser:xtscript-->
if $search
# Get page number
get_or_default results_page;0
# Results per page
var $per_page=10
# Create javascript
print {{list.length=list.length-1;
var length=list.length;
if (length){
var total_pages=Math.floor(}}
print {{list.length/$per_page);
var results_page=$results_page;
var search='$search';
var per_page=$per_page}}
print_raw {{;
var offset=(results_page*per_page);
var page_end=(offset + per_page);
if (page_end >= length)page_end=length;
// Output results
list.sort();
document.write('<div class="zxfourborder">');
if (length >= 1)document.write('<div class="zxfourborder" style="text-align:left">'+(offset+1)+' to '+page_end+' of ');
document.write( length+' Result');
if (length > 1) document.write('s');
document.write(' For "<span> '+search+' </span>"</div>');
var baze='http://weezywap.xtgem.com/';
for(i=offset;i < page_end;i++){
document.write('<div class="full" style="background:url('+baze+'/B/Bg/download.png);">\
<table cellspacing="0"><tr style="text-align:center"><td align="left">');
lastDot = list[i][0].lastIndexOf('.') ;
if (lastDot > 0){
ext= list[i][0].slice(lastDot+1);
document.write('<img src="'+baze+'/images/mimes/'+ext+'.png" alt="'+list[i][0]+'" class="ico" width="47px" height="50px" />');}
document.write('</td><td align="left"><img src="'+baze+'/images/rating.gif" /><br/><b>Name:</b><font color="green"> '+list[i][0]+'</font><br/><b>Size:</b> '+list[i][2]+'<br/>• <a href="/download?file='+list[i][5]+'&name='+list[i][0]+'&type='+list[i][4]+'&size='+list[i][2]+'&ext='+list[i][6]+'&link='+list[i][1]+'&date='+list[i][7]+'&time='+list[i][8]+'"><b>Download</b></a></td></tr></table></div><hr style="border: 1px dotted red;"/>');}
}}
# Pagination
var $common_part = document.write('<form style="display:inline" action="<xt:url />#srch" method="post"><input type="hidden" name="search" value="$search" /><input type="hidden" name="anywhere" value="$anywhere" /><input type="hidden" name="results_page" value="'+(results_page
print_raw {{
if (length > per_page){
document.write('<div class="pagination">');
if (offset > per_page){}}
print $common_part
print_raw {{-2)+'" /><span><input type="submit" value="'+(results_page-1)+'" /></span></form>');}
if (offset){}}
print $common_part
print_raw {{-1)+'" /><span><input type="submit" value="'+results_page+'" /></span></form>');}
document.write('<form style="display:inline"><span><input type="button" value="'+(results_page+1)+'" /></span></form>');
if (page_end < length){}}
print $common_part
print_raw {{+1)+'" /><span><input type="submit" value="'+(results_page+2)+'" /></span></form>');}
if (page_end < (length-per_page)){}}
print $common_part
print_raw {{+2)+'" /><span><input type="submit" value="'+(results_page+3)+'" /></span></form>');}
document.write('</div>');}
document.write('</div>');}}
# No search results
print } else {document.write('<div class="zxfourborder"> No results for "<b>$search</b>"
print ;</div>');}
endif
<!--/parser:xtscript-->
</script>
Copy code
» Xtgem Coding Help » View post
Guests: 1
zf_mackie (Admin)