// Output HTML code directly or 'render' it. You addionally switch the new-line character off
function outputHtml ($htmlCode, $newLine = true) {
// Init output
- if (!isset($GLOBALS['output'])) $GLOBALS['output'] = '';
+ if (!isset($GLOBALS['output'])) {
+ $GLOBALS['output'] = '';
+ } // END - if
// Transfer username
$username = getMessage('USERNAME_UNKNOWN');
addPageHeaderFooter();
// Compile all out
- while (((strpos($GLOBALS['output'], '{--') !== false) || (strpos($GLOBALS['output'], '{!') !== false) || (strpos($GLOBALS['output'], '{?') !== false) || (strpos($GLOBALS['output'], '{%') !== false)) && ($cnt < 3)) {
+ while (((strpos($GLOBALS['output'], '{--') !== false) || (strpos($GLOBALS['output'], '{DQUOTE}') !== false) || (strpos($GLOBALS['output'], '{!') !== false) || (strpos($GLOBALS['output'], '{?') !== false) || (strpos($GLOBALS['output'], '{%') !== false)) && ($cnt < 3)) {
// Init common variables
$content = array();
$newContent = '';
// Compile it
//* DEBUG: */ print '<pre>'.htmlentities($GLOBALS['output']).'</pre>';
- $eval = '$newContent = "' . compileCode(escapeQuotes($GLOBALS['output'])) . '";';
+ $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($GLOBALS['output']))) . '";';
//* DEBUG: */ die('<pre>'.htmlentities($eval).'</pre>');
eval($eval);
+ //* DEBUG: */ die('<pre>'.htmlentities($newContent).'</pre>');
// Was that eval okay?
if (empty($newContent)) {
if ($type == 'yn') {
// This is a yes/no selection only!
- if ($id > 0) $prefix .= "[" . $id."]";
- $OUT .= " <select name=\"" . $prefix."\" class=\"" . $class . "\" size=\"1\">\n";
+ if ($id > 0) $prefix .= '[' . $id . ']';
+ $OUT .= '<select name="' . $prefix . '" class="' . $class . '" size="1">';
} else {
// Begin with regular selection box here
if (!empty($prefix)) $prefix .= "_";
$type2 = $type;
- if ($id > 0) $type2 .= "[" . $id."]";
- $OUT .= " <select name=\"".strtolower($prefix . $type2)."\" class=\"" . $class . "\" size=\"1\">\n";
+ if ($id > 0) $type2 .= '[' . $id . ']';
+ $OUT .= '<select name="' . strtolower($prefix . $type2) . '" class="' . $class . '" size="1">';
}
switch ($type) {
case 'day': // Day
for ($idx = 1; $idx < 32; $idx++) {
- $OUT .= "<option value=\"" . $idx."\"";
+ $OUT .= '<option value="' . $idx . '"';
if ($default == $idx) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
+ $OUT .= '>' . $idx . '</option>';
} // END - for
break;
case 'month': // Month
- foreach ($GLOBALS['month_descr'] as $month => $descr) {
- $OUT .= "<option value=\"" . $month."\"";
- if ($default == $month) $OUT .= ' selected="selected"';
- $OUT .= ">" . $descr."</option>\n";
+ foreach ($GLOBALS['month_descr'] as $idx => $descr) {
+ $OUT .= '<option value="' . $idx . '"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
+ $OUT .= '>' . $descr . '</option>';
} // END - for
break;
// Check if the default value is larger than minimum and bigger than actual year
if (($default > $minYear) && ($default >= $year)) {
for ($idx = $year; $idx < ($year + 11); $idx++) {
- $OUT .= "<option value=\"" . $idx."\"";
+ $OUT .= '<option value="' . $idx . '"';
if ($default == $idx) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
+ $OUT .= '>' . $idx . '</option>';
} // END - for
} elseif ($default == -1) {
// Current year minus 1
- for ($idx = $startYear; $idx <= ($year + 1); $idx++)
- {
- $OUT .= "<option value=\"" . $idx."\">" . $idx."</option>\n";
- }
+ for ($idx = $startYear; $idx <= ($year + 1); $idx++) {
+ $OUT .= '<option value="' . $idx . '">' . $idx . '</option>';
+ } // END - for
} else {
// Get current year and subtract the configured minimum age
- $OUT .= "<option value=\"".($minYear - 1)."\"><" . $minYear."</option>\n";
+ $OUT .= '<option value="' . ($minYear - 1) . '"><' . $minYear . '</option>';
// Calculate earliest year depending on extension version
if (isExtensionInstalledAndNewer('order', '0.2.1')) {
// Use configured minimum age
// Construct year selection list
for ($idx = $minYear; $idx <= $year; $idx++) {
- $OUT .= "<option value=\"" . $idx."\"";
+ $OUT .= '<option value="' . $idx . '"';
if ($default == $idx) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
+ $OUT .= '>' . $idx . '</option>';
} // END - for
}
break;
case 'sec':
case 'min':
- for ($idx = '0'; $idx < 60; $idx+=5) {
+ for ($idx = 0; $idx < 60; $idx+=5) {
if (strlen($idx) == 1) $idx = '0' . $idx;
- $OUT .= "<option value=\"" . $idx."\"";
+ $OUT .= '<option value="' . $idx . '"';
if ($default == $idx) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
+ $OUT .= '>' . $idx . '</option>';
} // END - for
break;
case 'hour':
- for ($idx = '0'; $idx < 24; $idx++) {
+ for ($idx = 0; $idx < 24; $idx++) {
if (strlen($idx) == 1) $idx = '0' . $idx;
- $OUT .= "<option value=\"" . $idx."\"";
+ $OUT .= '<option value="' . $idx . '"';
if ($default == $idx) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
+ $OUT .= '>' . $idx . '</option>';
} // END - for
break;
case 'yn':
- $OUT .= "<option value=\"Y\"";
+ $OUT .= '<option value="Y"';
if ($default == 'Y') $OUT .= ' selected="selected"';
- $OUT .= ">{--YES--}</option>\n<option value=\"N\"";
+ $OUT .= '>{--YES--}</option><option value="N"';
if ($default != 'Y') $OUT .= ' selected="selected"';
- $OUT .= ">{--NO--}</option>\n";
+ $OUT .= '>{--NO--}</option>';
break;
}
- $OUT .= " </select>\n";
+ $OUT .= '</select>';
return $OUT;
}
debug_report_bug('img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getConfig('code_length'));
} elseif ($headerSent === false) {
// Return an HTML code here
- return "<img src=\"{%url=img.php?code=" . $img_code."%}\" alt=\"Image\" />\n";
+ return '<img src="{%url=img.php?code=' . $img_code . '%}" alt="Image" />';
}
// Load image
// Is it readable?
if (isFileReadable($img)) {
// Switch image type
- switch (getConfig('img_type'))
- {
+ switch (getConfig('img_type')) {
case 'jpg':
// Okay, load image and hide all errors
$image = imagecreatefromjpeg($img);
// Okay, load image and hide all errors
$image = imagecreatefrompng($img);
break;
- }
+ } // END - switch
} else {
// Exit function here
logDebugMessage(__FUNCTION__, __LINE__, sprintf("File for image type %s not found.", getConfig('img_type')));
switch (getConfig('img_type')) {
case 'jpg': imagejpeg($image); break;
case 'png': imagepng($image); break;
- }
+ } // END - switch
// Remove image from memory
imagedestroy($image);
);
} else {
// Generate table
- $OUT = "<div align=\"" . $align."\">\n";
- $OUT .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"timebox_table dashed\">\n";
- $OUT .= "<tr>\n";
+ $OUT = '<div align="' . $align . '">';
+ $OUT .= '<table border="0" cellspacing="0" cellpadding="0" class="timebox_table dashed">';
+ $OUT .= '<tr>';
if (isInString('Y', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_YEARS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_YEARS--}</strong></td>';
+ } // END - if
if (isInString('M', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_MONTHS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_MONTHS--}</strong></td>';
+ } // END - if
if (isInString('W', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_WEEKS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_WEEKS--}</strong></td>';
+ } // END - if
if (isInString('D', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_DAYS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_DAYS--}</strong></td>';
+ } // END - if
if (isInString('h', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_HOURS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_HOURS--}</strong></td>';
+ } // END - if
if (isInString('m', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_MINUTES--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_MINUTES--}</strong></td>';
+ } // END - if
if (isInString('s', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"timebox_column bottom\"><div class=\"tiny\">{--_SECONDS--}</strong></td>\n";
- }
+ $OUT .= '<td align="center" class="timebox_column bottom"><div class="tiny">{--_SECONDS--}</strong></td>';
+ } // END - if
- $OUT .= "</tr>\n";
- $OUT .= "<tr>\n";
+ $OUT .= '</tr>';
+ $OUT .= '<tr>';
if (isInString('Y', $display) || (empty($display))) {
// Generate year selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_ye\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 10; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_ye" size="1">';
+ for ($idx = 0; $idx <= 10; $idx++) {
+ $OUT .= '<option class="mini_select" value="' . $idx . '"';
if ($idx == $Y) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_ye" value="0" />';
}
if (isInString('M', $display) || (empty($display))) {
// Generate month selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_mo\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 11; $idx++)
- {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_mo" size="1">';
+ for ($idx = 0; $idx <= 11; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $M) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_mo" value="0" />';
}
if (isInString('W', $display) || (empty($display))) {
// Generate week selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_we\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 4; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_we" size="1">';
+ for ($idx = 0; $idx <= 4; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $W) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_we" value="0" />';
}
if (isInString('D', $display) || (empty($display))) {
// Generate day selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_da\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 31; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_da" size="1">';
+ for ($idx = 0; $idx <= 31; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $D) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_da" value="0" />';
}
if (isInString('h', $display) || (empty($display))) {
// Generate hour selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_ho\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 23; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_ho" size="1">';
+ for ($idx = 0; $idx <= 23; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $h) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_ho" value="0" />';
}
if (isInString('m', $display) || (empty($display))) {
// Generate minute selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_mi\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 59; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_mi" size="1">';
+ for ($idx = 0; $idx <= 59; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $m) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_mi" value="0" />';
}
if (isInString('s', $display) || (empty($display))) {
// Generate second selection
- $OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix . "_se\" size=\"1\">\n";
- for ($idx = '0'; $idx <= 59; $idx++) {
- $OUT .= " <option class=\"mini_select\" value=\"" . $idx."\"";
+ $OUT .= '<td align="center"><select class="mini_select" name="' . $prefix . '_se" size="1">';
+ for ($idx = 0; $idx <= 59; $idx++) {
+ $OUT .= ' <option class="mini_select" value="' . $idx . '"';
if ($idx == $s) $OUT .= ' selected="selected"';
- $OUT .= ">" . $idx."</option>\n";
- }
- $OUT .= " </select></td>\n";
+ $OUT .= '>' . $idx . '</option>';
+ } // END - for
+ $OUT .= '</select></td>';
} else {
$OUT .= '<input type="hidden" name="' . $prefix . '_se" value="0" />';
}
- $OUT .= "</tr>\n";
- $OUT .= "</table>\n";
- $OUT .= "</div>\n";
- // Return generated HTML code
+ $OUT .= '</tr>';
+ $OUT .= '</table>';
+ $OUT .= '</div>';
}
+
+ // Return generated HTML code
return $OUT;
}
$SWITCH = '0';
$TEST = date('Y', time()) / 4;
$M1 = date('m', time());
+
// If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
if ((floor($TEST) == $TEST) && ($M1 == '02') && ($postData[$prefix . '_mo'] > '02')) $SWITCH = getConfig('ONE_DAY');
+
// First add years...
$ret += $postData[$prefix . '_ye'] * (31536000 + $SWITCH);
+
// Next months...
$ret += $postData[$prefix . '_mo'] * 2628000;
+
// Next weeks
$ret += $postData[$prefix . '_we'] * 604800;
+
// Next days...
$ret += $postData[$prefix . '_da'] * 86400;
+
// Next hours...
$ret += $postData[$prefix . '_ho'] * 3600;
+
// Next minutes..
$ret += $postData[$prefix . '_mi'] * 60;
+
// And at last seconds...
$ret += $postData[$prefix . '_se'];
+
// Return calculated value
return $ret;
}
foreach($data as $k => $v) {
if ($v > 0) {
// Value is greater than 0 "eval" data to return string
- eval("\$ret .= \", \".\$v.\" {--_".strtoupper($k)."--}\";");
+ eval('$ret .= ", ".$v." {--_' . strtoupper($k) . '--}";');
break;
} // END - if
} // END - foreach
$ret = substr($ret, 2);
} else {
// Zero seconds
- $ret = "0 {--_SECONDS--}";
+ $ret = '0 {--_SECONDS--}';
}
// Return fancy time string
function addEmailNavigation ($PAGES, $offset, $show_form, $colspan, $return=false) {
$TOP = '';
if ($show_form === false) {
- $TOP = " top";
- }
+ $TOP = ' top';
+ } // END - if
$NAV = '';
for ($page = 1; $page <= $PAGES; $page++) {
}
// Add seperator if we have not yet reached total pages
- if ($page < $PAGES) $NAV .= ' | ';
+ if ($page < $PAGES) {
+ // Add it
+ $NAV .= '|';
+ } // END - if
} // END - for
// Define constants only once
if (isInString('/', $host)) $host = substr($host, 0, strpos($host, '/'));
// Generate relative URL
- //* DEBUG: */ print("SCRIPT=" . $script.'<br />');
+ //* DEBUG: */ print('SCRIPT=' . $script.'<br />');
if (substr(strtolower($script), 0, 7) == 'http://') {
// But only if http:// is in front!
$script = substr($script, (strlen($url) + 7));
$script = substr($script, (strlen($url) + 8));
}
- //* DEBUG: */ print("SCRIPT=" . $script.'<br />');
+ //* DEBUG: */ print('SCRIPT=' . $script.'<br />');
if (substr($script, 0, 1) == '/') $script = substr($script, 1);
// Return host name
$resolver = new HostnameResolver();
// Open connection
- //* DEBUG: */ die("SCRIPT=" . $script.'<br />');
+ //* DEBUG: */ die('SCRIPT=' . $script.'<br />');
if ($useProxy === true) {
// Resolve hostname into IP address
$ip = $resolver->resolveHostname(compileRawCode(getConfig('proxy_host')));
$targetArray = array('del_user', 'edit_user', 'lock_user', 'add_points', 'sub_points');
// Begin of navigation links
- $OUT = '[ ';
+ $OUT = '[';
foreach ($targetArray as $tar) {
$OUT .= '<span class="admin_user_link"><a href="{%url=modules.php?module=admin&what=' . $tar . '&userid=' . $userid . '%}" title="{--ADMIN_LINK_';
// All other status is fine
$OUT .= strtoupper($tar);
}
- $OUT .= '--}</a></span> | ';
+ $OUT .= '--}</a></span>|';
}
// Finish navigation link
// Scramble string here
//* DEBUG: */ outputHtml('***Original=' . $str.'***<br />');
- for ($idx = '0'; $idx < strlen($str); $idx++) {
+ for ($idx = 0; $idx < strlen($str); $idx++) {
// Get char on scrambled position
$char = substr($str, $scrambleNums[$idx], 1);
// Begin descrambling
$orig = str_repeat(' ', 40);
//* DEBUG: */ outputHtml('+++Scrambled=' . $str.'+++<br />');
- for ($idx = '0'; $idx < 40; $idx++) {
+ for ($idx = 0; $idx < 40; $idx++) {
$char = substr($str, $idx, 1);
$orig = substr_replace($orig, $char, $scrambleNums[$idx], 1);
} // END - for
$scrambleNumbers = array();
// First we need to setup randomized numbers from 0 to 31
- for ($idx = '0'; $idx < $len; $idx++) {
+ for ($idx = 0; $idx < $len; $idx++) {
// Generate number
$rand = mt_rand(0, ($len -1));
if ($runTime < 0) $runTime = '0';
// Prepare output
+ // @TODO This can be easily moved out after the merge from EL branch to this is complete
$content = array(
- 'runtime' => translateComma($runTime),
- 'timeSQLs' => translateComma(getConfig('sql_time') * 1000),
+ 'run_time' => translateComma($runTime),
+ 'sql_time' => translateComma(getConfig('sql_time') * 1000),
);
// Load the template
} // END - if
// Default message
- $message = getMaskedMessage('EXTENSION_PROBLEM_EXT_NOT_INSTALLED', $ext_name);
+ $message = getMaskedMessage('EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED', $ext_name);
// Is an admin logged in?
if (isAdmin()) {
// Then output admin message
- $message = getMaskedMessage('ADMIN_EXTENSION_PROBLEM_EXT_NOT_INSTALLED', $ext_name);
+ $message = getMaskedMessage('ADMIN_EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED', $ext_name);
} // END - if
// Return prepared message
}
// Generates a 'selection box' from given array
-function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent='') {
+function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent = '', $extraName = '') {
// Start the output
$OUT = '<select name="' . $name . '" size="1" class="admin_select">
<option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>';
// Add the <option> entry
if (empty($optionContent)) {
// ... from template
- $OUT .= loadTemplate('select_' . $name . '_option', true, $option);
+ $OUT .= loadTemplate('select_' . $name . $extraName . '_option', true, $option);
} else {
// Direct HTML code
$OUT .= '<option value="' . $option[$optionValue] . '">' . $option[$optionContent] . '</option>';
);
// Load template and return it
- return loadTemplate('select_' . $name . '_box', true, $content);
+ return loadTemplate('select_' . $name . $extraName . '_box', true, $content);
}
// Get a module from filename and access level