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


PHP get_pwg_token函数代码示例

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


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

示例1: TAT_no_photo_yet

function TAT_no_photo_yet()
{
    global $template;
    load_language('plugin.lang', PHPWG_PLUGINS_PATH . 'TakeATour/');
    $template->set_prefilter('no_photo_yet', 'TAT_no_photo_yet_prefilter');
    $template->assign(array('F_ACTION' => get_root_url() . 'admin.php', 'pwg_token' => get_pwg_token()));
}
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:7,代码来源:main.inc.php

示例2: switch

    switch ($_GET['installstatus']) {
        case 'ok':
            $page['infos'][] = l10n('Theme has been successfully installed');
            break;
        case 'temp_path_error':
            $page['errors'][] = l10n('Can\'t create temporary file.');
            break;
        case 'dl_archive_error':
            $page['errors'][] = l10n('Can\'t download archive.');
            break;
        case 'archive_error':
            $page['errors'][] = l10n('Can\'t read or extract archive.');
            break;
        default:
            $page['errors'][] = l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']));
    }
}
// +-----------------------------------------------------------------------+
// |                          template output                              |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('themes' => 'themes_new.tpl'));
if ($themes->get_server_themes(true)) {
    foreach ($themes->server_themes as $theme) {
        $url_auto_install = htmlentities($base_url) . '&revision=' . $theme['revision_id'] . '&extension=' . $theme['extension_id'] . '&pwg_token=' . get_pwg_token();
        $template->append('new_themes', array('name' => $theme['extension_name'], 'thumbnail' => PEM_URL . '/upload/extension-' . $theme['extension_id'] . '/thumbnail.jpg', 'screenshot' => PEM_URL . '/upload/extension-' . $theme['extension_id'] . '/screenshot.jpg', 'install_url' => $url_auto_install));
    }
} else {
    $page['errors'][] = l10n('Can\'t connect to server.');
}
$template->assign('default_screenshot', get_root_url() . 'admin/themes/' . $conf['admin_theme'] . '/images/missing_screenshot.png');
$template->assign_var_from_handle('ADMIN_CONTENT', 'themes');
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:themes_new.php

示例3: IN

  WHERE group_id IN (' . implode(',', $group_granted_ids) . ') 
';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        if (!isset($granted_groups[$row['group_id']])) {
            $granted_groups[$row['group_id']] = array();
        }
        $granted_groups[$row['group_id']][] = $row['user_id'];
    }
    $user_granted_by_group_ids = array();
    foreach ($granted_groups as $group_users) {
        $user_granted_by_group_ids = array_merge($user_granted_by_group_ids, $group_users);
    }
    $user_granted_by_group_ids = array_unique($user_granted_by_group_ids);
    $user_granted_indirect_ids = array_diff($user_granted_by_group_ids, $user_granted_direct_ids);
    $template->assign('nb_users_granted_indirect', count($user_granted_indirect_ids));
    foreach ($granted_groups as $group_id => $group_users) {
        $group_usernames = array();
        foreach ($group_users as $user_id) {
            if (in_array($user_id, $user_granted_indirect_ids)) {
                $group_usernames[] = $users[$user_id];
            }
        }
        $template->append('user_granted_indirect_groups', array('group_name' => $groups[$group_id], 'group_users' => implode(', ', $group_usernames)));
    }
}
// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+
$template->assign(array('PWG_TOKEN' => get_pwg_token(), 'INHERIT' => $conf['inheritance_by_default'], 'CACHE_KEYS' => get_admin_client_cache_keys(array('groups', 'users'))));
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_perm');
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:cat_perm.php

示例4: pwg_query

// |                              group list                               |
// +-----------------------------------------------------------------------+
$query = '
SELECT id, name, is_default
  FROM ' . GROUPS_TABLE . '
  ORDER BY name ASC
;';
$result = pwg_query($query);
$admin_url = get_root_url() . 'admin.php?page=';
$perm_url = $admin_url . 'group_perm&group_id=';
$del_url = $admin_url . 'group_list&delete=';
$toggle_is_default_url = $admin_url . 'group_list&toggle_is_default=';
while ($row = pwg_db_fetch_assoc($result)) {
    $query = '
SELECT u.' . $conf['user_fields']['username'] . ' AS username
  FROM ' . USERS_TABLE . ' AS u
  INNER JOIN ' . USER_GROUP_TABLE . ' AS ug
    ON u.' . $conf['user_fields']['id'] . ' = ug.user_id
  WHERE ug.group_id = ' . $row['id'] . '
;';
    $members = array();
    $res = pwg_query($query);
    while ($us = pwg_db_fetch_assoc($res)) {
        $members[] = $us['username'];
    }
    $template->append('groups', array('NAME' => $row['name'], 'ID' => $row['id'], 'IS_DEFAULT' => get_boolean($row['is_default']) ? ' [' . l10n('default') . ']' : '', 'NB_MEMBERS' => count($members), 'L_MEMBERS' => implode(' <span class="userSeparator">&middot;</span> ', $members), 'MEMBERS' => l10n_dec('%d member', '%d members', count($members)), 'U_DELETE' => $del_url . $row['id'] . '&amp;pwg_token=' . get_pwg_token(), 'U_PERM' => $perm_url . $row['id'], 'U_ISDEFAULT' => $toggle_is_default_url . $row['id'] . '&amp;pwg_token=' . get_pwg_token()));
}
// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'group_list');
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:group_list.php

示例5: ws_session_getStatus

/**
 * API method
 * Returns info about the current user
 * @param mixed[] $params
 */
function ws_session_getStatus($params, &$service)
{
    global $user, $conf;
    $res['username'] = is_a_guest() ? 'guest' : stripslashes($user['username']);
    foreach (array('status', 'theme', 'language') as $k) {
        $res[$k] = $user[$k];
    }
    $res['pwg_token'] = get_pwg_token();
    $res['charset'] = get_pwg_charset();
    list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    $res['current_datetime'] = $dbnow;
    $res['version'] = PHPWG_VERSION;
    if (is_admin()) {
        $res['upload_file_types'] = implode(',', array_unique(array_map('strtolower', $conf['upload_form_all_types'] ? $conf['file_ext'] : $conf['picture_ext'])));
        $res['upload_form_chunk_size'] = $conf['upload_form_chunk_size'];
    }
    return $res;
}
开发者ID:donseba,项目名称:Piwigo,代码行数:23,代码来源:pwg.php

示例6: query2array

// | form options                                                          |
// +-----------------------------------------------------------------------+
$query = '
SELECT
    pm.*,
    uppercats
  FROM ' . PFEMAIL_MAILBOXES_TABLE . ' AS pm
    JOIN ' . CATEGORIES_TABLE . ' AS c ON c.id = category_id
  ORDER BY pm.id DESC
;';
$mailboxes = query2array($query);
foreach ($mailboxes as $idx => $mailbox) {
    $mailboxes[$idx]['album'] = get_cat_display_name_cache($mailbox['uppercats'], null, false);
    $mailboxes[$idx]['data'] = json_encode($mailbox);
}
$template->assign(array('mailboxes' => $mailboxes, 'PWG_TOKEN' => get_pwg_token()));
// list of albums
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
;';
display_select_cat_wrapper($query, isset($category_options_selected) ? $category_options_selected : array(), 'category_options');
// groups
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
;';
$group_ids = query2array($query, null, 'id');
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
开发者ID:plegall,项目名称:Piwigo-photo_from_email,代码行数:31,代码来源:admin_config.php

示例7: join

    $user_ids[] = $row['id'];
}
$template->assign(array('users' => $users, 'all_users' => join(',', $user_ids), 'ACTIVATE_COMMENTS' => $conf['activate_comments'], 'Double_Password' => $conf['double_password_type_in_admin']));
$default_user = get_default_user_info(true);
$protected_users = array($user['id'], $conf['guest_id'], $conf['default_user_id'], $conf['webmaster_id']);
// an admin can't delete other admin/webmaster
if ('admin' == $user['status']) {
    $query = '
SELECT
    user_id
  FROM ' . USER_INFOS_TABLE . '
  WHERE status IN (\'webmaster\', \'admin\')
;';
    $protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
}
$template->assign(array('PWG_TOKEN' => get_pwg_token(), 'NB_IMAGE_PAGE' => $default_user['nb_image_page'], 'RECENT_PERIOD' => $default_user['recent_period'], 'theme_options' => get_pwg_themes(), 'theme_selected' => get_default_theme(), 'language_options' => get_languages(), 'language_selected' => get_default_language(), 'association_options' => $groups, 'protected_users' => implode(',', array_unique($protected_users)), 'guest_user' => $conf['guest_id']));
// Status options
foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) {
    $label_of_status[$status] = l10n('user_status_' . $status);
}
$pref_status_options = $label_of_status;
// a simple "admin" can set/remove statuses webmaster/admin
if ('admin' == $user['status']) {
    unset($pref_status_options['webmaster']);
    unset($pref_status_options['admin']);
}
$template->assign('label_of_status', $label_of_status);
$template->assign('pref_status_options', $pref_status_options);
$template->assign('pref_status_selected', 'normal');
// user level options
foreach ($conf['available_permission_levels'] as $level) {
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:user_list.php

示例8: ws_permissions_remove

/**
 * API method
 * Removes permissions
 * @param mixed[] $params
 *    @option int[] cat_id
 *    @option int[] group_id (optional)
 *    @option int[] user_id (optional)
 */
function ws_permissions_remove($params, &$service)
{
    if (get_pwg_token() != $params['pwg_token']) {
        return new PwgError(403, 'Invalid security token');
    }
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    $cat_ids = get_subcat_ids($params['cat_id']);
    if (!empty($params['group_id'])) {
        $query = '
DELETE
  FROM ' . GROUP_ACCESS_TABLE . '
  WHERE group_id IN (' . implode(',', $params['group_id']) . ')
    AND cat_id IN (' . implode(',', $cat_ids) . ')
;';
        pwg_query($query);
    }
    if (!empty($params['user_id'])) {
        $query = '
DELETE
  FROM ' . USER_ACCESS_TABLE . '
  WHERE user_id IN (' . implode(',', $params['user_id']) . ')
    AND cat_id IN (' . implode(',', $cat_ids) . ')
;';
        pwg_query($query);
    }
    return $service->invoke('pwg.permissions.getList', array('cat_id' => $params['cat_id']));
}
开发者ID:squidjam,项目名称:Piwigo,代码行数:35,代码来源:pwg.permissions.php

示例9: hash_from_query

  ON c.id=i.storage_category_id 
  WHERE c.site_id IS NOT NULL
  GROUP BY c.site_id
;';
$sites_detail = hash_from_query($query, 'site_id');
$query = '
SELECT *
  FROM ' . SITES_TABLE . '
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    $is_remote = url_is_remote($row['galleries_url']);
    $base_url = PHPWG_ROOT_PATH . 'admin.php';
    $base_url .= '?page=site_manager';
    $base_url .= '&amp;site=' . $row['id'];
    $base_url .= '&amp;pwg_token=' . get_pwg_token();
    $base_url .= '&amp;action=';
    $update_url = PHPWG_ROOT_PATH . 'admin.php';
    $update_url .= '?page=site_update';
    $update_url .= '&amp;site=' . $row['id'];
    $tpl_var = array('NAME' => $row['galleries_url'], 'TYPE' => l10n($is_remote ? 'Remote' : 'Local'), 'CATEGORIES' => (int) @$sites_detail[$row['id']]['nb_categories'], 'IMAGES' => (int) @$sites_detail[$row['id']]['nb_images'], 'U_SYNCHRONIZE' => $update_url);
    if ($row['id'] != 1) {
        $tpl_var['U_DELETE'] = $base_url . 'delete';
    }
    $plugin_links = array();
    //$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
    $plugin_links = trigger_change('get_admins_site_links', $plugin_links, $row['id'], $is_remote);
    $tpl_var['plugin_links'] = $plugin_links;
    $template->append('sites', $tpl_var);
}
$template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager');
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:site_manager.php

示例10: list

        $query = '
SELECT
    name
  FROM ' . GROUPS_TABLE . '
  WHERE id = ' . $_POST['group'] . '
;';
        list($group_name) = pwg_db_fetch_row(pwg_query($query));
        $page['infos'][] = l10n('An information email was sent to group "%s"', $group_name);
    }
    unset_make_full_url();
}
// +-----------------------------------------------------------------------+
// |                       template initialization                         |
// +-----------------------------------------------------------------------+
$template->set_filename('album_notification', 'album_notification.tpl');
$template->assign(array('CATEGORIES_NAV' => get_cat_display_name_from_id($page['cat'], 'admin.php?page=album-'), 'F_ACTION' => $admin_album_base_url . '-notification', 'PWG_TOKEN' => get_pwg_token()));
// +-----------------------------------------------------------------------+
// |                          form construction                            |
// +-----------------------------------------------------------------------+
$query = '
SELECT
    id AS group_id
  FROM ' . GROUPS_TABLE . '
;';
$all_group_ids = array_from_query($query, 'group_id');
if (count($all_group_ids) == 0) {
    $template->assign('no_group_in_gallery', true);
} else {
    if ('private' == $category['status']) {
        $query = '
SELECT
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:album_notification.php

示例11: l10n

                $page['infos'][] = l10n('locfiledit_saved_bak', substr(get_bak_file($edited_file), 2));
            }
            if ($file = @fopen($edited_file, "w")) {
                @fwrite($file, $content_file);
                @fclose($file);
                array_unshift($page['infos'], l10n('locfiledit_save_config'));
                $template->delete_compiled_templates();
            } else {
                $page['errors'][] = l10n('locfiledit_cant_save');
            }
        }
    }
}
// +-----------------------------------------------------------------------+
// |                            template initialization
// +-----------------------------------------------------------------------+
$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl'));
if (!empty($edited_file)) {
    if (!empty($page['errors'])) {
        $content_file = stripslashes($_POST['text']);
    }
    $template->assign('zone_edit', array('EDITED_FILE' => $edited_file, 'CONTENT_FILE' => htmlspecialchars($content_file), 'FILE_NAME' => trim($edited_file, './\\')));
    if (file_exists(get_bak_file($edited_file))) {
        $template->assign('restore', true);
    }
    if (file_exists($edited_file)) {
        $template->assign('restore_infos', true);
    }
}
$template->assign(array('F_ACTION' => PHPWG_ROOT_PATH . 'admin.php?page=plugin-LocalFilesEditor-' . $page['tab'], 'LOCALEDIT_PATH' => LOCALEDIT_PATH, 'PWG_TOKEN' => get_pwg_token(), 'CODEMIRROR_MODE' => @$codemirror_mode));
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:31,代码来源:admin.php

示例12: pwg_set_session_var

$template->set_filenames(array('plugins' => 'plugins_installed.tpl'));
// should we display details on plugins?
if (isset($_GET['show_details'])) {
    if (1 == $_GET['show_details']) {
        $show_details = true;
    } else {
        $show_details = false;
    }
    pwg_set_session_var('plugins_show_details', $show_details);
} elseif (null != pwg_get_session_var('plugins_show_details')) {
    $show_details = pwg_get_session_var('plugins_show_details');
} else {
    $show_details = false;
}
$base_url = get_root_url() . 'admin.php?page=' . $page['page'];
$pwg_token = get_pwg_token();
$action_url = $base_url . '&amp;plugin=' . '%s' . '&amp;pwg_token=' . $pwg_token;
$plugins = new plugins();
//--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['plugin'])) {
    if (!is_webmaster()) {
        $page['errors'][] = l10n('Webmaster status is required.');
    } else {
        check_pwg_token();
        $page['errors'] = $plugins->perform_action($_GET['action'], $_GET['plugin']);
        if (empty($page['errors'])) {
            if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate') {
                $template->delete_compiled_templates();
                $persistent_cache->purge(true);
            }
            redirect($base_url);
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:plugins_installed.php

示例13: ws_users_setInfo

/**
 * API method
 * Updates users
 * @param mixed[] $params
 *    @option int[] user_id
 *    @option string username (optional)
 *    @option string password (optional)
 *    @option string email (optional)
 *    @option string status (optional)
 *    @option int level (optional)
 *    @option string language (optional)
 *    @option string theme (optional)
 *    @option int nb_image_page (optional)
 *    @option int recent_period (optional)
 *    @option bool expand (optional)
 *    @option bool show_nb_comments (optional)
 *    @option bool show_nb_hits (optional)
 *    @option bool enabled_high (optional)
 */
function ws_users_setInfo($params, &$service)
{
    if (get_pwg_token() != $params['pwg_token']) {
        return new PwgError(403, 'Invalid security token');
    }
    global $conf, $user;
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    $updates = $updates_infos = array();
    $update_status = null;
    if (count($params['user_id']) == 1) {
        if (get_username($params['user_id'][0]) === false) {
            return new PwgError(WS_ERR_INVALID_PARAM, 'This user does not exist.');
        }
        if (!empty($params['username'])) {
            $user_id = get_userid($params['username']);
            if ($user_id and $user_id != $params['user_id'][0]) {
                return new PwgError(WS_ERR_INVALID_PARAM, l10n('this login is already used'));
            }
            if ($params['username'] != strip_tags($params['username'])) {
                return new PwgError(WS_ERR_INVALID_PARAM, l10n('html tags are not allowed in login'));
            }
            $updates[$conf['user_fields']['username']] = $params['username'];
        }
        if (!empty($params['email'])) {
            if (($error = validate_mail_address($params['user_id'][0], $params['email'])) != '') {
                return new PwgError(WS_ERR_INVALID_PARAM, $error);
            }
            $updates[$conf['user_fields']['email']] = $params['email'];
        }
        if (!empty($params['password'])) {
            $updates[$conf['user_fields']['password']] = $conf['password_hash']($params['password']);
        }
    }
    if (!empty($params['status'])) {
        if (in_array($params['status'], array('webmaster', 'admin')) and !is_webmaster()) {
            return new PwgError(403, 'Only webmasters can grant "webmaster/admin" status');
        }
        if (!in_array($params['status'], array('guest', 'generic', 'normal', 'admin', 'webmaster'))) {
            return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid status');
        }
        $protected_users = array($user['id'], $conf['guest_id'], $conf['webmaster_id']);
        // an admin can't change status of other admin/webmaster
        if ('admin' == $user['status']) {
            $query = '
SELECT
    user_id
  FROM ' . USER_INFOS_TABLE . '
  WHERE status IN (\'webmaster\', \'admin\')
;';
            $protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
        }
        // status update query is separated from the rest as not applying to the same
        // set of users (current, guest and webmaster can't be changed)
        $params['user_id_for_status'] = array_diff($params['user_id'], $protected_users);
        $update_status = $params['status'];
    }
    if (!empty($params['level']) or @$params['level'] === 0) {
        if (!in_array($params['level'], $conf['available_permission_levels'])) {
            return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid level');
        }
        $updates_infos['level'] = $params['level'];
    }
    if (!empty($params['language'])) {
        if (!in_array($params['language'], array_keys(get_languages()))) {
            return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid language');
        }
        $updates_infos['language'] = $params['language'];
    }
    if (!empty($params['theme'])) {
        if (!in_array($params['theme'], array_keys(get_pwg_themes()))) {
            return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid theme');
        }
        $updates_infos['theme'] = $params['theme'];
    }
    if (!empty($params['nb_image_page'])) {
        $updates_infos['nb_image_page'] = $params['nb_image_page'];
    }
    if (!empty($params['recent_period']) or @$params['recent_period'] === 0) {
        $updates_infos['recent_period'] = $params['recent_period'];
    }
    if (!empty($params['expand']) or @$params['expand'] === false) {
//.........这里部分代码省略.........
开发者ID:donseba,项目名称:Piwigo,代码行数:101,代码来源:pwg.users.php

示例14: switch

if (isset($_GET['installstatus'])) {
    switch ($_GET['installstatus']) {
        case 'ok':
            $page['infos'][] = l10n('Language has been successfully installed');
            break;
        case 'temp_path_error':
            $page['errors'][] = l10n('Can\'t create temporary file.');
            break;
        case 'dl_archive_error':
            $page['errors'][] = l10n('Can\'t download archive.');
            break;
        case 'archive_error':
            $page['errors'][] = l10n('Can\'t read or extract archive.');
            break;
        default:
            $page['errors'][] = l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']));
    }
}
// +-----------------------------------------------------------------------+
// |                     start template output                             |
// +-----------------------------------------------------------------------+
if ($languages->get_server_languages(true)) {
    foreach ($languages->server_languages as $language) {
        list($date, ) = explode(' ', $language['revision_date']);
        $url_auto_install = htmlentities($base_url) . '&amp;revision=' . $language['revision_id'] . '&amp;pwg_token=' . get_pwg_token();
        $template->append('languages', array('EXT_NAME' => $language['extension_name'], 'EXT_DESC' => $language['extension_description'], 'EXT_URL' => PEM_URL . '/extension_view.php?eid=' . $language['extension_id'], 'VERSION' => $language['revision_name'], 'VER_DESC' => $language['revision_description'], 'DATE' => $date, 'AUTHOR' => $language['author_name'], 'URL_INSTALL' => $url_auto_install, 'URL_DOWNLOAD' => $language['download_url'] . '&amp;origin=piwigo_download'));
    }
} else {
    $page['errors'][] = l10n('Can\'t connect to server.');
}
$template->assign_var_from_handle('ADMIN_CONTENT', 'languages');
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:languages_new.php

示例15: ws_groups_deleteUser

/**
 * API method
 * Removes user(s) from a group
 * @param mixed[] $params
 *    @option int group_id
 *    @option int[] user_id
 */
function ws_groups_deleteUser($params, &$service)
{
    if (get_pwg_token() != $params['pwg_token']) {
        return new PwgError(403, 'Invalid security token');
    }
    // does the group exist ?
    $query = '
SELECT COUNT(*)
  FROM ' . GROUPS_TABLE . '
  WHERE id = ' . $params['group_id'] . '
;';
    list($count) = pwg_db_fetch_row(pwg_query($query));
    if ($count == 0) {
        return new PwgError(WS_ERR_INVALID_PARAM, 'This group does not exist.');
    }
    $query = '
DELETE FROM ' . USER_GROUP_TABLE . '
  WHERE
    group_id = ' . $params['group_id'] . '
    AND user_id IN(' . implode(',', $params['user_id']) . ')
;';
    pwg_query($query);
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    invalidate_user_cache();
    return $service->invoke('pwg.groups.getList', array('group_id' => $params['group_id']));
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:33,代码来源:pwg.groups.php


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