예제 #1
0
파일: index.php 프로젝트: cwcw/cms
    } else {
        mosNotAuth();
    }
} else {
    echo _NOT_EXIST;
}
$_MOS_OPTION['buffer'] = ob_get_contents();
ob_end_clean();
initGzip();
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
// loads template file
if (!file_exists('templates/' . $cur_template . '/index.php')) {
    echo _TEMPLATE_WARN . $cur_template;
} else {
    require_once 'templates/' . $cur_template . '/index.php';
    echo "<!-- " . time() . " -->";
}
// displays queries performed for page
if ($mosConfig_debug) {
    echo $database->_ticker . ' queries executed';
    echo '<pre>';
    foreach ($database->_log as $k => $sql) {
        echo $k + 1 . "\n" . $sql . '<hr />';
    }
}
doGzip();
예제 #2
0
 function _csvExport()
 {
     $db = FabrikWorker::getDbo();
     initGzip();
     $listModel = JModel::getInstance('List', 'FabrikFEModel');
     $id = $this->tableIds[0];
     $listModel->setId($id);
     $listModel->_outPutFormat = 'csv';
     $table =& $listModel->getTable();
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename="' . $table->label . '-export.csv"');
     $aTable = JArrayHelper::fromObject($table);
     $fabrikDb =& $listModel->getDb();
     $table = $table->db_table_name;
     $sql = "SELECT * FROM {$table}";
     $fabrikDb->setQuery($sql);
     $elementData = $fabrikDb->loadObjectList();
     //TODO: replace switchDb
     //$aNewDbInfo 	= switchDatabase($oTable, $oConn);
     //$fabrikDb 		= $aNewDbInfo[0];
     //$table 			= $aNewDbInfo[1];
     $aFilter = array();
     $listModel->getForm();
     $listModel->getFormGroupElementData();
     $listModel->getParams();
     $limitLength = $listModel->getTotalRecords();
     $pageNav = $listModel->_getPagination(count($elementData), 0, $limitLength);
     $formdata = $listModel->getData();
     if (is_array($formdata)) {
         $firstrow = JArrayHelper::fromObject($formdata[0][0]);
         if (is_array($firstrow)) {
             echo implode(",", array_keys($firstrow));
         }
         foreach ($formdata as $group) {
             foreach ($group as $row) {
                 echo "\n";
                 echo implode(",", array_map(array($this, "_quote"), array_values(JArrayHelper::fromObject($row))));
             }
         }
     }
     doGzip();
 }