本文整理汇总了PHP中refine函数的典型用法代码示例。如果您正苦于以下问题:PHP refine函数的具体用法?PHP refine怎么用?PHP refine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了refine函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readSelectedRecordsFromRequest
static function readSelectedRecordsFromRequest($table)
{
if (!$_REQUEST["selection"]) {
return array();
}
$selected_recs = array();
$pSet = new ProjectSettings($table);
$keyFields = $pSet->getTableKeys();
foreach (@$_REQUEST["selection"] as $keyblock) {
$arr = explode("&", refine($keyblock));
if (count($arr) < count($keyFields)) {
continue;
}
$keys = array();
foreach ($arr as $i => $value) {
$keys[$keyFields[$i]] = urldecode($value);
}
$selected_recs[] = $keys;
}
return $selected_recs;
}
示例2: EditPage
$params['includes_js'] = $includes_js;
$params['includes_jsreq'] = $includes_jsreq;
$params['includes_css'] = $includes_css;
$params['locale_info'] = $locale_info;
$params['templatefile'] = $templatefile;
$params['pageEditLikeInline'] = $inlineedit == EDIT_INLINE;
//Get array of tabs for edit page
$params['useTabsOnEdit'] = $gSettings->useTabsOnEdit();
if ($params['useTabsOnEdit']) {
$params['arrEditTabs'] = $gSettings->getEditTabs();
}
$pageObject = new EditPage($params);
// For ajax request
if ($_REQUEST["action"] != "") {
if ($pageObject->lockingObj) {
$arrkeys = explode("&", refine($_REQUEST["keys"]));
foreach ($arrkeys as $ind => $val) {
$arrkeys[$ind] = urldecode($val);
}
if ($_REQUEST["action"] == "unlock") {
$pageObject->lockingObj->UnlockRecord($strTableName, $arrkeys, $_REQUEST["sid"]);
exit;
} else {
if ($_REQUEST["action"] == "lockadmin" && (IsAdmin() || $_SESSION["AccessLevel"] == ACCESS_LEVEL_ADMINGROUP)) {
$pageObject->lockingObj->UnlockAdmin($strTableName, $arrkeys, $_REQUEST["startEdit"] == "yes");
if ($_REQUEST["startEdit"] == "no") {
echo "unlock";
} else {
if ($_REQUEST["startEdit"] == "yes") {
echo "lock";
}
示例3: postvalue
function postvalue($name)
{
if (array_key_exists($name, $_POST)) {
$value = $_POST[$name];
} else {
if (array_key_exists($name, $_GET)) {
$value = $_GET[$name];
} else {
return "";
}
}
if (!is_array($value)) {
return refine($value);
}
$ret = array();
foreach ($value as $key => $val) {
$ret[$key] = refine($val);
}
return $ret;
}
示例4: array
$strWhereClause = "";
$strHavingClause = "";
$strSearchCriteria = "and";
$selected_recs = array();
if (@$_REQUEST["a"] != "") {
$sWhere = "1=0";
// process selection
if (@$_REQUEST["mdelete"]) {
foreach (@$_REQUEST["mdelete"] as $ind) {
$keys = array();
$keys["id"] = refine($_REQUEST["mdelete1"][mdeleteIndex($ind)]);
$selected_recs[] = $keys;
}
} elseif (@$_REQUEST["selection"]) {
foreach (@$_REQUEST["selection"] as $keyblock) {
$arr = explode("&", refine($keyblock));
if (count($arr) < 1) {
continue;
}
$keys = array();
$keys["id"] = urldecode($arr[0]);
$selected_recs[] = $keys;
}
}
foreach ($selected_recs as $keys) {
$sWhere = $sWhere . " or ";
$sWhere .= KeyWhere($keys);
}
$strSQL = $gQuery->gSQLWhere($sWhere);
$strWhereClause = $sWhere;
} else {
示例5: isGuestLoginAvailable
$xt->assign("guestlink_block", isGuestLoginAvailable());
$_SESSION["MyURL"] = $myurl;
if ($myurl && $_SESSION["MyUrlAccess"]) {
$xt->assign("guestlink_attrs", "href=\"" . $myurl . "\"");
} else {
$xt->assign("guestlink_attrs", "href=\"" . GetTableLink("menu") . "\"");
}
if (postvalue("username")) {
$xt->assign("username_attrs", ($is508 == true ? "id=\"username\" " : "") . "value=\"" . runner_htmlspecialchars($pUsername) . "\"");
} else {
$xt->assign("username_attrs", ($is508 == true ? "id=\"username\" " : "") . "value=\"" . runner_htmlspecialchars(refine(@$_COOKIE["username"])) . "\"");
}
if (postvalue("password")) {
$xt->assign("password_attrs", ($is508 == true ? " id=\"password\"" : "") . " value=\"" . runner_htmlspecialchars($pPassword) . "\"");
} else {
$xt->assign("password_attrs", ($is508 == true ? " id=\"password\"" : "") . " value=\"" . runner_htmlspecialchars(refine(@$_COOKIE["password"])) . "\"");
}
if (@$_GET["message"] == "expired") {
$message = "Your session has expired." . "Please login again.";
}
if (@$_GET["message"] == "invalidlogin") {
$message = "Invalid Login";
}
if ($message) {
$xt->assign("message_block", true);
$xt->assign("message", "<div class='message rnr-error'>" . $message . "</div>");
}
$pageObject->body["begin"] .= GetBaseScriptsForPage(false);
$pageObject->body["begin"] .= "<form method=\"post\" action='" . GetTableLink("login") . "' id=\"form1\" name=\"form1\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"btnSubmit\" value=\"Login\">";
$pageObject->body["end"] .= "</form>";
$pageObject->addCommonJs();
示例6: load_convert
function load_convert($filename)
{
$path = pathinfo($filename);
global $min_count, $ms1_enable, $ms2_enable, $ms3_enable, $mzxml_enable, $out_file, $unpack_only;
print $filename . "\n";
$scanned = simplexml_load_file($filename);
$preIntensity = -1;
$preCharge = -1;
$mzLoad = array();
$count = 0;
foreach ($scanned->msRun->children() as $a) {
$preIntensity = -1;
$preCharge = -1;
$mH = 0;
//print "Curr $count\n";
if ($a->getName() == 'scan') {
$attrs = $a->attributes();
if ($attrs['msLevel'] == 2 && $ms2_enable) {
if ($a->children()->getName() == 'precursorMz') {
$b = $a->precursorMz;
$battrs = $b->attributes();
if ($preIntensity == -1) {
$preIntensity = $battrs['precursorIntensity'];
}
if ($preCharge == -1) {
$preCharge = $battrs['precursorCharge'];
}
$mH = (double) $b * $preCharge;
$mH = round($mH, 9);
}
} elseif ($attrs['msLevel'] == 1 && $ms1_enable) {
$preIntensity = 0;
$preCharge = 0;
}
$high = FALSE;
if ($ms2_enable || $ms3_enable) {
$high = TRUE;
}
$ms_id = (int) $attrs['num'];
if ($mH > 0 && $high) {
$label = $path['filename'] . "." . $ms_id . "." . $count . "." . $preCharge;
} else {
$label = $path['filename'] . "." . $ms_id . "." . "ms1";
}
if ($a->peaks) {
$base = base64_decode($a->peaks);
if ($attrs['msLevel'] == 1 && $ms1_enable) {
//print "Decoding MS1 peaks\n";
$mzLoad = mzxml_decode_peaks($a->peaks);
}
if ($attrs['msLevel'] == 2 && $ms2_enable) {
//print "Decoding MS2 peaks\n";
$mzLoad = mzxml_decode_peaks($a->peaks);
}
if ($attrs['msLevel'] == 3 && $ms3_enable) {
print "Given MS level " . $attrs['msLevel'] . "not currently supported";
}
if (!empty($mzLoad) || $mzLoad == NULL) {
if ($ms1_enable && $mH == 0 && $attrs['msLevel'] == 1) {
//print "Unpacking MS1 scan\n";
$mzLoad = refine_ms1($mzLoad);
if (!$unpack_only) {
$mzLoad = deisotope($mzLoad, $preIntensity, $preCharge);
}
writeData($mzLoad, "ms1", $out_file . $label . ".dta", $min_count);
$count++;
}
if ($ms2_enable && $mH > 0 && $attrs['msLevel'] == 2) {
//print "Unpacking MS2 scan\n";
$mzLoad = refine($mzLoad);
if (!$unpack_only) {
$mzLoad = deisotope($mzLoad, $preIntensity, $preCharge);
}
writeData($mzLoad, $mH, $out_file . $label . ".dta", $min_count);
$count++;
}
if ($ms3_enable && $mH > 0 && $attrs['msLevel'] == 3) {
$mzLoad = refine($mzLoad);
if (!$unpack_only) {
$mzLoad = deisotope($mzLoad, $preIntensity, $preCharge);
}
writeData($mzLoad, $mH, $out_file . $label . ".ms3.dta", $min_count);
$count++;
}
} else {
print "ERROR: Peaks section could not be decoded.\n";
}
} else {
print "ERROR: No peaks provided in current scan element.\n";
}
}
}
print "Number of scans reported {$count}\n";
}
示例7: deleteRecords
/**
* Delete selected records
*/
function deleteRecords()
{
global $globalEvents;
$this->deleteMessage = "";
if (@$_REQUEST["mdelete"]) {
foreach (@$_REQUEST["mdelete"] as $ind) {
for ($i = 0; $i < count($this->arrKeyFields); $i++) {
$keys[$this->arrKeyFields[$i]] = refine($_REQUEST["mdelete" . ($i + 1)][mdeleteIndex($ind)]);
}
$this->selectedRecs[] = $keys;
}
} elseif (@$_REQUEST["selection"]) {
foreach (@$_REQUEST["selection"] as $keyblock) {
$arr = explode("&", refine($keyblock));
if (count($arr) < count($this->arrKeyFields)) {
continue;
}
for ($i = 0; $i < count($this->arrKeyFields); $i++) {
$keys[$this->arrKeyFields[$i]] = urldecode(@$arr[$i]);
}
$this->selectedRecs[] = $keys;
}
}
$this->recordsDeleted = 0;
$this->lockDelRec = array();
foreach ($this->selectedRecs as $keys) {
$where = KeyWhere($keys);
// delete only owned records
if ($this->nSecOptions != ADVSECURITY_ALL && $this->nLoginMethod == SECURITY_TABLE && $this->createLoginPage) {
$where = whereAdd($where, SecuritySQL("Delete"));
}
$strSQl = "delete from " . AddTableWrappers($this->origTName) . " where " . $where;
$retval = true;
$deletedrs = db_query(SQLQuery::gSQLWhere_having($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $where), $this->conn);
$deleted_values = $this->cipherer->DecryptFetchedArray($deletedrs);
if ($globalEvents->exists("IsRecordEditable", $this->tName)) {
if (!$globalEvents->IsRecordEditable($deleted_values, true, $this->tName)) {
continue;
}
}
if ($this->eventExists("BeforeDelete")) {
$tdeleteMessage = $this->deleteMessage;
$retval = $this->eventsObject->BeforeDelete($where, $deleted_values, $tdeleteMessage, $this);
$this->deleteMessage = $tdeleteMessage;
}
$lockRecord = false;
if ($this->lockingObj) {
$lockWhere = "";
foreach ($keys as $keysvalue) {
$lockWhere .= rawurlencode($keysvalue) . "&";
}
$lockWhere = substr($lockWhere, 0, -1);
$lockSQL = "select * from " . AddTableWrappers("") . " where " . AddFieldWrappers("keys") . "=" . db_prepare_string($lockWhere) . " and " . AddFieldWrappers("table") . "=" . db_prepare_string($this->origTName) . " and " . AddFieldWrappers("action") . "=1";
$lockSet = db_query($lockSQL, $this->conn);
if ($data = db_fetch_array($lockSet)) {
$lockRecord = true;
$this->lockDelRec[] = $keys;
}
if ($this->mode == LIST_SIMPLE) {
$_SESSION[$this->sessionPrefix . "_lockDelRec"] = $this->lockDelRec;
}
}
if (!$lockRecord && @$_REQUEST["a"] == "delete" && $retval) {
$this->recordsDeleted++;
// delete associated uploaded files if any
DeleteUploadedFiles($this->pSet, $deleted_values);
LogInfo($strSQl);
db_exec($strSQl, $this->conn);
if ($this->audit && $deleted_values) {
$fieldsList = $this->pSet->getFieldsList();
$i = 0;
foreach ($deleted_values as $key => $value) {
if (IsBinaryType($this->pSet->getFieldType($fieldsList[$i]))) {
$deleted_audit_values[$fieldsList[$i]] = $value;
} else {
$deleted_audit_values[$key] = $value;
}
$i++;
}
$this->audit->LogDelete($this->tName, $deleted_audit_values, $keys);
}
if ($this->eventExists("AfterDelete")) {
$tdeleteMessage = $this->deleteMessage;
$this->eventsObject->AfterDelete($where, $deleted_values, $tdeleteMessage, $this);
$this->deleteMessage = $tdeleteMessage;
}
}
if (strlen($this->deleteMessage)) {
$this->xt->assignbyref("message", $this->deleteMessage);
$this->xt->assign("message_block", true);
}
}
if (count($this->selectedRecs) && $this->eventExists("AfterMassDelete")) {
$this->eventsObject->AfterMassDelete($this->recordsDeleted, $this);
}
}
示例8: EditPage
$params['pageEditLikeInline'] = $inlineedit == EDIT_INLINE;
//Get array of tabs for edit page
$params['useTabsOnEdit'] = $gSettings->useTabsOnEdit();
if($params['useTabsOnEdit'])
$params['arrEditTabs'] = $gSettings->getEditTabs();
$pageObject = new EditPage($params);
$pageObject->init();
// For ajax request
if($_REQUEST["action"] != "")
{
if($pageObject->lockingObj)
{
$arrkeys = explode("&",urldecode(refine($_REQUEST["keys"])));
foreach($arrkeys as $ind=>$val)
$arrkeys[$ind]=urldecode($val);
if($_REQUEST["action"]=="unlock")
{
$pageObject->lockingObj->UnlockRecord($strTableName,$arrkeys,$_REQUEST["sid"]);
exit();
}
else if($_REQUEST["action"]=="lockadmin" && (IsAdmin() || $_SESSION["AccessLevel"] == ACCESS_LEVEL_ADMINGROUP))
{
$pageObject->lockingObj->UnlockAdmin($strTableName,$arrkeys,$_REQUEST["startEdit"]=="yes");
if($_REQUEST["startEdit"]=="no")
echo "unlock";
else if($_REQUEST["startEdit"]=="yes")
echo "lock";
示例9: get_args
}
}
return $sqls;
}
$plugin = get_args('path');
$sqlfile = get_args('sql');
$force = get_args('force');
$type = get_args('type');
if (is_null($force)) {
$force = false;
} else {
$force = true;
}
$sqlpath = $plugin . '/' . $sqlfile;
if ($sqlfile) {
$sqls = refine(dirname(__FILE__) . "/../plugins/{$sqlpath}", $create_tables, $drop_tables);
$dbo = new dbex();
dbtarget('r', $dbServs);
$sql = "show tables";
$result = $dbo->getRs($sql);
foreach ($result as $row) {
if (isset($drop_tables[$row[0]]) || isset($create_tables[$row[0]])) {
$check_sql = false;
break 1;
}
}
if ($force) {
if (install_sql($sqls, $force)) {
$config = dirname(__FILE__) . "/../plugins/{$plugin}/config.php";
$str = file_get_contents($config);
$str = preg_replace("/table_prefix=[^;]*;/", "table_prefix='{$plugin}_';", $str);
示例10: htmlspecialchars
$_SESSION["MyURL"] = $myurl;
if ($myurl) {
$xt->assign("guestlink_attrs", "href=\"" . $myurl . "\"");
} else {
$xt->assign("guestlink_attrs", "href=\"menu.php\"");
}
if (postvalue("username")) {
$xt->assign("username_attrs", ($is508 == true ? "id=\"username\" " : "") . "value=\"" . htmlspecialchars($pUsername) . "\"");
} else {
$xt->assign("username_attrs", ($is508 == true ? "id=\"username\" " : "") . "value=\"" . htmlspecialchars(refine(@$_COOKIE["username"])) . "\"");
}
$password_attrs = "onkeydown=\"e=event; if(!e) e = window.event; if (e.keyCode != 13) return; e.cancel = true; e.cancelBubble=true; document.forms[0].submit(); return false;\"";
if (postvalue("password")) {
$password_attrs .= ($is508 == true ? " id=\"password\"" : "") . " value=\"" . htmlspecialchars($pPassword) . "\"";
} else {
$password_attrs .= ($is508 == true ? " id=\"password\"" : "") . " value=\"" . htmlspecialchars(refine(@$_COOKIE["password"])) . "\"";
}
$xt->assign("password_attrs", $password_attrs);
if (@$_GET["message"] == "expired") {
$message = mlang_message("SESSION_EXPIRED");
}
if ($message) {
$xt->assign("message_block", true);
$xt->assign("message", $message);
}
$pageObject->body["begin"] .= "<script type=\"text/javascript\" src=\"include/loadfirst.js\"></script>";
$pageObject->body["begin"] .= "<script type=\"text/javascript\" src=\"include/lang/" . getLangFileName(mlang_getcurrentlang()) . ".js\"></script>";
$pageObject->body["begin"] .= "<form method=post action=\"login.php\" id=form1 name=form1>\n\t\t<input type=hidden name=btnSubmit value=\"Login\">";
$pageObject->body["end"] .= "</form>\n<script>\nfunction elementVisible(jselement)\n{ \n\tdo\n\t{\n\t\tif (jselement.style.display.toUpperCase() == 'NONE')\n\t\t\treturn false;\n\t\tjselement=jselement.parentNode; \n\t}\n\twhile (jselement.tagName.toUpperCase() != 'BODY'); \n\treturn true;\n}\nif(elementVisible(document.forms[0].elements['username']))\n\tdocument.forms[0].elements['username'].focus();\n</script>";
$pageObject->addCommonJs();
// button handlers file names
示例11: postvalue
/**
* @intellisense
*/
function postvalue($name)
{
if(isset($_POST[$name]))
$value=$_POST[$name];
else if(isset($_GET[$name]))
$value=$_GET[$name];
else
return "";
if(!is_array($value))
return refine($value);
$ret=array();
foreach($value as $key=>$val)
$ret[$key]=refine($val);
return $ret;
}