public function m_transControl($RefNum, $MID, $State, $ResNum) { global $system, $lang, $settings; // echo 'RefNum: ' . $this->RefNum = $RefNum; // echo '<br>'; // echo 'MID: ' . $this->MID = $MID; // echo '<br>'; // echo 'State: ' . $this->State = $State; // echo '<br>'; // echo 'ResNum: ' . $this->ResNum = $ResNum; // echo '<br>'; if ($this->RefNum && $this->MID && $this->State) { if ($this->State == 'OK') { $soapProxy = $system->relation->nusoap->getProxy(); // $soapProxy->debug_flag = true; $this->RefNum = $RefNum; $result = $soapProxy->verifyTransaction($RefNum, $MID); if ($result <= 0) { $system->watchDog->exception("e", $lang[securityWarning], $this->resutlState($result)); } else { if ($this->m_addNewTrans($result)) { if (!empty($_SESSION['uid']) && $_SESSION['uid'] != 2) { $user = $system->dbm->db->informer("`user`", "`id` = {$_SESSION['uid']}"); $toMail = $user['email']; $firstName = $user['firstName']; $lastName = $user['lastName']; $userName = $user['userName']; $to = $user['mobile']; $transaction = $system->dbm->db->informer("`{$settings['financialTransaction']}`", "`id` = {$ResNum}"); $amount = $transaction['amount']; $invoiceNumber = $transaction['invoiceNumber']; $system->xorg->smarty->assign("message", $this->m_invoiceViewer($invoiceNumber, false)); require_once 'module/mta/config/config.php'; require_once 'module/mta/model/mta.php'; m_mta::m_mail($settings['adminMail'], $settings['domainName'], $toMail, "{$firstName} {$lastName}", "خرید شما با موفقیت انجام گردید", $system->xorg->smarty->fetch("module/mta/view/tpl/message.htm")); m_mta::m_mail($settings['adminMail'], $settings['domainName'], $settings['adminMail'], $settings['adminMail'], "یک خرید با موفقیت انجام گردید", $system->xorg->smarty->fetch("module/mta/view/tpl/message.htm")); m_mta::m_mail($settings['adminMail'], $settings['domainName'], $settings['invoiceMail'], $settings['invoiceMail'], "یک خرید با موفقیت انجام گردید", $system->xorg->smarty->fetch("module/mta/view/tpl/message.htm")); require_once 'module/sms/config/config.php'; require_once 'module/sms/model/sms.php'; m_sms::m_addObject($to, "{$firstName} {$lastName} با تشکر از خرید شما به مبلغ {$amount} ریال و به شماره پیگری {$RefNum} لطفا برای بررسی اطلاعات خرید به ایمیلتان مراجعه فرمایید.\nبازار بزرگ ایدهآل", '', false); m_sms::m_addObject($settings['shopAlertMobile'], "یک خرید توسط {$userName} به مبلغ {$amount} ریال و کد پیگیری {$RefNum} با موفقیت انجام گرفت.", '', false); } // $system->watchDog->exception ( "s", $lang ['successful'], $lang ['yourShoppingSuccessfull'] ); $system->xorg->smarty->display("{$settings['moduleAddress']}/{$settings['moduleName']}/{$settings['viewAddress']}/{$settings['tplAddress']}/success" . $settings['ext4']); } else { $system->watchDog->exception("e", $lang['securityWarning'], $lang['payRegError']); } } } else { $system->watchDog->exception("e", $lang['securityWarning'], $this->m_checkState()); } } else { $system->watchDog->exception("e", $lang['securityWarning'], "{$this->RefNum} Or {$this->MID} Or {$this->State} is empty"); } }
public function m_remember($userName) { global $settings, $lang, $system; if (isset($userName)) { $code = rand(1111, 99999999); if (strstr($userName, '@')) { echo 'a'; $to['email'] = $system->dbm->db->informer("`{$settings['userTalbe']}`", "`email` = '{$userName}'", "email"); $system->dbm->db->update("`{$settings['userTalbe']}`", "`passReset` = '{$code}'", "`email` = '{$userName}'"); } elseif (is_numeric($userName)) { echo 'b'; $to['mobile'] = $system->dbm->db->informer("`{$settings['userTalbe']}`", "`mobile` = '{$userName}'", "mobile"); $system->dbm->db->update("`{$settings['userTalbe']}`", "`passReset` = '{$code}'", "`id` = '{$_SESSION['uid']}'"); } } if ($to) { if (!empty($to['mobile'])) { require_once 'module/sms/config/config.php'; require_once 'module/sms/model/sms.php'; m_sms::m_addObject($to['mobile'], $code, '', false); echo "SMS-> To: {$to['mobile']} Code: {$code}"; } if (!empty($to['email'])) { $system->mail->CharSet = 'utf-8'; $system->mail->From = $settings['roboMail']; $system->mail->FromName = $settings['domainName']; $system->mail->Subject = $lang['resetCodeSuccessfullSent']; $system->xorg->smarty->assign("subject", $lang['resetCodeSuccessfullSent']); $system->xorg->smarty->assign("message", 'Code: ' . $code); $system->mail->Body = $system->xorg->smarty->fetch($settings['moduleAddress'] . "/mta/view/tpl/message" . $settings['ext4']); $system->mail->addAddress($to['email']); $system->mail->addReplyTo($settings['roboMail']); $system->mail->isHTML(true); $system->mail->send(); echo "Email-> To: {$to['email']} Code: {$code}"; } $system->watchDog->exception("s", $lang[successful], $lang[resetCodeSuccessfullSent]); } else { $system->watchDog->exception("e", $lang[warning], $lang[userNotExist]); } }
public function m_addObject($values, $show = false) { global $system, $lang, $settings; $timeStamp = time(); $values[category] = empty($values[category]) ? 0 : $values[category]; if (empty($values[startYear])) { $values[startTime] = time(); } else { $startTime = $system->time->iCal->geoimport($values[startYear], $values[startMonth], $values[startDay], $values[startHour], $values[startMinute]); if ($startTime < time()) { $values[startTime] = time(); } else { $values[startTime] = $startTime; } } $values[endTime] = empty($values[endYear]) ? 0 : $system->time->iCal->geoimport($values[endYear], $values[endMonth], $values[endDay], $values[endHour], $values[endMinute], 59); if (empty($values[contentPath])) { preg_match('/src="(.+?)"/', $values['description'], $result); if ($result) { $values[contentPath] = $result[1]; str_replace($result[0], '', $values['description']); } } $system->seo->seo(null, $values['description']); $brief = trim($system->seo->p()); if ($_SESSION['uid'] == 1 || $_SESSION['gid'] == 1) { $system->dbm->db->insert("`{$settings['postObject']}`", "`active`, `timeStamp`, `owner`, `group`, `or`, `ow`, `ox`, `gr`, `gw`, `gx`, `tr`, `tx`, `ur`, `ux`, `title`, `brief`, `description`, `category`, `startTime`, `endTime`, `resources`, `filePath`, `contentType`, `contentPath`, `author`, `emailPublish`, `smsPublish`", "1, {$timeStamp}, {$_SESSION['uid']}, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '{$values['title']}', '{$brief}', '{$values['description']}', {$values['category']}, '{$values['startTime']}', '{$values['endTime']}', '{$values['resources']}', '{$values['fileSinglePath2']}', '{$values['contentType']}', '{$values['fileSinglePath1']}', {$_SESSION['uid']}, {$values['emailPublish']}, {$values['smsPublish']}"); $id = $system->dbm->db->insert_id(); if ($settings['enableSendSMS'] && $values['smsPublish']) { $system->dbm->db->select("`mobile`", "`{$settings['contactBook']}`", "`mobile` <> ''", "rand()", '', '', '0,49'); while ($row = $system->dbm->db->fetch_array()) { if (!empty($row[mobile])) { $to .= $row[mobile] . ","; } } require_once 'module/sms/config/config.php'; require_once 'module/sms/model/sms.php'; m_sms::m_addObject($to, "{$values['title']} ...\n {$lang['continueAt']} \n {$settings['domainName']}", '', false); } if ($settings['enableSendEmail'] && $values['emailPublish']) { require_once 'module/mta/config/config.php'; require_once 'module/mta/model/mta.php'; m_mta::m_addMtaQueue($values['domain'], $values['title'], $brief . ' ...', "post/c_showListObject/" . $id . "_" . str_ireplace(' ', '-', trim($values['title'])), $values['fileSinglePath1'], 'newsletter@' . $values['domain'], 'newsletter'); } if ($show == true) { $system->watchDog->exception("s", $lang['postAdd'], sprintf($lang[successfulDone], $lang[postAdd], $values[title]), '', "setTimeout('\$(\\'#content\\').farajax(\\'loader\\', \\'/post/c_listObject\\')', 3000);"); } } else { $system->dbm->db->insert("`{$settings['postObject']}`", "`active`, `timeStamp`, `owner`, `group`, `or`, `ow`, `ox`, `gr`, `gw`, `gx`, `tr`, `tx`, `ur`, `ux`, `title`, `brief`, `description`, `category`, `startTime`, `endTime`, `resources`, `filePath`, `contentType`, `contentPath`, `author`, `emailPublish`, `smsPublish`", "0, {$timeStamp}, {$_SESSION['uid']}, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '{$values['title']}', '{$brief}', '{$values['description']}', {$values['category']}, '{$values['startTime']}', '{$values['endTime']}', '{$values['resources']}', '{$values['fileSinglePath2']}', '{$values['contentType']}', '{$values['fileSinglePath1']}', {$_SESSION['uid']}, {$values['emailPublish']}, {$values['smsPublish']}"); if ($show == true) { $system->watchDog->exception("s", $lang['postAdd'], sprintf($lang['successfulDone'], $lang['postAdd'], $values['title']) . 'و بعد از تایید توسط مدیر درون سایت قرار میگیرد.'); } } }
public function m_editObject($values) { global $system, $lang, $settings; $timeStamp = time(); // print_r($values); if ($values['type'] == 'task') { $taskInfo = $system->dbm->db->informer("`{$settings['task']}`", "`id` = {$values['id']}"); $values['deadline'] = $system->time->iCal->geoimport($values['deadlineYear'], $values['deadlineMonth'], $values['deadlineDay'], $values['deadlineHour'], $values['deadlineMinute']); $commentCount = $system->dbm->db->count_records("`{$settings['commentObject']}`", "`op` = 'crm' AND `opid` = {$values['id']}"); $weight = $values['priority'] * $timeStamp + $commentCount * $settings['commentWeight']; // echo 'Comment Count: ' . $commentCount . '<br>'; // echo 'Priority: ' . $values['priority'] . '<br>'; // echo 'Timestamp: ' . $timeStamp . '<br>'; // echo 'Weight: ' . $weight . '<br>'; $system->dbm->db->update("`{$settings['task']}`", "`lastEditTime` = {$timeStamp}, `priority` = '{$values['priority']}', `status` = '{$values['status']}', `department` = '{$values['department']}', `agent` = '{$values['agent']}', `deadline` = '{$values['deadline']}', `progress` = '{$values['progress']}', `weight` = {$weight}", "`id` = {$values['id']}"); if ($taskInfo['priority'] != $values['priority'] && !empty($values['priority'])) { $log = '<li>' . $lang['priority'] . ' ' . $lang['from'] . ' ' . $taskInfo['priority'] . ' ' . $lang['to'] . ' ' . $values['priority'] . '<li>'; } if ($taskInfo['status'] != $values['status'] && !empty($values['status'])) { $system->dbm->db->update("`{$settings['task']}`", "`weight` = 0", "`id` = {$values['id']}"); $log .= '<li>' . $lang['status'] . ' ' . $lang['from'] . ' ' . $system->dbm->db->informer($settings['status'], "`id` = {$taskInfo['status']}", 'name') . ' ' . $lang['to'] . ' ' . $system->dbm->db->informer($settings['status'], "`id` = {$values['status']}", 'name') . '</li>'; $clientInfo = $system->dbm->db->informer("`{$settings['contactBook']}`", "`id` = {$taskInfo['cientId']}"); if (!empty($clientInfo['mobile'])) { require_once 'module/sms/config/config.php'; require_once 'module/sms/model/sms.php'; m_sms::m_addObject($clientInfo['mobile'], $lang['yourRequestStatusChangedTo'] . ': ' . $system->dbm->db->informer("`{$settings['status']}`", "`id` = {$taskInfo['status']}", 'name'), '', false); } if (!empty($clientInfo['email'])) { require_once 'module/mta/config/config.php'; require_once 'module/mta/model/mta.php'; m_mta::m_addObject($settings['roboMail'], $lang['statusChanged'], $lang['yourRequestStatusChangedTo'] . ': ' . $system->dbm->db->informer("`{$settings['status']}`", "`id` = {$taskInfo['status']}", 'name'), $clientInfo['email'], $clientInfo['firstName'], $clientInfo['lastName']); } } if ($taskInfo['department'] != $values['department'] && !empty($values['department'])) { $log .= '<li>' . $lang['department'] . ' ' . $lang['from'] . ' ' . $system->dbm->db->informer("`{$settings['groupManObject']}`", "`id` = {$taskInfo['department']}", 'name') . ' ' . $lang['to'] . ' ' . $system->dbm->db->informer("`{$settings['groupManObject']}`", "`id` = {$values['department']}", 'name') . '</li>'; } if ($taskInfo['agent'] != $values['agent'] && !empty($values['agent'])) { $log .= '<li>' . $lang['agent'] . ' ' . $lang['from'] . ' ' . $system->dbm->db->informer("`user`", "`id` = {$taskInfo['agent']}", 'name') . ' ' . $lang['to'] . ' ' . $system->dbm->db->informer("`user`", "`id` = {$values['agent']}", 'name') . '</li>'; $agentInfo = $system->dbm->db->informer("`user`", "`id` = {$values['agent']}"); if (!empty($agentInfo['mobile'])) { require_once 'module/sms/config/config.php'; require_once 'module/sms/model/sms.php'; m_sms::m_addObject($agentInfo['mobile'], $lang['aTaskAssignedWithNumber'] . ': ' . $taskInfo['id'], '', false); } if (!empty($agentInfo['email'])) { require_once 'module/mta/config/config.php'; require_once 'module/mta/model/mta.php'; m_mta::m_addObject($settings['roboMail'], $lang['agentChanged'], $lang['yourRequestStatusChangedTo'] . ': ' . $system->dbm->db->informer("`{$settings['status']}`", "`id` = {$taskInfo['status']}", 'name'), $agentInfo['email'], $agentInfo['firstName'], $agentInfo['lastName']); } } if ($taskInfo['deadline'] != $values['deadline'] && !empty($values['deadline'])) { $log .= '<li>' . $lang['deadline'] . ' ' . $lang['from'] . ' ' . $system->time->iCal->dator($taskInfo['deadline'], 2) . ' ' . $lang['to'] . ' ' . $system->time->iCal->dator($values['deadline'], 2) . '</li>'; } if ($taskInfo['progress'] != $values['progress'] && !empty($values['progress'])) { $log .= '<li>' . $lang['progress'] . ' ' . $lang['from'] . ' ' . $taskInfo['progress'] . ' ' . $lang['to'] . ' ' . $values['progress'] . '</li>'; } if (!empty($log)) { $system->dbm->db->insert("`{$settings['taskLog']}`", "`active`, `timeStamp`, `owner`, `group`, `or`, `ow`, `ox`, `uid`, `taskId`, `log`", "1, {$timeStamp}, 1, 12, 1, 1, 1, {$_SESSION['uid']}, {$values['id']}, '{$log}'"); } $system->watchDog->exception("s", $lang['update'], sprintf($lang['successfulDone'], $lang['task'], $values['id'])); } elseif ($values['type'] == 'contactBook') { $system->dbm->db->update("`{$settings['contactBook']}`", "`firstName` = '{$values['firstName']}', `lastName` = '{$values['lastName']}', `gender` = '{$values['gender']}', `birthday` = '{$values['birthday']}', `eduLevel` = '{$values['eduLevel']}', `eduBranch` = '{$values['eduBranch']}', `company` = '{$values['company']}', `jopTitle` = '{$values['jobTitle']}', `position` = '{$values['position']}', `website` = '{$values['website']}', `phoneCode` = '{$values['phoneCode']}', `phoneNumber` = '{$values['phoneNumber']}', `fax` = '{$values['fax']}', `mobile` = '{$values['mobile']}', `receiveSms` = '{$values['receiveSms']}', `email` = '{$values['email']}', `receiveEmail` = '{$values['receiveEmail']}', `address` = '{$values['address']}', `state` = '{$values['state']}', `city` = '{$values['city']}'", "`id` = {$values['id']}"); $system->watchDog->exception("s", $lang['contactBookEdit'], sprintf($lang['successfulDone'], $lang['contactBookEdit'], $values['name'])); } }