* NOTE: this is actually a duplicate from the function in
* functions/imap_messages. I'm not sure if it's ok here to call
* that function?
- * @param string $value literal priority name
+ * @param string $sValue literal priority name
* @return integer
*/
- function parsePriority($value) {
- $value = strtolower(array_shift(split('/\w/',trim($value))));
+ function parsePriority($sValue) {
+ // don't use function call inside array_shift.
+ $aValue = split('/\w/',trim($sValue));
+ $value = strtolower(array_shift($aValue));
+
if ( is_numeric($value) ) {
return $value;
}
* X-MS-Mail-Priority is not parsed because it always coincides
* with one of the other headers.
*
- * DUPLICATE CODE ALERT:
+ * FIXME: DUPLICATE CODE ALERT:
* NOTE: this is actually a duplicate from the function in
* class/mime/Rfc822Header.php.
+ * @todo obsolate function or use it instead of code block in parseFetch()
*/
-function parsePriority($value) {
- $value = strtolower(array_shift(split('/\w/',trim($value))));
+function parsePriority($sValue) {
+ $aValue = split('/\w/',trim($sValue));
+ $value = strtolower(array_shift($aValue));
if ( is_numeric($value) ) {
return $value;
}
case 'priority':
case 'importance':
if (!isset($aMsg['x-priority'])) {
- $value = strtolower(array_shift(split('/\w/',trim($value))));
- if (is_numeric($value)) {
- $value = (int) $value;
- } elseif ( $value == 'non-urgent' || $value == 'low' ) {
- $value = 3;
- } elseif ( $value == 'urgent' || $value == 'high' ) {
- $value = 1;
+ $aPrio = split('/\w/',trim($value));
+ $sPrio = strtolower(array_shift($aPrio));
+ if (is_numeric($sPrio)) {
+ $iPrio = (int) $sPrio;
+ } elseif ( $sPrio == 'non-urgent' || $sPrio == 'low' ) {
+ $iPrio = 3;
+ } elseif ( $sPrio == 'urgent' || $sPrio == 'high' ) {
+ $iPrio = 1;
} else {
// default is normal priority
- $value = 3;
+ $iPrio = 3;
}
- $aMsg['x-priority'] = $value;
+ $aMsg['x-priority'] = $iPrio;
}
break;
case 'content-type':
}
/* proto = {mailto,href} */
- $proto = array_shift(array_keys($actions));
- $act = array_shift($actions);
+ $aActions = array_keys($actions);
+ $proto = array_shift($aActions);
+ $act = array_shift($aActions);
if ($proto == 'mailto') {
echo "$IND recode - ";
if (function_exists('recode')) {
echo "Recode functions are available.<br />\n";
-} elseif ($use_php_recode) {
+} elseif (isset($use_php_recode) && $use_php_recode) {
echo "Recode functions are unavailable.<br />\n";
do_err('Your configuration requires recode support, but recode support is missing.');
} else {
echo "$IND iconv - ";
if (function_exists('iconv')) {
echo "Iconv functions are available.<br />\n";
-} elseif ($use_php_iconv) {
+} elseif (isset($use_php_iconv) && $use_php_iconv) {
echo "Iconv functions are unavailable.<br />\n";
do_err('Your configuration requires iconv support, but iconv support is missing.');
} else {
}
foreach($dsns as $type => $dsn) {
- $dbtype = array_shift(explode(':', $dsn));
+ $aDsn = explode(':', $dsn);
+ $dbtype = array_shift($aDsn);
if(isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) {
echo "$IND$dbtype database support present.<br />\n";
echo "$IND$type database connect successful.<br />\n";
} else {
- do_err($db.' database support not present!');
+ do_err($dbtype.' database support not present!');
}
}
} else {