SUITE DU POST PRECEDENT :
Nous sommes toujours dans le fichier UPLOAD.PHP
12/ Trouvez le code :
// Check to see if this is the last one.
if(count($escrow_array) == '0') {
// Create the final message.
if ($PIC_NEED_APPROVAL) {
if ($file_placement == 'no') {
$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];
} else {
$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];
}
} else {
if ($file_placement == 'no') {
$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];
} else {
$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];
}
}
// Delete the temporary data file.
delete_record($_POST['unique_ID']);
// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification() {
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once('include/mailer.inc.php');
// Send the message.
cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
}
cpg_send_upload_notification();
}
// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();
// Exit the script.
exit;
}
et remplacez-le par celui-ci :
// Check to see if this is the last one.
if(count($escrow_array) == '0') {
// Create the final message.
if ($PIC_NEED_APPROVAL) {
if ($file_placement == 'no') {
$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];
} else {
$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];
}
} else {
if ($file_placement == 'no') {
$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];
} else {
$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];
}
}
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
// Delete the temporary data file.
delete_record($_POST['unique_ID']);
// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification() {
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once('include/mailer.inc.php');
// Send the message.
cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
}
cpg_send_upload_notification();
}
// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();
// Exit the script.
exit;
}
} //end for loop
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
// Delete the temporary data file.
delete_record($_POST['unique_ID']);
// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification() {
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once('include/mailer.inc.php');
// Send the message.
cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
}
cpg_send_upload_notification();
}
// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();
// Exit the script.
exit;
}
}
13/ Trouvez ceci :
// Create array index.
$index = count($escrow_array) - 1;
et ajoutez le code suivant :
$start = 0;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$iCnt = count($escrow_array);
} else {
$iCnt = $index + 1;
$start = $index;
}
// Create upload form headers.
pageheader($lang_upload_php['title']);
echo <<<EOT
<script type="text/javascript">
function moveAllTo(d,box) {
var f = document.editForm;
for (i = 0; i < f.length; i++) {
if (f[i].type == "select-one" && f[i].name.indexOf(box) >= 0) {
f[i].value = d
}
}
}
</script>
EOT;
// Open the form table.
starttable("100%", $lang_upload_php['title'], 2);
echo <<<EOT
<tr>
<td class="tableh2">
All Photos:
</td>
<td class="tableh2">
EOT;
//MOVE TO ALL MOD
form_alb_list_box("Move all photos to:","moveAllTo","moveAllTo(this.value,'album');");
echo <<<EOT
</td>
</tr>
EOT;
// Direct the request to this script.
open_form($_SERVER['PHP_SELF'],'editForm');
//Display all of the photos at once for editing
for ($index = $start; $index < $iCnt; $index++) {
14/ Trouvez ceci :
// Create upload form headers.
pageheader($lang_upload_php['title']);
// Open the form table.
starttable("100%", $lang_upload_php['title'], 2);
// Direct the request to this script.
open_form($_SERVER['PHP_SELF']);
et remplacez par :
// Create upload form headers.
// pageheader($lang_upload_php['title']);
// Open the form table.
// starttable("100%", $lang_upload_php['title'], 2);
// Direct the request to this script.
// open_form($_SERVER['PHP_SELF']);
15/ Trouvez le code suivant :
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
// Check for user defined fields.
if(!empty($CONFIG['user_field1_name'])) {
$form_array[] = array($CONFIG['user_field1_name'], 'user1', 0, 255, 1);
}
if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name'], 'user2', 0, 255, 1);
}
if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name'], 'user3', 0, 255, 1);
}
if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
}
puis remplacez-le par celui-ci :
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
$form_array[] = array('control', 'phase_2', 4);
$form_array[] = array('unique_ID', $_POST['unique_ID'], 4);
}
// Check for user defined fields.
if(!empty($CONFIG['user_field1_name[]'])) {
$form_array[] = array($CONFIG['user_field1_name[]'], 'user1', 0, 255, 1);
}
if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name[]'], 'user2', 0, 255, 1);
}
if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name[]'], 'user3', 0, 255, 1);
}
if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name[]'], 'user4', 0, 255, 1);
}
16/ Recherchez ceci :
// Create the form and echo more instructions.
create_form($form_array);
et ajoutez ceci :
}//end loop over pictures
17/ Trouvez le code suivant :
// More instructions.
if(count($escrow_array) > '1') {
form_statement($lang_upload_php['place_instr_2']);
}
puis ajoutez le code ci-après :
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$form_array = array(
array('control', 'phase_2', 4),
array('unique_ID', $_REQUEST['unique_ID'], 4),
);
create_form($form_array);
}
18/ Ouvrez searchnew.php
et trouvez la fonction "function albumselect($id = "album")"
et remplacer-la entièrement par cette nouvelle fonction :function albumselect($id = "album") {
// frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order
global $CONFIG, $lang_search_new_php;
static $select = "";
// Reset counter
$list_count = 0;
if ($select == "") {
$result = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
while ($row = mysql_fetch_array($result)) {
// Add to multi-dim array for later sorting
$listArray[$list_count][cat] = $lang_search_new_php['albums_no_category'];
$listArray[$list_count][aid] = $row['aid'];
$listArray[$list_count][title] = $row['title'];
$list_count++;
}
mysql_free_result($result);
$result = db_query("SELECT DISTINCT a.aid as aid, a.title as title, c.name as cname FROM {$CONFIG['TABLE_ALBUMS']} as a, {$CONFIG['TABLE_CATEGORIES']} as c WHERE a.category = c.cid AND a.category < '" . FIRST_USER_CAT . "'");
while ($row = mysql_fetch_array($result)) {
// Add to multi-dim array for later sorting
$listArray[$list_count][cat] = $row['cname'];
$listArray[$list_count][aid] = $row['aid'];
$listArray[$list_count][title] = $row['title'];
$list_count++;
}
mysql_free_result($result);
if (defined('UDB_INTEGRATION')) {
$sql = udb_get_admin_album_list();
} else {
$sql = "SELECT aid, CONCAT('(', user_name, ') ', title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_USERS']} AS u ON category = (" . FIRST_USER_CAT . " + user_id)";
}
$result = db_query($sql);
while ($row = mysql_fetch_array($result)) {
// Add to multi-dim array for later sorting
$listArray[$list_count][cat] = $lang_search_new_php['personal_albums'];
$listArray[$list_count][aid] = $row['aid'];
$listArray[$list_count][title] = $row['title'];
$list_count++;
}
mysql_free_result($result);
$select = '<option value="0">' . $lang_search_new_php['select_album'] . "</option>\n";
// Sort the pulldown options by category and album name
$listArray = array_csort($listArray,'cat','title');
// Create the nicely sorted and formatted drop down list
$alb_cat = '';
foreach ($listArray as $val) {
if ($val[cat] != $alb_cat) {
if ($alb_cat) $select .= "</optgroup>\n";
$select .= '<optgroup label="' . $val[cat] . '">' . "\n";
$alb_cat = $val[cat];
}
$select .= '<option value="' . $val[aid] . '"' . ($val[aid] == $sel_album ? ' selected' : '') . '> ' . $val[title] . "</option>\n";
}
if ($alb_cat) $select .= "</optgroup>\n";
}
return "\n<select name=\"$id\" class=\"listbox\">\n$select</select>\n";
}
// Multi-dim array sort, with ability to sort by two and more dimensions
// Coded by Ichier2003, available at php.net
// syntax:
// $array = array_csort($array [, 'col1' [, SORT_FLAG [, SORT_FLAG]]]...);
function array_csort() {
$args = func_get_args();
$marray = array_shift($args);
$msortline = "return(array_multisort(";
foreach ($args as $arg) {
$i++;
if (is_string($arg)) {
foreach ($marray as $row) {
$sortarr[$i][] = $row[$arg];
}
} else {
$sortarr[$i] = $arg;
}
$msortline .= "\$sortarr[".$i."],";
}
$msortline .= "\$marray));";
eval($msortline);
return $marray;
}
FIN
PYAP