本文整理汇总了PHP中get_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_id函数的具体用法?PHP get_id怎么用?PHP get_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setView
<?php
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$itemID = get_id(2);
$itemsClass = new items();
$item = $itemsClass->get($itemID);
if (!is_array($item) || check_login_bool() && $item['status'] == 'unapproved' && $item['user_id'] != $_SESSION['user']['user_id'] || $item['status'] == 'queue' || $item['status'] == 'extended_buy') {
header("HTTP/1.0 404 Not Found");
header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
}
abr('item', $item);
示例2: print_highlighted
function print_highlighted($lang)
{
//The GeSHI syntax highlighter is included.
include_once 'geshi/geshi.php';
//The string returned is stored in a variable.
$filename = get_id($_SERVER['REQUEST_URI']);
//If file does not exist then it redirects the user to the home page.
$file = fopen("data/{$filename}", "r") or header("Location: /");
$source = '';
while (!feof($file)) {
$source = $source . fgets($file);
}
//The object created is passed two arguments for syntax highlighting.
$geshi = new GeSHi($source, $lang);
$geshi->set_overall_style('background-color: #f2f2f2; margin: 0px 35px; border: 1px dotted;', true);
//$geshi->set_header_type(GESHI_HEADER_PRE_VALID);
$geshi->set_header_type(GESHI_HEADER_DIV);
//The flag below shows the line numbers. See GeSHI docs for more options.
$flag = GESHI_FANCY_LINE_NUMBERS;
$geshi->enable_line_numbers($flag);
$geshi->set_line_style(' padding: 0px 15px;');
//The <pre> tags are included for maintaining the indentation.
// echo "<pre>";
echo $geshi->parse_code();
// echo "</pre></div>";
return 0;
}
示例3: update_category
/**
* Show and process config category form
*
* @param void
* @return null
*/
function update_category()
{
$category = ConfigCategories::findById(get_id());
if (!$category instanceof ConfigCategory) {
flash_error(lang('config category dnx'));
$this->redirectToReferer(get_url('administration'));
}
// if
if ($category->isEmpty()) {
flash_error(lang('config category is empty'));
$this->redirectToReferer(get_url('administration'));
}
// if
$options = $category->getOptions(false);
$categories = ConfigCategories::getAll(false);
tpl_assign('category', $category);
tpl_assign('options', $options);
tpl_assign('config_categories', $categories);
$submitted_values = array_var($_POST, 'options');
if (is_array($submitted_values)) {
foreach ($options as $option) {
$new_value = array_var($submitted_values, $option->getName());
if (is_null($new_value) || $new_value == $option->getValue()) {
continue;
}
$option->setValue($new_value);
$option->save();
}
// foreach
flash_success(lang('success update config category', $category->getDisplayName()));
$this->redirectTo('administration', 'configuration');
}
// if
$this->setSidebar(get_template_path('update_category_sidebar', 'config'));
}
示例4: auth_id
function auth_id()
{
global $torque_id, $torque_id_hash;
// Prepare authentification of Torque Instance that uploads data to this server
// If $torque_id is defined, this will overwrite $torque_id_hash from creds.php
$session_id = get_id();
// Parse IDs from "creds.php", if IDs are defined these will overrule HASHES
$auth_by_hash_possible = false;
if (isset($torque_id) && !empty($torque_id)) {
if (!is_array($torque_id)) {
$torque_id = array($torque_id);
}
$torque_id_hash = array_map(md5, $torque_id);
$auth_by_hash_possible = true;
} elseif (isset($torque_id_hash) && !empty($torque_id_hash)) {
if (!is_array($torque_id_hash)) {
$torque_id_hash = array($torque_id_hash);
}
$auth_by_hash_possible = true;
}
// Authenticate torque instance: Check if we know its HASH
if ($auth_by_hash_possible) {
if (in_array($session_id, $torque_id_hash)) {
return true;
}
} else {
return true;
}
return false;
}
示例5: login
function login($username, $password)
{
$id = get_id($username);
$username = validate($username);
$password = md5($password);
$sql = mysql_query("SELECT COUNT(`UserID`) FROM `user` WHERE `Username` = '{$username}' AND `Password` = '{$password}'");
return mysql_result($sql, 0) == 1 ? $id : false;
}
示例6: sel_file
function sel_file($val)
{
$return = get_id('goods', 'goo_img', $val);
if (!$return) {
$return = get_id('goods', 'goo_x_img', $val);
}
if (!$return) {
$return = get_id('picture', 'pic_path', $val);
}
return $return;
}
示例7: recive_formular
function recive_formular()
{
//um einwenig weniger tipp arbeit zu haben und zukünftige erweiterungen schneller einfließen zu lassen
//werden einfach nur alle tabellen felder durch gegangen und ggf berichtigt
//konfiguration über config.php: $anmeldung_fields
/*liest die bei der Anmeldung abgeschickten Daten aus, prüft sie und packt sie in einen Hash*/
$daten = array();
foreach ($GLOBALS["anmeldung_fields"] as $key) {
switch ($key) {
case 'idx':
$daten[$key] = get_id();
break;
case 'ew_count':
if (!is_numeric($_POST[$key]) or $_POST[$key] > 99) {
array_push($GLOBALS["error_msgs"], MSG_NUMBER_UNREAL);
$GLOBALS["error"] += 1;
}
$daten[$key] = abs($_POST[$key]);
break;
case 'ki_count':
if (!is_numeric($_POST[$key]) or $_POST[$key] > 99) {
array_push($GLOBALS["error_msgs"], MSG_NUMBER_UNREAL);
$GLOBALS["error"] += 1;
}
$daten[$key] = abs($_POST[$key]);
break;
case 'ba_count':
if (!is_numeric($_POST[$key]) or $_POST[$key] > 99) {
array_push($GLOBALS["error_msgs"], MSG_NUMBER_UNREAL);
$GLOBALS["error"] += 1;
}
$daten[$key] = abs($_POST[$key]);
break;
case 'newsletter':
if (isset($_POST[$key])) {
$daten[$key] = "1";
} else {
$daten[$key] = "0";
}
break;
case 'timestamp':
$daten[$key] = date("d.m.Y \\u\\m H:i:s");
break;
default:
if (isset($_POST[$key])) {
$daten[$key] = $_POST[$key];
} else {
$daten[$key] = "";
}
}
}
//gibt die Formular daten zurück
return $daten;
}
示例8: delete
/**
* Delete specific user
*
* @access public
* @param void
* @return null
*/
function delete()
{
$this->setTemplate('del_user');
$user = Users::findById(get_id());
if (!$user instanceof User) {
flash_error(lang('user dnx'));
$this->redirectTo('administration');
}
// if
if (!$user->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectToReferer(get_url('dashboard'));
}
// if
$delete_data = array_var($_POST, 'deleteUser');
tpl_assign('user', $user);
tpl_assign('delete_data', $delete_data);
if (!is_array($delete_data)) {
$delete_data = array('really' => 0, 'password' => '');
// array
tpl_assign('delete_data', $delete_data);
} else {
if ($delete_data['really'] == 1) {
$password = $delete_data['password'];
if (trim($password) == '') {
tpl_assign('error', new Error(lang('password value missing')));
return $this->render();
}
if (!logged_user()->isValidPassword($password)) {
tpl_assign('error', new Error(lang('invalid login data')));
return $this->render();
}
try {
DB::beginWork();
$user->delete();
ApplicationLogs::createLog($user, null, ApplicationLogs::ACTION_DELETE);
DB::commit();
flash_success(lang('success delete user', $user->getDisplayName()));
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete user'));
}
// try
$this->redirectToUrl($user->getCompany()->getViewUrl());
} else {
flash_error(lang('error delete user'));
$this->redirectToUrl($user->getCompany()->getViewUrl());
}
}
}
示例9: module_comment
function module_comment()
{
global $global, $smarty;
if ($global['id']) {
$obj = new comment();
$obj->set_where('com_channel_id = ' . get_id('channel', 'cha_code', $global['channel']));
$obj->set_where('com_page_id = ' . $global['id']);
$obj->set_page_size(5);
$obj->set_page_num($global['page']);
$sheet = $obj->get_sheet();
set_link($obj->get_page_sum());
$smarty->assign('comment', $sheet);
}
}
示例10: uninstall
function uninstall($id = null) {
ajx_current("empty");
if (!$id) {
$id=get_id();
}
if ( $plg = Plugins::instance()->findById($id)) {
if (!$plg->isInstalled()) return ;
$plg->setIsInstalled(0);
$plg->save();
$name= $plg->getSystemName();
$path = ROOT . "/plugins/$name/uninstall.php";
if (file_exists($path)){
include_once $path;
}
}
}
示例11: set_more_global
function set_more_global()
{
global $global;
$global['channel'] = get_global('channel', 'index');
$global['cat'] = get_global('cat', 0);
$global['page'] = get_global('page', 1);
$global['id'] = get_global('id', 0);
$global['original'] = $global['channel'];
$global['channel_id'] = get_id('channel', 'cha_code', $global['channel']);
if ($global['channel_id']) {
$original_id = get_data('channel', $global['channel_id'], 'cha_original');
if ($original_id) {
$global['original'] = get_data('channel', $original_id, 'cha_code');
}
}
}
示例12: post_request
/**
* This function call when a post request send .If that request is a valid addTicket request, new ticket will added,
* Else redirect user to not found page or echo error message;
* @param WP_USER $user
* @return string
*/
function post_request($user)
{
if (!isset($_POST["requestType"]) || $_POST["requestType"] != "addTicket" && $_POST["requestType"] != "addTicketAnswer") {
header("Location: " . NOT_FOUND_URL);
exit;
}
$const_array = array("applicant_id" => $user->ID, "status" => 0, "attachments" => $_POST["upfile"], "title" => $_POST["title"], "content" => $_POST["message"], "department" => $_POST["department"], "other" => "priority:" . $_POST["priority"] . "|", "related_order" => get_id($_POST["order"]));
if (isset($_POST['relatedTicket'])) {
$related_ticket = $_POST['relatedTicket'];
$const_array = array_merge($const_array, array("related_ticket" => get_id($related_ticket)));
}
if ($_POST["requestType"] == "addTicket") {
foreach ($const_array as $key => $value) {
if (empty($value) && $value !== 0 && $key !== "attachments" && $key !== "order" && $key !== "related_ticket") {
return "لطفا متنی تایپ کنید!" . "<br>";
}
}
} else {
if (empty($_POST["message"])) {
return "متن پاسخ نیم تواند خالی باشد";
}
}
$ticket = new Ticket($const_array);
if ($ticket->create()) {
if ($_POST["requestType"] == "addTicket") {
echo "1|ticket.php?iti=" . $ticket->get_fake_id();
exit;
} else {
if (get_user_level($user->ID) == 10) {
Ticket::change_ticket_status($ticket->get_related_ticket_id(), 1);
} else {
Ticket::change_ticket_status($ticket->get_related_ticket_id(), 0);
}
echo "پاسخ شما افزوده شد";
}
} else {
return "مشکلی در ایجاد تیکت وجود دارد.لطفا مجددا تلاش کنید";
}
}
示例13: add_comment
function add_comment()
{
safe('comment');
global $global, $smarty, $lang;
$channel = post('channel');
$com_page_id = post('page_id');
$com_username = post('username');
$com_email = post('email');
$com_rank = post('rank');
$com_text = post('text');
if ($channel == '' || $com_page_id == '' || $com_username == '' || $com_email == '' || $com_rank == '' || $com_text == '') {
$info_text = $lang['submit_error_info'];
} else {
$com_channel_id = get_id('channel', 'cha_code', $channel);
$com_add_time = time();
$obj = new comment();
$obj->set_value('com_channel_id', $com_channel_id);
$obj->set_value('com_page_id', $com_page_id);
$obj->set_value('com_username', $com_username);
$obj->set_value('com_email', $com_email);
$obj->set_value('com_rank', $com_rank);
$obj->set_value('com_text', $com_text);
$obj->set_value('com_add_time', $com_add_time);
$obj->set_value('com_show', 0);
$obj->set_value('com_lang', S_LANG);
$obj->add();
if (intval(get_varia('sentmail'))) {
$email_title = '您的网站有了新的评论';
$str = get_data($channel, $com_page_id, substr($channel, 0, 3) . '_title');
$email_text = '评论:《' . $str . '》<br />' . $com_text;
call_send_email($email_title, $email_text, $com_username, $com_email);
}
$info_text = $lang['submit_comment'];
}
$smarty->assign('info_text', $info_text);
$smarty->assign('link_text', $lang['go_back']);
$smarty->assign('link_href', url(array('channel' => $channel, 'id' => $com_page_id)));
}
示例14: delete
function delete()
{
ajx_current("empty");
$billingCategory = BillingCategories::findById(get_id());
if (!$billingCategory instanceof BillingCategory) {
flash_error(lang('billing category dnx'));
return;
}
// if
if (!$billingCategory->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
return;
}
// if
try {
DB::beginWork();
$billingCategory->delete();
DB::commit();
flash_success(lang('success delete billing category', $billingCategory->getName()));
ajx_current("reload");
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
}
// try
}
示例15: view
function view()
{
$comment = Comments::findById(get_id());
if (!$comment instanceof Comment) {
flash_error(lang('comment dnx'));
ajx_current("empty");
return;
}
if (!$comment->canView(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$object = $comment->getRelObject();
if (!$object instanceof ContentDataObject) {
flash_error(lang('object dnx'));
ajx_current("empty");
return;
}
redirect_to($object->getViewUrl());
}