Example #1
0
 public function testMBYTE_eregiWhenRegsNotNull()
 {
     $dummy[0] = 'Pat';
     $result = MBYTE_eregi('pat', 'Pat my pattern', $regs);
     $this->assertEquals($dummy[0], $regs[0], 'Error asserting that correct pattern was matched.');
     $this->assertEquals(3, $result, 'Error asserting pattern matched was corret length.');
 }
Example #2
0
if (isset($_CONF['mail_settings']['password'])) {
    unset($_CONF['mail_settings']['password']);
}
$display = "<html>\n<head><title>Configuration Settings</title></head>\n<body>\n";
$n = 0;
$display .= '<table width="100%" cellspacing="0" cellpadding="0" border="0" style="border: thin black solid;">';
foreach ($_CONF as $option => $value) {
    $display .= '<tr';
    if ($n % 2 == 0) {
        $display .= ' style="background-color: ' . $highlight_on . '">';
    } else {
        $display .= ' style="background-color: ' . $highlight_off . '">';
    }
    $display .= '<td style="border: thin black solid; padding: 2px;"><strong>$_CONF[\'<a href="' . $docs . $option . '">' . $option . '</a>\']</strong></td>';
    if (is_array($value)) {
        ob_start();
        print_r($value);
        $value = COM_nl2br(ob_get_clean());
    } elseif (is_bool($value)) {
        $value = $value === false ? 'false' : 'true';
    } elseif (MBYTE_eregi('[a-z]+html', $option)) {
        $value = htmlentities($value);
    } elseif (!isset($value)) {
        $value = '&nbsp;';
    }
    $display .= '<td style="border: thin black solid; padding: 2px;"><strong>' . $value . '</strong></td>';
    $display .= '</tr>';
    $n++;
}
$display .= "</table>\n</body>\n</html>";
echo $display;
 public function testMBYTE_eregiWhenRegsNotNull()
 {
     $dummy[0] = 'n';
     $result = MBYTE_eregi('n', utf8_encode('Användare'), $regs);
     $this->assertEquals($dummy[0], $regs[0], 'Error asserting that correct pattern was matched.');
     $this->assertEquals(1, $result, 'Error asserting pattern matched was corret length.');
 }
Example #4
0
 /**
  * returns a sql string that has the pesky date_sub removed from it
  *
  *
  * @param    string      $sql    SQL that needs conversion
  * @return   string      return sql string
  *
  */
 function cleanse_date_sub($sql)
 {
     $string = $sql;
     $testString = strtolower($string);
     $isIn = strpos($testString, 'date_sub');
     while ($isIn > 0) {
         $testString = strtolower($string);
         $isIn = strpos($testString, 'date_sub');
         if ($isIn > 0) {
             $startLoc = strpos($testString, 'date_sub');
             $rightStr = ltrim(substr($string, $startLoc + 8, strlen($string)));
             //eregi("\((.*),([^\)]+\))", $rightStr,$left);
             MBYTE_eregi("\\(([^,]+),([^\\)]+\\))", $rightStr, $left);
             $firstParm = $left[1];
             $secondParm = trim($left[2]);
             $secondParm = str_replace("interval", "", $secondParm);
             $secondParm = str_replace(")", "", $secondParm);
             $left[2] = str_replace(")", "", $left[2]);
             $testMode = strpos($string, 'date_sub');
             if ($testMode > 0) {
                 $mode = 0;
             } else {
                 $mode = 1;
             }
             if ($mode == 0) {
                 $replaceString = 'date_sub(' . $firstParm . ',' . $left[2] . ')';
             } else {
                 $replaceString = 'DATE_SUB(' . $firstParm . ',' . $left[2] . ')';
             }
             $secondParmArray = explode(' ', $secondParm);
             $intervalTime = $secondParmArray[1];
             $typeForInterval = $secondParmArray[2];
             if ($intervalTime > 0) {
                 $intervalTime = '-' . $intervalTime;
             }
             $replaceWITHString = "dateadd({$typeForInterval},{$intervalTime},{$firstParm})";
             $string = str_replace($replaceString, $replaceWITHString, $string);
             //$replaceString='DATE_SUB(' . $firstParm . ',' . $left[2] . ')';
             //$string=str_replace($replaceString,$replaceWITHString,$string);
             $tempsql = str_replace("now()", "getDate()", $string);
             $string = $tempsql;
         }
     }
     return $string;
 }