/**
 * This function sends a mail to the handler whenever the product reaches the reorder level.
 * Param $product_id - product id
 * Param $upd_qty - updated product quantity in no's
 * Param $prod_name - product name
 * Param $qtyinstk - quantity in stock
 * Param $qty - quantity
 * Param $module - module name
 * return type void
 */
function sendPrdStckMail($product_id, $upd_qty, $prod_name, $qtyinstk, $qty, $module)
{
    global $log;
    $log->debug("Entering sendPrdStckMail(" . $product_id . "," . $upd_qty . "," . $prod_name . "," . $qtyinstk . "," . $qty . "," . $module . ") method ...");
    global $current_user;
    global $adb;
    $reorderlevel = getPrdReOrderLevel($product_id);
    $log->debug("Inside sendPrdStckMail function, module=" . $module);
    $log->debug("Prd reorder level " . $reorderlevel);
    if ($upd_qty < $reorderlevel) {
        //send mail to the handler
        $handler = getRecordOwnerId($product_id);
        foreach ($handler as $type => $id) {
            $handler = $id;
        }
        $handler_name = getOwnerName($handler);
        if (vtws_isRecordOwnerUser($handler)) {
            $to_address = getUserEmail($handler);
        } else {
            $to_address = implode(',', getDefaultAssigneeEmailIds($handler));
        }
        //Get the email details from database;
        if ($module == 'SalesOrder') {
            $notification_table = 'SalesOrderNotification';
            $quan_name = '{SOQUANTITY}';
        }
        if ($module == 'Quotes') {
            $notification_table = 'QuoteNotification';
            $quan_name = '{QUOTEQUANTITY}';
        }
        if ($module == 'Invoice') {
            $notification_table = 'InvoiceNotification';
        }
        $query = "select * from vtiger_inventorynotification where notificationname=?";
        $result = $adb->pquery($query, array($notification_table));
        $subject = $adb->query_result($result, 0, 'notificationsubject');
        $body = $adb->query_result($result, 0, 'notificationbody');
        $status = $adb->query_result($result, 0, 'status');
        if ($status == 0 || $status == '') {
            return false;
        }
        $subject = str_replace('{PRODUCTNAME}', $prod_name, $subject);
        $body = str_replace('{HANDLER}', $handler_name, $body);
        $body = str_replace('{PRODUCTNAME}', $prod_name, $body);
        if ($module == 'Invoice') {
            $body = str_replace('{CURRENTSTOCK}', $upd_qty, $body);
            $body = str_replace('{REORDERLEVELVALUE}', $reorderlevel, $body);
        } else {
            $body = str_replace('{CURRENTSTOCK}', $qtyinstk, $body);
            $body = str_replace($quan_name, $qty, $body);
        }
        $body = str_replace('{CURRENTUSER}', $current_user->user_name, $body);
        $mail_status = send_mail($module, $to_address, $current_user->user_name, $current_user->email1, decode_html($subject), nl2br(to_html($body)));
    }
    $log->debug("Exiting sendPrdStckMail method ...");
}
Exemple #2
0
 public static function isUserRegistered($userId, $moduleComponentId)
 {
     if (isInternalUserRegistered($userId, $moduleComponentId, false)) {
         return true;
     }
     $userEmail = getUserEmail($userId);
     if (isExternalUserRegistered($userEmail, $moduleComponentId)) {
         moveUserToInternal($userEmail, $userId);
         return true;
     }
     return false;
 }
Exemple #3
0
 public function index()
 {
     $myID = getUserID();
     $name = trim(jsonInput('name'));
     $description = jsonInput('description');
     $membersPost = jsonInput('members');
     $this->np_validations();
     $newProjID = $this->mdb->project_add($myID, $name, $description);
     if ($newProjID) {
         //add yourself in project members
         $this->mdb->project_member_add(array('project_id' => $newProjID, 'user_id' => $myID, 'email_address' => getUserEmail(), 'joined_by' => 0, 'date_joined' => today(), 'last_visit' => today(), 'is_accepted' => 1, 'project_role' => 3));
         $this->mdb->add_project_settings(array('project_id' => $newProjID, 'task_approval' => 0, 'project_approval' => 1));
         //add specified members to project
         if (is_array($membersPost)) {
             foreach ($membersPost as $member) {
                 if (filter_var($member, FILTER_VALIDATE_EMAIL)) {
                     $qChkifAlreadyMember = $this->mdb->checkIfAlreadyMember($newProjID, $member);
                     if (!$qChkifAlreadyMember) {
                         $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                         if ($qChkUser->num_rows()) {
                             $pmRow = $qChkUser->row();
                             $this->mdb->project_member_add(array('project_id' => $newProjID, 'user_id' => $pmRow->id, 'email_address' => $pmRow->email_address, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                             //notification
                             notify('project_invite', $pmRow->id, array('project_id' => $newProjID));
                             $qProj = $this->db->get_where('projects', array('id' => $newProjID));
                             if ($qProj->num_rows()) {
                                 $qProjRow = $qProj->row();
                                 $myName = $this->session->userdata('display_name');
                                 $redirectLink = base_url('#/app/projects/' . $newProjID);
                                 do_sendmail($pmRow->id, $qProjRow->project_name, "{$myName} invited you to join <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                             }
                         } else {
                             $this->mdb->project_member_add(array('project_id' => $newProjID, 'user_id' => 0, 'email_address' => $member, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                         }
                     }
                 }
             }
         }
         //add project roles
         foreach ($this->siteinfo->config('project_roles') as $roleID => $role) {
             $default = $this->siteinfo->config('project_roles_default') == $roleID ? 1 : 0;
             $this->mdb->project_roles_add($newProjID, $roleID, $default, $role);
         }
     }
     generate_json(array('status' => 1, 'message' => 'New project has been created.'));
 }
Exemple #4
0
 public function index()
 {
     $myID = getUserID();
     $myEmail = getUserEmail();
     $pID = (int) $this->input->get('id');
     $visitorType = visitor_type($pID, $myID);
     $query = $this->mdb->project_get($pID);
     if ($query->num_rows()) {
         $row = $query->row();
         switch ($visitorType) {
             case 'invited':
                 $this->mdb->project_member_remove($row->id, $myID);
                 break;
         }
         generate_json(array('status' => 1));
     } else {
         generate_json(array('status' => 0, 'message' => 'Project does not exists.'));
     }
 }
         echo " Gagal," . addslashes(mysql_error($conn));
     }
     break;
 case 'insert_persetujuan':
     $sql = "SELECT * FROM " . $dbname . ".`log_prapoht` WHERE `nopp`='" . $nopp . "' ";
     $query = mysql_query($sql) or die(mysql_error());
     $rest = mysql_fetch_assoc($query);
     if ($rest['close'] > 1) {
         echo "Warning: Status closed, Can't update the status";
         exit;
     } elseif ($rest['hasilpersetujuan1'] < 1) {
         $stat_cls = 1;
         $strx = "update " . $dbname . ". log_prapoht set persetujuan1='" . $user_id . "',close='" . $stat_cls . "'  where nopp='" . $nopp . "'";
         if (mysql_query($strx)) {
             #send an email to incharge person
             $to = getUserEmail($user_id);
             $namakaryawan = getNamaKaryawan($_SESSION['standard']['userid']);
             if ($_SESSION['language'] == 'EN') {
                 $subject = "[Notifikasi] PR Submission for approval, submitted by: " . $namakaryawan;
                 $body = "<html>\n\t\t\t\t\t\t\t <head>\n\t\t\t\t\t\t\t <body>\n\t\t\t\t\t\t\t   <dd>Dear Sir/Madam,</dd><br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   Today,  " . date('d-m-Y') . ",  on behalf of " . $namakaryawan . " submit a PR, requesting for your approval. To follow up, please follow the link below.\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   Regards,<br>\n\t\t\t\t\t\t\t   Owl-Plantation System.\n\t\t\t\t\t\t\t </body>\n\t\t\t\t\t\t\t </head>\n\t\t\t\t\t\t   </html>\n\t\t\t\t\t\t   ";
             } else {
                 $subject = "[Notifikasi]Persetujuan PP a/n " . $namakaryawan;
                 $body = "<html>\n\t\t\t\t\t\t\t <head>\n\t\t\t\t\t\t\t <body>\n\t\t\t\t\t\t\t   <dd>Dengan Hormat,</dd><br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   Pada hari ini, tanggal " . date('d-m-Y') . " karyawan a/n  " . $namakaryawan . " mengajukan Permintaan Pembelian Barang\n\t\t\t\t\t\t\t   kepada bapak/ibu. Untuk menindak-lanjuti, silahkan ikuti link dibawah.\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   <br>\n\t\t\t\t\t\t\t   Regards,<br>\n\t\t\t\t\t\t\t   Owl-Plantation System.\n\t\t\t\t\t\t\t </body>\n\t\t\t\t\t\t\t </head>\n\t\t\t\t\t\t   </html>\n\t\t\t\t\t\t   ";
             }
             $kirim = kirimEmail($to, '', $subject, $body);
             #this has return but disobeying;
         } else {
             echo " Gagal," . addslashes(mysql_error($conn));
         }
     } else {
         echo "Warning: Documents already in the process";
 public function getRecipientEmails()
 {
     $recipientsInfo = $this->scheduledRecipients;
     $recipientsList = array();
     if (!empty($recipientsInfo)) {
         if (!empty($recipientsInfo['users'])) {
             $recipientsList = array_merge($recipientsList, $recipientsInfo['users']);
         }
         if (!empty($recipientsInfo['roles'])) {
             foreach ($recipientsInfo['roles'] as $roleId) {
                 $roleUsers = getRoleUsers($roleId);
                 foreach ($roleUsers as $userId => $userName) {
                     array_push($recipientsList, $userId);
                 }
             }
         }
         if (!empty($recipientsInfo['rs'])) {
             foreach ($recipientsInfo['rs'] as $roleId) {
                 $users = getRoleAndSubordinateUsers($roleId);
                 foreach ($users as $userId => $userName) {
                     array_push($recipientsList, $userId);
                 }
             }
         }
         if (!empty($recipientsInfo['groups'])) {
             require_once 'include/utils/GetGroupUsers.php';
             foreach ($recipientsInfo['groups'] as $groupId) {
                 $userGroups = new GetGroupUsers();
                 $userGroups->getAllUsersInGroup($groupId);
                 $recipientsList = array_merge($recipientsList, $userGroups->group_users);
             }
         }
     }
     $recipientsEmails = array();
     if (!empty($recipientsList) && count($recipientsList) > 0) {
         foreach ($recipientsList as $userId) {
             $userName = getUserFullName($userId);
             $userEmail = getUserEmail($userId);
             if (!in_array($userEmail, $recipientsEmails)) {
                 $recipientsEmails[$userName] = $userEmail;
             }
         }
     }
     return $recipientsEmails;
 }
Exemple #7
0
function getProfileRegistrantsList($showEditButtons = false)
{
    global $urlRequestRoot, $cmsFolder, $moduleFolder, $templateFolder, $sourceFolder;
    require_once "{$sourceFolder}/{$moduleFolder}/form/viewregistrants.php";
    $sortField = 'useremail';
    $sortOrder = 'asc';
    if (isset($_GET['sortfield'])) {
        $sortField = escape($_GET['sortfield']);
    }
    if (isset($_GET['sortorder']) && ($_GET['sortorder'] == 'asc' || $_GET['sortorder'] == 'desc')) {
        $sortOrder = escape($_GET['sortorder']);
    }
    $action = './+admin&subaction=' . escape($_GET['subaction']);
    $columnList['useremail'] = 'User Email';
    $columnList['username'] = '******';
    $columnList['userfullname'] = 'User Full Name';
    $columnList['registrationdate'] = 'Registration Date';
    $columnList['lastupdated'] = 'Last Updated';
    $columnList = array_merge($columnList, getColumnList(0, false, false, false, false));
    $normalImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/view-refresh.png\" />";
    $orderedImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/go-" . ($sortOrder == 'asc' ? 'up' : 'down') . ".png\" />";
    $tableCaptions = "<tr>\n<th nowrap=\"nowrap\">S. No.</th>\n";
    if ($showEditButtons) {
        $tableCaptions .= '<th nowrap="nowrap">Edit</th><th nowrap="nowrap">Delete</th>';
    }
    foreach ($columnList as $columnName => $columnTitle) {
        $tableCaptions .= "<th nowrap=\"nowrap\">{$columnTitle}<a href=\"{$action}&sortfield={$columnName}";
        if ($sortField == $columnName) {
            $tableCaptions .= '&sortorder=' . ($sortOrder == 'asc' ? 'desc' : 'asc') . '">' . $orderedImage . '</a>';
        } else {
            $tableCaptions .= '">' . $normalImage . '</a>';
        }
        $tableCaptions .= "</th>\n";
        $columnNames[] = $columnName;
    }
    $tableCaptions .= "</tr>\n";
    $userIds = getDistinctRegistrants(0, $sortField, $sortOrder);
    $userCount = count($userIds);
    $editImage = "<img style=\"padding:0px\" src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/apps/accessories-text-editor.png\" alt=\"Edit\" />";
    $deleteImage = "<img style=\"padding:0px\" src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/edit-delete.png\" alt=\"Delete\" />";
    $tableBody = '';
    for ($i = 0; $i < $userCount; $i++) {
        $tableBody .= '<tr><td>' . ($i + 1) . '</td>';
        if ($showEditButtons) {
            $tableBody .= '<td align="center"><a href="./+admin&subaction=editsiteregistrants&subsubaction=editregistrant&useremail=' . getUserEmail($userIds[$i]) . '" />' . $editImage . '</a></td>';
            $tableBody .= '<td align="center"><a href="./+admin&subaction=editsiteregistrants&subsubaction=deleteregistrant&useremail=' . getUserEmail($userIds[$i]) . '" />' . $deleteImage . '</a></td>';
        }
        $tableBody .= '<td>' . join(generateFormDataRow(0, $userIds[$i], $columnNames), '</td><td>') . "</td></tr>\n";
    }
    return '<br /><br /><br /><table border="1">' . $tableCaptions . $tableBody . '</table>';
}
function sendMailUserTicketClose($mail_refno)
{
    global $conn;
    $sql = " Select * from sptbl_lookup where vLookUpName IN('MailFromName','MailFromMail',";
    $sql .= "'MailReplyName','MailReplyMail','Emailfooter','Emailheader','MailEscalation','HelpdeskTitle')";
    $result = executeSelect($sql, $conn);
    if (mysql_num_rows($result) > 0) {
        while ($row2 = mysql_fetch_array($result)) {
            switch ($row2["vLookUpName"]) {
                case "MailFromName":
                    $var_fromName = $row2["vLookUpValue"];
                    break;
                case "MailFromMail":
                    $var_fromMail = $row2["vLookUpValue"];
                    break;
                case "MailReplyName":
                    $var_replyName = $row2["vLookUpValue"];
                    break;
                case "MailReplyMail":
                    $var_replyMail = $row2["vLookUpValue"];
                    break;
                case "Emailfooter":
                    $var_emailfooter = $row2["vLookUpValue"];
                    break;
                case "Emailheader":
                    $var_emailheader = $row2["vLookUpValue"];
                    break;
                case "MailEscalation":
                    $var_emailescalation = $row2["vLookUpValue"];
                    break;
                case "HelpdeskTitle":
                    $var_helpdesktitle = $row2["vLookUpValue"];
                    break;
            }
        }
    }
    $sql = "Select u.nUserId, u.vUserName, u.vEmail, t.nTicketId   from sptbl_tickets t INNER JOIN sptbl_users u ON t.nUserId = u.nUserId WHERE t.vRefNo = '" . mysql_real_escape_string(trim($mail_refno)) . "' ORDER BY t.nTicketId  DESC LIMIT 1";
    $result_user = executeSelect($sql, $conn);
    if (mysql_num_rows($result_user) > 0) {
        $row_user = mysql_fetch_array($result_user);
        $toemail = $row_user['vEmail'];
        $var_body = $var_emailheader . "<br>" . TEXT_MAIL_START . "&nbsp; " . $row_user['vUserName'] . ",<br>";
        $var_body .= TEXT_CLOSED_BODY . " " . $mail_refno . TEXT_MAIL_BY . htmlentities($_SESSION['sess_staffname']) . "<br><br>";
        // $sql_reply    =   "SELECT nReplyId FROM sptbl_replies WHERE nTicketId='".$row_user['nTicketId']."'";
        $sql_reply = "SELECT vStaffLogin  FROM  sptbl_tickets WHERE nTicketId='" . $row_user['nTicketId'] . "' AND ( vStaffLogin  !='NULL' OR  \tvStaffLogin  !='' OR  \tvStaffLogin  !='0')";
        $res_reply = executeSelect($sql_reply, $conn);
        if (mysql_num_rows($res_reply) > 0) {
            $row_staff = mysql_fetch_array($res_reply);
            if ($row_staff['vStaffLogin'] != "") {
                $var_body .= TEXT_RATE_URL_MSG1 . "  <a href='" . SITE_URL . "rating.php?uid=" . $row_user['nUserId'] . "&ticket_id=" . $row_user['nTicketId'] . "'> " . TEXT_RATE_URL_MSG2 . " </a>  " . TEXT_RATE_URL_MSG3 . " <br><br>";
            }
        }
        $var_body .= TEXT_MAIL_THANK . "<br>" . htmlentities($var_helpdesktitle) . "<br>" . $var_emailfooter;
        $var_subject = TEXT_CLOSED_SUB . " " . $mail_refno;
        $Headers = "From: {$var_fromName} <{$var_fromMail}>\n";
        $Headers .= "Reply-To: {$var_replyName} <{$var_replyMail}>\n";
        $Headers .= "MIME-Version: 1.0\n";
        $Headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
        //  echo $var_body;exit;
        // it is for smtp mail sending
        $useremail = getUserEmail($row_user['nUserId']);
        //get user email
        if (!in_array($toemail, $useremail)) {
            $useremail[] = $toemail;
        }
        if (count($useremail) > 0) {
            foreach ($useremail as $key => $value) {
                $toemail_us = $value;
                if ($_SESSION["sess_smtpsettings"] == 1) {
                    $var_smtpserver = $_SESSION["sess_smtpserver"];
                    $var_port = $_SESSION["sess_smtpport"];
                    SMTPMail($var_fromMail, $toemail_us, $var_smtpserver, $var_port, $var_subject, $var_body);
                } else {
                    $mailstatus = @mail($toemail_us, $var_subject, $var_body, $Headers);
                }
            }
            //end of for loop user email
        }
        //end of if email count
    }
}
<div class="inner_conainer" >
  <?php 
include "trainer_dashboard_link.php";
?>
  <div class="dashboard_right fade_anim">
    <div class="dashbox_wrap">
      <div class="dashbox blue_bg">
        <div class="title"><img src="images/icon_profile_big.png" />profile
          <div class="clear"></div>
        </div>
        <p><strong>Name :</strong> <?php 
echo getUserName($conn, $registration_id);
?>
</p>
        <p><strong>Email :</strong> <?php 
echo getUserEmail($conn, $registration_id);
?>
</p>
        <p><strong>Mobile :</strong> <?php 
echo getUserMobile($conn, $registration_id);
?>
</p>
        <a class="more" href="trainer_profile.php"></a> </div>
      <div class="dashbox green_bg">
        <div class="title"><img src="images/icon_tranings_big.png" />Trainings Courses
          <div class="clear"></div>
        </div>
        <div class="posted_job">
          <?php 
while ($row = $result->fetch_assoc()) {
    ?>
function mailCoy($userid)
{
    #send an email to incharge person
    $to = getUserEmail($userid);
    $namakaryawan = getNamaKaryawan($_SESSION['standard']['userid']);
    if ($_SESSION['language'] == 'EN') {
        $subject = "[Notifikasi] PR Submission for approval, submitted by: " . $namakaryawan;
        $body = "<html>\r\n                             <head>\r\n                             <body>\r\n                               <dd>Dear Sir/Madam,</dd><br>\r\n                               <br>\r\n                               Today,  " . date('d-m-Y') . ",  on behalf of " . $namakaryawan . " submit a PR, requesting for your approval. To follow up, please follow the link below.\r\n                               <br>\r\n                               <br>\r\n                               <br>\r\n                               Regards,<br>\r\n                               Owl-Plantation System.\r\n                             </body>\r\n                             </head>\r\n                           </html>\r\n                           ";
    } else {
        $subject = "[Notifikasi]Persetujuan PP a/n " . $namakaryawan;
        $body = "<html>\r\n                             <head>\r\n                             <body>\r\n                               <dd>Dengan Hormat,</dd><br>\r\n                               <br>\r\n                               Pada hari ini, tanggal " . date('d-m-Y') . " karyawan a/n  " . $namakaryawan . " mengajukan Permintaan Pembelian Barang\r\n                               kepada bapak/ibu. Untuk menindak-lanjuti, silahkan ikuti link dibawah.\r\n                               <br>\r\n                               <br>\r\n                               <br>\r\n                               Regards,<br>\r\n                               Owl-Plantation System.\r\n                             </body>\r\n                             </head>\r\n                           </html>\r\n                           ";
    }
    $kirim = kirimEmail($to, '', $subject, $body);
    #this has return but disobeying;
}
Exemple #11
0
     $tab .= "<tr><td colspan=3 align=center><button class=mybutton onclick=saveAjukan()>" . $_SESSION['lang']['diajukan'] . "</button></td></tr></table>";
     $tab .= "</fieldset>";
     echo $tab;
     break;
 case 'appSetuju':
     $sKary = "select distinct status1 from " . $dbname . ".pta_ht where notransaksi='" . $notransaksi . "'";
     $qKary = mysql_query($sKary) or die(mysql_error($conn));
     $rKary = mysql_fetch_assoc($qKary);
     if ($rKary['status1'] == 0) {
         $sUpdate = "update " . $dbname . ".pta_ht set persetujuan1='" . $krywnId . "' \r\n             where status1='0' and notransaksi='" . $notransaksi . "'";
     }
     // exit($sUpdate." Error");
     if (!mysql_query($sUpdate)) {
         exit("DB:Error" . mysql_error($conn) . "__" . $sUpdate);
     } else {
         $to = getUserEmail($krywnId);
         $subject = "[Notifikasi] Persetujuan PTA ";
         $body = "<html>\r\n                            <head>\r\n                            <body>\r\n                            <dd>Dengan Hormat,</dd><br>\r\n                            <br>\r\n                             Pada hari ini karyawan A/n " . $_SESSION['empl']['name'] . " mengajukan persetujuan PTA \r\n                             No." . $notransaksi . " kepada bapak/ibu, untuk menindaklanjuti silahkan click link dibawah.\r\n                            <br>\r\n                            <br>\r\n                            <br>\r\n                            Regards,<br>\r\n                            Owl-Plantation System.\r\n                            </body>\r\n                            </head>\r\n                        </html>";
         $kirim = kirimEmail($to, '', $subject, $body);
         #this has return but disobeying;
     }
     break;
 case 'getKegiatan':
     $optKeg = "<option value=''>" . $_SESSION['lang']['pilihdata'] . "</option>";
     if ($_SESSION['language'] == 'EN') {
         $dd = 'namakegiatan1 as namakegiatan';
     } else {
         $dd = 'namakegiatan as namakegiatan';
     }
     $sKeg = "select distinct kodekegiatan," . $dd . " from " . $dbname . ".setup_kegiatan where noakun like '%" . $_POST['noakun'] . "%' order by kodekegiatan";
     $qKeg = mysql_query($sKeg) or die(mysql_error($conn));
function modifyDomainPerm($domainId, $userId, $admin)
{
    if (!$domainId || !$userId) {
        return FALSE;
    }
    if (!isDomainAdmin()) {
        return FALSE;
    }
    if ($userId == $_SESSION['user']['user_id']) {
        return FALSE;
    }
    if (!userIsActive($userId)) {
        return FALSE;
    }
    $user = getUserEmail($userId);
    if (!$user) {
        return FALSE;
    }
    $domain = getDomain($domainId);
    if (!$domain) {
        return FALSE;
    }
    $adminDomains = getAdminDomains();
    if (!in_array($domain, $adminDomains)) {
        return FALSE;
    }
    $params = array('user_id' => $userId, 'domain_id' => $domainId);
    if ($admin) {
        return db_insert('domain_administrators', $params, 'admin_id');
    } else {
        return db_delete('domain_administrators', $params);
    }
}
     $actionLogId = mysql_insert_id();
 }
 //send mail to user
 if ($var_ntuser == "ntuser") {
 }
 if ($var_cc != "" or $var_ntuser == "ntuser") {
     //Get department details for the ticket id here
     $sql = "Select t.vRefNo,t.vTitle,d.vDeptMail,u.vLogin,u.vEmail, u.nUserId as userid from sptbl_tickets t inner join\n\t\t\t\t\t\t\t\t\t\tsptbl_depts d on t.nDeptId=d.nDeptId inner join sptbl_users u on t.nUserId=u.nUserId\n\t\t\t\t\t\t\t\t\t\t  where  t.nTicketId='" . mysql_real_escape_string($var_tid) . "'";
     //End Get department details for the ticket id here
     //$sql="select vLogin,vEmail from sptbl_users where nUserId='$var_userid'";
     $result = executeSelect($sql, $conn);
     $row = mysql_fetch_array($result);
     $var_email = $row['vEmail'];
     $var_ulogin = $row['vLogin'];
     $user_id = $row['userid'];
     $useremail = getUserEmail($user_id);
     if (!in_array($var_email, $useremail)) {
         $useremail[] = $var_email;
     }
     if (count($useremail) > 0) {
         foreach ($useremail as $key => $value) {
             $var_email = $value;
             //Send replay mail to user ******************
             $var_mail_body = $var_emailheader . "<br>" . TEXT_MAIL_START . "&nbsp;" . htmlentities($var_ulogin) . ",<br>";
             $var_mail_body .= TEXT_MAIL_BODY . ":" . $var_refno . "<br><br>";
             $var_mail_body .= nl2br($var_replymatter) . "<br>" . $var_emailfooter;
             $var_subject = "Re:" . $row["vTitle"] . "  Id#[" . $row["vRefNo"] . "]";
             $var_body = $var_mail_body;
             //$Headers="From: " . $row["vDeptMail"] . "\n";
             //$Headers .="Reply-To: " . $row["vDeptMail"] . "\n";
             $arr_header = array("Reply-To: " . $row["vDeptMail"]);
                $wktu = date("Y-m-d H:i:s");
                $sUp .= ",persetujuan1='" . $atasan . "',waktupengajuan='" . $wktu . "'";
            }
            $sUp .= " where " . $where . "";
            if (mysql_query($sUp)) {
                if ($atsSblm != $atasan) {
                    #send an email to incharge person
                    $to = getUserEmail($atasan);
                    $namakaryawan = getNamaKaryawan($_SESSION['standard']['userid']);
                    $subject = "[Notifikasi]Persetujuan Ijin Keluar Kantor a/n " . $namakaryawan;
                    $body = "<html>\r\n                                                     <head>\r\n                                                     <body>\r\n                                                       <dd>Dengan Hormat,</dd><br>\r\n                                                       <br>\r\n                                                       Pada hari ini, tanggal " . date('d-m-Y') . " karyawan a/n  " . $namakaryawan . " mengajukan Ijin/" . $jnsIjin . " (" . $keperluan . ")\r\n                                                       kepada bapak/ibu. Untuk menindak-lanjuti, silahkan ikuti link dibawah.\r\n                                                       <br>\r\n                                                       <br>\r\n                                                       Note: Sisa cuti ybs periode " . $periodec . ":" . $sisa . " Hari\r\n                                                       <br>\r\n                                                       <br>\r\n                                                       Regards,<br>\r\n                                                       Owl-Plantation System.\r\n                                                     </body>\r\n                                                     </head>\r\n                                                   </html>\r\n                                                   ";
                    $kirim = kirimEmail($to, '', $subject, $body);
                    #this has return but disobeying;
                }
            }
            //mysql_query($sUp) or die(mysql_error());
        } else {
            exit("Error:Sudah ada keputusan");
        }
        if ($atsSblm != $atasan) {
            $to = getUserEmail($atsSblm);
            $namakaryawan = getNamaKaryawan($_SESSION['standard']['userid']);
            $subject = "[Notifikasi]Pembatalan Persetujuan Ijin Keluar Kantor a/n " . $namakaryawan;
            $body = "<html>\r\n                                                     <head>\r\n                                                     <body>\r\n                                                       <dd>Dengan Hormat,</dd><br>\r\n                                                       <br>\r\n                                                       Pada hari ini, tanggal " . date('d-m-Y') . " karyawan a/n  " . $namakaryawan . " mengajukan Ijin/" . $jnsIjin . " (" . $keperluan . ")\r\n                                                       kepada bapak/ibu. Untuk menindak-lanjuti, silahkan ikuti link dibawah.\r\n                                                       <br>\r\n                                                       <br>\r\n                                                       Note: Sisa cuti ybs periode " . $periodec . ":" . $sisa . " Hari\r\n                                                       <br>\r\n                                                       <br>\r\n                                                       Regards,<br>\r\n                                                       Owl-Plantation System.\r\n                                                     </body>\r\n                                                     </head>\r\n                                                   </html>\r\n                                                   ";
            $kirim = kirimEmail($to, '', $subject, $body);
            #this has return but disobeying;
        }
        break;
    default:
        break;
}
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail)
{
    global $database, $service, $hostURL, $serviceURL;
    if (empty($blogid)) {
        $blogid = POD::queryCell("SELECT max(blogid)\n\t\t\tFROM {$database['prefix']}BlogSettings");
        // If no blogid, get the latest created blogid.
    }
    $email = getUserEmail($userid);
    $password = POD::queryCell("SELECT password\n\t\tFROM {$database['prefix']}Users\n\t\tWHERE userid = " . $userid);
    $authtoken = getAuthToken($userid);
    $blogName = getBlogName($blogid);
    if (empty($email)) {
        return 1;
    }
    if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
        return 2;
    }
    if (empty($name)) {
        $name = User::getName($userid);
    }
    if (strcmp($email, UTF8::lessenAsEncoding($email, 64)) != 0) {
        return 11;
    }
    //$loginid = POD::escapeString(UTF8::lessenAsEncoding($email, 64));
    $name = POD::escapeString(UTF8::lessenAsEncoding($name, 32));
    //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n";
    if (empty($name)) {
        $subject = _textf('귀하를 %1님이 초대합니다', $senderName);
    } else {
        $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName);
    }
    $message = file_get_contents(ROOT . "/resources/style/letter/letter.html");
    $message = str_replace('[##_title_##]', _text('초대장'), $message);
    $message = str_replace('[##_content_##]', $comment, $message);
    $message = str_replace('[##_images_##]', $serviceURL . "/resources/style/letter", $message);
    $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message);
    $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message);
    $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message);
    if (empty($name)) {
        $message = str_replace('[##_to_##]', '', $message);
    } else {
        $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message);
    }
    $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message);
    $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message);
    if ($ret !== true) {
        return array(14, $ret[1]);
    }
    return true;
}
Exemple #16
0
/**
 * Performs the actual openid login once the authentication has been confirmed
 * from the Provider.
 * Basically deals with four cases:
 * 1. The user has used this OpenID before:
 *       This means that this OpenID entry is there in the _openid_users table
 *       and thus the user has previously used this OpenID before.
 *       In such case, the authentication is done and the user logs in.
 * 2. When the OpenID provider didn't returned the user's email address:
 *       We currently do not support such OpenID provider, and thus an
 *       error message is recieved by the user.
 * 3. When OpenID provider returns an Email which is already there in our records:
 *       This means that the user of this OpenID is already being registered also
 *       as a normal Pragyan User (or other OpenID user). The main thing is that 
 *       the there is an entry for this particular EmailID in _users table.
 *       When this happens, user is asked to give the password of the pre-existing
 *       account at the PragyanCMS so that it can be linked to this OpenID
 * @todo Check what happen if the entry in _users is because of another OpenID entry
 *       and not because of a Pragyan user. I suspect that the code will still ask 
 *       for the password (which it shouldn't). The code shouldn't check Pre-existing
 *       email ID for those entries which have login_method as openid.
 * 4. When OpenID proovider returns an Email which is not there in our records:
 *       In this case, the system demands the user to give their full name and thus
 *       it registers themselves as a dummy openid user in _users (with login_method
 *       = openid) and create entries in _openid_users too. After this, the user
 *       can start using his account.
 *
 * @param $userdata user information returned by the OpenID provider. Can be fetched
 *        by the ->filteruserinfo() function in DopeOpenID class
 */
function openid_login($userdata)
{
    $userdata['openid_url'] = escape($_GET['openid_identity']);
    /// Build a query to check if the OpenID already exits in openid_users table
    $query = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "openid_users` WHERE `openid_url` = '" . $userdata['openid_url'] . "';";
    $result = mysql_query($query) or die(mysql_error() . " in openid_login() inside login.lib.php while executing query for openid_row");
    $openid_row = mysql_fetch_array($result);
    if ($openid_row) {
        ///the record exists, this user has already used his OpenID before
        //print_r($row);
        ///Fetch the user_id that corresponds to user_id in the _users table
        $userid = $openid_row['user_id'];
        ///the OpenID provider did sent us the email of the user. Check if it exists in our database and is activated
        $userdetails = getUserInfo(getUserEmail($userid));
        if (!$userdetails) {
            displayerror("Your openid registration is corrupted. Please contact site administrator.");
            return;
        }
        /// ASSUMPTION : the `user_activated' column in _users table is 1 if and only if his email is verified.
        if ($userdetails && $userdetails['user_activated'] == 0) {
            displayerror("Your account is not activated. Please verify your account using the email sent to you during registration or contact site administrator.");
            return;
        }
        ///Assign the value to $_SESSION['last_to_last_login_datetime']
        $query = "SELECT `user_lastlogin` FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id`='" . $openid_row['user_id'] . "';";
        $result = mysql_query($query) or die(mysql_error() . " in openid_login() inside login.lib.php while trying to fetch last login");
        $last_login_row = mysql_fetch_array($result);
        $_SESSION['last_to_last_login_datetime'] = $last_login_row['user_lastlogin'];
        ///update the last login
        $query = "UPDATE `" . MYSQL_DATABASE_PREFIX . "users` SET `user_lastlogin`=NOW() WHERE `" . MYSQL_DATABASE_PREFIX . "users`.`user_id` ='" . $openid_row['user_id'] . "';";
        mysql_query($query) or die(mysql_error() . " in openid_login() inside login.lib.php while trying to update the last login");
        ///logging in the user
        setAuth($openid_row['user_id']);
        return $openid_row['user_id'];
    } else {
        /**This user is first time using the OpenID
         * display a small form to input User's Details
         * System should now check if the email ID is provided by the openID provider is already there in Our records.
         * If yes, the current account should be linked up to the account in the database after accepting the password.
         * Else, User should provide few details about him/her like Full name, and Email. Now after he provides the email,
         * The System again has to check if the email is under records and if it is, ask the password from user to link
         * it else, just make a new user in table _users
         */
        //Save the OpenID url first in Session
        $_SESSION['openid_url'] = $userdata['openid_url'];
        $_SESSION['openid_email'] = $userdata['email'];
        if (array_key_exists('email', $userdata)) {
            ///the OpenID provider did sent us the email of the user. Check if it exists in our database and is activated
            $userdetails = getUserInfo($userdata['email']);
            $userid = $userdetails['user_id'];
            /// ASSUMPTION : the `user_activated' column in _users table is 1 if and only if his email is verified.
            if ($userdetails && $userdetails['user_activated'] == 0) {
                displayerror("Your account is not activated. Please verify your account using the email sent to you during registration or contact site administrator.");
                return;
            }
            if ($userdetails && $userdetails['user_activated'] && $userdetails['user_loginmethod'] != 'openid') {
                ///if the Email was found in the records
                ///Display a Form to capture the Password and connect it
                $username = getUserName($userid);
                displayinfo("<ul><li>An account with your Email was found in our record already. This mean you are already registered as a user.</li>" . "<li>You just need to provide your password of your existing account to link your OpenID with.</li>" . "<li> This is a one time step after which you can use your OpenID account to Login.</li></ul>");
                $cmstitle = CMS_TITLE;
                $openid_pass_form = <<<OPENIDPASS
\t\t
\t<form method="POST" class="registrationform" name="openid_pass"  action="./home/+login&subaction=openid_pass">
\t\t<fieldset>
\t\t <legend>Password for the existing account </legend>
\t\t\t\t\t    Please Enter the Password of the pre-existing account on {$cmstitle}
\t\t<input type="hidden" name="email" value="{$userdata['email']}" />\t\t\t\t\t\t\t\t\t\t\t\t\t\t      
        <table>

<tr><td>Username</td>

<td>{$username}</td></tr>

<tr><td>Email</td>
<td>{$userdata['email']}</td></tr>
 <tr><td><label for="user_password" class="labelrequired">Password</label></td>
\t\t\t\t      <td><input type="password" name="user_password"  id="user_password"  class="required" /><br /></td>
\t\t\t\t      </tr>
\t\t\t\t      <tr>
\t\t\t\t      <td><input type="submit" value="Submit" /></td>
\t\t\t\t      
                                                                            </tr>
                                                                            </table>
                                                                            </fieldset>
                                                                            </form>
OPENIDPASS;
                return $openid_pass_form;
            } else {
                /**
                 * User have not used this OpenID before. The EmailID returned wasn't found in our records. Hence
                 * now we will have to get the full name of the user and then create a dummy user in _users table
                 * with the login_method as `openid'. Then we also have to make entries in the _openid_users table
                 * and add the user there appropriately.
                 */
                displayinfo("Seems like you are using this OpenID for the first time. We just need your full name to continue.");
                $openid_detail_form = <<<OPENIDFORM
\t<form method="POST" class="registrationform" name="quick_openid_reg"  action="./home/+login&subaction=quick_openid_reg">
\t<fieldset>
\t<legend>Just give us your Full name</legend>
\t<table>
\t<tr>
\t<td><label for="user_email"  class="labelrequired">Email</label></td>
        <td><input type="text" name="user_email" value="{$userdata['email']}"  id="user_email" class="required" readonly="true" onchange="if(this.length!=0) return checkEmail(this);"/><br /></td>
        </tr>

\t<tr>
\t<td><label for="user_name">Full Name</label></td>
        <td><input type="text" name="user_name" value="{$userdata['fullname']}"  id="user_name" class="required"/><br /></td>
        </tr>

        <tr>
        <td><input type="submit" value="Submit" /></td>
        
        </tr>
    
        </table>
        </fieldset>
        </form>
OPENIDFORM;
                return $openid_detail_form;
            }
        } else {
            /**
               The OpenID provider didn't sent us the Email. Tell the user that he can't authenticate using such providers
            */
            displayerror("The OpenID provider didn't return your Email Address. Please configure your Provider to provide your Email address");
            return;
        }
    }
}
Exemple #17
0
<?php

session_start();
include_once "events.php";
include_once "users.php";
include_once "templates/nav.php";
$logged = isset($_SESSION['username']);
$id = isset($_GET['id']) ? $_GET['id'] : "";
$event = getEvent($id);
$registered = getRegistered($id);
$from_email = getUserEmail($_SESSION['username'])[0];
$comments = getComments($id);
$url = 'http' . (empty($_SERVER['HTTPS']) ? '' : 's') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
include_once "templates/show_event.php";
?>

<!-- Comment form and Share form-->
<?php 
if ($logged && (isRegisteredInEvent($id, $_SESSION['username']) || $_SESSION['username'] == $event['creator'])) {
    ?>
    <form action="action_comment.php" method="post">
        <input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
        <input type="hidden" name="event" value="<?php 
    echo $id;
    ?>
">
        <input type="hidden" name="author" value="<?php 
    echo $_SESSION['username'];
        $notrx = substr($bar->notransaksi, 10, 5);
    }
    $notrx = intval($notrx);
    $notrx = $notrx + 1;
    $notrx = str_pad($notrx, 5, "0", STR_PAD_LEFT);
    $notrx = $potSK . $notrx;
    $str = "insert into " . $dbname . ".sdm_pjdinasht (\r\n\t\t  `notransaksi`,`karyawanid`,`tanggalbuat`,\r\n\t\t  `tanggalperjalanan`,`kodeorg`,`tujuan1`,\r\n\t\t  `tugas1`,`tujuan2`,`tugas2`,`tujuan3`,\r\n\t\t  `tugas3`,`tugaslain`,`tujuanlain`,\r\n\t\t  `pesawat`,`darat`,`laut`,\r\n\t\t  `mess`,`hotel`,`tanggalkembali`,`uangmuka`,\r\n\t\t  `hrd`,`persetujuan`,`statuspersetujuan`\r\n\t\t  ) values(\r\n\t\t\t\t'" . $notrx . "'," . $karyawanid . "," . date('Ymd') . ",\r\n\t\t\t\t" . $tanggalperjalanan . ",'" . $kodeorg . "','" . $tujuan1 . "',\r\n\t\t\t\t'" . $tugas1 . "','" . $tujuan2 . "','" . $tugas2 . "','" . $tujuan3 . "',\r\n\t\t\t\t'" . $tugas3 . "','" . $tugaslain . "','" . $tujuanlain . "',\r\n\t\t\t\t" . $pesawat . "," . $darat . "," . $laut . ",\r\n\t\t\t\t" . $mess . "," . $hotel . "," . $tanggalkembali . "," . $uangmuka . ",\r\n\t\t\t\t" . $hrd . "," . $persetujuan . ",'1' \r\n\t\t  )";
    //echo $str;
} else {
    if ($method == 'delete') {
        $notransaksi = $_POST['notransaksi'];
        $str = "delete from " . $dbname . ".sdm_pjdinasht\r\n\t      where karyawanid=" . $karyawanid . " and notransaksi='" . $notransaksi . "'";
    } else {
        if ($method == 'update') {
            $notransaksi = $_POST['notransaksi'];
            $str = "update " . $dbname . ".sdm_pjdinasht set\r\n\t\t  `tanggalperjalanan`=" . $tanggalperjalanan . ",\r\n\t\t  `kodeorg`='" . $kodeorg . "',\r\n\t\t  `tujuan1`='" . $tujuan1 . "',\r\n\t\t  `tugas1`='" . $tugas1 . "',\r\n\t\t  `tujuan2`='" . $tujuan2 . "',\r\n\t\t  `tugas2`='" . $tugas2 . "',\r\n\t\t  `tujuan3`='" . $tujuan3 . "',\r\n\t\t  `tugas3`='" . $tugas3 . "',\r\n\t\t  `tugaslain`='" . $tugaslain . "',\r\n\t\t  `tujuanlain`='" . $tujuanlain . "',\r\n\t\t  `pesawat`=" . $pesawat . ",\r\n\t\t  `darat`=" . $darat . ",\r\n\t\t  `laut`=" . $laut . ",\r\n\t\t  `mess`=" . $mess . ",\r\n\t\t  `hotel`=" . $hotel . ",\r\n\t\t  `tanggalkembali`=" . $tanggalkembali . ",\r\n\t\t  `uangmuka`=" . $uangmuka . ",\r\n\t\t  `hrd`=" . $hrd . ",\r\n\t\t  `persetujuan`=" . $persetujuan . "\r\n\t\twhere karyawanid=" . $karyawanid . " and notransaksi='" . $notransaksi . "'";
        }
    }
}
if (mysql_query($str)) {
    if ($method == 'update' or $method == 'insert') {
        $to = getUserEmail($hrd);
        $namakaryawan = getNamaKaryawan($_SESSION['standard']['userid']);
        $subject = "[Notifikasi]Persetujuan Perjalanan Dinas a/n " . $namakaryawan;
        $body = "<html>\r\n                 <head>\r\n                 <body>\r\n                   <dd>Dengan Hormat,</dd><br>\r\n                   <br>\r\n                   Pada hari ini, tanggal " . date('d-m-Y') . " karyawan a/n  " . $namakaryawan . " mengajukan surat perjalanan dinas\r\n                   kepada bapak/ibu. Untuk menindak-lanjuti, silahkan ikuti link dibawah.\r\n                   <br>\r\n                   <br>\r\n                   <br>\r\n                   Regards,<br>\r\n                   Owl-Plantation System.\r\n                 </body>\r\n                 </head>\r\n               </html>\r\n               ";
        $kirim = kirimEmail($to, '', $subject, $body);
        #this has return but disobeying;
    }
} else {
    echo " Gagal:" . addslashes(mysql_error($conn));
}
Exemple #19
0
<?php

try {
    require $_SERVER['DOCUMENT_ROOT'] . '/model/connect.php';
    require $_SERVER['DOCUMENT_ROOT'] . '/controller/functions.php';
} catch (EXCEPTION $ex) {
    echo 'error files not found';
}
if (isset($_POST['submit'])) {
    //grab all of the Users data thats been input in the login form, and put it in a variable
    $userName = $_POST['userName'];
    $password = $_POST['password'];
    //Grab Email
    $login = login($userName, $password);
    $email = getUserEmail($userName, $password);
    //compare permissions
    if ($login == true) {
        //yay
        //Put User's Email in the url and Redirect them to the Users login home page.
        $user = comparePermission($userName);
        $permission = $user['permission'];
        //if admin
        if ($permission == 'admin') {
            Header('Location: /view/admin/index.php?action=home');
        } else {
            //if user
            Header("Location: /view/client.php?email=" . $email);
        }
    } else {
        if ($login == false) {
            //nay
     //exit("Error:".$tglAkhir."___".$jmAkhir);
     list($h, $m, $s) = explode(":", $jmAkhir);
     list($thn, $mth, $dy) = explode("-", $tglAkhir);
     $dtAkhir = mktime($h, $m, $s, intval($mth), $dy, $thn);
     $dtSelisih = $dtAkhir - $dtAwal;
     //exit("Error:".$dtSelisih."___".$dtAkhir."___".$dtAwal."___".$mth."__".$dy."__".$thn);
     $totalmenit = $dtSelisih / 60;
     $jam = explode(".", $totalmenit / 60);
     $sisamenit = $totalmenit / 60 - $jam[0];
     $sisamenit2 = $sisamenit * 60;
     $jml_jam = $jam[0];
     //end ambil selisih waktu
     $sUpdate = "update " . $dbname . ".it_request set jumlah='" . $jml_jam . "',waktuselesai='" . $tlgjmskrng . "',saranpelaksana='" . $saran . "'\r\n                          where notransaksi='" . $notransaksi . "'";
     if (mysql_query($sUpdate)) {
         #send an email to incharge person
         $to = getUserEmail($rGet['karyawanid']);
         $namakaryawan = getNamaKaryawan($rGet['karyawanid']);
         $subject = "[Notifikasi]Permintaan layanan " . $rGet['keterangan'] . " a/n " . $namakaryawan;
         $body = "<html>\r\n                             <head>\r\n                             <body>\r\n                               <dd>Dengan Hormat,</dd><br>\r\n                               <p align=justify>\r\n                               Permintaan layanan " . $rGet['keterangan'] . " pada tanggal " . tanggalnormal($rGet['tanggal']) . " oleh saudara ke departemen IT\r\n                               dengan deskripsi " . $rGet['deskripsi'] . ".\r\n                               <br>\r\n                               <br>\r\n                               Telah selesai dilaksanakan pada tanggal " . tanggalnormald($tlgjmskrng) . ", mohon kesediaan saudara untuk memberi penilaian terhadap layanan kami dari menuIT->Permintaan Layanan\r\n                               <br>\r\n                               <br>\r\n                               Regards,<br>\r\n                               Owl-Plantation System.\r\n                             </body>\r\n                             </head>\r\n                           </html>\r\n                           ";
         $kirim = kirimEmail($to, '', $subject, $body);
         #this has return but disobeying;
     }
     break;
 case 'getDetail':
     $sData = "select distinct * from " . $dbname . ".it_request where notransaksi='" . $notransaksi . "' ";
     $qData = mysql_query($sData) or die(mysql_error($conn));
     $rData = mysql_fetch_assoc($qData);
     $dataTab .= "<div style=overflow:auto;width:420px;height:880px;>";
     $dataTab .= "<fieldset><legend>" . $_SESSION['lang']['desc'] . "</legend>";
     $dataTab .= "<div align=justify>" . $rData['deskripsi'] . "</p>";
     $dataTab .= "</fieldset><br />";
Exemple #21
0
}
if ($_REQUEST['assigntype'] == 'U') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif ($_REQUEST['assigntype'] == 'T') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save($currentModule);
$return_id = $focus->id;
$search = vtlib_purify($_REQUEST['search_url']);
if ($_REQUEST['return_id'] != '') {
    $return_id = vtlib_purify($_REQUEST['return_id']);
}
//Checking and Sending Mail from reorder level
global $current_user;
$productname = $focus->column_fields['productname'];
$qty_stk = $focus->column_fields['qtyinstock'];
$reord = $focus->column_fields['reorderlevel'];
$handler = $focus->column_fields['assigned_user_id'];
if ($qty_stk != '' && $reord != '') {
    if ($qty_stk < $reord) {
        $handler_name = getUserName($handler);
        $sender_name = getUserName($current_user->id);
        $to_address = getUserEmail($handler);
        $subject = $productname . ' ' . $mod_strings['MSG_STOCK_LEVEL'];
        $body = $mod_strings['MSG_DEAR'] . ' ' . $handler_name . ',<br><br>' . $mod_strings['MSG_CURRENT_STOCK'] . ' ' . $productname . ' ' . $mod_strings['MSG_IN_OUR_WAREHOUSE'] . ' ' . $qty_stk . '. ' . $mod_strings['MSG_PROCURE_REQUIRED_NUMBER'] . ' ' . $reord . '.<br> ' . $mod_strings['MSG_SEVERITY'] . '<br><br> ' . $mod_strings['MSG_THANKS'] . '<br> ' . $sender_name;
        include "modules/Emails/mail.php";
        $mail_status = send_mail("Products", $to_address, $current_user->user_name, $current_user->email1, $subject, $body);
    }
}
$parenttab = getParentTab();
header("Location: index.php?action={$return_action}&module={$return_module}&record={$return_id}&parenttab={$parenttab}&start=" . vtlib_purify($_REQUEST['pagenumber']) . $search);
 $result = executeSelect($sql, $conn);
 if (mysql_num_rows($result) > 0) {
     $row = mysql_fetch_array($result);
     $var_body = $var_emailheader . "<br>" . TEXT_MAIL_START . ",<br>&nbsp;<br>";
     $var_body .= TEXT_TICKET_CREATION_BODY1 . " ( " . htmlentities($title) . " ) ";
     $var_body .= TEXT_TICKET_CREATION_BODY2 . date("m-d-Y H:i");
     $var_body .= TEXT_TICKET_CREATION_BODY3 . " [" . $var_refno . "].<br><br>";
     $var_body .= "<a href=\"" . $var_loginurl . "?mt=y&email=" . urlencode($var_email) . "&ref=" . $var_refno . "&\">" . TEXT_CLICK_HERE . "</a> " . TEXT_VIEW_TICKET_STATUS . "<BR><BR>";
     $var_body .= TEXT_MAIL_THANK . "<br>" . htmlentities($var_helpdesktitle) . "<br>" . $var_emailfooter;
     $var_subject = TEXT_TICKET_CREATION_SUBJECT . $var_helpdesktitle . "  Id#[" . $var_refno . "]";
     $Headers = "From: " . $row["vDeptMail"] . "\n";
     $Headers .= "Reply-To: " . $row["vDeptMail"] . "\n";
     $Headers .= "MIME-Version: 1.0\n";
     $Headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
     //*************Send mail user on ticket
     $useremail = getUserEmail($var_userid);
     if (!in_array($var_email, $useremail)) {
         $useremail[] = $var_email;
     }
     if (count($useremail) > 0) {
         foreach ($useremail as $key => $value) {
             $var_email = $value;
             // it is for smtp mail sending
             if ($_SESSION["sess_smtpsettings"] == 1) {
                 $var_smtpserver = $_SESSION["sess_smtpserver"];
                 $var_port = $_SESSION["sess_smtpport"];
                 SMTPMail($var_fromMail, $var_email, $var_smtpserver, $var_port, $var_subject, $var_body);
             } else {
                 $mailstatus = @mail($var_email, $var_subject, $var_body, $Headers);
             }
             //*************Send mail user on ticket ends
Exemple #23
0
<?php

require_once 'master_validation.php';
require_once 'config/connection.php';
require_once 'lib/nangkoelib.php';
require_once 'lib/admin_validation.php';
$uname = $_POST['uname'];
$sendmail = $_POST['sendmail'];
$pw = $_POST['pw'];
$userid = $_POST['userid'];
$active = $_POST['active'];
//Has the password
if ($sendmail == 1) {
    $email = getUserEmail($uname, $userid, $conn);
} else {
    $email = '';
}
if ($active == 1) {
    $ac_comment = 'Active';
} else {
    $ac_comment = 'Inactive';
}
$str = "insert into " . $dbname . ".user (namauser,password,karyawanid,lastuser,status)\r\n\t      values('" . $uname . "',MD5('" . $pw . "')," . $userid . ",'" . $_SESSION['standard']['username'] . "'," . $active . ")";
if (mysql_query($str)) {
    echo "*Account " . $uname . " has been created.<br>";
    //if email is available then send an email to user
    if ($email != '') {
        $subject = 'Your User Account has been created';
        $content = "Dear " . $uname . ",<br><br>\r\n\t\t\t          <dd>Your Account has been created as follow:\r\n\t\t\t\t\t  <table>\r\n\t\t\t\t\t  <tr><td><i>UserName</i></td><td>:" . $uname . "</td></tr>\r\n\t\t\t\t\t  <tr><td><i>Password</i></td><td>:" . $pw . "</td></tr>\r\n\t\t\t\t\t  <tr><td><i>UserId(Empl.ID)</i></td><td>:" . $userid . "</td></tr>\r\n\t\t\t\t\t  <tr><td><i>AccountStatus</i></td><td>:" . $ac_comment . "</td></tr>\r\n\t\t\t\t\t  </table><br>\r\n\t\t\t\t\t  Please maintain your password periodically.\r\n\t\t\t\t\t  <br>\r\n\t\t\t\t\t  Regards,\r\n\t\t\t\t\t  System, at " . date('d-m-YYY H:i:s');
        $from = 'administrator@' . $_SERVER['HOST'] . '.local';
        $to = $email;
Exemple #24
0
/**
 * Returns a form which displays the list of files uploaded in that page and if the user has sufficient permissions option to delete files.  
 * @param $moduleComponentId page_modulecomponentid.
 * @param $moduleName The module which is calling this function.
 * @param $deleteFormAction The page or action that must be taken on clicking the delete option in the final form,
 * @return A variable that has the required form.
 *
 */
function getUploadedFilePreviewDeleteForm($moduleComponentId, $moduleName, $deleteFormAction = './+edit')
{
    global $uploadedFormNumber;
    if (!isset($uploadedFormNumber)) {
        $uploadedFormNumber = 1;
    }
    $uploadedFormNumber += 1;
    if (isset($_POST['file_deleted']) && $_POST['file_deleted'] == "form_{$uploadedFormNumber}") {
        if (isset($_GET['deletefile'])) {
            if (deleteFile($moduleComponentId, $moduleName, escape($_GET['deletefile']))) {
                displayinfo("The file " . escape($_GET['deletefile']) . " has been removed");
            } else {
                displayinfo("Unable to remove the file.");
            }
        }
    }
    $uploadedFiles = getUploadedFiles($moduleComponentId, $moduleName);
    $uploadedFilesString = "";
    foreach ($uploadedFiles as $file) {
        $uploadedUserEmail = getUserEmail($file['user_id']);
        $uploadedUserName = getUserFullName($file['user_id']);
        $fileDelete = addslashes($file['upload_filename']);
        $uploadedFilesString .= <<<UPLOADEDFILESSTRING
\t\t<tr>
\t\t\t<td><a href="./{$file['upload_filename']}"   onMouseOver="javascript:showPath('{$fileDelete}')"  target="previewIframe_{$uploadedFormNumber}">{$file['upload_filename']}</a></td>
\t\t\t<td>{$uploadedUserName}</td>
\t\t\t<td>{$uploadedUserEmail}</td>
\t\t\t<td>{$file['upload_time']}</td>
\t\t\t<td><input type='submit' value='Delete'  onclick="return checkDeleteUpload(this, '{$fileDelete}');"></td>
\t\t</tr>
UPLOADEDFILESSTRING;
    }
    global $urlRequestRoot;
    global $cmsFolder;
    global $STARTSCRIPTS;
    if (count($uploadedFiles) > 0) {
        $smarttablestuff = smarttable::render(array('filestable'), null);
        $STARTSCRIPTS .= "initSmartTable();";
        $uploadedFilesString = <<<UPLOADEDFILESSTRING
\t<form action="{$deleteFormAction}" method="POST" name="deleteFile">
\t\t<script language="javascript">
\t    \tfunction showPath(fileName) {
\t    \t\tpath = document.location.pathname;
\t\t\t\tpath = path.split('+');
\t\t\t\tpath = path[0].split('&');
\t\t\t\tdocument.getElementById("preview_uploadedfile_{$uploadedFormNumber}").setAttribute('value',path[0]+fileName);
\t\t\t}
\t\t\tfunction checkDeleteUpload(butt,fileDel) {
\t\t\t\tif(confirm('Are you sure you want to delete '+fileDel+'?')) {
\t\t\t\t\tbutt.form.action+='&deletefile='+fileDel;
\t\t\t\t\tbutt.form.submit();
\t\t\t\t}
\t\t\t\telse
\t\t\t\t\treturn false;
\t\t\t}
\t\t\t
\t    </script>
\t\t{$smarttablestuff}
\t\t<table border="1" width="100%">
\t\t\t\t<tr>
\t\t\t\t\t

\t\t\t\t\t<td  height="100" width="100%" style="overflow:scroll">
\t\t\t\t\t<center>Preview (only for images)</center>
\t\t\t\t\t<iframe name="previewIframe_{$uploadedFormNumber}" width="100%" style="min-height:200px" ></iframe>
\t\t\t\t\t</td>
\t\t\t\t\t
\t\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>
\t\t\t\t\t<b>Click</b> for preview
\t\t\t\t</td>
\t\t\t\t
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>
\t\t\t\t\t<table class="display" id="filestable" border="1" width="100%">
\t\t\t\t\t\t<thead>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<th>File</th>
\t\t\t\t\t\t\t<th>Uploaded By</th>
\t\t\t\t\t\t\t<th>Email Id</th>
\t\t\t\t\t\t\t<th>Upload Time</th>
\t\t\t\t\t\t\t<th>Delete</th>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t</thead>
\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t{$uploadedFilesString}
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>

\t\t\t\t</td>

\t\t\t\t
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td align="right">Path for file (move mouse over name):
\t\t\t\t
\t\t\t\t\t<input type="text" style="width:97%" readonly="readonly" id="preview_uploadedfile_{$uploadedFormNumber}" value="Copy the path from here" />
\t\t\t\t</td>
\t\t\t</tr>
\t\t\t</table>
\t\t\t\t<input type="hidden" name="file_deleted" value="form_{$uploadedFormNumber}">
\t\t\t</form>
UPLOADEDFILESSTRING;
    } else {
        $uploadedFilesString = "No files associated with this page.";
    }
    return $uploadedFilesString;
}
Exemple #25
0
    exit;
}
///Parse the URL and retrieve the PageID of the request page if its valid
$pageId = parseUrlReal($pageFullPath, $pageIdArray);
///Means that the requested URL is not valid.
if ($pageId === false) {
    define("TEMPLATE", getPageTemplate(0));
    $pageId = parseUrlReal("home", $pageIdArray);
    $TITLE = CMS_TITLE;
    $MENUBAR = '';
    $CONTENT = "The requested URL was not found on this server.<br />{$_SERVER['SERVER_SIGNATURE']}" . "<br /><br />Click <a href='" . $urlRequestRoot . "'>here </a> to return to the home page";
    templateReplace($TITLE, $MENUBAR, $ACTIONBARMODULE, $ACTIONBARPAGE, $BREADCRUMB, $SEARCHBAR, $PAGEKEYWORDS, $INHERITEDINFO, $CONTENT, $FOOTER, $DEBUGINFO, $ERRORSTRING, $WARNINGSTRING, $INFOSTRING, $STARTSCRIPTS, $LOGINFORM);
    exit;
}
///If it reaches here, means the page requested is valid. Log the information for future use.
logInfo(getUserEmail($userId), $userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']);
///The URL points to a file. Download permissions for the file are handled inside the download() function in download.lib.php
if (isset($_GET['fileget'])) {
    require_once $sourceFolder . "/download.lib.php";
    $action = "";
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    download($pageId, $userId, $_GET['fileget'], $action);
    exit;
}
///Check whether the user has the permission to use that action on the requested page.
$permission = getPermissions($userId, $pageId, $action);
///Gets the page-specific template for that requested page
define("TEMPLATE", getPageTemplate($pageId));
///Gets the page title of the requested page
              <?php 
}
?>
        </select>
    </div>
	<div class="textfield"> To &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="job_to" id="job_to">
            <option value="">--- To ---</option>
            <?php 
$transfer_result = $conn->query("SELECT * FROM  `job_registration` WHERE  `refer_registration_id`='{$registration_id}'");
while ($transfer_row = $transfer_result->fetch_assoc()) {
    ?>
              <option value="<?php 
    echo $transfer_row['id'];
    ?>
" ><?php 
    echo getUserName($conn, $transfer_row['id']) . " (" . getUserEmail($conn, $city_row['registration_id']) . ")";
    ?>
</option>
              <?php 
}
?>
        </select>
    </div>
    
<div class="textfield fade">
<input type="submit" name="seveRecruiter" id="seveRecruiter" value="Submit"/>
</div>
<div class="clear"></div>
</div>
</form>
</div>
 function iCalendar_event_attendee($activity)
 {
     $adb = PearDatabase::getInstance();
     $users_res = $adb->pquery("SELECT inviteeid FROM vtiger_invitees WHERE activityid=?", array($activity['id']));
     if ($adb->num_rows($users_res) > 0) {
         for ($i = 0; $i < $adb->num_rows($users_res); $i++) {
             $inviteeid = $adb->query_result($users_res, $i, 'inviteeid');
             $username = getUserFullName($inviteeid);
             $user_email = getUserEmail($inviteeid);
             $attendee = 'mailto:' . $user_email;
             $this->add_property('ATTENDEE', $attendee);
         }
     }
     return true;
 }
Exemple #28
0
          <?php 
if (!isSignin()) {
    ?>
            <a href="sign_in_form.php">
              <span class="glyphicon glyphicon-log-in" aria-hidden="true"></span>
              <?php 
    echo $s_sign_in;
    ?>
            </a>
          <?php 
} else {
    ?>
            <a href="control_sign_out.php">
              <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
              <?php 
    echo getUserEmail();
    ?>
 |
              <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
              <?php 
    echo $s_sign_out;
    ?>
            </a>
          <?php 
}
?>

        </li>
      </ul>

    </div>
 public function sendEmail()
 {
     require_once 'vtlib/Vtiger/Mailer.php';
     $vtigerMailer = new Vtiger_Mailer();
     $recipientEmails = $this->getRecipientEmails();
     Vtiger_Utils::ModuleLog('ScheduleReprots', $recipientEmails);
     foreach ($recipientEmails as $name => $email) {
         $vtigerMailer->AddAddress($email, $name);
     }
     vimport('~modules/Report/models/Record.php');
     $reportRecordModel = Reports_Record_Model::getInstanceById($this->get('reportid'));
     $currentTime = date('Y-m-d.H.i.s');
     Vtiger_Utils::ModuleLog('ScheduleReprots Send Mail Start ::', $currentTime);
     $reportname = decode_html($reportRecordModel->getName());
     $subject = $reportname;
     Vtiger_Utils::ModuleLog('ScheduleReprot Name ::', $reportname);
     $vtigerMailer->Subject = $subject;
     $vtigerMailer->Body = $this->getEmailContent($reportRecordModel);
     $vtigerMailer->IsHTML();
     $baseFileName = $reportname . '__' . $currentTime;
     $oReportRun = ReportRun::getInstance($this->get('reportid'));
     $reportFormat = $this->scheduledFormat;
     $attachments = array();
     if ($reportFormat == 'CSV') {
         $fileName = $baseFileName . '.csv';
         $filePath = 'storage/' . $fileName;
         $attachments[$fileName] = $filePath;
         $oReportRun->writeReportToCSVFile($filePath);
     }
     foreach ($attachments as $attachmentName => $path) {
         $vtigerMailer->AddAttachment($path, decode_html($attachmentName));
     }
     //Added cc to account owner
     $accountOwnerId = Users::getActiveAdminId();
     $vtigerMailer->AddCC(getUserEmail($accountOwnerId), getUserFullName($accountOwnerId));
     $status = $vtigerMailer->Send(true);
     foreach ($attachments as $attachmentName => $path) {
         unlink($path);
     }
     return $status;
 }
<?php

session_start();
ob_start();
include 'db.inc.php';
include 'functions.php';
$registration_id = $_SESSION['registration_id'];
$user = getUserName($conn, $registration_id);
$user_mail = getUserEmail($conn, $registration_id);
$id = $_REQUEST['id'];
$result = $conn->query("select company_name from job_profile where registration_id='{$registration_id}'");
$row = $result->fetch_assoc();
$company_name = $row['company_name'];
$result = $conn->query("select contact_name,email_id from admin_master where id='{$id}'");
$row = $result->fetch_assoc();
$admin_name = $row['contact_name'];
$email = $row['email_id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/1.8.3_min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#savecontact").on('click',function(e){
	    e.preventDefault();
		formData=$('#sendmail').serialize();
		var errors = jQuery('.recruiterError');
		$.ajax({