本文整理汇总了PHP中_get函数的典型用法代码示例。如果您正苦于以下问题:PHP _get函数的具体用法?PHP _get怎么用?PHP _get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeMessage
protected function mergeMessage()
{
self::$message['toid'] = (int) _get('toid');
self::$message['fromid'] = (int) _get('fromid');
self::$message['title'] = (string) _get('title');
self::$message['content'] = (string) _get('content');
}
示例2: insert
function insert()
{
global $db;
$table = _get('table');
$id = _get('id');
$pkey = get_pkey($table);
if ($id) {
$row = $db->queryRow("SELECT * FROM {$table} WHERE {$pkey} = {$id}");
}
$desc = get_desc($table, true);
foreach ($desc as $Field => $d) {
if (filter_input(INPUT_POST, $Field . '_is_null')) {
$values[$Field] = null;
} elseif (isset($_POST[$Field])) {
$values[$Field] = $_POST[$Field];
} elseif ($id) {
$values[$Field] = $row[$Field];
} else {
$values[$Field] = '';
}
}
$keys = implode(',', array_map(function ($key) {
return "`{$key}`";
}, array_keys($values)));
$val = implode(',', array_map(function ($value) use($db) {
return $value === null ? 'NULL' : $db->quote($value);
}, $values));
$confirm_sql = "INSERT INTO `{$table}` ({$keys}) VALUES ({$val})";
render(__DIR__ . '/view/insert.html', compact('values', 'table', 'pkey', 'confirm_sql'), LAYOUT);
}
示例3: setCardToUser
function setCardToUser()
{
$ret = '';
if (count($_POST) > 0) {
$cardID = $_POST['cardID'] or trigger_error('Undefined userID', PM_FATAL);
print '<pre>';
$card = new Card($cardID);
print_r($_POST);
# $res
print '</pre>';
# new template('dump',$_POST);
$ret .= 'no yet';
} else {
$action = "/admin/?cmd=cards&act=setCardToUser&cardID=" . $item->getItemData('cardID');
$ret .= '
<style type="text/css">
.h16str {margin-top:10px;}
.h16str, .h16str * {line-height:16px;vertical-align:middle;}
</style>
<form action="' . $action . '" method="post">';
$pmUsers = new pmUsers(array('isUserGroup' => '0'));
$ret .= '<select name="userID">';
foreach ($pmUsers->items as $itemID => $item) {
$cardStr = $item->getItemData('cardID') == '0' ? '' : ' #cardID: ' . $item->getItemData('cardID');
$ret .= '<option value="' . $itemID . '">' . $item->getItemData('FirstName') . ' ' . $item->getItemData('LastName') . ' [' . $item->getItemData('Login') . ' - ' . $itemID . ']' . $cardStr . '</option>';
}
$ret .= '</select>';
$ret .= '<div class="h16str"><b>№ карты:</b> <input type="text" name="cardID" value="' . _get('cardID') . '"/></div>';
$ret .= '<div class="h16str">
<input type="submit" name="submit" value="Назначить"/>
</div>';
$ret .= '<form>';
}
return $ret;
}
示例4: build_table_sql
function build_table_sql($table, $where = null)
{
global $db;
$order = _get('order');
$asc = _get('asc', 0);
$map = ['ASC', 'DESC'];
if ($order) {
$order = "ORDER BY `{$order}` {$map[$asc]}";
} else {
$order = '';
}
$where_str = '';
if ($where) {
$where = array_filter($where, function ($v) {
return $v !== '';
});
$where_str = array();
foreach ($where as $key => $value) {
$where_str[] = "`{$key}`=" . $db->quote($value);
}
$where_str = $where_str ? 'WHERE ' . implode(' AND ', $where_str) : '';
}
$sql = "SELECT * FROM `{$table}` {$where_str} {$order} LIMIT 111";
return $sql;
}
示例5: isAllowedIP
function isAllowedIP()
{
if (in_array(getIP(), _get("allowIP"))) {
return true;
}
return false;
}
示例6: _getActionName
function _getActionName() {
$action = _get(ACTION);
if (!$action){
$action = _get(OTHERACTION);
}
$action or $action = 'index';
return $action;
}
示例7: indexAction
/**
* Demo for article with comments
*/
public function indexAction()
{
$id = _get('id', 'int') ?: rand(1, 5);
$page = _get('page', 'int') ?: 1;
$paginator = Paginator::factory(100, array('limit' => 10, 'page' => $page, 'url_options' => array('params' => array('id' => $id, 'enable' => 'yes'))));
$this->view()->assign(array('title' => sprintf(__('Demo article #%d'), $id), 'paginator' => $paginator));
$this->view()->setTemplate('demo');
}
示例8: listAction
/**
* Show all tag of website.
*/
public function listAction()
{
$tag = _get('tag');
$limit = (int) $this->config('item_per_page');
$page = _get('page') ? (int) _get('page') : 1;
$offset = (int) ($page - 1) * $limit;
$module = _get('m');
$type = null;
$moduleTitle = '';
$modules = Pi::registry('modulelist')->read();
if ($module && !isset($modules[$module])) {
$module = '';
}
if ($module) {
$moduleTitle = $modules[$module]['title'];
}
$paginator = null;
$list = array();
$count = Pi::service('tag')->getCount($tag, $module, $type);
if ($count) {
$items = Pi::service('tag')->getList($tag, $module, $type, $limit, $offset);
$content = array();
$batches = array();
foreach ($items as $item) {
//$key = $item['module'] . '-' . $item['type'];
$batches[$item['module']][$item['type']][] = $item['item'];
}
$vars = array('id', 'title', 'link', 'time');
foreach ($batches as $m => $mData) {
foreach ($mData as $t => $tData) {
$content[$m . '-' . $t] = Pi::service('module')->content($vars, array('module' => $m, 'type' => $t, 'id' => $tData));
}
}
$list = array();
array_walk($items, function ($item) use($modules, $content, &$list) {
$key = $item['module'] . '-' . $item['type'];
if (isset($content[$key]) && isset($modules[$item['module']])) {
$found = false;
foreach ($content[$key] as $data) {
if ($data['id'] == $item['item']) {
$item['url'] = $data['link'];
$item['title'] = $data['title'];
$item['time'] = $data['time'];
$found = true;
break;
}
}
if ($found) {
$item['module'] = $modules[$item['module']]['title'];
$list[] = $item;
}
}
});
$paginator = Paginator::factory($count, array('limit' => $limit, 'page' => $page, 'url_options' => array('route' => 'tag', 'params' => array('tag' => $tag, 'm' => $module))));
}
$this->view()->assign(array('paginator' => $paginator, 'list' => $list, 'tag' => $tag, 'count' => $count, 'm' => $module, 'moduleTitle' => $moduleTitle));
$this->view()->setTemplate('list');
}
示例9: have_access
/**
* Check view and edit permissions.
*
* @param $op
* The type of operation. Either 'view' or 'edit'.
*/
function have_access($op)
{
global $user;
$db = DBConnection::instance();
$field_id = (int) _post('fid');
if (!$field_id) {
$field_id = (int) _get('fid');
}
$field = (object) $db->dq("SELECT entity_id, entity_type, delta FROM {mytinytodo_fields} WHERE id = ?", $field_id)->fetch_assoc();
$field_info = field_info_field_by_id($field->delta);
if ($field->entity_type == 'node') {
if (!($node = node_load($field->entity_id))) {
return false;
}
$node_access = $op == 'edit' ? 'update' : $op;
if (node_access($node_access, $node, $user) && field_access($op, $field_info, $field->entity_type, $node, $user)) {
return true;
}
} else {
if ($field->entity_type == 'user') {
if (!($account = user_load($field->entity_id))) {
return false;
}
if (field_access($op, $field_info, $field->entity_type, $account, $user)) {
return true;
}
} else {
if ($field->entity_type == 'comment') {
if (!($comment = comment_load($field->entity_id))) {
return false;
}
if ($op == 'view' && !user_access('access comments')) {
return false;
} else {
if ($op == 'edit' && !comment_access($op, $comment)) {
return false;
}
}
if (field_access($op, $field_info, $field->entity_type, $comment, $user)) {
return true;
}
} else {
if (module_exists('entity')) {
if (!($entity = entity_load($field_id))) {
return false;
}
$entity_access = $op == 'edit' ? 'update' : $op;
if (entity_access($entity_access, $field->entity_type, $entity, $user) && field_access($op, $field_info, $field->entity_type, $entity, $user)) {
return true;
}
}
}
}
}
return false;
}
示例10: proStatus
public function proStatus()
{
$project_hash = _get('get.token', null, '/^[a-z0-9]{30}$/');
if ($project_hash) {
$obj = new Model('project');
if ($obj->where("project_hash = '" . $project_hash . "'")->update(array('status' => '1'))) {
echo 'ok';
}
}
}
示例11: login
public function login()
{
$pass = _get('pass');
$name = I('get.name');
$arr = array("xx" => $pass, "name" => $name);
\GZ_Api::outPut($arr);
// $out= json_encode($arr);
// exit($out);
//$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover,{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
}
示例12: _action_view
function _action_view()
{
$ruleId = _get('id');
$rule = $this->getRuleManager()->getRule($ruleId);
if (is_null($rule)) {
$this->redirect("index.php?action=browse!list");
} else {
$this->viewBean->rule = $rule;
$this->set_view("view.php");
}
}
示例13: COOKIE
function COOKIE($cookie, $value = false, $time = 300000, $redirect = false, $URL = false)
{
if ($value) {
setcookie($cookie, filter($value), time() + $time, "/");
if ($redirect) {
redirect(isset($URL) ? $URL : _get("webBase"));
}
} else {
return isset($_COOKIE[$cookie]) ? filter($_COOKIE[$cookie]) : false;
}
}
示例14: login_POST
function login_POST()
{
$username = _post('username');
$password = _post('password');
if ($user = User::check($username, $password)) {
$user->login();
$back_url = _get('back_url') ?: DEFAULT_LOGIN_REDIRECT_URL;
redirect($back_url);
} else {
$GLOBALS['msg'] = $GLOBALS['config']['error']['info']['USERNAME_OR_PASSWORD_INCORRECT'];
}
}
示例15: viewAction
/**
* For page render
*/
public function viewAction()
{
$id = _get('id');
$row = $this->getModel('page')->find($id);
$page = $row->toArray();
$page['module'] = $this->getModule();
$form = new BaseForm();
$form->add(array('name' => 'tag', 'type' => 'tag'));
$this->view()->assign('form', $form);
$this->view()->assign('page', $page);
$this->view()->setTemplate('page-content');
}