本文整理汇总了PHP中userid函数的典型用法代码示例。如果您正苦于以下问题:PHP userid函数的具体用法?PHP userid怎么用?PHP userid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了userid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_cover_photo
function set_cover_photo($pid, $cid, $myaccount = false)
{
global $db, $userquery, $cbphoto;
if (!$this->collection_exists($cid)) {
e(lang('collection_not_exists'));
return false;
}
if (!$this->object_exists($pid)) {
e(lang(sprintf('%s does not exist', $this->objType)));
return false;
}
if (!$this->object_in_collection($pid, $cid)) {
e(sprintf(lang("object_not_in_collect"), $this->objName));
return false;
}
if (!$this->is_collection_owner($cid) || userid() != $cbphoto->get_photo_owner($pid)) {
e(lang('cant_perform_action_collect'));
return false;
}
$fields = tbl_fields(array('p' => get_photo_fields(), 'c' => get_collection_fields()));
$query = ' SELECT ' . $fields . ' FROM ' . tbl('collections') . ' as c';
$query .= " LEFT JOIN " . tbl('photos') . " as p ON c.collection_id = p.collection_id ";
start_where();
add_where(" c.collection_id = '{$cid}' ");
add_where(" p.photo_id = '{$pid}' ");
if (get_where()) {
$query .= ' WHERE ' . get_where();
}
end_where();
$result = db_select($query);
if ($myaccount) {
if ($result['is_avatar'] == 'yes' || $result['is_avatar_collection'] == 'yes') {
return false;
}
}
$cover_photo = json_decode($result['cover_photo'], true);
if ($pid == $cover_photo['photo_id']) {
$update = true;
} else {
//Create array so we can reduce one query per collection YOSH !!!
$result = $result[0];
$cover_photo['photo_id'] = $result['photo_id'];
$cover_photo['photo_key'] = $result['photo_key'];
$cover_photo['filename'] = $result['filename'];
$cover_photo['ext'] = $result['ext'];
$cover_photo['is_collection_cover'] = true;
// This flag will help us make a query to get is_mature for cover photo while displaying
$jecp = json_encode($cover_photo);
$field = array('cover_photo' => $jecp);
$update = db_update(tbl('collections'), $field, " collection_id = '" . $result['collection_id'] . "' ");
}
if ($update) {
return $cover_photo;
} else {
return false;
}
}
示例2: update
function update($id_detail)
{
$data = array('id_detail' => $this->input->post('id_detail', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'id_barang' => $this->input->post('id_barang', TRUE), 'id_satuan' => $this->input->post('id_satuan', TRUE), 'jumlah' => $this->input->post('jumlah', TRUE), 'jumlah_baru' => $this->input->post('jumlah_baru', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'user_id' => userid(), 'datetime' => now());
$this->db->where('id_detail', $id_detail);
$this->db->update('penyesuaian_detail', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例3: update
function update($id)
{
$data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'tgl' => $this->input->post('tgl', TRUE), 'tgl_kedaluarsa' => $this->input->post('tgl_kedaluarsa', TRUE), 'tgl_terima' => $this->input->post('tgl_terima', TRUE), 'id_customer' => $this->input->post('id_customer', TRUE), 'id_sales' => $this->input->post('id_sales', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'ref' => $this->input->post('ref', TRUE), 'id_bayar' => $this->input->post('id_bayar', TRUE), 'totalbayar' => $this->input->post('total', TRUE), 'pajak' => $this->input->post('pajak', TRUE), 'total_pajak' => $this->input->post('total_pajak', TRUE), 'grandtotal' => $this->input->post('grandtotal', TRUE), 'uangmuka' => $this->input->post('uangmuka', TRUE), 'sisa' => $this->input->post('sisa', TRUE), 'biaya_lain' => $this->input->post('biayakirim', TRUE), 'status' => $this->input->post('status', TRUE), 'id_user' => userid(), 'datetime' => now());
$this->db->where('id', $id);
$this->db->update('sales_order', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例4: update
function update($id)
{
$data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'faktur_po' => $this->input->post('faktur_po', TRUE), 'id_customer' => $this->input->post('id_customer', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_kirim' => $this->input->post('tanggal_kirim', TRUE), 'kirim_via' => $this->input->post('kirim_via', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'alamat_kirim' => $this->input->post('alamat_kirim', TRUE), 'alamat_tagihan' => $this->input->post('alamat_tagihan', TRUE), 'biaya_id' => $this->input->post('biaya_id', TRUE), 'biaya_kirim' => $this->input->post('biaya_kirim', TRUE), 'armada_id' => $this->input->post('armada_id', TRUE), 'is_approved' => $this->input->post('is_approved', TRUE), 'user_id' => userid(), 'datetime' => now());
$this->db->where('id', $id);
$this->db->update('delivery_order', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例5: confirm_collection_type
function confirm_collection_type($type)
{
global $cbcollection;
if (empty($type)) {
$type = 'photos';
}
if ($type != $cbcollection->types) {
if (VERSION < '3.0') {
// Get Deprecated Types;
$dep_types = $cbcollection->deprecated_types;
$message = 'Collections feature now only support photos';
if (array_key_exists($type, $dep_types)) {
$message .= '. ' . $cbcollection->deprecated_types[$type] . ' support has been dropped since 2.6';
$dep_type = $cbcollection->deprecated_types[$type] . ' ';
}
if (userid() && has_access('admin_access', true)) {
$message .= '. Please upgrade your Clipbucket to <a href="http://clip-bucket.com" target="_blank">latest version</a>';
} else {
$message .= '. Please contact Site Administrator about this.';
}
e(lang($message));
cb_show_page();
}
return $cbcollection->types;
}
return $cbcollection->types;
}
示例6: update
function update($id)
{
$data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'faktur_do' => $this->input->post('faktur_do', TRUE), 'id_supplier' => $this->input->post('id_supplier', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_terima' => $this->input->post('tanggal_terima', TRUE), 'kirim_via' => $this->input->post('kirim_via', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'alamat_terima' => $this->input->post('alamat_terima', TRUE), 'id_cabang' => $this->input->post('id_cabang', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'nopol_pengirim' => $this->input->post('nopol_pengirim', TRUE), 'nama_pengirim' => $this->input->post('nama_pengirim', TRUE), 'is_approved' => $this->input->post('is_approved', TRUE), 'user_id' => userid(), 'datetime' => now());
$this->db->where('id', $id);
$this->db->update('receive_item', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例7: cropScreen
/**
* Scale & crops a screen image
* @param id - screen id
* @param viewport - dimension (width, height) and position (x,y) of the viewport
* @param dimension - target dimension (width, height)
* @param path - target path
* @return void
*/
function cropScreen($id, $viewport, $dimension, $path)
{
global $db;
$w = $dimension['width'];
$h = $dimension['height'];
$screen = $db->single("SELECT id, project, type, ext FROM screen WHERE id = '" . $id . "' AND (embeddable = 'TRUE' or creator = '" . userid() . "') LIMIT 1");
if (!$screen) {
die;
}
$filename = UPLOAD . 'screens/' . $screen['project'] . '/' . md5($screen['id'] . config('security.general.hash')) . '.' . $screen['ext'];
$target = TERRIFIC . $path;
if (!is_file($target)) {
if (!is_dir(dirname($target))) {
@mkdir(dirname($target), 0777, true);
}
$width = $viewport['width'];
$height = $viewport['height'];
$r = $width / $height;
$newheight = $w / $r;
$newwidth = $w;
switch ($screen['type']) {
case 'image/jpeg':
case 'image/jpg':
$src = imagecreatefromjpeg($filename);
break;
case 'image/png':
$src = imagecreatefrompng($filename);
break;
}
$dst = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($dst, $src, 0, 0, $viewport['x'], $viewport['y'], $newwidth, $newheight, $width, $height);
imagepng($dst, $target);
}
}
示例8: update
function update($id)
{
$data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'akun' => $this->input->post('akun', TRUE), 'total_nilai' => $this->input->post('total_nilai', TRUE), 'user_id' => userid(), 'datetime' => now());
$this->db->where('id', $id);
$this->db->update('penyesuaian', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例9: update
function update($id_detail)
{
$data = array('id_detail' => $this->input->post('id_detail', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'id_so' => $this->input->post('id_so', TRUE), 'id_barang' => $this->input->post('id_barang', TRUE), 'jumlah' => $this->input->post('jumlah', TRUE), 'id_satuan' => $this->input->post('id_satuan', TRUE), 'harga_jual' => $this->input->post('harga_jual', TRUE), 'diskon1' => $this->input->post('diskon1', TRUE), 'diskon2' => $this->input->post('diskon2', TRUE), 'diskon3' => $this->input->post('diskon3', TRUE), 'id_user' => userid(), 'datetime' => now());
$this->db->where('id_detail', $id_detail);
$this->db->update('sales_order_detail', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例10: update
function update($id)
{
$data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'tanggal_tempo' => $this->input->post('tanggal_tempo', TRUE), 'id_mitra' => $this->input->post('id_mitra', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'id_kandang' => $this->input->post('id_kandang', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'catatan' => $this->input->post('catatan', TRUE), 'user_id' => userid(), 'is_approved' => $this->input->post('is_approved', TRUE), 'datetime' => now());
$this->db->where('id', $id);
$this->db->update('purchase_request', $data);
/*'datetime' => date('Y-m-d H:i:s'),*/
}
示例11: login
function login()
{
global $db;
// load project permissions
$owned_projects = $db->data("SELECT id FROM project WHERE creator = '" . userid() . "'");
$projects = array();
foreach ($owned_projects as $project) {
$projects[$project['id']] = 'ADMIN';
}
$collaboration_projects = $db->data("SELECT project, permission FROM project_permission WHERE user = '" . userid() . "'");
foreach ($collaboration_projects as $project) {
$projects[$project['project']] = $project['permission'];
}
$_SESSION['user']['permissions']['project'] = $projects;
}
示例12: replace
/**
* Function used to replace content
* of email template with variables
* it can either be email subject or message content
* @param : Content STRING
* @param : array ARRAY => array({somevar}=>$isvar)
*/
function replace($content, $array)
{
//Common Varialbs
$com_array = array('{website_title}' => TITLE, '{baseurl}' => BASEURL, '{website_url}' => BASEURL, '{date_format}' => cbdate(DATE_FORMAT), '{date}' => cbdate(), '{username}' => username(), '{userid}' => userid(), '{date_year}' => cbdate("Y"), '{date_month}' => cbdate("m"), '{date_day}' => cbdate("d"), '{signup_link}' => cblink(array('name' => 'signup')), '{login_link}' => cblink(array('name' => 'login')));
if (is_array($array) && count($array) > 0) {
$array = array_merge($com_array, $array);
} else {
$array = $com_array;
}
foreach ($array as $key => $val) {
$var_array[] = '/' . $key . '/';
$val_array[] = $val;
}
return preg_replace($var_array, $val_array, $content);
}
示例13: activity_add
/**
* Log activity.
*
* @param $title Activity title
* @param $actor Actor ID
* @param $actor_type Actor type
* @param $verb Verb
* @param $object Object ID
* @param $object_type Object type
* @param $target Target ID
* @param $target_type Target type
*/
function activity_add($title, $actor, $actor_type, $actor_title, $verb, $object, $object_type, $object_title, $target = null, $target_type = null, $target_title = null)
{
global $db;
global $cache;
// create activity object
$activity = array('created' => date('Y-m-d H:i:s'), 'creator' => userid(), 'actor' => $actor, 'actor_type' => $actor_type, 'actor_title' => $actor_title, 'verb' => $verb, 'object' => $object, 'object_type' => $object_type, 'object_title' => $object_title, 'target' => $target, 'target_type' => $target_type, 'target_title' => $target_title, 'title' => $title);
// log activity into database
$id = $db->insert('activity', $activity);
// cache activity in memcache
$cache->set('activity.' . $id, $activity);
// push activity into streams
stream_activity_add($actor_type, $actor, $id);
stream_activity_add($object_type, $object, $id);
if ($target > 0) {
stream_activity_add($target_type, $target, $id);
}
}
示例14: call_download_video_function
/**
* Funcion used to call functions
* when video is going to dwnload
* ie in download.php
*/
function call_download_video_function($vdo)
{
global $db;
$funcs = get_functions('download_video_functions');
if (is_array($funcs) && count($funcs) > 0) {
foreach ($funcs as $func) {
if (function_exists($func)) {
$func($vdo);
}
}
}
//Updating Video Downloads
$db->update(tbl("video"), array("downloads"), array("|f|downloads+1"), "videoid = '" . $vdo['videoid'] . "'");
//Updating User Download
if (userid()) {
$db->update(tbl("users"), array("total_downloads"), array("|f|total_downloads+1"), "userid = '" . userid() . "'");
}
}
示例15: is_playlist_viewable
function is_playlist_viewable($list_id)
{
if (is_array($list_id)) {
$playlist = $list_id;
} else {
$playlist = get_playlist($list_id);
}
if (isset($playlist['playlist_id'])) {
if ($playlist['privacy'] == 'private' and $playlist['userid'] != userid()) {
e(lang('User has made this playlist private.'));
return false;
}
$data = cb_do_action('is_playlist_viewable', array('playlist' => $playlist));
if ($data) {
return $data;
}
return true;
}
return true;
}