Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:entwickler:changes_to_functions_and_methods [2016/03/22 22:05] fasseen:entwickler:changes_to_functions_and_methods [2022/04/15 20:11] (current) fasse
Line 1: Line 1:
 ====== Changes to functions and methods ====== ====== Changes to functions and methods ======
  
-With this page we want to help plugin developers to stay compatible with the changes that were made in the Admidio core and that could affect plugins. During the developement of Admidio we try to not change our existing methods and functions but sometimes it'neccessary and could break your working plugin. Here you will find a list of methods and functions that we changed in a specific Admidio version with a notice how you could fix this in your plugin if you have used that method or function.+With this page we want to help plugin developers to stay compatible with the changes that were made in the Admidio core and that could affect plugins. During the development of Admidio we try to not change our existing methods and functions but sometimes it'necessary and could break your working plugin. Here you will find a list of methods and functions that we changed in a specific Admidio version with a notice how you could fix this in your plugin if you have used that method or function. 
 + 
 +===== Admidio version 4.2 ===== 
 + 
 +=== Changes/Deprecations === 
 +== Class == 
 +  * **Menu** renamed to **MainMenu** 
 +== Class methods == 
 +  * **HtmlPage->hasNavbar()** was removed 
 +  * **Email->adminNotification()**: 'Email->sendNotification()' 
 +  * **Email->addBlindCopy()**: 'Email->addRecipient()' 
 + 
 +===== Admidio version 4.1 ===== 
 + 
 +=== Call Admidio scripts with the UUID for user or role === 
 +To prevend CSRF attacks as described in [[https://github.com/Admidio/admidio/issues/612|Issue 612]] we have introduce the UUID for the user and role objects. To call Admidio scripts that use the an id or as parameter you must now use the UUID. Therefore tables like **adm_users** and **adm_roles** got new columns **usr_uuid** and **rol_uuid** where you can get the uuid of the object instead of the **usr_id** or **rol_id**. So if you want to call the profile of a user you do it until now with the following url: <code php>ADMIDIO_URL. FOLDER_MODULES. '/profile/profile.php?usr_id=4711'</code> Now you must use the url with the following parameter <code php>ADMIDIO_URL. FOLDER_MODULES. '/profile/profile.php?user_uuid=bfa4db69-1722-4704-801f-e8b4bfe2f081'</code> We add a new method to the **TableAccess** class to read a record with the UUID. <code php>$user = new User($gDb); 
 +$user->readDataByUuid($userUuid);</code> This Method could be used with all tables that have a **uuid** column. If you save a new record the **uuid** column will be filled automatically. You must do nothing and got a record with a uuid. 
 + 
 +=== Call Admidio scripts with the UUID for user or role === 
 +The following methods are removed:\\  
 +**Session::renewMenuObject()**\\  
 +**Session::renewOrganizationObject**\\  
 +**Session::renewUserObject(int $userId = 0)**\\  
 +New methods that could be used instead of them:\\  
 +**Session::reloadAllSessions()**\\  
 +**Session::reloadSession(int $userId)**\\  
 + 
 + 
 +===== Admidio version 3.3 ===== 
 + 
 +=== Bootstrapping === 
 +Simplified the bootstrapping (initialization of the common Admidio stuff). 
 +Most stuff got extracted in separate **bootstrap.php**. 
 +Autoload is in it's own **autoload.php**. 
 +Now it could be enough to require only the **bootstrap.php** if you don't need a database connection. 
 + 
 +=== Prepared Statement === 
 +To improve the security move from **Database->query()** to the new **Database->queryPrepared()** method. You have to adapt the SQL queries and add the necessary parameters 
 + 
 +=== New === 
 +== Constants == 
 +  * **SCHEME**: 'http' or 'https' 
 +  * **COOKIE_PREFIX**: Unique prefix for cookies 
 +  * **DB_ENGINE**: 'mysql' or 'pgsql' 
 +  * **DB_HOST**: 'localhost' or '127.0.0.1' 
 +  * **DB_PORT**: null or port number 
 +  * **DB_NAME**: the database name 
 +  * **DB_USERNAME**: the database user 
 +  * **DB_PASSWORD**: the database user password 
 +== Classes == 
 +  * **PhpIniUtils**: Manages most of php-ini stuff 
 +  * **FileSystemUtils**: Manages nearly all FileSystem stuff like copy, move, ... 
 +  * **SettingsManager**: Manages the organization settings 
 + 
 +=== Changes/Deprecations === 
 +== Classes == 
 +  * **Folder**: Use FileSystemUtils instead 
 +  * **MyFiles**: Use FileSystemUtils instead 
 +== Class methods == 
 +  * **Email->adminNotfication()**: 'Email->adminNotification()' 
 +  * **Email::getMaxAttachementSize()**: 'Email::getMaxAttachmentSize()' 
 +  * **Language->addLanguageData()**: 'new Language()' 
 +  * **Language->addLanguagePath()**: 'Language->addLanguageFolderPath()' 
 +  * **Language->getCountryByCode()**: 'Language->getCountryName()' 
 +  * **Language->getCountryByName()**: 'Language->getCountryIsoCode()' 
 +  * **LanguageData->addLanguagePath()**: 'LanguageData->addLanguageFolderPath()' 
 +  * **LanguageData->getLanguagePaths()**: 'LanguageData->getLanguageFolderPaths()' 
 +  * **LanguageData->getCountriesArray()**: 'LanguageData->getCountries()' 
 +  * **LanguageData->setCountriesArray()**: 'LanguageData->setCountries()' 
 +  * **Message->showInModaleWindow()**: 'Message->showInModalWindow()' 
 +  * **Organization->getPreferences()**: 'Organization->getSettingsManager()->getAll()' 
 +  * **Organization->setPreferences()**: 'Organization->getSettingsManager()->setMulti()' 
 +  * **PhpIniUtils->isSafeModeEnabled()**: no replacement 
 +  * **TableFile->getCompletePathOfFile()**: 'TableFile->getFullFilePath()' 
 +  * **TableFolder->getCompletePathOfFolder()**: 'TableFolder->getFolderPath()' 
 +  * **TableRoles->viewRole()**: 'TableRoles->isVisible()' 
 +  * **User->columnsValueChanged()**: 'User->hasColumnsValueChanged()' 
 +== Class method params == 
 +  * **new AdmException('MSG', 'PARAM1', 'PARAM2')**: 'new AdmException('MSG', array('PARAM1', 'PARAM2'))' 
 +  * **AdmException->setNewMessage('ID', 'PARAM1', 'PARAM2')**: 'AdmException->setNewMessage('ID', array('PARAM1', 'PARAM2'))' 
 +  * **Language->get('ID', 'PARAM1', 'PARAM2')**: 'Language->get('ID', array('PARAM1', 'PARAM2'))' 
 +  * **Language->getLanguage(true)**: 'LanguageData::REFERENCE_LANGUAGE' 
 +  * **Language->getLanguageIsoCode(true)**: 'LanguageData::REFERENCE_LANGUAGE' 
 +  * **LanguageData->getLanguage(true)**: 'LanguageData::REFERENCE_LANGUAGE' 
 +== Functions == 
 +  * **admFuncMaxUploadSize()**: 'PhpIniUtils::getUploadMaxSize()' 
 +  * **admFuncGetBytesFromSize()**: 'FileSystemUtils::getHumanReadableBytes()' 
 +  * **admReadTemplateFile()**: 'FileSystemUtils::readFile()' 
 + 
 +===== Admidio version 3.2 ===== 
 +=== Changes/Deprecations === 
 +Every usage of a deprecated function/class/property now gets logged. So it is easy to see if you still use a deprecated feature. 
 + 
 +Class **TableUsers** has been marked as deprecated. You should use the existing class **Users**. All methods of **TableUsers** have been moved to **Users**. The class **TableUsers** will be removed in future versions. 
 + 
 +Method **isWebmaster()** of the class **User** is marked as deprecated and will be removed in future versions. Use method **isAdministrator()** instead. 
 + 
 +The functions **admFuncGetFilenameExtension** and **admFuncGetFilenameWithoutExtension** were marked as deprecated in version 3.1 and are now removed in this version. 
 + 
 +The config property **$g_root_path** is deprecated and replaced with new constant **ADMIDIO_URL**. There are some more new helpful constants defined: 
 +  * BASIC STUFF 
 +    * **ADMIDIO_HOMEPAGE**: 'https://www.admidio.org/' 
 +    * **HTTPS**: true, false 
 +    * **PORT**: 80, 443, ... 
 +    * **HOST**: 'www.example.org:1234', 'www.example.org', 'admidio.example.org' (only with port number if not 80 or 443) 
 +    * **DOMAIN**: 'www.example.org', 'admidio.example.org' (always without port number) 
 +    * **ADMIDIO_SUBFOLDER**: '/subfolder', '/admidio', '/' 
 +  * URLS 
 +    * **SERVER_URL**: 'https://www.example.org:1234' (protocol + HOST) 
 +    * **ADMIDIO_URL**: 'https://www.example.org:1234/subfolder' (SERVER_URL + ADMIDIO_SUBFOLDER) 
 +    * **FILE_URL**: 'https://www.example.org:1234/subfolder/adm_program/index.php' (URL without params, hash, ...) 
 +    * **CURRENT_URL**: 'https://www.example.org:1234/subfolder/adm_program/index.php?param=value' (complete URL) 
 +  * PATHS 
 +    * **WWW_PATH**: '/var/www', 'C:\inetpub\wwwroot' (Will get "SERVER_PATH" in v4.0) 
 +    * **ADMIDIO_PATH**: '/var/www/subfolder', 'C:\inetpub\wwwroot\subfolder' 
 +    * **CURRENT_PATH**: '/var/www/subfolder/adm_program/index.php', 'C:\inetpub\wwwroot\subfolder\adm_program\index.php' 
 +  * FOLDERS 
 +    * **FOLDER_DATA**: '/adm_my_files' 
 +    * **FOLDER_CLASSES**: '/adm_program/system/classes' 
 +    * **FOLDER_LIBS_SERVER**: '/adm_program/libs' (PHP libs) 
 +    * **FOLDER_LIBS_CLIENT**: '/adm_program/libs' (JavaScript/CSS libs) 
 +    * **FOLDER_LANGUAGES**: '/adm_program/languages' 
 +    * **FOLDER_THEMES**: '/adm_themes' 
 +    * **FOLDER_MODULES**: '/adm_program/modules' 
 +    * **FOLDER_PLUGINS**: '/adm_plugins' 
  
 ===== Admidio version 3.1 ===== ===== Admidio version 3.1 =====
 === New database class === === New database class ===
-Within Admidio 3.1 we changed the database class. This was neccessary because PHP7 knocks at the door and in this PHP version our used database functions were no longer supported. So we have rewritten the whole class and now use the PHP class [[http://de2.php.net/manual/en/book.pdo.php|PDO]] for database access. This is a powerful class that will also allow us to integrate some more database engines in the future much easier. Admidio has a new well documented implementation of the his [[http://www.admidio.org/dokusource/class_database.html|Database class]]. The Admidio database object **$gDb** is still available now with the new class. We also try to implement some compatibility methods for often used methods so there should be not much problems for existing code. +Within Admidio 3.1 we changed the database class. This was necessary because PHP7 knocks at the door and in this PHP version our used database functions were no longer supported. So we have rewritten the whole class and now use the PHP class [[https://secure.php.net/manual/en/book.pdo.php|PDO]] for database access. This is a powerful class that will also allow us to integrate some more database engines in the future much easier. Admidio has a new well documented implementation of the his [[https://www.admidio.org/dokusource/class_database.html|Database class]]. The Admidio database object **$gDb** is still available now with the new class. We also try to implement some compatibility methods for often used methods so there should be not much problems for existing code. 
  
 Some methods must be removed because they are no longer necessary or there is another (better) way to find a solution. Please check if you use some of them and find a way to replace them with the new methods. Some methods must be removed because they are no longer necessary or there is another (better) way to find a solution. Please check if you use some of them and find a way to replace them with the new methods.
Line 24: Line 149:
  
 === New syntax in language files === === New syntax in language files ===
-Within this version we use a new format for our translation files. Before it was an Admidio specific xml format. Now its the [[http://developer.android.com/guide/topics/resources/string-resource.html|Android String Resource]]. Version 3.1 will be still compatible to the old Admidio format but we encourage you to use the new format. There is also a small [[en:entwickler:how_to_make_your_plugin_translatable|How to for plugin developers]]. We also changed the style of the placeholders within the strings. Please have a look at [[en:entwickler:mehrsprachigkeit|Multilingualism]] for a detailed description of the new syntax.+Within this version we use a new format for our translation files. Before it was an Admidio specific xml format. Now its the [[https://developer.android.com/guide/topics/resources/string-resource.html|Android String Resource]]. Version 3.1 will be still compatible to the old Admidio format but we encourage you to use the new format. There is also a small [[en:entwickler:how_to_make_your_plugin_translatable|How to for plugin developers]]. We also changed the style of the placeholders within the strings. Please have a look at [[en:entwickler:mehrsprachigkeit|Multilingualism]] for a detailed description of the new syntax.
  
 === Changes to DatetimeExtended class === === Changes to DatetimeExtended class ===
-Since our requirements for PHP are changed to 5.3 we could use a lot of methods of the PHP class [[http://php.net/manual/en/class.datetime.php|DateTime]]. Therefore we have removed methods from **DatetimeExtended** that were redundant.+Since our requirements for PHP are changed to 5.3 we could use a lot of methods of the PHP class [[https://secure.php.net/manual/en/class.datetime.php|DateTime]]. Therefore we have removed methods from **DatetimeExtended** that were redundant.
 There are only 4 methods left: There are only 4 methods left:
   * isValid()   * isValid()
Line 38: Line 163:
 The functions **admFuncGetFilenameExtension** and **admFuncGetFilenameWithoutExtension** are marked as deprecated and will be removed in future versions. The functions **admFuncGetFilenameExtension** and **admFuncGetFilenameWithoutExtension** are marked as deprecated and will be removed in future versions.
  
-===== Admidio version 3.2 ===== 
-=== Changes === 
-Class **TableUsers** has been marked as deprecated. You should use the existing class **Users**. All methods of **TableUsers** have been moved to **Users**. The class **TableUsers** will be removed in future versions. 
  
-The functions **admFuncGetFilenameExtension** and **admFuncGetFilenameWithoutExtension** were marked as deprecated in version 3.1 and are now removed in this version. 
  • en/entwickler/changes_to_functions_and_methods.1458680713.txt.gz
  • Last modified: 2016/03/22 22:05
  • by fasse