本文整理汇总了PHP中has_access函数的典型用法代码示例。如果您正苦于以下问题:PHP has_access函数的具体用法?PHP has_access怎么用?PHP has_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_access函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: editAction
public function editAction($id = null, $advanced = null)
{
if ($advanced == 'advanced' && has_access('Orange::Advanced Settings')) {
$this->page->data('advanced', true);
}
$this->page->js('/themes/orange/assets/js/settings.min.js');
parent::editAction($id);
}
示例3: admin_protect
function admin_protect()
{
global $user_data;
if (has_access($user_data['user_id'], 1) === false) {
header('Location: index.php');
exit;
}
}
示例4: admin_page
function admin_page()
{
global $user_data;
if (has_access($user_data['user_id'], USER_TYPE_ADMIN) === false) {
echo '<meta HTTP-EQUIV="REFRESH" content="0; url=index.php">';
exit;
}
}
示例5: adminormoderate_protect
function adminormoderate_protect()
{
global $user_data;
if (has_access($user_data['user_id'], 2) === true || has_access($user_data['user_id'], 1) === true) {
} else {
header('Location: /');
exit;
}
}
示例6: edit_savePostAction
public function edit_savePostAction()
{
has_access('templates::edit');
$id = $this->input->post('id');
$content = $this->input->post('content');
$name = $this->input->post('name');
$is_file = $this->input->post('is_file');
$this->c_templates_model->save($id, $content, $name, $is_file);
$this->output->json('err', false);
}
示例7: editAction
public function editAction($id = null, $advanced = null)
{
if ($advanced == 'advanced' && has_access('Orange::Advanced Menubar')) {
$this->page->data('advanced', true);
}
$this->page->data('return_to', $this->input->server('HTTP_REFERER'));
$record = $this->o_menubar_model->get($id);
$catalog = $this->o_menubar_model->catalog();
$title = 'Edit “' . $record->text . '”';
if (!empty($catalog[$record->parent_id]->text)) {
$title .= ' Menu Under “' . $catalog[$record->parent_id]->text . '”';
}
$data = ['controller_title' => $title, 'record' => $record, 'controller_action' => 'edit'];
$this->page->data($data)->build($this->controller_path . '/form');
}
示例8: update_broadcast
/**
* update video broadcast option
*
* @param INT videoid
* @param STRING broadcast
*
* @return BOOLEAN
*/
function update_broadcast($vid, $brd)
{
if (!is_valid_broadcast($brd)) {
e(lang('Invalid broadcast option'));
} else {
if ($this->is_video_owner($vid, userid()) || has_access('admin_access', TRUE)) {
db_update(tbl('video'), array('broadcast' => mysql_clean($brd)), " videoid='{$vid}' ");
} else {
e(lang('You cannot update this video'), true);
}
}
}
示例9: Assign
Assign('layout_dir', LAYOUT);
if (USE_PHOTO_TAGGING == true) {
$Cbucket->addJS('jquery_plugs/jquery.cbtagger.js', 'view_item');
}
$Cbucket->addJS('jquery_plugs/jquery.Jcrop.js', 'edit_account');
$Cbucket->addJS('amplify/amplify.core.min.js');
$Cbucket->addJS('amplify/amplify.request.min.js');
$Cbucket->addJS('amplify/amplify.store.min.js');
$Cbucket->addJS('amplify_requests.js');
//Assigning JS Files
Assign('jsArray', $Cbucket->JSArray);
//Assigning Module Files
Assign('module_list', $Cbucket->moduleList);
//Checking Website is closed or not
if (config('closed') && THIS_PAGE != 'ajax' && !$in_bg_cron && THIS_PAGE != 'cb_install') {
if (!has_access("admin_access", TRUE)) {
e($row['closed_msg'], "w");
template("global_header.html");
template("message.html");
exit;
} else {
e(lang("ATTENTION: THIS WEBSITE IS IN OFFLINE MODE"), "w");
}
}
//Configuring Uploader
uploaderDetails();
register_filter('photo_action_links', 'cbphoto_pm_action_link_filter');
attach_photo_pm_handlers();
if (!IN_MODULE) {
isSectionEnabled(PARENT_PAGE, true);
}
示例10: subtitle
}
subtitle(sprintf(lang('user_s_channel'), $udetails['username']));
//Setting profilte item
$profileItem = $userquery->getProfileItem($udetails['userid'], true);
assign('profile_item', $profileItem);
} else {
if ($_GET['seo_diret'] != 'yes') {
e(lang("usr_exist_err"));
$Cbucket->show_page = false;
} else {
header("HTTP/1.0 404 Not Found");
if (file_exists(LAYOUT . "/404.html")) {
template_files('404.html');
} else {
$data = "404_error";
if (has_access('admin_access')) {
e(sprintf(lang("err_warning"), "404", "http://docs.clip-bucket.com/?p=154"), "w");
}
e(lang($data));
}
display_it();
exit;
}
}
add_js(array('jquery_plugs/compressed/jquery.jCarousel.js' => 'view_channel'));
if ($Cbucket->show_page) {
template_files('view_channel.html');
display_it();
} else {
$Cbucket->show_page = true;
if ($udetails) {
示例11: set_the_template
/**
* Function used to set template (Frontend)
*/
function set_the_template()
{
global $cbtpl, $myquery;
$template = $this->template;
$can_change = can_change_template();
if (isset($_SESSION['the_template']) && $cbtpl->is_template($_SESSION['the_template'])) {
$template = $_SESSION['the_template'];
}
if ($_GET['template'] and $can_change) {
if (is_dir(STYLES_DIR . '/' . $_GET['template']) && $_GET['template']) {
$template = $_GET['template'];
}
}
if (isset($_GET['set_the_template']) && $cbtpl->is_template($_GET['set_the_template']) and $can_change) {
$template = $_SESSION['the_template'] = $_GET['set_the_template'];
}
if (!is_dir(STYLES_DIR . '/' . $template) || !$template || is_template_hidden($template)) {
$template = 'cbv3';
}
if (!is_dir(STYLES_DIR . '/' . $template) || !$template) {
$template = $cbtpl->get_any_template();
}
if (!is_dir(STYLES_DIR . '/' . $template) || !$template) {
exit("Unable to find any template, please goto <a href='http://clip-bucket.com/no-template-found'><strong>ClipBucket Support!</strong></a>");
}
if ($_GET['set_template'] and has_access('admin_access')) {
$myquery->set_template($template);
}
$this->template_details = $cbtpl->get_template_details($template);
//CHecking if there is any php file, include it like a BOSS!
//if($this->template_details['php_file'])
// include($this->template_details['php_file']);
$this->template = $template;
return $this->template;
}
示例12:
<?php
theme::header_start('Banners', 'mange banners.');
Plugin_search_sort::field();
if (has_access('templates::add')) {
theme::header_button('new');
}
theme::header_end();
theme::table_start(['Title', 'Starts After', 'End After', 'Points To', 'Weight' => 'text-center', 'Actions' => 'text-center'], [], $records);
foreach ($records as $key => $record) {
theme::table_start_tr();
theme::e($record->title);
theme::table_row();
theme::date($record->start_on);
theme::table_row();
theme::date($record->end_on);
theme::table_row();
theme::e($record->url);
theme::table_row('text-center');
theme::e($record->weight);
theme::table_row('actions text-center');
if ($record->is_editable) {
theme::table_action('edit', $this->controller_path . '/edit/' . $record->id);
}
if ($record->is_deletable) {
o_dialog::confirm_a_delete($this->controller_path . '/delete/' . $record->id);
}
theme::table_end_tr();
}
theme::table_end();
theme::return_to_top();
示例13: get_playlists
/**
* Function used to get playlists
*/
function get_playlists($params = array())
{
global $cb_columns, $db;
$fields = array('playlists' => $cb_columns->object('playlists')->get_columns());
$order = $params['order'];
$limit = $params['limit'];
$main_query = $query = "SELECT " . table_fields($fields) . " FROM " . table('playlists');
$condition = "playlists.playlist_type = 'v'";
if (!has_access('admin_access')) {
$condition .= $condition ? " AND " : "";
$condition .= "playlists.privacy = 'public'";
} else {
if ($params['privacy']) {
$condition .= $condition ? " AND " : "";
$condition .= " playlists.privacy = '" . mysql_clean($params['privacy']) . "' ";
}
}
if ($params['category']) {
$condition .= $condition ? " AND " : "";
$condition .= " playlists.category = '" . $params['category'] . "' ";
}
if ($params['include']) {
$ids = is_array($params['include']) ? $params['include'] : explode(',', $params['include']);
if (is_array($ids) and !empty($ids)) {
$condition .= $condition ? " AND " : "";
$ids = implode(",", array_map('trim', $ids));
$condition .= " playlists.playlist_id IN ({$ids}) ";
}
}
if ($params['exclude']) {
$ids = is_array($params['exclude']) ? $params['exclude'] : explode(',', $params['exclude']);
if (is_array($ids) and !empty($ids)) {
$condition .= $condition ? " AND " : "";
$ids = implode(",", array_map('trim', $ids));
$condition .= " playlists.playlist_id NOT IN ({$ids}) ";
}
}
if ($params['date_span']) {
$condition .= $condition ? " AND " : "";
$column = $params['date_span_column'] ? trim($params['date_span_column']) : 'playlists.date_added';
$condition .= cbsearch::date_margin($column, $params['date_span']);
}
if ($params['last_update']) {
$condition .= $condition ? " AND " : "";
$condition .= cbsearch::date_margin('playlists.last_update', $params['last_update']);
}
if ($params['user']) {
$condition .= $condition ? " AND " : "";
$condition .= " playlists.userid = '" . $params['user'] . "' ";
}
if ($params['has_items']) {
$condition .= $condition ? " AND " : "";
$condition .= " playlists.total_items > '0' ";
}
if ($params['count_only']) {
$result = $db->count(cb_sql_table('playlists'), 'playlist_id');
return $result;
}
if ($condition) {
$query .= " WHERE " . $condition;
}
$order = " ORDER BY " . ($order ? trim($order) : "playlists.date_added DESC");
$limit = $limit ? " LIMIT {$limit} " : "";
$query .= $order . $limit;
$query_id = cb_query_id($query);
$action_array = array('query_id' => $query_id);
$data = cb_do_action('select_playlists', array_merge($action_array, $params));
if ($data) {
return $data;
}
$results = select($query);
if (!empty($results)) {
cb_do_action('return_playlists', array('query_id' => $query_id, 'results' => $results));
return $results;
}
return false;
}
示例14: update_collection
/**
* Function used to create collection preview
*/
function update_collection($array = NULL)
{
global $db;
if ($array == NULL) {
$array = $_POST;
}
if (is_array($_FILES)) {
$array = array_merge($array, $_FILES);
}
$this->validate_form_fields($array);
$cid = $array['collection_id'];
if (!error()) {
$reqFields = $this->load_required_fields($array);
$otherFields = $this->load_other_fields($array);
$collection_fields = array_merge($reqFields, $otherFields);
if ($this->custom_collection_fields > 0) {
$collection_fields = array_merge($collection_fields, $this->custom_collection_fields);
}
foreach ($collection_fields as $field) {
$name = formObj::rmBrackets($field['name']);
$val = $array[$name];
if ($field['use_func_val']) {
$val = $field['validate_function']($val);
}
if (!empty($field['db_field'])) {
$query_field[] = $field['db_field'];
}
if (is_array($val)) {
$new_val = '';
foreach ($val as $v) {
$new_val .= "#" . $v . "# ";
}
$val = $new_val;
}
if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) {
$val = $val;
} else {
$val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
}
if (!empty($field['db_field'])) {
$query_val[] = $val;
}
}
if (has_access('admin_access', TRUE)) {
if (!empty($array['total_comments'])) {
$total_comments = $array['total_comments'];
if (!is_numeric($total_comments) || $total_comments < 0) {
$total_comments = 0;
}
$query_field[] = "total_comments";
$query_val[] = $total_comments;
}
if (!empty($array['total_objects'])) {
$tobj = $array['total_objects'];
if (!is_numeric($tobj) || $tobj < 0) {
$tobj = 0;
}
$query_field[] = "total_objects";
$query_val[] = $tobj;
}
}
}
if (!error()) {
if (!userid()) {
e(lang("you_not_logged_in"));
} elseif (!$this->collection_exists($cid)) {
e(lang("collect_not_exist"));
} elseif (!$this->is_collection_owner($cid, userid()) && !has_access('admin_access', TRUE)) {
e(lang("cant_edit_collection"));
} else {
$db->update(tbl($this->section_tbl), $query_field, $query_val, " collection_id = {$cid}");
e(lang("collection_updated"), "m");
if (!empty($array['collection_thumb']['tmp_name'])) {
$this->upload_thumb($cid, $array['collection_thumb']);
}
}
}
}
示例15: foreach
<?php
theme::header_start($controller_titles, 'manage random bits of text.');
Plugin_search_sort::field();
if (has_access('Snippets::Add Snippets')) {
theme::header_button('new');
}
theme::header_end();
theme::table_start(['Name', 'Value', 'Note', 'Actions' => 'text-center'], [], $records);
foreach ($records as $record) {
theme::table_start_tr();
theme::e($record->name);
theme::table_row();
theme::shorten($record->value);
theme::table_row();
theme::shorten($record->note);
theme::table_row('actions text-center');
if ($record->is_editable && has_access('Snippets::Edit Snippets')) {
theme::table_action('edit', $this->controller_path . '/edit/' . $record->id);
}
if ($record->is_deletable && has_access('Snippets::Delete Snippets')) {
o_dialog::confirm_a_delete($this->controller_path . '/delete/' . $record->id);
}
theme::table_end_tr();
}
theme::table_end();
theme::return_to_top();