Exemplo n.º 1
0
    var confirmBox = confirm('Are you sure to remove selected item?' + "\n" + 'Once deleted, it can\'t be restored!');
    if (confirmBox) {
        // set hidden element value
        document.hiddenActionForm.bid.value = int_biblio_id;
        document.hiddenActionForm.remove.value = int_item_id;
        // submit form
        document.hiddenActionForm.submit();
    }
}
</script>
<?php 
/* main content */
if (isset($_POST['remove'])) {
    $id = (int) $_POST['remove'];
    $bid = (int) $_POST['bid'];
    $sql_op = new simbio_dbop($dbs);
    // check if the item still on loan
    $loan_q = $dbs->query('SELECT DISTINCT l.item_code, b.title FROM loan AS l
        LEFT JOIN item AS i ON l.item_code=i.item_code
        LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id
        WHERE i.item_id=' . $id . ' AND l.is_lent=1 AND l.is_return=0');
    $loan_d = $loan_q->fetch_row();
    // send an alert if the member cant be deleted
    if ($loan_q->num_rows > 0) {
        echo '<script type="text/javascript">';
        echo 'alert(\'' . lang_mod_biblio_item_alert_delete_fail_on_loan . '\');';
        echo 'self.location.href = \'iframe_item_list.php?biblioID=' . $bid . '\';';
        echo '</script>';
    } else {
        if ($sql_op->delete('item', 'item_id=' . $id)) {
            echo '<script type="text/javascript">';
Exemplo n.º 2
0
                echo '<script type="text/javascript">parent.jQuery(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
            } else {
                utility::jsAlert(__('Subject Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        // create sql op object
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_topic', 'topic_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
</script>
<?php 
/* main content */
// topic of removal
if (isset($_GET['removesess'])) {
    $idx = $_GET['removesess'];
    unset($_SESSION['biblioTopic'][$idx]);
    echo '<script type="text/javascript">';
    echo 'alert(\'Topic removed!\');';
    echo 'location.href = \'iframe_topic.php\';';
    echo '</script>';
}
if (isset($_POST['remove'])) {
    $id = (int) $_POST['remove'];
    $bid = (int) $_POST['bid'];
    $sql_op = new simbio_dbop($dbs);
    $sql_op->delete('biblio_topic', 'topic_id=' . $id . ' AND biblio_id=' . $bid);
    echo '<script type="text/javascript">';
    echo 'alert(\'Topic succesfully removed!\');';
    echo 'location.href = \'iframe_topic.php?biblioID=' . $bid . '\';';
    echo '</script>';
}
// if biblio ID is set
if ($biblioID) {
    $table = new simbio_table();
    $table->table_attr = 'align="center" style="width: 100%;" cellpadding="2" cellspacing="0"';
    // database list
    $biblio_topic_q = $dbs->query("SELECT bt.*, t.topic, t.topic_type FROM biblio_topic AS bt\n    LEFT JOIN mst_topic AS t ON bt.topic_id=t.topic_id\n    WHERE bt.biblio_id={$biblioID} ORDER BY level ASC");
    $row = 1;
    while ($biblio_topic_d = $biblio_topic_q->fetch_assoc()) {
        // alternate the row color
Exemplo n.º 4
0
</script>
<?php 
/* main content */
// author of removal
if (isset($_GET['removesess'])) {
    $idx = $_GET['removesess'];
    unset($_SESSION['biblioAuthor'][$idx]);
    echo '<script type="text/javascript">';
    echo 'alert(\'' . __('Author succesfully removed!') . '\');';
    echo 'location.href = \'iframe_author.php\';';
    echo '</script>';
}
if (isset($_POST['remove'])) {
    $id = (int) $_POST['remove'];
    $bid = (int) $_POST['bid'];
    $sql_op = new simbio_dbop($dbs);
    $sql_op->delete('biblio_author', 'author_id=' . $id . ' AND biblio_id=' . $bid);
    echo '<script type="text/javascript">';
    echo 'alert(\'' . __('Author removed!') . '\');';
    echo 'location.href = \'iframe_author.php?biblioID=' . $bid . '\';';
    echo '</script>';
}
// if biblio ID is set
if ($biblioID) {
    $table = new simbio_table();
    $table->table_attr = 'align="center" style="width: 100%;" cellpadding="2" cellspacing="0"';
    // database list
    $biblio_author_q = $dbs->query("SELECT ba.*, a.author_name, a.author_year, a.authority_type FROM biblio_author AS ba\n      LEFT JOIN mst_author AS a ON ba.author_id=a.author_id\n      WHERE ba.biblio_id={$biblioID} ORDER BY level ASC");
    $row = 1;
    while ($biblio_author_d = $biblio_author_q->fetch_assoc()) {
        // alternate the row color
Exemplo n.º 5
0
 $author_cache = array();
 $subject_cache = array();
 $input_date = date('Y-m-d H:i:s');
 // record counter
 $r = 0;
 foreach ($_POST['p2precord'] as $id) {
     // construct full XML URI
     $detail_uri = $p2pserver . "/index.php?p=show_detail&inXML=true&id=" . $id;
     // parse XML
     $data = modsXMLsenayan($detail_uri, 'uri');
     // get record detail
     $record = $data['records'][0];
     // insert record to database
     if ($record) {
         // create dbop object
         $sql_op = new simbio_dbop($dbs);
         // escape all string value
         foreach ($record as $field => $content) {
             if (is_string($content)) {
                 $biblio[$field] = $dbs->escape_string(trim($content));
             }
         }
         // gmd
         $biblio['gmd_id'] = utility::getID($dbs, 'mst_gmd', 'gmd_id', 'gmd_name', $record['gmd'], $gmd_cache);
         unset($biblio['gmd']);
         // publisher
         $biblio['publisher_id'] = utility::getID($dbs, 'mst_publisher', 'publisher_id', 'publisher_name', $record['publisher'], $publ_cache);
         unset($biblio['publisher']);
         // publish place
         $biblio['publish_place_id'] = utility::getID($dbs, 'mst_place', 'place_id', 'place_name', $record['publish_place'], $place_cache);
         unset($biblio['publish_place']);
Exemplo n.º 6
0
                utility::jsAlert(__('New Language Data Successfully Saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Language Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array($dbs->escape_string(trim($_POST['itemID'])));
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = $dbs->escape_string(trim($itemID));
            if (!$sql_op->delete('mst_language', "language_id='{$itemID}'")) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 7
0
}
// check for file ID in url
$fileID = 0;
if (isset($_GET['fileID']) and $_GET['fileID']) {
    $fileID = (int) $_GET['fileID'];
}
// start the output buffer
ob_start();
/* main content */
// biblio topic save proccess
if (isset($_POST['upload']) and trim(strip_tags($_POST['fileTitle'])) != '') {
    $uploaded_file_id = 0;
    $title = trim(strip_tags($_POST['fileTitle']));
    $url = trim(strip_tags($_POST['fileURL']));
    // create new sql op object
    $sql_op = new simbio_dbop($dbs);
    // FILE UPLOADING
    if (isset($_FILES['file2attach']) and $_FILES['file2attach']['size']) {
        // create upload object
        $file_dir = trim($_POST['fileDir']);
        $file_upload = new simbio_file_upload();
        $file_upload->setAllowableFormat($sysconf['allowed_file_att']);
        $file_upload->setMaxSize($sysconf['max_upload'] * 1024);
        $file_upload->setUploadDir(REPO_BASE_DIR . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $file_dir));
        $file_upload_status = $file_upload->doUpload('file2attach');
        if ($file_upload_status === UPLOAD_SUCCESS) {
            $file_ext = substr($file_upload->new_filename, strrpos($file_upload->new_filename, '.') + 1);
            $fdata['uploader_id'] = $_SESSION['uid'];
            $fdata['file_title'] = $dbs->escape_string($title);
            $fdata['file_name'] = $dbs->escape_string($file_upload->new_filename);
            $fdata['file_url'] = $dbs->escape_string($url);
Exemplo n.º 8
0
    $_q = $dbs->query('SELECT topic_id FROM mst_topic WHERE topic=\'' . $str_subject . '\'');
    if ($_q->num_rows > 0) {
        $_d = $_q->fetch_row();
        // return the subject/topic ID
        return $_d[0];
    }
    return false;
}
// start the output buffer
ob_start();
/* main content */
// biblio topic save proccess
if (isset($_POST['save']) and (isset($_POST['topicID']) or trim($_POST['search_str']))) {
    $subject = trim($dbs->escape_string(strip_tags($_POST['search_str'])));
    // create new sql op object
    $sql_op = new simbio_dbop($dbs);
    // check if biblioID POST var exists
    if (isset($_POST['biblioID']) and !empty($_POST['biblioID'])) {
        $data['biblio_id'] = (int) $_POST['biblioID'];
        // check if the topic select list is empty or not
        if (!empty($_POST['topicID'])) {
            $data['topic_id'] = $_POST['topicID'];
        } else {
            if ($subject and empty($_POST['topicID'])) {
                // check subject
                $subject_id = checkSubject($subject);
                if ($subject_id !== false) {
                    $data['topic_id'] = $subject_id;
                } else {
                    // adding new topic
                    $topic_data['topic'] = $subject;
Exemplo n.º 9
0
require SB . 'admin/default/session_check.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_GUI/paging/simbio_paging.inc.php';
require SIMBIO . 'simbio_DB/datagrid/simbio_dbgrid.inc.php';
require SIMBIO . 'simbio_DB/simbio_dbop.inc.php';
// privileges checking
$can_read = utility::havePrivilege('master_file', 'r');
$can_write = utility::havePrivilege('master_file', 'w');
// GET ID FROM URL
$itemID = (int) isset($_GET['itemID']) ? $_GET['itemID'] : 0;
if (isset($_POST['save'])) {
    $data['topic_id'] = (int) $_POST['topic_id'];
    $data['scope'] = trim($dbs->escape_string(strip_tags($_POST['scope'])));
    # create new sql op object
    $sql_op = new simbio_dbop($dbs);
    if (!empty($_POST['vocabolary_id'])) {
        // do update
        $save = $sql_op->update('mst_voc_ctrl', $data, 'vocabolary_id=' . $_POST['vocabolary_id']);
    } else {
        // insert
        $save = $sql_op->insert('mst_voc_ctrl', $data);
    }
    if (isset($_POST['delete'])) {
        # create new sql op object
        $save = $sql_op->delete('mst_voc_ctrl', 'vocabolary_id=' . $_POST['vocabolary_id']);
    }
    if ($save) {
        $alert_save = '<script type="text/javascript">';
        $alert_save .= 'alert(\'' . __('Data saved!') . '\');';
        $alert_save .= 'parent.setIframeContent(\'itemIframe\', \'' . MWB . 'master_file/iframe_vocabolary_control.php?itemID=' . $data['topic_id'] . '\');';
Exemplo n.º 10
0
    $_q = $dbs->query('SELECT author_id FROM mst_author WHERE author_name=\'' . $str_author_name . '\' AND authority_type=\'' . $str_author_type . '\'');
    if ($_q->num_rows > 0) {
        $_d = $_q->fetch_row();
        // return the author ID
        return $_d[0];
    }
    return false;
}
// start the output buffer
ob_start();
/* main content */
// biblio author save proccess
if (isset($_POST['save']) and (isset($_POST['authorID']) or trim($_POST['search_str']))) {
    $author_name = trim($dbs->escape_string(strip_tags($_POST['search_str'])));
    // create new sql op object
    $sql_op = new simbio_dbop($dbs);
    // check if biblioID POST var exists
    if (isset($_POST['biblioID']) and !empty($_POST['biblioID'])) {
        $data['biblio_id'] = intval($_POST['biblioID']);
        // check if the author select list is empty or not
        if (isset($_POST['authorID']) and !empty($_POST['authorID'])) {
            $data['author_id'] = $_POST['authorID'];
        } else {
            if ($author_name and empty($_POST['authorID'])) {
                // check author
                $author_id = checkAuthor($author_name, $_POST['type']);
                if ($author_id !== false) {
                    $data['author_id'] = $author_id;
                } else {
                    // adding new author
                    $author_data['author_name'] = $author_name;
 /**
     * LDAP/Active directory login
     *
     * @return  boolean
     */
    protected function ldapLogin() {
        global $ldap_configs;
        if (!function_exists('ldap_connect')) {
            $this->errors = 'LDAP library is not installed yet!';
            return false;
        }
        // connect to Directory Server
        $_ds = $ldap_configs['ldap_port']?ldap_connect($ldap_configs['ldap_server'], $ldap_configs['ldap_port']):ldap_connect($ldap_configs['ldap_server']);

        // check LDAP options
        if ($ldap_configs['ldap_options']) {
            foreach ($ldap_configs['ldap_options'] as $_opt) {
                @ldap_set_option($_ds, $_opt[0], $_opt[1]);
            }
        }

        // LDAP Connection check
        if (!$_ds) {
            $this->errors = 'Failed to connect to LDAP server';
            return false;
        }

        // LDAP binding
        // for Active Directory Server login active line below
        // $_bind = ldap_bind($_ds, ( $ldap_configs['ldap_suffix']?$this->username.'@'.$ldap_configs['ldap_suffix']:$this->username ), $this->password);
        $_bind = @ldap_bind($_ds,
            str_ireplace('#loginUserName', $this->username, $ldap_configs['ldap_bind_dn']),
            $this->password);

        if (!$_bind) {
            $this->errors = 'Failed to bind to directory server!';
            return false;
        }

        $_filter = str_ireplace('#loginUserName', $this->username, $ldap_configs['ldap_search_filter']);

        // run query
        $_search = @ldap_search($_ds, $ldap_configs['ldap_base_dn'], $_filter);
        if (!$_search) {
            $this->errors = 'LDAP search failed because of error!';
            return false;
        }

        // get query entry
        $_entries = @ldap_get_entries($_ds, $_search);
        if ($_entries) {
            $this->user_info['member_id'] = $_entries[0]['uid'][0];
            // check member in database
            $_check_q = $this->obj_db->query('SELECT m.member_id, m.member_name, m.inst_name,
                m.member_email, m.expire_date, m.register_date, m.is_pending,
                m.member_type_id, mt.member_type_name
                FROM member AS m LEFT JOIN mst_member_type AS mt ON m.member_type_id=mt.member_type_id
                WHERE m.member_id=\''.$this->user_info['member_id'].'\'');
            if ($_check_q->num_rows < 1) {
                $_curr_date = date('Y-m-d H:i:s');
                // insert member data to database
                $this->user_info['member_id'] = $_entries[0]['uid'][0];
                $this->user_info['member_name'] = $_entries[0]['cn'][0];
                $this->user_info['gender'] = '1';
                $this->user_info['inst_name'] = 'New registered member';
                $this->user_info['member_email'] = $_entries[0]['mail'][0];
                $this->user_info['expire_date'] = '0000-00-00';
                $this->user_info['register_date'] = '0000-00-00';
                $this->user_info['is_pending'] = '1';
                $this->user_info['member_type_id'] = '1';
                $this->user_info['input_date'] = $_curr_date;
                $this->user_info['last_update'] = $_curr_date;

                // include database operation library
                require_once SIMBIO_BASE_DIR.'simbio_DB/simbio_dbop.inc.php';
                $_dbop = new simbio_dbop($this->obj_db);
                $_insert = $_dbop->insert('member', $this->user_info);
                if (!$_insert) {
                    $this->errors = 'Member insertion error because of: '.$_dbop->error;
                }
                $this->user_info['member_type_name'] = 'None';
            } else {
                $this->user_info = $_check_q->fetch_assoc();
            }
        } else {
            $this->errors = 'LDAP Record not found!';
            return false;
        }

        // closing connection
        ldap_close($_ds);
        return true;
    }
Exemplo n.º 12
0
                utility::jsAlert(__('New Supplier Data Successfully Saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Supplier Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_supplier', 'supplier_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 13
0
// check if there is any active stock take proccess
$stk_q = $dbs->query('SELECT * FROM stock_take WHERE is_active=1');
if ($stk_q->num_rows) {
    echo '<div class="errorBox">' . __('There is already stock taking proccess running!') . '</div>';
} else {
    // add new stock take
    if (isset($_POST['saveData']) and empty($_POST['name'])) {
        utility::jsAlert(__('Stock Take Name must be filled!'));
        exit;
    } else {
        if (isset($_POST['saveData']) and !empty($_POST['name'])) {
            $data['stock_take_name'] = trim($dbs->escape_string(strip_tags($_POST['name'])));
            $data['start_date'] = date('Y-m-d H:i:s');
            $data['init_user'] = $_SESSION['realname'];
            $data['is_active'] = 1;
            $sql_op = new simbio_dbop($dbs);
            if ($sql_op->insert('stock_take', $data)) {
                // get latest stock take id
                $stock_take_id = $sql_op->insert_id;
                // criteria
                $criteria = ' WHERE item_id IS NOT NULL ';
                // gmd
                if ($_POST['gmdID'] != '0') {
                    $criteria .= ' AND b.gmd_id=' . intval($_POST['gmdID']) . ' ';
                }
                // collection type
                if ($_POST['collTypeID'] != '0') {
                    $criteria .= ' AND i.coll_type_id=\'' . intval($_POST['collTypeID']) . '\' ';
                }
                // location
                if ($_POST['location'] != '0') {
Exemplo n.º 14
0
                }
            } else {
                utility::jsAlert(__('Item Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        // create sql op object
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        $still_on_loan = array();
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // check if the item still on loan
            $loan_q = $dbs->query('SELECT i.item_code, b.title, COUNT(l.loan_id) FROM item AS i
            LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id
            LEFT JOIN loan AS l ON (i.item_code=l.item_code AND l.is_lent=1 AND l.is_return=0)
            WHERE i.item_id=' . $itemID . ' GROUP BY i.item_code');
Exemplo n.º 15
0
            utility::jsAlert(__('New Loan Rules Successfully Saved'));
            echo '<script language="Javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
        } else {
            utility::jsAlert(__('Loan Rules FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
        }
        exit;
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        // create sql op object
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_loan_rules', 'loan_rules_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 16
0
                if ($insert) {
                    utility::jsAlert(__('New Fines Data Successfully Saved'));
                } else {
                    utility::jsAlert(__('Fines Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
                }
            }
        }
    }
} else {
    if ($_SESSION['uid'] == 1 && isset($_POST['itemID']) && !empty($_POST['itemID']) && isset($_POST['itemAction'])) {
        // only admin can delete
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('fines', 'fines_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 17
0
                utility::jsAlert(lang_mod_masterfile_author_alert_new_add_ok);
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(lang_mod_masterfile_author_alert_add_fail . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_author', 'author_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 18
0
    @unlink(REPO_BASE_DIR . str_replace('/', DIRECTORY_SEPARATOR, $_SESSION['biblioAttach'][$idx]['file_dir']) . DIRECTORY_SEPARATOR . $_SESSION['biblioAttach'][$idx]['file_name']);
    // remove session array
    unset($_SESSION['biblioAttach'][$idx]);
    echo '<script type="text/javascript">';
    echo 'alert(\'' . __('Attachment removed!') . '\');';
    echo 'location.href = \'iframe_attach.php\';';
    echo '</script>';
}
if (isset($_POST['bid']) and isset($_POST['remove'])) {
    $bid = (int) $_POST['bid'];
    $file = (int) $_POST['remove'];
    // query file data from database
    $file_q = $dbs->query('SELECT * FROM files WHERE file_id=' . $file);
    $file_d = $file_q->fetch_assoc();
    // attachment data delete
    $sql_op = new simbio_dbop($dbs);
    $sql_op->delete('biblio_attachment', "file_id={$file} AND biblio_id={$bid}");
    echo '<script type="text/javascript">';
    if ($_POST['alsoDeleteFile'] == '1') {
        // remove file from repository and filesystem
        @unlink(REPO_BASE_DIR . str_replace('/', DIRECTORY_SEPARATOR, $file_d['file_dir']) . DIRECTORY_SEPARATOR . $file_d['file_name']);
        echo 'alert(\'Attachment ' . $file_d['file_name'] . ' succesfully removed!\');';
    }
    echo 'location.href = \'iframe_attach.php?biblioID=' . $bid . '\';';
    echo '</script>';
}
// if biblio ID is set
if ($biblioID) {
    $table = new simbio_table();
    $table->table_attr = 'align="center" style="width: 100%;" cellpadding="2" cellspacing="0"';
    // database list
Exemplo n.º 19
0
                echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . MODULES_WEB_ROOT_DIR . 'bibliography/index.php\', {method: \'post\', addData: \'itemID=' . $last_biblio_id . '&detail=true\'});</script>';
            } else {
                utility::jsAlert(__('Bibliography Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        // create sql op object
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        $still_have_item = array();
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        $http_query = '';
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // check if this biblio data still have an item
            $_sql_biblio_item_q = sprintf('SELECT b.title, COUNT(item_id) FROM biblio AS b
            LEFT JOIN item AS i ON b.biblio_id=i.biblio_id
            WHERE b.biblio_id=%d GROUP BY title', $itemID);
Exemplo n.º 20
0
                    } else {
                        utility::jsAlert(__('User Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
                    }
                    exit;
                }
            }
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // get user data
            $user_q = $dbs->query('SELECT username, realname FROM user WHERE user_id=' . $itemID);
            $user_d = $user_q->fetch_row();
            if (!$sql_op->delete('user', "user_id='{$itemID}'")) {
                $error_num++;
            } else {
Exemplo n.º 21
0
                utility::jsAlert(__('New Item Status Data Successfully Saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Item Status Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array($dbs->escape_string(trim($_POST['itemID'])));
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = $dbs->escape_string(trim($itemID));
            if (!$sql_op->delete('mst_item_status', "item_status_id='{$itemID}'")) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 22
0
                utility::jsAlert(__('New Module Data Successfully Saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Module Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // get module data
            $module_q = $dbs->query('SELECT module_name, module_path FROM mst_module WHERE module_id=' . $itemID);
            $module_d = $module_q->fetch_row();
            if (!$sql_op->delete('mst_module', "module_id={$itemID}")) {
                $error_num++;
            } else {
Exemplo n.º 23
0
                utility::jsAlert(__('Content data saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Content data FAILED to save!') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // get content data
            $content_q = $dbs->query('SELECT content_title FROM content WHERE content_id=' . $itemID);
            $content_d = $content_q->fetch_row();
            if (!$sql_op->delete('content', "content_id='{$itemID}'")) {
                $error_num++;
            } else {
Exemplo n.º 24
0
                }
                echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '?mode=special\');</script>';
                exit;
            } else {
                utility::jsAlert(__('Holiday FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // get info about this holiday
            $rec_q = $dbs->query('SELECT holiday_date FROM holiday WHERE holiday_id=' . $itemID);
            $rec_d = $rec_q->fetch_row();
            if (!$sql_op->delete('holiday', 'holiday_id=' . $itemID)) {
                $error_num++;
            } else {
Exemplo n.º 25
0
                }
                // write log
                utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'system', $_SESSION['realname'] . ' add new group (' . $groupName . ')');
                utility::jsAlert(__('New Group Data Successfully Saved'));
                echo '<script type="text/javascript">parent.setContent(\'mainContent\', \'' . $_SERVER['PHP_SELF'] . '\', \'post\');</script>';
            } else {
                utility::jsAlert(__('Group Data FAILED to Save. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            // get group data
            $group_q = $dbs->query('SELECT group_name FROM user_group WHERE group_id=' . $itemID);
            $group_d = $group_q->fetch_row();
            if (!$sql_op->delete('user_group', 'group_id=' . $itemID)) {
                $error_num++;
            } else {
Exemplo n.º 26
0
                utility::jsAlert(__('New Frequency Data Successfully Saved'));
                echo '<script type="text/javascript">parent.jQuery(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
            } else {
                utility::jsAlert(__('Frequency Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_frequency', 'frequency_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 27
0
         $mtype_d = $mtype_q->fetch_row();
         $expire_date = simbio_date::getNextDate($mtype_d[0], $curr_date);
         @$dbs->query('UPDATE member SET expire_date=\'' . $expire_date . '\' WHERE member_id=\'' . $memberID . '\'');
         // write log
         utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'membership', $_SESSION['realname'] . ' extends membership for member (' . $mtype_d[1] . ') with ID (' . $memberID . ')');
         $num_extended++;
     }
     header('Location: ' . MODULES_WEB_ROOT_DIR . 'membership/index.php?expire=true&numExtended=' . $num_extended);
     exit;
 } else {
     if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
         if (!($can_read and $can_write)) {
             die;
         }
         /* DATA DELETION PROCESS */
         $sql_op = new simbio_dbop($dbs);
         $failed_array = array();
         $error_num = 0;
         $still_have_loan = array();
         if (!is_array($_POST['itemID'])) {
             // make an array
             $_POST['itemID'] = array($dbs->escape_string(trim($_POST['itemID'])));
         }
         // loop array
         foreach ($_POST['itemID'] as $itemID) {
             $itemID = $dbs->escape_string(trim($itemID));
             // check if the member still have loan
             $loan_q = $dbs->query('SELECT DISTINCT m.member_id, m.member_name, COUNT(l.loan_id) FROM member AS m
         LEFT JOIN loan AS l ON (m.member_id=l.member_id AND l.is_lent=1 AND l.is_return=0)
         WHERE m.member_id=\'' . $itemID . '\' GROUP BY m.member_id');
             $loan_d = $loan_q->fetch_row();
Exemplo n.º 28
0
                utility::jsAlert(__('New Place Data Successfully Saved'));
                echo '<script type="text/javascript">parent.jQuery(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
            } else {
                utility::jsAlert(__('Place Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_place', 'place_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 29
0
                utility::jsAlert(__('New GMD Data Successfully Saved'));
                echo '<script type="text/javascript">parent.jQuery(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
            } else {
                utility::jsAlert(__('GMD Data FAILED to Save. Please Contact System Administrator') . "\nDEBUG : " . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_gmd', 'gmd_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {
Exemplo n.º 30
0
                utility::jsAlert(__('New Member Type Successfully Saved'));
                echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
            } else {
                utility::jsAlert(__('Member Type Data FAILED to Save/Update. Please Contact System Administrator') . "\n" . $sql_op->error);
            }
            exit;
        }
    }
    exit;
} else {
    if (isset($_POST['itemID']) and !empty($_POST['itemID']) and isset($_POST['itemAction'])) {
        if (!($can_read and $can_write)) {
            die;
        }
        /* DATA DELETION PROCESS */
        $sql_op = new simbio_dbop($dbs);
        $failed_array = array();
        $error_num = 0;
        if (!is_array($_POST['itemID'])) {
            // make an array
            $_POST['itemID'] = array((int) $_POST['itemID']);
        }
        // loop array
        foreach ($_POST['itemID'] as $itemID) {
            $itemID = (int) $itemID;
            if (!$sql_op->delete('mst_member_type', 'member_type_id=' . $itemID)) {
                $error_num++;
            }
        }
        // error alerting
        if ($error_num == 0) {