+ // Return array
+ return $cssFiles;
+}
+
+// Init CSS files array
+function EXT_INIT_CSS_FILES () {
+ // Simply init it
+ $GLOBALS['css_files'] = array();
+}
+
+// Add new entry
+function EXT_ADD_CSS_FILE ($file) {
+ // Is the array there?
+ if (!isset($GLOBALS['css_files'])) {
+ // Then auto-init them
+ EXT_INIT_CSS_FILES();
+ } // END - if
+
+ // Add the entry
+ $GLOBALS['css_files'][] = $file;
+}
+
+// Setter for EXT_ALWAYS_ACTIVE flag
+function EXT_SET_ALWAYS_ACTIVE ($active) {
+ $GLOBALS['ext_always_active'][EXT_GET_CURR_NAME()] = (string) $active;
+}
+
+// Getter for EXT_ALWAYS_ACTIVE flag
+function EXT_GET_ALWAYS_ACTIVE () {
+ return $GLOBALS['ext_always_active'][EXT_GET_CURR_NAME()];
+}
+
+// Setter for EXT_VERSION flag
+function EXT_SET_VERSION ($version) {
+ $GLOBALS['ext_version'][EXT_GET_CURR_NAME()] = (string) $version;
+}
+
+// Getter for EXT_VERSION flag
+function EXT_GET_VERSION () {
+ return $GLOBALS['ext_version'][EXT_GET_CURR_NAME()];
+}
+
+// Setter for EXT_DEPRECATED flag
+function EXT_SET_DEPRECATED ($deprecated) {
+ $GLOBALS['ext_deprecated'][EXT_GET_CURR_NAME()] = (string) $deprecated;
+}
+
+// Getter for EXT_DEPRECATED flag
+function EXT_GET_DEPRECATED () {
+ return $GLOBALS['ext_deprecated'][EXT_GET_CURR_NAME()];
+}
+
+// Setter for EXT_UPDATE_DEPENDS flag
+function EXT_ADD_UPDATE_DEPENDS ($updateDepends) {
+ // Is the update depency empty? (NEED TO BE FIXED!)
+ if (empty($updateDepends)) {
+ // Please report this bug!
+ debug_report_bug("updateDepends is left empty!");
+ } // END - if
+
+ // Is it not yet added?
+ if (!in_array($updateDepends, $GLOBALS['ext_running_updates'])) {
+ //* DEBUG */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME().'/'.$updateDepends);
+ // Add it to the list of extension update depencies map
+ $GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()][] = (string) $updateDepends;
+
+ // Remember it in the list of running updates
+ $GLOBALS['ext_running_updates'][] = $updateDepends;
+ } // END - if
+}
+
+// Checks wether the given extension registration is in progress
+function EXT_IS_REGISTER_RUNNING ($ext_name) {
+ return ((isset($GLOBALS['ext_register_running'])) && (in_array($ext_name, $GLOBALS['ext_register_running'])));
+}
+
+// Init EXT_UPDATE_DEPENDS flag
+function EXT_INIT_UPDATE_DEPENDS () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+
+ // Init update depency map automatically if not found
+ if (!EXT_IS_UPDATE_DEPENDS_INIT()) {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME()." - INIT!");
+ $GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()] = array();
+ } // END - if
+
+ // Init running updates array
+ EXT_INIT_RUNNING_UPDATES();
+}
+
+// Adds an extension as "registration in progress"
+function EXT_ADD_RUNNING_REGISTRATION ($ext_name) {
+ // Is it running?
+ if (!EXT_IS_REGISTER_RUNNING($ext_name)) {
+ // Then add it!
+ $GLOBALS['ext_register_running'][] = $ext_name;
+ } // END - if
+}
+
+// Checks wether EXT_UPDATE_DEPENDS is initialized
+function EXT_IS_UPDATE_DEPENDS_INIT () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ return (isset($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()]));
+}
+
+// Initializes the list of running updates
+function EXT_INIT_RUNNING_UPDATES () {
+ // Auto-init ext_running_updates
+ if (!isset($GLOBALS['ext_running_updates'])) {
+ $GLOBALS['ext_running_updates'] = array();
+ $GLOBALS['ext_register_running'] = array();
+ } // END - if
+}
+
+// Getter for EXT_UPDATE_DEPENDS flag
+function EXT_GET_UPDATE_DEPENDS () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ return $GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()];
+}
+
+// Getter for next iterator depency
+function EXT_GET_ITERATOR_UPDATE_DEPENDS () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ return ($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()][EXT_GET_UPDATE_ITERATOR()]);
+}
+
+// Counter for extension update depencies
+function EXT_COUNT_UPDATE_DEPENDS () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ return count($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()]);
+}
+
+// Removes given extension from update denpency list
+function EXT_REMOVE_UPDATE_DEPENDS ($ext_name) {
+ // Look it up
+ $key = array_search($ext_name, EXT_GET_UPDATE_DEPENDS());
+
+ // Is it valid?
+ if ($key !== false) {
+ // Then remove it
+ unset($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()][$key]);
+
+ // And sort the array
+ ksort($GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()]);
+ } // END - if
+}
+
+// Init iterator for update depencies
+function EXT_INIT_UPDATE_ITERATOR () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ $GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()] = 0;
+}
+
+// Getter for depency iterator
+function EXT_GET_UPDATE_ITERATOR () {
+ // Auto-init iterator
+ if (!isset($GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()])) EXT_INIT_UPDATE_ITERATOR();
+
+ // Return it
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME().'/'.$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]);
+ return $GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()];
+}
+
+// Increments the update iterator
+function EXT_INCREMENT_UPDATE_INTERATOR () {
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME());
+ $GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]++;
+}
+
+// Setter for EXT_REPORTS_FAILURE flag
+function EXT_SET_REPORTS_FAILURE ($reportsFailure) {
+ $GLOBALS['ext_reports_failure'] = (bool) $reportsFailure;
+}
+
+// Getter for EXT_REPORTS_FAILURE flag
+function EXT_GET_REPORTS_FAILURE () {
+ return $GLOBALS['ext_reports_failure'];
+}
+
+// Setter for EXT_VER_HISTORY flag
+function EXT_SET_VER_HISTORY ($verHistory) {
+ $GLOBALS['ext_ver_history'] = (array) $verHistory;
+}
+
+// Getter for EXT_VER_HISTORY array
+function EXT_GET_VER_HISTORY () {
+ return $GLOBALS['ext_ver_history'];
+}
+
+// Setter for EXT_UPDATE_NOTES flag
+function EXT_SET_UPDATE_NOTES ($updateNotes) {
+ $GLOBALS['ext_update_notes'] = (string) $updateNotes;
+}
+
+// Getter for EXT_UPDATE_NOTES flag
+function EXT_GET_UPDATE_NOTES () {
+ return $GLOBALS['ext_update_notes'];
+}
+
+// Init extension notice
+function EXT_INIT_NOTES () {
+ $GLOBALS['ext_notes'] = '';
+}
+
+// Append extension notice
+function EXT_APPEND_NOTES ($notes) {
+ $GLOBALS['ext_notes'] .= (string) $notes;
+}
+
+// Getter for extension notes
+function EXT_GET_NOTES () {
+ return $GLOBALS['ext_notes'];
+}
+
+// Setter for current extension name
+function EXT_SET_CURR_NAME ($ext_name) {
+ $GLOBALS['curr_ext_name'] = (string) $ext_name;
+}
+
+// Getter for current extension name
+function EXT_GET_CURR_NAME () {
+ if (isset($GLOBALS['curr_ext_name'])) {
+ return $GLOBALS['curr_ext_name'];
+ } // END - if
+
+ // Not set!
+ debug_report_bug(__FUNCTION__.": curr_ext_name not initialized. Please execute INIT_EXT_SQLS() before calling this function.");
+}
+
+// Init SQLs array for current extension
+function INIT_EXT_SQLS () {
+ // Auto-init the array now...
+ if (!isset($GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()])) {
+ $GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()] = array();
+ } // END - if
+}
+
+// Adds SQLs to the SQLs array but "assigns" it with current extension name
+function ADD_EXT_SQL ($sql) {
+ $GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()][] = $sql;
+}
+
+// Getter for SQLs array for current extension
+function GET_EXT_SQLS () {
+ // Output debug backtrace if not found (SHOULD NOT HAPPEN!)
+ if (!isset($GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()])) {
+ // Not found, should not happen
+ debug_report_bug(sprintf("ext_sqls is empty, current extension: %s",
+ EXT_GET_CURR_NAME()
+ ));
+ } // END - if
+
+ // Return the array
+ return $GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()];
+}
+
+// Removes SQLs for current extension
+function UNSET_EXT_SQLS () {
+ unset($GLOBALS['ext_sqls'][EXT_GET_CURR_NAME()]);
+}
+
+// Auto-initializes the removal list
+function EXT_INIT_REMOVAL_LIST () {
+ // Is the remove list there?
+ if (!isset($GLOBALS['ext_update_remove'])) {
+ // Then create it
+ $GLOBALS['ext_update_remove'] = array();
+ } // END - if
+}
+
+// Checks wether the current extension is on the removal list
+function EXT_IS_ON_REMOVAL_LIST () {
+ // Init removal list
+ EXT_INIT_REMOVAL_LIST();
+
+ // Is it there?
+ return (in_array(EXT_GET_CURR_NAME(), $GLOBALS['ext_update_remove']));
+}
+
+// Adds the current extension to the removal list
+function EXT_ADD_CURRENT_TO_REMOVAL_LIST () {
+ // Simply add it
+ $GLOBALS['ext_update_remove'][] = EXT_GET_CURR_NAME();
+}
+
+// Getter for removal list
+function EXT_GET_REMOVAL_LIST () {
+ // Return the removal list
+ return $GLOBALS['ext_update_remove'];
+}
+
+// Redirects if the provided extension is not installed
+function redirectOnUninstalledExtension ($ext_name) {
+ // So is the extension there?
+ if (!EXT_IS_ACTIVE($ext_name)) {
+ // Redirect to index
+ redirectToUrl('modules.php?module=index&msg=' . getCode('EXTENSION_PROBLEM') . '&ext=' . $ext_name);
+ } // END - if