Merge pull request #15373 from Hystepik/develop
New: Reset invalid email script
This commit is contained in:
commit
848e98d05a
@ -793,7 +793,7 @@ if ($mode == 'standard')
|
|||||||
if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
|
if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
|
||||||
|
|
||||||
// For month
|
// For month
|
||||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||||
print '<div class="right clearboth">'.$link.'</div>';
|
print '<div class="right clearboth">'.$link.'</div>';
|
||||||
|
|
||||||
print '<div class="center clearboth margintoponly">';
|
print '<div class="center clearboth margintoponly">';
|
||||||
@ -807,7 +807,7 @@ if ($mode == 'standard')
|
|||||||
|
|
||||||
// For year
|
// For year
|
||||||
$prevyear = $year - 1; $nextyear = $year + 1;
|
$prevyear = $year - 1; $nextyear = $year + 1;
|
||||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||||
|
|
||||||
print '<div class="right clearboth margintoponly">'.$link.'</div>';
|
print '<div class="right clearboth margintoponly">'.$link.'</div>';
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||||
|
if (!defined('MAXEMAILS')) define('MAXEMAILS', 100);
|
||||||
|
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
$script_file = basename(__FILE__);
|
$script_file = basename(__FILE__);
|
||||||
@ -40,7 +41,7 @@ if (!isset($argv[2]) || !$argv[2]) {
|
|||||||
print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n";
|
print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
$id = $argv[1];
|
$fileofinvalidemail = $argv[1];
|
||||||
$type = $argv[2];
|
$type = $argv[2];
|
||||||
|
|
||||||
require_once $path."../../htdocs/master.inc.php";
|
require_once $path."../../htdocs/master.inc.php";
|
||||||
@ -68,36 +69,66 @@ if (!empty($login))
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
|
||||||
// TODO Loop on the entry file to get the 100 first entries
|
$myfile = fopen($fileofinvalidemail, "r");
|
||||||
|
if (!$myfile)
|
||||||
$groupofemails = array();
|
|
||||||
|
|
||||||
|
|
||||||
// For each groupofemail, we update tables to set email field to empty
|
|
||||||
if ($type == 'all' || $type == 'thirdparty')
|
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
echo "Failed to open file";
|
||||||
// TODO
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'contact')
|
$tmp = 1;
|
||||||
|
while ($tmp!=null)
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
$groupofemails=array();
|
||||||
// TODO
|
for ($i=0; $i < MAXEMAILS; $i++)
|
||||||
}
|
{
|
||||||
|
$tmp =fgets($myfile);
|
||||||
|
if ($tmp == null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$groupofemails[$i] = trim($tmp, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'user')
|
// For each groupofemail, we update tables to set email field to empty
|
||||||
{
|
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'member')
|
$sql_base = "UPDATE ".MAIN_DB_PREFIX;
|
||||||
{
|
foreach ($groupofemails as $email)
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
{
|
||||||
// TODO
|
if ($type == 'all' || $type == 'thirdparty')
|
||||||
}
|
{
|
||||||
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
|
|
||||||
|
$sql=$sql_base."societe as s SET s.email = NULL WHERE s.email = '".$db->escape($email)."';";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == 'all' || $type == 'contact')
|
||||||
|
{
|
||||||
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
|
|
||||||
|
$sql=$sql_base."socpeople as s SET s.email = NULL WHERE s.email = '".$db->escape($email)."';";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == 'all' || $type == 'user')
|
||||||
|
{
|
||||||
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
|
|
||||||
|
$sql=$sql_base."user as u SET u.email = NULL WHERE u.email = '".$db->escape($email)."';";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == 'all' || $type == 'member')
|
||||||
|
{
|
||||||
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
|
|
||||||
|
$sql=$sql_base."adherent as a SET a.email = NULL WHERE a.email = '".$db->escape($email)."';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
}
|
||||||
|
echo $email;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user