当前位置: 首页>>代码示例>>PHP>>正文


PHP param_action函数代码示例

本文整理汇总了PHP中param_action函数的典型用法代码示例。如果您正苦于以下问题:PHP param_action函数的具体用法?PHP param_action怎么用?PHP param_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了param_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: die

 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
load_class('items/model/_itemtag.class.php', 'ItemTag');
/**
 * @var User
 */
global $current_User;
// Check minimum permission:
$current_User->check_perm('options', 'view', true);
$AdminUI->set_path('site', 'tags');
param_action('list', true);
if (param('tag_ID', 'integer', '', true)) {
    // Load item tag:
    $ItemTagCache =& get_ItemTagCache();
    if (($edited_ItemTag =& $ItemTagCache->get_by_ID($tag_ID, false)) === false) {
        // We could not find the goal to edit:
        unset($edited_ItemTag);
        forget_param('tag_ID');
        $Messages->add(sprintf(T_('Requested «%s» object does not exist any longer.'), T_('Tag')), 'error');
        $action = 'nil';
    }
}
switch ($action) {
    case 'list':
        break;
    case 'new':
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:item_tags.ctrl.php

示例2: dirname

 * See also {@link https://github.com/b2evolution/b2evolution}.
 *
 * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
 *
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
 *
 * @package htsrv
 */
/**
 * Includes:
 */
require_once dirname(__FILE__) . '/../conf/_config.php';
require_once $inc_path . '_main.inc.php';
$login = param($dummy_fields['login'], 'string', '');
param_action('req_login');
param('mode', 'string', '');
param('inskin', 'boolean', false);
if ($inskin) {
    param('blog', 'integer', NULL);
}
// gets used by header_redirect();
param('redirect_to', 'url', $ReqURI);
// Used to ABORT login
param('return_to', 'url', $ReqURI);
switch ($action) {
    case 'logout':
        logout();
        // logout $Session and set $current_User = NULL
        // TODO: to give the user feedback through Messages, we would need to start a new $Session here and append $Messages to it.
        // Redirect to $baseurl on logout if redirect URI is not set. Temporarily fix until we remove actions from redirect URIs
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:login.php

示例3: die

 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
/**
 * @var instance of User class
 */
global $current_User;
// Check minimum permission:
$current_User->check_perm('perm_maintenance', 'backup', true);
// Load Backup class (PHP4):
load_class('maintenance/model/_backup.class.php', 'Backup');
// Set options path:
$AdminUI->set_path('options', 'misc', 'backup');
// Get action parameter from request:
param_action('start');
// Create instance of Backup class
$current_Backup = new Backup();
// Load backup settings from request
if ($action == 'backup' && !$current_Backup->load_from_Request()) {
    $action = 'new';
}
$AdminUI->breadcrumbpath_init(false);
// fp> I'm playing with the idea of keeping the current blog in the path here...
$AdminUI->breadcrumbpath_add(T_('System'), $admin_url . '?ctrl=system');
$AdminUI->breadcrumbpath_add(T_('Maintenance'), $admin_url . '?ctrl=tools');
$AdminUI->breadcrumbpath_add(T_('Backup'), $admin_url . '?ctrl=backup');
// Set an url for manual page:
$AdminUI->set_page_manual_link('backup-tab');
// Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
$AdminUI->disp_html_head();
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:backup.ctrl.php

示例4: die

 * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
 *
 * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
 *
 * @package admin
 *
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
 * @author efy-asimo: Attila Simo.
 *
 * @version $Id: _broken_posts.view.php 3328 2013-03-26 11:44:11Z yura $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
$SQL = new SQL();
$SQL->SELECT('post_ID, post_title, post_main_cat_ID, post_canonical_slug_ID');
$SQL->FROM('T_items__item');
$SQL->WHERE('post_main_cat_ID NOT IN (SELECT cat_ID FROM T_categories )');
$Results = new Results($SQL->get(), 'broken_posts_');
$Results->title = T_('Broken items with no matching category');
$Results->global_icon(T_('Cancel!'), 'close', regenerate_url('action'));
$Results->cols[] = array('th' => T_('Item ID'), 'th_class' => 'shrinkwrap', 'td_class' => 'small center', 'order' => 'post_ID', 'td' => '$post_ID$');
$Results->cols[] = array('th' => T_('Title'), 'th_class' => 'nowrap', 'order' => 'post_title', 'td' => '$post_title$', 'td_class' => 'small');
$Results->cols[] = array('th' => T_('Main Cat ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_main_cat_ID', 'td' => '$post_main_cat_ID$', 'td_class' => 'small center');
$Results->cols[] = array('th' => T_('Canoncical Slug ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_canonical_slug_ID', 'td' => '$post_canonical_slug_ID$', 'td_class' => 'small center');
$Results->display(array('page_url' => regenerate_url('blog,ctrl,action,results_' . $Results->param_prefix . 'page', 'action=' . param_action() . '&amp;' . url_crumb('tools'))));
if ($current_User->check_perm('options', 'edit', true) && $Results->get_num_rows()) {
    // display Delete link
    $redirect_to = regenerate_url('action', 'action=del_broken_posts&' . url_crumb('tools'));
    echo '<p>[<a href="' . $redirect_to . '">' . T_('Delete these posts') . '</a>]</p>';
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:_broken_posts.view.php

示例5: param

/**
 * @global boolean Is this an admin page? Use {@link is_admin_page()} to query it, because it may change.
 */
$is_admin_page = true;
// user must be logged in and his/her account must be validated before access to admin
$login_required = true;
$validate_required = true;
require_once $inc_path . '_main.inc.php';
// Check global permission:
if (!$current_User->check_perm('admin', 'restricted')) {
    // No permission to access admin...
    // asimo> This should always denied access, but we insert a hack to create a temporary solution
    // We do allow comments and items actions, if the redirect is set to the front office! This way users without admin access may use the comments, and items controls.
    $test_ctrl = param('ctrl', '/^[a-z0-9_]+$/', '', false);
    $test_redirect_to = param('redirect_to', 'url', '', false);
    $test_action = param_action();
    // asimo> If we also would like to allow publish, deprecate and delete item/comment actions for users without admin access, we must uncomment the commented part below.
    if ($test_ctrl !== 'comments' && $test_ctrl !== 'items' || empty($test_redirect_to) || strpos($test_redirect_to, $admin_url) === 0 || empty($test_action) || !in_array($test_action, array('update', 'publish'))) {
        require $adminskins_path . '_access_denied.main.php';
    }
}
// Check user email is validated to make sure users can never has access to admin without a validated email address
if (!$current_User->check_status('can_access_admin')) {
    if ($current_User->check_status('can_be_validated')) {
        // redirect back to the login page
        $action = 'req_validatemail';
        require $htsrv_path . 'login.php';
    } else {
        // show access denied
        require $adminskins_path . '_access_denied.main.php';
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:admin.php

示例6: get_request_title


//.........这里部分代码省略.........
            $r[] = $params['lostpassword_text'];
            break;
        case 'single':
        case 'page':
            // We are displaying a single message:
            if ($preview) {
                // We are requesting a post preview:
                $r[] = T_('PREVIEW');
            } elseif ($params['title_' . $disp . '_disp'] && isset($MainList)) {
                $r = array_merge($r, $MainList->get_filter_titles(array('visibility', 'hide_future'), $params));
            }
            if ($params['title_' . $disp . '_before'] != '#') {
                $before = $params['title_' . $disp . '_before'];
            }
            if ($params['title_' . $disp . '_after'] != '#') {
                $after = $params['title_' . $disp . '_after'];
            }
            break;
        case 'user':
            // We are requesting the user page:
            $user_ID = param('user_ID', 'integer', 0);
            $UserCache =& get_UserCache();
            $User =& $UserCache->get_by_ID($user_ID, false, false);
            $user_login = $User ? $User->get('login') : '';
            $r[] = sprintf($params['user_text'], $user_login);
            break;
        case 'users':
            $r[] = $params['users_text'];
            break;
        case 'closeaccount':
            $r[] = $params['closeaccount_text'];
            break;
        case 'edit':
            $action = param_action();
            // Edit post by switching into 'In skin' mode from Back-office
            $p = param('p', 'integer', 0);
            // Edit post from Front-office
            $cp = param('cp', 'integer', 0);
            // Copy post from Front-office
            if ($action == 'edit_switchtab' || $p > 0) {
                // Edit post
                $title = $params['edit_text_update'];
            } else {
                if ($cp > 0) {
                    // Copy post
                    $title = $params['edit_text_copy'];
                } else {
                    // Create post
                    $title = $params['edit_text_create'];
                }
            }
            if ($params['auto_pilot'] != 'seo_title') {
                // Add advanced edit and close icon
                global $edited_Item;
                if (!empty($edited_Item) && $edited_Item->ID > 0) {
                    // Set the cancel editing url as permanent url of the item
                    $cancel_url = $edited_Item->get_permanent_url();
                } else {
                    // Set the cancel editing url to home page of the blog
                    $cancel_url = $Blog->gen_blogurl();
                }
                $title .= '<span class="title_action_icons">';
                if ($current_User->check_perm('admin', 'normal')) {
                    global $advanced_edit_link;
                    $title .= action_icon(T_('Go to advanced edit screen'), 'edit', $advanced_edit_link['href'], ' ' . T_('Advanced editing'), NULL, 3, array('onclick' => $advanced_edit_link['onclick']));
                }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:67,代码来源:_template.funcs.php

示例7: handle_htsrv_action

 /**
  * Handle messaging module htsrv actions
  */
 function handle_htsrv_action()
 {
     global $current_User, $Blog, $Session, $Messages, $samedomain_htsrv_url;
     // Init objects we want to work on.
     $action = param_action(true, true);
     $disp = param('disp', '/^[a-z0-9\\-_]+$/', 'threads');
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('messaging_' . $disp);
     // Load classes
     load_class('messaging/model/_thread.class.php', 'Thread');
     load_class('messaging/model/_message.class.php', 'Message');
     if (!is_logged_in()) {
         // user must be logged in
         debug_die('User must be logged in to proceed with messaging updates!');
     }
     // Check permission:
     $current_User->check_perm('perm_messaging', 'reply', true);
     // set where to redirect
     $redirect_to = param('redirect_to', 'url', NULL);
     if (empty($redirect_to)) {
         if (isset($Blog)) {
             $redirect_to = url_add_param($Blog->gen_baseurl(), 'disp=' . $disp);
         } else {
             $redirect_to = url_add_param($baseurl, 'disp=' . $disp);
         }
     }
     if ($disp != 'contacts' && ($thrd_ID = param('thrd_ID', 'integer', '', true))) {
         // Load thread from cache:
         $ThreadCache =& get_ThreadCache();
         if (($edited_Thread =& $ThreadCache->get_by_ID($thrd_ID, false)) === false) {
             unset($edited_Thread);
             forget_param('thrd_ID');
             $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Thread')), 'error');
             $action = 'nil';
         }
     }
     switch ($disp) {
         // threads action
         case 'threads':
             if ($action != 'create') {
                 // Make sure we got a thrd_ID:
                 param('thrd_ID', 'integer', true);
             }
             switch ($action) {
                 case 'create':
                     // create thread
                     // check if create new thread is allowed
                     if (check_create_thread_limit()) {
                         // max new threads limit reached, don't allow to create new thread
                         debug_die('Invalid request, new conversation limit already reached!');
                     }
                     if (!create_new_thread()) {
                         // unsuccessful new thread creation
                         global $edited_Thread, $edited_Message, $thrd_recipients, $thrd_recipients_array;
                         $redirect_to .= '&action=new';
                         // save new message and thread params into the Session to not lose the content
                         $unsaved_message_params = array();
                         $unsaved_message_params['subject'] = $edited_Thread->title;
                         $unsaved_message_params['message'] = $edited_Message->text;
                         $unsaved_message_params['thrdtype'] = param('thrdtype', 'string', 'individual');
                         // alternative: discussion
                         $unsaved_message_params['thrd_recipients'] = $thrd_recipients;
                         $unsaved_message_params['thrd_recipients_array'] = $thrd_recipients_array;
                         save_message_params_to_session($unsaved_message_params);
                     }
                     break;
                 case 'delete':
                     // delete thread
                     // Check permission:
                     $current_User->check_perm('perm_messaging', 'delete', true);
                     $confirmed = param('confirmed', 'integer', 0);
                     if ($confirmed) {
                         $msg = sprintf(T_('Thread &laquo;%s&raquo; deleted.'), $edited_Thread->dget('title'));
                         $edited_Thread->dbdelete(true);
                         unset($edited_Thread);
                         forget_param('thrd_ID');
                         $Messages->add($msg, 'success');
                     } else {
                         $delete_url = $samedomain_htsrv_url . 'action.php?mname=messaging&thrd_ID=' . $edited_Thread->ID . '&action=delete&confirmed=1&redirect_to=' . $redirect_to . '&' . url_crumb('messaging_threads');
                         $ok_button = '<span class="linkbutton"><a href="' . $delete_url . '">' . T_('I am sure!') . '!</a></span>';
                         $cancel_button = '<span class="linkbutton"><a href="' . $redirect_to . '">CANCEL</a></span>';
                         $msg = sprintf(T_('You are about to delete all messages in the conversation &laquo;%s&raquo;.'), $edited_Thread->dget('title'));
                         $msg .= '<br />' . T_('This CANNOT be undone!') . '<br />' . T_('Are you sure?') . '<br /><br />' . $ok_button . "\t" . $cancel_button;
                         $Messages->add($msg, 'error');
                     }
                     break;
                 case 'leave':
                     // user wants to leave the thread
                     leave_thread($edited_Thread->ID, $current_User->ID, false);
                     $Messages->add(sprintf(T_('You have successfuly left the &laquo;%s&raquo; conversation!'), $edited_Thread->get('title')), 'success');
                     break;
                 case 'close':
                     // close the thread
                 // close the thread
                 case 'close_and_block':
                     // close the thread and block contact
                     leave_thread($edited_Thread->ID, $current_User->ID, true);
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_messaging.init.php

示例8: die

 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
 *
 * @package admin
 *
 * @todo separate object inits and permission checks
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
/**
 * @var AdminUI_general
 */
global $AdminUI;
param('user_ID', 'integer', NULL);
// Note: should NOT be memorized (would kill navigation/sorting) use memorize_param() if needed
param_action('list');
$tab = param('tab', 'string', '');
$AdminUI->set_path('users', $tab == 'stats' ? 'stats' : 'users');
if (!$current_User->check_perm('users', 'view')) {
    // User has no permissions to view: he can only edit his profile
    if (isset($user_ID) && $user_ID != $current_User->ID) {
        // User is trying to edit something he should not: add error message (Should be prevented by UI)
        $Messages->add(T_('You have no permission to view other users!'), 'error');
    }
    // Make sure the user only edits himself:
    $user_ID = $current_User->ID;
    if (!in_array($action, array('update', 'edit', 'default_settings', 'change_admin_skin'))) {
        header_redirect(regenerate_url('ctrl,action', 'ctrl=user&action=edit&user_ID=' . $user_ID, '', '&'));
    }
}
/*
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:users.ctrl.php

示例9: die

 * }}
 *
 * @package admin
 *
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
 * @author fplanque: Francois PLANQUE.
 *
 * @todo (sessions) When creating a blog, provide "edit options" (3 tabs) instead of a single long "New" form (storing the new Blog object with the session data).
 * @todo Currently if you change the name of a blog it gets not reflected in the blog list buttons!
 *
 * @version $Id: coll_settings.ctrl.php,v 1.11 2008/01/21 09:35:26 fplanque Exp $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
param_action('edit');
param('tab', 'string', 'general', true);
// Check permissions on requested blog and autoselect an appropriate blog if necessary.
// This will prevent a fat error when switching tabs and you have restricted perms on blog properties.
if ($selected = autoselect_blog('blog_properties', 'edit')) {
    // We have a blog to work on:
    if (set_working_blog($selected)) {
        // Selected a new blog:
        $BlogCache =& get_Cache('BlogCache');
        $Blog =& $BlogCache->get_by_ID($blog);
    }
    /**
     * @var Blog
     */
    $edited_Blog =& $Blog;
} else {
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:coll_settings.ctrl.php

示例10: die

 * @package admin
 *
 * @todo Allow applying / re-checking of the known data, not just after an update!
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
param('display_mode', 'string');
if ($display_mode != 'js') {
    $AdminUI->set_path('options', 'antispam');
} else {
    // This is an Ajax response
    // fp> TODO: have a more systematic way of handling AJAX responses
    header_content_type('text/html', $io_charset);
}
param_action('');
param('confirm', 'string');
param('keyword', 'string', '', true);
param('domain', 'string');
param('filteron', 'string', '', true);
param('filter', 'array:string', array());
$tab = param('tab', 'string', '', true);
$tab3 = param('tab3', 'string', '', true);
$tool = param('tool', 'string', '', true);
if (isset($filter['off'])) {
    unset($filteron);
    forget_param('filteron');
}
// Check permission:
$current_User->check_perm('options', 'view', true);
$current_User->check_perm('spamblacklist', 'view', true);
开发者ID:Edind304,项目名称:b2evolution,代码行数:31,代码来源:antispam.ctrl.php

示例11: array_merge

global $Skin;
if (!empty($Skin)) {
    $display_params = array_merge($Skin->get_template('Results'), $Skin->get_template('messages'));
} else {
    $display_params = NULL;
}
$thrdtype = 'individual';
// alternative: discussion
if (!is_logged_in()) {
    debug_die('You are not logged in!');
}
if (!isset($disp)) {
    $disp = 'threads';
}
// Get action parameter from request:
$action = param_action('view');
// ----------------------- End Init variables --------------------------
// set params
if (!isset($params)) {
    $params = array();
}
$params = array_merge(array('form_class' => 'bComment', 'form_title' => '', 'form_action' => $samedomain_htsrv_url . 'action.php?mname=messaging', 'form_name' => '', 'form_layout' => NULL, 'cols' => 40, 'thrdtype' => $thrdtype), $params);
switch ($disp) {
    case 'threads':
        if ($action == 'new') {
            require $inc_path . 'messaging/views/_thread.form.php';
        } else {
            require $inc_path . 'messaging/views/_thread_list.view.php';
        }
        break;
    case 'contacts':
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:_threads.disp.php

示例12: display_comment_mass_delete

/**
 * Dispay a form to mass delete the comments
 *
 * @param object Comment List
 */
function display_comment_mass_delete($CommentList)
{
    $action = param_action();
    if ($action != 'mass_delete') {
        // Display this form only for action "mass_delete"
        return;
    }
    if (!check_comment_mass_delete($CommentList)) {
        // Form is not available
        return;
    }
    require dirname(__FILE__) . '/../views/_comment_mass.form.php';
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:18,代码来源:_comment.funcs.php

示例13: die

 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
// Load Organization class:
load_class('users/model/_organization.class.php', 'Organization');
/**
 * @var User
 */
global $current_User;
// Check minimum permission:
$current_User->check_perm('users', 'view', true);
// Set options path:
$AdminUI->set_path('users', 'organizations');
// Get action parameter from request:
param_action('', true);
if (param('org_ID', 'integer', '', true)) {
    // Load organization from cache:
    $OrganizationCache =& get_OrganizationCache();
    if (($edited_Organization =& $OrganizationCache->get_by_ID($org_ID, false)) === false) {
        // We could not find the organization to edit:
        unset($edited_Organization);
        forget_param('org_ID');
        $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Organization')), 'error');
        $action = 'nil';
    }
}
switch ($action) {
    case 'new':
        // Check permission:
        $current_User->check_perm('users', 'edit', true);
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:organizations.ctrl.php

示例14: skin_init


//.........这里部分代码省略.........
                        $action = $unsaved_message_params['action'];
                    }
                    break;
                case 'contacts':
                    // Actions ONLY for disp=contacts
                    if (!is_logged_in()) {
                        // Redirect to the login page for anonymous users
                        $Messages->add(T_('You must log in to manage your contacts.'));
                        header_redirect(get_login_url('cannot see contacts'), 302);
                        // will have exited
                    }
                    if (!$current_User->check_status('can_view_contacts')) {
                        // user is logged in, but his status doesn't allow to view contacts
                        if ($current_User->check_status('can_be_validated')) {
                            // user is logged in but his/her account was not activated yet
                            // Redirect to the account activation page
                            $Messages->add(T_('You must activate your account before you can manage your contacts. <b>See below:</b>'));
                            header_redirect(get_activate_info_url(), 302);
                            // will have exited
                        }
                        // Redirect to the blog url for users without messaging permission
                        $Messages->add('You are not allowed to view Contacts!');
                        $blogurl = $Blog->gen_blogurl();
                        // If it was a front page request or the front page is set to display 'contacts' then we must not redirect to the front page because it is forbidden for the current User
                        $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'contacts' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl;
                        header_redirect($redirect_to, 302);
                    }
                    if (has_cross_country_restriction('any') && empty($current_User->ctry_ID)) {
                        // User may browse/contact other users only from the same country
                        $Messages->add(T_('Please specify your country before attempting to contact other users.'));
                        header_redirect(get_user_profile_url());
                    }
                    // Get action parameter from request:
                    $action = param_action();
                    if (!$current_User->check_perm('perm_messaging', 'reply')) {
                        // Redirect to the blog url for users without messaging permission
                        $Messages->add('You are not allowed to view Contacts!');
                        $blogurl = $Blog->gen_blogurl();
                        // If it was a front page request or the front page is set to display 'contacts' then we must not redirect to the front page because it is forbidden for the current User
                        $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'contacts' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl;
                        header_redirect($redirect_to, 302);
                        // will have exited
                    }
                    switch ($action) {
                        case 'add_user':
                            // Add user to contacts list
                            // Check that this action request is not a CSRF hacked request:
                            $Session->assert_received_crumb('messaging_contacts');
                            $user_ID = param('user_ID', 'integer', 0);
                            if ($user_ID > 0) {
                                // Add user to contacts
                                if (create_contacts_user($user_ID)) {
                                    // Add user to the group
                                    $group_ID = param('group_ID', 'string', '');
                                    if ($result = create_contacts_group_users($group_ID, $user_ID, 'group_ID_combo')) {
                                        // User has been added to the group
                                        $Messages->add(sprintf(T_('User has been added to the &laquo;%s&raquo; group.'), $result['group_name']), 'success');
                                    } else {
                                        // User has been added ONLY to the contacts list
                                        $Messages->add('User has been added to your contacts.', 'success');
                                    }
                                }
                                header_redirect($Blog->get('userurl', array('url_suffix' => 'user_ID=' . $user_ID, 'glue' => '&')));
                            }
                            break;
                        case 'unblock':
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:67,代码来源:_skin.funcs.php

示例15: handle_htsrv_action

 /**
  * Handle collections module htsrv actions
  */
 function handle_htsrv_action()
 {
     global $demo_mode, $current_User, $DB, $Session, $Messages;
     global $UserSettings, $samedomain_htsrv_url;
     if (!is_logged_in()) {
         // user must be logged in
         bad_request_die($this->T_('You are not logged in.'));
     }
     // Init the objects we want to work on.
     $action = param_action(true);
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('collections_' . $action);
     switch ($action) {
         case 'unlink':
             // Unlink a file from a LinkOwner ( Item, Comment ) object, and delete that file if it's not linked to any other object
             $link_ID = param('link_ID', 'integer', true);
             $redirect_to = param('redirect_to', 'url', '');
             $LinkCache =& get_LinkCache();
             $edited_Link =& $LinkCache->get_by_ID($link_ID, false);
             if (!$edited_Link) {
                 // the edited Link object doesn't exists
                 $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Link')), 'error');
                 header_redirect();
             }
             // We have a link, get the LinkOwner it is attached to:
             $LinkOwner =& $edited_Link->get_LinkOwner();
             $linked_File =& $edited_Link->get_File();
             // Load the blog we're in:
             $Blog =& $LinkOwner->get_Blog();
             set_working_blog($Blog->ID);
             // Check permission:
             $LinkOwner->check_perm('edit', true);
             $confirmed = param('confirmed', 'integer', 0);
             if ($confirmed) {
                 // Unlink File from Item:
                 $edited_Link->dbdelete(true);
                 unset($edited_Link);
                 $Messages->add($LinkOwner->translate('Link has been deleted from $ownerTitle$.'), 'success');
                 if ($current_User->check_perm('files', 'edit')) {
                     // current User has permission to edit/delete files
                     $file_name = $linked_File->get_name();
                     // Get number of objects where this file is attahced to
                     // TODO: attila>this must be handled with a different function
                     $file_links = get_file_links($linked_File->ID, array('separator' => '<br />'));
                     $links_count = strlen($file_links) > 0 ? substr_count($file_links, '<br />') + 1 : 0;
                     if ($links_count > 0) {
                         // File is linked to other objects
                         $Messages->add(sprintf(T_('File %s is still linked to %d other objects'), $file_name, $links_count), 'note');
                     } else {
                         // File is not linked to other objects
                         if ($linked_File->unlink()) {
                             // File removed successful ( removed from db and from storage device also )
                             $Messages->add(sprintf(T_('File %s has been deleted.'), $file_name), 'success');
                         } else {
                             // Could not completly remove the file
                             $Messages->add(sprintf(T_('File %s could not be deleted.'), $file_name), 'error');
                         }
                     }
                 }
             } else {
                 // Display confirm unlink/delete message
                 $delete_url = $samedomain_htsrv_url . 'action.php?mname=collections&action=unlink&link_ID=' . $edited_Link->ID . '&confirmed=1&crumb_collections_unlink=' . get_crumb('collections_unlink');
                 $ok_button = '<span class="linkbutton"><a href="' . $delete_url . '">' . T_('I am sure!') . '!</a></span>';
                 $cancel_button = '<span class="linkbutton"><a href="' . $redirect_to . '">CANCEL</a></span>';
                 $msg = sprintf(T_('You are about to unlink and delete the attached file from %s path.'), $linked_File->get_root_and_rel_path());
                 $msg .= '<br />' . T_('This CANNOT be undone!') . '<br />' . T_('Are you sure?') . '<br /><br />' . $ok_button . "\t" . $cancel_button;
                 $Messages->add($msg, 'error');
             }
             header_redirect($redirect_to);
             break;
         case 'isubs_update':
             // Subscribe/Unsubscribe user on the selected item
             if ($demo_mode && $current_User->ID <= 3) {
                 // don't allow default users profile change on demo mode
                 bad_request_die('Demo mode: you can\'t edit the admin and demo users profile!<br />[<a href="javascript:history.go(-1)">' . T_('Back to profile') . '</a>]');
             }
             // Get params
             $item_ID = param('p', 'integer', true);
             $notify = param('notify', 'integer', 0);
             if ($notify < 0 || $notify > 1) {
                 // Invalid notify param. It should be 0 for unsubscribe and 1 for subscribe.
                 $Messages->add('Invalid params!', 'error');
             }
             if (!is_email($current_User->get('email'))) {
                 // user doesn't have a valid email address
                 $Messages->add(T_('Your email address is invalid. Please set your email address first.'), 'error');
             }
             if ($Messages->has_errors()) {
                 // errors detected
                 header_redirect();
                 // already exited here
             }
             if (set_user_isubscription($current_User->ID, $item_ID, $notify)) {
                 if ($notify == 0) {
                     $Messages->add(T_('You have successfully unsubscribed.'), 'success');
                 } else {
                     $Messages->add(T_('You have successfully subscribed to notifications.'), 'success');
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_collections.init.php


注:本文中的param_action函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。