{maketoc}
|
!Convert permissions
|
Global variables are deprecated and the verifyPermission function can be used to go to an error page on failure, removing duplicate code and standardising on an error page.
|
-{CODE()}if ($tiki_p_admin_cms == 'y') {{CODE}
|
+{code}if ($tiki_p_admin_cms == 'y') {{/code} |
becomes
|
-{CODE()}if ($gTikiUser->hasPermission('tiki_p_admin_cms')) {{CODE}
|
+{code}if ($gTikiUser->hasPermission('tiki_p_admin_cms')) {{/code} |
and
|
-{CODE()}if ( !$gTikiUser->hasPermission( 'tiki_p_view' )) {
|
- $smarty->assign('msg',tra("Permission denied you cannot view pages"));
|
- $gTikiSystem->display( 'error.tpl' );
|
+{code}if ( !$gTikiUser->hasPermission( 'tiki_p_view' )) { |
+ $smarty->assign('msg',tra("Permission denied you cannot view pages")); |
+ $gTikiSystem->display( 'error.tpl' ); |
die;
|
-}{CODE}
|
+}{/code} |
becomes
|
-{CODE()}$gTikiSystem->verifyPermission( 'tiki_p_view' );{CODE}
|
+{code}$gTikiSystem->verifyPermission( 'tiki_p_view' );{/code} |
|
!Convert preferences
|
Function standardisation rename.
|
-{CODE()}$gTikiSystem->get_preference("maxArticles", 10){CODE}
|
+{code}$gTikiSystem->get_preference("maxArticles", 10){/code} |
becomes
|
-{CODE()}$gTikiSystem->getPreference("maxArticles", 10){CODE}
|
+{code}$gTikiSystem->getPreference("maxArticles", 10){/code} |
|
!Convert enabled packages and features
|
Global variables are deprecated and the isPackageActive and isFeatureActive functions can be used to go to an error page on failure, removing duplicate code and standardising on an error page.
|
-{CODE()}$feature_articles{CODE}
|
+{code}if ($feature_articles == 'y') {{/code} |
becomes
|
-{CODE()}$gTikiSystem->isPackageActive( 'articles' ){CODE}
|
+{code}if ($gTikiSystem->isPackageActive( 'articles' )) {{/code} |
and
|
-{CODE()}if($feature_listPages != 'y') {
|
- $smarty->assign('msg',tra("This feature is disabled"));
|
- $gTikiSystem->display( 'error.tpl' );
|
+{code}if($feature_listPages != 'y') { |
+ $smarty->assign('msg',tra("This feature is disabled")); |
+ $gTikiSystem->display( 'error.tpl' ); |
die;
|
-}{CODE}
|
+}{/code} |
becomes
|
-{CODE()}$gTikiSystem->isFeatureActive( 'feature_listPages' );{CODE}
|
+{code}$gTikiSystem->verifyFeature( 'feature_listPages' );{/code} |
and conversion of package active checks at start of pages.
|
-{CODE()}if ( $feature_articles != 'y' ) {
|
- $smarty->assign( 'msg', tra( "This feature is disabled" ) . ": feature_articles" );
|
- $smarty->display( "error.tpl" );
|
+{code}if ( $feature_articles != 'y' ) { |
+ $smarty->assign( 'msg', tra( "This feature is disabled" ) . ": feature_articles" ); |
+ $smarty->display( "error.tpl" ); |
die;
|
-}{CODE}
|
+}{/code} |
becomes
|
-{CODE()}$gTikiSystem->isPackageActive( 'articles' );{CODE}
|
+{code}$gTikiSystem->verifyPackage( 'articles' );{/code} |
|
!Register packages
|
Package name should be lowercase
|
-{CODE()}$gTikiSystem->registerPackage( 'articles', dirname( __FILE__ ).'/' );{CODE}
|
+{code}$gTikiSystem->registerPackage( 'articles', dirname( __FILE__ ).'/' );{/code} |
|
!Convert dependent packages
|
When errors occur due to missing packages, the follow check code should be inserted in appropriate places.
|
-{CODE()}if ($gTikiSystem->isPackageActive( 'categories' )) {
|
+{code}if ($gTikiSystem->isPackageActive( 'categories' )) { |
include_once( CATEGORIES_PKG_PATH.'categ_lib.php');
|
-}{CODE}
|
+}{/code} |
+ |
+!Comments_lib has moved |
+{code}include_once( KERNEL_PKG_PATH . 'comments_lib.php' );{/code} |
+becomes |
+{code}include_once( LIBERTY_PKG_PATH . 'comments_lib.php' );{/code} |
|
!Convert db_byte_encode
|
New location for this function.
|
-{CODE()}$this->db_byte_encode( $imgdata ){CODE}
|
+{code}$this->db_byte_encode( $imgdata ){/code} |
becomes
|
-{CODE()}$this->mDb->db_byte_encode( $imgdata ){CODE}
|
+{code}$this->mDb->db_byte_encode( $imgdata ){/code} |
|
!Convert error pages
|
-{CODE()}$smarty->display( "error.tpl" ){CODE}
|
+{code}$smarty->display( "error.tpl" ){/code} |
becomes
|
-{CODE()}$gTikiSystem->display( "error.tpl" ){CODE}
|
+{code}$gTikiSystem->fatalError( "Any error message you want" ){/code} |
|
-Convert browser title -
|
-$gTikiSystem->setBrowserTitle( tra("articles") );
|
----
|
-(usually last line)
|
-$gTikiSystem->display( 'tikipackage:articles/list_articles.tpl', tra("articles") );
|
+!Convert error pages |
+{code}$smarty->display( "error.tpl" ){/code} |
+becomes |
+{code}$gTikiSystem->display( "error.tpl" ){/code} |
|
-Convert $user - $user => $gTikiUser->mUserId
|
+!Convert browser title |
+{code}$gTikiSystem->setBrowserTitle( tra("articles") );{/code} |
+has moved to the display() function, usually on the last line. |
+{code}$gTikiSystem->display( 'tikipackage:articles/list_articles.tpl', tra("articles") );{/code} |
|
+!Convert User |
+This is a little complicated, as $user what a text string with the username, where as mUserId is a numerical identifier. |
+{code}$user{/code} |
+becomes |
+{code}$gTikiUser->mUserId{/code} |
|
+!Standardise Find |
+Use minifind to standardise find in lists. |
+{code}<table class="find"> |
+<tr><td>{tr}Find{/tr}</td> |
+ <td> |
+ <form method="get" action="{$gTikiLoc.SAMPLES_PKG_URL}list_samples.php"> |
+ <input type="text" name="find" value="{$control.find|escape}" /> |
+ <input type="submit" name="search" value="{tr}find{/tr}" /> |
+ <input type="hidden" name="sort_mode" value="{$control.sort_mode|escape}" /> |
+ </form> |
+ </td> |
+</tr> |
+</table>{/code} |
+becomes |
+{code}{minifind sort_mode=$sort_mode}{/code} |
|
!Smarty tpl changes
|
-{if $gTikiSystem->isPackageActive( 'categories' )}
|
- <div class="tabpage {$categoriesTabSelect}">
|
- <h4>{tr}Categorize{/tr}</h4>
|
- {legend legend="Categorize"}
|
- {include file="tikipackage:categories/categorize.tpl"}
|
- {/legend}
|
- </div><!-- end .tabpage -->
|
-{/if}
|
+!!Checking for active packages and features |
+{code}{include file="tikipackage:categories/categorize.tpl"}{/code} |
+becomes |
+{code}{if $gTikiSystem->isPackageActive( 'categories' )} |
+ {include file="tikipackage:categories/categorize.tpl"} |
+{/if}{/code} |
|
+!!Smarty Menu Templates |
+Use of <ul> and <li>. |
+{code}<a class="menuoption" href="{$gTikiLoc.KERNEL_PKG_URL}admin/index.php?page=articles">{tr}Articles Settings{/tr}</a> |
+<a class="menuoption" href="{$gTikiLoc.ARTICLES_PKG_URL}admin/admin_topics.php">{tr}Topics{/tr}</a> |
+<a class="menuoption" href="{$gTikiLoc.ARTICLES_PKG_URL}article_types.php">{tr}Types{/tr}</a>{/code} |
+becomes |
+{code}{strip} |
+<ul> |
+ <li><a class="item" href="{$gTikiLoc.KERNEL_PKG_URL}admin/index.php?page=articles">{tr}Articles Settings{/tr}</a></li> |
+ <li><a class="item" href="{$gTikiLoc.ARTICLES_PKG_URL}admin/admin_topics.php">{tr}Topics{/tr}</a></li> |
+ <li><a class="item" href="{$gTikiLoc.ARTICLES_PKG_URL}admin/admin_types.php">{tr}Types{/tr}</a></li> |
+</ul> |
+{/strip}{/code} |
|
+!!Checking for permissions |
+{code}{if $tiki_p_read_article eq 'y'} |
+ <a class="menuoption" href="{$gTikiLoc.ARTICLES_PKG_URL}index.php">{tr}Articles home{/tr}</a> |
+ <a class="menuoption" href="{$gTikiLoc.ARTICLES_PKG_URL}list.php">{tr}List articles{/tr}</a> |
+{/if}{/code} |
+becomes |
+{code}{if $gTikiUser->hasPermission( 'tiki_p_read_article' )} |
+ <li><a class="item" href="{$gTikiLoc.ARTICLES_PKG_URL}index.php">{tikicon ipackage=liberty iname=home iexplain="articles home"} {tr}Articles Home{/tr}</a></li> |
+ <li><a class="item" href="{$gTikiLoc.ARTICLES_PKG_URL}list.php">{tikicon ipackage=liberty iname=list iexplain="list articles"} {tr}List articles{/tr}</a></li> |
+{/if}{/code} |