Exemplo n.º 1
0
    exit;
}
/* RECORD OPERATION */
if (isset($_POST['saveData']) and $can_read and $can_write) {
    $title = trim(strip_tags($_POST['title']));
    // check form validity
    if (empty($title)) {
        utility::jsAlert(__('Title can not be empty'));
        exit;
    } else {
        // include custom fields file
        if (file_exists(MDLBS . 'bibliography/custom_fields.inc.php')) {
            include MDLBS . 'bibliography/custom_fields.inc.php';
        }
        // create biblio_indexer class instance
        $indexer = new biblio_indexer($dbs);
        /**
         * Custom fields
         */
        if (isset($biblio_custom_fields)) {
            if (is_array($biblio_custom_fields) && $biblio_custom_fields) {
                foreach ($biblio_custom_fields as $fid => $cfield) {
                    // custom field data
                    $cf_dbfield = $cfield['dbfield'];
                    if (isset($_POST[$cf_dbfield])) {
                        $cf_val = $dbs->escape_string(strip_tags(trim($_POST[$cf_dbfield]), $sysconf['content']['allowable_tags']));
                        if ($cf_val) {
                            $custom_data[$cf_dbfield] = $cf_val;
                        } else {
                            $custom_data[$cf_dbfield] = 'literal{\'\'}';
                        }
Exemplo n.º 2
0
        if ($indexer->failed) {
            $message = '<div style="color: #f00;">' . sprintf(__('<strong>%d</strong> index records failed to indexed. The IDs are: %s'), count($indexer->failed), implode(', ', $indexer->failed)) . '</div>';
        }
        $_SESSION['message'] = $message;
    }
    /* re-create index table */
    if ($_GET['detail'] == 'reindex') {
        set_time_limit(0);
        $bib_sql = 'SELECT COUNT(*) FROM search_biblio';
        $rec_bib_q = $dbs->query($bib_sql);
        $rec_bib_d = $rec_bib_q->fetch_row();
        if ($rec_bib_d[0] > 0) {
            $message = __('Please empty the Index first before re-creating the Index');
            echo '<div class="errorBox">' . $message . '</div>' . "\n";
        } else {
            $indexer = new biblio_indexer($dbs);
            $indexer->createFullIndex(false);
            $finish_minutes = $indexer->indexing_time / 60;
            $finish_sec = $indexer->indexing_time % 60;
            // message
            $message = sprintf(__('<strong>%d</strong> records (from total of <strong>%d</strong>) re-indexed. Finished in %d second(s)'), $indexer->indexed, $indexer->total_records, $finish_minutes, $finish_sec);
            if ($indexer->failed) {
                $message = '<div style="color: #f00;">' . sprintf(__('<strong>%d</strong> index records failed to indexed. The IDs are: %s'), count($indexer->failed), implode(', ', $indexer->failed)) . '</div>';
            }
            $_SESSION['message'] = $message;
        }
    }
    echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
    exit;
} else {
    ?>
Exemplo n.º 3
0
// start the session
require SB . 'admin/default/session.inc.php';
require SIMBIO . 'simbio_DB/simbio_dbop.inc.php';
require SIMBIO . 'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO . 'simbio_GUI/form_maker/simbio_form_table_AJAX.inc.php';
require SIMBIO . 'simbio_FILE/simbio_file_upload.inc.php';
// privileges checking
$can_read = utility::havePrivilege('bibliography', 'r');
$can_write = utility::havePrivilege('bibliography', 'w');
if (!$can_read) {
    die('<div class="errorBox">' . __('You are not authorized to view this section') . '</div>');
}
if ($sysconf['index']['type'] == 'index') {
    require MDLBS . 'system/biblio_indexer.inc.php';
    // create biblio_indexer class instance
    $indexer = new biblio_indexer($dbs);
}
// max chars in line for file operations
$max_chars = 1024 * 100;
if (isset($_POST['doImport'])) {
    // check for form validity
    if (!$_FILES['importFile']['name']) {
        utility::jsAlert(__('Please select the file to import!'));
        exit;
    } else {
        if (empty($_POST['fieldSep']) or empty($_POST['fieldEnc'])) {
            utility::jsAlert(__('Required fields (*)  must be filled correctly!'));
            exit;
        } else {
            $start_time = time();
            // set PHP time limit