Esempio n. 1
0
 public static function removeMail($mail_id, $remover_id, $remover)
 {
     global $db;
     Security::demand(USER);
     $t = MotiomeraMail::loadById($mail_id);
     if ($remover == "to_deleted") {
         $t->setIsRead(1);
         $t->setToDeleted(1);
     } else {
         $t->setFromDeleted(1);
     }
     if ($t->getToDeleted() == 1 && $t->getFromDeleted() == 1) {
         $t->delete();
     }
     $t->commit();
 }
Esempio n. 2
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER, null, false);
$smarty = new PopSmarty();
$mid = Security::escape($_GET['id']);
$do = Security::escape($_GET['do']);
$medlem_to_send = Medlem::loadById($mid);
$smarty->assign("medlem_to_send", $medlem_to_send);
$smarty->assign("mid", $mid);
if ($do == 'send') {
    $smarty->assign("is_replay", false);
    if (isset($_GET['re'])) {
        $id = Security::escape($_GET['re']);
        $mail_to_read = MotiomeraMail::loadById($id);
        $smarty->assign("is_replay", true);
        $text_message_decoded = str_replace("<br>", "", $mail_to_read->getMsg());
        $text_message_decoded = str_replace("<br />", "", $mail_to_read->getMsg());
        $text_message = "\n\n********************\n";
        $text_message .= $text_message_decoded;
        $smarty->assign("text_message", $text_message);
        $smarty->assign("mail_to_read", $mail_to_read);
    }
    $action = "send";
} else {
    if ($do == 'sent') {
        $action = "sent";
    }
}
$smarty->assign("action", $action);
$smarty->display('send_mail.tpl');
Esempio n. 3
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER);
$my_id = Security::escape($_POST['my_id']);
$multiple = Security::escape($_POST['multiple']);
if ($multiple == 0) {
    $folder_id = Security::escape($_POST['folder_id']);
    MotiomeraMail::removeMailFromFolder($folder_id, $my_id);
} else {
    $nroffolders = Security::escape($_POST['nroffolders']);
    for ($i = 0; $i < $nroffolders; $i++) {
        $postvar = 'folder_id_' . $i;
        $folder_id = Security::escape($_POST[$postvar]);
        MotiomeraMail::removeMailFromFolder($folder_id, $my_id);
    }
}
Esempio n. 4
0
 public function delete()
 {
     global $USER;
     if (Security::authorized(ADMIN) or $USER->getId() == $this->getId()) {
         Adressbok::removeAllMedlemKontakter($this);
         Anslagstavla::deleteAllMemberPosts($this);
         $this->deleteAllProfilDataVal();
         //ta bort alla mail
         MotiomeraMail::removeAllMemberMail($this);
         MotiomeraMail_Folders::deleteMemberFolders($this);
         //mal tabellen verkar oanvänd, nedanstående rad ej testad
         //MalManager::removeAllMedlemMal($this);
         Help::removeAllMedlemAvfardade($this);
         Quiz::removeAllMemberQuizresults($this);
         Fotoalbum::removeAllMedlemFolders($this);
         //lag inte i burk atm, nedanstående rad ej testad
         //Lag::removeMedlemFromAllLag($this);
         /* remove member from foretagsnycklar */
         $foretag = Foretag::loadByMedlem($this);
         if (isset($foretag)) {
             $foretag->gaUr($this->getId());
         }
         /* inga matchande klasser för mindre tabeller */
         global $db;
         $tables = array('mm_pokal', 'mm_medalj', 'mm_help_medlem_noshow');
         foreach ($tables as $table) {
             $sql = 'DELETE FROM ' . $table . ' WHERE medlem_id = "' . $this->getId() . '"';
             $db->nonquery($sql);
         }
         //mm_order, mm_prenumeration töms ej avsiktligen
         //ta bort medlemmen ur grupper (och grupper den skapat)
         $agrupp = Grupp::listByMedlem($this);
         foreach ($agrupp as $grupp) {
             if ($grupp->getSkapareId() == $this->getId()) {
                 $grupp->delete();
             }
             /* else
                $grupp->leaveGrupp($this); */
         }
         Grupp::flushMemberFromGroups($this);
         Stracka::deleteUserStrackor($this);
         $asteg = Steg::listByMedlem($this);
         foreach ($asteg as $steg) {
             $steg->delete();
         }
         FeedItem::deleteAllMedlemFeedItems($this);
         parent::delete();
     }
 }
Esempio n. 5
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER);
$mail_id = Security::escape($_POST['mail_id']);
$remover_id = Security::escape($_POST['remover_id']);
$remover = Security::escape($_POST['remover']);
if (isset($_POST['mails_to_remove'])) {
    $mails_to_remove = $_POST['mails_to_remove'];
    for ($i = 0; $i < $mails_to_remove; $i++) {
        $postvar = 'mail_id_' . $i;
        $mail_id = $_POST[$postvar];
        MotiomeraMail::removeMail($mail_id, $remover_id, $remover);
    }
} else {
    MotiomeraMail::removeMail($mail_id, $remover_id, $remover);
}
Esempio n. 6
0
    if (MedlemsBlockering::verifyBlocked($USER->getId(), $mid)) {
        echo 'blockerad_user';
        die;
        //throw new MedlemsBlockeringException("Kan ej skicka mail till medlemmen, medlemmen har spärrat dig.", 6);
    }
    if (MedlemsBlockering::verifyBlocked($mid, $USER->getId())) {
        echo 'blockerad_target';
        die;
        //throw new MedlemsBlockeringException("Kan ej skicka mail till medlemmen, du har spärrat medlemmen.", 5);
    }
    if ($send_to_Obj->getMotiomeraMailBlock() == 'true' && !$send_to_Obj->inAdressbok($USER)) {
        /** If user blocks mails from none friends */
        echo 'targetBlockMail';
        die;
    }
    if (!$send_to_Obj->synlig()) {
        echo 'blockedByProfile';
        die;
    }
    //åtkomst - ingen, foretag, adressbok (kom ihåg adminanvändare)
    new MotiomeraMail($amne, $msg, $sent_from, $send_to, $date, 0, 0, $allow_links);
    if (isset($_POST['rmid']) && !empty($_POST['rmid'])) {
        $reply_to = Security::escape($_POST['rmid']);
        $replyToMail = MotiomeraMail::loadById($reply_to);
        $replyToMail->setIsAnswered(1);
        $replyToMail->commit();
    }
    echo 'ok';
    //header("Location: /pages/mail.php?do=sent&mid=" . $send_to);
    //header("Location: /popup/pages/send_mail.php?do=sent&mid=" . $send_to);
}
Esempio n. 7
0
$smarty->assign("folders", $folders);
$folder_id = "0";
$myself = Medlem::loadById($USER->getId());
$my_contacts = $myself->getUsersThatHasMeAsContact(0);
$smarty->assign("my_contacts", $my_contacts);
if ($do == 'inbox') {
    $action = "inbox";
    if (isset($_GET['folder_id'])) {
        $folder_id = Security::escape($_GET['folder_id']);
    }
    $box_mails = MotiomeraMail::listMailInbox($USER->getId(), $folder_id);
    $smarty->assign("box_mails", $box_mails);
    $smarty->assign("is_inbox", true);
    $smarty->assign("to_include", "mail_box.tpl");
} else {
    if ($do == 'outbox') {
        $action = "outbox";
        $smarty->assign("is_inbox", false);
        $box_mails = MotiomeraMail::listMailOutbox($USER->getId());
        $smarty->assign("box_mails", $box_mails);
        $smarty->assign("to_include", "mail_box.tpl");
    } else {
        if ($do == 'manage_folders') {
            $action = "manage_folders";
            $smarty->assign("to_include", "mail_folders.tpl");
        }
    }
}
$smarty->assign("folder_id", $folder_id);
$smarty->assign("action", $action);
$smarty->display('mail.tpl');
Esempio n. 8
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER);
$id_to_remove = Security::escape($_POST['id_to_remove']);
MotiomeraMail::removeMail($id_to_remove);
/*
$send_to = Security::escape($_POST['mid']);
$amne = isset($_POST['amne']) ? Security::escape($_POST['amne']) : "";
$msg = isset($_POST['msg']) ? $_POST['msg'] : "";
$sent_from = $USER->getId();
$date = date("Y-m-d H:i:s");

$mm_mail = new MotiomeraMail($amne, $msg, $sent_from, $send_to, $date, 0, 0);

header("Location: /pages/mail.php?do=sent&mid=" . $send_to);
*/
Esempio n. 9
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER);
$folder_id = Security::escape($_GET['folder_id']);
$move_to = Security::escape($_GET['move_to']);
$nrofmails = Security::escape($_GET['nrofmails']);
if ($nrofmails > 0) {
    for ($i = 0; $i < $nrofmails; $i++) {
        $getvar = 'mail_id_' . $i;
        $mail_id = Security::escape($_GET[$getvar]);
        $motiomeraMail = MotiomeraMail::loadById($mail_id);
        $motiomeraMail->setToInFolder($move_to);
    }
}
header("Location: /pages/mail.php?do=inbox&folder_id=" . $folder_id);