Hello,
i've just write some modification for the MOD Pictures Email Upload V1.7.8
http://www.4homepages.de/forum/index.php?topic=23681This little MOD is not finished jet, because i'm not able to make the selection for user by dropdown-list - i've no idea to solve this by myself
Please be patient to help me
What will this MOD do (V 0.5)?- in ACP you provide some mailadresses for using "Pictures Email Upload" eMail_upload.php without have to use the subject
- in ACP you provide the default category
- in ACP you provide the default user (in this time by user-number, i'll hope to finish by dropdown)
new V 0.8- in ACP set "all", if you like to enable emailupload without check mailadresses
- in UserCP user set up eMail-Adress for emailupload (separate from 4images mailadress)
- in UserCP user set up category by using v@no [MOD] Categories upload dropdown form (
http://www.4homepages.de/forum/index.php?topic=7722.0)
- in ACP user-section enable/disable each user using personal emailupload-config
- in eMail_upload.php new column "Auth" display, whitch rule matches
pending things:- dropdown userselect for ACP
- dropdown categoryselect for ACP in user setting
- check unique mailadress in member.php (to ensure no users use same imagesupload-maildress)
- solution for change cat-setting in ACP/UserCP while cat deleted (or user lost rights for upload in cat with future function while direct-upload)
Whischlist: If user have right to direct upload images in cat, images direct send into db instead of temp-table for validating.
This function may be inclue into original MOD
Mail checks in follow priority:
1) mail with POP-Code
2) mailadress from personal uploadmailadress by user
3) mailadress from ACP (list or "all")
This provide to sort images into category by POP-Code but also use the "easy way" like user personal settings.
Attention: Mails must have no subject to select by the new rules.After setting up, you are able to use the standard from the MOD by providing parameters in subject
oryou send email from listet adress
without subject and the attached images (vids ...) prepared automatic for validateimages.php
Please back up your files and database!
you have to change:
/admin/settings.php
/admin/users.php
/admin/plugins/eMail_upload.php
/includes/sessions.php
/includes/functions.php
/lang/xxx/admin.php
/lang/xxx/main.php
/templates/xxx/member_editprofile.html
First install [MOD] Categories upload dropdown form (http://www.4homepages.de/forum/index.php?topic=7722.0)Second update database with phpmyadmin:
ALTER TABLE `4images_users` ADD `user_emailupload` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,
ADD `user_emailupload_active` TINYINT NOT NULL DEFAULT '0', ADD `user_emailupload_cat` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0';
If you have not install the first version, you need also:
INSERT INTO `4images_settings` (`setting_name`, `setting_value`) VALUES ('noauth_mail', ''), ('noauth_mail_cat', ''), ('noauth_mail_user', '');
Next few steps are different betwen update from V 0.5 or new install.
step 1) in
/admin/settings.php (not if update)
search for:
// end of functionsinsert above:
function show_categorory_select($setting_name, $setting_value)
{
global $cat_parent_cache, $drop_down_cat_cache, $lang;
$drop_down_cat_cache = $cat_parent_cache;
echo "<select name=\"setting_item[".$setting_name."]\" class=\"categoryselect\">";
echo "<option value=\"0\">".$lang['select_category']."</option>";
echo "<option value=\"0\">-------------------------------</option>";
echo get_category_dropdown_bits((int)$setting_value);
echo "</select>";
}
step 1.1) (not if update)
search for:
show_setting_row("pop_code");add after:
show_setting_row("noauth_mail", "textarea");
show_setting_row("noauth_mail_cat", "show_categorory_select");
show_setting_row("noauth_mail_user");step 2a) in
/admin/plugins/eMail_upload.php (not if update)
search for:
$sql = "SELECT setting_value as noauth_mail FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail'"; // Mailadressen abfragen
$result = $site_db->query($sql); $row = mysql_fetch_object($result);
$noauth_mail = $row->noauth_mail;
if (($array[0] == "$user_name" && $array[1] == $config['pop_code']) || (strstr($noauth_mail, $head['from']) && $head['subject'] == ""))
{
if (strstr($noauth_mail, $head['from']) && $head['subject'] == "") {
$sql = "SELECT setting_value as noauth_mail_cat FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail_cat'"; // Kategorie abfragen
$result = $site_db->query($sql); $row = mysql_fetch_object($result);
$cat_id = $row->noauth_mail_cat;
$sql = "SELECT cat_id, cat_name FROM ".CATEGORIES_TABLE." WHERE cat_id = $cat_id"; // Kategorienamen abfragen
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$cat_name = $row[cat_name];
$sql = "SELECT setting_value as noauth_mail_user FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail_user'"; // User-ID abfragen
$result = $site_db->query($sql); $row = mysql_fetch_object($result);
$user_id = $row->noauth_mail_user;
$sql = "SELECT user_id, user_name FROM ".USERS_TABLE." WHERE user_id = $user_id"; // Usernamen abfragen
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_name = $row[user_name];
}
$path = MEDIA_TEMP_PATH."/";replace with:
if ($array[0] == "$user_name" && $array[1] == $config['pop_code']){
$path = MEDIA_TEMP_PATH."/";
step 2) in
/admin/plugins/eMail_upload.phpsearch for:
echo '<td class="tableheader" width=3%>Nr.</td>';add after:
echo '<td class="tableheader" width=5%>Auth</td>';step 2.1) in
/admin/plugins/eMail_upload.phpsearch for:
$sql = "SELECT u.user_id, u.user_name, c.cat_id, c.cat_name
FROM (".USERS_TABLE." u, ".CATEGORIES_TABLE." c)
WHERE user_name = '$array[0]' AND cat_id = '$array[2]'
";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_name = $row[user_name];
$user_id = $row[user_id];
$cat_name = $row[cat_name];
$cat_id = $row[cat_id];
if ($array[0] == "$user_name" && $array[1] == $config['pop_code']){
$path = MEDIA_TEMP_PATH."/";replace with:
if ($head['subject'] != ""){
$sql = "SELECT u.user_id, u.user_name, c.cat_id, c.cat_name
FROM (".USERS_TABLE." u, ".CATEGORIES_TABLE." c)
WHERE user_name = '$array[0]' AND cat_id = '$array[2]'
";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_name = $row[user_name];
$user_id = $row[user_id];
$cat_name = $row[cat_name];
$cat_id = $row[cat_id];
$authselect = "POP-Code";
}
else
{
$from = $head['from'];
$sql = "SELECT u.user_id, u.user_name, u.user_emailupload, u.user_emailupload_cat, u.user_emailupload_active, c.cat_id, c.cat_name
FROM ".USERS_TABLE." u
LEFT JOIN ".CATEGORIES_TABLE." c ON (".get_user_table_field("u.", "user_emailupload_cat")." = c.cat_id)
WHERE user_emailupload_active = 1 and user_emailupload = '$from'";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if ($num_rows != 0) {
$row = $site_db->fetch_array($result);
$noauth_mail = $row[user_emailupload];
$user_name = $row[user_name];
$user_id = $row[user_id];
$cat_name = $row[cat_name];
$cat_id = $row[cat_id];
$authselect = "UserUpMail";
}
else {
$sql = "SELECT setting_value as noauth_mail FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail'"; // Mailadressen abfragen
$result = $site_db->query($sql);
$row = mysql_fetch_object($result);
$noauth_mail = $row->noauth_mail;
if (strstr($noauth_mail, "all")) {
$authselect = "<b>ACPUpALL</b>";
}
else {
$authselect = "ACPUpMail";
}
$sql = "SELECT setting_value as noauth_mail_cat FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail_cat'"; // Kategorie abfragen
$result = $site_db->query($sql);
$row = mysql_fetch_object($result);
$cat_id = $row->noauth_mail_cat;
$sql = "SELECT cat_id, cat_name FROM ".CATEGORIES_TABLE." WHERE cat_id = $cat_id"; // Kategorienamen abfragen
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$cat_name = $row[cat_name];
$sql = "SELECT setting_value as noauth_mail_user FROM ".SETTINGS_TABLE." WHERE setting_name = 'noauth_mail_user'"; // User-ID abfragen
$result = $site_db->query($sql);
$row = mysql_fetch_object($result);
$user_id = $row->noauth_mail_user;
$sql = "SELECT user_id, user_name FROM ".USERS_TABLE." WHERE user_id = $user_id"; // Usernamen abfragen
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_name = $row[user_name];
}
}
if (($array[0] == "$user_name" && $array[1] == $config['pop_code']) || (strstr($noauth_mail, $head['from']) && $head['subject'] == "") || (strstr($noauth_mail, "all") && $head['subject'] == ""))
{
$path = MEDIA_TEMP_PATH."/";
step 2.2) in
/admin/plugins/eMail_upload.phpsearch for:
echo '<td width=3%>'.$i.'</td>';add after:
echo '<td width=5%>'.$authselect.'</td>';do replace twice!
step 3.0) in
/admin/users.phpsearch for:
$user_invisible = intval($HTTP_POST_VARS['user_invisible']);add after:
$user_emailupload_active = intval($HTTP_POST_VARS['user_emailupload_active']);
$user_emailupload = trim($HTTP_POST_VARS['user_emailupload']);
$user_emailupload_cat = trim($HTTP_POST_VARS['user_emailupload_cat']);
step 3.1) in
/admin/users.phpsearch for:
SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
replace with:
SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_emailupload_active")." = $user_emailupload_active, ".get_user_table_field("", "user_emailupload")." = '$user_emailupload', ".get_user_table_field("", "user_emailupload_cat")." = $user_emailupload_cat, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
step 3.2) in
/admin/users.phpsearch for:
show_date_input_row($lang['field_lastaction'].$lang['date_desc'], "user_lastaction", $user_row['user_lastaction'], $textinput_size);add after:
show_radio_row($lang['field_emailupload_active'], "user_emailupload_active", $user_row['user_emailupload_active']);
show_input_row($lang['field_user_emailupload'], "user_emailupload", $user_row['user_emailupload'], $textinput_size);
show_input_row($lang['field_user_emailupload_cat'], "user_emailupload_cat", $user_row['user_emailupload_cat'], $textinput_size);
step 3.3) in
/admin/users.phpsearch for:
$user_invisible = intval($HTTP_POST_VARS['user_invisible_'.$i]);add after:
$user_emailupload_active = intval($HTTP_POST_VARS['user_emailupload_active_'.$i]);
$user_emailupload = trim($HTTP_POST_VARS['user_emailupload_'.$i]);
$user_emailupload_cat = intval(trim($HTTP_POST_VARS['user_emailupload_cat_'.$i]));
step 3.4) in
/admin/users.phpsearch for:
$sql = "INSERT INTO ".USERS_TABLE."
(".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
VALUES
($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";replace with:
(".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_emailupload_active").get_user_table_field(", ", "user_emailupload").get_user_table_field(", ", "user_emailupload_cat").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
VALUES
($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, $user_emailupload_active, '$user_emailupload', $user_emailupload_cat, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";step 3.4) in
/admin/users.phpsearch for:
show_radio_row($lang['field_invisible'], "user_invisible_".$i, 0);add after:
show_radio_row($lang['field_emailupload_active'], "user_emailupload_active_".$i, 0);
show_input_row($lang['field_user_emailupload'], "user_emailupload_".$i, 0);
show_input_row($lang['field_user_emailupload_cat'], "user_emailupload_cat_".$i, 0);
step 4) in
/includes/sessions.phpsearch for:
"user_homepage" => "user_homepage",add after:
"user_emailupload" => "user_emailupload",
"user_emailupload_cat" => "user_emailupload_cat",
"user_emailupload_active" => "user_emailupload_active",
step 5) in
/lang/xxx/main.phpsearch for:
$lang['icq'] = "ICQ:";add after:
$lang['user_emailupload'] = "Adresse für eMail-Upload:";
$lang['user_emailupload_cat'] = "Kategorie für eMail-Upload:";step 6) in
/lang/xxx/admin.phpsearch for:
$lang['field_homepage'] = "Homepage";add after:
$lang['field_emailupload_active'] = "eMailupload";
$lang['field_user_emailupload'] = "eMail für Mailupload";
$lang['field_user_emailupload_cat'] = "Kategorie für Mailupload";step 7) in
/member.phpsearch for:
$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";add after:
$user_emailupload = (isset($HTTP_POST_VARS['user_emailupload'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_emailupload'])) : "";
$user_emailupload_cat = (isset($HTTP_POST_VARS['user_emailupload_cat'])) ? ((intval(trim($HTTP_POST_VARS['user_emailupload_cat']))) ? intval(trim($HTTP_POST_VARS['user_emailupload_cat'])) : "") : "";
step 7.1) in
/member.phpsearch for:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
replace with:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_emailupload")." = '$user_emailupload', ".get_user_table_field("", "user_emailupload_cat")." = '$cat_id',".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
step 7.2) in
/member.phpsearch for:
$site_template->register_vars(array(
"user_name" => format_text(stripslashes($user_name), 2),
"user_email" => format_text(stripslashes($user_email), 2),
"user_email2" => format_text(stripslashes($user_email2), 2),
"user_homepage" => format_text(stripslashes($user_homepage), 2),
"user_icq" => $user_icq,replace with:
$site_template->register_vars(array(
"cat_name" => get_category_dropdown_upload($user_emailupload_cat),
"user_name" => format_text(stripslashes($user_name), 2),
"user_email" => format_text(stripslashes($user_email), 2),
"user_email2" => format_text(stripslashes($user_email2), 2),
"user_homepage" => format_text(stripslashes($user_homepage), 2),
"user_icq" => $user_icq,
"user_emailupload" => format_text(stripslashes($user_emailupload), 2),
"user_emailupload_cat" => $user_emailupload_cat,step 7.3) in
/member.phpsearch for:
"lang_icq" => $lang['icq'],add after:
"lang_user_emailupload" => $lang['user_emailupload'],
"lang_user_emailupload_cat" => $lang['user_emailupload_cat'],
step in
/templates/xxx/member_editprofile.htmlsearch for:
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">
<input type="text" name="user_icq" size="30" value="{user_icq}" class="input" />
</td>
</tr>
add after:
<tr>
<td class="row1"><b>{lang_user_emailupload}</b></td>
<td class="row1">
<input type="text" name="user_emailupload" size="100" value="{user_emailupload}" class="input" />
</td>
</tr>
<tr>
<td class="row1"><b>{lang_user_emailupload_cat}</b></td>
<td class="row1">{cat_name}</td>
</tr>step 8.1) in
/templates/xxx/member_editprofile.htmlsearch for:
<input type="hidden" name="action" value="updateprofile" />add bevor:
{if cat_id}<input type="hidden" name="user_emailupload_cat" value="{cat_id}" />{endif cat_id}I've tested many configurations and i think, it works well. May i've to make the code include in eMail_upload.php mor nice
Please send your feedback here.
Regards,
Henry