Example #1
0
 /**
  * @FIXME get_data and has_data should be used exclusively inside templates (not namespaced)
  * @return array|bool
  */
 public static function getMessages()
 {
     $messages = array();
     if (has_data('errorMessage')) {
         $messages['error'] = get_data('errorMessage');
     }
     if (has_data('message')) {
         $messages['info'] = get_data('message');
     }
     return !!count($messages) ? $messages : false;
 }
    foreach ($fields as $field_array) {
        $table_list[] = $field_array['Field'];
    }
    $buffer .= $export;
    // dump the data
    $query = 'select * from `' . $table . '` LIMIT ' . $limit_from . ', ' . $limit_to . ' ';
    $result = $dbc->prepare($query);
    $rows = $dbc->executeGetRows($result);
    foreach ($rows as $row_array) {
        $export = 'insert into `' . $table . '` (`' . implode('`, `', $table_list) . '`) values (';
        $lines_exported++;
        reset($table_list);
        while (list(, $i) = each($table_list)) {
            if (!isset($row_array[$i])) {
                $export .= 'NULL, ';
            } elseif (has_data($row_array[$i])) {
                $row = addslashes($row_array[$i]);
                $row = str_replace("\n#", "\n" . '\\#', $row);
                $export .= '\'' . $row . '\', ';
            } else {
                $export .= '\'\', ';
            }
        }
        $export = substr($export, 0, -2) . ");" . NEWLINE;
        $buffer .= $export;
    }
}
//uncomment line below to show table dumps, inc insert and alter table statements:
//exit('<textarea rows="30" name="themessage" cols="100">'.$buffer.$alter_tables.'</textarea>');
$buffer .= $alter_tables;
$recordBackup->save(time(), strlen($buffer), $lines_exported);