$excuses = file($SYS["DOCROOT"]."../Data/excuses.txt"); $tdata=$gt->english_to_spanish($excuses[rand(0,sizeof($excuses)-1)]); */ require_once "Lib/lib_class_xml_to_array.php"; $qod = new XmlToArray(file_get_contents("http://chistes.developers4web.com/rss.php")); $arr = $qod->createArray(); $chiste = strip_tags(strtr($arr["rss"]["channel"]["item"]["description"], array("/" => "<br>")), "<br><br/><p><div><a>"); $SYS["ROOT"] = "http://172.24.81.200/~operador/globalscheduler/Backend/"; foreach ($o->searchResults as $ID => $GTASK) { $g = newObject("group", $GTASK->departamento); // Recojer responsables foreach ($g->listUsersInGroup() as $user) { if (empty($user->email)) { continue; } echo $GTASK->etiqueta . " " . $user->email . "\n"; require_once "Lib/lib_phpmailer.php"; $mail = new PHPMailer(); $mail->AddAddress($user->email); $mail->IsHTML(true); $mail->From = $SYS["admin_email"]; $mail->FromName = utf8_decode($SYS["admin_realm"]); $mail->Subject = utf8_decode("La tarea {$GTASK->etiqueta} está retrasada"); $mail->Body = utf8_decode("\r\n La tarea {$GTASK->idname()} ({$GTASK->etiqueta}) está retrasada.<br>\r\n Su fecha y hora prevista es " . strftime("%d/%m/%Y a las %H:%M", $GTASK->inicio) . "\r\n <br>\r\n Puede revisar esta tarea accediendo a la aplicación: <a href='{$SYS["ROOT"]}'>{$SYS["ROOT"]}</\r\n a>\r\n \r\n <hr>\r\n El sistema le propone mejorar su humor:\r\n {$chiste} \r\n \r\n <br>Un saludo.\r\n "); if (!$mail->Send()) { echo $mail->ErrorInfo(); } else { echo _("Aviso enviado\n"); } } }
function resetPassword($hash) { global $SYS; if ($hash != "") { $action = newObject("reset_psw"); $action->searchResults = $action->select("hash='{$hash}' AND completed='No'", $offset, $sort); if ($action->nRes > 0) { $temp = $action->searchResults[0]; $user = newObject("user", $temp->user_id); $exp_reg = "[^A-Z0-9]"; $longitud = 5; $pass = substr(eregi_replace($exp_reg, "", md5(rand())) . eregi_replace($exp_reg, "", md5(rand())) . eregi_replace($exp_reg, "", md5(rand())), 0, $longitud); $user->password = md5($pass); //dataDump($user); if ($user->save()) { $temp->completed = 'Si'; $temp->save(); $link = "Se ha generado una nueva contraseña para su usuario, a continuación le informamos de sus nuevos datos para conectarse:<br><br>\n Usuario: {$user->username}<br><br>\n Contraseña: {$pass}"; require_once "Lib/lib_phpmailer.php"; $mail = new PHPMailer(); $mail->AddAddress($user->email); $mail->IsHTML(true); $mail->From = $SYS["admin_email"]; $mail->FromName = $SYS["admin_realm"]; $mail->Attached = $mail->AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream"); $mail->Subject = $SYS["SITENAME"] . _("::Nueva contraseña de usuario"); $mail->Body = $link; if (!$mail->Send()) { $this->ERROR = $mail->ErrorInfo(); return false; } else { return true; } } } else { $this->ERROR = _("No se encuentra la solicitud"); return false; } } $this->ERROR = _("Hash invalido"); return false; }
public function sendRecoverEmail($email, $pss) { //$mail->SMTPDebug = 2; $mail = new PHPMailer(true); $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)); // set it to use SMTP $mail->isSMTP(); $mail->Host = gethostbyname("smtp.gmail.com"); // gets authentication actions $mail->SMTPAuth = true; $mail->Mailer = "smtp"; //auth data $mail->Username = "******"; $mail->Password = "******"; $mail->Port = 587; $mail->SMTPSecure = 'tls'; $mail->From = "*****@*****.**"; $mail->FromName = "Team Allocation Tool Team"; $mail->addAddress($email); $mail->isHTML(true); $mail->Subject = "Temporary Password - Team Allocation Tool"; $mail->Body = "Hello, <br/>\n You are receiving this email as you have recently requested to reset your password <br/>\n Please use the following as your temporary password: {$pss}<br/>\n Please ensure that you carefully follow these instructions:<br/>\n <ul>\n <li>1) Goto the <a href='http://team-allocation-tool.bitnamiapp.com/no_parking.php?p={$pss}'>Team Allocation Tool</a></li>\n <li>2) Change your temporary password</li>\n <li>3) Login with your new password</li>\n </ul>\n <br/><br/>\n If you require any further assistance please contact your administrator.\n <br/><br/>\n Regards,<br/><br/>\n The Team Allocation Tool Team"; if (!$mail->send()) { return $error = "Mailing Error " . $mail->ErrorInfo(); } }