{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}
becomes
{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' );
die;
}{CODE}
becomes
{CODE()}$gTikiSystem->verifyPermission( 'tiki_p_view' );{CODE}

!Convert preferences
Function standardisation rename.
{CODE()}$gTikiSystem->get_preference("maxArticles", 10){CODE}
becomes
{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()}if ($feature_articles == 'y') {{CODE}
becomes
{CODE()}if ($gTikiSystem->isPackageActive( 'articles' )) {{CODE}
and
{CODE()}if($feature_listPages != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$gTikiSystem->display( 'error.tpl' );
die;
}{CODE}
becomes
{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" );
die;
}{CODE}
becomes
{CODE()}$gTikiSystem->verifyPackage( 'articles' );{CODE}

!Register packages
Package name should be lowercase
{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' )) {
include_once( CATEGORIES_PKG_PATH.'categ_lib.php');
}{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}
becomes
{CODE()}$this->mDb->db_byte_encode( $imgdata ){CODE}

!Convert error pages
{CODE()}$smarty->display( "error.tpl" ){CODE}
becomes
{CODE()}$gTikiSystem->fatalError( "Any error message you want" ){CODE}

!Convert error pages
{CODE()}$smarty->display( "error.tpl" ){CODE}
becomes
{CODE()}$gTikiSystem->display( "error.tpl" ){CODE}

!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}

!Smarty tpl changes
!!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}
Page History
Date/CommentUserIPVersion
29 Dec 2005 (03:36 UTC)
Stephan Borg218.214.1.11312
Current • Source
Stephan Borg218.214.1.11311
View • Compare • Difference • Source
Stephan Borg218.214.1.11310
View • Compare • Difference • Source
Stephan Borg218.214.1.1139
View • Compare • Difference • Source
Stephan Borg218.214.1.1138
View • Compare • Difference • Source
Stephan Borg218.214.1.1137
View • Compare • Difference • Source
Stephan Borg218.214.1.1132
View • Compare • Difference • Source