Feature proposal #1895
closedAdd new substitutions for CB
Description
[7:45:55 μμ] Kyle (krileon): i think CB it self should have the substitutions built in
[7:46:05 μμ] Kyle (krileon): for like live_site, absolute_path, sitename, my_id, etc...
[7:46:23 μμ] Kyle (krileon): so anywhere substitutions can be used, so could that.. would be a good feature
and as explained here:
http://www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/id,138354/catid,88/
Files
Updated by krileon almost 14 years ago
- File 1895.patch 1895.patch added
- Status changed from New to Resolved
- Assignee set to beat
- Target version set to CB 1.4.0
- % Done changed from 0 to 100
Added new evaluate function for vars. Usage example as follows.
[cb:vardate date="Y-m-d" /]
[cb:varurl url="profile_view" /]
[cb:varconfig config="sitename" /]
Allows you to use substitutions to return a formatted Date based off current datetime. Also allows returned of API prepared URLs for easy HTML usage instead of having to manually type the URL into your content (wouldn't be dynamic if say itemid changed, this fixes that). Also allows obtaining of configuration variables like sitename, live_site, absolute_path, etc (not a security vulnerability as config variables possible are only basic info like sitename, live_site, absolute_path, language, new usertype so you can not get password or say ftp_host)..
If using URL to obtain a userlist you can also supply list="ID". In addition user="" is also supported so profile_view and profile_edit URLs can be specific to the user specified.
Updated by beat almost 14 years ago
- Status changed from Resolved to Assigned
- Assignee changed from beat to krileon
- % Done changed from 100 to 70
Kyle,
Thanks, but patch needs refinement:
- the addition should be implemented as a sub-function of existing _evaluateCbTags() with preg_match already done. Adding yet another preg_match will just slow down unneededly all CB output
- the switch can be written much more compact by using $input2 after the filter of the switch cases... e.g.:
switch ( $input[2] ) { case 'login': case 'logout': case 'register': //... more cases return $_CB_framework->viewUrl( $input[2], false ); break;
- thus no need to rename existing sub-keywords
- we need to review main keywords. [cb:vardate is not a variable, same for varurl and varconfig)
- limiting to a known set is a good idea.
Please review patch and propose a new one.
Updated by krileon almost 14 years ago
- File 1895-rev2.patch 1895-rev2.patch added
- Status changed from Assigned to Resolved
- Assignee changed from krileon to beat
- % Done changed from 70 to 100
New patch is more compact and just extends existing CB fields evaluation (no re-matching).
When reviewing #2279 changes will need to be made as the two will conflict as both change the REGEX for the matching. Minor adjustments would be needed. Can provide a new patch for #2279 if this one is applied first or if #2279 is applied first can provide a new patch for this ticket.
Updated by krileon almost 14 years ago
- File 1895-rev3.patch 1895-rev3.patch added
Rev3 is with #2279 implemented (current SVN).
Updated by beat almost 14 years ago
- Status changed from Resolved to Assigned
- Assignee changed from beat to krileon
one more iteration needed as just discussed
Updated by krileon almost 14 years ago
- File 1895-rev4.patch 1895-rev4.patch added
- Status changed from Assigned to Resolved
- Assignee changed from krileon to beat
Usages as follows with rev4.
[cb:userdata field="name" /]
[cb:userdata field="name" user="62" default="UNKOWN" /]
[cb:userdata field="name" user="62" default="UNKOWN" output="html" /]
[cb:userdata field="name" user="62" default="UNKOWN" output="html" formatting="none" /]
[cb:userdata field="name" user="62" default="UNKOWN" output="html" formatting="none" reason="list" /]
[cb:userfield field="username" /]
[cb:date format="Y-m-d" /]
[cb:url location="login" /]
[cb:config param="lang" /]
Updated by beat almost 14 years ago
- Status changed from Resolved to Closed
Committed into r1427 with a few optimizations and also removed potentially information-disclosing configs absolute_path and newusertype.