} elseif (($ext_name == 'cache') || (!isExtensionInstalled('cache'))) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'DB! ext_name=' . $ext_name);
// Load from database
- $result = SQL_QUERY_ESC("SELECT `ext_active` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Load entry
$data = SQL_FETCHARRAY($result);
+
+ // Set cache
+ setExtensionCacheRow($ext_name, $data);
} // END - if
// Free result
SQL_FREERESULT($result);
-
- // Write cache array
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . '[DB]: ' . $data['ext_active']);
- $GLOBALS['cache_array']['extension']['ext_active'][$ext_name] = $data['ext_active'];
} else {
// Extension not active!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': Not active!');
return ($data['ext_active'] == 'Y');
}
+// Sets extension cache row
+function setExtensionCacheRow ($ext_name, &$data) {
+ // Add all
+ foreach ($data as $key => $value) {
+ // Is key=id?
+ if ($key == 'id') {
+ $data['ext_id'] = $value;
+ $key == 'ext_id';
+ } // END - if
+
+ // Is key=ext_has_css?
+ if ($key == 'ext_has_css') {
+ $data['ext_css'] = $value;
+ $key == 'ext_css';
+ } // END - if
+
+ // Set all entries
+ if ($key == 'ext_name') {
+ $GLOBALS['cache_array']['extension']['ext_name'][$data['id']] = $value;
+ } else {
+ // Add ordinary entry
+ $GLOBALS['cache_array']['extension'][$key][$ext_name] = $value;
+ }
+ } // END - foreach
+}
+
// Get version from extensions
function getExtensionVersion ($ext_name, $force = FALSE) {
// By default no extension is found
incrementStatsEntry('cache_hits');
} elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (!isHtmlOutputMode())) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT `ext_version` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': DB - '.SQL_NUMROWS($result).'');
$data = SQL_FETCHARRAY($result);
// Set cache
- $GLOBALS['cache_array']['extension']['ext_version'][$ext_name] = $data['ext_version'];
+ setExtensionCacheRow($ext_name, $data);
} elseif (isDebugModeEnabled()) {
// Not found, may happen while an extension is uninstalled
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot find extension %s in database!", $ext_name));
incrementStatsEntry('cache_hits');
} else {
// Load from database
- $result = SQL_QUERY_ESC("SELECT `id` AS `ext_id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Is the entry there?
if (SQL_NUMROWS($result) == 1) {
// Get the extension's id from database
$data = SQL_FETCHARRAY($result);
+
+ // Set cache
+ setExtensionCacheRow($ext_name, $data);
} // END - if
// Free result
SQL_FREERESULT($result);
-
- // Cache it
- $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $data['ext_id'];
}
// Return value
} // END - if
// Version number
-setThisExtensionVersion('0.2.8');
+setThisExtensionVersion('0.2.9');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9'));
// Keep this extension always active!
setExtensionAlwaysActive('Y');
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("<strong>mailid_error_redirect</strong> bzw. alle ENUMs haben gross geschriebene Werte.");
break;
+
+ case '0.2.9': // SQL queries for v0.2.9
+ addConfigAddSql('word_wrap', 'TINYINT(3) NOT NULL DEFAULT 15');
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Anzahl Zeichen für <strong>wordwrap()</strong>-Aufruf hinzugefügt.");
+ break;
} // END - switch
break;
break;
case '0.2.1': // SQL queries for v0.2.1
- addConfigAddSql('css_php', "ENUM('DIRECT','FILE') NOT NULL DEFAULT 'FILE'");
+ addConfigAddSql('css_php', "ENUM('DIRECT','FILE','INLINE') NOT NULL DEFAULT 'FILE'");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Ausgabe der CSS-Dateien entweder per css.php oder sie sind direkt eingebunden.");
// Error handler function
function __errorHandler ($errno, $errstr, $errfile, $errline) {
// Construct message
- $message = sprintf("errno=%s,errstr=%s,errfile=%s,errline=%s",
+ $message = sprintf("errno=%s(0x%s),errstr=%s,errfile=%s,errline=%s",
$errno,
+ getHexErrorCode($errno),
$errstr,
basename($errfile),
$errline
addMessages(array(
// Admin strings
'ADMIN_TASK_TYPE_HOLIDAY_REQUEST' => "Urlaubsanfrage",
- 'ADMIN_HOLIDAY_NOTHING_FOUND' => "Niemand hat Urlaub beantragt.",
+ 'ADMIN_LIST_HOLIDAY_404' => "Niemand hat Urlaub beantragt.",
'ADMIN_HOLIDAY_TSTART' => "Anfang",
'ADMIN_HOLIDAY_TEND' => "Ende",
'ADMIN_HOLIDAY_COMMENTS' => "Kommentar",
'ADMIN_CONFIG_DISPLAY_DEBUG_SQLS' => "Sollen die SQL-Abfragen für Administratoren zu Debug-Zwecken angezeigt werden?. Das Einschalten dieser Einstellung kann enorme Performanceverluste bedeuten.",
'ADMIN_CONFIG_INTERNAL_STATS_TITLE' => "Interne Statistik-Einstellungen",
'ADMIN_CONFIG_INTERNAL_STATS_ENABLED' => "Sollen die internen Statistiken eingeschaltet sein? Das Abschalten dieser Statistiken kann etwas Performance bringen, ist aber für Performancemessungen vorraussetzend.",
+ 'ADMIN_CONFIG_WORD_WRAP' => "Allgemeiner Zeilenumbruch",
+ 'ADMIN_CONFIG_OTHER_NOTICE' => "<strong>Hinweise:</strong> Der allgemeine Zeilenumbruch (in Zeichen angegeben) gilt als Fallback-Einstellung falls der für die Erweiterung spezielle Konfigurationseintrag fehlen sollte. Für Details, siehe Funktion <strong>getWordWrap()</strong> im Script <strong>inc/wrapper-functions.php</strong>.",
));
// [EOF]
// Add more if ext-sql_patches is recent enougth
$add = '';
if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
- $add = ',`ext_has_css` AS `ext_css`';
+ // Old naming
+ $add = ', `ext_has_css` AS `ext_css`';
} // END - if
// Query for all extensions
if (!isPostRequestElementSet('reject_url')) { unsetPostRequestElement('ok'); }
} // END - if
-if (isFormSent()) {
+if (isFormSent('save_config')) {
// Update stamps directly
adminSaveSettingsFromPostData();
} else {
case 'overview': // List all registered extensions
if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
// Load extension data with CSS informations
- $result = SQL_QUERY("SELECT
- `id` AS `ext_id`,
+ $result = SQL_QUERY('SELECT
+ `ext_id`,
`ext_name`,
`ext_active`,
- `ext_has_css` AS `ext_css`,
+ `ext_css`,
`ext_version`
FROM
`{?_MYSQL_PREFIX?}_extensions`
-".$where."
+' . $where . '
ORDER BY
- `ext_name` ASC", __FILE__, __LINE__);
+ `ext_name` ASC', __FILE__, __LINE__);
} else {
// Load extension data without CSS informations
- $result = SQL_QUERY("SELECT
- `id` AS `ext_id`,
+ $result = SQL_QUERY('SELECT
+ `ext_id`,
`ext_name`,
`ext_active`,
`ext_version`
FROM
`{?_MYSQL_PREFIX?}_extensions`
-".$where."
+' . $where . '
ORDER BY
- `ext_name` ASC", __FILE__, __LINE__);
+ `ext_name` ASC', __FILE__, __LINE__);
}
// Are there some entries?
// Start listing holiday requests
$result = SQL_QUERY("SELECT
- h.id, h.userid, h.holiday_start, h.holiday_end, h.comments, d.status, d.last_online
+ h.`id`,
+ h.`userid`,
+ h.`holiday_start`,
+ h.`holiday_end`,
+ h.`comments`,
+ d.`status`,
+ d.`last_online`
FROM
- `{?_MYSQL_PREFIX?}_user_holidays` AS h
+ `{?_MYSQL_PREFIX?}_user_holidays` AS `h`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- h.userid=d.userid
+ h.`userid`=d.`userid`
ORDER BY
- h.userid ASC", __FILE__, __LINE__);
+ h.`userid` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// List all holiday requests
'userid' => $content['userid'],
'start' => generateDateTime($content['holiday_start'], 3),
'end' => generateDateTime($content['holiday_end'], 3),
- 'comments' => wordwrap($content['comments'], 15),
'status' => $content['status'],
'last_online' => generateDateTime($content['last_online'], 3),
);
loadTemplate('admin_list_holiday', FALSE, $OUT);
} else {
// No holiday requests found
- displayMessage('{--ADMIN_HOLIDAY_NOTHING_FOUND--}');
+ displayMessage('{--ADMIN_LIST_HOLIDAY_404--}');
}
// [EOF]
while ($content = SQL_FETCHARRAY($result)) {
// Prepare data for the row template
$content['time_trans'] = generateDateTime($content['time_trans'], 3);
- $content['reason'] = wordwrap($content['reason'], 15);
// Load row template add points and switch color
$OUT .= loadTemplate('admin_list_transfer_row', TRUE, $content);
} // END - if
// Output CSS files or content or link to css.php ?
-if ((isCssOutputMode()) || (getConfig('css_php') == 'DIRECT')) {
+if ((isCssOutputMode()) || (getCssPhp() == 'DIRECT')) {
// Load CSS files
$stylesList = merge_array($stylesList, getExtensionCssFiles());
// Do include only existing files and whose are not empty
if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
- switch (getConfig('css_php')) {
+ switch (getCssPhp()) {
case 'DIRECT': // Just link them (unsupported)
$GLOBALS['__page_header'] .= '<link rel="stylesheet" type="text/css" href="{%url=theme/' . getCurrentTheme() . '/' . $value . '%}" />';
break;
break;
default: // Invalid mode!
- reportBug(__FILE__, __LINE__, sprintf("Invalid css_php value %s detected.", getConfig('css_php')));
+ reportBug(__FILE__, __LINE__, sprintf("Invalid css_php value %s detected.", getCssPhp()));
break;
} // END - switch
} // END - if
} // END - foreach
-} elseif ((isHtmlOutputMode()) || (getConfig('css_php') == 'INLINE')) {
+} elseif ((isHtmlOutputMode()) || (getCssPhp() == 'INLINE')) {
// Load CSS files
$stylesList = merge_array($stylesList, getExtensionCssFiles());
// Is content an array?
if (is_array($content)) {
// Add expiration to array
- if ((isExtensionInstalled('autopurge')) && (getAutoPurge() == '0')) {
+ if ((isExtensionInstalled('autopurge')) && (isConfigEntrySet('auto_purge')) && (getAutoPurge() == '0')) {
// Will never expire!
$content['expiration'] = '{--MAIL_WILL_NEVER_EXPIRE--}';
} elseif ((isExtensionInstalled('autopurge')) && (isConfigEntrySet('auto_purge'))) {
return $GLOBALS[__FUNCTION__];
}
+// Getter for 'css_php'
+function getCssPhp () {
+ // Is the cache entry set?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // No, so determine it
+ $GLOBALS[__FUNCTION__] = getConfig('css_php');
+ } // END - if
+
+ // Return cached entry
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for 'word_wrap'
+function getWordWrap () {
+ // Is the cache entry set?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Construct config entry name
+ $configEntry = getMenuModeFromModule() . '_word_wrap_' . getWhat();
+
+ // Is a special config entry found or ext-sql_patches updated?
+ if (isConfigEntrySet($configEntry)) {
+ // A special config entry has been found, then use it
+ $GLOBALS[__FUNCTION__] = getConfig($configEntry);
+ } elseif (isExtensionInstalledAndNewer('other', '0.2.9')) {
+ // No special config entry found, then use it as "fall-back"
+ $GLOBALS[__FUNCTION__] = getConfig('word_wrap');
+ } else {
+ // No, use default (15 characters)
+ $GLOBALS[__FUNCTION__] = 15;
+ }
+ } // END - if
+
+ // Return cached entry
+ return $GLOBALS[__FUNCTION__];
+}
+
// Checks whether proxy configuration is used
function isProxyUsed () {
// Is there cache?
return $GLOBALS[__FUNCTION__];
}
+// Wrapper function to wrap call of wordwrap()
+function wrapWords ($text) {
+ // Wrap words
+ $wrapped = wordwrap($test, getWordWrap());
+
+ // Return it
+ return $wrapped;
+}
+
// [EOF]
?>
DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_extensions`;
CREATE TABLE `{?_MYSQL_PREFIX?}_extensions` (
- `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `ext_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`ext_name` VARCHAR(255) NOT NULL DEFAULT '',
`ext_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
`ext_version` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
</tr>
<tr>
- <td class="bottom" align="right">
+ <td align="right">
{--ADMIN_CONFIG_MAILID_REDIRECT--}
</td>
- <td class="bottom">
+ <td>
<input type="radio" class="form_field" name="mailid_error_redirect" value="INDEX"$content[mailid_error_redirect_index] /> {--ADMIN_CONFIG_MAILID_REDIRECT_INDEX--}<br />
<input type="radio" class="form_field" name="mailid_error_redirect" value="REJECT"$content[mailid_error_redirect_reject] /> {--ADMIN_CONFIG_MAILID_REDIRECT_REJECT--}
</td>
</tr>
+ <tr>
+ <td class="bottom" align="right">
+ {--ADMIN_CONFIG_WORD_WRAP--}:
+ </td>
+ <td class="bottom">
+ <input type="text" class="form_field" name="word_wrap" size="3" maxlength="3" value="{?word_wrap?}" />
+ </td>
+ </tr>
+
<tr>
<td colspan="2" align="center" class="table_header bottom">
<strong>{--ADMIN_CONFIG_SENDING_TITLE--}</strong>
</table>
{%form_close%}
</div>
+
+<div class="notice">
+ {--ADMIN_CONFIG_OTHER_NOTICE--}
+</div>
$content[end]
</td>
<td class="{%template,ColorSwitch%} bottom right" align="center">
- <pre>{%pipe,fixEmptyContentToDashes=$content[comments]%}</pre>
+ <pre>{%pipe,wrapWords,fixEmptyContentToDashes=$content[comments]%}</pre>
</td>
<td class="{%template,ColorSwitch%} bottom right" align="center">
{%user,status,translateUserStatus=$content[userid]%}
{%pipe,generateUserProfileLink=$content[to_userid]%}
</td>
<td class="{%template,ColorSwitch%} bottom right">
- $content[reason]
+ {%pipe,wrapWords=$content[reason]%}
</td>
<td class="{%template,ColorSwitch%} bottom" align="center">
{%pipe,translateComma=$content[points]%}