本文整理汇总了PHP中get_pwg_token函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pwg_token函数的具体用法?PHP get_pwg_token怎么用?PHP get_pwg_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pwg_token函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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">·</span> ', $members), 'MEMBERS' => l10n_dec('%d member', '%d members', count($members)), 'U_DELETE' => $del_url . $row['id'] . '&pwg_token=' . get_pwg_token(), 'U_PERM' => $perm_url . $row['id'], 'U_ISDEFAULT' => $toggle_is_default_url . $row['id'] . '&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 .= '&site=' . $row['id'];
$base_url .= '&pwg_token=' . get_pwg_token();
$base_url .= '&action=';
$update_url = PHPWG_ROOT_PATH . 'admin.php';
$update_url .= '?page=site_update';
$update_url .= '&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 . '&plugin=' . '%s' . '&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) . '&revision=' . $language['revision_id'] . '&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'] . '&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
示例16: add_url_params
if (can_manage_comment('delete', $row['author_id'])) {
$tpl_comment['U_DELETE'] = add_url_params($url_self, array('action' => 'delete_comment', 'comment_to_delete' => $row['id'], 'pwg_token' => get_pwg_token()));
}
if (can_manage_comment('edit', $row['author_id'])) {
$tpl_comment['U_EDIT'] = add_url_params($url_self, array('action' => 'edit_comment', 'comment_to_edit' => $row['id']));
if (isset($edit_comment) and $row['id'] == $edit_comment) {
$tpl_comment['IN_EDIT'] = true;
$tpl_comment['KEY'] = get_ephemeral_key(2);
$tpl_comment['CONTENT'] = $row['content'];
$tpl_comment['PWG_TOKEN'] = get_pwg_token();
$tpl_comment['U_CANCEL'] = $url_self;
}
}
if (is_admin()) {
if ($row['validated'] != 'true') {
$tpl_comment['U_VALIDATE'] = add_url_params($url_self, array('action' => 'validate_comment', 'comment_to_validate' => $row['id'], 'pwg_token' => get_pwg_token()));
}
}
$template->append('comments', $tpl_comment);
}
}
$show_add_comment_form = !is_a_guest() || $conf['guestbook']['guest_can_add'];
if (isset($edit_comment)) {
$show_add_comment_form = false;
}
if ($show_add_comment_form) {
foreach (array('content', 'author', 'website', 'email') as $el) {
${$el} = '';
if ('reject' === @$comment_action and !empty($comm[$el])) {
${$el} = htmlspecialchars(stripslashes($comm[$el]));
}
开发者ID:plegall,项目名称:Piwigo-Guest-Book,代码行数:31,代码来源:guestbook.inc.php
示例17: pwg_db_fetch_assoc
WHERE id = ' . $_GET['image_id'] . '
;';
$row = pwg_db_fetch_assoc(pwg_query($query));
$storage_category_id = null;
if (!empty($row['storage_category_id'])) {
$storage_category_id = $row['storage_category_id'];
}
$image_file = $row['file'];
// +-----------------------------------------------------------------------+
// | template init |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('picture_modify' => 'picture_modify.tpl'));
$admin_url_start = $admin_photo_base_url . '-properties';
$admin_url_start .= isset($_GET['cat_id']) ? '&cat_id=' . $_GET['cat_id'] : '';
$src_image = new SrcImage($row);
$template->assign(array('tag_selection' => $tag_selection, 'U_SYNC' => $admin_url_start . '&sync_metadata=1', 'U_DELETE' => $admin_url_start . '&delete=1&pwg_token=' . get_pwg_token(), 'PATH' => $row['path'], 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image), 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 'NAME' => isset($_POST['name']) ? stripslashes($_POST['name']) : @$row['name'], 'TITLE' => render_element_name($row), 'DIMENSIONS' => @$row['width'] . ' * ' . @$row['height'], 'FILESIZE' => @$row['filesize'] . ' KB', 'REGISTRATION_DATE' => format_date($row['date_available']), 'AUTHOR' => htmlspecialchars(isset($_POST['author']) ? stripslashes($_POST['author']) : @$row['author']), 'DATE_CREATION' => $row['date_creation'], 'DESCRIPTION' => htmlspecialchars(isset($_POST['description']) ? stripslashes($_POST['description']) : @$row['comment']), 'F_ACTION' => get_root_url() . 'admin.php' . get_query_string_diff(array('sync_metadata'))));
$added_by = 'N/A';
$query = '
SELECT ' . $conf['user_fields']['username'] . ' AS username
FROM ' . USERS_TABLE . '
WHERE ' . $conf['user_fields']['id'] . ' = ' . $row['added_by'] . '
;';
$result = pwg_query($query);
while ($user_row = pwg_db_fetch_assoc($result)) {
$row['added_by'] = $user_row['username'];
}
$intro_vars = array('file' => l10n('Original file : %s', $row['file']), 'add_date' => l10n('Posted %s on %s', time_since($row['date_available'], 'year'), format_date($row['date_available'], array('day', 'month', 'year'))), 'added_by' => l10n('Added by %s', $row['added_by']), 'size' => $row['width'] . '×' . $row['height'] . ' pixels, ' . sprintf('%.2f', $row['filesize'] / 1024) . 'MB', 'stats' => l10n('Visited %d times', $row['hit']), 'id' => l10n('Numeric identifier : %d', $row['id']));
if ($conf['rate'] and !empty($row['rating_score'])) {
$query = '
SELECT
COUNT(*)
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:picture_modify.php
示例18: clear_derivative_cache
case 'compiled-templates':
$template->delete_compiled_templates();
FileCombiner::clear_combined_files();
$persistent_cache->purge(true);
break;
case 'derivatives':
clear_derivative_cache($_GET['type']);
break;
default:
break;
}
// +-----------------------------------------------------------------------+
// | template init |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('maintenance' => 'maintenance.tpl'));
$url_format = get_root_url() . 'admin.php?page=maintenance&action=%s&pwg_token=' . get_pwg_token();
$purge_urls[l10n('All')] = sprintf($url_format, 'derivatives') . '&type=all';
foreach (ImageStdParams::get_defined_type_map() as $params) {
$purge_urls[l10n($params->type)] = sprintf($url_format, 'derivatives') . '&type=' . $params->type;
}
$purge_urls[l10n(IMG_CUSTOM)] = sprintf($url_format, 'derivatives') . '&type=' . IMG_CUSTOM;
$template->assign(array('U_MAINT_CATEGORIES' => sprintf($url_format, 'categories'), 'U_MAINT_IMAGES' => sprintf($url_format, 'images'), 'U_MAINT_ORPHAN_TAGS' => sprintf($url_format, 'delete_orphan_tags'), 'U_MAINT_USER_CACHE' => sprintf($url_format, 'user_cache'), 'U_MAINT_HISTORY_DETAIL' => sprintf($url_format, 'history_detail'), 'U_MAINT_HISTORY_SUMMARY' => sprintf($url_format, 'history_summary'), 'U_MAINT_SESSIONS' => sprintf($url_format, 'sessions'), 'U_MAINT_FEEDS' => sprintf($url_format, 'feeds'), 'U_MAINT_DATABASE' => sprintf($url_format, 'database'), 'U_MAINT_C13Y' => sprintf($url_format, 'c13y'), 'U_MAINT_SEARCH' => sprintf($url_format, 'search'), 'U_MAINT_COMPILED_TEMPLATES' => sprintf($url_format, 'compiled-templates'), 'U_MAINT_DERIVATIVES' => sprintf($url_format, 'derivatives'), 'purge_derivatives' => $purge_urls, 'U_HELP' => get_root_url() . 'admin/popuphelp.php?page=maintenance'));
if ($conf['gallery_locked']) {
$template->assign(array('U_MAINT_UNLOCK_GALLERY' => sprintf($url_format, 'unlock_gallery')));
} else {
$template->assign(array('U_MAINT_LOCK_GALLERY' => sprintf($url_format, 'lock_gallery')));
}
// +-----------------------------------------------------------------------+
// | Define advanced features |
// +-----------------------------------------------------------------------+
$advanced_features = array();
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:maintenance.php
示例19: array
$page['infos'] = array();
$query = '
REPLACE INTO ' . PLUGINS_TABLE . '
(id, state)
VALUES (\'TakeATour\', \'active\')
;';
pwg_query($query);
$template->assign(array('button_label' => l10n('Home'), 'button_link' => 'index.php'));
// if the webmaster has a session, let's give a link to discover new features
if (!empty($_SESSION['pwg_uid'])) {
$version_ = str_replace('.', '_', get_branch_from_version(PHPWG_VERSION) . '.0');
if (file_exists(PHPWG_PLUGINS_PATH . 'TakeATour/tours/' . $version_ . '/config.inc.php')) {
load_language('plugin.lang', PHPWG_PLUGINS_PATH . 'TakeATour/', array('language' => $language, 'force_fallback' => 'en_UK'));
// we need the secret key for get_pwg_token()
load_conf_from_db();
$template->assign(array('button_label' => l10n('2_7_0_descrp'), 'button_link' => 'admin.php?submited_tour_path=tours/' . $version_ . '&pwg_token=' . get_pwg_token()));
}
}
// Delete cache data
invalidate_user_cache(true);
$template->delete_compiled_templates();
// Restore $page['infos'] in order to hide informations messages from functions calles
// errors messages are not hide
$page['infos'] = $page['infos_sav'];
}
} else {
if (!defined('PWG_CHARSET')) {
define('PWG_CHARSET', 'utf-8');
}
include_once PHPWG_ROOT_PATH . 'admin/include/languages.class.php';
$languages = new languages();
开发者ID:RioPwg,项目名称:Piwigo,代码行数:31,代码来源:upgrade.php
示例20: l10n
if (!$autoupdate->get_server_extensions()) {
$page['errors'][] = l10n('Can\'t connect to server.');
return;
// TODO: remove this return and add a proper "page killer"
}
foreach ($autoupdate->types as $type) {
$fs = 'fs_' . $type;
$server = 'server_' . $type;
$server_ext = $autoupdate->{$type}->{$server};
$fs_ext = $autoupdate->{$type}->{$fs};
if (empty($server_ext)) {
continue;
}
foreach ($fs_ext as $ext_id => $fs_ext) {
if (!isset($fs_ext['extension']) or !isset($server_ext[$fs_ext['extension']])) {
continue;
}
$ext_info = $server_ext[$fs_ext['extension']];
if (!safe_version_compare($fs_ext['version'], $ext_info['revision_name'], '>=')) {
$template->append('update_' . $type, array('ID' => $ext_info['extension_id'], 'REVISION_ID' => $ext_info['revision_id'], 'EXT_ID' => $ext_id, 'EXT_NAME' => $fs_ext['name'], 'EXT_URL' => PEM_URL . '/extension_view.php?eid=' . $ext_info['extension_id'], 'EXT_DESC' => trim($ext_info['extension_description'], " \n\r"), 'REV_DESC' => trim($ext_info['revision_description'], " \n\r"), 'CURRENT_VERSION' => $fs_ext['version'], 'NEW_VERSION' => $ext_info['revision_name'], 'AUTHOR' => $ext_info['author_name'], 'DOWNLOADS' => $ext_info['extension_nb_downloads'], 'URL_DOWNLOAD' => $ext_info['download_url'] . '&origin=piwigo_download', 'IGNORED' => in_array($ext_id, $conf['updates_ignored'][$type])));
}
}
if (!empty($conf['updates_ignored'][$type])) {
$show_reset = true;
}
}
$template->assign('SHOW_RESET', $show_reset);
$template->assign('PWG_TOKEN', get_pwg_token());
$template->assign('EXT_TYPE', $page['page'] == 'updates' ? 'extensions' : $page['page']);
$template->set_filename('plugin_admin_content', 'updates_ext.tpl');
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:updates_ext.php
注:本文中的get_pwg_token函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论