function deQueueMsg($checkSelf = true, $ref = '') { if (empty($ref)) { $ref = $_SERVER['HTTP_REFERER']; } if (!isset($_SESSION['ERROR_QUEUE'])) { return ''; } if (!isset($_SESSION['ERROR_QUEUE'][$ref]) && $checkSelf) { $ref = $_SERVER['PHP_SELF']; } if (!isset($_SESSION['ERROR_QUEUE'][$ref])) { return ''; } $allMsgs = $_SESSION['ERROR_QUEUE'][$ref]; $return = ""; $msg_count = 1; foreach ($allMsgs as $type => $msgs) { if ($type == 'expiration') { continue; } foreach ($msgs as $msg) { $return .= displayMsg($msg, $type); } $msg_count++; } unset($_SESSION['ERROR_QUEUE'][$ref]); return $return; }
function deleteElem($key, array $newarr = NULL) { if ($newarr === NULL) { displayMsg(); return NULL; } else { if (array_key_exists($key, $newarr)) { echo "removed: " . $key . " => " . $newarr[$key] . PHP_EOL; unset($newarr[$key]); echo "elements in the array: " . PHP_EOL; foreach ($newarr as $x => $xvalue) { echo " key= " . $x . " value= " . $xvalue . PHP_EOL; } return $newarr; } } }
if($barcode1==''){ $midT = $member['mid']; $msg = 'The barcode entry field is empty.<hr>' . $mem->toString($member) . '<hr>' . "<a href='member_edit.php?ID=$midT'>Edit Again</a> | <a href='member_view.php?ID=$midT'>View Full Details</a> | <a href='member_browse.php'>Browse Members</a>"; $title = 'No Changes Made'; displayMsg($msg,$title); } if(strlen($barcode1)<5){ $midT = $member['mid']; $msg = 'The barcode must be 5 characters or longer.<hr>' . $mem->toString($member) . '<hr>' . "<a href='member_edit.php?ID=$midT'>Edit Again</a> | <a href='member_view.php?ID=$midT'>View Full Details</a> | <a href='member_browse.php'>Browse Members</a>"; $title = 'No Changes Made'; displayMsg($msg,$title); } $mem->changeBarcode($member, $barcode1); } // Get member details into $row //////////////////////////////////////////// if(!isset($_REQUEST['ID'])){ header("Location: member_browse.php"); exit(); } $row = $mem->getByID($_REQUEST['ID']); // for displaying in page ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
$update_image = array('image' => $fileName, 'id' => $product_id); InsertUpdateRecord($update_image, DB_TABLE_PREFIX . 'product', 'id'); } else { enqueueMsg("Image type does not uploaded, Invalid image file.", "error", 'product.php', false); } } // $message = "Record has beed " . ($id > 0 ? 'updated' : 'added') . "."; // enqueueMsg($message, "success"); if ($_GET['id'] > 0) { header("location:product.php?id=" . $_GET['id']); } else { $message = "Record has beed " . ($id > 0 ? 'updated' : 'added') . "."; enqueueMsg($message, "success"); } } else { $msg = displayMsg('This slug "' . $slug . '" already is use.', 'error'); $var_clear = false; } } } if (isset($_GET['id'])) { $id = $_GET["id"]; $where = array('id' => $id); $result_arr = getRows(DB_TABLE_PREFIX . 'product', $where); if ($result_arr['total_recs'] > 0) { $result = $result_arr['result']; $row_data = GetArr($result); extract($row_data); $var_clear = false; } else { enqueueMsg('Invalid record id.', "alert");
<?php include_once '../inc/config.inc.php'; require_once '../inc/admin_secure.inc.php'; $msg = deQueueMsg(); $var_clear = true; if (!empty($_POST)) { extract($_POST); if (isset($_POST['is_active'])) { $_POST['is_active'] = 'Y'; } else { $_POST['is_active'] = 'N'; } if (empty($services)) { $msg = displayMsg('Enter Service name.', 'error'); $var_clear = false; } else { $update_data = array(); $update_data = array_copy('id,services,price,sort_order,is_active'); $new_id = InsertUpdateRecord($update_data, DB_TABLE_PREFIX . 'services', 'id'); $message = "Record has beed " . ($id > 0 ? 'updated' : 'added') . "."; enqueueMsg($message, $message_type); } } if (isset($_GET['id'])) { $id = $_GET["id"]; $where = array('id' => $id); $result_arr = getRows(DB_TABLE_PREFIX . 'services', $where); if ($result_arr['total_recs'] > 0) { $result = $result_arr['result']; $row_data = GetArr($result);
<?php displayMsg('CLI Exemple file'); $opt = getCliParams('vhp', array('version::', 'help::', 'parameters::')); if (isset($opt['v']) || isset($opt['version'])) { displayMsg('v0.1'); } if (isset($opt['p']) || isset($opt['paramters'])) { displayMsg(print_r($opt, true)); } if (isset($opt['h']) || isset($opt['help'])) { displayMsg(''); displayMsg('Helping Informations : Parameters script'); displayMsg('* -v --version : Version of test script'); displayMsg('* -p --parameters : Display option array'); displayMsg('* -h --help : View this message'); }
function changeBarcode($member, $barcode){ $sql = sprintf("SELECT * FROM member WHERE barcode='%s'", $barcode); $rs = executeSqlQuery($sql); $cnt = mysql_num_rows($rs); if($cnt>0){ //Specified barcode already exist $midT = $member['mid']; $msg = "The barcode <strong>$barcode</strong> already exists!<br>Barcode was not changed<hr>" . $this->toString($member) . '<hr>' . "<a href='member_edit.php?ID=$midT'>Edit Again</a> | <a href='member_view.php?ID=$midT'>View Full Details</a> | <a href='member_browse.php'>Browse Members</a>"; $title = 'No Changes Made'; displayMsg($msg,$title); } $sql = sprintf("update member set barcode='%s' WHERE mid=%d", $barcode, $member['mid']); $a = executeSqlNonQuery($sql); $rows_affected = $a['rows']; $midT = $member['mid']; if ($rows_affected == 1) { //[Log Event]--------------------------- $des = '[' . $member['barcode'] . "] ==> [$barcode]"; logEvent('MEMBER_BARCODE', $_SESSION['CurrentUser']['mid'], $member['mid'], addslashes($des)); //[Display message] ------------------------------ $msg = "Barcode Changed to: <strong>$barcode</strong><br>Member Details before the change are:<hr>" . $this->toString($member) . '<hr>' . "<a href='member_edit.php?ID=$midT'>Edit Again</a> | <a href='member_view.php?ID=$midT'>View Full Details</a> | <a href='member_browse.php'>Browse Members</a>"; $title = 'Member Barcode Changed'; displayMsg($msg,$title); } elseif ($rows_affected == 0) { $msg = 'Barcode was not changed, because you had specified the old barcode as the new one.<hr>' . $this->toString($member) . '<hr>' . "<a href='member_edit.php?ID=$midT'>Edit Again</a> | <a href='member_view.php?ID=$midT'>View Full Details</a> | <a href='member_browse.php'>Browse Members</a>"; $title = 'No Changes Made'; displayMsg($msg, $title); } }
function exitWithMessage($msg) { include APP_PATH_DOCROOT . 'ProjectGeneral/header.php'; print RCView::div(array('style' => 'max-width:750px;margin-bottom:10px;'), RCView::div(array('style' => 'color: #800000;font-size: 16px;font-weight: bold;float:left;'), LR_PLUGIN_TITLE) . RCView::div(array('class' => 'clear'), '')); displayMsg($msg, "errorMsg", "center", "red", "exclamation_frame.png", 600); include APP_PATH_DOCROOT . 'ProjectGeneral/footer.php'; exit; }
$(document).on('click', '.delete-rec', function() { var rec_id = $(this).data('id'); var rec_table = $(this).data('table'); $('#deleteModel').modal('show'); $("#btn_confirm_delete").click(function() { $.post('delete.php', {del: 'y', table: rec_table, id: rec_id}, function(response) { if($.trim(response) == 'y'){ var msg = '<?php echo displayMsg('Record has been deleted successfully.'); ?> '; $("#table_"+rec_table+" #row_"+rec_id).remove(); $("#message_container").html(msg); }else{ var msg = '<?php echo displayMsg('<strong>Oh snap!</strong> Some error occour while deleting! try again.', 'error'); ?> '; $("#message_container").html(msg); } }); $('#deleteModel').modal('hide'); }); }); $('#category_form').validate({ rules: { title: { required: true } },
d($rights); if ($rights['data_export_tool'] != 1) { include APP_PATH_DOCROOT . 'ProjectGeneral/header.php'; displayMsg("You do not have proper data export rights to use this tool ({$rights[USERID]['data_export_tool']})", "errorMsg","center","red","exclamation_frame.png", 600); exit(); } } // Check if we are posting back for a download if(isset($_POST['download'])) { // Request to download a processed file $target_filename = $_POST['download']; $target_file = APP_PATH_TEMP . $target_filename; if (!file_exists($target_file)) { include APP_PATH_DOCROOT . 'ProjectGeneral/header.php'; displayMsg("Unable to located requested file: $target_filename", "errorMsg","center","red","exclamation_frame.png", 600); exit(); } // Download file and then delete it from the server header('Pragma: anytextexeptno-cache', true); header('Content-Type: application/octet-stream"'); header('Content-Disposition: attachment; filename="'.$target_filename.'"'); header('Content-Length: ' . filesize($target_file)); ob_end_flush(); readfile_chunked($target_file); // unlink($target_file); REDCap::logEvent("Full Export Downloaded"); exit(); }
function changeBarcode($copy, $barcode) { $sql = sprintf("SELECT * FROM copy WHERE barcode='%s'", $barcode); $rs = executeSqlQuery($sql); $cnt = mysql_num_rows($rs); if ($cnt > 0) { //Specified barcode already exist $msg = "The barcode <strong>$barcode</strong> already exists!<br>Barcode was not changed<hr>" . $this->toStringCopy($copy) . '<hr>' . "<a href='book_copy_edit.php?ID=$cid'>Edit This Copy Again</a> | <a href='book_edit.php?ID=$bid'>Edit the Associated Book</a> | <a href='book_search.php'>Browse Books</a>"; $title = 'No Changes Made'; displayMsg($msg, $title); } $sql = sprintf("update copy set barcode='%s' WHERE cid=%d", $barcode, $copy['cid']); $a = executeSqlNonQuery($sql); $rows_affected = $a['rows']; $bid = $copy['bid']; $cid = $copy['cid']; if ($rows_affected == 1) { //[Log Event]--------------------------- $des = '[' . $copy['barcode'] . "] ==> [$barcode]"; logEvent('BOOK_BARCODE', $_SESSION['CurrentUser']['mid'], 0, addslashes($des)); //[Display message] ------------------------------ $msg = "Barcode Changed to: $barcode<br>Copy Details before the change are:<hr>" . $this->toStringCopy($copy) . '<hr>' . "<a href='book_copy_edit.php?ID=$cid'>Edit This Copy Again</a> | <a href='book_edit.php?ID=$bid'>Edit the Associated Book</a> | <a href='book_search.php'>Browse Books</a>"; $title = 'Copy Updated'; displayMsg($msg, $title); } elseif ($rows_affected == 0) { $msg = 'Barcode was not changed, because you had specified the old barcode as the new one.<hr>' . $this->toStringCopy($copy) . '<hr>' . "<a href='book_copy_edit.php?ID=$cid'>Edit This Copy Again</a> | <a href='book_edit.php?ID=$bid'>Edit the Associated Book</a> | <a href='book_search.php'>Browse Books</a>"; $title = 'No Changes Made'; displayMsg($msg, $title); } }
function logout(){ logEvent('LOGOUT', $_SESSION['CurrentUser']['mid'], $_SESSION['CurrentUser']['mid'], addslashes($_SESSION['CurrentUser']['title'] . ' ' . $_SESSION['CurrentUser']['firstnames'] . ' ' . $_SESSION['CurrentUser']['surname'])); foreach($_SESSION as $key => $val){ unset($_SESSION[$key]); } $msg = 'Thank you for using Pusthaka.<br>' . 'We are always looking for ways to improve your experience with the UCSC Library and we ' . 'welcome your suggestions as to how we may do so.<br>' . 'Please send us your comments by email to ' . "<a href='mailto:lib@ucsc.cmb.ac.lk'>lib@ucsc.cmb.ac.lk</a><br>"; $title = 'Thank You'; $backlink = 'index.php'; $backlinkTitle = 'Go Back to Pusthaka Home Page'; displayMsg($msg, $title, $backlink, $backlinkTitle); }