$image_list = (isset($HTTP_POST_VARS['image_list'])) ? $HTTP_POST_VARS['image_list'] : "";
Insert below:/*
MOD VALIDATION RESULT V2
START INSERT
*/
$msg_list = (isset($HTTP_POST_VARS['msg_list'])) ? $HTTP_POST_VARS['msg_list'] : "";
$email_cache = array();
$action = "validateimages";
/*
MOD VALIDATION RESULT V2
END INSERT
*/
echo $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";
Replace it with:/*
MOD VALIDATION RESULT V2
START ORIGINAL CODE
echo $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";
MOD VALIDATION RESULT V2
END ORIGINAL CODE
*/
/*
MOD VALIDATION RESULT V2
START REPLACE
*/
echo $lang['image_add_success'].": <b><a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id)."\" target=\"_blank\">".stripslashes($image_name)."</a></b> (".$image_media_file.")<br />";
$email_cache[$user_id][] = array(
"status" => 1,
"send" => (isset($HTTP_POST_VARS['send'][$key]) && $HTTP_POST_VARS['send'][$key] == 2) ? 1 : 0,
"image_id" => $image_id,
"date" => $image_date,
"image_media_file" => $image_media_file,
"msg" => $msg_list[$key]
);
/*
MOD VALIDATION RESULT V2
END REPLACE
*/
echo $lang['image_delete_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";
Insert below:/*
MOD VALIDATION RESULT V2
START INSERT
*/
$email_cache[$user_id][] = array(
"status" => 0,
"send" => (isset($HTTP_POST_VARS['send'][$key]) && $HTTP_POST_VARS['send'][$key] == 2) ? 1 : 0,
"image_id" => 0,
"date" => $image_date,
"image_media_file" => $image_media_file,
"msg" => $msg_list[$key]
);
/*
MOD VALIDATION RESULT V2
END INSERT
*/
}
else {
echo "<b>Just relaxing because you give me nothing to do!</b>";
Insert above (make sure insert it above the closing bracket "}" above the else !!!!:/*
MOD VALIDATION RESULT V2
START INSERT
*/
if (!empty($email_cache))
{
if (!class_exists('Email')) include(ROOT_PATH.'includes/email.php');
$user_ids = implode(",", array_keys($email_cache));
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_allowemails")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." IN (".$user_ids.") AND ".get_user_table_field("", "user_level")." > ".GUEST;
$result = $site_db->query($sql);
$email_template = new Template(ROOT_PATH."lang/".$config['language_dir']."/email");
while($row = $site_db->fetch_array($result))
{
if (!$row['user_allowemails']) continue; //comment this line out to disregard member's setting not to receive emails from administrators
$list = "";
$file_list = array();
$site_url = $script_url;
$site_url = preg_replace("#/?admin#", "", $site_url);
// $site_url = "http://yoursite.com/4images"; // uncomment this line and update to the correct domain if your have problem with url in the email message
$email_template->register_vars(array(
"lang_upload_date" => $lang['validate_date'],
"lang_file" => $lang['validate_file'],
"lang_msg" => $lang['validate_msg'],
"lang_status" => $lang['validate_status'],
));
foreach ($email_cache[$row['user_id']] as $info)
{
if (!$info['send']) continue;
$file_list[] = $info['image_media_file'];
// $image_url = ($info['image_id']) ? "( ".$site_sess->url($site_url."/details.php?".URL_IMAGE_ID."=".$info['image_id'], "&")." )" : "";
$image_url = ($info['image_id']) ? "( ".$site_url."/details.php?".URL_IMAGE_ID."=".$info['image_id']." )" : "";
$email_template->register_vars(array(
"status" => ($info['status']) ? $lang['validate_yes'] : $lang['validate_no'],
"image_url" => $image_url,
"image_id" => $info['image_id'],
"date" => format_date($config['date_format']." ".$config['time_format'], $info['date']),
"file" => $info['image_media_file'],
"msg" => stripslashes($info['msg'])
));
$list .= $email_template->parse_template("validation_email_bit");
}
if (empty($list)) continue;
$site_email = new Email();
$site_email->set_to($row['user_email']);
// $site_email->set_from($config['site_email'], $config['site_name']);
$site_email->set_subject($lang['valdiate_title']);
$site_email->register_vars(array(
"recipient_name" => $row['user_name'],
"list" => $site_email->prepare_text($list),
"file_list" => implode(", ", $file_list),
"site_url" => $site_sess->url($site_url, "&"),
"date" => format_date($config['date_format']." ".$config['time_format'], time()),
"site_name" => $config['site_name']
));
$site_email->set_body("validation_email", $config['language_dir']);
$site_email->send_email();
}
}
echo "<br />";
/*
MOD VALIDATION RESULT V2
END INSERT
*/
(make sure that between this block of code and the code u've inserted in previous step are only two (2) closing brackets ( } )! echo "<td class=\"tableseparator\">".$lang['validate']."</td>\n<td class=\"tableseparator\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
Replace it with:/*
MOD VALIDATION RESULT V2
START ORIGINAL CODE
echo "<td class=\"tableseparator\">".$lang['validate']."</td>\n<td class=\"tableseparator\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
MOD VALIDATION RESULT V2
END ORIGINAL CODE
*/
/*
MOD VALIDATION RESULT V2
START REPLACE
*/
show_hidden_input("cat_id", $cat_id);
show_hidden_input("limitnumber", $limitnumber);
echo "<script>
var yes = false;
var no = false;
var send = true;
var rc = new Array();
function CheckAllradio(num, checked) {
for (var i=0;i<document.form.elements.length;i++) {
var e = document.form.elements[i];
if (e.type=='radio' && e.value == num) {
e.checked = checked;
}
}
}
</script>";
echo "<td class=\"tableseparator\">".$lang['validate_msg']."</td>\n<td class=\"tableseparator\" onClick=\"if(send){send=false;CheckAllradio(2, false);CheckAllradio(3, true);}else{send=true;CheckAllradio(2, true); CheckAllradio(3, false);}\">Send</td>\n<td class=\"tableseparator\" onClick=\"if(yes){yes=false;no=false}else{yes=true;no=false;}CheckAllradio(1, yes)\">".$lang['validate']."</td>\n<td class=\"tableseparator\" onClick=\"if(no){no=false;yes=false}else{no=true;yes=false;}CheckAllradio(0, no)\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
/*
MOD VALIDATION RESULT V2
END REPLACE
*/
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\"></td>";
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\"></td>";
Replace it with:/*
MOD VALIDATION RESULT V2
START ORIGINAL CODE
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\"></td>";
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\"></td>";
MOD VALIDATION RESULT V2
END ORIGINAL CODE
*/
/*
MOD VALIDATION RESULT V2
START REPLACE
*/
echo "<td>".(($image_row['user_id'] != GUEST) ? "<textarea name=\"msg_list[".$image_row['image_id']."]\" rows=\"3\" cols=\"40\">".((isset($HTTP_POST_VARS['msg_list'][$image_row['image_id']])) ? stripslashes($HTTP_POST_VARS['msg_list'][$image_row['image_id']]) : "")."</textarea>" : "")."</td>";
echo "<td>".(($image_row['user_id'] != GUEST) ? "<input type=\"radio\" name=\"send[".$image_row['image_id']."]\" value=\"2\"".(((isset($HTTP_POST_VARS['send'][$image_row['image_id']]) && $HTTP_POST_VARS['send'][$image_row['image_id']] == 2) || !isset($HTTP_POST_VARS['send'][$image_row['image_id']])) ? " checked" : "").">yes <input type=\"radio\" name=\"send[".$image_row['image_id']."]\" value=\"3\"".(((isset($HTTP_POST_VARS['send'][$image_row['image_id']]) && $HTTP_POST_VARS['send'][$image_row['image_id']] == 3)) ? " checked" : "").">no" : " ")."</td>";
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\" onDblclick=\"this.checked=false;\"></td>";
echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\" onDblclick=\"this.checked=false;\"></td>";
/*
MOD VALIDATION RESULT V2
END REPLACE
*/
/*
MOD VALIDATION RESULT V2
START INSERT
*/
$lang['valdiate_title'] = "Image Validation Results";
$lang['validate_yes'] = "added";
$lang['validate_no'] = "deleted";
$lang['validate_msg'] = "Message";
$lang['validate_file'] = "File";
$lang['validate_date'] = "Uploaded";
$lang['validate_status'] = "Status";
/*
MOD VALIDATION RESULT V2
END INSERT
*/
Dear {recipient_name},
You've uploaded to the "{site_name}" the following file(s):
{file_list}
The validation result is the following:
___________________________________________________
{list}--
Best regards, {site_name}
{site_url}
{lang_file}: {file}
{lang_upload_date}: {date}
{lang_status}: {status} {image_url}
{lang_msg}: {msg}
___________________________________________________
Q: | When someone receive an email the url to the site is broken. Why? |
A: | This might happend on some sertain systems, to fix that, try uncomment this line in admin/validateimages.php // $site_url = "http://yoursite.com/4images"; // uncomment this line and update to the correct domain if your have problem with url in the email message and change yoursite.com/4images to the correct path to your gallery |
Q: | Why some members dont receive any emails even though I selected "send" during validation? |
A: | If a member set in their profile "Do not receive emails from administrators" they will not receive validation results either. But you can force email to be sent by commenting out this line: if (!$row['user_allowemails']) continue; //comment this line out to disregard member's setting not to receive emails from administrators |
Q: | When members receive email, the validation results list is showed in one line, without line breaks. Why? |
A: | When I was writing this mod I've experienced it myself, it turned out that 4images template engine (atleast in v1.7.1) removes line breaks if a template tag placed at the end of line. To fix that, simply add one space after each last template tag on each line |
Q: | What exactly "Send" column does? |
A: | In some cases (dont ask me what) you might not want the member know if a sertain image was added or deleted, so, by selecting "no" in the "Send" column the file will not be added in the list in the email (if only one file validated and "Send" selected to "no", then no email will be sent at all to that member) |
Q: | What can I do if I selected a file to be added or deleted and then changed my mind and dont want do any actions to that sertain file? Is page refresh the only way? |
A: | Page refresh is one way, but not the only way. By double click on the "Add" or "Delete" radio button on the specific image it should "unselect" it. Another way is click on the column name on top ("Validate" or "Delete"), ones it selected all files, click that column name again, it will unselect everything. |
would I get any conflict if i install this mod because I have install the mod that send a email when the images are validated??no if u uninstall it first (as it mentioned at the beginning of the installation guide)
"recipient_name" => $row['user_name'],
Insert below: "admin_name" => $user_info['user_name'],
"admin_email" => $user_info['user_email'],
$site_email->set_to($row['user_email']);
This line:[qcode] $site_email->set_bcc("your@email.com");email_validation_bit.html sieht ja so aus:
{lang_file}: {file}
{lang_upload_date}: {date}
{lang_status}: {status} {image_url}
{lang_msg}: {msg}
Wenn die Email dann versendet wird, werden die einzelnen Zeilen aber nicht mit einem Zeilenumbruch versehen, sondern hintereinander weg geschrieben.
Datei: D-HZSB_2007-09-05_CHR_29_BWK_HH_Anflug_005.jpgHochgeladen: 08.01.2008
23:05Status: gelöscht Nachricht: test
Wenn ich jetzt mit <br> oder <br /> oder [n] arbeite, erfolgt ein Zeilenumbruch, aber die Tags werden mit ausgegeben:
Datei: D-HZSB_2007-09-05_CHR_29_BWK_HH_Anflug_005.jpg[n]
Hochgeladen: 08.01.2008 23:02[n]
Status: gelöscht [n]
Nachricht: test[n]
Wer kennt den richtigen Weg für ein gelesenen, aber nicht ausgegebenen Zeilenumbruch in diesem Fall?
$site_email->set_to($row['user_email']);
$site_email->set_bcc(array("abc@def.de"));
{lang_file}: {file}
{lang_upload_date}: {date}
{lang_status}: {status} {image_url}
{lang_msg}: {msg}
echo $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";
echo $lang['image_add_success'].": <b>".format_text(stripslashes($image_name), 2)."</b> (".$image_media_file.")<br />";
Ok, hab mich mal an dieses Problem gewagt und auch schon einen Teilerfolg erzielen können.
In der E-Mail werden unter einem neuen Punkt die Checkboxen angezeigt, jedoch immer nur eine, also nicht mehrere.
Ich vermute mal, dass der Fehler hier liegt und man die Werte eigentlich in einem array speichern muss:
$msg_list = (isset($HTTP_POST_VARS['msg_list'])) ? $HTTP_POST_VARS['msg_list'] : "";
$reason_list = (isset($HTTP_POST_VARS['reason_list'])) ? $HTTP_POST_VARS['reason_list'] : "";
$email_cache = array();
$action = "validateimages";
($reason_list ist für die Ckeckboxen)
Kann mir hier vielleicht jemand weiterhelfen?
Danke und Grüße,
Patrick
Ich würde an deiner Stelle ein Option Dropdownfeld benutzen, da hast du weniger Probleme mit den Style.
Zur Zeit kann ich dir auf die schnelle nicht weiterhelfen, erst hatte ich 14 Tage Probleme mit dem Ischiasnerv (Spritze, Infusionen, e.t.c), Gestern Zahnextraktion Ergebnis Fieber geschwollene Backe :evil:
mfg Andi
.....Drei Tabletten, jetzt geht's :mrgreen:
Hm, das Problem am Dropdownfeld ist der größere Zeitaufwand beim Anklicken, aber eine Alternative ist es allemal, vielen Dank!
....
Wenn's dir dann wieder besser geht würd ich mich freuen, wenn du nochmal über meinen Code schauen könntest ;)