function scheduleNewEmail_temp($email_to, $email_content, $subject, $caldate_day, $hour, $USERNAME) { $manageUsers = new manageUsers(); $thisuserEmailId = $manageUsers->get_userSingleDetail($USERNAME, 'user_primaryEmail'); $delivery_ts = $caldate_day . ' ' . $hour . ':10:00'; // 'YYYY-MM-DD HH:MM:SS' $details = array('emailby_user' => $USERNAME, 'email_to' => $email_to, 'email_content' => $email_content, 'emailby_from' => $thisuserEmailId, 'email_subject' => $subject, 'email_scheduledon' => $delivery_ts); $success = execute_sqlInsert("scheduledmails", $details); }
if ($errMsg == '') { $valid_email_cnt = 0; $invalid_emails = ''; $emails = str_replace(chr(13), "", $emails); //remove carriage returns $emails = str_replace(chr(10), "", $emails); //remove line feeds $file_name = UPLOAD_PATH . $send_FILEINFO['fileRandomName']; $file_act_name = $send_FILEINFO['fileName']; $subject = 'Simple Chat File'; $body = nl2br($your_comment) . "<br/><br/><br/>Please find the file attached."; $send_FileUploadInfo = $send_MF->getChatFileUploadInfo($send_FILEINFO['fileId']); $msg = sendMailUsingMailer($emails, $subject, $body, $file_name, $file_act_name); if ($msg == 'Letter is sent') { $newmsg = "has emailed " . $file_act_name . "</a> to " . $emails . " [ <a href=\"chatfiledownload.php?fc={$send_FILEINFO['fileId']}\">View File</a> ]"; $success = execute_sqlInsert('tbl_ChatRooms', array('saidBy_username' => $_SESSION["uname"], 'saidBy_empl_id' => $_SESSION["empl_id"], 'message_base64' => '', 'message_plain_mysqlescaped' => $newmsg, 'chatRoom' => $send_FileUploadInfo['roomId'], 'msgType' => 'E')); } else { } register_LastPingAt(); } } if (get_GET_var('fid')) { $fid = get_GET_var('fid'); $MF = new ManageFiles(); $FILEINFO = $MF->get_file_Info($fid, $_SESSION["empl_id"]); if (!count($FILEINFO)) { echo "Invalid file or privilege"; exit; } $FileUploadInfo = $MF->getChatFileUploadInfo($FILEINFO['fileId']); }
public function addComment($workID, $commentBy, $newComment) { $success = execute_sqlInsert("COMMENTS", array(workID => $workID, comment_by => $commentBy, comment_date => get_currentPHPTimestamp(), comment => $newComment)); }
$_SESSION["emplEmail_id"] = $emp_details['emplEmail_id']; $_SESSION["emplFullName"] = $emp_details['emplFullName']; $_SESSION["emplLastLoginAt"] = $emp_details['emplLastLoginAt']; register_LastPingAt(); send_Action_Response('Success', 'Logged In !'); exit; break; case 'postmessage': // This action will be called every X seconds from the chat page // to post a new message (if there is a new message) // and then fetch the list of un-seen/new messages since the last fetch $newmsg = get_POST_var('newmsg'); $lmsgid = get_POST_var('LMSGID'); $roomid = get_POST_var('ROOMID'); if ($newmsg) { $success = execute_sqlInsert('tbl_ChatRooms', array('saidBy_username' => $USERNAME, 'saidBy_empl_id' => $CURRENT_USERID, 'message_base64' => base64_encode(htmlentities(base64_decode($newmsg), ENT_QUOTES)), 'message_plain_mysqlescaped' => base64_decode($newmsg), 'chatRoom' => $roomid)); } register_LastPingAt(); $newMsgCount = executesql_returnArray("select count(msgid) as newmsgcount from tbl_ChatRooms where chatRoom='{$roomid}' AND msgid > {$lmsgid}"); if (!$newMsgCount) { send_Action_Response('Success', " NEW_MESSAGES = [] ; LASTFETCHEDMSGID = {$lmsgid} ;"); } $TMC = new ManageChatRooms(); $NMFR = $TMC->get_NewMessages_fromRoom(array('condition' => 'NewerThan', 'value' => $lmsgid), $roomid, $CURRENT_USERID); send_Action_Response('Success', " NEW_MESSAGES = " . json_encode($NMFR['NEW_MESSAGES']) . "; LASTFETCHEDMSGID = {$NMFR['LASTFETCHEDMSGID']} ;"); exit; break; case 'post_direct_message': // Post Direct Messages between users $newmsg = get_POST_var('newmsg'); $to_user = get_POST_var('to_user');
//$image->thumbnailImage($new_width, $new_height); //$thumbFile = dirname($file) . '/' . basename($target_path, '.JPG') . '.thumb.jpg'; //$image->writeImage($Thumb_Path); /*$thumb_size = $image->getsize(); $MF->updateDiskSpace($thumb_size);*/ // free resource handle $image->destroy(); } catch (Exception $e) { die($e->getMessage()); } } $file_success = execute_sqlInsert('tbl_chatFiles', array('fileName' => $file_name, 'fileRandomName' => $name, 'fileExt' => $type, 'fileSize' => $size, 'fileCode' => $UFID, 'fileType' => $file_type)); $fileId = mysql_insert_id(); if ($fileId) { $newmsg = 'has uploaded a file <a href="chatfiledownload.php?fc=' . $fileId . '">' . $file_name . '</a>'; $success = execute_sqlInsert('tbl_ChatRooms', array('saidBy_username' => $CURRENT_USER, 'saidBy_empl_id' => $_SESSION["empl_id"], 'message_base64' => '', 'message_plain_mysqlescaped' => $newmsg, 'chatRoom' => $rid, 'msgType' => 'F', 'fileId' => $fileId)); register_LastPingAt(); } $result = 1; } //} } ?> <script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?> );</script>
<?php include_once "include_db.php"; include_once "include_functions.php"; checkUserSessionandCookie(); $username = $_SESSION["uname"]; $workid = @$_POST["fileupload_workid"]; $uploadname = basename($_FILES['uploadedfile']['name']); $ruri = @$_POST["fileupload_requestURI"]; $tmp_uploadedOn = get_currentPHPTimestamp(); $tmp = getDirectorySize($target_path); $currentsize = $tmp['size']; $maxallowed = $_SESSION["pkgSpaceMb"] * 1024 * 1024; // convert Mb into bytes if ($currentsize > $maxallowed) { echo "<h1>You do not have enough free space for uploading any new files ! </h1>"; exit; } Task_LogSystemComment($workid, "<B>{$username}</B> has uploaded file '{$uploadname}' {$thisfilesize}"); logUserEvent('Uploaded attachment to ' . $workid); $fp = fopen($_FILES['uploadedfile']['tmp_name'], 'r'); $fp_size = filesize($_FILES['uploadedfile']['tmp_name']); $somefile = bin2hex(fread($fp, $fp_size)); $success = execute_sqlInsert('attachments', array('workid' => $workid, 'uploadname' => $uploadname, 'uploadedby' => $username, 'filecontent' => $somefile, 'filesize' => $fp_size, 'uploadedOn' => $tmp_uploadedOn)); header("Location: " . $ruri);
//$image->thumbnailImage(200, 150); //$thumbFile = dirname($file) . '/' . basename($target_path, '.JPG') . '.thumb.jpg'; //$image->writeImage($Thumb_Path); // free resource handle $image->destroy(); } catch (Exception $e) { die($e->getMessage()); } } $file_success = execute_sqlInsert('tbl_chatFiles', array('fileName' => $file_name, 'fileRandomName' => $name, 'fileExt' => $type, 'fileSize' => $size, 'fileCode' => $UFID, 'fileType' => $file_type)); $fileId = mysql_insert_id(); } } } if ($fileId) { $fileType = 'F'; } else { $fileType = 'M'; } $success = execute_sqlInsert('tbl_DirectMessages', array('to_uid' => $to_user, 'from_uid' => $_SESSION["empl_id"], 'msg_base64' => base64_encode(htmlentities($new_message, ENT_QUOTES)), 'msg_plain' => $new_message, 'msgType' => $fileType, 'fileId' => $fileId)); register_LastPingAt(); $result = 1; //send_Action_Response('Success' , $result ); //$redirect= "Location:dmsg.php?id=".base64_encode($to_user)."&re=".$result.""; //header($redirect); /*?><script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script> <?php */ ?>
// If the email received has attachments , put attach those files to this task $attachments = $Parser->getAttachments(); if (count($attachments)) { $tmp_uploadedOn = get_currentPHPTimestamp(); foreach ($attachments as $attachment) { $upload_filename = $attachment->filename; $TMP_SOMENAME = '/tmp/' . getaRandomString(9); if ($fp = fopen($TMP_SOMENAME, 'w')) { while ($bytes = $attachment->read()) { fwrite($fp, $bytes); } fclose($fp); $fp = fopen($TMP_SOMENAME, 'r'); $TMP_SOMENAME_SIZE = filesize($TMP_SOMENAME); $TMP_SOMENAME_CONTENT = bin2hex(fread($fp, $TMP_SOMENAME_SIZE)); $success = execute_sqlInsert('attachments', array('workid' => $WORK_ID, 'uploadname' => $upload_filename, 'uploadedby' => $SUBDOMAIN_USER, 'filecontent' => $TMP_SOMENAME_CONTENT, 'filesize' => $TMP_SOMENAME_SIZE, 'uploadedOn' => $tmp_uploadedOn)); fclose($fp); unlink($TMP_SOMENAME); } } } } } if ($before_underscore == 'notes') { $manageNotes = new manageNotes(); $manageNotes->USERNAME = $SUBDOMAIN_USER; $note_body = "{$thisemail_subject} \n --------------------- \n {$thisemail_body} "; $manageNotes->insertNote($note_body); } $processemail_debugoutput = " \n before_underscore is {$before_underscore} "; // email $processemail_debugoutput to your email id to see the debug information
public function newMessage($fromUid, $toUid, $messageInBase64) { $success = execute_sqlInsert('tbl_DirectMessages', array('to_uid' => $toUid, 'from_uid' => $fromUid, 'msg_base64' => base64_encode(htmlentities(base64_decode($messageInBase64), ENT_QUOTES)), 'msg_plain' => base64_decode($messageInBase64), 'msgtime' => get_currentPHPTimestamp())); }
$USERNAME = $_SESSION['loggedinUser']; // $_SESSION['loggedinUser'] = $_SERVER['PHP_AUTH_USER'] ; switch ($ACTION) { case 'updatePwd': $currentPwd = @$_POST["currentPwd"]; $newPwd = @$_POST["newPwd"]; execute_sqlUpdate("users", array(user_pwd => $newPwd), array(username => $USERNAME, user_pwd => $currentPwd)); send_Action_Response('Success', 'password updated !'); exit; break; case 'deleteTask': $taskid = @$_POST["taskid"]; $query = mysql_query("delete from journalentries where jid='{$taskid}' and task_user='******'"); send_Action_Response('Success', 'Entry deleted !'); exit; break; case 'addnewtask': $nutask_date = @$_POST["nutask_date"]; $nutask_duration = @$_POST["nutask_duration"]; $nutask_desc = @$_POST["nutask_desc"]; $nutask_project = @$_POST["nutask_project"]; // if( $nutask_date == getTomorrowCaldate(-1) || $nutask_date == getTomorrowCaldate(0) || $nutask_date == getTomorrowCaldate(1) ){ // // }else{ // send_Action_Response('Fail' , 'You can enter journal for only today & yesterday !'); // } $success = execute_sqlInsert("journalentries", array('task_day' => $nutask_date, 'task_mins' => $nutask_duration, 'task_desc' => $nutask_desc, 'task_user' => $USERNAME, 'task_project' => $nutask_project)); send_Action_Response('Success', 'Added !'); exit; break; }
case 'isPrivate': $actualFieldName = 'work_isPrivate'; $fieldValue = $fieldValue == 'yes' ? 'Y' : 'N'; break; } $somearray = array(); $somearray[$actualFieldName] = $fieldValue; $manageWorks = new manageWorks(); $manageWorks->updateWork($workid, $somearray); $manageWorks->addComment($workid, APPNAME, "<B>{$USERNAME}</B> updated field {$fieldName} to {$fieldValue}"); send_Action_Response('Success', "updated Task {$workid} !"); exit; break; case 'newRoutineTask': $nrt = get_POST_var('nrt'); $result = execute_sqlInsert("dailychecklist", array(username => $USERNAME, task => $nrt)); send_Action_Response('Success', "Note Routine task added !"); exit; break; case 'resetRoutineTasksStatus': $result = execute_sqlUpdate("dailychecklist", array(status => 'N'), array(username => $USERNAME)); send_Action_Response('Success', "Status Reset !"); exit; break; case 'updateTasksStatus': $dclid = get_POST_var('dclid'); $task_status = get_POST_var('task_status'); $result = execute_sqlUpdate("dailychecklist", array(status => $task_status), array(username => $USERNAME, dclid => $dclid)); send_Action_Response('Success', "Status Reset !"); exit; break;