Project

General

Profile

Actions

Feature proposal #1895

closed

Add new substitutions for CB

Added by nant over 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
21 July 2010
Due date:
% Done:

100%

Estimated time:
2:00 h

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

1895.patch (3.66 KB) 1895.patch krileon, 02 February 2011 20:55
1895-rev2.patch (2.82 KB) 1895-rev2.patch krileon, 09 February 2011 14:49
1895-rev3.patch (3.38 KB) 1895-rev3.patch krileon, 09 February 2011 16:33
1895-rev4.patch (3.69 KB) 1895-rev4.patch krileon, 09 February 2011 18:32

Related issues 2 (0 open2 closed)

Related to CB - Feature proposal #2279: CB Substitutions: add default, output, formatting, reason options for fields and tabClosedbeat02 February 2011

Actions
Has duplicate CB - Feature proposal #2297: Add [DATE] substitution functionalityRejected05 February 2011

Actions
Actions #1

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.

Actions #2

Updated by beat almost 14 years ago

  • Estimated time set to 2:00 h
Actions #3

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:

  1. 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
  2. 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;
    
  3. thus no need to rename existing sub-keywords
  4. we need to review main keywords. [cb:vardate is not a variable, same for varurl and varconfig)
  5. limiting to a known set is a good idea.

Please review patch and propose a new one.

Actions #4

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.

Actions #5

Updated by krileon almost 14 years ago

Rev3 is with #2279 implemented (current SVN).

Actions #6

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

Actions #7

Updated by krileon almost 14 years ago

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" /]

Actions #8

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.

Actions

Also available in: Atom PDF