Compare commits
148 commits
Author | SHA1 | Date | |
---|---|---|---|
|
469e6ad8e6 | ||
|
b43b1d22b7 | ||
|
5799abb9ee | ||
|
4411169d1a | ||
|
9598532f67 | ||
|
e9b9046d8b | ||
|
59129beb22 | ||
|
7550df3915 | ||
|
f645fc1419 | ||
|
a2e98299d7 | ||
|
4469cbdfde | ||
|
d7d454ad9f | ||
|
b4793e959e | ||
|
be13718838 | ||
|
3e8dd7da9b | ||
|
be7bb150c2 | ||
|
9a18da34fd | ||
|
dc40995cad | ||
|
0499c2ccc5 | ||
|
6fabb4f449 | ||
|
ecb61ba267 | ||
|
8908a2d01d | ||
|
2492a87f5f | ||
|
4745f49130 | ||
|
732c696582 | ||
|
4fca6fa234 | ||
|
619bdc957b | ||
|
097a91db39 | ||
|
59262acebd | ||
|
428763fda6 | ||
|
eca2a6dd94 | ||
|
be31d7b2de | ||
|
226c61c6f9 | ||
|
9a4ee7574f | ||
|
f95f48a226 | ||
|
cd30335df7 | ||
|
e74943520a | ||
|
3909b99f1e | ||
|
4c92087d6b | ||
|
8164f0c66e | ||
|
fba40ee64c | ||
|
c7aea2a7da | ||
|
2f6b60e063 | ||
|
b593bc2f79 | ||
|
238b1e4412 | ||
|
234a64607b | ||
|
8f354f008e | ||
|
352060bbe9 | ||
|
81a509d5bf | ||
|
ea3769d283 | ||
|
e31b4e49d6 | ||
|
e3a7b726d2 | ||
|
7bb12f4f48 | ||
|
49b663ecec | ||
|
a874845d40 | ||
|
fdf915a2c1 | ||
|
e4479c9233 | ||
|
69b27bdc31 | ||
|
5a07213fba | ||
|
8104cb71cf | ||
|
aeacb3f5e9 | ||
|
972b8a1a9b | ||
|
99c692d369 | ||
|
1117ff9ed2 | ||
|
58b1c34aa1 | ||
|
6f66e183a0 | ||
|
d453f9a7d4 | ||
|
fabfd5eb6e | ||
|
7cc4ab6fba | ||
|
56a533f3cb | ||
|
eab34bed9c | ||
|
034e914870 | ||
|
a2e3963cb0 | ||
|
0fea350295 | ||
|
26d336bd3b | ||
|
33b7f46dd3 | ||
|
a15cc194b9 | ||
|
d446a221cd | ||
|
530e3e6974 | ||
|
58977351dd | ||
|
7948d1871d | ||
|
f1f4e4386c | ||
|
7a267ee7f0 | ||
|
94cd8b4fbb | ||
|
fc19598a8e | ||
|
bb07324f76 | ||
|
b34b7c6b28 | ||
|
0a8cfa318a | ||
|
160fdcf517 | ||
|
fad95e6522 | ||
|
61f2646d4e | ||
|
9d91210e41 | ||
|
5e5dc77f9e | ||
|
cd9e784e75 | ||
|
d958a19ed5 | ||
|
e78758a25c | ||
|
027d0c8846 | ||
|
2221b4e4e6 | ||
|
b21a954e29 | ||
|
c83520ffe1 | ||
|
6fb6cf516f | ||
|
e7130ac18c | ||
|
28a8e83485 | ||
|
c281046fca | ||
|
3d6fc7d9ea | ||
|
30532b2186 | ||
|
134c91774f | ||
|
94a89e8f10 | ||
|
97703aa9de | ||
|
58dc3aa595 | ||
|
106c39d7bd | ||
|
fcb3c824a0 | ||
|
d949a38624 | ||
|
805205c8a5 | ||
|
f45c97f663 | ||
|
e0bd45f7e3 | ||
|
9c856a2fd0 | ||
|
35858a70a0 | ||
|
b0e92b7df1 | ||
|
13a7e043ac | ||
|
2f9084b5e9 | ||
|
1e8220d083 | ||
|
f413decdd7 | ||
|
ae6cd8f928 | ||
|
db02ed0b14 | ||
|
933749789c | ||
|
8192a92ff4 | ||
|
a44bf33a85 | ||
|
53522d5411 | ||
|
5b0d26b779 | ||
|
bd73ae2b2d | ||
|
657b7e814e | ||
|
d029431644 | ||
|
85efba1370 | ||
|
d96768a05e | ||
|
06153552a8 | ||
|
bf22f7ec69 | ||
|
25ed7b89d3 | ||
|
8a97ff299e | ||
|
1d02741910 | ||
|
ee399d727d | ||
|
5f4f11299a | ||
|
bb5821e577 | ||
|
9c861fd51b | ||
|
33f7477dbe | ||
|
1e0b576e3b | ||
|
009e0e3029 | ||
|
a2eee141fd |
134 changed files with 3888 additions and 2619 deletions
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -38,7 +37,7 @@ check_status(ACCESS_GUEST);
|
|||
//
|
||||
// Start output of page
|
||||
//
|
||||
$title= $lang['about_page_title'];
|
||||
$title= l10n('about_page_title');
|
||||
$page['body_id'] = 'theAboutPage';
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
|
|
55
admin.php
55
admin.php
|
@ -43,12 +43,6 @@ check_status(ACCESS_ADMINISTRATOR);
|
|||
|
||||
sync_users();
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Check configuration and add notes on problem |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
check_conf();
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | variables init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -67,6 +61,13 @@ else
|
|||
$page['errors'] = array();
|
||||
$page['infos'] = array();
|
||||
|
||||
|
||||
if ($page['page'] == 'intro')
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_check_integrity.inc.php');
|
||||
check_integrity();
|
||||
}
|
||||
|
||||
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||
$conf_link = $link_start.'configuration&section=';
|
||||
//----------------------------------------------------- template initialization
|
||||
|
@ -115,15 +116,20 @@ if ($conf['ws_access_control']) // Do we need to display ws_checker
|
|||
}
|
||||
|
||||
// required before plugin page inclusion
|
||||
$plugin_menu_links = array(
|
||||
$plugin_menu_links = trigger_event('get_admin_plugin_menu_links', array() );
|
||||
|
||||
function UC_name_compare($a, $b)
|
||||
{
|
||||
return strcmp(strtolower($a['NAME']), strtolower($b['NAME']));
|
||||
}
|
||||
usort($plugin_menu_links, 'UC_name_compare');
|
||||
|
||||
array_unshift($plugin_menu_links,
|
||||
array(
|
||||
'NAME' => l10n('admin'),
|
||||
'URL' => $link_start.'plugins'
|
||||
)
|
||||
);
|
||||
$plugin_menu_links = trigger_event('get_admin_plugin_menu_links',
|
||||
$plugin_menu_links );
|
||||
|
||||
|
||||
include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
|
||||
|
||||
|
@ -154,15 +160,32 @@ if (count($page['infos']) != 0)
|
|||
}
|
||||
|
||||
$template->parse('admin');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | order permission refreshment |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// Only for pages witch change permissions
|
||||
if (
|
||||
in_array($page['page'],
|
||||
array(
|
||||
'site_manager', // delete site
|
||||
'site_update', // ?only POST
|
||||
'cat_list', // delete cat
|
||||
'cat_modify', // delete cat; public/private; lock/unlock
|
||||
'cat_move', // ?only POST
|
||||
'cat_options', // ?only POST; public/private; lock/unlock
|
||||
'cat_perm', // ?only POST
|
||||
'element_set', // ?only POST; associate/dissociate
|
||||
'user_list', // ?only POST; group assoc
|
||||
'user_perm',
|
||||
'group_perm',
|
||||
'group_list', // delete group
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
invalidate_user_cache();
|
||||
}
|
||||
|
||||
$query = '
|
||||
UPDATE '.USER_CACHE_TABLE.'
|
||||
SET need_update = \'true\'
|
||||
;';
|
||||
pwg_query($query);
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -60,7 +60,7 @@ function save_categories_order($categories)
|
|||
$fields = array('primary' => array('id'), 'update' => array('rank'));
|
||||
mass_updates(CATEGORIES_TABLE, $fields, $datas);
|
||||
|
||||
update_global_rank(@$_GET['parent_id']);
|
||||
update_global_rank();
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -71,7 +71,7 @@ $categories = array();
|
|||
|
||||
$base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_list';
|
||||
$navigation = '<a class="" href="'.$base_url.'">';
|
||||
$navigation.= $lang['home'];
|
||||
$navigation.= l10n('home');
|
||||
$navigation.= '</a>';
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -81,8 +81,7 @@ $navigation.= '</a>';
|
|||
if (isset($_GET['delete']) and is_numeric($_GET['delete']) and !is_adviser())
|
||||
{
|
||||
delete_categories(array($_GET['delete']));
|
||||
array_push($page['infos'], $lang['cat_virtual_deleted']);
|
||||
ordering();
|
||||
array_push($page['infos'], l10n('cat_virtual_deleted'));
|
||||
update_global_rank();
|
||||
}
|
||||
// request to add a virtual category
|
||||
|
@ -166,13 +165,13 @@ $template->assign_vars(array(
|
|||
'CATEGORIES_NAV'=>$navigation,
|
||||
'F_ACTION'=>$form_action,
|
||||
|
||||
'L_ADD_VIRTUAL'=>$lang['cat_add'],
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_STORAGE'=>$lang['storage'],
|
||||
'L_NB_IMG'=>$lang['pictures'],
|
||||
'L_MOVE_UP'=>$lang['up'],
|
||||
'L_EDIT'=>$lang['edit'],
|
||||
'L_DELETE'=>$lang['delete'],
|
||||
'L_ADD_VIRTUAL'=>l10n('cat_add'),
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
'L_STORAGE'=>l10n('storage'),
|
||||
'L_NB_IMG'=>l10n('pictures'),
|
||||
'L_MOVE_UP'=>l10n('up'),
|
||||
'L_EDIT'=>l10n('edit'),
|
||||
'L_DELETE'=>l10n('delete'),
|
||||
));
|
||||
|
||||
$tpl = array('cat_first','cat_last');
|
||||
|
@ -242,7 +241,12 @@ foreach ($categories as $category)
|
|||
$template->assign_block_vars(
|
||||
'categories.category',
|
||||
array(
|
||||
'NAME' => $category['name'],
|
||||
'NAME' =>
|
||||
trigger_event(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'admin_cat_list'
|
||||
),
|
||||
'ID' => $category['id'],
|
||||
'RANK' => $category['rank']*10,
|
||||
|
||||
|
@ -294,7 +298,7 @@ foreach ($categories as $category)
|
|||
}
|
||||
}
|
||||
// Add a link to Page bottom only if needed (10 or more categories)
|
||||
if ( isset($category['rank']) and $category['rank'] > 9 )
|
||||
if ( isset($category['rank']) and $category['rank'] > 9 )
|
||||
{
|
||||
$template->assign_block_vars('eop_link', array('ICON'=>'Displayed'));
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ WHERE ';
|
|||
}
|
||||
pwg_query($query);
|
||||
|
||||
array_push($page['infos'], $lang['editcat_confirm']);
|
||||
array_push($page['infos'], l10n('editcat_confirm'));
|
||||
}
|
||||
else if (isset($_POST['set_random_representant']))
|
||||
{
|
||||
|
@ -262,20 +262,20 @@ $template->assign_vars(
|
|||
'IMG_ORDER_DEFAULT' => empty($category['image_order']) ?
|
||||
'checked="checked"' : '',
|
||||
|
||||
'L_EDIT_NAME' => $lang['name'],
|
||||
'L_STORAGE' => $lang['storage'],
|
||||
'L_REMOTE_SITE' => $lang['remote_site'],
|
||||
'L_EDIT_COMMENT' => $lang['description'],
|
||||
'L_EDIT_STATUS' => $lang['conf_access'],
|
||||
'L_STATUS_PUBLIC' => $lang['public'],
|
||||
'L_STATUS_PRIVATE' => $lang['private'],
|
||||
'L_EDIT_LOCK' => $lang['lock'],
|
||||
'L_EDIT_UPLOADABLE' => $lang['editcat_uploadable'],
|
||||
'L_EDIT_COMMENTABLE' => $lang['comments'],
|
||||
'L_YES' => $lang['yes'],
|
||||
'L_NO' => $lang['no'],
|
||||
'L_SUBMIT' => $lang['submit'],
|
||||
'L_SET_RANDOM_REPRESENTANT'=>$lang['cat_representant'],
|
||||
'L_EDIT_NAME' => l10n('name'),
|
||||
'L_STORAGE' => l10n('storage'),
|
||||
'L_REMOTE_SITE' => l10n('remote_site'),
|
||||
'L_EDIT_COMMENT' => l10n('description'),
|
||||
'L_EDIT_STATUS' => l10n('conf_access'),
|
||||
'L_STATUS_PUBLIC' => l10n('public'),
|
||||
'L_STATUS_PRIVATE' => l10n('private'),
|
||||
'L_EDIT_LOCK' => l10n('lock'),
|
||||
'L_EDIT_UPLOADABLE' => l10n('editcat_uploadable'),
|
||||
'L_EDIT_COMMENTABLE' => l10n('comments'),
|
||||
'L_YES' => l10n('yes'),
|
||||
'L_NO' => l10n('no'),
|
||||
'L_SUBMIT' => l10n('submit'),
|
||||
'L_SET_RANDOM_REPRESENTANT'=>l10n('cat_representant'),
|
||||
|
||||
'U_JUMPTO' => make_index_url(
|
||||
array(
|
||||
|
@ -529,7 +529,7 @@ display_select_cat_wrapper(
|
|||
);
|
||||
|
||||
// info by email to an access granted group of category informations
|
||||
if (isset($_POST['submitEmail']))
|
||||
if (isset($_POST['submitEmail']) and !empty($_POST['group']))
|
||||
{
|
||||
set_make_full_url();
|
||||
|
||||
|
@ -640,7 +640,7 @@ SELECT
|
|||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'group_option',
|
||||
'group_mail.group_option',
|
||||
array(
|
||||
'VALUE' => $row['id'],
|
||||
'OPTION' => $row['name'],
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -155,8 +154,8 @@ $base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_options&section=';
|
|||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_RESET'=>$lang['reset'],
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
'L_RESET'=>l10n('reset'),
|
||||
|
||||
'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=cat_options',
|
||||
|
||||
|
@ -239,9 +238,9 @@ SELECT id,name,uppercats,global_rank
|
|||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SECTION' => $lang['cat_upload_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['forbidden'],
|
||||
'L_SECTION' => l10n('cat_upload_title'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('authorized'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('forbidden'),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@ -260,9 +259,9 @@ SELECT id,name,uppercats,global_rank
|
|||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SECTION' => $lang['cat_comments_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['forbidden'],
|
||||
'L_SECTION' => l10n('cat_comments_title'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('authorized'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('forbidden'),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@ -281,9 +280,9 @@ SELECT id,name,uppercats,global_rank
|
|||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SECTION' => $lang['cat_lock_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['unlocked'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['locked'],
|
||||
'L_SECTION' => l10n('cat_lock_title'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('unlocked'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('locked'),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@ -302,9 +301,9 @@ SELECT id,name,uppercats,global_rank
|
|||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SECTION' => $lang['cat_status_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['cat_public'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['cat_private'],
|
||||
'L_SECTION' => l10n('cat_status_title'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('cat_public'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('cat_private'),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -229,6 +228,7 @@ $groups = array();
|
|||
$query = '
|
||||
SELECT id, name
|
||||
FROM '.GROUPS_TABLE.'
|
||||
ORDER BY name ASC
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
@ -243,7 +243,7 @@ SELECT group_id
|
|||
WHERE cat_id = '.$page['cat'].'
|
||||
;';
|
||||
$group_granted_ids = array_from_query($query, 'group_id');
|
||||
|
||||
$group_granted_ids = order_by_name($group_granted_ids, $groups);
|
||||
// groups granted to access the category
|
||||
foreach ($group_granted_ids as $group_id)
|
||||
{
|
||||
|
@ -255,9 +255,10 @@ foreach ($group_granted_ids as $group_id)
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
$group_denied_ids = array_diff(array_keys($groups), $group_granted_ids);
|
||||
$group_denied_ids = order_by_name($group_denied_ids, $groups);
|
||||
// groups denied
|
||||
foreach (array_diff(array_keys($groups), $group_granted_ids) as $group_id)
|
||||
foreach ($group_denied_ids as $group_id)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'group_denied',
|
||||
|
@ -288,7 +289,7 @@ SELECT user_id
|
|||
WHERE cat_id = '.$page['cat'].'
|
||||
;';
|
||||
$user_granted_direct_ids = array_from_query($query, 'user_id');
|
||||
|
||||
$user_granted_direct_ids = order_by_name($user_granted_direct_ids, $users);
|
||||
foreach ($user_granted_direct_ids as $user_id)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
|
@ -332,7 +333,8 @@ SELECT user_id, group_id
|
|||
|
||||
$user_granted_indirect_ids = array_diff($user_granted_by_group_ids,
|
||||
$user_granted_direct_ids);
|
||||
|
||||
$user_granted_indirect_ids =
|
||||
order_by_name($user_granted_indirect_ids, $users);
|
||||
foreach ($user_granted_indirect_ids as $user_id)
|
||||
{
|
||||
$group = '';
|
||||
|
@ -359,7 +361,7 @@ SELECT user_id, group_id
|
|||
$user_denied_ids = array_diff(array_keys($users),
|
||||
$user_granted_indirect_ids,
|
||||
$user_granted_direct_ids);
|
||||
|
||||
$user_denied_ids = order_by_name($user_denied_ids, $users);
|
||||
foreach ($user_denied_ids as $user_id)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
|
@ -371,6 +373,19 @@ foreach ($user_denied_ids as $user_id)
|
|||
);
|
||||
}
|
||||
|
||||
// Warning: this function breaks original keys
|
||||
// This function should be move in the futur to ./include/functions_html.inc
|
||||
function order_by_name($element_ids,$name)
|
||||
{
|
||||
$ordered_element_ids = array();
|
||||
foreach ($element_ids as $k_id => $element_id)
|
||||
{
|
||||
$key = strtolower($name[$element_id]) .'-'. $name[$element_id] .'-'. $k_id;
|
||||
$ordered_element_ids[$key] = $element_id;
|
||||
}
|
||||
ksort($ordered_element_ids);
|
||||
return $ordered_element_ids;
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
|
|
|
@ -162,7 +162,7 @@ while ($row = mysql_fetch_assoc($result))
|
|||
'&image_id='.$row['image_id'],
|
||||
'ID' => $row['id'],
|
||||
'TN_SRC' => $thumb,
|
||||
'AUTHOR' => $row['author'],
|
||||
'AUTHOR' => trigger_event('render_comment_author', $row['author']),
|
||||
'DATE' => format_date($row['date'],'mysql_datetime',true),
|
||||
'CONTENT' => trigger_event('render_comment_content',$row['content'])
|
||||
)
|
||||
|
|
|
@ -80,7 +80,7 @@ if (isset($_POST['submit']) and !is_adviser())
|
|||
{
|
||||
if ( !url_is_remote($_POST['gallery_url']) )
|
||||
{
|
||||
array_push($page['errors'], $lang['conf_gallery_url_error']);
|
||||
array_push($page['errors'], l10n('conf_gallery_url_error'));
|
||||
}
|
||||
foreach( $main_checkboxes as $checkbox)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ if (isset($_POST['submit']) and !is_adviser())
|
|||
or $_POST['nb_comment_page'] < 5
|
||||
or $_POST['nb_comment_page'] > 50)
|
||||
{
|
||||
array_push($page['errors'], $lang['conf_nb_comment_page_error']);
|
||||
array_push($page['errors'], l10n('conf_nb_comment_page_error'));
|
||||
}
|
||||
foreach( $comments_checkboxes as $checkbox)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ WHERE param = \''.$row['param'].'\'
|
|||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
array_push($page['infos'], $lang['conf_confirmation']);
|
||||
array_push($page['infos'], l10n('conf_confirmation'));
|
||||
}
|
||||
|
||||
//------------------------------------------------------ $conf reinitialization
|
||||
|
@ -191,10 +191,10 @@ $action.= '&section='.$page['section'];
|
|||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_YES'=>$lang['yes'],
|
||||
'L_NO'=>$lang['no'],
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_RESET'=>$lang['reset'],
|
||||
'L_YES'=>l10n('yes'),
|
||||
'L_NO'=>l10n('no'),
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
'L_RESET'=>l10n('reset'),
|
||||
|
||||
'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=configuration',
|
||||
|
||||
|
@ -217,8 +217,8 @@ switch ($page['section'])
|
|||
array(
|
||||
'GALLERY_LOCKED_YES'=>$lock_yes,
|
||||
'GALLERY_LOCKED_NO'=>$lock_no,
|
||||
'CONF_GALLERY_TITLE' => $conf['gallery_title'],
|
||||
'CONF_PAGE_BANNER' => $conf['page_banner'],
|
||||
'CONF_GALLERY_TITLE' => htmlspecialchars($conf['gallery_title']),
|
||||
'CONF_PAGE_BANNER' => htmlspecialchars($conf['page_banner']),
|
||||
'CONF_GALLERY_URL' => $conf['gallery_url'],
|
||||
));
|
||||
|
||||
|
@ -280,7 +280,7 @@ switch ($page['section'])
|
|||
{
|
||||
// Reload user
|
||||
$edit_user = build_user($conf['default_user_id'], false);
|
||||
array_push($page['infos'], $lang['conf_confirmation']);
|
||||
array_push($page['infos'], l10n('conf_confirmation'));
|
||||
}
|
||||
}
|
||||
$page['errors'] = array_merge($page['errors'], $errors);
|
||||
|
|
|
@ -124,7 +124,7 @@ SELECT image_id
|
|||
}
|
||||
else if ('caddie' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = $lang['caddie'];
|
||||
$page['title'] = l10n('caddie');
|
||||
|
||||
$query = '
|
||||
SELECT element_id
|
||||
|
|
|
@ -114,6 +114,8 @@ SELECT id
|
|||
;';
|
||||
$dissociables = array_from_query($query, 'id');
|
||||
|
||||
if (!empty($dissociables))
|
||||
{
|
||||
$query = '
|
||||
DELETE
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
|
@ -121,6 +123,7 @@ DELETE
|
|||
AND image_id IN ('.implode(',', $dissociables).')
|
||||
';
|
||||
pwg_query($query);
|
||||
}
|
||||
|
||||
update_category($_POST['dissociate']);
|
||||
}
|
||||
|
@ -202,7 +205,7 @@ $template->assign_vars(
|
|||
array(
|
||||
'CATEGORIES_NAV'=>$page['title'],
|
||||
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
|
||||
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ $template->assign_vars(
|
|||
array(
|
||||
'CATEGORIES_NAV'=>$page['title'],
|
||||
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
|
||||
'U_ELEMENTS_PAGE'
|
||||
=>$base_url.get_query_string_diff(array('display','start')),
|
||||
|
|
|
@ -87,7 +87,7 @@ if (isset($_POST['submit_add']) and !is_adviser())
|
|||
{
|
||||
if (empty($_POST['groupname']))
|
||||
{
|
||||
array_push($page['errors'], $lang['group_add_error1']);
|
||||
array_push($page['errors'], l10n('group_add_error1'));
|
||||
}
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ SELECT COUNT(*)
|
|||
list($count) = mysql_fetch_row(pwg_query($query));
|
||||
if ($count != 0)
|
||||
{
|
||||
array_push($page['errors'], $lang['group_add_error2']);
|
||||
array_push($page['errors'], l10n('group_add_error2'));
|
||||
}
|
||||
}
|
||||
if (count($page['errors']) == 0)
|
||||
|
@ -168,7 +168,7 @@ $template->assign_vars(
|
|||
$query = '
|
||||
SELECT id, name, is_default
|
||||
FROM '.GROUPS_TABLE.'
|
||||
ORDER BY id ASC
|
||||
ORDER BY name ASC
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
|
|
@ -141,9 +141,9 @@ $template->assign_vars(
|
|||
get_groupname($page['group']
|
||||
)
|
||||
),
|
||||
'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
|
||||
'L_CAT_OPTIONS_INFO'=>$lang['permuser_info'],
|
||||
'L_CAT_OPTIONS_TRUE'=>l10n('authorized'),
|
||||
'L_CAT_OPTIONS_FALSE'=>l10n('forbidden'),
|
||||
'L_CAT_OPTIONS_INFO'=>l10n('permuser_info'),
|
||||
|
||||
'F_ACTION' =>
|
||||
PHPWG_ROOT_PATH.
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
* Display filtered history lines
|
||||
*/
|
||||
|
||||
// echo '<pre>$_POST:
|
||||
// '; print_r($_POST); echo '</pre>';
|
||||
// echo '<pre>$_GET:
|
||||
// '; print_r($_GET); echo '</pre>';
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | functions |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -96,7 +91,14 @@ if (isset($_POST['submit']))
|
|||
);
|
||||
}
|
||||
|
||||
$search['fields']['types'] = $_POST['types'];
|
||||
if (empty($_POST['types']))
|
||||
{
|
||||
$search['fields']['types'] = $types;
|
||||
}
|
||||
else
|
||||
{
|
||||
$search['fields']['types'] = $_POST['types'];
|
||||
}
|
||||
|
||||
$search['fields']['user'] = $_POST['user'];
|
||||
|
||||
|
@ -139,7 +141,7 @@ INSERT INTO '.SEARCH_TABLE.'
|
|||
}
|
||||
else
|
||||
{
|
||||
array_push($page['errors'], $lang['search_one_clause_at_least']);
|
||||
array_push($page['errors'], l10n('search_one_clause_at_least'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +197,7 @@ SELECT rules
|
|||
}
|
||||
|
||||
$page['search']['fields']['user'] = $_GET['user_id'];
|
||||
|
||||
|
||||
$query ='
|
||||
INSERT INTO '.SEARCH_TABLE.'
|
||||
(rules)
|
||||
|
@ -211,137 +213,19 @@ INSERT INTO '.SEARCH_TABLE.'
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
if (isset($page['search']['fields']['filename']))
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE file LIKE \''.$page['search']['fields']['filename'].'\'
|
||||
;';
|
||||
$page['search']['image_ids'] = array_from_query($query, 'id');
|
||||
}
|
||||
|
||||
// echo '<pre>'; print_r($page['search']); echo '</pre>';
|
||||
|
||||
$clauses = array();
|
||||
$data = trigger_event('get_history', array(), $page['search'], $types);
|
||||
usort($data, 'history_compare');
|
||||
|
||||
if (isset($page['search']['fields']['date-after']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
"date >= '".$page['search']['fields']['date-after']."'"
|
||||
);
|
||||
}
|
||||
$page['nb_lines'] = count($data);
|
||||
|
||||
if (isset($page['search']['fields']['date-before']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
"date <= '".$page['search']['fields']['date-before']."'"
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($page['search']['fields']['types']))
|
||||
{
|
||||
$local_clauses = array();
|
||||
|
||||
foreach ($types as $type) {
|
||||
if (in_array($type, $page['search']['fields']['types'])) {
|
||||
$clause = 'image_type ';
|
||||
if ($type == 'none')
|
||||
{
|
||||
$clause.= 'IS NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$clause.= "= '".$type."'";
|
||||
}
|
||||
|
||||
array_push($local_clauses, $clause);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($local_clauses) > 0)
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
implode(' OR ', $local_clauses)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($page['search']['fields']['user'])
|
||||
and $page['search']['fields']['user'] != -1)
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'user_id = '.$page['search']['fields']['user']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($page['search']['fields']['image_id']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'image_id = '.$page['search']['fields']['image_id']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($page['search']['fields']['filename']))
|
||||
{
|
||||
if (count($page['search']['image_ids']) == 0)
|
||||
{
|
||||
// a clause that is always false
|
||||
array_push($clauses, '1 = 2 ');
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'image_id IN ('.implode(', ', $page['search']['image_ids']).')'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$clauses = prepend_append_array_items($clauses, '(', ')');
|
||||
|
||||
$where_separator =
|
||||
implode(
|
||||
"\n AND ",
|
||||
$clauses
|
||||
);
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
date,
|
||||
time,
|
||||
user_id,
|
||||
IP,
|
||||
section,
|
||||
category_id,
|
||||
tag_ids,
|
||||
image_id,
|
||||
image_type
|
||||
FROM '.HISTORY_TABLE.'
|
||||
WHERE '.$where_separator.'
|
||||
;';
|
||||
|
||||
// LIMIT '.$page['start'].', '.$conf['nb_logs_page'].'
|
||||
|
||||
$result = pwg_query($query);
|
||||
|
||||
$page['nb_lines'] = mysql_num_rows($result);
|
||||
|
||||
$history_lines = array();
|
||||
$user_ids = array();
|
||||
$username_of = array();
|
||||
$category_ids = array();
|
||||
$image_ids = array();
|
||||
$tag_ids = array();
|
||||
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
|
||||
foreach ($data as $row)
|
||||
{
|
||||
$user_ids[$row['user_id']] = 1;
|
||||
|
||||
|
@ -557,6 +441,7 @@ SELECT
|
|||
if (isset($label_of_image[$line['image_id']]))
|
||||
{
|
||||
$image_string.= ' '.$label_of_image[$line['image_id']];
|
||||
$image_string.= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -62,8 +62,6 @@ DELETE FROM '.SITES_TABLE.'
|
|||
// The function works recursively.
|
||||
function delete_categories($ids)
|
||||
{
|
||||
global $counts;
|
||||
|
||||
if (count($ids) == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -124,10 +122,6 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
|
|||
WHERE cat_id IN ('.implode(',',$ids).')';
|
||||
pwg_query($query);
|
||||
|
||||
if (isset($counts['del_categories']))
|
||||
{
|
||||
$counts['del_categories']+= count($ids);
|
||||
}
|
||||
trigger_action('delete_categories', $ids);
|
||||
}
|
||||
|
||||
|
@ -138,8 +132,6 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
|
|||
// - all the favorites associated to elements
|
||||
function delete_elements($ids)
|
||||
{
|
||||
global $counts;
|
||||
|
||||
if (count($ids) == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -201,10 +193,6 @@ DELETE FROM '.IMAGES_TABLE.'
|
|||
;';
|
||||
pwg_query($query);
|
||||
|
||||
if (isset($counts['del_elements']))
|
||||
{
|
||||
$counts['del_elements']+= count($ids);
|
||||
}
|
||||
trigger_action('delete_elements', $ids);
|
||||
}
|
||||
|
||||
|
@ -578,9 +566,7 @@ function mass_updates($tablename, $dbfields, $datas)
|
|||
{
|
||||
// depending on the MySQL version, we use the multi table update or N
|
||||
// update queries
|
||||
$query = 'SELECT VERSION() AS version;';
|
||||
list($mysql_version) = mysql_fetch_array(pwg_query($query));
|
||||
if (count($datas) < 10 or version_compare($mysql_version, '4.0.4') < 0)
|
||||
if (count($datas) < 10 or version_compare(mysql_get_server_info(), '4.0.4') < 0)
|
||||
{
|
||||
// MySQL is prior to version 4.0.4, multi table update feature is not
|
||||
// available
|
||||
|
@ -697,69 +683,72 @@ function mass_updates($tablename, $dbfields, $datas)
|
|||
}
|
||||
|
||||
/**
|
||||
* updates the global_rank of categories under the given id_uppercat
|
||||
*
|
||||
* @param int id_uppercat
|
||||
* order categories (update categories.rank and global_rank database fields)
|
||||
* so that rank field are consecutive integers starting at 1 for each child
|
||||
* @return void
|
||||
*/
|
||||
function update_global_rank($id_uppercat = 'all')
|
||||
function update_global_rank()
|
||||
{
|
||||
$query = '
|
||||
SELECT id,rank
|
||||
SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat, uppercats, rank, global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
ORDER BY id_uppercat,rank,name
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
$ranks_array = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$ranks_array[$row['id']] = $row['rank'];
|
||||
}
|
||||
|
||||
// which categories to update ?
|
||||
$uppercats_array = array();
|
||||
$cat_map = array();
|
||||
|
||||
$current_rank = 0;
|
||||
$current_uppercat = '';
|
||||
|
||||
$query = '
|
||||
SELECT id,uppercats
|
||||
FROM '.CATEGORIES_TABLE;
|
||||
if (is_numeric($id_uppercat))
|
||||
{
|
||||
$query.= '
|
||||
WHERE uppercats REGEXP \'(^|,)'.$id_uppercat.'(,|$)\'
|
||||
AND id != '.$id_uppercat.'
|
||||
';
|
||||
}
|
||||
$query.= '
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$uppercats_array[$row['id']] = $row['uppercats'];
|
||||
if ($row['id_uppercat'] != $current_uppercat)
|
||||
{
|
||||
$current_rank = 0;
|
||||
$current_uppercat = $row['id_uppercat'];
|
||||
}
|
||||
++$current_rank;
|
||||
$cat =
|
||||
array(
|
||||
'rank' => $current_rank,
|
||||
'rank_changed' =>$current_rank!=$row['rank'],
|
||||
'global_rank' => $row['global_rank'],
|
||||
'uppercats' => $row['uppercats'],
|
||||
);
|
||||
$cat_map[ $row['id'] ] = $cat;
|
||||
}
|
||||
|
||||
$datas = array();
|
||||
foreach ($uppercats_array as $id => $uppercats)
|
||||
|
||||
foreach( $cat_map as $id=>$cat )
|
||||
{
|
||||
array_push(
|
||||
$datas,
|
||||
array(
|
||||
'id' => $id,
|
||||
'global_rank' => preg_replace(
|
||||
$new_global_rank = preg_replace(
|
||||
'/(\d+)/e',
|
||||
"\$ranks_array['$1']",
|
||||
str_replace(',', '.', $uppercats)
|
||||
),
|
||||
)
|
||||
);
|
||||
"\$cat_map['$1']['rank']",
|
||||
str_replace(',', '.', $cat['uppercats'] )
|
||||
);
|
||||
if ( $cat['rank_changed']
|
||||
or $new_global_rank!=$cat['global_rank']
|
||||
)
|
||||
{
|
||||
$datas[] = array(
|
||||
'id' => $id,
|
||||
'rank' => $cat['rank'],
|
||||
'global_rank' => $new_global_rank,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
mass_updates(
|
||||
CATEGORIES_TABLE,
|
||||
array(
|
||||
'primary' => array('id'),
|
||||
'update' => array('global_rank')
|
||||
'update' => array('rank', 'global_rank')
|
||||
),
|
||||
$datas
|
||||
);
|
||||
return count($datas);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -907,43 +896,6 @@ SELECT image_id
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* order categories (update categories.rank and global_rank database fields)
|
||||
*
|
||||
* the purpose of this function is to give a rank for all categories
|
||||
* (insides its sub-category), even the newer that have none at te
|
||||
* beginning. For this, ordering function selects all categories ordered by
|
||||
* rank ASC then name ASC for each uppercat.
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function ordering()
|
||||
{
|
||||
$current_rank = 0;
|
||||
$current_uppercat = '';
|
||||
|
||||
$query = '
|
||||
SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
ORDER BY id_uppercat,rank,name
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
$datas = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
if ($row['id_uppercat'] != $current_uppercat)
|
||||
{
|
||||
$current_rank = 0;
|
||||
$current_uppercat = $row['id_uppercat'];
|
||||
}
|
||||
$data = array('id' => $row['id'], 'rank' => ++$current_rank);
|
||||
array_push($datas, $data);
|
||||
}
|
||||
|
||||
$fields = array('primary' => array('id'), 'update' => array('rank'));
|
||||
mass_updates(CATEGORIES_TABLE, $fields, $datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the fulldir for each given category id
|
||||
*
|
||||
|
@ -1159,7 +1111,7 @@ SELECT user_id
|
|||
foreach ($tables as $table)
|
||||
{
|
||||
$query = '
|
||||
SELECT user_id
|
||||
SELECT DISTINCT user_id
|
||||
FROM '.$table.'
|
||||
;';
|
||||
$to_delete = array_diff(
|
||||
|
@ -1187,48 +1139,36 @@ DELETE
|
|||
*/
|
||||
function update_uppercats()
|
||||
{
|
||||
$uppercat_ids = array();
|
||||
|
||||
$query = '
|
||||
SELECT id, id_uppercat
|
||||
SELECT id, id_uppercat, uppercats
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$uppercat_ids[$row['id']] =
|
||||
!empty($row['id_uppercat']) ? $row['id_uppercat'] : 'NULL';
|
||||
}
|
||||
|
||||
// uppercats array associates a category id to the list of uppercats id.
|
||||
$uppercats = array();
|
||||
|
||||
foreach (array_keys($uppercat_ids) as $id)
|
||||
{
|
||||
$uppercats[$id] = array();
|
||||
|
||||
$uppercat = $id;
|
||||
|
||||
while ($uppercat != 'NULL')
|
||||
{
|
||||
array_push($uppercats[$id], $uppercat);
|
||||
$uppercat = $uppercat_ids[$uppercat];
|
||||
}
|
||||
}
|
||||
$cat_map = hash_from_query($query, 'id');
|
||||
|
||||
$datas = array();
|
||||
|
||||
foreach ($uppercats as $id => $list)
|
||||
foreach ($cat_map as $id => $cat)
|
||||
{
|
||||
array_push(
|
||||
$datas,
|
||||
array(
|
||||
'id' => $id,
|
||||
'uppercats' => implode(',', array_reverse($list))
|
||||
)
|
||||
);
|
||||
}
|
||||
$upper_list = array();
|
||||
|
||||
$uppercat = $id;
|
||||
while ($uppercat)
|
||||
{
|
||||
array_push($upper_list, $uppercat);
|
||||
$uppercat = $cat_map[$uppercat]['id_uppercat'];
|
||||
}
|
||||
|
||||
$new_uppercats = implode(',', array_reverse($upper_list));
|
||||
if ($new_uppercats != $cat['uppercats'])
|
||||
{
|
||||
array_push(
|
||||
$datas,
|
||||
array(
|
||||
'id' => $id,
|
||||
'uppercats' => $new_uppercats
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$fields = array('primary' => array('id'), 'update' => array('uppercats'));
|
||||
mass_updates(CATEGORIES_TABLE, $fields, $datas);
|
||||
}
|
||||
|
@ -1396,7 +1336,6 @@ UPDATE '.CATEGORIES_TABLE.'
|
|||
pwg_query($query);
|
||||
|
||||
update_uppercats();
|
||||
ordering();
|
||||
update_global_rank();
|
||||
|
||||
// status and related permissions management
|
||||
|
@ -1951,42 +1890,6 @@ SELECT id,
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check configuration and add notes on problem
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function check_conf()
|
||||
{
|
||||
global $conf, $header_notes;
|
||||
$count = 0;
|
||||
|
||||
if (($conf['show_exif']) and (!function_exists('read_exif_data')))
|
||||
{
|
||||
$header_notes[] = sprintf(l10n('note_check_exif'), '$conf[\'show_exif\']');
|
||||
$count++;
|
||||
}
|
||||
|
||||
if (($conf['use_exif']) and (!function_exists('read_exif_data')))
|
||||
{
|
||||
$header_notes[] = sprintf(l10n('note_check_exif'), '$conf[\'use_exif\']');
|
||||
$count++;
|
||||
}
|
||||
|
||||
if ($count != 0)
|
||||
{
|
||||
$pwg_links = pwg_URL();
|
||||
$link_fmt = '<a href="%s" onclick="window.open(this.href, \'\'); return false;">%s</a>';
|
||||
$header_notes[] =
|
||||
sprintf
|
||||
(
|
||||
l10n('note_check_more_info'),
|
||||
sprintf($link_fmt, $pwg_links['FORUM'], l10n('note_check_more_info_forum')),
|
||||
sprintf($link_fmt, $pwg_links['WIKI'], l10n('note_check_more_info_wiki'))
|
||||
);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Refer main PhpWebGallery URLs (currently PHPWG_DOMAIN domain)
|
||||
*
|
||||
|
@ -2013,4 +1916,16 @@ function pwg_URL()
|
|||
return $urls;
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* Invalidates cahed data (permissions and category counts) for all users.
|
||||
*/
|
||||
function invalidate_user_cache()
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.USER_CACHE_TABLE.'
|
||||
SET need_update = \'true\'
|
||||
;';
|
||||
pwg_query($query);
|
||||
trigger_action('invalidate_user_cache');
|
||||
}
|
||||
?>
|
405
admin/include/functions_check_integrity.inc.php
Normal file
405
admin/include/functions_check_integrity.inc.php
Normal file
|
@ -0,0 +1,405 @@
|
|||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
/**
|
||||
* Check integrity
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function check_integrity()
|
||||
{
|
||||
global $page, $header_notes;
|
||||
|
||||
add_event_handler('get_check_integrity', 'c13y_exif');
|
||||
add_event_handler('get_check_integrity', 'c13y_user');
|
||||
|
||||
$page['check_integrity'] = array();
|
||||
$page['check_integrity'] = trigger_event('get_check_integrity',
|
||||
$page['check_integrity']);
|
||||
|
||||
if (count($page['check_integrity']) > 0)
|
||||
{
|
||||
$header_notes[] =
|
||||
l10n_dec('c13y_anomaly_count', 'c13y_anomalies_count',
|
||||
count($page['check_integrity']));
|
||||
}
|
||||
|
||||
if (!is_adviser())
|
||||
{
|
||||
if (isset($_POST['c13y_submit']) and isset($_POST['c13y_selection']))
|
||||
{
|
||||
$corrected_count = 0;
|
||||
$not_corrected_count = 0;
|
||||
|
||||
foreach ($page['check_integrity'] as $i => $c13y)
|
||||
{
|
||||
if (!empty($c13y['correction_fct']) and
|
||||
$c13y['is_callable'] and
|
||||
in_array($c13y['id'], $_POST['c13y_selection']))
|
||||
{
|
||||
if (is_array($c13y['correction_fct_args']))
|
||||
{
|
||||
$args = $c13y['correction_fct_args'];
|
||||
}
|
||||
else
|
||||
if (!is_null($c13y['correction_fct_args']))
|
||||
{
|
||||
$args = array($c13y['correction_fct_args']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args = array();
|
||||
}
|
||||
$page['check_integrity'][$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
|
||||
|
||||
if ($page['check_integrity'][$i]['corrected'])
|
||||
{
|
||||
$corrected_count += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$not_corrected_count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($corrected_count > 0)
|
||||
{
|
||||
$page['infos'][] =
|
||||
l10n_dec('c13y_anomaly_corrected_count', 'c13y_anomalies_corrected_count',
|
||||
$corrected_count);
|
||||
}
|
||||
if ($not_corrected_count > 0)
|
||||
{
|
||||
$page['errors'][] =
|
||||
l10n_dec('c13y_anomaly_not_corrected_count', 'c13y_anomalies_not_corrected_count',
|
||||
$not_corrected_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display anomalies list
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function display_check_integrity()
|
||||
{
|
||||
global $template, $page;
|
||||
|
||||
$show_submit = false;
|
||||
|
||||
if (isset($page['check_integrity']) and count($page['check_integrity']) > 0)
|
||||
{
|
||||
$template->set_filenames(array('check_integrity' => 'admin/check_integrity.tpl'));
|
||||
|
||||
foreach ($page['check_integrity'] as $i => $c13y)
|
||||
{
|
||||
$template->assign_block_vars('c13y',
|
||||
array(
|
||||
'CLASS' => ($i % 2 == 1) ? 'row2' : 'row1',
|
||||
'ID' => $c13y['id'],
|
||||
'ANOMALY' => $c13y['anomaly']
|
||||
));
|
||||
|
||||
if (!empty($c13y['correction_fct']))
|
||||
{
|
||||
if (isset($c13y['corrected']))
|
||||
{
|
||||
if ($c13y['corrected'])
|
||||
{
|
||||
$template->assign_block_vars('c13y.correction_success_fct', array());
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('c13y.correction_error_fct',
|
||||
array('WIKI_FOROM_LINKS' => get_htlm_links_more_info()));
|
||||
}
|
||||
}
|
||||
else if ($c13y['is_callable'])
|
||||
{
|
||||
$template->assign_block_vars('c13y.correction_fct', array());
|
||||
$show_submit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('c13y.correction_bad_fct', array());
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg']))
|
||||
{
|
||||
$template->assign_block_vars('c13y.br', array());
|
||||
}
|
||||
|
||||
if (!empty($c13y['correction_msg']) and !isset($c13y['corrected']))
|
||||
{
|
||||
$template->assign_block_vars('c13y.correction_msg',
|
||||
array(
|
||||
'DATA' => nl2br($c13y['correction_msg'])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_submit)
|
||||
{
|
||||
$template->assign_block_vars('c13y_submit', array());
|
||||
}
|
||||
|
||||
$template->concat_var_from_handle('ADMIN_CONTENT', 'check_integrity');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns structured anomaly data
|
||||
*
|
||||
* @param anomaly arguments
|
||||
* @return c13y anomaly array
|
||||
*/
|
||||
function get_c13y($anomaly, $correction_fct = null, $correction_fct_args = null, $correction_msg = null)
|
||||
{
|
||||
return
|
||||
array(
|
||||
'id' => md5($anomaly.$correction_fct.serialize($correction_fct_args).$correction_msg),
|
||||
'anomaly' => $anomaly,
|
||||
'correction_fct' => $correction_fct,
|
||||
'correction_fct_args' => $correction_fct_args,
|
||||
'correction_msg' => $correction_msg,
|
||||
'is_callable' => is_callable($correction_fct));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns links more informations
|
||||
*
|
||||
* @param void
|
||||
* @return html links
|
||||
*/
|
||||
function get_htlm_links_more_info()
|
||||
{
|
||||
$pwg_links = pwg_URL();
|
||||
$link_fmt = '<a href="%s" onclick="window.open(this.href, \'\'); return false;">%s</a>';
|
||||
return
|
||||
sprintf
|
||||
(
|
||||
l10n('c13y_more_info'),
|
||||
sprintf($link_fmt, $pwg_links['FORUM'], l10n('c13y_more_info_forum')),
|
||||
sprintf($link_fmt, $pwg_links['WIKI'], l10n('c13y_more_info_wiki'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check exif
|
||||
*
|
||||
* @param c13y anomalies array
|
||||
* @return c13y anomalies array
|
||||
*/
|
||||
function c13y_exif($c13y_array)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
foreach (array('show_exif', 'use_exif') as $value)
|
||||
{
|
||||
if (($conf[$value]) and (!function_exists('read_exif_data')))
|
||||
{
|
||||
$c13y_array[] = get_c13y(
|
||||
sprintf(l10n('c13y_exif_anomaly'), '$conf[\''.$value.'\']'),
|
||||
null,
|
||||
null,
|
||||
sprintf(l10n('c13y_exif_correction'), '$conf[\''.$value.'\']')
|
||||
.'<BR />'.
|
||||
get_htlm_links_more_info());
|
||||
}
|
||||
}
|
||||
|
||||
return $c13y_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check user
|
||||
*
|
||||
* @param c13y anomalies array
|
||||
* @return c13y anomalies array
|
||||
*/
|
||||
function c13y_user($c13y_array)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$c13y_users = array();
|
||||
$c13y_users[$conf['guest_id']] = array(
|
||||
'status' => 'guest',
|
||||
'l10n_non_existent' => 'c13y_guest_non_existent',
|
||||
'l10n_bad_status' => 'c13y_bad_guest_status');
|
||||
|
||||
if ($conf['guest_id'] != $conf['default_user_id'])
|
||||
{
|
||||
$c13y_users[$conf['default_user_id']] = array(
|
||||
'password' => null,
|
||||
'l10n_non_existent' => 'c13y_default_non_existent');
|
||||
}
|
||||
|
||||
$c13y_users[$conf['webmaster_id']] = array(
|
||||
'status' => 'webmaster',
|
||||
'l10n_non_existent' => 'c13y_webmaster_non_existent',
|
||||
'l10n_bad_status' => 'c13y_bad_webmaster_status');
|
||||
|
||||
$query = '
|
||||
select u.'.$conf['user_fields']['id'].' as id, ui.status
|
||||
from '.USERS_TABLE.' as u
|
||||
left join '.USER_INFOS_TABLE.' as ui
|
||||
on u.'.$conf['user_fields']['id'].' = ui.user_id
|
||||
where
|
||||
u.'.$conf['user_fields']['id'].' in ('.implode(',', array_keys($c13y_users)).')
|
||||
;';
|
||||
|
||||
|
||||
$status = array();
|
||||
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$status[$row['id']] = $row['status'];
|
||||
}
|
||||
|
||||
foreach ($c13y_users as $id => $data)
|
||||
{
|
||||
if (!array_key_exists($id, $status))
|
||||
{
|
||||
$c13y_array[] = get_c13y(l10n($data['l10n_non_existent']), 'c13y_correction_user',
|
||||
array('id' => $id, 'action' => 'creation'));
|
||||
}
|
||||
else
|
||||
if (!empty($data['status']) and $status[$id] != $data['status'])
|
||||
{
|
||||
$c13y_array[] = get_c13y(l10n($data['l10n_bad_status']), 'c13y_correction_user',
|
||||
array('id' => $id, 'action' => 'status'));
|
||||
}
|
||||
}
|
||||
|
||||
return $c13y_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check exif
|
||||
*
|
||||
* @param user_id, action
|
||||
* @return boolean true if ok else false
|
||||
*/
|
||||
function c13y_correction_user($id, $action)
|
||||
{
|
||||
global $conf, $page;
|
||||
|
||||
$result = false;
|
||||
|
||||
if (!empty($id))
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
case 'creation':
|
||||
if ($id == $conf['guest_id'])
|
||||
{
|
||||
$name = 'guest';
|
||||
$password = null;
|
||||
}
|
||||
else if ($id == $conf['default_user_id'])
|
||||
{
|
||||
$name = 'guest';
|
||||
$password = null;
|
||||
}
|
||||
else if ($id == $conf['webmaster_id'])
|
||||
{
|
||||
$name = 'webmaster';
|
||||
$password = generate_key(6);
|
||||
}
|
||||
|
||||
if (isset($name))
|
||||
{
|
||||
$name_ok = false;
|
||||
while (!$name_ok)
|
||||
{
|
||||
$name_ok = (get_userid($name) === false);
|
||||
if (!$name_ok)
|
||||
{
|
||||
$name .= generate_key(1);
|
||||
}
|
||||
}
|
||||
|
||||
$inserts = array(
|
||||
array(
|
||||
'id' => $id,
|
||||
'username' => $name,
|
||||
'password' => $password
|
||||
),
|
||||
);
|
||||
mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts);
|
||||
|
||||
create_user_infos($id);
|
||||
|
||||
$page['infos'][] = sprintf(l10n('c13y_user_created'), $name, $password);
|
||||
|
||||
$result = true;
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
if ($id == $conf['guest_id'])
|
||||
{
|
||||
$status = 'guest';
|
||||
}
|
||||
else if ($id == $conf['default_user_id'])
|
||||
{
|
||||
$status = 'guest';
|
||||
}
|
||||
else if ($id == $conf['webmaster_id'])
|
||||
{
|
||||
$status = 'webmaster';
|
||||
}
|
||||
|
||||
if (isset($status))
|
||||
{
|
||||
$updates = array(
|
||||
array(
|
||||
'user_id' => $id,
|
||||
'status' => $status
|
||||
),
|
||||
);
|
||||
mass_updates(USER_INFOS_TABLE,
|
||||
array('primary' => array('user_id'),'update' => array('status')),
|
||||
$updates);
|
||||
|
||||
$page['infos'][] = sprintf(l10n('c13y_user_status_updated'), get_username($id));
|
||||
|
||||
$result = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
|
@ -51,4 +51,142 @@ function history_tabsheet()
|
|||
template_assign_tabsheet();
|
||||
}
|
||||
|
||||
function history_compare($a, $b)
|
||||
{
|
||||
return strcmp($a['date'].$a['time'], $b['date'].$b['time']);
|
||||
}
|
||||
|
||||
function get_history($data, $search, $types)
|
||||
{
|
||||
if (isset($search['fields']['filename']))
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE file LIKE \''.$search['fields']['filename'].'\'
|
||||
;';
|
||||
$search['image_ids'] = array_from_query($query, 'id');
|
||||
}
|
||||
|
||||
// echo '<pre>'; print_r($search); echo '</pre>';
|
||||
|
||||
$clauses = array();
|
||||
|
||||
if (isset($search['fields']['date-after']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
"date >= '".$search['fields']['date-after']."'"
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($search['fields']['date-before']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
"date <= '".$search['fields']['date-before']."'"
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($search['fields']['types']))
|
||||
{
|
||||
$local_clauses = array();
|
||||
|
||||
foreach ($types as $type) {
|
||||
if (in_array($type, $search['fields']['types'])) {
|
||||
$clause = 'image_type ';
|
||||
if ($type == 'none')
|
||||
{
|
||||
$clause.= 'IS NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$clause.= "= '".$type."'";
|
||||
}
|
||||
|
||||
array_push($local_clauses, $clause);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($local_clauses) > 0)
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
implode(' OR ', $local_clauses)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($search['fields']['user'])
|
||||
and $search['fields']['user'] != -1)
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'user_id = '.$search['fields']['user']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($search['fields']['image_id']))
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'image_id = '.$search['fields']['image_id']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($search['fields']['filename']))
|
||||
{
|
||||
if (count($search['image_ids']) == 0)
|
||||
{
|
||||
// a clause that is always false
|
||||
array_push($clauses, '1 = 2 ');
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push(
|
||||
$clauses,
|
||||
'image_id IN ('.implode(', ', $search['image_ids']).')'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$clauses = prepend_append_array_items($clauses, '(', ')');
|
||||
|
||||
$where_separator =
|
||||
implode(
|
||||
"\n AND ",
|
||||
$clauses
|
||||
);
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
date,
|
||||
time,
|
||||
user_id,
|
||||
IP,
|
||||
section,
|
||||
category_id,
|
||||
tag_ids,
|
||||
image_id,
|
||||
image_type
|
||||
FROM '.HISTORY_TABLE.'
|
||||
WHERE '.$where_separator.'
|
||||
;';
|
||||
|
||||
// LIMIT '.$page['start'].', '.$conf['nb_logs_page'].'
|
||||
|
||||
$result = pwg_query($query);
|
||||
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
array_push($data, $row);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
|
||||
trigger_action('functions_history_included');
|
||||
|
||||
?>
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -201,7 +200,7 @@ function begin_users_env_nbm($is_to_send_mail = false)
|
|||
{
|
||||
// Init mail configuration
|
||||
$env_nbm['email_format'] = get_str_email_format($conf['nbm_send_html_mail']);
|
||||
$env_nbm['send_as_name'] = ((isset($conf['nbm_send_mail_as']) and !empty($conf['nbm_send_mail_as'])) ? $conf['nbm_send_mail_as'] : $conf['gallery_title']);
|
||||
$env_nbm['send_as_name'] = ((isset($conf['nbm_send_mail_as']) and !empty($conf['nbm_send_mail_as'])) ? $conf['nbm_send_mail_as'] : get_mail_sender_name());
|
||||
$env_nbm['send_as_mail_address'] = get_webmaster_mail_address();
|
||||
$env_nbm['send_as_mail_formated'] = format_email($env_nbm['send_as_name'], $env_nbm['send_as_mail_address']);
|
||||
// Init mail counter
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
|
@ -95,7 +94,7 @@ function get_admin_plugin_menu_link($file)
|
|||
$url = get_root_url().'admin.php?page=plugin';
|
||||
if (false!==$real_file)
|
||||
{
|
||||
$real_plugin_path = realpath(PHPWG_PLUGINS_PATH);
|
||||
$real_plugin_path = rtrim(realpath(PHPWG_PLUGINS_PATH), '\\/');
|
||||
$file = substr($real_file, strlen($real_plugin_path)+1);
|
||||
$file = str_replace('\\', '/', $file);//Windows
|
||||
$url .= '&section='.urlencode($file);
|
||||
|
|
|
@ -40,5 +40,24 @@ if you want to upgrade';
|
|||
}
|
||||
}
|
||||
|
||||
// Create empty local files to avoid log errors
|
||||
function create_empty_local_files()
|
||||
{
|
||||
$files =
|
||||
array (
|
||||
PHPWG_ROOT_PATH . 'template-common/local-layout.css',
|
||||
PHPWG_ROOT_PATH . 'template/yoga/local-layout.css'
|
||||
);
|
||||
|
||||
foreach ($files as $path)
|
||||
{
|
||||
if (!file_exists ($path))
|
||||
{
|
||||
$file = @fopen($path, "w");
|
||||
@fwrite($file , '/* You can modify this file */');
|
||||
@fclose($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -244,7 +244,7 @@ if ($nb_waiting > 0)
|
|||
$template->assign_block_vars(
|
||||
'waiting',
|
||||
array(
|
||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=waiting',
|
||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=upload',
|
||||
'INFO' => sprintf(l10n('%d waiting for validation'), $nb_waiting)
|
||||
)
|
||||
);
|
||||
|
@ -278,4 +278,6 @@ if ($nb_comments > 0)
|
|||
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'intro');
|
||||
|
||||
display_check_integrity();
|
||||
|
||||
?>
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -49,8 +48,8 @@ switch ($action)
|
|||
{
|
||||
update_uppercats();
|
||||
update_category('all');
|
||||
ordering();
|
||||
update_global_rank();
|
||||
invalidate_user_cache();
|
||||
break;
|
||||
}
|
||||
case 'images' :
|
||||
|
@ -59,11 +58,20 @@ switch ($action)
|
|||
update_average_rate();
|
||||
break;
|
||||
}
|
||||
case 'history' :
|
||||
case 'history_detail' :
|
||||
{
|
||||
$query = '
|
||||
DELETE
|
||||
FROM '.HISTORY_TABLE.'
|
||||
;';
|
||||
pwg_query($query);
|
||||
break;
|
||||
}
|
||||
case 'history_summary' :
|
||||
{
|
||||
$query = '
|
||||
DELETE
|
||||
FROM '.HISTORY_SUMMARY_TABLE.'
|
||||
;';
|
||||
pwg_query($query);
|
||||
break;
|
||||
|
@ -106,7 +114,8 @@ $template->assign_vars(
|
|||
array(
|
||||
'U_MAINT_CATEGORIES' => $start_url.'categories',
|
||||
'U_MAINT_IMAGES' => $start_url.'images',
|
||||
'U_MAINT_HISTORY' => $start_url.'history',
|
||||
'U_MAINT_HISTORY_DETAIL' => $start_url.'history_detail',
|
||||
'U_MAINT_HISTORY_SUMMARY' => $start_url.'history_summary',
|
||||
'U_MAINT_SESSIONS' => $start_url.'sessions',
|
||||
'U_MAINT_FEEDS' => $start_url.'feeds',
|
||||
'U_MAINT_DATABASE' => $start_url.'database',
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -85,7 +84,7 @@ function do_timeout_treatment($post_keyname, $check_key_treated = array())
|
|||
|
||||
$must_repost = true;
|
||||
array_push($page['errors'],
|
||||
l10n_dec('nbm_background_treatment_redirect_second',
|
||||
l10n_dec('nbm_background_treatment_redirect_second',
|
||||
'nbm_background_treatment_redirect_seconds',
|
||||
$time_refresh));
|
||||
}
|
||||
|
@ -165,7 +164,7 @@ order by
|
|||
// Insert new nbm_users
|
||||
array_push
|
||||
(
|
||||
$inserts,
|
||||
$inserts,
|
||||
array
|
||||
(
|
||||
'user_id' => $nbm_user['user_id'],
|
||||
|
@ -176,10 +175,10 @@ order by
|
|||
|
||||
array_push
|
||||
(
|
||||
$page['infos'],
|
||||
$page['infos'],
|
||||
sprintf(
|
||||
l10n('nbm_user_x_added'),
|
||||
$nbm_user['username'],
|
||||
l10n('nbm_user_x_added'),
|
||||
$nbm_user['username'],
|
||||
get_email_address_as_display_text($nbm_user['mail_address'])
|
||||
)
|
||||
);
|
||||
|
@ -204,12 +203,32 @@ order by
|
|||
$query = 'delete from '.USER_MAIL_NOTIFICATION_TABLE.' where check_key in ('.implode(",", $quoted_check_key_list).');';
|
||||
$result = pwg_query($query);
|
||||
|
||||
redirect($base_url.get_query_string_diff(array()), l10n('nbm_redirect_msg'));
|
||||
redirect($base_url.get_query_string_diff(array(), false), l10n('nbm_redirect_msg'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply global functions to mail content
|
||||
* return customize mail content rendered
|
||||
*/
|
||||
function render_global_customize_mail_content($customize_mail_content)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
|
||||
{
|
||||
// On HTML mail, detects if the content are HTML format.
|
||||
// If it's plain text format, convert content to readable HTML
|
||||
return nl2br(htmlspecialchars($customize_mail_content));
|
||||
}
|
||||
else
|
||||
{
|
||||
return $customize_mail_content;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail for notification to all users
|
||||
* Return list of "selected" users for 'list_to_send'
|
||||
|
@ -219,7 +238,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
|
|||
{
|
||||
global $conf, $page, $user, $lang_info, $lang, $env_nbm;
|
||||
$return_list = array();
|
||||
|
||||
|
||||
if (in_array($action, array('list_to_send', 'send')))
|
||||
{
|
||||
list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
|
||||
|
@ -244,12 +263,9 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
|
|||
$customize_mail_content = $conf['nbm_complementary_mail_content'];
|
||||
}
|
||||
|
||||
if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
|
||||
{
|
||||
// On HTML mail, detects if the content are HTML format.
|
||||
// If it's plain text format, convert content to readable HTML
|
||||
$customize_mail_content = nl2br(htmlentities($customize_mail_content));
|
||||
}
|
||||
$customize_mail_content =
|
||||
trigger_event('nbm_render_global_customize_mail_content', $customize_mail_content);
|
||||
|
||||
|
||||
// Prepare message after change language
|
||||
if ($is_action_send)
|
||||
|
@ -314,7 +330,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
|
|||
'content_new_elements_between',
|
||||
array
|
||||
(
|
||||
'DATE_BETWEEN_1' => $nbm_user['last_send'],
|
||||
'DATE_BETWEEN_1' => $nbm_user['last_send'],
|
||||
'DATE_BETWEEN_2' => $dbnow,
|
||||
'END_PUNCT' => $end_punct
|
||||
)
|
||||
|
@ -344,11 +360,16 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($customize_mail_content))
|
||||
$nbm_user_customize_mail_content =
|
||||
trigger_event('nbm_render_user_customize_mail_content',
|
||||
$customize_mail_content, $nbm_user);
|
||||
if (!empty($nbm_user_customize_mail_content))
|
||||
{
|
||||
$env_nbm['mail_template']->assign_block_vars
|
||||
(
|
||||
'custom', array('CUSTOMIZE_MAIL_CONTENT' => $customize_mail_content)
|
||||
'custom',
|
||||
array('CUSTOMIZE_MAIL_CONTENT' =>
|
||||
$nbm_user_customize_mail_content)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -422,7 +443,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
|
|||
array_push($return_list, $nbm_user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// unset env nbm user
|
||||
unset_user_on_env_nbm();
|
||||
}
|
||||
|
@ -482,6 +503,14 @@ else
|
|||
// +-----------------------------------------------------------------------+
|
||||
check_status(get_tab_status($page['mode']));
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Add event handler |
|
||||
// +-----------------------------------------------------------------------+
|
||||
add_event_handler('nbm_render_global_customize_mail_content', 'render_global_customize_mail_content');
|
||||
trigger_action('nbm_event_handler_added');
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Insert new users with mails |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -520,7 +549,7 @@ where
|
|||
$updated_param_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
array_push($page['infos'],
|
||||
l10n_dec('nbm_updated_param_count', 'nbm_updated_params_count',
|
||||
$updated_param_count));
|
||||
|
@ -587,7 +616,7 @@ if (is_autorize_status(ACCESS_WEBMASTER))
|
|||
'param' => array
|
||||
(
|
||||
'caption' => l10n('nbm_param_mode'),
|
||||
'url' => add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
|
||||
'url' => add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
|
||||
array('mode' => 'param'))
|
||||
),
|
||||
'subscribe' => array
|
||||
|
@ -627,7 +656,7 @@ if ($must_repost)
|
|||
|
||||
$template->assign_block_vars
|
||||
(
|
||||
'repost',
|
||||
'repost',
|
||||
array
|
||||
(
|
||||
'REPOST_SUBMIT_NAME' => $repost_submit_name
|
||||
|
|
|
@ -26,14 +26,15 @@
|
|||
function parse_sort_variables(
|
||||
$sortable_by, $default_field,
|
||||
$get_param, $get_rejects,
|
||||
$template_var )
|
||||
$template_var,
|
||||
$anchor = '' )
|
||||
{
|
||||
global $template;
|
||||
|
||||
|
||||
$url_components = parse_url( $_SERVER['REQUEST_URI'] );
|
||||
|
||||
$base_url = $url_components['path'];
|
||||
|
||||
|
||||
parse_str($url_components['query'], $vars);
|
||||
$is_first = true;
|
||||
foreach ($vars as $key => $value)
|
||||
|
@ -50,23 +51,29 @@ function parse_sort_variables(
|
|||
foreach( $sortable_by as $field)
|
||||
{
|
||||
$url = $base_url;
|
||||
$disp = '⇓'; // TODO: an small image is better
|
||||
|
||||
if ( $field !== @$_GET[$get_param] )
|
||||
{
|
||||
if ( !isset($default_field) or $default_field!=$field )
|
||||
{ // the first should be the default
|
||||
$url = add_url_params($url, array($get_param=>$field) );
|
||||
}
|
||||
$disp = '⇓'; // TODO: an small image is better
|
||||
elseif (isset($default_field) and !isset($_GET[$get_param]) )
|
||||
{
|
||||
array_push($ret, $field);
|
||||
$disp = '<em>'.$disp.'</em>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($ret, $field);
|
||||
$disp = '<em>⇓</em>'; // TODO: an small image is better
|
||||
$disp = '<em>'.$disp.'</em>';
|
||||
}
|
||||
if ( isset($template_var) )
|
||||
{
|
||||
$template->assign_var( $template_var.strtoupper($field),
|
||||
'<a href="'.$url.'" title="'.l10n('Sort order').'">'.$disp.'</a>'
|
||||
'<a href="'.$url.$anchor.'" title="'.l10n('Sort order').'">'.$disp.'</a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +85,7 @@ if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
|
|||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_permalinks.php');
|
||||
|
||||
$selected_cat = array();
|
||||
if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 )
|
||||
if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 and !is_adviser() )
|
||||
{
|
||||
$permalink = $_POST['permalink'];
|
||||
if ( empty($permalink) )
|
||||
|
@ -87,7 +94,7 @@ if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 )
|
|||
set_cat_permalink($_POST['cat_id'], $permalink, isset($_POST['save']) );
|
||||
$selected_cat = array( $_POST['cat_id'] );
|
||||
}
|
||||
elseif ( isset($_GET['delete_permanent']) )
|
||||
elseif ( isset($_GET['delete_permanent']) and !is_adviser() )
|
||||
{
|
||||
$query = '
|
||||
DELETE FROM '.OLD_PERMALINKS_TABLE.'
|
||||
|
@ -102,10 +109,10 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
|
|||
$template->set_filename('permalinks', 'admin/permalinks.tpl' );
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
id,
|
||||
SELECT
|
||||
id,
|
||||
CONCAT(id, " - ", name, IF(permalink IS NULL, "", " √") ) AS name,
|
||||
uppercats, global_rank
|
||||
uppercats, global_rank
|
||||
FROM '.CATEGORIES_TABLE;
|
||||
|
||||
display_select_cat_wrapper( $query, $selected_cat, 'categories', false );
|
||||
|
@ -123,9 +130,7 @@ SELECT id, permalink, uppercats, global_rank
|
|||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE permalink IS NOT NULL
|
||||
';
|
||||
if ( count($sort_by) and
|
||||
($sort_by[0]=='id' or $sort_by[0]=='permalink')
|
||||
)
|
||||
if ( $sort_by[0]=='id' or $sort_by[0]=='permalink' )
|
||||
{
|
||||
$query .= ' ORDER BY '.$sort_by[0];
|
||||
}
|
||||
|
@ -137,7 +142,7 @@ while ( $row=mysql_fetch_assoc($result) )
|
|||
$categories[] = $row;
|
||||
}
|
||||
|
||||
if ( !count($sort_by) or $sort_by[0]='name')
|
||||
if ( $sort_by[0]=='name')
|
||||
{
|
||||
usort($categories, 'global_rank_compare');
|
||||
}
|
||||
|
@ -153,7 +158,7 @@ $sort_by = parse_sort_variables(
|
|||
array('cat_id','permalink','date_deleted','last_hit','hit'), null,
|
||||
'dpsf',
|
||||
array('delete_permanent'),
|
||||
'SORT_OLD_' );
|
||||
'SORT_OLD_', '#old_permalinks' );
|
||||
|
||||
$url_del_base = get_root_url().'admin.php?page=permalinks';
|
||||
$query = 'SELECT * FROM '.OLD_PERMALINKS_TABLE;
|
||||
|
|
|
@ -65,7 +65,7 @@ if (isset($_POST['date_creation_action'])
|
|||
$_POST['date_creation_year'])
|
||||
)
|
||||
{
|
||||
array_push($page['errors'], $lang['err_date']);
|
||||
array_push($page['errors'], l10n('err_date'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ $my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugins';
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | perform requested actions |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if ( isset($_GET['action']) and isset($_GET['plugin']) )
|
||||
if ( isset($_GET['action']) and isset($_GET['plugin']) and !is_adviser() )
|
||||
{
|
||||
$plugin_id = $_GET['plugin'];
|
||||
$crt_db_plugin = get_db_plugins('', $plugin_id);
|
||||
|
@ -164,6 +164,7 @@ DELETE FROM '.PLUGINS_TABLE.' WHERE id="'.$plugin_id.'"';
|
|||
// | start template output |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$fs_plugins = get_fs_plugins();
|
||||
uasort($fs_plugins, 'name_compare');
|
||||
$db_plugins = get_db_plugins();
|
||||
$db_plugins_by_id=array();
|
||||
foreach ($db_plugins as $db_plugin)
|
||||
|
|
|
@ -259,22 +259,22 @@ ORDER BY date DESC;';
|
|||
|
||||
if ( isset($users[$row['user_id']]) )
|
||||
{
|
||||
$user = $users[$row['user_id']];
|
||||
$user_rate = $users[$row['user_id']];
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = '? '. $row['user_id'];
|
||||
$user_rate = '? '. $row['user_id'];
|
||||
}
|
||||
if ( strlen($row['anonymous_id'])>0 )
|
||||
{
|
||||
$user .= '('.$row['anonymous_id'].')';
|
||||
$user_rate .= '('.$row['anonymous_id'].')';
|
||||
}
|
||||
|
||||
$template->assign_block_vars('image.rate',
|
||||
array(
|
||||
'DATE' => format_date($row['date']),
|
||||
'RATE' => $row['rate'],
|
||||
'USER' => $user,
|
||||
'USER' => $user_rate,
|
||||
'U_DELETE' => $url_del
|
||||
)
|
||||
);
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -127,15 +126,20 @@ if (isset($_POST['submit']))
|
|||
// | directories / categories |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if (isset($_POST['submit'])
|
||||
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files')
|
||||
and !$general_failure)
|
||||
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files'))
|
||||
{
|
||||
$counts['new_categories'] = 0;
|
||||
$counts['del_categories'] = 0;
|
||||
$counts['del_elements'] = 0;
|
||||
$counts['new_elements'] = 0;
|
||||
$counts['upd_elements'] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit'])
|
||||
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files')
|
||||
and !$general_failure)
|
||||
{
|
||||
$start = get_moment();
|
||||
// which categories to update ?
|
||||
$cat_ids = array();
|
||||
|
@ -236,6 +240,19 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
|
|||
array_push($fs_fulldirs, $basedir);
|
||||
}
|
||||
|
||||
// If $_POST['subcats-included'] != 1 ("Search in subcategories" is unchecked)
|
||||
// $db_fulldirs doesn't include any subdirectories and $fs_fulldirs does
|
||||
// So $fs_fulldirs will be limited to the selected basedir
|
||||
// (if that one is in $fs_fulldirs)
|
||||
if (!isset($_POST['subcats-included']) or $_POST['subcats-included'] != 1)
|
||||
{
|
||||
$fs_fulldirs = array_intersect($fs_fulldirs, array_keys($db_fulldirs));
|
||||
}
|
||||
// print_r( $fs_fulldirs ); echo "<br>";
|
||||
// print_r( $db_fulldirs ); echo "<br>";
|
||||
// print_r( array_diff($fs_fulldirs, array_keys($db_fulldirs)) ); echo "<br>";
|
||||
// die('That\'s why dirs or files synchronizations were duplicating cats.');
|
||||
|
||||
$inserts = array();
|
||||
// new categories are the directories not present yet in the database
|
||||
foreach (array_diff($fs_fulldirs, array_keys($db_fulldirs)) as $fulldir)
|
||||
|
@ -481,6 +498,8 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
|
|||
'info' => l10n('update_research_added')
|
||||
)
|
||||
);
|
||||
|
||||
$caddiables[] = $insert['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -526,6 +545,8 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
|
|||
'info' => l10n('update_research_added')
|
||||
)
|
||||
);
|
||||
|
||||
$caddiables[] = $insert['id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,6 +567,12 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
|
|||
array_keys($insert_links[0]),
|
||||
$insert_links
|
||||
);
|
||||
|
||||
// add new elements to caddie
|
||||
if (isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1)
|
||||
{
|
||||
fill_caddie($caddiables);
|
||||
}
|
||||
}
|
||||
$counts['new_elements'] = count($inserts);
|
||||
}
|
||||
|
@ -643,7 +670,6 @@ if (isset($_POST['submit'])
|
|||
echo get_elapsed_time($start,get_moment());
|
||||
echo ' -->'."\n";
|
||||
$start = get_moment();
|
||||
ordering();
|
||||
update_global_rank();
|
||||
echo '<!-- ordering categories : ';
|
||||
echo get_elapsed_time($start, get_moment());
|
||||
|
@ -801,14 +827,14 @@ SELECT id
|
|||
array_push($has_high_images, $row['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ( $files as $id=>$file )
|
||||
{
|
||||
$data = $site_reader->get_element_metadata(
|
||||
$file,
|
||||
in_array($id, $has_high_images)
|
||||
);
|
||||
|
||||
|
||||
if ( is_array($data) )
|
||||
{
|
||||
$data['date_metadata_update'] = CURRENT_DATE;
|
||||
|
@ -845,7 +871,7 @@ SELECT id
|
|||
if (count($datas) > 0)
|
||||
{
|
||||
// echo '<pre>', print_r($datas); echo '</pre>';
|
||||
|
||||
|
||||
mass_updates(
|
||||
IMAGES_TABLE,
|
||||
// fields
|
||||
|
@ -955,6 +981,12 @@ if (!isset($_POST['submit']) or (isset($simulate) and $simulate))
|
|||
array('DISPLAY_INFO_CHECKED'=>'checked="checked"'));
|
||||
}
|
||||
|
||||
if (isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1)
|
||||
{
|
||||
$template->assign_vars(
|
||||
array('ADD_TO_CADDIE_CHECKED'=>'checked="checked"'));
|
||||
}
|
||||
|
||||
if (isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1)
|
||||
{
|
||||
$template->assign_vars(
|
||||
|
|
|
@ -389,10 +389,14 @@ $template->set_filename('stats', 'admin/stats.tpl');
|
|||
// TabSheet initialization
|
||||
history_tabsheet();
|
||||
|
||||
$base_url = PHPWG_ROOT_PATH.'admin.php?page=history';
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_STAT_TITLE' => implode($conf['level_separator'], $title_parts),
|
||||
'PERIOD_LABEL' => $period_label,
|
||||
'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=history',
|
||||
'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=history',
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -61,14 +61,7 @@ SELECT id, name
|
|||
// we must not rename tag with an already existing name
|
||||
foreach (explode(',', $_POST['edit_list']) as $tag_id)
|
||||
{
|
||||
if (function_exists('mysql_real_escape_string'))
|
||||
{
|
||||
$tag_name = mysql_real_escape_string($_POST['tag_name-'.$tag_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tag_name = mysql_escape_string($_POST['tag_name-'.$tag_id]);
|
||||
}
|
||||
$tag_name = stripslashes($_POST['tag_name-'.$tag_id]);
|
||||
|
||||
if ($tag_name != $current_name_of[$tag_id])
|
||||
{
|
||||
|
@ -88,7 +81,7 @@ SELECT id, name
|
|||
$updates,
|
||||
array(
|
||||
'id' => $tag_id,
|
||||
'name' => $tag_name,
|
||||
'name' => addslashes($tag_name),
|
||||
'url_name' => str2url($tag_name),
|
||||
)
|
||||
);
|
||||
|
|
|
@ -119,7 +119,7 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
// creation and backup of final picture
|
||||
if (!is_writable($tndir))
|
||||
{
|
||||
array_push($page['errors'], '['.$tndir.'] : '.$lang['no_write_access']);
|
||||
array_push($page['errors'], '['.$tndir.'] : '.l10n('no_write_access'));
|
||||
return false;
|
||||
}
|
||||
imagejpeg($destImage, $dest_file);
|
||||
|
@ -140,14 +140,14 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
// error
|
||||
else
|
||||
{
|
||||
echo $lang['tn_no_support']." ";
|
||||
echo l10n('tn_no_support')." ";
|
||||
if ( isset( $extenstion ) )
|
||||
{
|
||||
echo $lang['tn_format'].' '.$extension;
|
||||
echo l10n('tn_format').' '.$extension;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $lang['tn_thisformat'];
|
||||
echo l10n('tn_thisformat');
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
@ -155,32 +155,38 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
|
||||
$pictures = array();
|
||||
$stats = array();
|
||||
|
||||
if (!function_exists('gd_info'))
|
||||
{
|
||||
array_push($page['errors'], l10n('GD library is missing'));
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template initialization |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$template->set_filenames( array('thumbnail'=>'admin/thumbnail.tpl') );
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_THUMBNAIL_TITLE'=>$lang['tn_dirs_title'],
|
||||
'L_UNLINK'=>$lang['tn_no_missing'],
|
||||
'L_MISSING_THUMBNAILS'=>$lang['tn_dirs_alone'],
|
||||
'L_RESULTS'=>$lang['tn_results_title'],
|
||||
'L_PATH'=>$lang['path'],
|
||||
'L_FILESIZE'=>$lang['filesize'],
|
||||
'L_GENERATED'=>$lang['tn_results_gen_time'],
|
||||
'L_THUMBNAIL'=>$lang['thumbnail'],
|
||||
'L_PARAMS'=>$lang['tn_params_title'],
|
||||
'L_GD'=>$lang['tn_params_GD'],
|
||||
'L_CREATE'=>$lang['tn_params_create'],
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
'L_REMAINING'=>$lang['tn_alone_title'],
|
||||
'L_TN_STATS'=>$lang['tn_stats'],
|
||||
'L_TN_NB_STATS'=>$lang['tn_stats_nb'],
|
||||
'L_TN_TOTAL'=>$lang['tn_stats_total'],
|
||||
'L_TN_MAX'=>$lang['tn_stats_max'],
|
||||
'L_TN_MIN'=>$lang['tn_stats_min'],
|
||||
'L_TN_AVERAGE'=>$lang['tn_stats_mean'],
|
||||
'L_ALL'=>$lang['tn_all'],
|
||||
'L_THUMBNAIL_TITLE'=>l10n('tn_dirs_title'),
|
||||
'L_UNLINK'=>l10n('tn_no_missing'),
|
||||
'L_MISSING_THUMBNAILS'=>l10n('tn_dirs_alone'),
|
||||
'L_RESULTS'=>l10n('tn_results_title'),
|
||||
'L_PATH'=>l10n('path'),
|
||||
'L_FILESIZE'=>l10n('filesize'),
|
||||
'L_GENERATED'=>l10n('tn_results_gen_time'),
|
||||
'L_THUMBNAIL'=>l10n('thumbnail'),
|
||||
'L_PARAMS'=>l10n('tn_params_title'),
|
||||
'L_GD'=>l10n('tn_params_GD'),
|
||||
'L_CREATE'=>l10n('tn_params_create'),
|
||||
'L_SUBMIT'=>l10n('submit'),
|
||||
'L_REMAINING'=>l10n('tn_alone_title'),
|
||||
'L_TN_STATS'=>l10n('tn_stats'),
|
||||
'L_TN_NB_STATS'=>l10n('tn_stats_nb'),
|
||||
'L_TN_TOTAL'=>l10n('tn_stats_total'),
|
||||
'L_TN_MAX'=>l10n('tn_stats_max'),
|
||||
'L_TN_MIN'=>l10n('tn_stats_min'),
|
||||
'L_TN_AVERAGE'=>l10n('tn_stats_mean'),
|
||||
'L_ALL'=>l10n('tn_all'),
|
||||
|
||||
'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=thumbnail',
|
||||
|
||||
|
@ -254,11 +260,11 @@ if (isset($_POST['submit']))
|
|||
// checking criteria
|
||||
if (!ereg('^[0-9]{2,3}$', $_POST['width']) or $_POST['width'] < 10)
|
||||
{
|
||||
array_push($page['errors'], $lang['tn_err_width'].' 10');
|
||||
array_push($page['errors'], l10n('tn_err_width').' 10');
|
||||
}
|
||||
if (!ereg('^[0-9]{2,3}$', $_POST['height']) or $_POST['height'] < 10)
|
||||
{
|
||||
array_push($page['errors'], $lang['tn_err_height'].' 10');
|
||||
array_push($page['errors'], l10n('tn_err_height').' 10');
|
||||
}
|
||||
|
||||
// picture miniaturization
|
||||
|
|
|
@ -177,13 +177,13 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
|||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
$page['order_by_items'] = array(
|
||||
'id' => $lang['registration_date'],
|
||||
'username' => $lang['Username']
|
||||
'id' => l10n('registration_date'),
|
||||
'username' => l10n('Username')
|
||||
);
|
||||
|
||||
$page['direction_items'] = array(
|
||||
'asc' => $lang['ascending'],
|
||||
'desc' => $lang['descending']
|
||||
'asc' => l10n('ascending'),
|
||||
'desc' => l10n('descending')
|
||||
);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
@ -193,7 +193,7 @@ $page['direction_items'] = array(
|
|||
if (isset($_POST['submit_add']))
|
||||
{
|
||||
$page['errors'] = register_user(
|
||||
$_POST['login'], $_POST['password'], $_POST['email']);
|
||||
$_POST['login'], $_POST['password'], $_POST['email'], false);
|
||||
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
|
@ -252,15 +252,25 @@ if (isset($_POST['delete']) or isset($_POST['pref_submit']))
|
|||
// +-----------------------------------------------------------------------+
|
||||
if (isset($_POST['delete']) and count($collection) > 0)
|
||||
{
|
||||
if (in_array($conf['guest_id'], $collection))
|
||||
{
|
||||
array_push($page['errors'], l10n('Guest cannot be deleted'));
|
||||
}
|
||||
if (($conf['guest_id'] != $conf['default_user_id']) and
|
||||
in_array($conf['default_user_id'], $collection))
|
||||
{
|
||||
array_push($page['errors'], l10n('Default user cannot be deleted'));
|
||||
}
|
||||
if (in_array($conf['webmaster_id'], $collection))
|
||||
{
|
||||
array_push($page['errors'], l10n('Webmaster cannot be deleted'));
|
||||
}
|
||||
elseif (in_array($user['id'], $collection))
|
||||
if (in_array($user['id'], $collection))
|
||||
{
|
||||
array_push($page['errors'], l10n('You cannot delete your account'));
|
||||
}
|
||||
else
|
||||
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
|
||||
{
|
||||
|
@ -343,7 +353,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
|
|||
'recent_period', 'maxwidth', 'expand', 'show_nb_comments',
|
||||
'show_nb_hits', 'maxheight', 'status', 'enabled_high');
|
||||
|
||||
$true_false_fields = array('expand', 'show_nb_comments',
|
||||
$true_false_fields = array('expand', 'show_nb_comments',
|
||||
'show_nb_hits', 'enabled_high');
|
||||
if ($conf['allow_adviser'])
|
||||
{
|
||||
|
@ -391,16 +401,32 @@ DELETE FROM '.USER_GROUP_TABLE.'
|
|||
}
|
||||
}
|
||||
|
||||
// Webmaster status must not be changed
|
||||
if ($conf['webmaster_id'] == $user_id and isset($data['status']))
|
||||
// special users checks
|
||||
if
|
||||
(
|
||||
($conf['webmaster_id'] == $user_id) or
|
||||
($conf['guest_id'] == $user_id) or
|
||||
($conf['default_user_id'] == $user_id)
|
||||
)
|
||||
{
|
||||
$data['status'] = 'webmaster';
|
||||
}
|
||||
// status must not be changed
|
||||
if (isset($data['status']))
|
||||
{
|
||||
if ($conf['webmaster_id'] == $user_id)
|
||||
{
|
||||
$data['status'] = 'webmaster';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['status'] = 'guest';
|
||||
}
|
||||
}
|
||||
|
||||
// Webmaster and guest adviser must not be changed
|
||||
if ((($conf['webmaster_id'] == $user_id) or ($conf['guest_id'] == $user_id)) and isset($data['adviser']))
|
||||
{
|
||||
$data['adviser'] = 'false';
|
||||
// could not be adivser
|
||||
if (isset($data['adviser']))
|
||||
{
|
||||
$data['adviser'] = 'false';
|
||||
}
|
||||
}
|
||||
|
||||
array_push($datas, $data);
|
||||
|
@ -412,11 +438,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
|
|||
redirect(
|
||||
PHPWG_ROOT_PATH.
|
||||
'admin.php'.
|
||||
get_query_string_diff(
|
||||
array(
|
||||
'start'
|
||||
)
|
||||
)
|
||||
get_query_string_diff(array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -429,6 +451,7 @@ $groups = array();
|
|||
$query = '
|
||||
SELECT id, name
|
||||
FROM '.GROUPS_TABLE.'
|
||||
ORDER BY name ASC
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
@ -751,6 +774,7 @@ $template->assign_vars(array('NAVBAR' => $navbar));
|
|||
$profile_url = get_root_url().'admin.php?page=profile&user_id=';
|
||||
$perm_url = get_root_url().'admin.php?page=user_perm&user_id=';
|
||||
|
||||
$visible_user_list = array();
|
||||
foreach ($page['filtered_users'] as $num => $local_user)
|
||||
{
|
||||
// simulate LIMIT $start, $conf['users_page']
|
||||
|
@ -763,6 +787,13 @@ foreach ($page['filtered_users'] as $num => $local_user)
|
|||
break;
|
||||
}
|
||||
|
||||
$visible_user_list[] = $local_user;
|
||||
}
|
||||
|
||||
$visible_user_list = trigger_event('loc_visible_user_list', $visible_user_list);
|
||||
|
||||
foreach ($visible_user_list as $num => $local_user)
|
||||
{
|
||||
$groups_string = preg_replace(
|
||||
'/(\d+)/e',
|
||||
"\$groups['$1']",
|
||||
|
@ -801,11 +832,12 @@ foreach ($page['filtered_users'] as $num => $local_user)
|
|||
? '<BR />['.l10n('adviser').']' : ''),
|
||||
'EMAIL' => get_email_address_as_display_text($local_user['email']),
|
||||
'GROUPS' => $groups_string,
|
||||
'PROPERTIES' =>
|
||||
'PROPERTIES' =>
|
||||
(isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
|
||||
? $lang['is_high_enabled'] : $lang['is_high_disabled']
|
||||
? l10n('is_high_enabled') : l10n('is_high_disabled')
|
||||
)
|
||||
);
|
||||
trigger_action('loc_assign_block_var_local_user_list', $local_user);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
@ -134,8 +134,8 @@ $template->assign_vars(
|
|||
get_username($page['user']
|
||||
)
|
||||
),
|
||||
'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
|
||||
'L_CAT_OPTIONS_TRUE'=>l10n('authorized'),
|
||||
'L_CAT_OPTIONS_FALSE'=>l10n('forbidden'),
|
||||
|
||||
'F_ACTION' =>
|
||||
PHPWG_ROOT_PATH.
|
||||
|
|
|
@ -157,7 +157,7 @@ VALUES (' . "
|
|||
$template->assign_block_vars(
|
||||
'update_result',
|
||||
array(
|
||||
'UPD_ELEMENT'=> $lang['ws_adding_legend'].$lang['ws_success_upd'],
|
||||
'UPD_ELEMENT'=> l10n('ws_adding_legend').l10n('ws_success_upd'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -179,14 +179,14 @@ if (isset($_POST['wsu_submit']))
|
|||
$template->assign_block_vars(
|
||||
'update_result',
|
||||
array(
|
||||
'UPD_ELEMENT'=> $lang['ws_update_legend'].$lang['ws_success_upd'],
|
||||
'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_success_upd'),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$template->assign_block_vars(
|
||||
'update_result',
|
||||
array(
|
||||
'UPD_ELEMENT'=> $lang['ws_update_legend'].$lang['ws_failed_upd'],
|
||||
'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_failed_upd'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -205,15 +205,15 @@ if (isset($_POST['wsX_submit']))
|
|||
$template->assign_block_vars(
|
||||
'update_result',
|
||||
array(
|
||||
'UPD_ELEMENT'=> $lang['ws_delete_legend'].$lang['ws_success_upd'],
|
||||
'UPD_ELEMENT'=> l10n('ws_delete_legend').l10n('ws_success_upd'),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$template->assign_block_vars(
|
||||
'update_result',
|
||||
array(
|
||||
'UPD_ELEMENT'=> $lang['Not selected / Not confirmed']
|
||||
.$lang['ws_failed_upd'],
|
||||
'UPD_ELEMENT'=> l10n('Not selected / Not confirmed')
|
||||
.l10n('ws_failed_upd'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ if ( isset($_GET['cat']) )
|
|||
$url = make_index_url($url_params);
|
||||
if (!headers_sent())
|
||||
{
|
||||
set_status_header(302);
|
||||
set_status_header(301);
|
||||
redirect_http( $url );
|
||||
}
|
||||
redirect ( $url );
|
||||
|
|
|
@ -69,7 +69,7 @@ $page['since'] = isset($_GET['since']) ? $_GET['since'] : 4;
|
|||
//
|
||||
$page['sort_by'] = 'date';
|
||||
// if the form was submitted, it overloads default behaviour
|
||||
if (isset($_GET['sort_by']))
|
||||
if (isset($_GET['sort_by']) and isset($sort_by[$_GET['sort_by']]) )
|
||||
{
|
||||
$page['sort_by'] = $_GET['sort_by'];
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ if (isset($_GET['sort_by']))
|
|||
//
|
||||
$page['sort_order'] = $sort_order['descending'];
|
||||
// if the form was submitted, it overloads default behaviour
|
||||
if (isset($_GET['sort_order']))
|
||||
if (isset($_GET['sort_order']) and isset($sort_order[$_GET['sort_order']]))
|
||||
{
|
||||
$page['sort_order'] = $sort_order[$_GET['sort_order']];
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ if (isset($_GET['keyword']) and !empty($_GET['keyword']))
|
|||
'$s',
|
||||
'return "content LIKE \'%$s%\'";'
|
||||
),
|
||||
preg_split('/[\s,;]+/', $keyword)
|
||||
preg_split('/[\s,;]+/', $_GET['keyword'] )
|
||||
)
|
||||
).
|
||||
')';
|
||||
|
@ -411,7 +411,7 @@ SELECT id, name, permalink, uppercats
|
|||
'U_PICTURE' => $url,
|
||||
'TN_SRC' => $thumbnail_src,
|
||||
'ALT' => $name,
|
||||
'AUTHOR' => $author,
|
||||
'AUTHOR' => trigger_event('render_comment_author', $author),
|
||||
'DATE'=>format_date($comment['date'],'mysql_datetime',true),
|
||||
'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
|
||||
));
|
||||
|
|
19
feed.php
19
feed.php
|
@ -117,6 +117,7 @@ $rss->link = $conf['gallery_url'];
|
|||
// | Feed creation |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$news = array();
|
||||
if (!$image_only)
|
||||
{
|
||||
$news = news($feed_row['last_check'], $dbnow, true, true);
|
||||
|
@ -151,15 +152,17 @@ UPDATE '.USER_FEED_TABLE.'
|
|||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !empty($feed_id) )
|
||||
{// update the last check to avoid deletion by maintenance task
|
||||
|
||||
if ( !empty($feed_id) and empty($news) )
|
||||
{// update the last check from time to time to avoid deletion by maintenance tasks
|
||||
if ( !isset($feed_row['last_check'])
|
||||
or time()-mysqldt_to_ts($feed_row['last_check']) > 30*24*3600 )
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.USER_FEED_TABLE.'
|
||||
SET last_check = \''.$dbnow.'\'
|
||||
WHERE id = \''.$feed_id.'\'
|
||||
;';
|
||||
UPDATE '.USER_FEED_TABLE.'
|
||||
SET last_check = DATE_ADD(\''.$dbnow.'\', INTERVAL -15 DAY )
|
||||
WHERE id = \''.$feed_id.'\'
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -43,7 +42,7 @@ if ( !empty($_GET['redirect']) )
|
|||
$redirect_to = urldecode($_GET['redirect']);
|
||||
if ( $user['is_the_guest'] )
|
||||
{
|
||||
array_push($errors, $lang['access_forbiden']);
|
||||
array_push($errors, l10n('access_forbiden'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +56,7 @@ if (isset($_POST['login']))
|
|||
}
|
||||
else
|
||||
{
|
||||
array_push( $errors, $lang['invalid_pwd'] );
|
||||
array_push( $errors, l10n('invalid_pwd') );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +64,7 @@ if (isset($_POST['login']))
|
|||
//
|
||||
// Start output of page
|
||||
//
|
||||
$title = $lang['identification'];
|
||||
$title = l10n('identification');
|
||||
$page['body_id'] = 'theIdentificationPage';
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ else
|
|||
// $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE
|
||||
$query = '
|
||||
SELECT
|
||||
id, name, permalink, representative_picture_id, comment, nb_images,
|
||||
id, name, permalink, representative_picture_id, comment, nb_images, uppercats,
|
||||
date_last, max_date_last, count_images, count_categories
|
||||
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
||||
ON id = cat_id and user_id = '.$user['id'].'
|
||||
|
@ -95,8 +95,8 @@ SELECT image_id
|
|||
FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
|
||||
ON ic.category_id = c.id';
|
||||
$query.= '
|
||||
WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
|
||||
'.get_sql_condition_FandF
|
||||
WHERE (c.id='.$row['id'].' OR uppercats LIKE \''.$row['uppercats'].',%\')'
|
||||
.get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
|
@ -104,7 +104,7 @@ SELECT image_id
|
|||
'visible_categories' => 'c.id',
|
||||
'visible_images' => 'image_id'
|
||||
),
|
||||
'AND'
|
||||
"\n AND"
|
||||
).'
|
||||
ORDER BY RAND()
|
||||
LIMIT 0,1
|
||||
|
@ -121,15 +121,15 @@ SELECT image_id
|
|||
SELECT representative_picture_id
|
||||
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
||||
ON id = cat_id and user_id = '.$user['id'].'
|
||||
WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
|
||||
AND representative_picture_id IS NOT NULL
|
||||
'.get_sql_condition_FandF
|
||||
WHERE uppercats LIKE \''.$row['uppercats'].',%\'
|
||||
AND representative_picture_id IS NOT NULL'
|
||||
.get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
'visible_categories' => 'id',
|
||||
),
|
||||
'AND'
|
||||
"\n AND"
|
||||
).'
|
||||
ORDER BY RAND()
|
||||
LIMIT 0,1
|
||||
|
@ -177,6 +177,7 @@ if (count($categories) > 0)
|
|||
{
|
||||
update_cats_with_filtered_data($categories);
|
||||
}
|
||||
|
||||
trigger_action('loc_begin_index_category_thumbnails', $categories);
|
||||
if ($conf['subcatify'])
|
||||
{
|
||||
|
@ -184,7 +185,12 @@ if (count($categories) > 0)
|
|||
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
$comment = strip_tags(@$category['comment'], '<a><br><p><b><i><small><strong><font>');
|
||||
$category['name'] = trigger_event(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'subcatify_category_name'
|
||||
);
|
||||
|
||||
if ($page['section']=='recent_cats')
|
||||
{
|
||||
$name = get_cat_display_name_cache($category['uppercats'], null, false);
|
||||
|
@ -200,8 +206,8 @@ if (count($categories) > 0)
|
|||
'categories.category',
|
||||
array(
|
||||
'SRC' => $thumbnail_src_of[$category['representative_picture_id']],
|
||||
'ALT' => $category['name'],
|
||||
'TITLE' => $lang['hint_category'],
|
||||
'ALT' => strip_tags($category['name']),
|
||||
'TITLE' => l10n('hint_category'),
|
||||
'ICON' => $icon_ts,
|
||||
|
||||
'URL' => make_index_url(
|
||||
|
@ -217,11 +223,15 @@ if (count($categories) > 0)
|
|||
true,
|
||||
'<br />'
|
||||
),
|
||||
'DESCRIPTION' => @$comment,
|
||||
'DESCRIPTION' =>
|
||||
trigger_event('render_category_literal_description',
|
||||
trigger_event('render_category_description',
|
||||
@$category['comment'],
|
||||
'subcatify_category_description')),
|
||||
'NAME' => $name,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
//plugins need to add/modify sth in this loop ?
|
||||
trigger_action('loc_index_category_thumbnail',
|
||||
$category, 'categories.category' );
|
||||
|
@ -245,11 +255,17 @@ if (count($categories) > 0)
|
|||
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
$category['name'] = trigger_event(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'thumbnail_category_name'
|
||||
);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'thumbnails.line.thumbnail',
|
||||
array(
|
||||
'IMAGE' => $thumbnail_src_of[ $category['representative_picture_id'] ],
|
||||
'IMAGE_ALT' => $category['name'],
|
||||
'IMAGE_ALT' => strip_tags($category['name']),
|
||||
'IMAGE_TITLE' => get_display_images_count
|
||||
(
|
||||
$category['nb_images'],
|
||||
|
@ -306,8 +322,8 @@ if (count($categories) > 0)
|
|||
}
|
||||
|
||||
$template->assign_var_from_handle('CATEGORIES', 'thumbnails');
|
||||
unset( $template->_tpldata['thumbnails.'] );//maybe write a func for that
|
||||
$template->delete_block_vars('thumbnails', true); // category_default reuse them
|
||||
}
|
||||
trigger_action('loc_end_index_category_thumbnails', $categories);
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -105,7 +105,7 @@ foreach ($pictures as $row)
|
|||
'CLASS'=> set_span_class($row['hit']) . ' nb-hits',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($conf['show_thumbnail_caption'])
|
||||
|
@ -129,12 +129,9 @@ foreach ($pictures as $row)
|
|||
}
|
||||
case 'most_visited' :
|
||||
{
|
||||
$name = '('.$row['hit'].') '.$name;
|
||||
break;
|
||||
}
|
||||
case 'search' :
|
||||
{
|
||||
$name = replace_search($name, $page['search']);
|
||||
if ( !$user['show_nb_hits']) {
|
||||
$name = '('.$row['hit'].') '.$name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +156,7 @@ SELECT COUNT(*) AS nb_comments
|
|||
$template->assign_block_vars(
|
||||
'thumbnails.line.thumbnail.nb_comments',
|
||||
array(
|
||||
'NB_COMMENTS'=> l10n_dec('%d comment', '%d comments',
|
||||
'NB_COMMENTS'=> l10n_dec('%d comment', '%d comments',
|
||||
$row['nb_comments']),
|
||||
'CLASS'=> set_span_class($row['nb_comments']) . ' nb-comments',
|
||||
)
|
||||
|
|
160
include/class_smtp_mail.inc.php
Normal file
160
include/class_smtp_mail.inc.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// These function were originally a part of the punBB.
|
||||
|
||||
class smtp_mail
|
||||
{
|
||||
var $socket;
|
||||
var $no_error;
|
||||
var $host;
|
||||
var $user;
|
||||
var $password;
|
||||
var $email_webmaster;
|
||||
|
||||
function smtp_mail($host, $user, $password, $email_webmaster)
|
||||
{
|
||||
$this->host = $host;
|
||||
$this->user = $user;
|
||||
$this->password = $password;
|
||||
$this->email_webmaster = $email_webmaster;
|
||||
}
|
||||
|
||||
// Adaptation of server_parse
|
||||
function server_parse($expected_response)
|
||||
{
|
||||
if ($this->no_error)
|
||||
{
|
||||
$server_response = '';
|
||||
while (substr($server_response, 3, 1) != ' ')
|
||||
{
|
||||
if (!($server_response = fgets($this->socket, 256)))
|
||||
{
|
||||
trigger_error('Couldn\'t get mail server response codes.', E_USER_WARNING);
|
||||
$this->no_error = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->no_error)
|
||||
{
|
||||
if (!(substr($server_response, 0, 3) == $expected_response))
|
||||
{
|
||||
trigger_error('Unable to send e-mail. Error message reported by the SMTP server: "'.$server_response.'"', E_USER_WARNING);
|
||||
$this->no_error = false;
|
||||
}
|
||||
}
|
||||
return $this->no_error;
|
||||
}
|
||||
|
||||
function server_write($s)
|
||||
{
|
||||
$this->no_error = $this->no_error && (fwrite($this->socket, $s) !== false);
|
||||
return $this->no_error;
|
||||
}
|
||||
|
||||
// Adaptation of pun_mail
|
||||
function mail($to, $subject, $message, $headers = '')
|
||||
{
|
||||
$this->no_error = true;
|
||||
|
||||
$recipients = explode(',', $to);
|
||||
|
||||
// Are we using port 25 or a custom port?
|
||||
if (strpos($this->host, ':') !== false)
|
||||
{
|
||||
list($smtp_host, $smtp_port) = explode(':', $this->host);
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtp_host = $this->host;
|
||||
$smtp_port = 25;
|
||||
}
|
||||
|
||||
if ($this->socket = fsockopen($smtp_host, $smtp_port, $errno, $errstr, 15))
|
||||
{
|
||||
$this->server_parse('220');
|
||||
|
||||
if (!empty($this->user) && !empty($this->password))
|
||||
{
|
||||
$this->server_write('EHLO '.$smtp_host."\r\n");
|
||||
$this->server_parse('250');
|
||||
|
||||
$this->server_write('AUTH LOGIN'."\r\n");
|
||||
$this->server_parse('334');
|
||||
|
||||
$this->server_write(base64_encode($this->user)."\r\n");
|
||||
$this->no_error = $this->no_error && $this->no_error = $this->server_parse('334');
|
||||
|
||||
$this->server_write(base64_encode($this->password)."\r\n");
|
||||
$this->server_parse('235');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->server_write('HELO '.$smtp_host."\r\n");
|
||||
$this->server_parse('250');
|
||||
}
|
||||
|
||||
$this->server_write('MAIL FROM: <'.$this->email_webmaster.'>'."\r\n");
|
||||
$this->server_parse('250');
|
||||
|
||||
if (preg_match('/^\s*to\s*:.*/mi', $headers) === 0)
|
||||
{
|
||||
$to_header = 'To: '.implode(',', array_map(create_function('$email','return "<".$email.">";'), $recipients));
|
||||
}
|
||||
else
|
||||
{
|
||||
$to_header = '';
|
||||
}
|
||||
|
||||
@reset($recipients);
|
||||
while (list(, $email) = @each($recipients))
|
||||
{
|
||||
$this->server_write('RCPT TO: <'.$email.'>'."\r\n");
|
||||
$this->server_parse('250');
|
||||
}
|
||||
|
||||
$this->server_write('DATA'."\r\n");
|
||||
$this->server_parse('354');
|
||||
|
||||
$this->server_write('Subject: '.$subject."\r\n".(empty($to_header) ? "" : $to_header."\r\n").$headers."\r\n\r\n".$message."\r\n");
|
||||
$this->server_write('.'."\r\n");
|
||||
$this->server_parse('250');
|
||||
|
||||
$this->server_write('QUIT'."\r\n");
|
||||
fclose($this->socket);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('Could not connect to smtp host "'.$this->host.'" ('.$errno.') ('.$errstr.')', E_USER_WARNING);
|
||||
$this->no_error = false;;
|
||||
}
|
||||
|
||||
return $this->no_error;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -2,7 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $Id$
|
||||
|
@ -102,6 +102,10 @@ if( !get_magic_quotes_gpc() )
|
|||
@reset($_COOKIE);
|
||||
}
|
||||
}
|
||||
if ( !empty($_SERVER["PATH_INFO"]) )
|
||||
{
|
||||
$_SERVER["PATH_INFO"] = addslashes($_SERVER["PATH_INFO"]);
|
||||
}
|
||||
|
||||
//
|
||||
// Define some basic configuration arrays this also prevents malicious
|
||||
|
@ -113,6 +117,7 @@ $user = array();
|
|||
$lang = array();
|
||||
$header_msgs = array();
|
||||
$header_notes = array();
|
||||
$filter = array();
|
||||
|
||||
@include(PHPWG_ROOT_PATH .'include/mysql.inc.php');
|
||||
if (!defined('PHPWG_INSTALLED'))
|
||||
|
@ -124,6 +129,7 @@ if (!defined('PHPWG_INSTALLED'))
|
|||
foreach( array(
|
||||
'array_intersect_key', //PHP 5 >= 5.1.0RC1
|
||||
'hash_hmac', //(hash) - enabled by default as of PHP 5.1.2
|
||||
'preg_last_error', // PHP 5 >= 5.2.0
|
||||
) as $func)
|
||||
{
|
||||
if (!function_exists($func))
|
||||
|
@ -139,10 +145,8 @@ include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
|
|||
include(PHPWG_ROOT_PATH . 'include/template.php');
|
||||
|
||||
// Database connection
|
||||
mysql_connect( $cfgHote, $cfgUser, $cfgPassword )
|
||||
or die ( "Could not connect to database server" );
|
||||
mysql_select_db( $cfgBase )
|
||||
or die ( "Could not connect to database" );
|
||||
@mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or my_error( 'mysql_connect', true );
|
||||
@mysql_select_db( $cfgBase ) or my_error( 'mysql_select_db', true );
|
||||
|
||||
//
|
||||
// Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
|
||||
|
@ -167,19 +171,40 @@ trigger_action('loading_lang');
|
|||
// include/user.inc.php)
|
||||
if ($user['is_the_guest'])
|
||||
{
|
||||
$user['username'] = $lang['guest'];
|
||||
$user['username'] = l10n('guest');
|
||||
}
|
||||
|
||||
// template instance
|
||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
|
||||
if
|
||||
(
|
||||
defined('IN_ADMIN') and IN_ADMIN and
|
||||
isset($user['admin_template']) and
|
||||
isset($user['admin_theme'])
|
||||
)
|
||||
{
|
||||
// Admin template
|
||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['admin_template'], $user['admin_theme'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Classic template
|
||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
|
||||
}
|
||||
|
||||
if (isset($user['internal_status']['guest_must_be_guest'])
|
||||
and
|
||||
$user['internal_status']['guest_must_be_guest'] === true)
|
||||
{
|
||||
$header_msgs[] = l10n('guest_must_be_guest');
|
||||
}
|
||||
|
||||
if ($conf['gallery_locked'])
|
||||
{
|
||||
$header_msgs[] = $lang['gallery_locked_message'];
|
||||
$header_msgs[] = l10n('gallery_locked_message');
|
||||
|
||||
if ( script_basename() != 'identification' and !is_admin() )
|
||||
{
|
||||
echo $lang['gallery_locked_message']
|
||||
echo l10n('gallery_locked_message')
|
||||
.'<a href="'.get_absolute_root_url(false).'identification.php">.</a>';
|
||||
exit();
|
||||
}
|
||||
|
@ -210,7 +235,7 @@ SELECT id
|
|||
|
||||
if (is_adviser())
|
||||
{
|
||||
$header_msgs[] = $lang['adviser_mode_enabled'];
|
||||
$header_msgs[] = l10n('adviser_mode_enabled');
|
||||
}
|
||||
|
||||
if (count($header_msgs) > 0)
|
||||
|
@ -230,8 +255,6 @@ if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
|
|||
}
|
||||
else
|
||||
{
|
||||
// global variable for filter
|
||||
$filter = array();
|
||||
$filter['enabled'] = false;
|
||||
}
|
||||
|
||||
|
@ -241,7 +264,10 @@ if (isset($conf['header_notes']))
|
|||
}
|
||||
|
||||
// default event handlers
|
||||
add_event_handler('render_category_literal_description', 'render_category_literal_description');
|
||||
add_event_handler('render_category_description', 'render_category_description');
|
||||
add_event_handler('render_comment_content', 'htmlspecialchars');
|
||||
add_event_handler('render_comment_content', 'parse_comment_content');
|
||||
add_event_handler('render_comment_author', 'strip_tags');
|
||||
trigger_action('init');
|
||||
?>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -267,17 +267,27 @@ $conf['mail_options'] = false;
|
|||
// or test.
|
||||
$conf['send_bcc_mail_webmaster'] = false;
|
||||
|
||||
// enabled_format_email:
|
||||
// on true email will be formatted with name and address
|
||||
// on false email will be only address
|
||||
// There are webhosting wich not allow email formatted (Lycos, ...)
|
||||
$conf['enabled_format_email'] = true;
|
||||
|
||||
// default_email_format:
|
||||
// Define the default email format use to send email
|
||||
// Value could be text/plain or text/html
|
||||
$conf['default_email_format'] = 'text/html';
|
||||
|
||||
// define the name of sender mail:
|
||||
// If value is empty, gallery title is used
|
||||
$conf['mail_sender_name'] = '';
|
||||
|
||||
// smtp configuration
|
||||
// (work if fsockopen function is allowed for smtp port)
|
||||
// smtp_host: smtp server host
|
||||
// if null, regular mail function is used
|
||||
// format: hoststring[:port]
|
||||
// exemple: smtp.pwg.net:21
|
||||
// smtp_user/smtp_password: user & password for smtp identication
|
||||
$conf['smtp_host'] = '';
|
||||
$conf['smtp_user'] = '';
|
||||
$conf['smtp_password'] = '';
|
||||
|
||||
|
||||
// check_upgrade_feed: check if there are database upgrade required. Set to
|
||||
// true, a message will strongly encourage you to upgrade your database if
|
||||
// needed.
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Default settings
|
||||
define('PHPWG_VERSION', 'Alligator');
|
||||
define('PHPWG_VERSION', 'branch 1.7');
|
||||
define('PHPWG_DOMAIN', 'phpwebgallery.net');
|
||||
define('PHPWG_URL', 'http://www.'.PHPWG_DOMAIN);
|
||||
define('PHPWG_DEFAULT_LANGUAGE', 'en_UK.iso-8859-1');
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// global variable for filter
|
||||
$filter = array();
|
||||
|
||||
// $filter['enabled']: Filter is enabled
|
||||
// $filter['check_key']: Check key to valitade computed filter data
|
||||
// $filter['recent_period']: Recent period used to computed filter data
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -28,7 +28,6 @@ include_once( PHPWG_ROOT_PATH .'include/functions_user.inc.php' );
|
|||
include_once( PHPWG_ROOT_PATH .'include/functions_session.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_group.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' );
|
||||
|
@ -298,27 +297,169 @@ function get_picture_size( $original_width, $original_height,
|
|||
return $picture_size;
|
||||
}
|
||||
|
||||
/* Returns true if the string appears to be encoded in UTF-8. (from wordpress)
|
||||
* @param string Str
|
||||
*/
|
||||
function seems_utf8($Str) { # by bmorel at ssi dot fr
|
||||
for ($i=0; $i<strlen($Str); $i++) {
|
||||
if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
|
||||
elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
|
||||
elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb
|
||||
elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb
|
||||
elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb
|
||||
elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
|
||||
else return false; # Does not match any model
|
||||
for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
|
||||
if ((++$i == strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Remove accents from a UTF-8 or ISO-859-1 string (from wordpress)
|
||||
* @param string sstring - an UTF-8 or ISO-8859-1 string
|
||||
*/
|
||||
function remove_accents($string)
|
||||
{
|
||||
if ( !preg_match('/[\x80-\xff]/', $string) )
|
||||
return $string;
|
||||
|
||||
if (seems_utf8($string)) {
|
||||
$chars = array(
|
||||
// Decompositions for Latin-1 Supplement
|
||||
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
|
||||
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
|
||||
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
|
||||
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
|
||||
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
|
||||
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
|
||||
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
|
||||
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
|
||||
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
|
||||
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
|
||||
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
|
||||
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
|
||||
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
|
||||
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
|
||||
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
|
||||
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
|
||||
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
|
||||
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
|
||||
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
|
||||
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
|
||||
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
|
||||
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
|
||||
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
|
||||
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
|
||||
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
|
||||
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
|
||||
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
|
||||
chr(195).chr(191) => 'y',
|
||||
// Decompositions for Latin Extended-A
|
||||
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
|
||||
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
|
||||
chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
|
||||
chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
|
||||
chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
|
||||
chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
|
||||
chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
|
||||
chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
|
||||
chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
|
||||
chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
|
||||
chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
|
||||
chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
|
||||
chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
|
||||
chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
|
||||
chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
|
||||
chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
|
||||
chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
|
||||
chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
|
||||
chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
|
||||
chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
|
||||
chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
|
||||
chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
|
||||
chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
|
||||
chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
|
||||
chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
|
||||
chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
|
||||
chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
|
||||
chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
|
||||
chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
|
||||
chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
|
||||
chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
|
||||
chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
|
||||
chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
|
||||
chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
|
||||
chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
|
||||
chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
|
||||
chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
|
||||
chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
|
||||
chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
|
||||
chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
|
||||
chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
|
||||
chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
|
||||
chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
|
||||
chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
|
||||
chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
|
||||
chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
|
||||
chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
|
||||
chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
|
||||
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
|
||||
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
|
||||
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
|
||||
chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
|
||||
chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
|
||||
chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
|
||||
chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
|
||||
chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
|
||||
chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
|
||||
chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
|
||||
chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
|
||||
chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
|
||||
chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
|
||||
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
|
||||
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
|
||||
chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
|
||||
// Euro Sign
|
||||
chr(226).chr(130).chr(172) => 'E',
|
||||
// GBP (Pound) Sign
|
||||
chr(194).chr(163) => '');
|
||||
|
||||
$string = strtr($string, $chars);
|
||||
} else {
|
||||
// Assume ISO-8859-1 if not UTF-8
|
||||
$chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158)
|
||||
.chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194)
|
||||
.chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202)
|
||||
.chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210)
|
||||
.chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218)
|
||||
.chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227)
|
||||
.chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235)
|
||||
.chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243)
|
||||
.chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251)
|
||||
.chr(252).chr(253).chr(255);
|
||||
|
||||
$chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";
|
||||
|
||||
$string = strtr($string, $chars['in'], $chars['out']);
|
||||
$double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254));
|
||||
$double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th');
|
||||
$string = str_replace($double_chars['in'], $double_chars['out'], $string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* simplify a string to insert it into an URL
|
||||
*
|
||||
* based on str2url function from Dotclear
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function str2url($str)
|
||||
{
|
||||
$str = strtr(
|
||||
$str,
|
||||
'ÀÁÂÃÄÅàáâãäåÇçÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûü¾ÝÿýÑñ',
|
||||
'AAAAAAaaaaaaCcOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuYYyyNn'
|
||||
);
|
||||
|
||||
$str = str_replace('Æ', 'AE', $str);
|
||||
$str = str_replace('æ', 'ae', $str);
|
||||
$str = str_replace('¼', 'OE', $str);
|
||||
$str = str_replace('½', 'oe', $str);
|
||||
|
||||
$str = remove_accents($str);
|
||||
$str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str));
|
||||
$str = preg_replace('/[\s\'\:\/\[\],-]+/',' ',trim($str));
|
||||
$res = str_replace(' ','_',$str);
|
||||
|
@ -354,61 +495,6 @@ function get_languages()
|
|||
return $languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* replaces the $search into <span style="$style">$search</span> in the
|
||||
* given $string.
|
||||
*
|
||||
* case insensitive replacements, does not replace characters in HTML tags
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $search
|
||||
* @param string $style
|
||||
* @return string
|
||||
*/
|
||||
function add_style( $string, $search, $style )
|
||||
{
|
||||
//return $string;
|
||||
$return_string = '';
|
||||
$remaining = $string;
|
||||
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
$start = strpos ( $remaining, '<' );
|
||||
$end = strpos ( $remaining, '>' );
|
||||
while ( is_numeric( $start ) and is_numeric( $end ) )
|
||||
{
|
||||
$treatment = substr ( $remaining, 0, $start );
|
||||
$treatment = preg_replace( '/('.$search.')/i',
|
||||
'<span style="'.$style.'">\\0</span>',
|
||||
$treatment );
|
||||
$return_string.= $treatment.substr( $remaining, $start, $end-$start+1 );
|
||||
$remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
|
||||
$start = strpos ( $remaining, '<' );
|
||||
$end = strpos ( $remaining, '>' );
|
||||
}
|
||||
$treatment = preg_replace( '/('.$search.')/i',
|
||||
'<span style="'.$style.'">\\0</span>',
|
||||
$remaining );
|
||||
$return_string.= $treatment;
|
||||
|
||||
return $return_string;
|
||||
}
|
||||
|
||||
// replace_search replaces a searched words array string by the search in
|
||||
// another style for the given $string.
|
||||
function replace_search( $string, $search )
|
||||
{
|
||||
// FIXME : with new advanced search, this function needs a rewrite
|
||||
return $string;
|
||||
|
||||
$words = explode( ',', $search );
|
||||
$style = 'background-color:white;color:red;';
|
||||
foreach ( $words as $word ) {
|
||||
$string = add_style( $string, $word, $style );
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function pwg_log($image_id = null, $image_type = null)
|
||||
{
|
||||
global $conf, $user, $page;
|
||||
|
@ -428,7 +514,7 @@ function pwg_log($image_id = null, $image_type = null)
|
|||
}
|
||||
|
||||
$do_log = trigger_event('pwg_log_allowed', $do_log, $image_id, $image_type);
|
||||
|
||||
|
||||
if (!$do_log)
|
||||
{
|
||||
return false;
|
||||
|
@ -446,19 +532,6 @@ function pwg_log($image_id = null, $image_type = null)
|
|||
$tags_string = implode(',', $tag_ids);
|
||||
}
|
||||
|
||||
// here we ask the database the current date and time, and we extract
|
||||
// {year, month, day} from the current date. We could do this during the
|
||||
// insert query with a CURDATE(), CURTIME(), DATE_FORMAT(CURDATE(), '%Y')
|
||||
// ... but I (plg) think it would cost more than a double query and a PHP
|
||||
// extraction.
|
||||
$query = '
|
||||
SELECT CURDATE(), CURTIME()
|
||||
;';
|
||||
list($curdate, $curtime) = mysql_fetch_row(pwg_query($query));
|
||||
|
||||
list($curyear, $curmonth, $curday) = explode('-', $curdate);
|
||||
list($curhour) = explode(':', $curtime);
|
||||
|
||||
$query = '
|
||||
INSERT INTO '.HISTORY_TABLE.'
|
||||
(
|
||||
|
@ -478,18 +551,18 @@ INSERT INTO '.HISTORY_TABLE.'
|
|||
)
|
||||
VALUES
|
||||
(
|
||||
\''.$curdate.'\',
|
||||
\''.$curtime.'\',
|
||||
'.$curyear.',
|
||||
'.$curmonth.',
|
||||
'.$curday.',
|
||||
'.$curhour.',
|
||||
CURDATE(),
|
||||
CURTIME(),
|
||||
YEAR( CURDATE() ),
|
||||
MONTH( CURDATE() ),
|
||||
DAYOFMONTH( CURDATE() ),
|
||||
HOUR( CURTIME() ),
|
||||
'.$user['id'].',
|
||||
\''.$_SERVER['REMOTE_ADDR'].'\',
|
||||
'.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
|
||||
'.(isset($page['category']) ? $page['category']['id'] : 'NULL').',
|
||||
'.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').',
|
||||
'.(isset($image_id) ? $image_id : 'NULL').',
|
||||
'.(isset($image_id) ? "'".$image_type."'" : 'NULL').',
|
||||
'.(isset($image_type) ? "'".$image_type."'" : 'NULL').',
|
||||
'.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').'
|
||||
)
|
||||
;';
|
||||
|
@ -556,7 +629,7 @@ function pwg_query($query)
|
|||
global $conf,$page,$debug,$t2;
|
||||
|
||||
$start = get_moment();
|
||||
$result = mysql_query($query) or my_error($query."\n");
|
||||
($result = mysql_query($query)) or my_error($query, $conf['die_on_sql_error']);
|
||||
|
||||
$time = get_moment() - $start;
|
||||
|
||||
|
@ -617,6 +690,8 @@ function redirect_http( $url )
|
|||
{
|
||||
ob_clean();
|
||||
}
|
||||
// default url is on html format
|
||||
$url = html_entity_decode($url);
|
||||
header('Request-URI: '.$url);
|
||||
header('Content-Location: '.$url);
|
||||
header('Location: '.$url);
|
||||
|
@ -711,9 +786,10 @@ function redirect( $url , $msg = '', $refresh_time = 0)
|
|||
* returns $_SERVER['QUERY_STRING'] whitout keys given in parameters
|
||||
*
|
||||
* @param array $rejects
|
||||
* @param boolean $escape - if true escape & to & (for html)
|
||||
* @returns string
|
||||
*/
|
||||
function get_query_string_diff($rejects = array())
|
||||
function get_query_string_diff($rejects=array(), $escape=true)
|
||||
{
|
||||
$query_string = '';
|
||||
|
||||
|
@ -725,7 +801,7 @@ function get_query_string_diff($rejects = array())
|
|||
{
|
||||
if (!in_array($key, $rejects))
|
||||
{
|
||||
$query_string.= $is_first ? '?' : '&';
|
||||
$query_string.= $is_first ? '?' : ($escape ? '&' : '&' );
|
||||
$is_first = false;
|
||||
$query_string.= $key.'='.$value;
|
||||
}
|
||||
|
@ -837,7 +913,7 @@ function get_thumbnail_title($element_info)
|
|||
{
|
||||
$thumbnail_title = '';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($element_info['filesize']))
|
||||
{
|
||||
$thumbnail_title .= ' : '.l10n_dec('%d Kb', '%d Kb', $element_info['filesize']);
|
||||
|
@ -848,26 +924,33 @@ function get_thumbnail_title($element_info)
|
|||
|
||||
// my_error returns (or send to standard output) the message concerning the
|
||||
// error occured for the last mysql query.
|
||||
function my_error($header)
|
||||
|
||||
function my_error($header, $die)
|
||||
{
|
||||
global $conf;
|
||||
$error = $header;
|
||||
$error.= "\n[mysql error ".mysql_errno().'] '.mysql_error()."\n";
|
||||
|
||||
$error = '<pre>';
|
||||
$error.= $header;
|
||||
$error.= '[mysql error '.mysql_errno().'] ';
|
||||
$error.= mysql_error();
|
||||
$error.= '</pre>';
|
||||
if (function_exists('debug_backtrace'))
|
||||
{
|
||||
$bt = debug_backtrace();
|
||||
for ($i=0; $i<count($bt); $i++)
|
||||
{
|
||||
$error .= "#$i\t".@$bt[$i]['function']." ".@$bt[$i]['file']."(".@@$bt[$i]['line'].")\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf['die_on_sql_error'])
|
||||
if ($die)
|
||||
{
|
||||
die($error);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $error;
|
||||
@set_status_header(500);
|
||||
echo( str_repeat( ' ', 300)."\n"); //IE doesn't error output if below a size
|
||||
}
|
||||
echo("<pre>");
|
||||
trigger_error($error, $die ? E_USER_ERROR : E_USER_WARNING);
|
||||
!$die || die($error); // just in case the handler didnt die
|
||||
echo("</pre>");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* creates an array based on a query, this function is a very common pattern
|
||||
* used here
|
||||
|
@ -1073,7 +1156,7 @@ function get_l10n_args($key, $args)
|
|||
* returns a string with formated with l10n_args elements
|
||||
*
|
||||
* @param element/array $key_args: element or array of l10n_args elements
|
||||
* @param $sep: if $key_args is array,
|
||||
* @param $sep: if $key_args is array,
|
||||
* separator is used when translated l10n_args elements are concated
|
||||
* @return string
|
||||
*/
|
||||
|
@ -1111,24 +1194,6 @@ function l10n_args($key_args, $sep = "\n")
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate string in string ascii7bits
|
||||
* It's possible to do that with iconv_substr
|
||||
* but this fonction is not avaible on all the providers.
|
||||
*
|
||||
* @param string str
|
||||
* @return string
|
||||
*/
|
||||
function str_translate_to_ascii7bits($str)
|
||||
{
|
||||
global $lang_table_translate_ascii7bits;
|
||||
|
||||
$src_table = array_keys($lang_table_translate_ascii7bits);
|
||||
$dst_table = array_values($lang_table_translate_ascii7bits);
|
||||
|
||||
return str_replace($src_table , $dst_table, $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the corresponding value from $themeconf if existing. Else, the
|
||||
* key is returned
|
||||
|
@ -1294,21 +1359,34 @@ function hash_from_query($query, $keyname)
|
|||
*/
|
||||
function script_basename()
|
||||
{
|
||||
if (!empty($_SERVER['SCRIPT_NAME']))
|
||||
global $conf;
|
||||
|
||||
foreach (array('SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF') as $value)
|
||||
{
|
||||
$file_name = $_SERVER['SCRIPT_NAME'];
|
||||
}
|
||||
else if (!empty($_SERVER['SCRIPT_FILENAME']))
|
||||
{
|
||||
$file_name = $_SERVER['SCRIPT_FILENAME'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_name = '';
|
||||
$continue = !empty($_SERVER[$value]);
|
||||
if ($continue)
|
||||
{
|
||||
$filename = strtolower($_SERVER[$value]);
|
||||
|
||||
if ($conf['php_extension_in_urls'])
|
||||
{
|
||||
$continue = get_extension($filename) === 'php';
|
||||
}
|
||||
|
||||
if ($continue)
|
||||
{
|
||||
$basename = basename($filename, '.php');
|
||||
$continue = !empty($basename);
|
||||
}
|
||||
|
||||
if ($continue)
|
||||
{
|
||||
return $basename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $_SERVER return lower string following var and systems
|
||||
return basename(strtolower($file_name), '.php');
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,29 +72,33 @@ FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
|||
// Always expand when filter is activated
|
||||
if (!$user['expand'] and !$filter['enabled'])
|
||||
{
|
||||
$query.= '
|
||||
WHERE
|
||||
$where = '
|
||||
(id_uppercat is NULL';
|
||||
if (isset($page['category']))
|
||||
{
|
||||
$query.= ' OR id_uppercat IN ('.$page['category']['uppercats'].')';
|
||||
$where .= ' OR id_uppercat IN ('.$page['category']['uppercats'].')';
|
||||
}
|
||||
$query.= ')';
|
||||
$where .= ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= '
|
||||
$where = '
|
||||
'.get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
'visible_categories' => 'id',
|
||||
),
|
||||
'WHERE'
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$where = trigger_event('get_categories_menu_sql_where',
|
||||
$where, $user['expand'], $filter['enabled'] );
|
||||
|
||||
$query.= '
|
||||
WHERE '.$where.'
|
||||
;';
|
||||
|
||||
$result = pwg_query($query);
|
||||
|
@ -152,12 +156,6 @@ SELECT *
|
|||
$cat[$k] = get_boolean( $cat[$k] );
|
||||
}
|
||||
}
|
||||
global $conf;
|
||||
if ( !( $conf['allow_html_descriptions'] and
|
||||
preg_match('/<(div|br|img|script).*>/i', $cat['comment']) ) )
|
||||
{
|
||||
$cat['comment'] = nl2br(@$cat['comment']);
|
||||
}
|
||||
|
||||
$upper_ids = explode(',', $cat['uppercats']);
|
||||
if ( count($upper_ids)==1 )
|
||||
|
@ -298,7 +296,14 @@ function display_select_categories($categories,
|
|||
{
|
||||
$option = str_repeat(' ',
|
||||
(3 * substr_count($category['global_rank'], '.')));
|
||||
$option.= '- '.$category['name'];
|
||||
$option.= '- ';
|
||||
$option.= strip_tags(
|
||||
trigger_event(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'display_select_categories'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars(
|
||||
|
@ -441,7 +446,7 @@ function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_
|
|||
$cat_count_images-= $cat_nb_images;
|
||||
$cat_nb_images = 0;
|
||||
}
|
||||
|
||||
|
||||
//at least one image direct or indirect
|
||||
$display_text.= l10n_dec('image_available', 'images_available', $cat_count_images);
|
||||
|
||||
|
@ -462,4 +467,4 @@ function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_
|
|||
return $display_text;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -189,8 +189,12 @@ INSERT INTO '.COMMENTS_TABLE.'
|
|||
|
||||
$comm['id'] = mysql_insert_id();
|
||||
|
||||
if ( ($comment_action=='validate' and $conf['email_admin_on_comment'])
|
||||
or $conf['email_admin_on_comment_validation'] )
|
||||
if
|
||||
(
|
||||
($comment_action=='validate' and $conf['email_admin_on_comment'])
|
||||
or
|
||||
($comment_action!='validate' and $conf['email_admin_on_comment_validation'])
|
||||
)
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function get_icon($date, $is_child_date = false)
|
|||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
if (isset($page['get_icon_cache'][$date]))
|
||||
{
|
||||
if (! $page['get_icon_cache'][$date] )
|
||||
|
@ -40,38 +40,22 @@ function get_icon($date, $is_child_date = false)
|
|||
return $page['get_icon_cache']['_icons_'][$is_child_date];
|
||||
}
|
||||
|
||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches))
|
||||
{// date can be empty, no icon to display
|
||||
$page['get_icon_cache'][$date] = false;
|
||||
return '';
|
||||
}
|
||||
|
||||
list($devnull, $year, $month, $day) = $matches;
|
||||
$unixtime = mktime( 0, 0, 0, $month, $day, $year );
|
||||
if ($unixtime === false // PHP 5.1.0 and above
|
||||
or $unixtime === -1) // PHP prior to 5.1.0
|
||||
{
|
||||
$page['get_icon_cache'][$date] = false;
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!isset($page['get_icon_cache']['unix_timestamp']))
|
||||
if (!isset($page['get_icon_cache']['sql_recent_date']))
|
||||
{
|
||||
// Use MySql date in order to standardize all recent "actions/queries"
|
||||
list($page['get_icon_cache']['unix_timestamp']) =
|
||||
mysql_fetch_array(pwg_query('select UNIX_TIMESTAMP(CURRENT_DATE)'));
|
||||
list($page['get_icon_cache']['sql_recent_date']) =
|
||||
mysql_fetch_array(pwg_query('select SUBDATE(
|
||||
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
|
||||
}
|
||||
|
||||
$diff = $page['get_icon_cache']['unix_timestamp'] - $unixtime;
|
||||
$day_in_seconds = 24*60*60;
|
||||
$page['get_icon_cache'][$date] = false;
|
||||
if ( $diff <= $user['recent_period'] * $day_in_seconds )
|
||||
if ( $date > $page['get_icon_cache']['sql_recent_date'] )
|
||||
{
|
||||
if ( !isset($page['get_icon_cache']['_icons_'] ) )
|
||||
{
|
||||
$icons = array(false => 'recent', true => 'recent_by_child' );
|
||||
$title = $lang['recent_image'].' '.$user['recent_period']
|
||||
.' '.$lang['days'];
|
||||
$title = l10n('recent_image').' '.$user['recent_period']
|
||||
.' '.l10n('days');
|
||||
foreach ($icons as $key => $icon)
|
||||
{
|
||||
$icon_url = get_themeconf('icon_dir').'/'.$icon.'.png';
|
||||
|
@ -84,12 +68,12 @@ function get_icon($date, $is_child_date = false)
|
|||
}
|
||||
$page['get_icon_cache'][$date] = true;
|
||||
}
|
||||
|
||||
if (! $page['get_icon_cache'][$date] )
|
||||
return '';
|
||||
return $page['get_icon_cache']['_icons_'][$is_child_date];
|
||||
}
|
||||
|
||||
|
||||
function create_navigation_bar(
|
||||
$url, $nb_element, $start, $nb_element_page, $clean_url = false
|
||||
)
|
||||
|
@ -121,13 +105,13 @@ function create_navigation_bar(
|
|||
if ($cur_page != 1)
|
||||
{
|
||||
$navbar.=
|
||||
'<a href="'.$url.'" rel="start">'
|
||||
.$lang['first_page']
|
||||
'<a href="'.$url.'" rel="first">'
|
||||
.l10n('first_page')
|
||||
.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$navbar.= $lang['first_page'];
|
||||
$navbar.= l10n('first_page');
|
||||
}
|
||||
$navbar.= ' | ';
|
||||
// link on previous page ?
|
||||
|
@ -139,12 +123,12 @@ function create_navigation_bar(
|
|||
'<a href="'
|
||||
.$url.($previous > 0 ? $start_str.$previous : '')
|
||||
.'" rel="prev">'
|
||||
.$lang['previous_page']
|
||||
.l10n('previous_page')
|
||||
.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$navbar.= $lang['previous_page'];
|
||||
$navbar.= l10n('previous_page');
|
||||
}
|
||||
$navbar.= ' |';
|
||||
|
||||
|
@ -210,12 +194,12 @@ function create_navigation_bar(
|
|||
|
||||
$navbar.=
|
||||
'<a href="'.$url.$start_str.$next.'" rel="next">'
|
||||
.$lang['next_page']
|
||||
.l10n('next_page')
|
||||
.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$navbar.= $lang['next_page'];
|
||||
$navbar.= l10n('next_page');
|
||||
}
|
||||
|
||||
$navbar.= ' | ';
|
||||
|
@ -226,12 +210,12 @@ function create_navigation_bar(
|
|||
|
||||
$navbar.=
|
||||
'<a href="'.$url.$start_str.$temp_start.'" rel="last">'
|
||||
.$lang['last_page']
|
||||
.l10n('last_page')
|
||||
.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$navbar.= $lang['last_page'];
|
||||
$navbar.= l10n('last_page');
|
||||
}
|
||||
}
|
||||
return $navbar;
|
||||
|
@ -263,6 +247,13 @@ function get_cat_display_name($cat_informations,
|
|||
is_array($cat) or trigger_error(
|
||||
'get_cat_display_name wrong type for category ', E_USER_WARNING
|
||||
);
|
||||
|
||||
$cat['name'] = trigger_event(
|
||||
'render_category_name',
|
||||
$cat['name'],
|
||||
'get_cat_display_name'
|
||||
);
|
||||
|
||||
if ($is_first)
|
||||
{
|
||||
$is_first = false;
|
||||
|
@ -337,6 +328,12 @@ SELECT id, name, permalink
|
|||
{
|
||||
$cat = $cache['cat_names'][$category_id];
|
||||
|
||||
$cat['name'] = trigger_event(
|
||||
'render_category_name',
|
||||
$cat['name'],
|
||||
'get_cat_display_name_cache'
|
||||
);
|
||||
|
||||
if ($is_first)
|
||||
{
|
||||
$is_first = false;
|
||||
|
@ -394,7 +391,13 @@ function get_html_menu_category($categories, $selected_category)
|
|||
|
||||
$ref_level = 0;
|
||||
$level = 0;
|
||||
$menu = '';
|
||||
|
||||
$menu = trigger_event('get_html_menu_category', '',
|
||||
$categories, $selected_category);
|
||||
if (strlen($menu))
|
||||
{
|
||||
return $menu;
|
||||
}
|
||||
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
|
@ -437,19 +440,25 @@ function get_html_menu_category($categories, $selected_category)
|
|||
' / '
|
||||
);
|
||||
|
||||
$menu.= "\n".'<a href="'.$url.'"';
|
||||
$menu.= '<a href="'.$url.'"';
|
||||
if ($selected_category!=null
|
||||
and $category['id'] == $selected_category['id_uppercat'])
|
||||
{
|
||||
$menu.= ' rel="up"';
|
||||
}
|
||||
$menu.= ' title=" '.$title.'">'.$category['name'].'</a>';
|
||||
$menu.= ' title="'.$title.'">';
|
||||
$menu.= trigger_event(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'get_html_menu_category'
|
||||
);
|
||||
$menu.= '</a>';
|
||||
|
||||
if ( $category['count_images']>0 )
|
||||
{// at least one direct or indirect image
|
||||
$menu.= "\n".'<span class="';
|
||||
// at least one image in this category -> class menuInfoCat
|
||||
$menu.= ($category['nb_images'] > 0 ? "menuInfoCat"
|
||||
$menu.= ($category['nb_images'] > 0 ? "menuInfoCat"
|
||||
: "menuInfoCatByChild").'"';
|
||||
$menu.= ' title=" '.$title.'">';
|
||||
// show total number of images
|
||||
|
@ -576,9 +585,9 @@ function access_denied()
|
|||
|
||||
if ( isset($user['is_the_guest']) and !$user['is_the_guest'] )
|
||||
{
|
||||
echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
|
||||
echo '<a href="'.get_root_url().'identification.php">'.$lang['identification'].'</a> ';
|
||||
echo '<a href="'.make_index_url().'">'.$lang['home'].'</a></div>';
|
||||
echo '<div style="text-align:center;">'.l10n('access_forbiden').'<br />';
|
||||
echo '<a href="'.get_root_url().'identification.php">'.l10n('identification').'</a> ';
|
||||
echo '<a href="'.make_index_url().'">'.l10n('home').'</a></div>';
|
||||
exit();
|
||||
}
|
||||
else
|
||||
|
@ -704,10 +713,22 @@ function set_status_header($code, $text='')
|
|||
case 401: $text='Authorization required';break;
|
||||
case 403: $text='Forbidden';break;
|
||||
case 404: $text='Not found';break;
|
||||
case 500: $text='Server error';break;
|
||||
case 503: $text='Service unavailable';break;
|
||||
}
|
||||
}
|
||||
header("HTTP/1.1 $code $text");
|
||||
header("Status: $code $text");
|
||||
$protocol = $_SERVER["SERVER_PROTOCOL"];
|
||||
if ( ('HTTP/1.1' != $protocol) && ('HTTP/1.0' != $protocol) )
|
||||
$protocol = 'HTTP/1.0';
|
||||
|
||||
if ( version_compare( phpversion(), '4.3.0', '>=' ) )
|
||||
{
|
||||
header( "$protocol $code $text", true, $code );
|
||||
}
|
||||
else
|
||||
{
|
||||
header( "$protocol $code $text" );
|
||||
}
|
||||
trigger_action('set_status_header', $code, $text);
|
||||
}
|
||||
|
||||
|
@ -717,10 +738,32 @@ function set_status_header($code, $text='')
|
|||
*/
|
||||
function set_span_class($count)
|
||||
{
|
||||
if ($count > 1)
|
||||
{
|
||||
if ($count > 1)
|
||||
{
|
||||
return 'plural';
|
||||
}
|
||||
return ( $count == 0 ) ? 'zero':'one';
|
||||
return ( $count == 0 ) ? 'zero':'one';
|
||||
}
|
||||
?>
|
||||
|
||||
/** returns the category comment for rendering in html.
|
||||
* this is an event handler. don't call directly
|
||||
*/
|
||||
function render_category_description($desc)
|
||||
{
|
||||
global $conf;
|
||||
if ( !( $conf['allow_html_descriptions'] and
|
||||
preg_match('/<(div|br|img|script).*>/i', $desc) ) )
|
||||
{
|
||||
$desc = nl2br($desc);
|
||||
}
|
||||
return $desc;
|
||||
}
|
||||
|
||||
/** returns the category comment for rendering in html textual mode (subcatify)
|
||||
* this is an event handler. don't call directly
|
||||
*/
|
||||
function render_category_literal_description($desc)
|
||||
{
|
||||
return strip_tags($desc, '<span><p><a><br><b><i><small><big><strong><em>');
|
||||
}
|
||||
?>
|
|
@ -2,8 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -29,6 +28,41 @@
|
|||
// | functions |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
|
||||
/**
|
||||
* Encodes a string using Q form if required (RFC2045)
|
||||
* mail headers MUST contain only US-ASCII characters
|
||||
*/
|
||||
function encode_mime_header($str)
|
||||
{
|
||||
$x = preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
|
||||
if ($x==0)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
// Replace every high ascii, control =, ? and _ characters
|
||||
$str = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
|
||||
"'='.sprintf('%02X', ord('\\1'))", $str);
|
||||
|
||||
// Replace every spaces to _ (more readable than =20)
|
||||
$str = str_replace(" ", "_", $str);
|
||||
|
||||
global $lang_info;
|
||||
return '=?'.$lang_info['charset'].'?Q?'.$str.'?=';
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the name of the mail sender :
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_mail_sender_name()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
return (empty($conf['mail_sender_name']) ? $conf['gallery_title'] : $conf['mail_sender_name']);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an array of mail configuration parameters :
|
||||
*
|
||||
|
@ -46,8 +80,12 @@ function get_mail_configuration()
|
|||
|
||||
$conf_mail = array(
|
||||
'mail_options' => $conf['mail_options'],
|
||||
'send_bcc_mail_webmaster' => $conf['send_bcc_mail_webmaster'],
|
||||
'default_email_format' => $conf['default_email_format']
|
||||
'send_bcc_mail_webmaster' => $conf['send_bcc_mail_webmaster'],
|
||||
'default_email_format' => $conf['default_email_format'],
|
||||
'use_smtp' => !empty($conf['smtp_host']),
|
||||
'smtp_host' => $conf['smtp_host'],
|
||||
'smtp_user' => $conf['smtp_user'],
|
||||
'smtp_password' => $conf['smtp_password']
|
||||
);
|
||||
|
||||
// we have webmaster id among user list, what's his email address ?
|
||||
|
@ -55,7 +93,7 @@ function get_mail_configuration()
|
|||
|
||||
// name of the webmaster is the title of the gallery
|
||||
$conf_mail['formated_email_webmaster'] =
|
||||
format_email($conf['gallery_title'], $conf_mail['email_webmaster']);
|
||||
format_email(get_mail_sender_name(), $conf_mail['email_webmaster']);
|
||||
|
||||
$conf_mail['boundary_key'] = generate_key(32);
|
||||
|
||||
|
@ -70,90 +108,113 @@ function get_mail_configuration()
|
|||
*/
|
||||
function format_email($name, $email)
|
||||
{
|
||||
global $conf;
|
||||
// Spring cleaning
|
||||
$cvt_email = trim(preg_replace('#[\n\r]+#s', '', $email));
|
||||
$cvt_name = trim(preg_replace('#[\n\r]+#s', '', $name));
|
||||
|
||||
if ($conf['enabled_format_email'])
|
||||
if ($cvt_name!="")
|
||||
{
|
||||
$cvt7b_name = str_translate_to_ascii7bits($name);
|
||||
$cvt_name = encode_mime_header(
|
||||
'"'
|
||||
.addcslashes($cvt_name,'"')
|
||||
.'"');
|
||||
$cvt_name .= ' ';
|
||||
}
|
||||
|
||||
if (strpos($email, '<') === false)
|
||||
{
|
||||
return $cvt7b_name.' <'.$email.'>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $cvt7b_name.$email;
|
||||
}
|
||||
if (strpos($cvt_email, '<') === false)
|
||||
{
|
||||
return $cvt_name.'<'.$cvt_email.'>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $email;
|
||||
return $cvt_name.$cvt_email;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an completed array template/theme
|
||||
* completed with get_default_template()
|
||||
*
|
||||
* @params:
|
||||
* - args: incompleted array of template/theme
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o theme: template to use [default get_default_template()]
|
||||
*/
|
||||
function get_array_template_theme($args = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$res = array();
|
||||
|
||||
if (empty($args['template']) or empty($args['theme']))
|
||||
{
|
||||
list($res['template'], $res['theme']) = explode('/', get_default_template());
|
||||
}
|
||||
|
||||
if (!empty($args['template']))
|
||||
{
|
||||
$res['template'] = $args['template'];
|
||||
}
|
||||
|
||||
if (!empty($args['theme']))
|
||||
{
|
||||
$res['theme'] = $args['theme'];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an new mail template
|
||||
*
|
||||
* @params:
|
||||
* - email_format: mail format
|
||||
* - args: function params of mail function:
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o theme: template to use [default get_default_template()]
|
||||
*/
|
||||
function get_mail_template($email_format, $args = array())
|
||||
{
|
||||
$args = get_array_template_theme($args);
|
||||
|
||||
$mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$args['template'], $args['theme']);
|
||||
$mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format);
|
||||
|
||||
return $mail_template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string email format (html or not)
|
||||
*
|
||||
* @param string format
|
||||
*/
|
||||
function get_str_email_format($is_html)
|
||||
{
|
||||
return ($is_html ? 'text/html' : 'text/plain');
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns an email address list with minimal email string
|
||||
*
|
||||
* @param string with email list (email separated by comma)
|
||||
*/
|
||||
function get_strict_email_list($email_list)
|
||||
{
|
||||
$result = array();
|
||||
$list = explode(',', $email_list);
|
||||
foreach ($list as $email)
|
||||
{
|
||||
if (strpos($email, '<') !== false)
|
||||
{
|
||||
$email = preg_replace('/.*<(.*)>.*/i', '$1', $email);
|
||||
}
|
||||
$result[] = trim($email);
|
||||
}
|
||||
|
||||
return implode(',', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an completed array template/theme
|
||||
* completed with get_default_template()
|
||||
*
|
||||
* @params:
|
||||
* - args: incompleted array of template/theme
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o theme: template to use [default get_default_template()]
|
||||
*/
|
||||
function get_array_template_theme($args = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$res = array();
|
||||
|
||||
if (empty($args['template']) or empty($args['theme']))
|
||||
{
|
||||
list($res['template'], $res['theme']) = explode('/', get_default_template());
|
||||
}
|
||||
|
||||
if (!empty($args['template']))
|
||||
{
|
||||
$res['template'] = $args['template'];
|
||||
}
|
||||
|
||||
if (!empty($args['theme']))
|
||||
{
|
||||
$res['theme'] = $args['theme'];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an new mail template
|
||||
*
|
||||
* @params:
|
||||
* - email_format: mail format
|
||||
* - args: function params of mail function:
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o theme: template to use [default get_default_template()]
|
||||
*/
|
||||
function get_mail_template($email_format, $args = array())
|
||||
{
|
||||
$args = get_array_template_theme($args);
|
||||
|
||||
$mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$args['template'], $args['theme']);
|
||||
$mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format);
|
||||
|
||||
return $mail_template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string email format (html or not)
|
||||
*
|
||||
* @param string format
|
||||
*/
|
||||
function get_str_email_format($is_html)
|
||||
{
|
||||
return ($is_html ? 'text/html' : 'text/plain');
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch language to param language
|
||||
* All entries are push on language stack
|
||||
*
|
||||
|
@ -204,10 +265,12 @@ function switch_lang_to($language)
|
|||
$lang_info = $switch_lang[$language]['lang_info'];
|
||||
$lang = $switch_lang[$language]['lang'];
|
||||
}
|
||||
|
||||
$user['language'] = $language;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Switch back language pushed with switch_lang_to function
|
||||
*
|
||||
* @param: none
|
||||
|
@ -234,6 +297,7 @@ function switch_lang_back()
|
|||
$lang_info = $switch_lang[$language]['lang_info'];
|
||||
$lang = $switch_lang[$language]['lang'];
|
||||
}
|
||||
$user['language'] = $language;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,8 +307,8 @@ function switch_lang_back()
|
|||
* @return string
|
||||
*/
|
||||
/*
|
||||
* send en notification email to all administrators
|
||||
* if a administrator is doing action,
|
||||
* send en notification email to all administrators
|
||||
* if a administrator is doing action,
|
||||
* he's be removed to email list
|
||||
*
|
||||
* @param:
|
||||
|
@ -255,6 +319,16 @@ function switch_lang_back()
|
|||
*/
|
||||
function pwg_mail_notification_admins($keyargs_subject, $keyargs_content)
|
||||
{
|
||||
// Check arguments
|
||||
if
|
||||
(
|
||||
empty($keyargs_subject) or
|
||||
empty($keyargs_content)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
global $conf, $user;
|
||||
$return = true;
|
||||
|
||||
|
@ -271,7 +345,7 @@ where
|
|||
I.user_id = U.'.$conf['user_fields']['id'].' and
|
||||
I.status in (\'webmaster\', \'admin\') and
|
||||
I.adviser = \'false\' and
|
||||
'.$conf['user_fields']['email'].' is not null and
|
||||
'.$conf['user_fields']['email'].' is not null and
|
||||
I.user_id <> '.$user['id'].'
|
||||
order by
|
||||
username
|
||||
|
@ -290,13 +364,13 @@ order by
|
|||
}
|
||||
|
||||
if (count($admins) > 0)
|
||||
{
|
||||
$keyargs_content_admin_info = array
|
||||
(
|
||||
get_l10n_args('Connected user: %s', $user['username']),
|
||||
get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
|
||||
get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
|
||||
);
|
||||
{
|
||||
$keyargs_content_admin_info = array
|
||||
(
|
||||
get_l10n_args('Connected user: %s', $user['username']),
|
||||
get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
|
||||
get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
|
||||
);
|
||||
|
||||
switch_lang_to(get_default_language());
|
||||
|
||||
|
@ -304,11 +378,11 @@ order by
|
|||
(
|
||||
'',
|
||||
array
|
||||
(
|
||||
'Bcc' => $admins,
|
||||
(
|
||||
'Bcc' => $admins,
|
||||
'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
|
||||
'content' =>
|
||||
l10n_args($keyargs_content)."\n\n"
|
||||
'content' =>
|
||||
l10n_args($keyargs_content)."\n\n"
|
||||
.l10n_args($keyargs_content_admin_info)."\n",
|
||||
'content_format' => 'text/plain'
|
||||
)
|
||||
|
@ -319,37 +393,49 @@ order by
|
|||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* send en email to user's group
|
||||
*
|
||||
* @param:
|
||||
* - group_id: mail are sent to group with this Id
|
||||
* - email_format: mail format
|
||||
* - keyargs_subject: mail subject on l10n_args format
|
||||
* @param:
|
||||
* - group_id: mail are sent to group with this Id
|
||||
* - email_format: mail format
|
||||
* - keyargs_subject: mail subject on l10n_args format
|
||||
* - dirname: short name of directory including template
|
||||
* - tpl_shortname: short template name without extension
|
||||
* - assign_vars: array used to assign_vars to mail template
|
||||
* - language_selected: send mail only to user with this selected language
|
||||
* - assign_vars: array used to assign_vars to mail template
|
||||
* - language_selected: send mail only to user with this selected language
|
||||
*
|
||||
* @return boolean (Ok or not)
|
||||
*/
|
||||
function pwg_mail_group(
|
||||
$group_id, $email_format, $keyargs_subject,
|
||||
function pwg_mail_group(
|
||||
$group_id, $email_format, $keyargs_subject,
|
||||
$dirname, $tpl_shortname,
|
||||
$assign_vars = array(), $language_selected = '')
|
||||
{
|
||||
// Check arguments
|
||||
if
|
||||
(
|
||||
empty($group_id) or
|
||||
empty($email_format) or
|
||||
empty($keyargs_subject) or
|
||||
empty($tpl_shortname)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
global $conf;
|
||||
$return = true;
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
distinct language, template
|
||||
FROM
|
||||
'.USER_GROUP_TABLE.' as ug
|
||||
FROM
|
||||
'.USER_GROUP_TABLE.' as ug
|
||||
INNER JOIN '.USERS_TABLE.' as u ON '.$conf['user_fields']['id'].' = ug.user_id
|
||||
INNER JOIN '.USER_INFOS_TABLE.' as ui ON ui.user_id = ug.user_id
|
||||
WHERE
|
||||
WHERE
|
||||
'.$conf['user_fields']['email'].' IS NOT NULL
|
||||
AND group_id = '.$group_id;
|
||||
|
||||
|
@ -362,74 +448,76 @@ WHERE
|
|||
$query .= '
|
||||
;';
|
||||
|
||||
$result = pwg_query($query);
|
||||
|
||||
if (mysql_num_rows($result) > 0)
|
||||
{
|
||||
$list = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$row['template_theme'] = $row['template'];
|
||||
list($row['template'], $row['theme']) = explode('/', $row['template_theme']);
|
||||
$list[] = $row;
|
||||
}
|
||||
}
|
||||
$result = pwg_query($query);
|
||||
|
||||
foreach ($list as $elem)
|
||||
if (mysql_num_rows($result) > 0)
|
||||
{
|
||||
$query = '
|
||||
$list = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$row['template_theme'] = $row['template'];
|
||||
list($row['template'], $row['theme']) = explode('/', $row['template_theme']);
|
||||
$list[] = $row;
|
||||
}
|
||||
|
||||
foreach ($list as $elem)
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
u.'.$conf['user_fields']['username'].' as username,
|
||||
u.'.$conf['user_fields']['email'].' as mail_address
|
||||
FROM
|
||||
'.USER_GROUP_TABLE.' as ug
|
||||
FROM
|
||||
'.USER_GROUP_TABLE.' as ug
|
||||
INNER JOIN '.USERS_TABLE.' as u ON '.$conf['user_fields']['id'].' = ug.user_id
|
||||
INNER JOIN '.USER_INFOS_TABLE.' as ui ON ui.user_id = ug.user_id
|
||||
WHERE
|
||||
WHERE
|
||||
'.$conf['user_fields']['email'].' IS NOT NULL
|
||||
AND group_id = '.$group_id.'
|
||||
AND language = \''.$elem['language'].'\'
|
||||
AND template = \''.$elem['template_theme'].'\'
|
||||
AND language = \''.$elem['language'].'\'
|
||||
AND template = \''.$elem['template_theme'].'\'
|
||||
;';
|
||||
|
||||
$result = pwg_query($query);
|
||||
$result = pwg_query($query);
|
||||
|
||||
if (mysql_num_rows($result) > 0)
|
||||
{
|
||||
$Bcc = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
if (mysql_num_rows($result) > 0)
|
||||
{
|
||||
if (!empty($row['mail_address']))
|
||||
$Bcc = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push($Bcc, format_email($row['username'], $row['mail_address']));
|
||||
if (!empty($row['mail_address']))
|
||||
{
|
||||
array_push($Bcc, format_email($row['username'], $row['mail_address']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($Bcc) > 0)
|
||||
{
|
||||
switch_lang_to($elem['language']);
|
||||
if (count($Bcc) > 0)
|
||||
{
|
||||
switch_lang_to($elem['language']);
|
||||
|
||||
$mail_template = get_mail_template($email_format, $elem);
|
||||
$mail_template->set_filename($tpl_shortname,
|
||||
(empty($dirname) ? '' : $dirname.'/').$tpl_shortname.'.tpl');
|
||||
$mail_template->assign_vars($assign_vars);
|
||||
$mail_template = get_mail_template($email_format, $elem);
|
||||
$mail_template->set_filename($tpl_shortname,
|
||||
(empty($dirname) ? '' : $dirname.'/').$tpl_shortname.'.tpl');
|
||||
|
||||
$return = pwg_mail
|
||||
(
|
||||
'',
|
||||
array
|
||||
(
|
||||
'Bcc' => $Bcc,
|
||||
'subject' => l10n_args($keyargs_subject),
|
||||
'email_format' => $email_format,
|
||||
'content' => $mail_template->parse($tpl_shortname, true),
|
||||
'content_format' => $email_format,
|
||||
'template' => $elem['template'],
|
||||
'theme' => $elem['theme']
|
||||
)
|
||||
) and $return;
|
||||
$mail_template->assign_vars(
|
||||
trigger_event('mail_group_assign_vars', $assign_vars));
|
||||
|
||||
switch_lang_back();
|
||||
$return = pwg_mail
|
||||
(
|
||||
'',
|
||||
array
|
||||
(
|
||||
'Bcc' => $Bcc,
|
||||
'subject' => l10n_args($keyargs_subject),
|
||||
'email_format' => $email_format,
|
||||
'content' => $mail_template->parse($tpl_shortname, true),
|
||||
'content_format' => $email_format,
|
||||
'template' => $elem['template'],
|
||||
'theme' => $elem['theme']
|
||||
)
|
||||
) and $return;
|
||||
|
||||
switch_lang_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,53 +525,47 @@ WHERE
|
|||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sends an email, using PhpWebGallery specific informations
|
||||
*
|
||||
* @param:
|
||||
* - to: Receiver, or receivers of the mail.
|
||||
* - to: receiver(s) of the mail (list separated by comma).
|
||||
* - args: function params of mail function:
|
||||
* o from: sender [default value webmaster email]
|
||||
* o Cc: array of carbon copy receivers of the mail. [default value empty]
|
||||
* o Bcc: array of blind carbon copy receivers of the mail. [default value empty]
|
||||
* o from: sender [default value webmaster email]
|
||||
* o Cc: array of carbon copy receivers of the mail. [default value empty]
|
||||
* o Bcc: array of blind carbon copy receivers of the mail. [default value empty]
|
||||
* o subject [default value 'PhpWebGallery']
|
||||
* o content: content of mail [default value '']
|
||||
* o content_format: format of mail content [default value 'text/plain']
|
||||
* o email_format: global mail format [default value $conf_mail['default_email_format']]
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o email_format: global mail format [default value $conf_mail['default_email_format']]
|
||||
* o template: template to use [default get_default_template()]
|
||||
* o theme: template to use [default get_default_template()]
|
||||
*
|
||||
* @return boolean (Ok or not)
|
||||
*/
|
||||
*/
|
||||
function pwg_mail($to, $args = array())
|
||||
{
|
||||
global $conf, $conf_mail, $lang_info, $page;
|
||||
|
||||
if (empty($to) and empty($args['Cc']) and empty($args['Bcc']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (empty($to) and empty($args['Cc']) and empty($args['Bcc']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isset($conf_mail))
|
||||
{
|
||||
$conf_mail = get_mail_configuration();
|
||||
}
|
||||
|
||||
if (empty($args['email_format']))
|
||||
{
|
||||
$args['email_format'] = $conf_mail['default_email_format'];
|
||||
}
|
||||
|
||||
|
||||
if (empty($args['email_format']))
|
||||
{
|
||||
$args['email_format'] = $conf_mail['default_email_format'];
|
||||
}
|
||||
|
||||
// Compute root_path in order have complete path
|
||||
if ($args['email_format'] == 'text/html')
|
||||
{
|
||||
set_make_full_url();
|
||||
}
|
||||
|
||||
if (!empty($to))
|
||||
{
|
||||
$to = format_email('', $to);
|
||||
set_make_full_url();
|
||||
}
|
||||
|
||||
if (empty($args['from']))
|
||||
|
@ -499,7 +581,10 @@ function pwg_mail($to, $args = array())
|
|||
{
|
||||
$args['subject'] = 'PhpWebGallery';
|
||||
}
|
||||
$cvt7b_subject = str_translate_to_ascii7bits($args['subject']);
|
||||
// Spring cleaning
|
||||
$cvt_subject = trim(preg_replace('#[\n\r]+#s', '', $args['subject']));
|
||||
// Ascii convertion
|
||||
$cvt_subject = encode_mime_header($cvt_subject);
|
||||
|
||||
if (!isset($args['content']))
|
||||
{
|
||||
|
@ -510,140 +595,145 @@ function pwg_mail($to, $args = array())
|
|||
{
|
||||
$args['content_format'] = 'text/plain';
|
||||
}
|
||||
|
||||
if ($conf_mail['send_bcc_mail_webmaster'])
|
||||
{
|
||||
$args['Bcc'][] = $conf_mail['formated_email_webmaster'];
|
||||
}
|
||||
|
||||
if (($args['content_format'] == 'text/html') and ($args['email_format'] == 'text/plain'))
|
||||
{
|
||||
// Todo find function to convert html text to plain text
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = array_merge($args, get_array_template_theme($args));
|
||||
|
||||
if ($conf_mail['send_bcc_mail_webmaster'])
|
||||
{
|
||||
$args['Bcc'][] = $conf_mail['formated_email_webmaster'];
|
||||
}
|
||||
|
||||
if (($args['content_format'] == 'text/html') and ($args['email_format'] == 'text/plain'))
|
||||
{
|
||||
// Todo find function to convert html text to plain text
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = array_merge($args, get_array_template_theme($args));
|
||||
|
||||
$headers = 'From: '.$args['from']."\n";
|
||||
$headers.= 'Reply-To: '.$args['from']."\n";
|
||||
if (empty($to))
|
||||
{
|
||||
$headers.= 'To: undisclosed-recipients: ;'."\n";
|
||||
}
|
||||
|
||||
if (!empty($args['Cc']))
|
||||
{
|
||||
$headers.= 'Cc: '.implode(',', $args['Cc'])."\n";
|
||||
}
|
||||
|
||||
if (!empty($args['Bcc']))
|
||||
{
|
||||
$headers.= 'Bcc: '.implode(',', $args['Bcc'])."\n";
|
||||
}
|
||||
$headers.= 'Reply-To: '.$args['from']."\n";
|
||||
if (empty($to))
|
||||
{
|
||||
$headers.= 'To: undisclosed-recipients: ;'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$headers.= 'To: '.$to."\n";
|
||||
}
|
||||
|
||||
if (!empty($args['Cc']))
|
||||
{
|
||||
$headers.= 'Cc: '.implode(',', $args['Cc'])."\n";
|
||||
}
|
||||
|
||||
if (!empty($args['Bcc']))
|
||||
{
|
||||
$headers.= 'Bcc: '.implode(',', $args['Bcc'])."\n";
|
||||
}
|
||||
|
||||
$headers.= 'Content-Type: multipart/alternative;'."\n";
|
||||
$headers.= ' boundary="---='.$conf_mail['boundary_key'].'";'."\n";
|
||||
$headers.= ' reply-type=original'."\n";
|
||||
$headers.= 'MIME-Version: 1.0'."\n";
|
||||
$headers.= ' reply-type=original'."\n";
|
||||
$headers.= 'MIME-Version: 1.0'."\n";
|
||||
$headers.= 'X-Mailer: Piwigo Mailer'."\n";
|
||||
|
||||
$content = '';
|
||||
|
||||
if (!isset($conf_mail[$args['email_format']][$lang_info['charset']][$args['template']][$args['theme']]))
|
||||
{
|
||||
if (!isset($mail_template))
|
||||
{
|
||||
$content = '';
|
||||
|
||||
if (!isset($conf_mail[$args['email_format']][$lang_info['code']][$lang_info['charset']][$args['template']][$args['theme']]))
|
||||
{
|
||||
if (!isset($mail_template))
|
||||
{
|
||||
$mail_template = get_mail_template($args['email_format']);
|
||||
}
|
||||
|
||||
$mail_template->set_filename('mail_header', 'header.tpl');
|
||||
$mail_template->set_filename('mail_footer', 'footer.tpl');
|
||||
|
||||
$mail_template->assign_vars(
|
||||
array(
|
||||
//Header
|
||||
}
|
||||
|
||||
$mail_template->set_filename('mail_header', 'header.tpl');
|
||||
$mail_template->set_filename('mail_footer', 'footer.tpl');
|
||||
|
||||
$mail_template->assign_vars(
|
||||
array(
|
||||
//Header
|
||||
'BOUNDARY_KEY' => $conf_mail['boundary_key'],
|
||||
'CONTENT_TYPE' => $args['email_format'],
|
||||
'CONTENT_ENCODING' => $lang_info['charset'],
|
||||
'LANG' => $lang_info['code'],
|
||||
'DIR' => $lang_info['direction'],
|
||||
|
||||
// Footer
|
||||
'GALLERY_URL' =>
|
||||
isset($page['gallery_url']) ?
|
||||
$page['gallery_url'] : $conf['gallery_url'],
|
||||
'GALLERY_TITLE' =>
|
||||
isset($page['gallery_title']) ?
|
||||
$page['gallery_title'] : $conf['gallery_title'],
|
||||
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
|
||||
'PHPWG_URL' => PHPWG_URL,
|
||||
|
||||
'TITLE_MAIL' => urlencode(l10n('title_send_mail')),
|
||||
'MAIL' => get_webmaster_mail_address()
|
||||
));
|
||||
|
||||
if ($args['email_format'] == 'text/html')
|
||||
{
|
||||
$old_root = $mail_template->root;
|
||||
|
||||
if (is_file($mail_template->root.'/global-mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('global_mail_css', 'global-mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('GLOBAL_MAIL_CSS', 'global_mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = PHPWG_ROOT_PATH.'template/'.$args['template'].'/theme/'.$args['theme'];
|
||||
if (is_file($mail_template->root.'/mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('mail_css', 'mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('MAIL_CSS', 'mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = PHPWG_ROOT_PATH.'template-common';
|
||||
if (is_file($mail_template->root.'/local-mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('local_mail_css', 'local-mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('LOCAL_MAIL_CSS', 'local_mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = $old_root;
|
||||
}
|
||||
|
||||
// what are displayed on the header of each mail ?
|
||||
'LANG' => $lang_info['code'],
|
||||
'DIR' => $lang_info['direction'],
|
||||
|
||||
// Footer
|
||||
'GALLERY_URL' =>
|
||||
isset($page['gallery_url']) ?
|
||||
$page['gallery_url'] : $conf['gallery_url'],
|
||||
'GALLERY_TITLE' =>
|
||||
isset($page['gallery_title']) ?
|
||||
$page['gallery_title'] : $conf['gallery_title'],
|
||||
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
|
||||
'PHPWG_URL' => PHPWG_URL,
|
||||
|
||||
'TITLE_MAIL' => urlencode(l10n('title_send_mail')),
|
||||
'MAIL' => get_webmaster_mail_address()
|
||||
));
|
||||
|
||||
if ($args['email_format'] == 'text/html')
|
||||
{
|
||||
$old_root = $mail_template->root;
|
||||
|
||||
if (is_file($mail_template->root.'/global-mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('global_mail_css', 'global-mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('GLOBAL_MAIL_CSS', 'global_mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = PHPWG_ROOT_PATH.'template/'.$args['template'].'/theme/'.$args['theme'];
|
||||
if (is_file($mail_template->root.'/mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('mail_css', 'mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('MAIL_CSS', 'mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = PHPWG_ROOT_PATH.'template-common';
|
||||
if (is_file($mail_template->root.'/local-mail-css.tpl'))
|
||||
{
|
||||
$mail_template->set_filename('local_mail_css', 'local-mail-css.tpl');
|
||||
$mail_template->assign_var_from_handle('LOCAL_MAIL_CSS', 'local_mail_css');
|
||||
}
|
||||
|
||||
$mail_template->root = $old_root;
|
||||
}
|
||||
|
||||
// what are displayed on the header of each mail ?
|
||||
$conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['header'] =
|
||||
[$lang_info['code']][$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['header'] =
|
||||
$mail_template->parse('mail_header', true);
|
||||
|
||||
// what are displayed on the footer of each mail ?
|
||||
// what are displayed on the footer of each mail ?
|
||||
$conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[$lang_info['code']][$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['footer'] =
|
||||
$mail_template->parse('mail_footer', true);
|
||||
}
|
||||
}
|
||||
|
||||
// Header
|
||||
$content.= $conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['header'];
|
||||
[$lang_info['code']][$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['header'];
|
||||
|
||||
// Content
|
||||
if (($args['content_format'] == 'text/plain') and ($args['email_format'] == 'text/html'))
|
||||
{
|
||||
if (($args['content_format'] == 'text/plain') and ($args['email_format'] == 'text/html'))
|
||||
{
|
||||
$content.= '<p>'.
|
||||
nl2br(
|
||||
preg_replace("/(http:\/\/)([^\s,]*)/i",
|
||||
"<a href='$1$2'>$1$2</a>",
|
||||
htmlentities($args['content']))).
|
||||
'</p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content.= $args['content'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content.= $args['content'];
|
||||
}
|
||||
|
||||
// Footer
|
||||
// Footer
|
||||
$content.= $conf_mail[$args['email_format']]
|
||||
[$lang_info['charset']]
|
||||
[$lang_info['code']][$lang_info['charset']]
|
||||
[$args['template']][$args['theme']]['footer'];
|
||||
|
||||
// Close boundary
|
||||
|
@ -651,15 +741,72 @@ function pwg_mail($to, $args = array())
|
|||
|
||||
// Undo Compute root_path in order have complete path
|
||||
if ($args['email_format'] == 'text/html')
|
||||
{
|
||||
{
|
||||
unset_make_full_url();
|
||||
}
|
||||
|
||||
/*Testing block
|
||||
return
|
||||
trigger_event('send_mail',
|
||||
false, /* Result */
|
||||
trigger_event('send_mail_to', get_strict_email_list($to)),
|
||||
trigger_event('send_mail_subject', $cvt_subject),
|
||||
trigger_event('send_mail_content', $content),
|
||||
trigger_event('send_mail_headers', $headers),
|
||||
$args
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* pwg sendmail
|
||||
*
|
||||
* @param:
|
||||
* - result of other sendmail
|
||||
* - to: Receiver or receiver(s) of the mail.
|
||||
* - subject [default value 'PhpWebGallery']
|
||||
* - content: content of mail
|
||||
* - headers: headers of mail
|
||||
*
|
||||
* @return boolean (Ok or not)
|
||||
*/
|
||||
function pwg_send_mail($result, $to, $subject, $content, $headers)
|
||||
{
|
||||
if (!$result)
|
||||
{
|
||||
global $user;
|
||||
global $conf_mail;
|
||||
|
||||
if ($conf_mail['use_smtp'])
|
||||
{
|
||||
include_once( PHPWG_ROOT_PATH.'include/class_smtp_mail.inc.php' );
|
||||
$smtp_mail = new smtp_mail(
|
||||
$conf_mail['smtp_host'], $conf_mail['smtp_user'], $conf_mail['smtp_password'],
|
||||
$conf_mail['email_webmaster']);
|
||||
return $smtp_mail->mail($to, $subject, $content, $headers);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf_mail['mail_options'])
|
||||
{
|
||||
$options = '-f '.$conf_mail['email_webmaster'];
|
||||
return mail($to, $subject, $content, $headers, $options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mail($to, $subject, $content, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/*Testing block
|
||||
function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
|
||||
{
|
||||
global $user, $lang_info;
|
||||
@mkdir(PHPWG_ROOT_PATH.'testmail');
|
||||
$filename = PHPWG_ROOT_PATH.'testmail/mail.'.$user['username'];
|
||||
$filename = PHPWG_ROOT_PATH.'testmail/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
|
||||
if ($args['content_format'] == 'text/plain')
|
||||
{
|
||||
$filename .= '.txt';
|
||||
|
@ -669,21 +816,17 @@ function pwg_mail($to, $args = array())
|
|||
$filename .= '.html';
|
||||
}
|
||||
$file = fopen($filename, 'w+');
|
||||
fwrite($file, $to);
|
||||
fwrite($file, $subject);
|
||||
fwrite($file, $headers);
|
||||
fwrite($file, $content);
|
||||
fclose($file);
|
||||
return true;
|
||||
}*/
|
||||
|
||||
if ($conf_mail['mail_options'])
|
||||
{
|
||||
$options = '-f '.$conf_mail['email_webmaster'];
|
||||
|
||||
return mail($to, $cvt7b_subject, $content, $headers, $options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mail($to, $cvt7b_subject, $content, $headers);
|
||||
}
|
||||
}
|
||||
add_event_handler('send_mail', 'pwg_send_mail_test', 0, 6);*/
|
||||
|
||||
|
||||
add_event_handler('send_mail', 'pwg_send_mail', EVENT_HANDLER_PRIORITY_NEUTRAL, 5);
|
||||
trigger_action('functions_mail_included');
|
||||
|
||||
?>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
|
||||
/*
|
||||
* get standard sql where in order to
|
||||
* get standard sql where in order to
|
||||
* restict an filter caregories and images
|
||||
*
|
||||
* IMAGE_CATEGORY_TABLE muste named ic in the query
|
||||
|
@ -83,9 +83,8 @@ function custom_notification_query($action, $type, $start, $end)
|
|||
case 'unvalidated_comments':
|
||||
$query = '
|
||||
FROM '.COMMENTS_TABLE.'
|
||||
WHERE date <= \''.$end.'\'
|
||||
AND (validated = \'false\'
|
||||
OR validation_date > \''.$end.'\')
|
||||
WHERE date> \''.$start.'\' AND date <= \''.$end.'\'
|
||||
AND validated = \'false\'
|
||||
;';
|
||||
break;
|
||||
case 'new_elements':
|
||||
|
@ -226,26 +225,15 @@ function new_comments($start, $end)
|
|||
*
|
||||
* Comments that are registered and not validated yet on a precise date
|
||||
*
|
||||
* @param string date (mysql datetime format)
|
||||
* @param string start (mysql datetime format)
|
||||
* @param string end (mysql datetime format)
|
||||
* @return count comment ids
|
||||
*/
|
||||
function nb_unvalidated_comments($date)
|
||||
function nb_unvalidated_comments($start, $end)
|
||||
{
|
||||
return custom_notification_query('count', 'unvalidated_comments', $date, $date);
|
||||
return custom_notification_query('count', 'unvalidated_comments', $start, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* unvalidated at a precise date
|
||||
*
|
||||
* Comments that are registered and not validated yet on a precise date
|
||||
*
|
||||
* @param string date (mysql datetime format)
|
||||
* @return array comment ids
|
||||
*/
|
||||
function unvalidated_comments($date)
|
||||
{
|
||||
return custom_notification_query('info', 'unvalidated_comments', $start, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* new elements between two dates, according to authorized categories
|
||||
|
@ -362,7 +350,7 @@ function news_exists($start, $end)
|
|||
(nb_new_comments($start, $end) > 0) or
|
||||
(nb_new_elements($start, $end) > 0) or
|
||||
(nb_updated_categories($start, $end) > 0) or
|
||||
((is_admin()) and (nb_unvalidated_comments($end) > 0)) or
|
||||
((is_admin()) and (nb_unvalidated_comments($start, $end) > 0)) or
|
||||
((is_admin()) and (nb_new_users($start, $end) > 0)) or
|
||||
((is_admin()) and (nb_waiting_elements() > 0))
|
||||
);
|
||||
|
@ -424,7 +412,7 @@ function news($start, $end, $exclude_img_cats=false, $add_url=false)
|
|||
if (is_admin())
|
||||
{
|
||||
add_news_line( $news,
|
||||
nb_unvalidated_comments($end), '%d comment to validate', '%d comments to validate',
|
||||
nb_unvalidated_comments($start, $end), '%d comment to validate', '%d comments to validate',
|
||||
get_root_url().'admin.php?page=comments', $add_url );
|
||||
|
||||
add_news_line( $news,
|
||||
|
@ -433,7 +421,7 @@ function news($start, $end, $exclude_img_cats=false, $add_url=false)
|
|||
|
||||
add_news_line( $news,
|
||||
nb_waiting_elements(), '%d waiting element', '%d waiting elements',
|
||||
get_root_url().'admin.php?page=waiting', $add_url );
|
||||
get_root_url().'admin.php?page=upload', $add_url );
|
||||
}
|
||||
|
||||
return $news;
|
||||
|
@ -478,6 +466,7 @@ SELECT DISTINCT id, path, name, tn_ext, file
|
|||
'.$where_sql.'
|
||||
AND date_available="'.$dates[$i]['date_available'].'"
|
||||
AND tn_ext IS NOT NULL
|
||||
ORDER BY RAND(NOW())
|
||||
LIMIT 0,'.$max_elements.'
|
||||
;';
|
||||
$dates[$i]['elements'] = array();
|
||||
|
@ -512,9 +501,9 @@ SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
|
|||
}
|
||||
|
||||
/*
|
||||
Call function get_recent_post_dates but
|
||||
Call function get_recent_post_dates but
|
||||
the parameters to be passed to the function, as an indexed array.
|
||||
|
||||
|
||||
*/
|
||||
function get_recent_post_dates_array($args)
|
||||
{
|
||||
|
@ -537,7 +526,7 @@ function get_html_description_recent_post_date($date_detail)
|
|||
global $conf;
|
||||
|
||||
$description = '';
|
||||
|
||||
|
||||
$description .=
|
||||
'<li>'
|
||||
.l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements'])
|
||||
|
|
|
@ -149,6 +149,11 @@ function get_image_location($element_info)
|
|||
$ext = get_extension($element_info['path']);
|
||||
$path = get_themeconf('mime_icon_dir');
|
||||
$path.= strtolower($ext).'.png';
|
||||
if ( !file_exists(PHPWG_ROOT_PATH.$path)
|
||||
and !empty($element_info['tn_ext']) )
|
||||
{
|
||||
$path = get_thumbnail_location($element_info);
|
||||
}
|
||||
}
|
||||
|
||||
// plugins want another location ?
|
||||
|
|
|
@ -50,15 +50,15 @@ function rate_picture($image_id, $rate)
|
|||
return;
|
||||
}
|
||||
|
||||
$ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
|
||||
if (count($ip_components) > 3)
|
||||
{
|
||||
array_pop($ip_components);
|
||||
}
|
||||
$anonymous_id = implode ('.', $ip_components);
|
||||
|
||||
if ($user_anonymous)
|
||||
{
|
||||
$ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
|
||||
if (count($ip_components) > 3)
|
||||
{
|
||||
array_pop($ip_components);
|
||||
}
|
||||
$anonymous_id = implode ('.', $ip_components);
|
||||
|
||||
if (isset($_COOKIE['pwg_anonymous_rater']))
|
||||
{
|
||||
if ($anonymous_id != $_COOKIE['pwg_anonymous_rater'])
|
||||
|
@ -78,7 +78,7 @@ DELETE
|
|||
FROM '.RATE_TABLE.'
|
||||
WHERE user_id = '.$user['id'].'
|
||||
AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\'
|
||||
AND element_id NOT IN ('.implode(',', $already_there).')
|
||||
AND element_id IN ('.implode(',', $already_there).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ DELETE
|
|||
WHERE element_id = '.$image_id.'
|
||||
AND user_id = '.$user['id'].'
|
||||
';
|
||||
if (isset($anonymous_id))
|
||||
if ($user_anonymous)
|
||||
{
|
||||
$query.= ' AND anonymous_id = \''.$anonymous_id.'\'';
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ INSERT
|
|||
VALUES
|
||||
('
|
||||
.$user['id'].','
|
||||
.(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").','
|
||||
.'\''.$anonymous_id.'\','
|
||||
.$image_id.','
|
||||
.$rate
|
||||
.',NOW())
|
||||
|
|
|
@ -197,22 +197,21 @@ function get_sql_search_clause($search)
|
|||
* @param array search
|
||||
* @return array
|
||||
*/
|
||||
function get_regular_search_results($search)
|
||||
function get_regular_search_results($search, $images_where)
|
||||
{
|
||||
global $conf;
|
||||
$forbidden = get_sql_condition_FandF(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'id'
|
||||
),
|
||||
"\n AND"
|
||||
);
|
||||
|
||||
$items = array();
|
||||
|
||||
$search_clause = get_sql_search_clause($search);
|
||||
|
||||
if (!empty($search_clause))
|
||||
{
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
WHERE '.$search_clause.'
|
||||
;';
|
||||
$items = array_from_query($query, 'id');
|
||||
}
|
||||
$tag_items = array();
|
||||
|
||||
if (isset($search['fields']['tags']))
|
||||
{
|
||||
|
@ -220,13 +219,38 @@ SELECT DISTINCT(id)
|
|||
$search['fields']['tags']['words'],
|
||||
$search['fields']['tags']['mode']
|
||||
);
|
||||
}
|
||||
|
||||
$search_clause = get_sql_search_clause($search);
|
||||
|
||||
if (!empty($search_clause))
|
||||
{
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.' i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
WHERE '.$search_clause;
|
||||
if (!empty($images_where))
|
||||
{
|
||||
$query .= "\n AND ".$images_where;
|
||||
}
|
||||
if (empty($tag_items) or $search['mode']=='AND')
|
||||
{ // directly use forbidden and order by
|
||||
$query .= $forbidden.'
|
||||
'.$conf['order_by'];
|
||||
}
|
||||
$items = array_from_query($query, 'id');
|
||||
}
|
||||
|
||||
if ( !empty($tag_items) )
|
||||
{
|
||||
$need_permission_check = false;
|
||||
switch ($search['mode'])
|
||||
{
|
||||
case 'AND':
|
||||
{
|
||||
if (empty($search_clause))
|
||||
{
|
||||
$need_permission_check = true;
|
||||
$items = $tag_items;
|
||||
}
|
||||
else
|
||||
|
@ -234,17 +258,34 @@ SELECT DISTINCT(id)
|
|||
$items = array_intersect($items, $tag_items);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'OR':
|
||||
{
|
||||
$before_count = count($items);
|
||||
$items = array_unique(
|
||||
array_merge(
|
||||
$items,
|
||||
$tag_items
|
||||
)
|
||||
);
|
||||
if ( $before_count < count($items) )
|
||||
{
|
||||
$need_permission_check = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($need_permission_check and count($items) )
|
||||
{
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.' i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
WHERE id IN ('.implode(',', $items).') '.$forbidden;
|
||||
if (!empty($images_where))
|
||||
{
|
||||
$query .= "\n AND ".$images_where;
|
||||
}
|
||||
$query .= '
|
||||
'.$conf['order_by'];
|
||||
$items = array_from_query($query, 'id');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,196 +294,288 @@ SELECT DISTINCT(id)
|
|||
|
||||
/**
|
||||
* returns the LIKE sql clause corresponding to the quick search query $q
|
||||
* and the field $field. example q="john bill", field="file" will return
|
||||
* file LIKE "%john%" OR file LIKE "%bill%". Special characters for MySql
|
||||
* full text search (+,<,>) are omitted.
|
||||
* and the field $field. example q='john bill', field='file' will return
|
||||
* file LIKE '%john%' OR file LIKE '%bill%'. Special characters for MySql full
|
||||
* text search (+,<,>,~) are omitted. The query can contain a phrase:
|
||||
* 'Pierre "New York"' will return LIKE '%Pierre%' OR LIKE '%New York%'.
|
||||
* @param string q
|
||||
* @param string field
|
||||
* @return string
|
||||
*/
|
||||
function get_qsearch_like_clause($q, $field)
|
||||
{
|
||||
$tokens = preg_split('/[\s,.;!\?]+/', $q);
|
||||
for ($i=0; $i<count($tokens); $i++)
|
||||
$q = stripslashes($q);
|
||||
$tokens = array();
|
||||
$token_modifiers = array();
|
||||
$crt_token = "";
|
||||
$crt_token_modifier = "";
|
||||
$state = 0;
|
||||
|
||||
for ($i=0; $i<strlen($q); $i++)
|
||||
{
|
||||
$tokens[$i]=str_replace('*','%', $tokens[$i]);
|
||||
if (preg_match('/^[+<>]/',$tokens[$i]) )
|
||||
$tokens[$i]=substr($tokens[$i], 1);
|
||||
else if (substr($tokens[$i], 0, 1)=='-')
|
||||
$ch = $q[$i];
|
||||
switch ($state)
|
||||
{
|
||||
unset($tokens[$i]);
|
||||
$i--;
|
||||
case 0:
|
||||
if ($ch=='"')
|
||||
{
|
||||
if (strlen($crt_token))
|
||||
{
|
||||
$tokens[] = $crt_token;
|
||||
$token_modifiers[] = $crt_token_modifier;
|
||||
$crt_token = "";
|
||||
$crt_token_modifier = "";
|
||||
}
|
||||
$state=1;
|
||||
}
|
||||
elseif ( $ch=='*' )
|
||||
{ // wild card
|
||||
$crt_token .= '%';
|
||||
}
|
||||
elseif ( strcspn($ch, '+-><~')==0 )
|
||||
{ //special full text modifier
|
||||
if (strlen($crt_token))
|
||||
{
|
||||
$tokens[] = $crt_token;
|
||||
$token_modifiers[] = $crt_token_modifier;
|
||||
$crt_token = "";
|
||||
$crt_token_modifier = "";
|
||||
}
|
||||
$crt_token_modifier .= $ch;
|
||||
}
|
||||
elseif (preg_match('/[\s,.;!\?]+/', $ch))
|
||||
{ // white space
|
||||
if (strlen($crt_token))
|
||||
{
|
||||
$tokens[] = $crt_token;
|
||||
$token_modifiers[] = $crt_token_modifier;
|
||||
$crt_token = "";
|
||||
$crt_token_modifier = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$crt_token .= $ch;
|
||||
}
|
||||
break;
|
||||
case 1: // qualified with quotes
|
||||
switch ($ch)
|
||||
{
|
||||
case '"':
|
||||
$tokens[] = $crt_token;
|
||||
$token_modifiers[] = $crt_token_modifier;
|
||||
$crt_token = "";
|
||||
$crt_token_modifier = "";
|
||||
$state=0;
|
||||
break;
|
||||
default:
|
||||
$crt_token .= $ch;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strlen($crt_token))
|
||||
{
|
||||
$tokens[] = $crt_token;
|
||||
$token_modifiers[] = $crt_token_modifier;
|
||||
}
|
||||
|
||||
if (!empty($tokens))
|
||||
$clauses = array();
|
||||
for ($i=0; $i<count($tokens); $i++)
|
||||
{
|
||||
$query = '(';
|
||||
for ($i=0; $i<count($tokens); $i++)
|
||||
{
|
||||
if ($i>0) $query .= 'OR ';
|
||||
$query .= ' '.$field.' LIKE "%'.$tokens[$i].'%" ';
|
||||
}
|
||||
$query .= ')';
|
||||
return $query;
|
||||
$tokens[$i] = trim($tokens[$i], '%');
|
||||
if (strstr($token_modifiers[$i], '-')!==false)
|
||||
continue;
|
||||
if ( strlen($tokens[$i])==0)
|
||||
continue;
|
||||
$clauses[] = $field.' LIKE "%'.addslashes($tokens[$i]).'%"';
|
||||
}
|
||||
return null;
|
||||
|
||||
return count($clauses) ? '('.implode(' OR ', $clauses).')' : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns the search results (array of image ids) corresponding to a
|
||||
* quick/query search. A quick/query search returns many items (search is
|
||||
* not strict), but results are sorted by relevance.
|
||||
* returns the search results corresponding to a quick/query search.
|
||||
* A quick/query search returns many items (search is not strict), but results
|
||||
* are sorted by relevance unless $super_order_by is true. Returns:
|
||||
* array (
|
||||
* 'items' => array(85,68,79...)
|
||||
* 'qs' => array(
|
||||
* 'matching_tags' => array of matching tags
|
||||
* 'matching_cats' => array of matching categories
|
||||
* 'matching_cats_no_images' =>array(99) - matching categories without images
|
||||
* ))
|
||||
*
|
||||
* @param string q
|
||||
* @param bool super_order_by
|
||||
* @param string images_where optional aditional restriction on images table
|
||||
* @return array
|
||||
*/
|
||||
function get_quick_search_results($q)
|
||||
function get_quick_search_results($q, $super_order_by, $images_where='')
|
||||
{
|
||||
global $page;
|
||||
$search_results = array();
|
||||
$search_results =
|
||||
array(
|
||||
'items' => array(),
|
||||
'qs' => array('q'=>stripslashes($q)),
|
||||
);
|
||||
$q = trim($q);
|
||||
if (empty($q))
|
||||
{
|
||||
$search_results['items'] = array();
|
||||
return $search_results;
|
||||
}
|
||||
// prepare the big join on images, comments and categories
|
||||
$query = '
|
||||
SELECT
|
||||
i.id, CAST( CONCAT_WS(" ",
|
||||
IFNULL(i.name,""),
|
||||
IFNULL(i.comment,""),
|
||||
IFNULL(GROUP_CONCAT(DISTINCT co.content),""),
|
||||
IFNULL(GROUP_CONCAT(DISTINCT c.dir),""),
|
||||
IFNULL(GROUP_CONCAT(DISTINCT c.name),""),
|
||||
IFNULL(GROUP_CONCAT(DISTINCT c.comment),"") ) AS CHAR) AS ft
|
||||
FROM (
|
||||
(
|
||||
'.IMAGES_TABLE.' i LEFT JOIN '.COMMENTS_TABLE.' co on i.id=co.image_id
|
||||
)
|
||||
INNER JOIN
|
||||
'.IMAGE_CATEGORY_TABLE.' ic on ic.image_id=i.id
|
||||
)
|
||||
INNER JOIN
|
||||
'.CATEGORIES_TABLE.' c on c.id=ic.category_id
|
||||
'.get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'i.id'
|
||||
),
|
||||
'WHERE'
|
||||
).'
|
||||
GROUP BY i.id';
|
||||
$q_like_field = '@@__db_field__@@'; //something never in a search
|
||||
$q_like_clause = get_qsearch_like_clause($q, $q_like_field );
|
||||
|
||||
$query = 'SELECT id, MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS q FROM ('.$query.') AS Y
|
||||
WHERE MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE)';
|
||||
|
||||
// Step 1 - first we find matches in #images table ===========================
|
||||
$where_clauses='MATCH(i.name, i.comment) AGAINST( "'.$q.'" IN BOOLEAN MODE)';
|
||||
if (!empty($q_like_clause))
|
||||
{
|
||||
$where_clauses .= '
|
||||
OR '. str_replace($q_like_field, 'file', $q_like_clause);
|
||||
$where_clauses = '('.$where_clauses.')';
|
||||
}
|
||||
$where_clauses = array($where_clauses);
|
||||
if (!empty($images_where))
|
||||
{
|
||||
$where_clauses[]='('.$images_where.')';
|
||||
}
|
||||
$where_clauses[] .= get_sql_condition_FandF
|
||||
(
|
||||
array( 'visible_images' => 'i.id' ), null, true
|
||||
);
|
||||
$query = '
|
||||
SELECT i.id,
|
||||
MATCH(i.name, i.comment) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS weight
|
||||
FROM '.IMAGES_TABLE.' i
|
||||
WHERE '.implode("\n AND ", $where_clauses);
|
||||
|
||||
$by_weights=array();
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{ // weight is important when sorting images by relevance
|
||||
if ($row['q'])
|
||||
if ($row['weight'])
|
||||
{
|
||||
$by_weights[(int)$row['id']] = 2*$row['q'];
|
||||
$by_weights[(int)$row['id']] = 2*$row['weight'];
|
||||
}
|
||||
else
|
||||
{//full text does not match but file name match
|
||||
$by_weights[(int)$row['id']] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
$permissions_checked = true;
|
||||
// now search the file name separately (not done in full text because slower
|
||||
// and the filename in pwg doesn't have spaces so full text is meaningless )
|
||||
$q_like_clause = get_qsearch_like_clause($q, 'file' );
|
||||
if (!empty($q_like_clause))
|
||||
{
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE '.$q_like_clause.
|
||||
get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
'visible_images' => 'id'
|
||||
),
|
||||
'AND'
|
||||
);
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{ // weight is important when sorting images by relevance
|
||||
$id=(int)$row['id'];
|
||||
@$by_weights[$id] += 2;
|
||||
$permissions_checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
// now search tag names corresponding to the query $q. we could have searched
|
||||
// tags earlier during the big join, but for the sake of the performance and
|
||||
// because tags have only a simple name we do it separately
|
||||
$q_like_clause = get_qsearch_like_clause($q, 'CONVERT(name, CHAR)' );
|
||||
// Step 2 - search tags corresponding to the query $q ========================
|
||||
if (!empty($q_like_clause))
|
||||
{
|
||||
// search also by url name (without accents)
|
||||
$q_like_clause_url = get_qsearch_like_clause($q, 'url_name' );
|
||||
{ // search name and url name (without accents)
|
||||
$query = '
|
||||
SELECT id
|
||||
SELECT id, name, url_name
|
||||
FROM '.TAGS_TABLE.'
|
||||
WHERE '.$q_like_clause.'
|
||||
OR '.$q_like_clause_url;
|
||||
$tag_ids = array_from_query( $query, 'id');
|
||||
if (!empty($tag_ids))
|
||||
{ // we got some tags
|
||||
WHERE ('.str_replace($q_like_field, 'CONVERT(name, CHAR)', $q_like_clause).'
|
||||
OR '.str_replace($q_like_field, 'url_name', $q_like_clause).')';
|
||||
$tags = hash_from_query($query, 'id');
|
||||
if ( !empty($tags) )
|
||||
{ // we got some tags; get the images
|
||||
$search_results['qs']['matching_tags']=$tags;
|
||||
$query = '
|
||||
SELECT image_id, COUNT(tag_id) AS q
|
||||
SELECT image_id, COUNT(tag_id) AS weight
|
||||
FROM '.IMAGE_TAG_TABLE.'
|
||||
WHERE tag_id IN ('.implode(',',$tag_ids).')
|
||||
WHERE tag_id IN ('.implode(',',array_keys($tags)).')
|
||||
GROUP BY image_id';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{ // weight is important when sorting images by relevance
|
||||
$image_id=(int)$row['image_id'];
|
||||
@$by_weights[$image_id] += $row['q'];
|
||||
$permissions_checked = false;
|
||||
@$by_weights[$image_id] += $row['weight'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//at this point, found images might contain images not allowed for the user
|
||||
if ( !$permissions_checked
|
||||
and !empty($by_weights)
|
||||
and !isset($page['super_order_by']) )
|
||||
|
||||
// Step 3 - search categories corresponding to the query $q ==================
|
||||
global $user;
|
||||
$query = '
|
||||
SELECT id, name, permalink, nb_images
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id
|
||||
WHERE user_id='.$user['id'].'
|
||||
AND MATCH(name, comment) AGAINST( "'.$q.'" IN BOOLEAN MODE)'.
|
||||
get_sql_condition_FandF (
|
||||
array( 'visible_categories' => 'cat_id' ), "\n AND"
|
||||
);
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{ // weight is important when sorting images by relevance
|
||||
if ($row['nb_images']==0)
|
||||
{
|
||||
$search_results['qs']['matching_cats_no_images'][] = $row;
|
||||
}
|
||||
else
|
||||
{
|
||||
$search_results['qs']['matching_cats'][$row['id']] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($by_weights) and empty($search_results['qs']['matching_cats']) )
|
||||
{
|
||||
// before returning the result "as is", make sure the user has the
|
||||
// permissions for every item
|
||||
$query = '
|
||||
return $search_results;
|
||||
}
|
||||
|
||||
// Step 4 - now we have $by_weights ( array image id => weight ) that need
|
||||
// permission checks and/or matching categories to get images from
|
||||
$where_clauses = array();
|
||||
if ( !empty($by_weights) )
|
||||
{
|
||||
$where_clauses[]='i.id IN ('
|
||||
. implode(',', array_keys($by_weights)) . ')';
|
||||
}
|
||||
if ( !empty($search_results['qs']['matching_cats']) )
|
||||
{
|
||||
$where_clauses[]='category_id IN ('.
|
||||
implode(',',array_keys($search_results['qs']['matching_cats'])).')';
|
||||
}
|
||||
$where_clauses = array( '('.implode("\n OR ",$where_clauses).')' );
|
||||
if (!empty($images_where))
|
||||
{
|
||||
$where_clauses[]='('.$images_where.')';
|
||||
}
|
||||
$where_clauses[] = get_sql_condition_FandF(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'i.id'
|
||||
),
|
||||
null,true
|
||||
);
|
||||
|
||||
global $conf;
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
FROM '.IMAGES_TABLE.' i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
WHERE id IN ('.implode(',', array_keys($by_weights) ).')
|
||||
'.get_sql_condition_FandF
|
||||
(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'id'
|
||||
),
|
||||
'AND'
|
||||
);
|
||||
$allowed_image_ids = array_from_query( $query, 'id');
|
||||
$by_weights = array_intersect_key($by_weights, array_flip($allowed_image_ids));
|
||||
$permissions_checked = true;
|
||||
}
|
||||
arsort($by_weights, SORT_NUMERIC);
|
||||
if ( $permissions_checked )
|
||||
WHERE '.implode("\n AND ", $where_clauses)."\n".
|
||||
$conf['order_by'];
|
||||
|
||||
$allowed_images = array_from_query( $query, 'id');
|
||||
|
||||
if ( $super_order_by or empty($by_weights) )
|
||||
{
|
||||
$search_results['as_is']=1;
|
||||
$search_results['items'] = $allowed_images;
|
||||
return $search_results;
|
||||
}
|
||||
|
||||
$search_results['items'] = array_keys($by_weights);
|
||||
|
||||
$allowed_images = array_flip( $allowed_images );
|
||||
$divisor = 5.0 * count($allowed_images);
|
||||
foreach ($allowed_images as $id=>$rank )
|
||||
{
|
||||
$weight = isset($by_weights[$id]) ? $by_weights[$id] : 1;
|
||||
$weight -= $rank/$divisor;
|
||||
$allowed_images[$id] = $weight;
|
||||
}
|
||||
arsort($allowed_images, SORT_NUMERIC);
|
||||
$search_results['items'] = array_keys($allowed_images);
|
||||
return $search_results;
|
||||
}
|
||||
|
||||
|
@ -450,19 +583,20 @@ SELECT DISTINCT(id)
|
|||
* returns an array of 'items' corresponding to the search id
|
||||
*
|
||||
* @param int search id
|
||||
* @param string images_where optional aditional restriction on images table
|
||||
* @return array
|
||||
*/
|
||||
function get_search_results($search_id)
|
||||
function get_search_results($search_id, $super_order_by, $images_where='')
|
||||
{
|
||||
$search = get_search_array($search_id);
|
||||
if ( !isset($search['q']) )
|
||||
{
|
||||
$result['items'] = get_regular_search_results($search);
|
||||
$result['items'] = get_regular_search_results($search, $images_where);
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return get_quick_search_results($search['q']);
|
||||
return get_quick_search_results($search['q'], $super_order_by, $images_where);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -2,10 +2,9 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -87,19 +86,19 @@ function cookie_path()
|
|||
$scr = $_SERVER['REDIRECT_SCRIPT_NAME'];
|
||||
}
|
||||
else if ( isset($_SERVER['REDIRECT_URL']) )
|
||||
{ // mod_rewrite is activated for upper level directories. we must set the
|
||||
{
|
||||
// mod_rewrite is activated for upper level directories. we must set the
|
||||
// cookie to the path shown in the browser otherwise it will be discarded.
|
||||
if ( isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) )
|
||||
if
|
||||
(
|
||||
isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) and
|
||||
($_SERVER['REDIRECT_URL'] !== $_SERVER['PATH_INFO']) and
|
||||
(substr($_SERVER['REDIRECT_URL'],-strlen($_SERVER['PATH_INFO']))
|
||||
== $_SERVER['PATH_INFO'])
|
||||
)
|
||||
{
|
||||
$idx = strpos( $_SERVER['REDIRECT_URL'], $_SERVER['PATH_INFO'] );
|
||||
if ($idx !== false)
|
||||
{
|
||||
$scr = substr($_SERVER['REDIRECT_URL'], 0, $idx);
|
||||
}
|
||||
else
|
||||
{//this should never happen
|
||||
$scr='//';
|
||||
}
|
||||
$scr = substr($_SERVER['REDIRECT_URL'], 0,
|
||||
strlen($_SERVER['REDIRECT_URL'])-strlen($_SERVER['PATH_INFO']));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,10 +109,14 @@ function cookie_path()
|
|||
{
|
||||
$scr = $_SERVER['SCRIPT_NAME'];
|
||||
}
|
||||
|
||||
$scr = substr($scr,0,strrpos( $scr,'/'));
|
||||
|
||||
// add a trailing '/' if needed
|
||||
$scr .= ($scr{strlen($scr)-1} == '/') ? '' : '/';
|
||||
if ((strlen($scr) == 0) or ($scr{strlen($scr)-1} !== '/'))
|
||||
{
|
||||
$scr .= '/';
|
||||
}
|
||||
|
||||
if ( substr(PHPWG_ROOT_PATH,0,3)=='../')
|
||||
{ // this is maybe a plugin inside pwg directory
|
||||
|
|
|
@ -40,9 +40,9 @@ function get_available_tags()
|
|||
{
|
||||
// we can find top fatter tags among reachable images
|
||||
$tags_query = '
|
||||
SELECT id, name, url_name, count(*) counter
|
||||
SELECT t.*, count(*) counter
|
||||
FROM '.IMAGE_TAG_TABLE.'
|
||||
INNER JOIN '.TAGS_TABLE.' ON tag_id = id';
|
||||
INNER JOIN '.TAGS_TABLE.' t ON tag_id = id';
|
||||
|
||||
$where_tag_img =
|
||||
get_sql_condition_FandF
|
||||
|
@ -53,7 +53,8 @@ SELECT id, name, url_name, count(*) counter
|
|||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'image_id'
|
||||
),
|
||||
'WHERE'
|
||||
'
|
||||
WHERE'
|
||||
);
|
||||
|
||||
if (!empty($where_tag_img))
|
||||
|
@ -100,9 +101,7 @@ SELECT DISTINCT image_id
|
|||
function get_all_tags()
|
||||
{
|
||||
$query = '
|
||||
SELECT id,
|
||||
name,
|
||||
url_name
|
||||
SELECT *
|
||||
FROM '.TAGS_TABLE.'
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
@ -244,9 +243,9 @@ function get_common_tags($items, $max_tags, $excluded_tag_ids=null)
|
|||
return array();
|
||||
}
|
||||
$query = '
|
||||
SELECT id, name, url_name, count(*) counter
|
||||
SELECT t.*, count(*) counter
|
||||
FROM '.IMAGE_TAG_TABLE.'
|
||||
INNER JOIN '.TAGS_TABLE.' ON tag_id = id
|
||||
INNER JOIN '.TAGS_TABLE.' t ON tag_id = id
|
||||
WHERE image_id IN ('.implode(',', $items).')';
|
||||
if (!empty($excluded_tag_ids))
|
||||
{
|
||||
|
@ -261,6 +260,11 @@ SELECT id, name, url_name, count(*) counter
|
|||
ORDER BY counter DESC
|
||||
LIMIT 0,'.$max_tags;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= '
|
||||
ORDER BY NULL';
|
||||
}
|
||||
|
||||
$result = pwg_query($query);
|
||||
$tags = array();
|
||||
|
|
|
@ -60,10 +60,22 @@ function get_absolute_root_url($with_scheme=true)
|
|||
$url = '';
|
||||
if ($with_scheme)
|
||||
{
|
||||
$url .= 'http://'.$_SERVER['HTTP_HOST'];
|
||||
if ($_SERVER['SERVER_PORT']!=80)
|
||||
if (empty($_SERVER['HTTPS']))
|
||||
{
|
||||
$url .= ':'.$_SERVER['SERVER_PORT'];
|
||||
$url .= 'http://';
|
||||
}
|
||||
else
|
||||
{
|
||||
$url .= 'https://';
|
||||
}
|
||||
$url .= $_SERVER['HTTP_HOST'];
|
||||
if ($_SERVER['SERVER_PORT'] != 80)
|
||||
{
|
||||
$url_port = ':'.$_SERVER['SERVER_PORT'];
|
||||
if (strrchr($url, ':') != $url_port)
|
||||
{
|
||||
$url .= $url_port;
|
||||
}
|
||||
}
|
||||
}
|
||||
$url .= cookie_path();
|
||||
|
@ -246,6 +258,10 @@ function make_picture_url($params)
|
|||
default:
|
||||
$url .= $params['image_id'];
|
||||
}
|
||||
if ( !isset($params['category'] ) )
|
||||
{// make urls shorter ...
|
||||
unset( $params['flat'] );
|
||||
}
|
||||
$url .= make_section_in_url($params);
|
||||
$url = add_well_known_params_in_url($url, $params);
|
||||
return $url;
|
||||
|
@ -425,6 +441,222 @@ function make_section_in_url($params)
|
|||
return $section_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* the reverse of make_section_in_url
|
||||
* returns the 'section' (categories/tags/...) and the data associated with it
|
||||
*
|
||||
* Depending on section, other parameters are returned (category/tags/list/...)
|
||||
*
|
||||
* @param array of url tokens to parse
|
||||
* @param int the index in the array of url tokens; in/out
|
||||
* @return array
|
||||
*/
|
||||
function parse_section_url( $tokens, &$next_token)
|
||||
{
|
||||
$page=array();
|
||||
if (0 === strpos(@$tokens[$next_token], 'categor'))
|
||||
{
|
||||
$page['section'] = 'categories';
|
||||
$next_token++;
|
||||
|
||||
if (isset($tokens[$next_token]) )
|
||||
{
|
||||
if (preg_match('/^(\d+)(?:-(.+))?$/', $tokens[$next_token], $matches))
|
||||
{
|
||||
if ( isset($matches[2]) )
|
||||
$page['hit_by']['cat_url_name'] = $matches[2];
|
||||
$page['category'] = $matches[1];
|
||||
$next_token++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strpos($tokens[$next_token], 'created-')!==0
|
||||
and strpos($tokens[$next_token], 'posted-')!==0
|
||||
and strpos($tokens[$next_token], 'start-')!==0
|
||||
and $tokens[$next_token] != 'flat')
|
||||
{// try a permalink
|
||||
$cat_id = get_cat_id_from_permalink($tokens[$next_token]);
|
||||
if ( !isset($cat_id) )
|
||||
{//try old permalink
|
||||
$cat_id = get_cat_id_from_old_permalink($tokens[$next_token], true);
|
||||
}
|
||||
if ( isset($cat_id) )
|
||||
{
|
||||
$page['category'] = $cat_id;
|
||||
$page['hit_by']['cat_permalink'] = $tokens[$next_token];
|
||||
}
|
||||
else
|
||||
{
|
||||
page_not_found('Permalink for album not found');
|
||||
}
|
||||
$next_token++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($page['category']))
|
||||
{
|
||||
$result = get_cat_info($page['category']);
|
||||
if (empty($result))
|
||||
{
|
||||
page_not_found('Requested category does not exist' );
|
||||
}
|
||||
$page['category']=$result;
|
||||
}
|
||||
}
|
||||
else if (0 === strpos(@$tokens[$next_token], 'tag'))
|
||||
{
|
||||
$page['section'] = 'tags';
|
||||
$page['tags'] = array();
|
||||
|
||||
$next_token++;
|
||||
$i = $next_token;
|
||||
|
||||
$requested_tag_ids = array();
|
||||
$requested_tag_url_names = array();
|
||||
|
||||
while (isset($tokens[$i]))
|
||||
{
|
||||
if ( preg_match('/^(created-|posted-|start-(\d)+)/', $tokens[$i]) )
|
||||
break;
|
||||
|
||||
if ( preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches) )
|
||||
{
|
||||
array_push($requested_tag_ids, $matches[1]);
|
||||
}
|
||||
elseif ( !empty($tokens[$i]) )
|
||||
{
|
||||
array_push($requested_tag_url_names, $tokens[$i]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$next_token = $i;
|
||||
|
||||
if ( empty($requested_tag_ids) && empty($requested_tag_url_names) )
|
||||
{
|
||||
bad_request('at least one tag required');
|
||||
}
|
||||
|
||||
$page['tags'] = find_tags($requested_tag_ids, $requested_tag_url_names);
|
||||
if ( empty($page['tags']) )
|
||||
{
|
||||
page_not_found('Requested tag does not exist', get_root_url().'tags.php' );
|
||||
}
|
||||
}
|
||||
else if (0 === strpos(@$tokens[$next_token], 'fav'))
|
||||
{
|
||||
$page['section'] = 'favorites';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('most_visited' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'most_visited';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('best_rated' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'best_rated';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('recent_pics' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'recent_pics';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('recent_cats' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'recent_cats';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('search' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'search';
|
||||
$next_token++;
|
||||
|
||||
preg_match('/(\d+)/', @$tokens[$next_token], $matches);
|
||||
if (!isset($matches[1]))
|
||||
{
|
||||
bad_request('search identifier is missing');
|
||||
}
|
||||
$page['search'] = $matches[1];
|
||||
$next_token++;
|
||||
}
|
||||
else if ('list' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'list';
|
||||
$next_token++;
|
||||
|
||||
$page['list'] = array();
|
||||
|
||||
// No pictures
|
||||
if (empty($tokens[$next_token]))
|
||||
{
|
||||
// Add dummy element list
|
||||
array_push($page['list'], -1);
|
||||
}
|
||||
// With pictures list
|
||||
else
|
||||
{
|
||||
if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
|
||||
{
|
||||
bad_request('wrong format on list GET parameter');
|
||||
}
|
||||
foreach (explode(',', $tokens[$next_token]) as $image_id)
|
||||
{
|
||||
array_push($page['list'], $image_id);
|
||||
}
|
||||
}
|
||||
$next_token++;
|
||||
}
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* the reverse of add_well_known_params_in_url
|
||||
* parses start, flat and chronology from url tokens
|
||||
*/
|
||||
function parse_well_known_params_url($tokens, $i)
|
||||
{
|
||||
$page = array();
|
||||
while (isset($tokens[$i]))
|
||||
{
|
||||
if (preg_match('/^start-(\d+)/', $tokens[$i], $matches))
|
||||
{
|
||||
$page['start'] = $matches[1];
|
||||
}
|
||||
|
||||
if ( 'flat' == $tokens[$i] )
|
||||
{
|
||||
// indicate a special list of images
|
||||
$page['flat'] = true;
|
||||
}
|
||||
|
||||
if (preg_match('/^(posted|created)/', $tokens[$i] ))
|
||||
{
|
||||
$chronology_tokens = explode('-', $tokens[$i] );
|
||||
|
||||
$page['chronology_field'] = $chronology_tokens[0];
|
||||
|
||||
array_shift($chronology_tokens);
|
||||
$page['chronology_style'] = $chronology_tokens[0];
|
||||
|
||||
array_shift($chronology_tokens);
|
||||
if ( count($chronology_tokens)>0 )
|
||||
{
|
||||
if ('list'==$chronology_tokens[0] or
|
||||
'calendar'==$chronology_tokens[0])
|
||||
{
|
||||
$page['chronology_view'] = $chronology_tokens[0];
|
||||
array_shift($chronology_tokens);
|
||||
}
|
||||
$page['chronology_date'] = $chronology_tokens;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate to build url with full path
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
|
@ -44,11 +44,11 @@ function validate_mail_address( $mail_address )
|
|||
}
|
||||
}
|
||||
|
||||
function register_user($login, $password, $mail_address)
|
||||
function register_user($login, $password, $mail_address,
|
||||
$with_notification = true, $errors = array())
|
||||
{
|
||||
global $lang, $conf;
|
||||
|
||||
$errors = array();
|
||||
if ($login == '')
|
||||
{
|
||||
array_push($errors, $lang['reg_err_login1']);
|
||||
|
@ -71,6 +71,15 @@ function register_user($login, $password, $mail_address)
|
|||
array_push($errors, $mail_error);
|
||||
}
|
||||
|
||||
$errors = trigger_event('register_user_check',
|
||||
$errors,
|
||||
array(
|
||||
'username'=>$login,
|
||||
'password'=>$password,
|
||||
'email'=>$mail_address,
|
||||
)
|
||||
);
|
||||
|
||||
// if no error until here, registration of the user
|
||||
if (count($errors) == 0)
|
||||
{
|
||||
|
@ -92,28 +101,29 @@ SELECT MAX('.$conf['user_fields']['id'].') + 1
|
|||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
mass_inserts(USERS_TABLE, array_keys($insert), array($insert));
|
||||
|
||||
// Assign by default groups
|
||||
{
|
||||
$query = '
|
||||
// Assign by default groups
|
||||
{
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.GROUPS_TABLE.'
|
||||
WHERE is_default = \''.boolean_to_string(true).'\'
|
||||
ORDER BY id ASC
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
$result = pwg_query($query);
|
||||
|
||||
$inserts = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push
|
||||
(
|
||||
$inserts,
|
||||
array
|
||||
$inserts = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push
|
||||
(
|
||||
'user_id' => $next_id,
|
||||
'group_id' => $row['id']
|
||||
)
|
||||
);
|
||||
$inserts,
|
||||
array
|
||||
(
|
||||
'user_id' => $next_id,
|
||||
'group_id' => $row['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($inserts) != 0)
|
||||
|
@ -121,10 +131,31 @@ SELECT id
|
|||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts);
|
||||
}
|
||||
}
|
||||
|
||||
create_user_infos($next_id);
|
||||
|
||||
if ($with_notification and $conf['email_admin_on_new_user'])
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
|
||||
$username = $_POST['login'];
|
||||
$admin_url = get_absolute_root_url()
|
||||
.'admin.php?page=user_list&username='.$username;
|
||||
|
||||
$keyargs_content = array
|
||||
(
|
||||
get_l10n_args('User: %s', $username),
|
||||
get_l10n_args('Email: %s', $_POST['mail_address']),
|
||||
get_l10n_args('', ''),
|
||||
get_l10n_args('Admin: %s', $admin_url)
|
||||
);
|
||||
|
||||
pwg_mail_notification_admins
|
||||
(
|
||||
get_l10n_args('Registration of %s', $username),
|
||||
$keyargs_content
|
||||
);
|
||||
}
|
||||
|
||||
trigger_action('register_user',
|
||||
array(
|
||||
'id'=>$next_id,
|
||||
|
@ -145,31 +176,34 @@ function setup_style($style)
|
|||
function build_user( $user_id, $use_cache )
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$user['id'] = $user_id;
|
||||
$user = array_merge( $user, getuserdata($user_id, $use_cache) );
|
||||
$user['is_the_guest'] = ($user['id'] == $conf['guest_id']);
|
||||
$user['is_the_default'] = ($user['id'] == $conf['default_user_id']);
|
||||
|
||||
if ($user['is_the_guest'] and $user['status'] <> 'guest')
|
||||
{
|
||||
$user['status'] = 'guest';
|
||||
$user['internal_status']['guest_must_be_guest'] = true;
|
||||
}
|
||||
|
||||
// calculation of the number of picture to display per page
|
||||
$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
|
||||
|
||||
// include template/theme configuration
|
||||
if (defined('IN_ADMIN') and IN_ADMIN)
|
||||
if (is_admin($user['status']))
|
||||
{
|
||||
list($user['template'], $user['theme']) =
|
||||
list($user['admin_template'], $user['admin_theme']) =
|
||||
explode
|
||||
(
|
||||
'/',
|
||||
isset($conf['default_admin_layout']) ? $conf['default_admin_layout']
|
||||
: $user['template']
|
||||
);
|
||||
// TODO : replace $conf['admin_layout'] by $user['admin_layout']
|
||||
}
|
||||
else
|
||||
{
|
||||
list($user['template'], $user['theme']) = explode('/', $user['template']);
|
||||
}
|
||||
|
||||
list($user['template'], $user['theme']) = explode('/', $user['template']);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -813,7 +847,7 @@ function create_user_infos($arg_id, $override_values = null)
|
|||
else
|
||||
{
|
||||
$user_ids = array();
|
||||
if (is_integer($arg_id))
|
||||
if (is_numeric($arg_id))
|
||||
{
|
||||
$user_ids[] = $arg_id;
|
||||
}
|
||||
|
@ -1140,9 +1174,10 @@ function get_access_type_status($user_status='')
|
|||
$access_type_status = ACCESS_WEBMASTER;
|
||||
break;
|
||||
}
|
||||
case 'default':
|
||||
default:
|
||||
{
|
||||
$access_type_status = ACCESS_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1242,7 @@ function get_email_address_as_display_text($email_address)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (is_adviser())
|
||||
if (defined('IN_ADMIN') and is_adviser())
|
||||
{
|
||||
return 'adviser.mode@'.$_SERVER['SERVER_NAME'];
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -65,7 +65,7 @@ function encodeAttribute( $attribute, $value )
|
|||
{
|
||||
return $attribute.'="'.htmlspecialchars($value, ENT_QUOTES).'" ';
|
||||
}
|
||||
|
||||
|
||||
// The function getChild returns the first child
|
||||
// exemple : getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )
|
||||
// returns "<tr>XXX</tr>"
|
||||
|
@ -74,8 +74,19 @@ function getChild( $document, $node )
|
|||
$regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
|
||||
$regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
|
||||
|
||||
preg_match( $regex, $document, $out );
|
||||
return $out[0];
|
||||
if
|
||||
(
|
||||
preg_match( $regex, $document, $out )
|
||||
or
|
||||
preg_last_error() == PREG_NO_ERROR
|
||||
)
|
||||
{
|
||||
return $out[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
die('getChild: error ['.preg_last_error().'] with preg_match function');
|
||||
}
|
||||
}
|
||||
|
||||
// getChildren returns a list of the children identified by the $node
|
||||
|
@ -89,14 +100,31 @@ function getChildren( $document, $node )
|
|||
$regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
|
||||
$regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
|
||||
|
||||
preg_match_all( $regex, $document, $out );
|
||||
return $out[0];
|
||||
if
|
||||
(
|
||||
preg_match_all( $regex, $document, $out )
|
||||
or
|
||||
preg_last_error() == PREG_NO_ERROR
|
||||
)
|
||||
{
|
||||
return $out[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
die('getChild: error ['.preg_last_error().'] with preg_match_all function');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get_CodeXML places the content of a text file in a PHP variable and
|
||||
// return it. If the file can't be opened, returns false.
|
||||
function getXmlCode( $filename )
|
||||
{
|
||||
if (function_exists('ini_set'))
|
||||
{
|
||||
// limit must be growed with php5 and "big" listing file
|
||||
ini_set("pcre.backtrack_limit", pow(2, 32));
|
||||
}
|
||||
|
||||
$file = fopen( $filename, 'r' );
|
||||
if ( !$file )
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ foreach ($conf['links'] as $url => $url_data)
|
|||
$url_data = array('label' => $url_data);
|
||||
}
|
||||
|
||||
if
|
||||
if
|
||||
(
|
||||
(!isset($url_data['eval_visible']))
|
||||
or
|
||||
|
@ -76,7 +76,7 @@ foreach ($conf['links'] as $url => $url_data)
|
|||
if (!isset($url_data['new_window']) or $url_data['new_window'])
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'links.link.new_window',
|
||||
'links.link.new_window',
|
||||
array(
|
||||
'name' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
|
||||
'features' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
|
||||
|
@ -126,18 +126,21 @@ if ('tags' == $page['section'])
|
|||
{
|
||||
$template->assign_block_vars(
|
||||
'tags.tag',
|
||||
array(
|
||||
'URL' => make_index_url(
|
||||
array(
|
||||
'tags' => array($tag)
|
||||
)
|
||||
),
|
||||
array_merge(
|
||||
$tag,
|
||||
array(
|
||||
'URL' => make_index_url(
|
||||
array(
|
||||
'tags' => array($tag)
|
||||
)
|
||||
),
|
||||
|
||||
'NAME' => $tag['name'],
|
||||
'NAME' => $tag['name'],
|
||||
|
||||
'TITLE' => l10n('See pictures linked to this tag only'),
|
||||
'TITLE' => l10n('See pictures linked to this tag only'),
|
||||
|
||||
'CLASS' => 'tagLevel'.$tag['level']
|
||||
'CLASS' => 'tagLevel'.$tag['level']
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -153,7 +156,7 @@ if ('tags' == $page['section'])
|
|||
)
|
||||
),
|
||||
'TITLE' => l10n_dec(
|
||||
'%d picture are also linked to current tags',
|
||||
'%d picture is also linked to current tags',
|
||||
'%d pictures are also linked to current tags',
|
||||
$tag['counter']),
|
||||
)
|
||||
|
@ -171,8 +174,8 @@ if ( !$user['is_the_guest'] )
|
|||
'special_cat',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'favorites')),
|
||||
'TITLE' => $lang['favorite_cat_hint'],
|
||||
'NAME' => $lang['favorite_cat']
|
||||
'TITLE' => l10n('favorite_cat_hint'),
|
||||
'NAME' => l10n('favorite_cat')
|
||||
));
|
||||
}
|
||||
// most visited
|
||||
|
@ -180,8 +183,8 @@ $template->assign_block_vars(
|
|||
'special_cat',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'most_visited')),
|
||||
'TITLE' => $lang['most_visited_cat_hint'],
|
||||
'NAME' => $lang['most_visited_cat']
|
||||
'TITLE' => l10n('most_visited_cat_hint'),
|
||||
'NAME' => l10n('most_visited_cat')
|
||||
));
|
||||
// best rated
|
||||
if ($conf['rate'])
|
||||
|
@ -190,8 +193,8 @@ if ($conf['rate'])
|
|||
'special_cat',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'best_rated')),
|
||||
'TITLE' => $lang['best_rated_cat_hint'],
|
||||
'NAME' => $lang['best_rated_cat']
|
||||
'TITLE' => l10n('best_rated_cat_hint'),
|
||||
'NAME' => l10n('best_rated_cat')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -200,8 +203,8 @@ $template->assign_block_vars(
|
|||
'special_cat',
|
||||
array(
|
||||
'URL' => get_root_url().'random.php',
|
||||
'TITLE' => $lang['random_cat_hint'],
|
||||
'NAME' => $lang['random_cat'],
|
||||
'TITLE' => l10n('random_cat_hint'),
|
||||
'NAME' => l10n('random_cat'),
|
||||
'REL'=> 'rel="nofollow"'
|
||||
));
|
||||
|
||||
|
@ -210,16 +213,16 @@ $template->assign_block_vars(
|
|||
'special_cat',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'recent_pics')),
|
||||
'TITLE' => $lang['recent_pics_cat_hint'],
|
||||
'NAME' => $lang['recent_pics_cat'],
|
||||
'TITLE' => l10n('recent_pics_cat_hint'),
|
||||
'NAME' => l10n('recent_pics_cat'),
|
||||
));
|
||||
// recent cats
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'recent_cats')),
|
||||
'TITLE' => $lang['recent_cats_cat_hint'],
|
||||
'NAME' => $lang['recent_cats_cat'],
|
||||
'TITLE' => l10n('recent_cats_cat_hint'),
|
||||
'NAME' => l10n('recent_cats_cat'),
|
||||
));
|
||||
|
||||
// calendar
|
||||
|
@ -235,8 +238,8 @@ $template->assign_block_vars(
|
|||
'chronology_view' => 'calendar'
|
||||
)
|
||||
),
|
||||
'TITLE' => $lang['calendar_hint'],
|
||||
'NAME' => $lang['calendar'],
|
||||
'TITLE' => l10n('calendar_hint'),
|
||||
'NAME' => l10n('calendar'),
|
||||
'REL'=> 'rel="nofollow"'
|
||||
)
|
||||
);
|
||||
|
@ -293,8 +296,8 @@ $template->assign_block_vars(
|
|||
$template->assign_block_vars(
|
||||
'summary',
|
||||
array(
|
||||
'TITLE'=>$lang['hint_search'],
|
||||
'NAME'=>$lang['search'],
|
||||
'TITLE'=>l10n('hint_search'),
|
||||
'NAME'=>l10n('search'),
|
||||
'U_SUMMARY'=> get_root_url().'search.php',
|
||||
'REL'=> 'rel="search"'
|
||||
)
|
||||
|
@ -305,8 +308,8 @@ $template->assign_block_vars( 'summary.quick_search', array() );
|
|||
$template->assign_block_vars(
|
||||
'summary',
|
||||
array(
|
||||
'TITLE'=>$lang['hint_comments'],
|
||||
'NAME'=>$lang['comments'],
|
||||
'TITLE'=>l10n('hint_comments'),
|
||||
'NAME'=>l10n('comments'),
|
||||
'U_SUMMARY'=> get_root_url().'comments.php',
|
||||
)
|
||||
);
|
||||
|
@ -315,8 +318,8 @@ $template->assign_block_vars(
|
|||
$template->assign_block_vars(
|
||||
'summary',
|
||||
array(
|
||||
'TITLE' => $lang['about_page_title'],
|
||||
'NAME' => $lang['About'],
|
||||
'TITLE' => l10n('about_page_title'),
|
||||
'NAME' => l10n('About'),
|
||||
'U_SUMMARY' => get_root_url().'about.php',
|
||||
)
|
||||
);
|
||||
|
|
|
@ -39,8 +39,9 @@ $template->assign_vars(
|
|||
$page['gallery_title'] : $conf['gallery_title'],
|
||||
|
||||
'PAGE_BANNER' =>
|
||||
isset($page['page_banner']) ?
|
||||
$page['page_banner'] : $conf['page_banner'],
|
||||
trigger_event('render_page_banner',
|
||||
isset($page['page_banner']) ?
|
||||
$page['page_banner'] : $conf['page_banner']),
|
||||
|
||||
'BODY_ID' =>
|
||||
isset($page['body_id']) ?
|
||||
|
@ -53,7 +54,7 @@ $template->assign_vars(
|
|||
|
||||
'TAG_INPUT_ENABLED' =>
|
||||
((is_adviser()) ? 'disabled onclick="return false;"' : ''),
|
||||
'U_HOME' => get_absolute_root_url(),
|
||||
'U_HOME' => make_index_url(),
|
||||
));
|
||||
|
||||
// picture header infos
|
||||
|
@ -103,4 +104,4 @@ header('Content-Type: text/html; charset='.$lang_info['charset']);
|
|||
$template->parse('header');
|
||||
|
||||
trigger_action('loc_after_page_header');
|
||||
?>
|
||||
?>
|
|
@ -33,7 +33,7 @@ $template->assign_vars(
|
|||
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
|
||||
'PHPWG_URL' => PHPWG_URL,
|
||||
|
||||
'L_TITLE_MAIL' => urlencode($lang['title_send_mail']),
|
||||
'L_TITLE_MAIL' => urlencode(l10n('title_send_mail')),
|
||||
));
|
||||
|
||||
//--------------------------------------------------------------------- contact
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -25,6 +25,21 @@
|
|||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// with 1.5 preparation, no group dedicated function is used.
|
||||
// http://www.php.net/manual/fr/function.preg-last-error.php
|
||||
// PHP 5 >= 5.2.0
|
||||
if (!defined('PREG_NO_ERROR'))
|
||||
define('PREG_NO_ERROR', 0);
|
||||
if (!defined('PREG_INTERNAL_ERROR'))
|
||||
define('PREG_INTERNAL_ERROR', 1);
|
||||
if (!defined('PREG_BACKTRACK_LIMIT_ERROR'))
|
||||
define('PREG_BACKTRACK_LIMIT_ERROR', 2);
|
||||
if (!defined('PREG_RECURSION_LIMIT_ERROR'))
|
||||
define('PREG_RECURSION_LIMIT_ERROR', 3);
|
||||
if (!defined('PREG_BAD_UTF8_ERROR'))
|
||||
define('PREG_BAD_UTF8_ERROR', 4);
|
||||
|
||||
?>
|
||||
function preg_last_error()
|
||||
{
|
||||
return PREG_NO_ERROR;
|
||||
}
|
||||
?>
|
|
@ -55,7 +55,7 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
|
|||
);
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
|
||||
|
||||
|
||||
$comment_action = insert_user_comment($comm, @$_POST['key'], $infos );
|
||||
|
||||
switch ($comment_action)
|
||||
|
@ -65,7 +65,7 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
|
|||
case 'validate':
|
||||
array_push( $infos, $lang['comment_added']);
|
||||
break;
|
||||
case 'reject':
|
||||
case 'reject':
|
||||
set_status_header(403);
|
||||
array_push($infos, l10n('comment_not_added') );
|
||||
break;
|
||||
|
@ -86,7 +86,11 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
|
|||
array_merge($comm, array('action'=>$comment_action) )
|
||||
);
|
||||
}
|
||||
|
||||
elseif ( isset($_POST['content']) )
|
||||
{
|
||||
set_status_header(403);
|
||||
die('ugly spammer');
|
||||
}
|
||||
|
||||
if ($page['show_comments'])
|
||||
{
|
||||
|
@ -136,9 +140,10 @@ SELECT id,author,date,image_id,content
|
|||
$template->assign_block_vars(
|
||||
'comments.comment',
|
||||
array(
|
||||
'COMMENT_AUTHOR' => empty($row['author'])
|
||||
'COMMENT_AUTHOR' => trigger_event('render_comment_author',
|
||||
empty($row['author'])
|
||||
? $lang['guest']
|
||||
: $row['author'],
|
||||
: $row['author']),
|
||||
|
||||
'COMMENT_DATE' => format_date(
|
||||
$row['date'],
|
||||
|
|
|
@ -32,17 +32,25 @@
|
|||
|
||||
if ($conf['rate'])
|
||||
{
|
||||
$query = '
|
||||
if ( NULL != $picture['current']['average_rate'] )
|
||||
{
|
||||
$query = '
|
||||
SELECT COUNT(rate) AS count
|
||||
, ROUND(AVG(rate),2) AS average
|
||||
, ROUND(STD(rate),2) AS STD
|
||||
FROM '.RATE_TABLE.'
|
||||
WHERE element_id = '.$picture['current']['id'].'
|
||||
;';
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
}
|
||||
else
|
||||
{ // avg rate null -> no rate -> no need to query db
|
||||
$row = array( 'count'=>0, 'average'=>NULL, 'std'=>NULL );
|
||||
}
|
||||
|
||||
if ($row['count'] == 0)
|
||||
{
|
||||
$value = $lang['no_rate'];
|
||||
$value = l10n('no_rate');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -96,6 +96,10 @@ if (script_basename() == 'picture') // basename without file extention
|
|||
if ( is_numeric($token) )
|
||||
{
|
||||
$page['image_id'] = $token;
|
||||
if ($page['image_id']==0)
|
||||
{
|
||||
bad_request('invalid picture identifier');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -122,162 +126,15 @@ if (script_basename() == 'picture') // basename without file extention
|
|||
}
|
||||
}
|
||||
|
||||
if (0 === strpos(@$tokens[$next_token], 'categor'))
|
||||
{
|
||||
$page['section'] = 'categories';
|
||||
$next_token++;
|
||||
|
||||
if (isset($tokens[$next_token]) )
|
||||
{
|
||||
if (preg_match('/^(\d+)(?:-(.+))?$/', $tokens[$next_token], $matches))
|
||||
{
|
||||
if ( isset($matches[2]) )
|
||||
$page['hit_by']['cat_url_name'] = $matches[2];
|
||||
$page['category'] = $matches[1];
|
||||
$next_token++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strpos($tokens[$next_token], 'created-')!==0
|
||||
and strpos($tokens[$next_token], 'posted-')!==0
|
||||
and $tokens[$next_token] != 'flat')
|
||||
{// try a permalink
|
||||
$cat_id = get_cat_id_from_permalink($tokens[$next_token]);
|
||||
if ( !isset($cat_id) )
|
||||
{//try old permalink
|
||||
$cat_id = get_cat_id_from_old_permalink($tokens[$next_token], true);
|
||||
}
|
||||
if ( isset($cat_id) )
|
||||
{
|
||||
$page['category'] = $cat_id;
|
||||
$page['hit_by']['cat_permalink'] = $tokens[$next_token];
|
||||
}
|
||||
else
|
||||
{
|
||||
page_not_found('Permalink for album not found');
|
||||
}
|
||||
unset($cat_id);
|
||||
$next_token++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (0 === strpos(@$tokens[$next_token], 'tag'))
|
||||
{
|
||||
$page['section'] = 'tags';
|
||||
$page['tags'] = array();
|
||||
|
||||
$next_token++;
|
||||
$i = $next_token;
|
||||
|
||||
$requested_tag_ids = array();
|
||||
$requested_tag_url_names = array();
|
||||
|
||||
while (isset($tokens[$i]))
|
||||
{
|
||||
if ( preg_match('/^(created-|posted-|start-(\d)+)/', $tokens[$i]) )
|
||||
break;
|
||||
|
||||
if ( preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches) )
|
||||
{
|
||||
array_push($requested_tag_ids, $matches[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($requested_tag_url_names, $tokens[$i]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$next_token = $i;
|
||||
|
||||
if ( empty($requested_tag_ids) && empty($requested_tag_url_names) )
|
||||
{
|
||||
bad_request('at least one tag required');
|
||||
}
|
||||
|
||||
$page['tags'] = find_tags($requested_tag_ids, $requested_tag_url_names);
|
||||
if ( empty($page['tags']) )
|
||||
{
|
||||
page_not_found('Requested tag does not exist', get_root_url().'tags.php' );
|
||||
}
|
||||
}
|
||||
else if (0 === strpos(@$tokens[$next_token], 'fav'))
|
||||
{
|
||||
$page['section'] = 'favorites';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('most_visited' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'most_visited';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('best_rated' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'best_rated';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('recent_pics' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'recent_pics';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('recent_cats' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'recent_cats';
|
||||
$next_token++;
|
||||
}
|
||||
else if ('search' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'search';
|
||||
$next_token++;
|
||||
|
||||
preg_match('/(\d+)/', @$tokens[$next_token], $matches);
|
||||
if (!isset($matches[1]))
|
||||
{
|
||||
bad_request('search identifier is missing');
|
||||
}
|
||||
$page['search'] = $matches[1];
|
||||
$next_token++;
|
||||
}
|
||||
else if ('list' == @$tokens[$next_token])
|
||||
{
|
||||
$page['section'] = 'list';
|
||||
$next_token++;
|
||||
|
||||
$page['list'] = array();
|
||||
|
||||
// No pictures
|
||||
if (empty($tokens[$next_token]))
|
||||
{
|
||||
// Add dummy element list
|
||||
array_push($page['list'], -1);
|
||||
}
|
||||
// With pictures list
|
||||
else
|
||||
{
|
||||
if (!preg_match('/^\d+(,\d+)*$/', $tokens[$next_token]))
|
||||
{
|
||||
bad_request('wrong format on list GET parameter');
|
||||
}
|
||||
foreach (explode(',', $tokens[$next_token]) as $image_id)
|
||||
{
|
||||
array_push($page['list'], $image_id);
|
||||
}
|
||||
}
|
||||
$next_token++;
|
||||
}
|
||||
else
|
||||
$page = array_merge( $page, parse_section_url( $tokens, $next_token) );
|
||||
if ( !isset($page['section']) )
|
||||
{
|
||||
$page['section'] = 'categories';
|
||||
|
||||
switch (script_basename())
|
||||
{
|
||||
case 'picture':
|
||||
{
|
||||
//access a picture only by id, file or id-file without given section
|
||||
$page['flat'] = true;
|
||||
break;
|
||||
}
|
||||
case 'index':
|
||||
{
|
||||
// No section defined, go to selected url
|
||||
|
@ -304,45 +161,14 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
$i = $next_token;
|
||||
|
||||
while (isset($tokens[$i]))
|
||||
{
|
||||
if (preg_match('/^start-(\d+)/', $tokens[$i], $matches))
|
||||
{
|
||||
$page['start'] = $matches[1];
|
||||
}
|
||||
$page = array_merge( $page, parse_well_known_params_url( $tokens, $next_token) );
|
||||
|
||||
if ('categories' == $page['section'] and
|
||||
'flat' == $tokens[$i])
|
||||
{
|
||||
// indicate a special list of images
|
||||
$page['flat'] = true;
|
||||
}
|
||||
|
||||
if (preg_match('/^(posted|created)/', $tokens[$i] ))
|
||||
{
|
||||
$chronology_tokens = explode('-', $tokens[$i] );
|
||||
|
||||
$page['chronology_field'] = $chronology_tokens[0];
|
||||
|
||||
array_shift($chronology_tokens);
|
||||
$page['chronology_style'] = $chronology_tokens[0];
|
||||
|
||||
array_shift($chronology_tokens);
|
||||
if ( count($chronology_tokens)>0 )
|
||||
{
|
||||
if ('list'==$chronology_tokens[0] or
|
||||
'calendar'==$chronology_tokens[0])
|
||||
{
|
||||
$page['chronology_view'] = $chronology_tokens[0];
|
||||
array_shift($chronology_tokens);
|
||||
}
|
||||
$page['chronology_date'] = $chronology_tokens;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
if ( script_basename()=='picture' and 'categories'==$page['section'] and
|
||||
!isset($page['category']) and !isset($page['chronology_field']) )
|
||||
{ //access a picture only by id, file or id-file without given section
|
||||
$page['flat']=true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,25 +205,23 @@ if ('categories' == $page['section'])
|
|||
{
|
||||
if (isset($page['category']))
|
||||
{
|
||||
$result = get_cat_info($page['category']);
|
||||
if (empty($result))
|
||||
{
|
||||
page_not_found('Requested category does not exist' );
|
||||
}
|
||||
|
||||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'comment' => $result['comment'],
|
||||
'category' => $result,
|
||||
'comment' =>
|
||||
trigger_event(
|
||||
'render_category_description',
|
||||
$page['category']['comment'],
|
||||
'main_page_category_description'
|
||||
),
|
||||
'title' =>
|
||||
get_cat_display_name($result['upper_names'], '', false),
|
||||
get_cat_display_name($page['category']['upper_names'], '', false),
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['title'] = $lang['no_category'];
|
||||
$page['title'] = l10n('no_category');
|
||||
}
|
||||
|
||||
if
|
||||
|
@ -409,17 +233,36 @@ if ('categories' == $page['section'])
|
|||
)
|
||||
)
|
||||
{
|
||||
if ( !empty($result['image_order']) and !isset($page['super_order_by']) )
|
||||
if ( !empty($page['category']['image_order']) and !isset($page['super_order_by']) )
|
||||
{
|
||||
$conf[ 'order_by' ] = ' ORDER BY '.$result['image_order'];
|
||||
$conf[ 'order_by' ] = ' ORDER BY '.$page['category']['image_order'];
|
||||
}
|
||||
|
||||
if (isset($page['flat']))
|
||||
{// flat categories mode
|
||||
if ( isset($page['category']) )
|
||||
{
|
||||
$subcat_ids = get_subcat_ids( array($page['category']['id']) );
|
||||
{ // get all allowed sub-categories
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE
|
||||
uppercats LIKE "'.$page['category']['uppercats'].',%" '
|
||||
.get_sql_condition_FandF(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'id',
|
||||
'visible_categories' => 'id',
|
||||
),
|
||||
"\n AND"
|
||||
);
|
||||
$subcat_ids = array_from_query($query, 'id');
|
||||
$subcat_ids[] = $page['category']['id'];
|
||||
$where_sql = 'category_id IN ('.implode(',',$subcat_ids).')';
|
||||
// remove categories from forbidden because just checked above
|
||||
$forbidden = get_sql_condition_FandF(
|
||||
array( 'visible_images' => 'id' ),
|
||||
'AND'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -467,15 +310,13 @@ else
|
|||
if (!empty($items) )
|
||||
{
|
||||
$query = '
|
||||
SELECT image_id
|
||||
SELECT DISTINCT(image_id)
|
||||
FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id
|
||||
WHERE image_id IN ('.implode(',', $items).')
|
||||
'.$forbidden.
|
||||
$conf['order_by'].'
|
||||
;';
|
||||
$items = array_unique(
|
||||
array_from_query($query, 'image_id')
|
||||
);
|
||||
$items = array_from_query($query, 'image_id');
|
||||
}
|
||||
|
||||
$title = get_tags_content_title();
|
||||
|
@ -484,7 +325,7 @@ SELECT image_id
|
|||
$page,
|
||||
array(
|
||||
'title' => $title,
|
||||
'items' => array_values($items),
|
||||
'items' => $items,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -495,28 +336,18 @@ SELECT image_id
|
|||
{
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_search.inc.php' );
|
||||
|
||||
$search_result = get_search_results($page['search']);
|
||||
if ( !empty($search_result['items']) and !isset($search_result['as_is']) )
|
||||
{
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
WHERE id IN ('.implode(',', $search_result['items']).')
|
||||
'.$forbidden.'
|
||||
'.$conf['order_by'].'
|
||||
;';
|
||||
$page['items'] = array_from_query($query, 'id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['items'] = $search_result['items'];
|
||||
$search_result = get_search_results($page['search'], @$page['super_order_by'] );
|
||||
if ( isset($search_result['qs']) )
|
||||
{//save the details of the query search
|
||||
$page['qsearch_details'] = $search_result['qs'];
|
||||
}
|
||||
|
||||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => $lang['search_result'],
|
||||
'items' => $search_result['items'],
|
||||
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
|
||||
.l10n('search_result').'</a>',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -536,7 +367,7 @@ SELECT image_id
|
|||
(
|
||||
array
|
||||
(
|
||||
'visible_images' => 'image_id'
|
||||
'visible_images' => 'id'
|
||||
),
|
||||
'AND'
|
||||
).'
|
||||
|
@ -546,7 +377,7 @@ SELECT image_id
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => $lang['favorites'],
|
||||
'title' => l10n('favorites'),
|
||||
'items' => array_from_query($query, 'image_id'),
|
||||
)
|
||||
);
|
||||
|
@ -556,6 +387,15 @@ SELECT image_id
|
|||
// +-----------------------------------------------------------------------+
|
||||
else if ($page['section'] == 'recent_pics')
|
||||
{
|
||||
if ( !isset($page['super_order_by']) )
|
||||
{
|
||||
$conf['order_by'] = str_replace(
|
||||
'ORDER BY ',
|
||||
'ORDER BY date_available DESC,',
|
||||
$conf['order_by']
|
||||
);
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
|
@ -570,8 +410,8 @@ SELECT DISTINCT(id)
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => '<a href="'.duplicate_index_url().'">'
|
||||
.$lang['recent_pics_cat'].'</a>',
|
||||
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
|
||||
.l10n('recent_pics_cat').'</a>',
|
||||
'items' => array_from_query($query, 'id'),
|
||||
)
|
||||
);
|
||||
|
@ -584,7 +424,7 @@ SELECT DISTINCT(id)
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => $lang['recent_cats_cat'],
|
||||
'title' => l10n('recent_cats_cat'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -608,8 +448,8 @@ SELECT DISTINCT(id)
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => '<a href="'.duplicate_index_url().'">'
|
||||
.$conf['top_number'].' '.$lang['most_visited_cat'].'</a>',
|
||||
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
|
||||
.$conf['top_number'].' '.l10n('most_visited_cat').'</a>',
|
||||
'items' => array_from_query($query, 'id'),
|
||||
)
|
||||
);
|
||||
|
@ -634,8 +474,8 @@ SELECT DISTINCT(id)
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => '<a href="'.duplicate_index_url().'">'
|
||||
.$conf['top_number'].' '.$lang['best_rated_cat'].'</a>',
|
||||
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
|
||||
.$conf['top_number'].' '.l10n('best_rated_cat').'</a>',
|
||||
'items' => array_from_query($query, 'id'),
|
||||
)
|
||||
);
|
||||
|
@ -657,8 +497,8 @@ SELECT DISTINCT(id)
|
|||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'title' => '<a href="'.duplicate_index_url().'">'
|
||||
.$lang['random_cat'].'</a>',
|
||||
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
|
||||
.l10n('random_cat').'</a>',
|
||||
'items' => array_from_query($query, 'id'),
|
||||
)
|
||||
);
|
||||
|
@ -678,29 +518,13 @@ if (isset($page['chronology_field']))
|
|||
if (script_basename() == 'picture'
|
||||
and !isset($page['image_id']) )
|
||||
{
|
||||
if ( !empty($page['items']) )
|
||||
{
|
||||
$query = '
|
||||
SELECT id,file
|
||||
FROM '.IMAGES_TABLE .'
|
||||
WHERE id IN ('.implode(',',$page['items']).')
|
||||
AND file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"'
|
||||
;
|
||||
$result = pwg_query($query);
|
||||
if (mysql_num_rows($result)>0)
|
||||
{
|
||||
list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
|
||||
}
|
||||
}
|
||||
if ( !isset($page['image_id']) )
|
||||
{
|
||||
$page['image_id'] = -1; // will fail in picture.php
|
||||
}
|
||||
$page['image_id'] = 0; // more work in picture.php
|
||||
}
|
||||
|
||||
// add meta robots noindex, nofollow to avoid unnecesary robot crawls
|
||||
$page['meta_robots']=array();
|
||||
if ( isset($page['chronology_field']) or isset($page['flat'])
|
||||
if ( isset($page['chronology_field'])
|
||||
or ( isset($page['flat']) and isset($page['category']) )
|
||||
or 'list'==$page['section'] or 'recent_pics'==$page['section'] )
|
||||
{
|
||||
$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
|
||||
|
@ -713,9 +537,14 @@ elseif ('tags' == $page['section'])
|
|||
}
|
||||
}
|
||||
elseif ('recent_cats'==$page['section'])
|
||||
{
|
||||
$page['meta_robots']['noindex']=1;
|
||||
}
|
||||
elseif ('search'==$page['section'])
|
||||
{
|
||||
$page['meta_robots']['nofollow']=1;
|
||||
}
|
||||
|
||||
if ( $filter['enabled'] )
|
||||
{
|
||||
$page['meta_robots']['noindex']=1;
|
||||
|
@ -749,7 +578,7 @@ if ( 'categories'==$page['section'] and isset($page['category']) )
|
|||
);
|
||||
if (!headers_sent())
|
||||
{ // this is a permanent redirection
|
||||
set_status_header(302);
|
||||
set_status_header(301);
|
||||
redirect_http( $redirect_url );
|
||||
}
|
||||
redirect( $redirect_url );
|
||||
|
|
|
@ -115,6 +115,8 @@ class Template {
|
|||
*/
|
||||
function set_filenames($filename_array)
|
||||
{
|
||||
$filename_array = trigger_event('loc_tpl_set_filenames', $filename_array, array(&$this));
|
||||
|
||||
if (!is_array($filename_array))
|
||||
{
|
||||
return false;
|
||||
|
@ -153,6 +155,7 @@ class Template {
|
|||
// actually compile the template now.
|
||||
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
|
||||
{
|
||||
trigger_action('loc_begin_tpl_pparse', $handle, array(&$this));
|
||||
// Actually compile the code now.
|
||||
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
|
||||
}
|
||||
|
@ -176,6 +179,7 @@ class Template {
|
|||
// actually compile the template now.
|
||||
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
|
||||
{
|
||||
trigger_action('loc_begin_tpl_parse', $handle, array(&$this));
|
||||
// Actually compile the code now.
|
||||
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle], true, '_str');
|
||||
}
|
||||
|
@ -210,20 +214,23 @@ class Template {
|
|||
*/
|
||||
function assign_var_from_handle($varname, $handle)
|
||||
{
|
||||
if (!$this->loadfile($handle))
|
||||
{
|
||||
die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
|
||||
}
|
||||
|
||||
// Compile it, with the "no echo statements" option on.
|
||||
$_str = "";
|
||||
$code = $this->compile($this->uncompiled_code[$handle], true, '_str');
|
||||
|
||||
// evaluate the variable assignment.
|
||||
eval($code);
|
||||
// assign the value of the generated variable to the given varname.
|
||||
$this->assign_var($varname, $_str);
|
||||
trigger_action('loc_begin_tpl_assign_var_from_handle', $varname, $handle, array(&$this));
|
||||
$this->assign_var($varname, $this->parse($handle, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concat the uncompiled code for $handle as the value of $varname in the
|
||||
* root-level. This can be used to effectively include a template in the
|
||||
* middle of another template.
|
||||
*
|
||||
* Note that all desired assignments to the variables in $handle should be
|
||||
* done BEFORE calling this function.
|
||||
*/
|
||||
function concat_var_from_handle($varname, $handle)
|
||||
{
|
||||
trigger_action('loc_begin_tpl_concat_var_from_handle', $varname, $handle, array(&$this));
|
||||
$this->concat_var($varname, $this->parse($handle, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -288,6 +295,43 @@ class Template {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block-level variable deletion. Deletes the last block iteration.
|
||||
* if all is true - all blocks are removed
|
||||
* return true if a deletion occured
|
||||
*/
|
||||
function delete_block_vars($blockname, $all=false)
|
||||
{
|
||||
$blocks = explode('.', $blockname);
|
||||
$blockcount = count($blocks);
|
||||
$str = '$this->_tpldata';
|
||||
for ($i = 0; $i < $blockcount; $i++)
|
||||
{
|
||||
$str .= '[\'' . $blocks[$i] . '.\']';
|
||||
eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:-1;');
|
||||
if ($lastiteration==-1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ($i==$blockcount-1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
$str .= '[' . $lastiteration . ']';
|
||||
}
|
||||
|
||||
if ($all==true or $lastiteration==0)
|
||||
{
|
||||
$str ='unset('.$str.');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$str ='unset('.$str.'['.$lastiteration.']);';
|
||||
}
|
||||
eval($str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Root-level variable assignment. Adds to current assignments, overriding
|
||||
* any existing variable assignment with the same name.
|
||||
|
@ -394,7 +438,7 @@ class Template {
|
|||
die("Template->loadfile(): File $filename for handle $handle is empty");
|
||||
}
|
||||
|
||||
$this->uncompiled_code[$handle] = $str;
|
||||
$this->uncompiled_code[$handle] = trigger_event('tpl_load_file', $str, $handle, array(&$this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER']))
|
|||
{
|
||||
if (!($user['id'] = get_userid($_SERVER['REMOTE_USER'])))
|
||||
{
|
||||
register_user($_SERVER['REMOTE_USER'], '', '');
|
||||
register_user($_SERVER['REMOTE_USER'], '', '', false);
|
||||
$user['id'] = get_userid($_SERVER['REMOTE_USER']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,8 +380,7 @@ class PwgServer
|
|||
{
|
||||
if ( is_null($this->_responseEncoder) )
|
||||
{
|
||||
@header("HTTP/1.1 500 Server error");
|
||||
@header("Status: 500 Server error");
|
||||
set_status_header(500);
|
||||
@header("Content-Type: text/plain");
|
||||
echo ("Cannot process your request. Unknown response format.
|
||||
Request format: ".@$this->_requestFormat." handler:".$this->_requestHandler."
|
||||
|
|
|
@ -32,18 +32,18 @@
|
|||
function ws_isInvokeAllowed($res, $methodName, $params)
|
||||
{
|
||||
global $conf, $calling_partner_id;
|
||||
|
||||
|
||||
if ( strpos($methodName,'reflection.')===0 )
|
||||
{ // OK for reflection
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
if ( !is_autorize_status(ACCESS_GUEST) and
|
||||
strpos($methodName,'pwg.session.')!==0 )
|
||||
{
|
||||
return new PwgError(401, 'Access denied');
|
||||
}
|
||||
|
||||
|
||||
if ( !$conf['ws_access_control'] )
|
||||
{
|
||||
return $res; // No controls are requested
|
||||
|
@ -316,7 +316,10 @@ function ws_categories_getImages($params, &$service)
|
|||
OR ', $where_clauses) . ')'
|
||||
);
|
||||
}
|
||||
$where_clauses[] = 'id NOT IN ('.$user['forbidden_categories'].')';
|
||||
$where_clauses[] = get_sql_condition_FandF(
|
||||
array('forbidden_categories' => 'id'),
|
||||
NULL, true
|
||||
);
|
||||
|
||||
$query = '
|
||||
SELECT id, name, permalink, image_order
|
||||
|
@ -460,7 +463,6 @@ function ws_categories_getList($params, &$service)
|
|||
}
|
||||
else
|
||||
{
|
||||
$where[] = 'id NOT IN ('.$user['forbidden_categories'].')';
|
||||
$where[]= 'user_id='.$user['id'];
|
||||
}
|
||||
|
||||
|
@ -472,8 +474,6 @@ SELECT id, name, permalink, uppercats, global_rank,
|
|||
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id
|
||||
WHERE '. implode('
|
||||
AND ', $where);
|
||||
$query .= '
|
||||
ORDER BY global_rank';
|
||||
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
@ -512,9 +512,9 @@ function ws_images_addComment($params, &$service)
|
|||
}
|
||||
$params['image_id'] = (int)$params['image_id'];
|
||||
$query = '
|
||||
SELECT DISTINCT image_id
|
||||
SELECT DISTINCT image_id
|
||||
FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.CATEGORIES_TABLE.' ON category_id=id
|
||||
WHERE commentable="true"
|
||||
WHERE commentable="true"
|
||||
AND image_id='.$params['image_id'].
|
||||
get_sql_condition_FandF(
|
||||
array(
|
||||
|
@ -528,9 +528,9 @@ SELECT DISTINCT image_id
|
|||
{
|
||||
return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
|
||||
}
|
||||
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
|
||||
|
||||
|
||||
$comm = array(
|
||||
'author' => trim( stripslashes($params['author']) ),
|
||||
'content' => trim( stripslashes($params['content']) ),
|
||||
|
@ -538,8 +538,8 @@ SELECT DISTINCT image_id
|
|||
);
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
|
||||
|
||||
$comment_action = insert_user_comment(
|
||||
|
||||
$comment_action = insert_user_comment(
|
||||
$comm, $params['key'], $infos
|
||||
);
|
||||
|
||||
|
@ -550,14 +550,14 @@ SELECT DISTINCT image_id
|
|||
return new PwgError(403, implode("\n", $infos) );
|
||||
case 'validate':
|
||||
case 'moderate':
|
||||
$ret = array(
|
||||
$ret = array(
|
||||
'id' => $comm['id'],
|
||||
'validation' => $comment_action=='validate',
|
||||
);
|
||||
return new PwgNamedStruct(
|
||||
'comment',
|
||||
$ret,
|
||||
null, array()
|
||||
$ret,
|
||||
null, array()
|
||||
);
|
||||
default:
|
||||
return new PwgError(500, "Unknown comment action ".$comment_action );
|
||||
|
@ -599,8 +599,11 @@ LIMIT 1;';
|
|||
SELECT id, name, permalink, uppercats, global_rank, commentable
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
|
||||
WHERE image_id = '.$image_row['id'].'
|
||||
AND category_id NOT IN ('.$user['forbidden_categories'].')
|
||||
WHERE image_id = '.$image_row['id'].
|
||||
get_sql_condition_FandF(
|
||||
array( 'forbidden_categories' => 'category_id' ),
|
||||
' AND'
|
||||
).'
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
$is_commentable = false;
|
||||
|
@ -667,7 +670,7 @@ SELECT COUNT(rate) AS count
|
|||
|
||||
//---------------------------------------------------------- related comments
|
||||
$related_comments = array();
|
||||
|
||||
|
||||
$where_comments = 'image_id = '.$image_row['id'];
|
||||
if ( !is_admin() )
|
||||
{
|
||||
|
@ -699,16 +702,16 @@ SELECT id, date, author, content
|
|||
array_push($related_comments, $row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$comment_post_data = null;
|
||||
if ($is_commentable and
|
||||
if ($is_commentable and
|
||||
(!$user['is_the_guest']
|
||||
or ($user['is_the_guest'] and $conf['comments_forall'] )
|
||||
)
|
||||
)
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
|
||||
$comment_post_data['author'] = $user['username'];
|
||||
$comment_post_data['author'] = $user['username'];
|
||||
$comment_post_data['key'] = get_comment_post_key($params['image_id']);
|
||||
}
|
||||
|
||||
|
@ -733,7 +736,7 @@ SELECT id, date, author, content
|
|||
$ret['comment_post'] = array( WS_XML_ATTRIBUTES => $comment_post_data );
|
||||
}
|
||||
$ret['comments'] = array(
|
||||
WS_XML_ATTRIBUTES =>
|
||||
WS_XML_ATTRIBUTES =>
|
||||
array(
|
||||
'page' => $params['comments_page'],
|
||||
'per_page' => $params['comments_per_page'],
|
||||
|
@ -756,68 +759,35 @@ function ws_images_search($params, &$service)
|
|||
include_once( PHPWG_ROOT_PATH .'include/functions_search.inc.php' );
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
|
||||
|
||||
$where_clauses = ws_std_image_sql_filter( $params );
|
||||
$order_by = ws_std_image_sql_order($params);
|
||||
$where_clauses = ws_std_image_sql_filter( $params, 'i.' );
|
||||
$order_by = ws_std_image_sql_order($params, 'i.');
|
||||
|
||||
if ( !empty($where_clauses) and !empty($order_by) )
|
||||
$super_order_by = false;
|
||||
if ( !empty($order_by) )
|
||||
{
|
||||
$page['super_order_by']=1; // quick_search_result might be faster
|
||||
global $conf;
|
||||
$conf['order_by'] = 'ORDER BY '.$order_by;
|
||||
$super_order_by=true; // quick_search_result might be faster
|
||||
}
|
||||
$search_result = get_quick_search_results($params['query']);
|
||||
|
||||
global $image_ids; //needed for sorting by rank (usort)
|
||||
if ( ( !isset($search_result['as_is'])
|
||||
or !empty($where_clauses)
|
||||
or !empty($order_by) )
|
||||
and !empty($search_result['items']) )
|
||||
{
|
||||
$where_clauses[] = 'id IN ('
|
||||
.wordwrap(implode(', ', $search_result['items']), 80, "\n")
|
||||
.')';
|
||||
$where_clauses[] = get_sql_condition_FandF(
|
||||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'id'
|
||||
),
|
||||
'', true
|
||||
);
|
||||
$query = '
|
||||
SELECT DISTINCT id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
|
||||
WHERE '.implode('
|
||||
AND ', $where_clauses);
|
||||
if (!empty($order_by))
|
||||
{
|
||||
$query .= '
|
||||
ORDER BY '.$order_by;
|
||||
}
|
||||
$image_ids = array_from_query($query, 'id');
|
||||
global $ranks;
|
||||
$ranks = array_flip( $search_result['items'] );
|
||||
usort(
|
||||
$image_ids,
|
||||
create_function('$i1,$i2', 'global $ranks; return $ranks[$i1]-$ranks[$i2];')
|
||||
$search_result = get_quick_search_results($params['query'],
|
||||
$super_order_by,
|
||||
implode(',', $where_clauses)
|
||||
);
|
||||
|
||||
$image_ids = array_slice(
|
||||
$search_result['items'],
|
||||
$params['page']*$params['per_page'],
|
||||
$params['per_page']
|
||||
);
|
||||
unset ($ranks);
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_ids = $search_result['items'];
|
||||
}
|
||||
|
||||
$image_ids = array_slice($image_ids,
|
||||
$params['page']*$params['per_page'],
|
||||
$params['per_page'] );
|
||||
|
||||
if ( count($image_ids) )
|
||||
{
|
||||
$query = '
|
||||
SELECT * FROM '.IMAGES_TABLE.'
|
||||
WHERE id IN ('
|
||||
.wordwrap(implode(', ', $image_ids), 80, "\n")
|
||||
.')';
|
||||
WHERE id IN ('.implode(',', $image_ids).')';
|
||||
|
||||
$image_ids = array_flip($image_ids);
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
|
@ -834,14 +804,10 @@ SELECT * FROM '.IMAGES_TABLE.'
|
|||
$image[$k] = $row[$k];
|
||||
}
|
||||
$image = array_merge( $image, ws_std_get_urls($row) );
|
||||
array_push($images, $image);
|
||||
$images[$image_ids[$image['id']]] = $image;
|
||||
}
|
||||
|
||||
$image_ids = array_flip($image_ids);
|
||||
usort(
|
||||
$images,
|
||||
create_function('$i1,$i2', 'global $image_ids; return $image_ids[$i1["id"]]-$image_ids[$i2["id"]];')
|
||||
);
|
||||
ksort($images, SORT_NUMERIC);
|
||||
$images = array_values($images);
|
||||
}
|
||||
|
||||
|
||||
|
@ -951,7 +917,7 @@ function ws_tags_getImages($params, &$service)
|
|||
{
|
||||
@include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
|
||||
global $conf;
|
||||
|
||||
|
||||
// first build all the tag_ids we are interested in
|
||||
$params['tag_id'] = array_map( 'intval',$params['tag_id'] );
|
||||
$tags = find_tags($params['tag_id'], $params['tag_url_name'], $params['tag_name']);
|
||||
|
@ -1028,6 +994,7 @@ LIMIT '.$params['per_page']*$params['page'].','.$params['per_page'];
|
|||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
$image = array();
|
||||
foreach ( array('id', 'width', 'height', 'hit') as $k )
|
||||
{
|
||||
if (isset($row[$k]))
|
||||
|
|
|
@ -86,7 +86,7 @@ else
|
|||
if (isset($_GET['caddie']))
|
||||
{
|
||||
fill_caddie($page['items']);
|
||||
// redirect();
|
||||
redirect(duplicate_index_url());
|
||||
}
|
||||
|
||||
//----------------------------------------------------- template initialization
|
||||
|
@ -167,7 +167,8 @@ else
|
|||
);
|
||||
}
|
||||
// include menubar
|
||||
include(PHPWG_ROOT_PATH.'include/menubar.inc.php');
|
||||
include(trigger_event('menubar_file',
|
||||
PHPWG_ROOT_PATH.'include/menubar.inc.php'));
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
|
|
72
install.php
72
install.php
|
@ -204,6 +204,7 @@ include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
|
|||
include(PHPWG_ROOT_PATH . 'include/constants.php');
|
||||
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
|
||||
include(PHPWG_ROOT_PATH . 'admin/include/functions.php');
|
||||
include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
|
||||
include(PHPWG_ROOT_PATH . 'include/template.php');
|
||||
|
||||
if ( isset( $_POST['language'] ))
|
||||
|
@ -241,27 +242,27 @@ if ( isset( $_POST['install'] ))
|
|||
{
|
||||
if ( @mysql_select_db($_POST['dbname'] ) )
|
||||
{
|
||||
array_push( $infos, $lang['step1_confirmation'] );
|
||||
array_push( $infos, l10n('step1_confirmation') );
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push( $errors, $lang['step1_err_db'] );
|
||||
array_push( $errors, l10n('step1_err_db') );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push( $errors, $lang['step1_err_server'] );
|
||||
array_push( $errors, l10n('step1_err_server') );
|
||||
}
|
||||
|
||||
$webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name ));
|
||||
if ( empty($webmaster))
|
||||
array_push( $errors, $lang['step2_err_login1'] );
|
||||
array_push( $errors, l10n('step2_err_login1') );
|
||||
else if ( preg_match( '/[\'"]/', $webmaster ) )
|
||||
array_push( $errors, $lang['step2_err_login3'] );
|
||||
array_push( $errors, l10n('step2_err_login3') );
|
||||
if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) )
|
||||
array_push( $errors, $lang['step2_err_pass'] );
|
||||
array_push( $errors, l10n('step2_err_pass') );
|
||||
if ( empty($admin_mail))
|
||||
array_push( $errors, $lang['reg_err_mail_address'] );
|
||||
array_push( $errors, l10n('reg_err_mail_address') );
|
||||
else
|
||||
{
|
||||
$error_mail_address = validate_mail_address($admin_mail);
|
||||
|
@ -298,6 +299,9 @@ define(\'PHPWG_INSTALLED\', true);
|
|||
}
|
||||
@fputs($fp, $file_content, strlen($file_content));
|
||||
@fclose($fp);
|
||||
|
||||
// Create empty local files to avoid log errors
|
||||
create_empty_local_files();
|
||||
|
||||
// tables creation, based on phpwebgallery_structure.sql
|
||||
execute_sqlfile(
|
||||
|
@ -367,33 +371,33 @@ $template->assign_vars(
|
|||
array(
|
||||
'RELEASE'=>PHPWG_VERSION,
|
||||
|
||||
'L_BASE_TITLE'=>$lang['Initial_config'],
|
||||
'L_LANG_TITLE'=>$lang['Default_lang'],
|
||||
'L_DB_TITLE'=>$lang['step1_title'],
|
||||
'L_DB_HOST'=>$lang['step1_host'],
|
||||
'L_DB_HOST_INFO'=>$lang['step1_host_info'],
|
||||
'L_DB_USER'=>$lang['step1_user'],
|
||||
'L_DB_USER_INFO'=>$lang['step1_user_info'],
|
||||
'L_DB_PASS'=>$lang['step1_pass'],
|
||||
'L_DB_PASS_INFO'=>$lang['step1_pass_info'],
|
||||
'L_DB_NAME'=>$lang['step1_database'],
|
||||
'L_DB_NAME_INFO'=>$lang['step1_database_info'],
|
||||
'L_DB_PREFIX'=>$lang['step1_prefix'],
|
||||
'L_DB_PREFIX_INFO'=>$lang['step1_prefix_info'],
|
||||
'L_ADMIN_TITLE'=>$lang['step2_title'],
|
||||
'L_ADMIN'=>$lang['install_webmaster'],
|
||||
'L_ADMIN_INFO'=>$lang['install_webmaster_info'],
|
||||
'L_ADMIN_PASSWORD'=>$lang['step2_pwd'],
|
||||
'L_ADMIN_PASSWORD_INFO'=>$lang['step2_pwd_info'],
|
||||
'L_ADMIN_CONFIRM_PASSWORD'=>$lang['step2_pwd_conf'],
|
||||
'L_ADMIN_CONFIRM_PASSWORD_INFO'=>$lang['step2_pwd_conf_info'],
|
||||
'L_ADMIN_EMAIL'=>$lang['conf_mail_webmaster'],
|
||||
'L_ADMIN_EMAIL_INFO'=>$lang['conf_mail_webmaster_info'],
|
||||
'L_SUBMIT'=>$lang['Start_Install'],
|
||||
'L_INSTALL_HELP'=>sprintf($lang['install_help'], 'http://forum.'.PHPWG_DOMAIN.'/'),
|
||||
'L_ERR_COPY'=>$lang['step1_err_copy'],
|
||||
'L_END_TITLE'=>$lang['install_end_title'],
|
||||
'L_END_MESSAGE'=>$lang['install_end_message'],
|
||||
'L_BASE_TITLE'=>l10n('Initial_config'),
|
||||
'L_LANG_TITLE'=>l10n('Default_lang'),
|
||||
'L_DB_TITLE'=>l10n('step1_title'),
|
||||
'L_DB_HOST'=>l10n('step1_host'),
|
||||
'L_DB_HOST_INFO'=>l10n('step1_host_info'),
|
||||
'L_DB_USER'=>l10n('step1_user'),
|
||||
'L_DB_USER_INFO'=>l10n('step1_user_info'),
|
||||
'L_DB_PASS'=>l10n('step1_pass'),
|
||||
'L_DB_PASS_INFO'=>l10n('step1_pass_info'),
|
||||
'L_DB_NAME'=>l10n('step1_database'),
|
||||
'L_DB_NAME_INFO'=>l10n('step1_database_info'),
|
||||
'L_DB_PREFIX'=>l10n('step1_prefix'),
|
||||
'L_DB_PREFIX_INFO'=>l10n('step1_prefix_info'),
|
||||
'L_ADMIN_TITLE'=>l10n('step2_title'),
|
||||
'L_ADMIN'=>l10n('install_webmaster'),
|
||||
'L_ADMIN_INFO'=>l10n('install_webmaster_info'),
|
||||
'L_ADMIN_PASSWORD'=>l10n('step2_pwd'),
|
||||
'L_ADMIN_PASSWORD_INFO'=>l10n('step2_pwd_info'),
|
||||
'L_ADMIN_CONFIRM_PASSWORD'=>l10n('step2_pwd_conf'),
|
||||
'L_ADMIN_CONFIRM_PASSWORD_INFO'=>l10n('step2_pwd_conf_info'),
|
||||
'L_ADMIN_EMAIL'=>l10n('conf_mail_webmaster'),
|
||||
'L_ADMIN_EMAIL_INFO'=>l10n('conf_mail_webmaster_info'),
|
||||
'L_SUBMIT'=>l10n('Start_Install'),
|
||||
'L_INSTALL_HELP'=>sprintf(l10n('install_help'), 'http://forum.'.PHPWG_DOMAIN.'/'),
|
||||
'L_ERR_COPY'=>l10n('step1_err_copy'),
|
||||
'L_END_TITLE'=>l10n('install_end_title'),
|
||||
'L_END_MESSAGE'=>l10n('install_end_message'),
|
||||
|
||||
'F_ACTION'=>'install.php',
|
||||
'F_DB_HOST'=>$dbhost,
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -71,7 +71,7 @@ ALTER TABLE phpwebgallery_categories
|
|||
ALTER TABLE phpwebgallery_categories
|
||||
ADD COLUMN commentable enum('true','false') NOT NULL default 'true'
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_categories
|
||||
ADD COLUMN global_rank varchar(255) default NULL
|
||||
|
@ -91,7 +91,7 @@ ALTER TABLE phpwebgallery_comments
|
|||
UPDATE phpwebgallery_comments
|
||||
SET date_temp = date
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_comments
|
||||
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00'
|
||||
|
@ -126,7 +126,7 @@ ALTER TABLE phpwebgallery_history
|
|||
UPDATE phpwebgallery_history
|
||||
SET date_temp = date
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_history
|
||||
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00'
|
||||
|
@ -207,7 +207,7 @@ ALTER TABLE phpwebgallery_images
|
|||
ALTER TABLE phpwebgallery_images
|
||||
ADD INDEX images_i5 (date_creation)
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_sessions
|
||||
DROP COLUMN ip
|
||||
|
@ -222,7 +222,7 @@ ALTER TABLE phpwebgallery_sessions
|
|||
UPDATE phpwebgallery_sessions
|
||||
SET expiration_temp = expiration
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_sessions
|
||||
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00'
|
||||
|
@ -237,7 +237,7 @@ UPDATE phpwebgallery_sessions
|
|||
ALTER TABLE phpwebgallery_sessions
|
||||
DROP COLUMN expiration_temp
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_sites
|
||||
DROP INDEX galleries_url
|
||||
|
@ -251,7 +251,7 @@ ALTER TABLE phpwebgallery_sites
|
|||
"
|
||||
DROP TABLE phpwebgallery_user_category
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
ALTER TABLE phpwebgallery_users
|
||||
DROP COLUMN long_period
|
||||
|
@ -276,7 +276,7 @@ ALTER TABLE phpwebgallery_users
|
|||
ALTER TABLE phpwebgallery_users
|
||||
ADD UNIQUE users_ui1 (username)
|
||||
;",
|
||||
|
||||
|
||||
"
|
||||
CREATE TABLE phpwebgallery_rate (
|
||||
user_id smallint(5) unsigned NOT NULL default '0',
|
||||
|
@ -342,7 +342,7 @@ $indexes_of = array(
|
|||
foreach (array_keys($indexes_of) as $table)
|
||||
{
|
||||
$existing_indexes = array();
|
||||
|
||||
|
||||
$query = '
|
||||
SHOW INDEX
|
||||
FROM '.PREFIX_TABLE.$table.'
|
||||
|
@ -529,7 +529,6 @@ mass_inserts(
|
|||
);
|
||||
|
||||
// refresh calculated datas
|
||||
ordering();
|
||||
update_global_rank();
|
||||
update_category();
|
||||
|
||||
|
@ -587,7 +586,7 @@ $page['infos'] = array_merge(
|
|||
$page['infos'],
|
||||
array(
|
||||
'all sub-categories of private categories become private',
|
||||
|
||||
|
||||
'user permissions and group permissions have been erased',
|
||||
|
||||
'only thumbnails prefix and webmaster mail address have been saved from
|
||||
|
|
|
@ -301,7 +301,7 @@ $lang['nbm_content_new_elements'] = 'New elements were added ';
|
|||
$lang['nbm_content_new_elements_single'] = ' on ';
|
||||
$lang['nbm_content_new_elements_between_1'] = 'between ';
|
||||
$lang['nbm_content_new_elements_between_2'] = ' and ';
|
||||
$lang['nbm_content_subscribe_by_admin'] = 'The webmaster has subscribed you for receiving notifications by mail.';
|
||||
$lang['nbm_content_subscribe_by_admin'] = 'The webmaster has subscribed you to receiving notifications by mail.';
|
||||
$lang['nbm_content_subscribe_by_himself'] = 'You have subscribed to receiving notifications by mail.';
|
||||
$lang['nbm_content_subscribe_link'] = 'To subscribe';
|
||||
$lang['nbm_content_problem_contact'] = 'If you encounter problems or have any question, please send a message to ';
|
||||
|
@ -366,7 +366,6 @@ $lang['permuser_info'] = 'Only private categories are listed. Private/Public cat
|
|||
$lang['private'] = 'private';
|
||||
$lang['properties'] = 'Properties';
|
||||
$lang['public'] = 'public';
|
||||
$lang['purge history'] = 'purge history';
|
||||
$lang['purge never used notification feeds'] = 'purge never used notification feeds';
|
||||
$lang['purge sessions'] = 'purge sessions';
|
||||
$lang['randomly represented'] = 'randomly represented';
|
||||
|
@ -608,4 +607,41 @@ $lang['Hour'] = 'Hour';
|
|||
$lang['is_the_guest'] = 'guest';
|
||||
$lang['is_the_default'] = 'default values';
|
||||
$lang['High filesize'] = 'High filesize';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
$lang['Guest cannot be deleted'] = 'Guest cannot be deleted';
|
||||
$lang['Default user cannot be deleted'] = 'Default user cannot be deleted';
|
||||
$lang['purge history detail'] = 'purge history detail';
|
||||
$lang['purge history summary'] = 'purge history summary';
|
||||
$lang['c13y_title'] = 'Check integrity';
|
||||
$lang['c13y_Anomaly'] = 'Anomaly';
|
||||
$lang['c13y_Correction'] = 'Correction';
|
||||
$lang['c13y_Automatic_correction'] = 'Automatic correction';
|
||||
$lang['c13y_Impossible_automatic_correction'] = 'Impossible automatic correction';
|
||||
$lang['c13y_Correction_applied_success'] = 'Correction applied with success';
|
||||
$lang['c13y_Correction_applied_error'] = 'Correction applied with error';
|
||||
$lang['c13y_Apply_selected_corrections'] = 'Apply selected corrections';
|
||||
$lang['c13y_anomaly_count'] = '%d anomaly has been detected.';
|
||||
$lang['c13y_anomalies_count'] = '%d anomalies has been detected.';
|
||||
$lang['c13y_anomaly_corrected_count'] = '%d anomaly has been corrected.';
|
||||
$lang['c13y_anomalies_corrected_count'] = '%d anomalies has been detected corrected.';
|
||||
$lang['c13y_anomaly_not_corrected_count'] = '%d anomaly hasn\'t been corrected.';
|
||||
$lang['c13y_anomalies_not_corrected_count'] = '%d anomalies hasn\'t been corrected.';
|
||||
$lang['c13y_more_info'] = 'Go to %s or %s for more informations';
|
||||
$lang['c13y_more_info_forum'] = 'the forum';
|
||||
$lang['c13y_more_info_wiki'] = 'the wiki';
|
||||
$lang['c13y_exif_anomaly'] = '%s value is not correct file because exif are not supported';
|
||||
$lang['c13y_exif_correction'] = '%s must be to set to false in your config_local.inc.php file';
|
||||
$lang['c13y_guest_non_existent'] = 'Main "guest" user don\'t exist any more';
|
||||
$lang['c13y_bad_guest_status'] = 'Main "guest" user status is incorrect';
|
||||
$lang['c13y_default_non_existent'] = 'Default user don\'t exist any more';
|
||||
$lang['c13y_webmaster_non_existent'] = 'Main "webmaster" user don\'t exist any more';
|
||||
$lang['c13y_bad_webmaster_status'] = 'Main "webmaster" user status is incorrect';
|
||||
$lang['c13y_user_created'] = 'User "%s" created with "%s" like password';
|
||||
$lang['c13y_user_status_updated'] = 'Status of user "%s" updated';
|
||||
$lang['add new elements to caddie'] = 'add new elements to caddie';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
$lang['Deleted on'] = 'Deleted on';
|
||||
$lang['Last hit'] = 'Last hit';
|
||||
$lang['Hits'] = 'Hits';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
|
@ -31,264 +31,6 @@ $lang_info['charset'] = 'iso-8859-1';
|
|||
$lang_info['direction'] = 'ltr';
|
||||
$lang_info['code'] = 'en';
|
||||
$lang_info['zero_plural'] = true;
|
||||
$lang_table_translate_ascii7bits = array(
|
||||
chr( 0) => chr(0),
|
||||
chr( 1) => chr( 1),
|
||||
chr( 2) => chr( 2),
|
||||
chr( 3) => chr( 3),
|
||||
chr( 4) => chr( 4),
|
||||
chr( 5) => chr( 5),
|
||||
chr( 6) => chr( 6),
|
||||
chr( 7) => chr( 7),
|
||||
chr( 8) => chr( 8),
|
||||
chr( 9) => chr( 9),
|
||||
chr( 10) => chr( 10),
|
||||
chr( 11) => chr( 11),
|
||||
chr( 12) => chr( 12),
|
||||
chr( 13) => chr( 13),
|
||||
chr( 14) => chr( 14),
|
||||
chr( 15) => chr( 15),
|
||||
chr( 16) => chr( 16),
|
||||
chr( 17) => chr( 17),
|
||||
chr( 18) => chr( 18),
|
||||
chr( 19) => chr( 19),
|
||||
chr( 20) => chr( 20),
|
||||
chr( 21) => chr( 21),
|
||||
chr( 22) => chr( 22),
|
||||
chr( 23) => chr( 23),
|
||||
chr( 24) => chr( 24),
|
||||
chr( 25) => chr( 25),
|
||||
chr( 26) => chr( 26),
|
||||
chr( 27) => chr( 27),
|
||||
chr( 28) => chr( 28),
|
||||
chr( 29) => chr( 29),
|
||||
chr( 30) => chr( 30),
|
||||
chr( 31) => chr( 31),
|
||||
chr( 32) => chr( 32),
|
||||
chr( 33) => chr( 33),
|
||||
chr( 34) => chr( 34),
|
||||
chr( 35) => chr( 35),
|
||||
chr( 36) => chr( 36),
|
||||
chr( 37) => chr( 37),
|
||||
chr( 38) => chr( 38),
|
||||
chr( 39) => chr( 39),
|
||||
chr( 40) => chr( 40),
|
||||
chr( 41) => chr( 41),
|
||||
chr( 42) => chr( 42),
|
||||
chr( 43) => chr( 43),
|
||||
chr( 44) => chr( 44),
|
||||
chr( 45) => chr( 45),
|
||||
chr( 46) => chr( 46),
|
||||
chr( 47) => chr( 47),
|
||||
chr( 48) => chr( 48),
|
||||
chr( 49) => chr( 49),
|
||||
chr( 50) => chr( 50),
|
||||
chr( 51) => chr( 51),
|
||||
chr( 52) => chr( 52),
|
||||
chr( 53) => chr( 53),
|
||||
chr( 54) => chr( 54),
|
||||
chr( 55) => chr( 55),
|
||||
chr( 56) => chr( 56),
|
||||
chr( 57) => chr( 57),
|
||||
chr( 58) => chr( 58),
|
||||
chr( 59) => chr( 59),
|
||||
chr( 60) => chr( 60),
|
||||
chr( 61) => chr( 61),
|
||||
chr( 62) => chr( 62),
|
||||
chr( 63) => chr( 63),
|
||||
chr( 64) => chr( 64),
|
||||
chr( 65) => chr( 65),
|
||||
chr( 66) => chr( 66),
|
||||
chr( 67) => chr( 67),
|
||||
chr( 68) => chr( 68),
|
||||
chr( 69) => chr( 69),
|
||||
chr( 70) => chr( 70),
|
||||
chr( 71) => chr( 71),
|
||||
chr( 72) => chr( 72),
|
||||
chr( 73) => chr( 73),
|
||||
chr( 74) => chr( 74),
|
||||
chr( 75) => chr( 75),
|
||||
chr( 76) => chr( 76),
|
||||
chr( 77) => chr( 77),
|
||||
chr( 78) => chr( 78),
|
||||
chr( 79) => chr( 79),
|
||||
chr( 80) => chr( 80),
|
||||
chr( 81) => chr( 81),
|
||||
chr( 82) => chr( 82),
|
||||
chr( 83) => chr( 83),
|
||||
chr( 84) => chr( 84),
|
||||
chr( 85) => chr( 85),
|
||||
chr( 86) => chr( 86),
|
||||
chr( 87) => chr( 87),
|
||||
chr( 88) => chr( 88),
|
||||
chr( 89) => chr( 89),
|
||||
chr( 90) => chr( 90),
|
||||
chr( 91) => chr( 91),
|
||||
chr( 92) => chr( 92),
|
||||
chr( 93) => chr( 93),
|
||||
chr( 94) => chr( 94),
|
||||
chr( 95) => chr( 95),
|
||||
chr( 96) => chr( 96),
|
||||
chr( 97) => chr( 97),
|
||||
chr( 98) => chr( 98),
|
||||
chr( 99) => chr( 99),
|
||||
chr(100) => chr(100),
|
||||
chr(101) => chr(101),
|
||||
chr(102) => chr(102),
|
||||
chr(103) => chr(103),
|
||||
chr(104) => chr(104),
|
||||
chr(105) => chr(105),
|
||||
chr(106) => chr(106),
|
||||
chr(107) => chr(107),
|
||||
chr(108) => chr(108),
|
||||
chr(109) => chr(109),
|
||||
chr(110) => chr(110),
|
||||
chr(111) => chr(111),
|
||||
chr(112) => chr(112),
|
||||
chr(113) => chr(113),
|
||||
chr(114) => chr(114),
|
||||
chr(115) => chr(115),
|
||||
chr(116) => chr(116),
|
||||
chr(117) => chr(117),
|
||||
chr(118) => chr(118),
|
||||
chr(119) => chr(119),
|
||||
chr(120) => chr(120),
|
||||
chr(121) => chr(121),
|
||||
chr(122) => chr(122),
|
||||
chr(123) => chr(123),
|
||||
chr(124) => chr(124),
|
||||
chr(125) => chr(125),
|
||||
chr(126) => chr(126),
|
||||
chr(127) => chr(127),
|
||||
chr(128) => chr(128),
|
||||
chr(129) => chr( 95),
|
||||
chr(130) => chr( 44),
|
||||
chr(131) => chr(102),
|
||||
chr(132) => chr( 44),
|
||||
chr(133) => chr( 46),
|
||||
chr(134) => chr( 43),
|
||||
chr(135) => chr( 43),
|
||||
chr(136) => chr( 32),
|
||||
chr(137) => chr( 37),
|
||||
chr(138) => chr( 83),
|
||||
chr(139) => chr( 60),
|
||||
chr(140) => chr( 69),
|
||||
chr(141) => chr( 32),
|
||||
chr(142) => chr( 90),
|
||||
chr(143) => chr( 32),
|
||||
chr(144) => chr( 32),
|
||||
chr(145) => chr( 39),
|
||||
chr(146) => chr( 39),
|
||||
chr(147) => chr( 34),
|
||||
chr(148) => chr( 34),
|
||||
chr(149) => chr( 46),
|
||||
chr(150) => chr( 45),
|
||||
chr(151) => chr( 45),
|
||||
chr(152) => chr( 32),
|
||||
chr(153) => chr( 32),
|
||||
chr(154) => chr(115),
|
||||
chr(155) => chr( 62),
|
||||
chr(156) => chr(111),
|
||||
chr(157) => chr( 32),
|
||||
chr(158) => chr(122),
|
||||
chr(159) => chr( 89),
|
||||
chr(160) => chr( 32),
|
||||
chr(161) => chr( 33),
|
||||
chr(162) => chr( 99),
|
||||
chr(163) => chr( 76),
|
||||
chr(164) => chr( 32),
|
||||
chr(165) => chr( 86),
|
||||
chr(166) => chr(124),
|
||||
chr(167) => chr( 83),
|
||||
chr(168) => chr( 32),
|
||||
chr(169) => chr( 99),
|
||||
chr(170) => chr( 97),
|
||||
chr(171) => chr( 60),
|
||||
chr(172) => chr( 32),
|
||||
chr(173) => chr( 45),
|
||||
chr(174) => chr( 114),
|
||||
chr(175) => chr( 45),
|
||||
chr(176) => chr( 111),
|
||||
chr(177) => chr( 43),
|
||||
chr(178) => chr( 50),
|
||||
chr(179) => chr( 51),
|
||||
chr(180) => chr( 39),
|
||||
chr(181) => chr(117),
|
||||
chr(182) => chr( 32),
|
||||
chr(183) => chr( 46),
|
||||
chr(184) => chr( 97),
|
||||
chr(185) => chr( 49),
|
||||
chr(186) => chr(111),
|
||||
chr(187) => chr( 62),
|
||||
chr(188) => chr( 32),
|
||||
chr(189) => chr( 32),
|
||||
chr(190) => chr( 32),
|
||||
chr(191) => chr( 63),
|
||||
chr(192) => chr( 65),
|
||||
chr(193) => chr( 65),
|
||||
chr(194) => chr( 65),
|
||||
chr(195) => chr( 65),
|
||||
chr(196) => chr( 65),
|
||||
chr(197) => chr( 65),
|
||||
chr(198) => chr( 65),
|
||||
chr(199) => chr( 67),
|
||||
chr(200) => chr( 69),
|
||||
chr(201) => chr( 69),
|
||||
chr(202) => chr( 69),
|
||||
chr(203) => chr( 69),
|
||||
chr(204) => chr( 73),
|
||||
chr(205) => chr( 73),
|
||||
chr(206) => chr( 73),
|
||||
chr(207) => chr( 73),
|
||||
chr(208) => chr( 68),
|
||||
chr(209) => chr( 78),
|
||||
chr(210) => chr( 79),
|
||||
chr(211) => chr( 79),
|
||||
chr(212) => chr( 79),
|
||||
chr(213) => chr( 79),
|
||||
chr(214) => chr( 79),
|
||||
chr(215) => chr( 42),
|
||||
chr(216) => chr( 48),
|
||||
chr(217) => chr( 85),
|
||||
chr(218) => chr( 85),
|
||||
chr(219) => chr( 85),
|
||||
chr(220) => chr( 85),
|
||||
chr(221) => chr( 89),
|
||||
chr(222) => chr( 80),
|
||||
chr(223) => chr( 66),
|
||||
chr(224) => chr( 97),
|
||||
chr(225) => chr( 97),
|
||||
chr(226) => chr( 97),
|
||||
chr(227) => chr( 97),
|
||||
chr(228) => chr( 97),
|
||||
chr(229) => chr( 97),
|
||||
chr(230) => chr( 97),
|
||||
chr(231) => chr( 99),
|
||||
chr(232) => chr(101),
|
||||
chr(233) => chr(101),
|
||||
chr(234) => chr(101),
|
||||
chr(235) => chr(101),
|
||||
chr(236) => chr(105),
|
||||
chr(237) => chr(105),
|
||||
chr(238) => chr(105),
|
||||
chr(239) => chr(105),
|
||||
chr(240) => chr( 97),
|
||||
chr(241) => chr(110),
|
||||
chr(242) => chr(111),
|
||||
chr(243) => chr(111),
|
||||
chr(244) => chr(111),
|
||||
chr(245) => chr(111),
|
||||
chr(246) => chr(111),
|
||||
chr(247) => chr( 47),
|
||||
chr(248) => chr( 48),
|
||||
chr(249) => chr(117),
|
||||
chr(250) => chr(117),
|
||||
chr(251) => chr(117),
|
||||
chr(252) => chr(117),
|
||||
chr(253) => chr(117),
|
||||
chr(254) => chr( 98),
|
||||
chr(255) => chr(121)
|
||||
);
|
||||
|
||||
$lang['%.2f (rated %d times, standard deviation = %.2f)'] = '%.2f (rated %d times, standard deviation = %.2f)';
|
||||
$lang['%d Kb'] = '%d Kb';
|
||||
|
@ -632,4 +374,8 @@ $lang['Picture name: %s'] = 'Picture name: %s';
|
|||
$lang['Creation date: %s'] = 'Creation date: %s';
|
||||
$lang['Waiting page: %s'] = 'Waiting page: %s';
|
||||
$lang['Picture uploaded by %s'] = 'Picture uploaded by %s';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
$lang['guest_must_be_guest'] = 'Bad status for user "guest", using default status. Please notify the webmaster.';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
45
language/en_UK.iso-8859-1/help/history.html
Normal file
45
language/en_UK.iso-8859-1/help/history.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<h2>History</h2>
|
||||
|
||||
<p>These screens allows you to follow the historical navigation en PhpWebGallery
|
||||
according to the options yo have chosen in - Administration - General - History index.</p>
|
||||
|
||||
<h3>Statistics</h3>
|
||||
<ul>
|
||||
<p>If you have chosen to keep the pages visited (<span
|
||||
class="pwgScreen">index.php</span> and <span
|
||||
class="pwgScreen">picture.php</span>) in the table <code>history. </code>
|
||||
This index allow you to follow the pages visited.</p>
|
||||
|
||||
<li><strong>Global statistics</strong> : you can visualize per year. </li>
|
||||
|
||||
<li><strong>Yearly statistics</strong> : you can visualize per month in the year selected.</li>
|
||||
|
||||
<li><strong>Monthly statistics</strong> : you can visualize per days in the month selected.</li>
|
||||
|
||||
<li><strong>Dayly statistics</strong> : you can visualize per hours in the day selected.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>Search</h3>
|
||||
<ul>
|
||||
<p>If you have chosen to keep the pages visited (<span
|
||||
class="pwgScreen">index.php</span> and <span
|
||||
class="pwgScreen">picture.php</span>) in the table <code>history. </code>
|
||||
This index allow to follow en details the pages visited on the site with
|
||||
the help of different filters.</p>
|
||||
|
||||
<li><strong>Filter per date</strong> : chose interval of date you wisk
|
||||
to observe the activity.</li>
|
||||
|
||||
<li><strong>Filter per type of element</strong> : chose the type
|
||||
of element you wisk to observe the activity.</li>
|
||||
|
||||
<li><strong>Filter per user</strong> : chose user you wisk to
|
||||
observe the activity.</li>
|
||||
|
||||
<li><strong>Filter per name of the file</strong> : chose name of the file
|
||||
you wisk to observe the activity.</li>
|
||||
|
||||
<li><strong>Filter per identifying image</strong> : chose identifying image
|
||||
you wisk to observe the activity.</li>
|
||||
</ul>
|
|
@ -25,18 +25,22 @@ information from database make you save disk space.</p>
|
|||
single picture (through <span class="pwgScreen">Picture</span> for
|
||||
example).</li>
|
||||
|
||||
<li><strong>Purge history:</strong> Delete all lines from
|
||||
<li><strong>Repair and optimize database:</strong>
|
||||
For each table, re-odrer, repair and optimize operations are done.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li><strong>Purge history detail:</strong> Delete all lines from
|
||||
<code>history</code> table. Screen <span class="pwgScreen">Administration,
|
||||
Specials, History</span> shows no informations anymore on past
|
||||
history. <em>Warning</em>: all data will be lost and there is no way to
|
||||
get informations back.</li>
|
||||
|
||||
<li><strong>Purge history summary:</strong> Delete all the summary information about visit history. This summary is calculated from the history detail.</li>
|
||||
|
||||
<li><strong>Purge sessions:</strong> Delete expired user sessions.</li>
|
||||
|
||||
<li><strong>Purge never used notification feeds</strong></li>
|
||||
|
||||
<li><strong>Repair and optimize database:</strong>
|
||||
For each table, re-odrer, repair and optimize operations are done.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -74,4 +74,7 @@ Once this file deleted , follow this instructions :
|
|||
</ul>';
|
||||
$lang['conf_mail_webmaster'] = 'Webmaster mail adress';
|
||||
$lang['conf_mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
|
||||
?>
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
|
@ -189,7 +189,7 @@ $lang['Tag selection'] = 'S
|
|||
$lang['Take selected elements out of caddie'] = 'Sortir les éléments sélectionnés du panier';
|
||||
$lang['The %d following tag were deleted'] = 'Le tag suivant a été supprimé';
|
||||
$lang['The %d following tags were deleted'] = 'Les %d tags suivants ont été supprimés';
|
||||
$lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Impossible de connaître la dernière version cat la fonction allow_url_fopen est désactivée.';
|
||||
$lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Impossible de connaître la dernière version car la fonction allow_url_fopen est désactivée.';
|
||||
$lang['Uninstall'] = 'Désinstaller';
|
||||
$lang['Use default sort order']='Utiliser l\'ordre de tri des images par défaut (défini dans le fichier de configuration)';
|
||||
$lang['User comments validation'] = 'Validation des commentaires d\'utilisateurs';
|
||||
|
@ -306,8 +306,8 @@ $lang['nbm_content_subscribe_by_himself'] = 'Vous venez de vous inscrire pour re
|
|||
$lang['nbm_content_subscribe_link'] = 'Pour vous inscrire';
|
||||
$lang['nbm_content_problem_contact'] = 'En cas de problèmes ou de questions, envoyer un mail à ';
|
||||
$lang['nbm_content_pb_contact_object'] = '[NBM] Problèmes ou de questions';
|
||||
$lang['nbm_content_unsubscribe_by_admin'] = 'Vous venez d\'être désinscrit par le webmestre du site pour recevoir la notification par mail.';
|
||||
$lang['nbm_content_unsubscribe_by_himself'] = 'Vous venez de vous désinscrire pour recevoir la notification par mail.';
|
||||
$lang['nbm_content_unsubscribe_by_admin'] = 'Vous venez d\'être désinscrit par le webmestre du site pour ne plus recevoir la notification par mail.';
|
||||
$lang['nbm_content_unsubscribe_by_himself'] = 'Vous venez de vous désinscrire pour ne plus recevoir la notification par mail.';
|
||||
$lang['nbm_content_click_on'] = ', cliquez sur ';
|
||||
$lang['nbm_content_unsubscribe_link'] = 'Pour vous désinscrire';
|
||||
$lang['nbm_info_send_mail_as'] = 'Sans valeur, le titre de la galerie sera utilisé';
|
||||
|
@ -321,7 +321,7 @@ $lang['nbm_msg_n_mails_not_send'] = '%s mails n\'ont pas
|
|||
$lang['nbm_no_mail_to_send'] = 'Pas de mail à envoyer.';
|
||||
$lang['nbm_no_user_available_to_send_L1'] = 'Il n\'y a pas d\'utilisateur à notifier par mail.';
|
||||
$lang['nbm_no_user_available_to_send_L2'] = 'Un utilisateur est à notifier si de nouveaux éléments sont disponibles pour cet utilisateur.';
|
||||
$lang['nbm_no_user_available_to_send_L3'] = 'Il se peut aussi qu\'il n\'y ai aucun utilisateur inscrit (seul le webmaster a accès à cet onglet).';
|
||||
$lang['nbm_no_user_available_to_send_L3'] = 'Il se peut aussi qu\'il n\'y ait aucun utilisateur inscrit (seul le webmaster a accès à cet onglet).';
|
||||
$lang['nbm_no_user_to send_notifications_by_mail'] = 'Pas d\'utilisateur pour envoyer des notifications par mails.';
|
||||
$lang['nbm_object_news'] = 'Nouveaux éléments ajoutés';
|
||||
$lang['nbm_object_subscribe'] = 'Inscription à la notification par mail';
|
||||
|
@ -363,10 +363,9 @@ $lang['no_write_access'] = 'pas d\'acc
|
|||
$lang['path'] = 'chemin';
|
||||
$lang['permissions'] = 'Permissions';
|
||||
$lang['permuser_info'] = 'Seules les catégories privées sont listées.';
|
||||
$lang['private'] = 'privée';
|
||||
$lang['private'] = 'privé';
|
||||
$lang['properties'] = 'Propriétés';
|
||||
$lang['public'] = 'publique';
|
||||
$lang['purge history'] = 'purger l\'historique';
|
||||
$lang['public'] = 'public';
|
||||
$lang['purge never used notification feeds'] = 'purger les flux de notification jamais utilisés';
|
||||
$lang['purge sessions'] = 'purger les sessions';
|
||||
$lang['randomly represented'] = 'représentant au hasard';
|
||||
|
@ -609,4 +608,41 @@ $lang['Hour'] = 'Heure';
|
|||
$lang['is_the_guest'] = 'invité';
|
||||
$lang['is_the_default'] = 'valeurs par défaut';
|
||||
$lang['High filesize'] = 'Taille du fichier HR';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
$lang['Guest cannot be deleted'] = 'L\'invité ne peut pas être supprimé';
|
||||
$lang['Default user cannot be deleted'] = 'L\'utilisateur par défaut ne peut pas être supprimé';
|
||||
$lang['purge history detail'] = 'purger le detail de l\'historique';
|
||||
$lang['purge history summary'] = 'purger le sommaire de l\'historique';
|
||||
$lang['c13y_title'] = 'Contrôle d\'intégrité';
|
||||
$lang['c13y_Anomaly'] = 'Anomalie';
|
||||
$lang['c13y_Correction'] = 'Correction';
|
||||
$lang['c13y_Automatic_correction'] = 'Correction automatique';
|
||||
$lang['c13y_Impossible_automatic_correction'] = 'Correction automatique impossible';
|
||||
$lang['c13y_Correction_applied_success'] = 'Correction appliquée avec succés';
|
||||
$lang['c13y_Correction_applied_error'] = 'Correction appliquée avec erreur';
|
||||
$lang['c13y_Apply_selected_corrections'] = 'Appliquer les corrections sélectionnées';
|
||||
$lang['c13y_anomaly_count'] = '%d anomalie a été détectée.';
|
||||
$lang['c13y_anomalies_count'] = '%d anomalies ont été détectées.';
|
||||
$lang['c13y_anomaly_corrected_count'] = '%d anomalie a été corrigée.';
|
||||
$lang['c13y_anomalies_corrected_count'] = '%d anomalies ont été corrigées.';
|
||||
$lang['c13y_anomaly_not_corrected_count'] = '%d anomalie n\'a pas pu être corrigée.';
|
||||
$lang['c13y_anomalies_not_corrected_count'] = '%d anomalies n\'ont pu être corrigées.';
|
||||
$lang['c13y_more_info'] = 'Allez sur %s ou %s pour plus d\'informations';
|
||||
$lang['c13y_more_info_forum'] = 'le forum';
|
||||
$lang['c13y_more_info_wiki'] = 'le wiki';
|
||||
$lang['c13y_exif_anomaly'] = 'La valeur de %s n\'est pas correcte parce que l\'exif n\'est pas supporté';
|
||||
$lang['c13y_exif_correction'] = '%s doit être mis à "false" dans votre fichier config_local.inc.php';
|
||||
$lang['c13y_guest_non_existent'] = 'L\'utilisateur "invité" principal n\'existe plus';
|
||||
$lang['c13y_bad_guest_status'] = 'Le statut de l\'utilisateur "invité" principal est incorrect';
|
||||
$lang['c13y_default_non_existent'] = 'L\'utilisateur par défaut n\'existe plus';
|
||||
$lang['c13y_webmaster_non_existent'] = 'L\'utilisateur "webmestre" principal n\'existe plus';
|
||||
$lang['c13y_bad_webmaster_status'] = 'Le statut de l\'utilisateur "webmestre" principal est incorrect';
|
||||
$lang['c13y_user_created'] = 'Utilisateur "%s" créé avec comme mot de passe "%s"';
|
||||
$lang['c13y_user_status_updated'] = 'Statut de l\'utilisateur "%s" mis à jour';
|
||||
$lang['add new elements to caddie'] = 'ajouter les nouveaux éléments au panier';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
$lang['Deleted on'] = 'Effacé le';
|
||||
$lang['Last hit'] = 'Dernier accès';
|
||||
$lang['Hits'] = 'Utilisations';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
|
@ -31,264 +31,6 @@ $lang_info['charset'] = 'iso-8859-1';
|
|||
$lang_info['direction'] = 'ltr';
|
||||
$lang_info['code'] = 'fr';
|
||||
$lang_info['zero_plural'] = false;
|
||||
$lang_table_translate_ascii7bits = array(
|
||||
chr( 0) => chr(0),
|
||||
chr( 1) => chr( 1),
|
||||
chr( 2) => chr( 2),
|
||||
chr( 3) => chr( 3),
|
||||
chr( 4) => chr( 4),
|
||||
chr( 5) => chr( 5),
|
||||
chr( 6) => chr( 6),
|
||||
chr( 7) => chr( 7),
|
||||
chr( 8) => chr( 8),
|
||||
chr( 9) => chr( 9),
|
||||
chr( 10) => chr( 10),
|
||||
chr( 11) => chr( 11),
|
||||
chr( 12) => chr( 12),
|
||||
chr( 13) => chr( 13),
|
||||
chr( 14) => chr( 14),
|
||||
chr( 15) => chr( 15),
|
||||
chr( 16) => chr( 16),
|
||||
chr( 17) => chr( 17),
|
||||
chr( 18) => chr( 18),
|
||||
chr( 19) => chr( 19),
|
||||
chr( 20) => chr( 20),
|
||||
chr( 21) => chr( 21),
|
||||
chr( 22) => chr( 22),
|
||||
chr( 23) => chr( 23),
|
||||
chr( 24) => chr( 24),
|
||||
chr( 25) => chr( 25),
|
||||
chr( 26) => chr( 26),
|
||||
chr( 27) => chr( 27),
|
||||
chr( 28) => chr( 28),
|
||||
chr( 29) => chr( 29),
|
||||
chr( 30) => chr( 30),
|
||||
chr( 31) => chr( 31),
|
||||
chr( 32) => chr( 32),
|
||||
chr( 33) => chr( 33),
|
||||
chr( 34) => chr( 34),
|
||||
chr( 35) => chr( 35),
|
||||
chr( 36) => chr( 36),
|
||||
chr( 37) => chr( 37),
|
||||
chr( 38) => chr( 38),
|
||||
chr( 39) => chr( 39),
|
||||
chr( 40) => chr( 40),
|
||||
chr( 41) => chr( 41),
|
||||
chr( 42) => chr( 42),
|
||||
chr( 43) => chr( 43),
|
||||
chr( 44) => chr( 44),
|
||||
chr( 45) => chr( 45),
|
||||
chr( 46) => chr( 46),
|
||||
chr( 47) => chr( 47),
|
||||
chr( 48) => chr( 48),
|
||||
chr( 49) => chr( 49),
|
||||
chr( 50) => chr( 50),
|
||||
chr( 51) => chr( 51),
|
||||
chr( 52) => chr( 52),
|
||||
chr( 53) => chr( 53),
|
||||
chr( 54) => chr( 54),
|
||||
chr( 55) => chr( 55),
|
||||
chr( 56) => chr( 56),
|
||||
chr( 57) => chr( 57),
|
||||
chr( 58) => chr( 58),
|
||||
chr( 59) => chr( 59),
|
||||
chr( 60) => chr( 60),
|
||||
chr( 61) => chr( 61),
|
||||
chr( 62) => chr( 62),
|
||||
chr( 63) => chr( 63),
|
||||
chr( 64) => chr( 64),
|
||||
chr( 65) => chr( 65),
|
||||
chr( 66) => chr( 66),
|
||||
chr( 67) => chr( 67),
|
||||
chr( 68) => chr( 68),
|
||||
chr( 69) => chr( 69),
|
||||
chr( 70) => chr( 70),
|
||||
chr( 71) => chr( 71),
|
||||
chr( 72) => chr( 72),
|
||||
chr( 73) => chr( 73),
|
||||
chr( 74) => chr( 74),
|
||||
chr( 75) => chr( 75),
|
||||
chr( 76) => chr( 76),
|
||||
chr( 77) => chr( 77),
|
||||
chr( 78) => chr( 78),
|
||||
chr( 79) => chr( 79),
|
||||
chr( 80) => chr( 80),
|
||||
chr( 81) => chr( 81),
|
||||
chr( 82) => chr( 82),
|
||||
chr( 83) => chr( 83),
|
||||
chr( 84) => chr( 84),
|
||||
chr( 85) => chr( 85),
|
||||
chr( 86) => chr( 86),
|
||||
chr( 87) => chr( 87),
|
||||
chr( 88) => chr( 88),
|
||||
chr( 89) => chr( 89),
|
||||
chr( 90) => chr( 90),
|
||||
chr( 91) => chr( 91),
|
||||
chr( 92) => chr( 92),
|
||||
chr( 93) => chr( 93),
|
||||
chr( 94) => chr( 94),
|
||||
chr( 95) => chr( 95),
|
||||
chr( 96) => chr( 96),
|
||||
chr( 97) => chr( 97),
|
||||
chr( 98) => chr( 98),
|
||||
chr( 99) => chr( 99),
|
||||
chr(100) => chr(100),
|
||||
chr(101) => chr(101),
|
||||
chr(102) => chr(102),
|
||||
chr(103) => chr(103),
|
||||
chr(104) => chr(104),
|
||||
chr(105) => chr(105),
|
||||
chr(106) => chr(106),
|
||||
chr(107) => chr(107),
|
||||
chr(108) => chr(108),
|
||||
chr(109) => chr(109),
|
||||
chr(110) => chr(110),
|
||||
chr(111) => chr(111),
|
||||
chr(112) => chr(112),
|
||||
chr(113) => chr(113),
|
||||
chr(114) => chr(114),
|
||||
chr(115) => chr(115),
|
||||
chr(116) => chr(116),
|
||||
chr(117) => chr(117),
|
||||
chr(118) => chr(118),
|
||||
chr(119) => chr(119),
|
||||
chr(120) => chr(120),
|
||||
chr(121) => chr(121),
|
||||
chr(122) => chr(122),
|
||||
chr(123) => chr(123),
|
||||
chr(124) => chr(124),
|
||||
chr(125) => chr(125),
|
||||
chr(126) => chr(126),
|
||||
chr(127) => chr(127),
|
||||
chr(128) => chr(128),
|
||||
chr(129) => chr( 95),
|
||||
chr(130) => chr( 44),
|
||||
chr(131) => chr(102),
|
||||
chr(132) => chr( 44),
|
||||
chr(133) => chr( 46),
|
||||
chr(134) => chr( 43),
|
||||
chr(135) => chr( 43),
|
||||
chr(136) => chr( 32),
|
||||
chr(137) => chr( 37),
|
||||
chr(138) => chr( 83),
|
||||
chr(139) => chr( 60),
|
||||
chr(140) => chr( 69),
|
||||
chr(141) => chr( 32),
|
||||
chr(142) => chr( 90),
|
||||
chr(143) => chr( 32),
|
||||
chr(144) => chr( 32),
|
||||
chr(145) => chr( 39),
|
||||
chr(146) => chr( 39),
|
||||
chr(147) => chr( 34),
|
||||
chr(148) => chr( 34),
|
||||
chr(149) => chr( 46),
|
||||
chr(150) => chr( 45),
|
||||
chr(151) => chr( 45),
|
||||
chr(152) => chr( 32),
|
||||
chr(153) => chr( 32),
|
||||
chr(154) => chr(115),
|
||||
chr(155) => chr( 62),
|
||||
chr(156) => chr(111),
|
||||
chr(157) => chr( 32),
|
||||
chr(158) => chr(122),
|
||||
chr(159) => chr( 89),
|
||||
chr(160) => chr( 32),
|
||||
chr(161) => chr( 33),
|
||||
chr(162) => chr( 99),
|
||||
chr(163) => chr( 76),
|
||||
chr(164) => chr( 32),
|
||||
chr(165) => chr( 86),
|
||||
chr(166) => chr(124),
|
||||
chr(167) => chr( 83),
|
||||
chr(168) => chr( 32),
|
||||
chr(169) => chr( 99),
|
||||
chr(170) => chr( 97),
|
||||
chr(171) => chr( 60),
|
||||
chr(172) => chr( 32),
|
||||
chr(173) => chr( 45),
|
||||
chr(174) => chr( 114),
|
||||
chr(175) => chr( 45),
|
||||
chr(176) => chr( 111),
|
||||
chr(177) => chr( 43),
|
||||
chr(178) => chr( 50),
|
||||
chr(179) => chr( 51),
|
||||
chr(180) => chr( 39),
|
||||
chr(181) => chr(117),
|
||||
chr(182) => chr( 32),
|
||||
chr(183) => chr( 46),
|
||||
chr(184) => chr( 97),
|
||||
chr(185) => chr( 49),
|
||||
chr(186) => chr(111),
|
||||
chr(187) => chr( 62),
|
||||
chr(188) => chr( 32),
|
||||
chr(189) => chr( 32),
|
||||
chr(190) => chr( 32),
|
||||
chr(191) => chr( 63),
|
||||
chr(192) => chr( 65),
|
||||
chr(193) => chr( 65),
|
||||
chr(194) => chr( 65),
|
||||
chr(195) => chr( 65),
|
||||
chr(196) => chr( 65),
|
||||
chr(197) => chr( 65),
|
||||
chr(198) => chr( 65),
|
||||
chr(199) => chr( 67),
|
||||
chr(200) => chr( 69),
|
||||
chr(201) => chr( 69),
|
||||
chr(202) => chr( 69),
|
||||
chr(203) => chr( 69),
|
||||
chr(204) => chr( 73),
|
||||
chr(205) => chr( 73),
|
||||
chr(206) => chr( 73),
|
||||
chr(207) => chr( 73),
|
||||
chr(208) => chr( 68),
|
||||
chr(209) => chr( 78),
|
||||
chr(210) => chr( 79),
|
||||
chr(211) => chr( 79),
|
||||
chr(212) => chr( 79),
|
||||
chr(213) => chr( 79),
|
||||
chr(214) => chr( 79),
|
||||
chr(215) => chr( 42),
|
||||
chr(216) => chr( 48),
|
||||
chr(217) => chr( 85),
|
||||
chr(218) => chr( 85),
|
||||
chr(219) => chr( 85),
|
||||
chr(220) => chr( 85),
|
||||
chr(221) => chr( 89),
|
||||
chr(222) => chr( 80),
|
||||
chr(223) => chr( 66),
|
||||
chr(224) => chr( 97),
|
||||
chr(225) => chr( 97),
|
||||
chr(226) => chr( 97),
|
||||
chr(227) => chr( 97),
|
||||
chr(228) => chr( 97),
|
||||
chr(229) => chr( 97),
|
||||
chr(230) => chr( 97),
|
||||
chr(231) => chr( 99),
|
||||
chr(232) => chr(101),
|
||||
chr(233) => chr(101),
|
||||
chr(234) => chr(101),
|
||||
chr(235) => chr(101),
|
||||
chr(236) => chr(105),
|
||||
chr(237) => chr(105),
|
||||
chr(238) => chr(105),
|
||||
chr(239) => chr(105),
|
||||
chr(240) => chr( 97),
|
||||
chr(241) => chr(110),
|
||||
chr(242) => chr(111),
|
||||
chr(243) => chr(111),
|
||||
chr(244) => chr(111),
|
||||
chr(245) => chr(111),
|
||||
chr(246) => chr(111),
|
||||
chr(247) => chr( 47),
|
||||
chr(248) => chr( 48),
|
||||
chr(249) => chr(117),
|
||||
chr(250) => chr(117),
|
||||
chr(251) => chr(117),
|
||||
chr(252) => chr(117),
|
||||
chr(253) => chr(117),
|
||||
chr(254) => chr( 98),
|
||||
chr(255) => chr(121)
|
||||
);
|
||||
|
||||
$lang['%.2f (rated %d times, standard deviation = %.2f)'] = '%.2f (noté %d fois, écart type = %.2f)';
|
||||
$lang['%d Kb'] = '%d Ko';
|
||||
|
@ -457,7 +199,7 @@ $lang['excluded'] = 'exclus';
|
|||
$lang['favorite_cat'] = 'Mes favorites';
|
||||
$lang['favorite_cat_hint'] = 'afficher mes images favorites';
|
||||
$lang['favorites'] = 'Favoris';
|
||||
$lang['first_page'] = 'Premier';
|
||||
$lang['first_page'] = 'Première';
|
||||
$lang['gallery_locked_message'] = 'La galerie est verrouillée pour cause de maintenance. Revenir plus tard.';
|
||||
$lang['generation_time'] = 'Page fabriquée en';
|
||||
$lang['guest'] = 'visiteur';
|
||||
|
@ -480,7 +222,7 @@ $lang['included'] = 'inclus';
|
|||
$lang['invalid_pwd'] = 'Mot de passe invalide !';
|
||||
$lang['language'] = 'Langue';
|
||||
$lang['last %d days'] = '%d derniers jours';
|
||||
$lang['last_page'] = 'Dernier';
|
||||
$lang['last_page'] = 'Dernière';
|
||||
$lang['link_info_image'] = 'Modifier les informations';
|
||||
$lang['logout'] = 'Déconnexion';
|
||||
$lang['mail_address'] = $lang['Email address'];
|
||||
|
@ -514,7 +256,7 @@ $lang['nb_row_per_page'] = 'Nombre de lignes par page';
|
|||
$lang['nbm_unknown_identifier'] = 'Identifiants inconnus';
|
||||
$lang['new_password'] = 'Nouveau mot de passe';
|
||||
$lang['new_rate'] = 'Votez pour cette image';
|
||||
$lang['next_page'] = 'Suivant';
|
||||
$lang['next_page'] = 'Suivante';
|
||||
$lang['no'] = 'Non';
|
||||
$lang['no_category'] = 'Accueil';
|
||||
$lang['no_rate'] = 'pas de note';
|
||||
|
@ -528,7 +270,7 @@ $lang['picture_show_metadata'] = 'Montrer les m
|
|||
$lang['pictures'] = 'images';
|
||||
$lang['powered_by'] = 'Propulsé par';
|
||||
$lang['preferences'] = 'Préférences';
|
||||
$lang['previous_page'] = 'Précédent';
|
||||
$lang['previous_page'] = 'Précédente';
|
||||
$lang['random_cat'] = 'Images au hasard';
|
||||
$lang['random_cat_hint'] = 'afficher un ensemble aléatoire d\'images';
|
||||
$lang['recent_cats_cat'] = 'Catégories récentes';
|
||||
|
@ -549,7 +291,7 @@ $lang['register_page_title'] = 'Enregistrement';
|
|||
$lang['register_title'] = 'Enregistrement';
|
||||
$lang['remember_me'] = 'Connexion auto';
|
||||
$lang['remove this tag'] = 'enlever ce tag de la liste';
|
||||
$lang['representative'] = 'représentant';
|
||||
$lang['representative'] = 'Représentante';
|
||||
$lang['reset'] = 'Annuler';
|
||||
$lang['return to homepage'] = 'retour à la page d\'accueil';
|
||||
$lang['search'] = 'Recherche';
|
||||
|
@ -572,10 +314,10 @@ $lang['search_subcats_included'] = 'Rechercher dans les sous-cat
|
|||
$lang['search_title'] = 'Recherche';
|
||||
$lang['searched words : %s'] = 'mots recherchés : %s';
|
||||
$lang['send_mail'] = 'Contacter';
|
||||
$lang['set as category representative'] = 'élire comme représentant de cette catégorie';
|
||||
$lang['set as category representative'] = 'Choisir comme représentante de cette catégorie';
|
||||
$lang['show_nb_comments'] = 'Montrer le nombre de commentaires';
|
||||
$lang['show_nb_hits'] = 'Montrer le nombre de visualisations';
|
||||
$lang['slideshow'] = 'diaporama';
|
||||
$lang['slideshow'] = 'Diaporama';
|
||||
$lang['slideshow_stop'] = 'arrêter le diaporama';
|
||||
$lang['special_categories'] = 'Spéciales';
|
||||
$lang['sql_queries_in'] = 'requêtes SQL en';
|
||||
|
@ -632,4 +374,8 @@ $lang['Picture name: %s'] = 'Nom de l\'image: %s';
|
|||
$lang['Creation date: %s'] = 'Date de création: %d';
|
||||
$lang['Waiting page: %s'] = 'Page en attente: %s';
|
||||
$lang['Picture uploaded by %s'] = 'Image téléchargée par %s';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
$lang['guest_must_be_guest'] = 'Statut de l\'utilisateur "guest" non conforme, utilisation du statut par défaut. Veuillez prévenir le webmestre.';
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
52
language/fr_FR.iso-8859-1/help/history.html
Normal file
52
language/fr_FR.iso-8859-1/help/history.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<h2>Historique</h2>
|
||||
|
||||
<p>Ces écrans permettent de suivre l'historique de navigation dans PhpWebGallery
|
||||
suivant les options que vous avez déterminées dans - Administration - Générale
|
||||
- Onglet "Historique".</p>
|
||||
|
||||
<h3>Statistiques</h3>
|
||||
<ul>
|
||||
<p>Si vous avez choisi que les visites des pages <span
|
||||
class="pwgScreen">index.php</span> et <span
|
||||
class="pwgScreen">picture.php</span> soient
|
||||
enregistrées dans la table <code>history</code>,
|
||||
cet onglet permet de suivre le nombre de pages visitées</p>
|
||||
|
||||
<li><strong>Statistiques totales</strong> : vous visualisez les statistiques
|
||||
par année</li>
|
||||
|
||||
<li><strong>Statistiques d'une année</strong> : vous visualisez les statistiques
|
||||
des mois de l’année sélectionnée.</li>
|
||||
|
||||
<li><strong>Statistiques d'un mois</strong> : vous visualisez les statistiques
|
||||
des jours du mois sélectionné.</li>
|
||||
|
||||
<li><strong>Statistiques d'une journée</strong> : vous visualisez les statistiques
|
||||
des heures de la journée sélectionnée.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>Rechercher</h3>
|
||||
<ul>
|
||||
<p>Si vous avez choisi que les visites des pages <span
|
||||
class="pwgScreen">index.php</span> et <span
|
||||
class="pwgScreen">picture.php</span> soient
|
||||
enregistrées dans la table <code>history</code>.
|
||||
Cet onglet permet de suivre plus en détail les pages explorées
|
||||
sur votre site avec l'aide de différents filtres.</p>
|
||||
|
||||
<li><strong>Filtrer par date</strong> : sélectionner la plage
|
||||
d'observation dont vous souhaitez observer l’activité.</li>
|
||||
|
||||
<li><strong>Filtrer par type d'élément</strong> : sélectionner le
|
||||
type d'élément dont vous souhaitez observer l’activité.</li>
|
||||
|
||||
<li><strong>Utilisateur</strong> : sélectionner l'utilisateur dont vous
|
||||
souhaitez observer l’activité.</li>
|
||||
|
||||
<li><strong>Nom du fichier</strong> : sélectionner le nom du fichier dont vous
|
||||
souhaitez observer l’activité.</li>
|
||||
|
||||
<li><strong>Identifiant image</strong> : sélectionner l'identifiant image dont vous
|
||||
souhaitez observer l’activité.</li>
|
||||
</ul>
|
|
@ -28,19 +28,24 @@ l'
|
|||
(accessible depuis la page de visualisation d'une image <span
|
||||
class="pwgScreen">picture.php</span>).</li>
|
||||
|
||||
<li><strong>Purger l'historique:</strong> Supprime toutes les lignes de
|
||||
<li><strong>Réparer et optimiser la base de données:</strong>
|
||||
Pour chaque tables de la base de données PhpWegGallery, les opérations de ré-ordonnancement, de réparation et d'optimisation sont effectuées.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li><strong>Purger le detail de l'historique:</strong> Supprime toutes les lignes de
|
||||
la table <code>history</code>. L'écran <span
|
||||
class="pwgScreen">Administration, Spéciales, Historique</span> ne montre alors
|
||||
plus aucune information sur le passé. <em>Attention</em>: toutes les données
|
||||
seront perdues et il n'existe aucun moyen de les récupérer.</li>
|
||||
|
||||
<li><strong>Purger le sommaire de l'historique:</strong> Supprime toutes les informations sommaires (obtenues à partir de detail de l'historique) .</li>
|
||||
|
||||
<li><strong>Purger les sessions:</strong> Supprimer les sessions
|
||||
expirées..</li>
|
||||
|
||||
<li><strong>Purger les flux de notification jamais utilisés</strong></li>
|
||||
|
||||
<li><strong>Réparer et optimiser la base de données:</strong>
|
||||
Pour chaque tables de la base de données PhpWegGallery, les opérations de ré-ordonnancement, de réparation et d'optimisation sont effectuées.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -69,4 +69,7 @@ Un fois ce fichier supprim
|
|||
</ul>';
|
||||
$lang['conf_mail_webmaster'] = 'Adresse e-mail de l\'Administrateur';
|
||||
$lang['conf_mail_webmaster_info'] = 'Les visiteurs pourront vous contacter par ce mail';
|
||||
?>
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.1
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.2
|
||||
// --------- Starting below: New or revised $lang ---- from version 1.7.3
|
||||
?>
|
||||
|
|
8
nbm.php
8
nbm.php
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
@ -61,15 +59,13 @@ if (isset($_GET['unsubscribe'])
|
|||
}
|
||||
else
|
||||
{
|
||||
/* echo l10n('nbm_unknown_identifier');
|
||||
exit();*/
|
||||
array_push($page['errors'], l10n('nbm_unknown_identifier'));
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template initialization |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$title = $lang['nbm_item_notification'];
|
||||
$title = l10n('nbm_item_notification');
|
||||
$page['body_id'] = 'theNBMPage';
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
|
|
175
picture.php
175
picture.php
|
@ -4,7 +4,6 @@
|
|||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
|
@ -29,6 +28,7 @@ define('PHPWG_ROOT_PATH','./');
|
|||
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
|
||||
include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_session.inc.php');
|
||||
|
||||
// Check Access and exit when user status is not ok
|
||||
check_status(ACCESS_GUEST);
|
||||
|
@ -39,14 +39,100 @@ if (isset($page['category']))
|
|||
check_restrictions($page['category']['id']);
|
||||
}
|
||||
|
||||
$page['rank_of'] = array_flip($page['items']);
|
||||
|
||||
// if this image_id doesn't correspond to this category, an error message is
|
||||
// displayed, and execution is stopped
|
||||
if (!in_array($page['image_id'], $page['items']))
|
||||
if ( !isset($page['rank_of'][$page['image_id']]) )
|
||||
{
|
||||
page_not_found(
|
||||
'The requested image does not belong to this image set',
|
||||
duplicate_index_url()
|
||||
);
|
||||
$query = '
|
||||
SELECT id, file
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE ';
|
||||
if ($page['image_id']>0)
|
||||
{
|
||||
$query .= 'id = '.$page['image_id'];
|
||||
}
|
||||
else
|
||||
{// url given by file name
|
||||
assert( !empty($page['image_file']) );
|
||||
$query .= 'file LIKE "' .
|
||||
str_replace(array('_','%'), array('/_','/%'), $page['image_file'] ).
|
||||
'.%" ESCAPE "/" LIMIT 1';
|
||||
}
|
||||
if ( ! ( $row = mysql_fetch_array(pwg_query($query)) ) )
|
||||
{// element does not exist
|
||||
page_not_found( 'The requested image does not exist',
|
||||
duplicate_index_url()
|
||||
);
|
||||
}
|
||||
|
||||
list($page['image_id'], $page['image_file']) = $row;
|
||||
if ( !isset($page['rank_of'][$page['image_id']]) )
|
||||
{// the image can still be non accessible (filter/cat perm) and/or not in the set
|
||||
global $filter;
|
||||
if ( !empty($filter['visible_images']) and
|
||||
!in_array($page['image_id'], explode(',',$filter['visible_images']) ) )
|
||||
{
|
||||
page_not_found( 'The requested image is filtered',
|
||||
duplicate_index_url()
|
||||
);
|
||||
}
|
||||
if ('categories'==$page['section'] and !isset($page['category']) )
|
||||
{// flat view - all items
|
||||
access_denied();
|
||||
}
|
||||
else
|
||||
{// try to see if we can access it differently
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
|
||||
WHERE id='.$page['image_id']
|
||||
. get_sql_condition_FandF(
|
||||
array('forbidden_categories' => 'category_id'),
|
||||
" AND"
|
||||
).'
|
||||
LIMIT 1';
|
||||
if ( mysql_num_rows( pwg_query($query) ) == 0 )
|
||||
{
|
||||
access_denied();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ('best_rated'==$page['section'])
|
||||
{
|
||||
$page['rank_of'][$page['image_id']] = count($page['items']);
|
||||
array_push($page['items'], $page['image_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = make_picture_url(
|
||||
array(
|
||||
'image_id' => $page['image_id'],
|
||||
'image_file' => $page['image_file'],
|
||||
'section' => 'categories',
|
||||
'flat' => true,
|
||||
)
|
||||
);
|
||||
set_status_header( 'recent_pics'==$page['section'] ? 301 : 302);
|
||||
redirect_http( $url );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// There is cookie, so we must handle it at the beginning
|
||||
if ( isset($_GET['metadata']) )
|
||||
{
|
||||
if ( pwg_get_session_var('show_metadata') == null )
|
||||
{
|
||||
pwg_set_session_var('show_metadata', 1, 86400, cookie_path());
|
||||
} else {
|
||||
pwg_unset_session_var('show_metadata');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add default event handler for rendering element content
|
||||
|
@ -56,6 +142,9 @@ add_event_handler(
|
|||
EVENT_HANDLER_PRIORITY_NEUTRAL,
|
||||
2
|
||||
);
|
||||
// add default event handler for rendering element description
|
||||
add_event_handler('render_element_description', 'nl2br');
|
||||
|
||||
trigger_action('loc_begin_picture');
|
||||
|
||||
// this is the default handler that generates the display for the element
|
||||
|
@ -101,8 +190,6 @@ function default_picture_content($content, $element_info)
|
|||
// | initialization |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$page['rank_of'] = array_flip($page['items']);
|
||||
|
||||
// caching first_rank, last_rank, current_rank in the displayed
|
||||
// section. This should also help in readability.
|
||||
$page['first_rank'] = 0;
|
||||
|
@ -242,13 +329,16 @@ DELETE FROM '.COMMENTS_TABLE.'
|
|||
}
|
||||
|
||||
// incrementation of the number of hits, we do this only if no action
|
||||
$query = '
|
||||
if (trigger_event('allow_increment_element_hit_count', !isset($_POST['content']) ) )
|
||||
{
|
||||
$query = '
|
||||
UPDATE
|
||||
'.IMAGES_TABLE.'
|
||||
SET hit = hit+1
|
||||
WHERE id = '.$page['image_id'].'
|
||||
;';
|
||||
pwg_query($query);
|
||||
pwg_query($query);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------- related categories
|
||||
$query = '
|
||||
|
@ -453,6 +543,8 @@ $title_nb = ($page['current_rank'] + 1).'/'.count($page['items']);
|
|||
|
||||
// metadata
|
||||
$url_metadata = duplicate_picture_url();
|
||||
$url_metadata = add_url_params( $url_metadata, array('metadata'=>null) );
|
||||
|
||||
|
||||
// do we have a plugin that can show metadata for something else than images?
|
||||
$metadata_showable = trigger_event(
|
||||
|
@ -464,18 +556,12 @@ $metadata_showable = trigger_event(
|
|||
$picture['current']['path']
|
||||
);
|
||||
|
||||
if ($metadata_showable)
|
||||
if ( $metadata_showable and pwg_get_session_var('show_metadata') )
|
||||
{
|
||||
if ( !isset($_GET['metadata']) )
|
||||
{
|
||||
$url_metadata = add_url_params( $url_metadata, array('metadata'=>null) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
|
||||
}
|
||||
$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
|
||||
}
|
||||
|
||||
|
||||
$page['body_id'] = 'thePicturePage';
|
||||
|
||||
// allow plugins to change what we computed before passing data to template
|
||||
|
@ -483,7 +569,7 @@ $picture = trigger_event('picture_pictures_data', $picture);
|
|||
|
||||
|
||||
if (isset($picture['next']['image_url'])
|
||||
and isset($picture['next']['is_picture']))
|
||||
and $picture['next']['is_picture'] )
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'prefetch',
|
||||
|
@ -598,8 +684,8 @@ SELECT COUNT(*) AS nb_fav
|
|||
array(
|
||||
'FAVORITE_IMG' =>
|
||||
get_root_url().get_themeconf('icon_dir').'/favorite.png',
|
||||
'FAVORITE_HINT' => $lang['add_favorites_hint'],
|
||||
'FAVORITE_ALT' => $lang['add_favorites_alt'],
|
||||
'FAVORITE_HINT' => l10n('add_favorites_hint'),
|
||||
'FAVORITE_ALT' => l10n('add_favorites_alt'),
|
||||
'U_FAVORITE' => add_url_params(
|
||||
$url_self,
|
||||
array('action'=>'add_to_favorites')
|
||||
|
@ -614,8 +700,8 @@ SELECT COUNT(*) AS nb_fav
|
|||
array(
|
||||
'FAVORITE_IMG' =>
|
||||
get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
|
||||
'FAVORITE_HINT' => $lang['del_favorites_hint'],
|
||||
'FAVORITE_ALT' => $lang['del_favorites_alt'],
|
||||
'FAVORITE_HINT' => l10n('del_favorites_hint'),
|
||||
'FAVORITE_ALT' => l10n('del_favorites_alt'),
|
||||
'U_FAVORITE' => add_url_params(
|
||||
$url_self,
|
||||
array('action'=>'remove_from_favorites')
|
||||
|
@ -639,7 +725,9 @@ if (isset($picture['current']['comment'])
|
|||
$template->assign_block_vars(
|
||||
'legend',
|
||||
array(
|
||||
'COMMENT_IMG' => nl2br($picture['current']['comment'])
|
||||
'COMMENT_IMG' =>
|
||||
trigger_event('render_element_description',
|
||||
$picture['current']['comment'])
|
||||
));
|
||||
$header_infos['COMMENT'] = strip_tags($picture['current']['comment']);
|
||||
}
|
||||
|
@ -764,17 +852,38 @@ else
|
|||
$template->assign_vars($infos);
|
||||
|
||||
// related categories
|
||||
foreach ($related_categories as $category)
|
||||
{
|
||||
if ( count($related_categories)==1 and
|
||||
isset($page['category']) and
|
||||
$related_categories[0]['category_id']==$page['category']['id'] )
|
||||
{ // no need to go to db, we have all the info
|
||||
$template->assign_block_vars(
|
||||
'category',
|
||||
array(
|
||||
'LINE' => count($related_categories) > 3
|
||||
? get_cat_display_name_cache($category['uppercats'])
|
||||
: get_cat_display_name_from_id($category['category_id'])
|
||||
)
|
||||
array('LINE'=>get_cat_display_name( $page['category']['upper_names'] ))
|
||||
);
|
||||
}
|
||||
else
|
||||
{ // use only 1 sql query to get names for all related categories
|
||||
$ids = array();
|
||||
foreach ($related_categories as $category)
|
||||
{// add all uppercats to $ids
|
||||
$ids = array_merge($ids, explode(',', $category['uppercats']) );
|
||||
}
|
||||
$ids = array_unique($ids);
|
||||
$query = '
|
||||
SELECT id, name, permalink
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id IN ('.implode(',',$ids).')';
|
||||
$cat_map = hash_from_query($query, 'id');
|
||||
foreach ($related_categories as $category)
|
||||
{
|
||||
$cats = array();
|
||||
foreach ( explode(',', $category['uppercats']) as $id )
|
||||
{
|
||||
$cats[] = $cat_map[$id];
|
||||
}
|
||||
$template->assign_block_vars('category', array('LINE'=>get_cat_display_name($cats) ) );
|
||||
}
|
||||
}
|
||||
|
||||
//slideshow end
|
||||
if (isset($_GET['slideshow']))
|
||||
|
@ -807,7 +916,7 @@ $template->assign_var( 'ELEMENT_CONTENT', $element_content );
|
|||
|
||||
include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
|
||||
include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
|
||||
if ($metadata_showable and isset($_GET['metadata']))
|
||||
if ($metadata_showable and pwg_get_session_var('show_metadata') <> null )
|
||||
{
|
||||
include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -10,10 +10,8 @@ Author URI: http://www.phpwebgallery.net
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | branch : BSF (Best So Far)
|
||||
// | file : $RCSfile$
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
// | last modifier : $Author$
|
||||
// | revision : $Revision$
|
||||
|
|
|
@ -154,7 +154,7 @@ foreach ($cases as $id_adv)
|
|||
|
||||
Case 11 :
|
||||
$adv[] = 'Valeur actuelle : ' . (string) $conf['level_separator'] . '.';
|
||||
$adv[] = 'Vous pouvez toujours essayer un autre séparateur commme :'
|
||||
$adv[] = 'Vous pouvez toujours essayer un autre séparateur comme :'
|
||||
. '<br />$conf[\'level_separator\'] = \'+ \';';
|
||||
$cond = ( $conf['level_separator'] == ' / ' );
|
||||
$confk = 'level_separator';
|
||||
|
@ -256,8 +256,8 @@ foreach ($cases as $id_adv)
|
|||
. 'create_listing_file.php devra être modifié.<br />'
|
||||
. 'Vous devriez avoir un message d\'avertissement pendant la '
|
||||
. 'synchronisation dans ce cas.';
|
||||
$adv[] = 'Try to keep the same prefix thru all your sites either '
|
||||
. 'local or distants.';
|
||||
$adv[] = 'Essayez de garder le même préfixe de miniatures pour les sites '
|
||||
. 'locaux ou distants.';
|
||||
$adv[] = 'Conservez ce paramètre dans votre ./include/config_'
|
||||
. '<strong>local.inc.php</strong>. <br />'
|
||||
. 'Voir la page sur la configuration dans le Wiki pour plus '
|
||||
|
|
|
@ -8,7 +8,10 @@ if (!is_admin() or !function_exists('multiview_user_init') )
|
|||
pwg_unset_session_var( 'multiview_as' );
|
||||
pwg_unset_session_var( 'multiview_theme' );
|
||||
pwg_unset_session_var( 'multiview_lang' );
|
||||
pwg_unset_session_var( 'multiview_show_queries' );
|
||||
pwg_unset_session_var( 'multiview_debug_l10n' );
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.close();
|
||||
</script>
|
||||
|
@ -18,18 +21,20 @@ if (!is_admin() or !function_exists('multiview_user_init') )
|
|||
|
||||
$refresh_main = false;
|
||||
|
||||
if ( isset($_GET['view_guest']) )
|
||||
if ( isset($_GET['view_as']) )
|
||||
{
|
||||
pwg_set_session_var( 'multiview_as', $conf['guest_id'] );
|
||||
if ( is_adviser() and $user['id']!=$_GET['view_as'] and $conf['guest_id']!=$_GET['view_as'])
|
||||
die('security error');
|
||||
pwg_set_session_var( 'multiview_as', (int)$_GET['view_as'] );
|
||||
// user change resets theme/lang
|
||||
pwg_unset_session_var( 'multiview_theme' );
|
||||
pwg_unset_session_var( 'multiview_lang' );
|
||||
$refresh_main = true;
|
||||
}
|
||||
elseif ( isset($_GET['view_admin']) )
|
||||
{
|
||||
pwg_unset_session_var('multiview_as');
|
||||
$refresh_main = true;
|
||||
}
|
||||
$view_as = pwg_get_session_var( 'multiview_as', 0 );
|
||||
|
||||
if (pwg_get_session_var( 'multiview_as', $user['id']) != $user['id'] )
|
||||
$view_as_user = build_user( pwg_get_session_var( 'multiview_as',0), false);
|
||||
else
|
||||
$view_as_user = $user;
|
||||
|
||||
if ( isset($_GET['theme']) )
|
||||
{
|
||||
|
@ -43,13 +48,65 @@ if ( isset($_GET['lang']) )
|
|||
$refresh_main = true;
|
||||
}
|
||||
|
||||
$my_url = get_root_url().'plugins/'.basename(dirname(__FILE__)).'/'.basename(__FILE__);
|
||||
$my_theme = get_root_url().'template/'.$user['template'].'/theme/'.$user['theme'].'/theme.css';
|
||||
if ( isset($_GET['show_queries']) )
|
||||
{
|
||||
if ( $_GET['show_queries']> 0 )
|
||||
pwg_set_session_var( 'multiview_show_queries', 1 );
|
||||
else
|
||||
pwg_unset_session_var( 'multiview_show_queries' );
|
||||
$refresh_main = true;
|
||||
}
|
||||
|
||||
$themes_html='Theme: <select onchange="document.location = this.options[this.selectedIndex].value;">';
|
||||
if ( isset($_GET['debug_l10n']) )
|
||||
{
|
||||
if ( $_GET['debug_l10n']>0 )
|
||||
pwg_set_session_var( 'multiview_debug_l10n', 1 );
|
||||
else
|
||||
pwg_unset_session_var( 'multiview_debug_l10n' );
|
||||
$refresh_main = true;
|
||||
}
|
||||
|
||||
|
||||
$my_url = get_root_url().'plugins/'.basename(dirname(__FILE__)).'/'.basename(__FILE__);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | users |
|
||||
$query = '
|
||||
SELECT '.$conf['user_fields']['id'].' AS id,'.$conf['user_fields']['username'].' AS username
|
||||
FROM '.USERS_TABLE;
|
||||
if (is_adviser())
|
||||
{
|
||||
$query .='
|
||||
WHERE '.$conf['user_fields']['id']. ' IN ('.$user['id'].','.$conf['guest_id'].')
|
||||
';
|
||||
}
|
||||
$query .='
|
||||
ORDER BY CONVERT('.$conf['user_fields']['username'].',CHAR)
|
||||
;';
|
||||
$user_map = simple_hash_from_query($query, 'id', 'username');
|
||||
|
||||
$users_html = '<select onchange="document.location = this.options[this.selectedIndex].value;">';
|
||||
foreach( $user_map as $id=>$username)
|
||||
{
|
||||
$selected = ($id==$view_as_user['id']) ? 'selected="selected"' : '';
|
||||
$users_html .=
|
||||
'<option value="'
|
||||
.$my_url.'?view_as='.$id
|
||||
.'" '.$selected.'>'
|
||||
.$username
|
||||
.'</option>';
|
||||
}
|
||||
$users_html.= '</select>';
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | templates |
|
||||
$my_template = '';
|
||||
$themes_html='<select onchange="document.location = this.options[this.selectedIndex].value;">';
|
||||
foreach (get_pwg_themes() as $pwg_template)
|
||||
{
|
||||
$selected = $pwg_template == pwg_get_session_var( 'multiview_theme', $user['template'].'/'.$user['theme'] ) ? 'selected="selected"' : '';
|
||||
$selected = $pwg_template == pwg_get_session_var( 'multiview_theme', $view_as_user['template'].'/'.$view_as_user['theme'] ) ? 'selected="selected"' : '';
|
||||
$my_template = $selected == '' ? $my_template : $view_as_user['template'].'/theme/'.$view_as_user['theme'];
|
||||
$themes_html .=
|
||||
'<option value="'
|
||||
.$my_url.'?theme='.$pwg_template
|
||||
|
@ -59,10 +116,12 @@ foreach (get_pwg_themes() as $pwg_template)
|
|||
}
|
||||
$themes_html .= '</select>';
|
||||
|
||||
$lang_html='Language: <select onchange="document.location = this.options[this.selectedIndex].value;">';
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | language |
|
||||
$lang_html='<select onchange="document.location = this.options[this.selectedIndex].value;">';
|
||||
foreach (get_languages() as $language_code => $language_name)
|
||||
{
|
||||
$selected = $language_code == pwg_get_session_var( 'multiview_lang', $user['language'] ) ? 'selected="selected"' : '';
|
||||
$selected = $language_code == pwg_get_session_var( 'multiview_lang', $view_as_user['language'] ) ? 'selected="selected"' : '';
|
||||
$lang_html .=
|
||||
'<option value="'
|
||||
.$my_url.'?lang='.$language_code
|
||||
|
@ -71,38 +130,59 @@ foreach (get_languages() as $language_code => $language_name)
|
|||
.'</option>';
|
||||
}
|
||||
$lang_html .= '</select>';
|
||||
?>
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | show queries |
|
||||
$show_queries_html='';
|
||||
if (!$conf['show_queries'])
|
||||
{
|
||||
if ( !pwg_get_session_var( 'multiview_show_queries', 0 ) )
|
||||
$show_queries_html.='<a href="'.$my_url.'?show_queries=1">Show SQL queries</a>';
|
||||
else
|
||||
$show_queries_html.='<a href="'.$my_url.'?show_queries=0">Hide SQL queries</a>';
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | debug language |
|
||||
$debug_l10n_html='';
|
||||
if (!$conf['debug_l10n'])
|
||||
{
|
||||
if ( !pwg_get_session_var( 'multiview_debug_l10n', 0 ) )
|
||||
$debug_l10n_html.='<a href="'.$my_url.'?debug_l10n=1">Debug language</a>';
|
||||
else
|
||||
$debug_l10n_html.='<a href="'.$my_url.'?debug_l10n=0">Revert debug language</a>';
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Controller</title>
|
||||
</head>
|
||||
<link rel="stylesheet" type="text/css" href="<?php
|
||||
echo $my_theme;
|
||||
?>">
|
||||
<body>
|
||||
<?php
|
||||
// Controller will be displayed with the **real admin template** (without Any if it has been removed)
|
||||
if ( $my_template !== '') {
|
||||
$my_template = get_root_url().'template/'.$my_template.'/theme.css';
|
||||
echo '<link rel="stylesheet" type="text/css" href="' . $my_template .'">';
|
||||
}
|
||||
?>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<script type="text/javascript">
|
||||
if (window.opener==null) {
|
||||
window.close();
|
||||
document.write("<h2>How did you get here ???</h2>");
|
||||
document.write("<"+"h2>How did you get here ???<"+"/h2>");
|
||||
}
|
||||
</script>
|
||||
|
||||
View as:
|
||||
<?php
|
||||
if ($view_as)
|
||||
echo '<a href="'.$my_url.'?view_admin">admin</a>';
|
||||
else
|
||||
echo '<a href="'.$my_url.'?view_guest">guest</a>';
|
||||
?>
|
||||
<table>
|
||||
<tr><td>User</td><td><?php echo $users_html; ?></td></tr>
|
||||
|
||||
<br />
|
||||
<?php echo $themes_html; ?>
|
||||
|
||||
<br />
|
||||
<?php echo $lang_html; ?>
|
||||
<tr><td>Theme</td><td><?php echo $themes_html; ?></td></tr>
|
||||
|
||||
<tr><td>Lang</td><td><?php echo $lang_html; ?></td></tr>
|
||||
</table>
|
||||
<?php echo implode( "<br/>\n", array($show_queries_html, $debug_l10n_html) ); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
|
@ -110,7 +190,6 @@ View as:
|
|||
window.opener.location = window.opener.location;';
|
||||
?>
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -11,12 +11,18 @@ if (! defined('MULTIVIEW_CONTROLLER') )
|
|||
if ( !empty($theme) )
|
||||
{
|
||||
list($user['template'], $user['theme']) = explode('/', $theme);
|
||||
unset( $user['admin_template'], $user['admin_theme']);
|
||||
}
|
||||
$lang = pwg_get_session_var( 'multiview_lang', '' );
|
||||
if ( !empty($lang) )
|
||||
{
|
||||
$user['language'] = $lang;
|
||||
}
|
||||
global $conf;
|
||||
if (pwg_get_session_var( 'multiview_show_queries', 0 ))
|
||||
$conf['show_queries'] = true;
|
||||
if (pwg_get_session_var( 'multiview_debug_l10n', 0 ))
|
||||
$conf['debug_l10n'] = true;
|
||||
}
|
||||
|
||||
add_event_handler('loc_end_page_header', 'multiview_loc_end_page_header');
|
||||
|
|
|
@ -16,7 +16,7 @@ function get_php_files($path, $to_ignore=array(), $recursive=true )
|
|||
if ( $recursive and is_dir($path.'/'.$node) )
|
||||
{
|
||||
$files = array_merge($files, get_php_files($path.'/'.$node, $to_ignore));
|
||||
|
||||
|
||||
}
|
||||
if ( is_file($path.'/'.$node) )
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ foreach ($files as $file)
|
|||
$code = preg_replace( '#\?'.'>.*<\?php#m', '', $code);
|
||||
$code = preg_replace( '#\/\*.*\*\/#m', '', $code);
|
||||
$code = preg_replace( '#\/\/.*#', '', $code);
|
||||
|
||||
|
||||
$count = preg_match_all(
|
||||
'#[^a-zA-Z_$-]trigger_(action|event)\s*\(\s*([^,)]+)#m',
|
||||
$code, $matches
|
||||
|
@ -57,7 +57,7 @@ foreach ($files as $file)
|
|||
}
|
||||
}
|
||||
|
||||
$sort= isset($_GET['sort']) ? $_GET['sort'] : 1;
|
||||
$sort= isset($_GET['sort']) ? (int)$_GET['sort'] : 1;
|
||||
usort(
|
||||
$events,
|
||||
create_function( '$a,$b', 'return $a['.$sort.']>$b['.$sort.'];' )
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue