History of UpgradingToLiberty
Version 7 | Current version | |
---|---|---|
Convert permissionsGlobal 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 preferencesFunction standardisation rename.{CODE()}$gTikiSystem->get_preference("maxArticles", 10){CODE} becomes {CODE()}$gTikiSystem->getPreference("maxArticles", 10){CODE} Convert enabled packages and featuresGlobal 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} becomes {CODE()}$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->isFeatureActive( '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 (where TRUE indicates a 'fatal out', or die if not active. {CODE()}$gTikiSystem->isPackageActive( 'articles', TRUE );{CODE} Register packagesPackage name should be lowercase{CODE()}$gTikiSystem->registerPackage( 'articles', dirname( FILE ).'/' );{CODE} Convert dependent packagesWhen 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_encodeNew 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 UserThis 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 changesChecking for active packages and features{CODE()}Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page. {CODE}becomes {CODE()}{if $gTikiSystem->isPackageActive( 'categories' )} Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page. {/if}{CODE} Smarty Menu TemplatesUse 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} | Convert permissionsGlobal 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.
becomes
and
becomes
Convert preferencesFunction standardisation rename.
becomes
Convert enabled packages and featuresGlobal 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.
becomes
and
becomes
and conversion of package active checks at start of pages.
becomes
Register packagesPackage name should be lowercase
Convert dependent packagesWhen errors occur due to missing packages, the follow check code should be inserted in appropriate places.
Comments_lib has moved
becomes
Convert db_byte_encodeNew location for this function.
becomes
Convert error pages
becomes
Convert error pages
becomes
Convert browser title
has moved to the display() function, usually on the last line.
Convert UserThis is a little complicated, as $user what a text string with the username, where as mUserId is a numerical identifier.
becomes
Standardise FindUse minifind to standardise find in lists.
becomes
Smarty tpl changesChecking for active packages and features
becomes
Smarty Menu TemplatesUse of
|