Differences

This shows you the differences between two versions of the page.

english:phpwcms_replacer_rts:frontend_render:xdownload [2010/05/21 17:46]
Knut Heermann (flip-flop)
english:phpwcms_replacer_rts:frontend_render:xdownload [2018/06/03 18:09] (current)
Line 1: Line 1:
{{indexmenu_n>20}} {{indexmenu_n>20}}
-====== xdownload by ids, tags, folder ids ======+====== [xdownload=IDs||t:ags||f:older-IDs/] ======
Download rt for files from file center. Download rt for files from file center.
Line 15: Line 15:
**E.g. v1.2:** ##%%[xdownload= t: a string tag, tag05, tag06 : template, greedy, max_count, sort_by /]%%## **E.g. v1.2:** ##%%[xdownload= t: a string tag, tag05, tag06 : template, greedy, max_count, sort_by /]%%##
 +
 +**E.g. v1.3:** ##%%[xdownload= t: a string tag, tag05, tag06 : template, operator, greedy, max_count, sort_by /]%%##
\\ \\
Line 23: Line 25:
V1.2: ##%%[xdownload= t: a string tag, tag05, tag06 : x_download_01, 1, 5, ext_asc /]%%## V1.2: ##%%[xdownload= t: a string tag, tag05, tag06 : x_download_01, 1, 5, ext_asc /]%%##
 +
 +V1.3: ##%%[xdownload= t: a string tag, tag05, tag06 : x_download_01, OR, 1, 5, ext_asc /]%%##
\\ \\
Line 31: Line 35:
\\ \\
-**Overview file infos** //(a very special filebrowser: comming soon)//: +**Overview file infos** //(a very special filebrowser: [[english/other-enhancements/backend/custom-links-in-home/filebrowserx]])//:
{{:english:phpwcms_replacer_rts:frontend_render:xdownload_filebrowser02_en_1.gif|}} {{:english:phpwcms_replacer_rts:frontend_render:xdownload_filebrowser02_en_1.gif|}}
Line 49: Line 53:
  * **Output:** template based like filelist   * **Output:** template based like filelist
  * **tag search** is "word sensitive" or "%%*all character strings*%%" [ungreedy=0|greedy=1]   * **tag search** is "word sensitive" or "%%*all character strings*%%" [ungreedy=0|greedy=1]
 +  * **logical operators** [AND|OR|NOT] if tag is selected  //(V1.3) (only important in tag mode)//
  * **max count** files are displayed [int]   * **max count** files are displayed [int]
-  * minimal **key lenght** [int]+  * minimal **key lenght** [int] //(only important in tag mode)//
  * -   * -
-  * Optional parameter input by tag: ":template name, greedy|ungreedy, max count, sort by" //(V1.2)//+  * Optional parameter input: ":template name, AND|OR|NOT, ungreedy|greedy, max count, sort by" //(V1.2/3)//
  * -   * -
  * **sort order** [string]   * **sort order** [string]
Line 95: Line 100:
**Update:** template 19.05.2010 KH: Optional lightBox feature inserted and small bugs removed\\ **Update:** template 19.05.2010 KH: Optional lightBox feature inserted and small bugs removed\\
**Update:** V 1.2 20.05.2010 KH: optional parameter input by tag **Update:** V 1.2 20.05.2010 KH: optional parameter input by tag
 +**Update:** V 1.3 21.05.2010 KH: enhanced with logical operators [AND|OR|NOT] if tag selected
   
Line 105: Line 111:
**Tag v1.2:**  \\ **Tag v1.2:**  \\
  * **%%[xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]%%**   -> selected by tags   * **%%[xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]%%**   -> selected by tags
-  * **%%[xdownload= f: id1, d2, d3 : template, greedy, max_count, sort_by /]%%**      -> selected by folder ids +  * **%%[xdownload= f: id1, d2, d3 : template, , max_count, sort_by /]%%**      -> selected by folder ids 
-  * **%%[xdownload= id1, id2, id3 : template, greedy, max_count, sort_by /]%%**       -> image ids+  * **%%[xdownload= id1, id2, id3 : template, , max_count, sort_by /]%%**       -> image ids
  * - or e.g.   * - or e.g.
  * **%%[xdownload= XX, XX, XX : template,,, sort_by /]%%**       -> image ids  //(The "template" is located in template/inc_cntpart/filelist/* with the name e.g. "template.html")// \\   * **%%[xdownload= XX, XX, XX : template,,, sort_by /]%%**       -> image ids  //(The "template" is located in template/inc_cntpart/filelist/* with the name e.g. "template.html")// \\
  * or like v1.1   * or like v1.1
 +
 +\\
 +
 +**Tag v1.3:**  \\
 +  * **%%[xdownload= t: tag1, tag2, tag3 : template, operator, greedy, max_count, sort_by /]%%**   -> selected by tags
 +  * **%%[xdownload= f: id1, d2, d3 : template, operator, , max_count, sort_by /]%%**      -> selected by folder ids
 +  * **%%[xdownload= id1, id2, id3 : template, operator, , max_count, sort_by /]%%**       -> image ids
Line 135: Line 148:
/** /**
 * *****************************************************************************  * *****************************************************************************
- * 14.05.2010 K.Heermann http://planmatrix.de+ * 14.05.2010 V1.1 K.Heermann http://planmatrix.de
 * Update 18.05.2010 V1.1: Update parsing bbcode and call lang_replace if available  * Update 18.05.2010 V1.1: Update parsing bbcode and call lang_replace if available
 *  *
Line 168: Line 181:
 *   - Copyright            = copyright  *   - Copyright            = copyright
 *  *
 + * http://www.phpwcms-howto.de/wiki/doku.php/english/phpwcms_replacer_rts/frontend_render/xdownload
 * *****************************************************************************  * *****************************************************************************
*/ */
Line 189: Line 203:
$download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*" $download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*"
- $key_lenght        = 2;                  //Min lenght of entry+ $key_lenght        = 1;                  //Min lenght of entry
$max_count         = '';                 // Max count of files $max_count         = '';                 // Max count of files
Line 465: Line 479:
/** /**
 * *****************************************************************************  * *****************************************************************************
- * 14.05.2010 K.Heermann http://planmatrix.de+ * 14.05.2010 V1.2 K.Heermann http://planmatrix.de
 * Update 18.05.2010 V1.1: Update parsing bbcode and call lang_replace if available  * Update 18.05.2010 V1.1: Update parsing bbcode and call lang_replace if available
 * Update 20.05.2010 V1.2: Update optional parameter input by tag  * Update 20.05.2010 V1.2: Update optional parameter input by tag
Line 508: Line 522:
 *   - Copyright            = copyright  *   - Copyright            = copyright
 *  *
 + * http://www.phpwcms-howto.de/wiki/doku.php/english/phpwcms_replacer_rts/frontend_render/xdownload
 * *****************************************************************************  * *****************************************************************************
*/ */
Line 537: Line 552:
$download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*" $download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*"
- $key_lenght        = 2;                  //Min lenght of entry+ $key_lenght        = 1;                  //Min lenght of entry
$max_count         = '';                 // Max count of files $max_count         = '';                 // Max count of files
Line 801: Line 816:
-===== PHP v1.2: =====+===== PHP v1.3: =====
-**Update 20.05.2010 V1.2:** optional parameter input by tag  +**Update 21.05.2010 V1.3:** enhanced with logical operators [AND|OR|NOT] if tag selected  
-  *  [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]  +  *  [xdownload= t: tag1, tag2, tag3 : template, operator, greedy, max_count, sort_by /]  
  * e.g.   * e.g.
-  * [xdownload= t: tag1, tag2, tag3 : x_download_01, 1, 5, ext_asc /] +  * [xdownload= t: tag1, tag2, tag3 : x_download_01, AND, 1, 5, ext_asc /] 
-  * tag1, tag2, tag3 : search by tag : using the template x_download_01.html, all character strings from tag, sort by file extension +  * tag1, tag2, tag3 : search by tag : using the template x_download_01.html, AND logical linked, all character strings from tag, sort by file extension
    * (In this case "x_download_01" is the name of file in template/inc_cntpart/filelist/ without an extend).     * (In this case "x_download_01" is the name of file in template/inc_cntpart/filelist/ without an extend).
\\ \\
Line 817: Line 832:
/** /**
 * *****************************************************************************  * *****************************************************************************
- * 14.05.2010 K.Heermann http://planmatrix.de + * 14.05.2010 V1.0 K.Heermann http://planmatrix.de 
- * Update 18.05.2010 V1.1: Update parsing bbcode and call lang_replace if available + * Update 18.05.2010 V1.1: parsing bbcode and call lang_replace if available 
- * Update 20.05.2010 V1.2: Update optional parameter input by tag + * Update 20.05.2010 V1.2: optional parameter input by tag
 *  + template name, greedy|ungreedy, max count, sort by  *  + template name, greedy|ungreedy, max count, sort by
 *  + e.g.:  *  + e.g.:
 *  + [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]  // tags  *  + [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]  // tags
 *  + If there is no parameter, the default values from script are catched  *  + If there is no parameter, the default values from script are catched
 + *
 + * Update 21.05.2010 V1.3: enhanced with logical operators [AND|OR|NOT] if tag selected
 + *  + e.g.:
 + *  + [xdownload= t: tag1, tag2, tag3 : template, operator, greedy, max_count, sort_by /]  // tags
 + *
 *  *
 * File download selected by Tags or image ids or filecenter folder id  * File download selected by Tags or image ids or filecenter folder id
Line 834: Line 854:
 * Tags v1.2:  * Tags v1.2:
 * - [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by/]  // tags  * - [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by/]  // tags
- * - [xdownload= f: id1, id2, id3 : template, greedy, max_count, sort_by/]     // folder ids + * - [xdownload= f: id1, id2, id3   : template,      , max_count, sort_by/]     // folder ids 
- * - [xdownload= id1, id2, id3 : template, greedy, max_count, sort_by/]        // image ids + * - [xdownload= id1, id2, id3      : template,      , max_count, sort_by/]        // image ids 
- *  + *  
 + * Tags v1.3:  
 + * - [xdownload= t: tag1, tag2, tag3 : template, operator, greedy, max_count, sort_by/] // tags 
 + * - [xdownload= f: id1, id2, id3    : template,         ,       , max_count, sort_by/]  // folder ids 
 + * - [xdownload= id1, id2, id3       : template,         ,       , max_count, sort_by/]  // image ids 
 + *
 * possible opportunities:  * possible opportunities:
 * - Output: template based like filelist  * - Output: template based like filelist
 * - tag search is "word sensitive" or "all character strings" [ungreedy|greedy]  * - tag search is "word sensitive" or "all character strings" [ungreedy|greedy]
 + * - tags search in dependence from operator [AND|OR|NOT]   // OR = default
 + * - max_count = maximum number of output
 *  *
 * - sort order  * - sort order
Line 860: Line 887:
 *   - Copyright            = copyright  *   - Copyright            = copyright
 *  *
 + * http://www.phpwcms-howto.de/wiki/doku.php/english/phpwcms_replacer_rts/frontend_render/xdownload
 * *****************************************************************************  * *****************************************************************************
*/ */
Line 884: Line 912:
// =============== CUSTOM VAR ================================================== // =============== CUSTOM VAR ==================================================
-// Tag: [xdownload= t: tag1, tag2, tag3 : template, greedy, max_count, sort_by /]+// Tag: [xdownload= t: tag1, tag2, tag3 : template, operator, greedy, max_count, sort_by /]
$download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*" $download_template = 'x_download.html';  // template in "template/inc_cntpart/filelist/*"
- $key_lenght        = 2;                  //Min lenght of entry+ $key_lenght        = 1;                  //Min lenght of entry
$max_count         = '';                 // Max count of files $max_count         = '';                 // Max count of files
Line 904: Line 932:
// copyright_asc / copyright_desc:  f_copyright -> Copyright // copyright_asc / copyright_desc:  f_copyright -> Copyright
 + $operator = 'OR';     // if tag is selected [AND|OR|NOT]  (Uppercase letter!!)
$greedy   = 1;        // [0|1]  [ungreedy|greedy] = [word sensitive | all character strings] $greedy   = 1;        // [0|1]  [ungreedy|greedy] = [word sensitive | all character strings]
Line 922: Line 951:
$download_template = (empty($cparam[0])) ? $download_template : strip_tags($cparam[0]).'.html'; $download_template = (empty($cparam[0])) ? $download_template : strip_tags($cparam[0]).'.html';
- $greedy = (empty($cparam[1])) ? $greedy : intval($cparam[1]); + $operator = (empty($cparam[1])) ? $operator : strtoupper(strip_tags($cparam[1])); 
- $max_count = (empty($cparam[2])) ? $max_count : intval($cparam[2]); + $greedy = (empty($cparam[2]) AND ($cparam[1] != '0')) ? $greedy : intval($cparam[2]); // Update 21.05.10 
- $sort_by = (empty($cparam[3])) ? $sort_by : strtolower(strip_tags($cparam[3]));+ $max_count = (empty($cparam[3])) ? $max_count : intval($cparam[3]); // Update 21.05.10 
 + $sort_by = (empty($cparam[4])) ? $sort_by : strtolower(strip_tags($cparam[4]));
} }
Line 932: Line 962:
case 't': $flag = 'tag'; case 't': $flag = 'tag';
- $key_lenght = 3;  // Min lenght of tag word+ // $key_lenght = 3;  // Min lenght of tag word
if ($greedy) { if ($greedy) {
// $where .= "f_tags LIKE '%".aporeplace($val)."%'";  // greedy // $where .= "f_tags LIKE '%".aporeplace($val)."%'";  // greedy
Line 955: Line 985:
$keywords = str_replace(";", ",", $keywords); $keywords = str_replace(";", ",", $keywords);
$keywords = str_replace("'", "", $keywords); $keywords = str_replace("'", "", $keywords);
- if (!$greedy) $keywords = str_replace(" ", ",", $keywords);+ // if (!$greedy) $keywords = str_replace(" ", ",", $keywords); // disabled 21.05.10
$keywords = str_replace(",,", ",", $keywords); $keywords = str_replace(",,", ",", $keywords);
Line 997: Line 1027:
$where = ''; $where = '';
- if ($flag =='tag') {+ if ($flag =='tag') { 
 +  
 + $first_op = ''; 
 +  
 + if (in_array($operator, array('AND','OR','NOT'))) {  // Update 21.05.10 
 +  
 + if ($operator == 'NOT') { 
 + $operator = 'AND NOT'; 
 + $first_op = 'NOT '; 
 +
 + }  
 +
foreach($keywordarray as $val) { foreach($keywordarray as $val) {
//build where keyword = blabla //build where keyword = blabla
- $where .= ($where) ? " OR " : "";+ $where .= ($where) ? " $operator " : "$first_op";
//replace every "'" to "''" for security reasons with aporeplace() //replace every "'" to "''" for security reasons with aporeplace()
Line 1137: Line 1178:
-// [xdownload= t: tag1, tag2, tag3:template,greedy,max_count,sort_by/]+// [xdownload= t: tag1, tag2, tag3:template,operator,greedy,max_count,sort_by/]
$content["all"] = preg_replace_callback('/\[xdownload=(.*?)\/\]/i', 'parse_xdownloads', $content["all"]); $content["all"] = preg_replace_callback('/\[xdownload=(.*?)\/\]/i', 'parse_xdownloads', $content["all"]);
Line 1154: Line 1195:
===== Template: ===== ===== Template: =====
-Update: 19.05.2010 KH: optional lightBox feature inserted and small bugs removed+**Update: 19.05.2010 KH:** optional lightBox feature inserted and small bugs removed
**File:** template/inc_cntpart/filelist/x_download.html **File:** template/inc_cntpart/filelist/x_download.html
english/phpwcms_replacer_rts/frontend_render/xdownload.1274456775.txt.gz · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0