コード例 #1
0
 public function insertToParent()
 {
     $recArr = $this->readInputRecord();
     $this->setActiveRecord($recArr);
     if (count($recArr) == 0) {
         return;
     }
     //generate fast_index
     $svcobj = Openbiz::getService("service.chineseService");
     if ($svcobj->isChinese($recArr['first_name'])) {
         $fast_index = $svcobj->Chinese2Pinyin($recArr['first_name']);
     } else {
         $fast_index = $recArr['first_name'];
     }
     $recArr['fast_index'] = substr($fast_index, 0, 1);
     if (!$recArr['company']) {
         $recArr['company'] = 'N/A';
     }
     try {
         $this->ValidateForm();
     } catch (Openbiz\Validation\Exception $e) {
         $this->processFormObjError($e->errors);
         return;
     }
     $recId = $this->_doInsert($recArr);
     $selIds[] = $recId;
     // if no parent elem or picker map, call AddToParent
     if (!$this->parentFormElemName) {
         $this->addToParent($selIds);
     }
     // if has parent elem and picker map, call JoinToParent
     if ($this->parentFormElemName && $this->pickerMap) {
         $this->joinToParent($selIds);
     }
 }
コード例 #2
0
 public function exportCSV()
 {
     $eventlogSvc = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
     $eventlogSvc->exportCSV();
     $this->runEventLog();
     return true;
 }
コード例 #3
0
 public function render()
 {
     $sHTML = "";
     if (Openbiz::getService('system.lib.ModuleService')->isModuleInstalled('oauth')) {
         $do = Openbiz::getObject('oauth.do.OauthProviderDO');
         $recArr = $do->directFetch("[status]=1", 30);
         $recArr = $recArr->toArray();
         if ($this->redirectURL) {
             $this->redirectURL = Expression::evaluateExpression($this->redirectURL, $this);
             $url_append .= "redirect_url=" . urlencode($this->redirectURL) . "&";
         }
         if ($this->assocURL) {
             $this->assocURL = Expression::evaluateExpression($this->assocURL, $this);
             $url_append .= "assoc_url=" . urlencode($this->assocURL) . "&";
         }
         if (count($recArr)) {
             $sHTML .= "<span class=\"oauth_bar\" {$style}>";
             foreach ($recArr as $oauthProvider) {
                 $url = OPENBIZ_APP_URL . "/ws.php/oauth/callback/login/type_" . $oauthProvider['type'] . '/';
                 if ($url_append) {
                     $url .= '?' . $url_append;
                 }
                 $sHTML .= "<a id=\"oauth_" . $oauthProvider['type'] . "\" title=\"" . $oauthProvider['type'] . "\"   href=\"{$url}\" style=\"\"></a>";
             }
             $sHTML .= "</span>";
         }
     }
     return $sHTML;
 }
コード例 #4
0
 /**
  * Reset the password
  *
  * @return void
  */
 public function resetPassword()
 {
     $recArr = $this->readInputs();
     $this->setActiveRecord($recArr);
     if (count($recArr) == 0) {
         return;
     }
     try {
         $this->ValidateForm();
         if ($this->ValidateEmail($recArr['username'], $recArr['email'])) {
             //Init user profile for event logging
             $profile = Openbiz::$app->InituserProfile($recArr['username']);
         } else {
             return;
         }
         //generate pass_token
         $token = $this->GenerateToken($profile);
         if ($token) {
             //event log
             $eventlog = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
             $logComment = array($username, $_SERVER['REMOTE_ADDR']);
             $eventlog->log("USER_MANAGEMENT", "MSG_GET_PASSWORD_TOKEN", $logComment);
             //send user email
             $emailObj = Openbiz::getService(CUBI_USER_EMAIL_SERVICE);
             $emailObj->UserResetPassword($token['Id']);
             Openbiz::$app->getSessionContext()->destroy();
             //goto URL
             $this->processPostAction();
         }
     } catch (Openbiz\Validation\Exception $e) {
         $this->processFormObjError($e->errors);
         return;
     }
 }
コード例 #5
0
 public function fetchData()
 {
     $result = Openbiz::getService("payment.lib.PaymentService")->getReturnData($_GET['type']);
     $txn_id = $result['txn_id'];
     $verify = Openbiz::getService("payment.lib.PaymentService")->validateNotification($_GET['type'], $txn_id);
     return $result;
 }
コード例 #6
0
ファイル: LogForm.php プロジェクト: openbizx/openbizx-cubix
 public function ExportCSV()
 {
     $excelSvc = Openbiz::getService(EXCEL_SERVICE);
     $excelSvc->renderCSV($this->objectName);
     $this->runEventLog();
     return true;
 }
コード例 #7
0
 protected function parseName($name)
 {
     $svcobj = Openbiz::getService("service.chineseService");
     if ($svcobj->isChinese($name)) {
         $fast_index = $svcobj->Chinese2Pinyin($name);
     } else {
         $fast_index = $recArr['display_name'];
     }
     $nameArr['fast_index'] = substr($fast_index, 0, 1);
     $nameArr['display_name'] = $name;
     if ($svcobj->isChinese($name)) {
         //chinese name
         switch (mb_strlen($name, 'UTF-8')) {
             case 5:
             case 4:
                 $nameArr['last_name'] = mb_substr($name, 0, 2, 'UTF-8');
                 $nameArr['first_name'] = mb_substr($name, 2, mb_strlen($name, 'UTF-8') - 1, 'UTF-8');
                 break;
             default:
                 $nameArr['last_name'] = mb_substr($name, 0, 1, 'UTF-8');
                 $nameArr['first_name'] = mb_substr($name, 1, mb_strlen($name, 'UTF-8') - 1, 'UTF-8');
                 break;
         }
     } else {
         //english name
         if (preg_match("/(\\S*?)\\s(\\S*)/si", $name, $match)) {
             $nameArr['last_name'] = $match[1];
             $nameArr['first_name'] = $match[2];
         }
     }
     return $nameArr;
 }
コード例 #8
0
 protected function _remoteCall($method, $params = null)
 {
     $uri = $this->reportServer;
     $cache_id = md5($this->objectName . $uri . $method . serialize($params));
     $cacheSvc = Openbiz::getService(CACHE_SERVICE, 1);
     $cacheSvc->init($this->objectName, $this->cacheLifeTime);
     if (substr($uri, strlen($uri) - 1, 1) != '/') {
         $uri .= '/';
     }
     $uri .= "ws.php/udc/CollectService";
     if ($cacheSvc->test($cache_id) && (int) $this->cacheLifeTime > 0) {
         $resultSetArray = $cacheSvc->load($cache_id);
     } else {
         try {
             $argsJson = urlencode(json_encode($params));
             $query = array("method={$method}", "format=json", "argsJson={$argsJson}");
             $httpClient = new HttpClient('POST');
             foreach ($query as $q) {
                 $httpClient->addQuery($q);
             }
             $headerList = array();
             $out = $httpClient->fetchContents($uri, $headerList);
             $cats = json_decode($out, true);
             $resultSetArray = $cats['data'];
             $cacheSvc->save($resultSetArray, $cache_id);
         } catch (Exception $e) {
             $resultSetArray = array();
         }
     }
     return $resultSetArray;
 }
コード例 #9
0
 public function insertRecord()
 {
     $recArr = $this->readInputRecord();
     $this->setActiveRecord($recArr);
     if (count($recArr) == 0) {
         return;
     }
     //generate fast_index
     $svcobj = Openbiz::getService("service.chineseService");
     if ($svcobj->isChinese($recArr['first_name'])) {
         $fast_index = $svcobj->Chinese2Pinyin($recArr['first_name']);
     } else {
         $fast_index = $recArr['first_name'];
     }
     $recArr['fast_index'] = substr($fast_index, 0, 1);
     try {
         $this->ValidateForm();
     } catch (Openbiz\Validation\Exception $e) {
         $this->processFormObjError($e->errors);
         return;
     }
     $this->_doInsert($recArr);
     // in case of popup form, close it, then rerender the parent form
     if ($this->parentFormName) {
         $this->close();
         $this->renderParent();
     }
     $this->processPostAction();
 }
コード例 #10
0
ファイル: SPtclk.php プロジェクト: openbizx/openbizx-cubix
 public function send($mobile, $content, $schedule = null)
 {
     $providerInfo = $this->_getProviderInfo();
     $CorpID = $providerInfo['username'];
     $Pwd = $providerInfo['password'];
     if ($schedule == "0000-00-00 00:00:00") {
         $schedule = '';
     } else {
         $schedule = date('YmdHis', strtotime($schedule));
     }
     $mobile_log = $mobile;
     $content_log = $content;
     $mobile = urlencode($mobile);
     $content = urlencode(iconv("UTF-8", "GBK", $content));
     $url = $this->url . "BatchSend?CorpID={$CorpID}&Pwd={$Pwd}&Mobile={$mobile}&Content={$content}&Cell=&SendTime={$schedule}";
     $result = file_get_contents($url);
     preg_match("/\">(.*?)<\\/int/si", $result, $match);
     $result = (int) $match[1];
     if ($result < 0) {
         Openbiz::getService(LOG_SERVICE)->log(LOG_ERR, "SMS", "sendMessage: " . $content . " TCLK:" . $mobile . ':' . $result['msg']);
         return false;
     } else {
         $this->HitMessageCounter();
         $this->_log($mobile_log, $content_log, $schedule);
         return true;
     }
 }
コード例 #11
0
 public function insertRecord()
 {
     $recArr = $this->readInputRecord();
     $this->setActiveRecord($recArr);
     if (count($recArr) == 0) {
         return;
     }
     try {
         $this->ValidateForm();
     } catch (Openbiz\Validation\Exception $e) {
         $this->processFormObjError($e->errors);
         return;
     }
     $repo_uri = $recArr['repository_uri'];
     $svc = Openbiz::getService("market.lib.PackageService");
     $repoInfo = $svc->discoverRepository($repo_uri);
     $recArr['repository_uid'] = $repoInfo['_repo_uid'];
     $recArr['repository_name'] = $repoInfo['_repo_name'];
     $this->_doInsert($recArr);
     // in case of popup form, close it, then rerender the parent form
     if ($this->parentFormName) {
         $this->close();
         $this->renderParent();
     }
     $this->processPostAction();
 }
コード例 #12
0
ファイル: ErrorForm.php プロジェクト: openbizx/openbizx-cubix
 public function Report()
 {
     //send an email to admin includes error messages;
     $system_uuid = Openbiz::getService("system.lib.CubiService")->getSystemUUID();
     $report = array("system_uuid" => $system_uuid, "error_info" => $this->errors["system"], "server_info" => $_SERVER, "php_version" => phpversion(), "php_extension" => get_loaded_extensions());
     $reportId = Openbiz::getObject("common.lib.ErrorReportService")->report($report);
     $this->notices = array("status" => "REPORTED", "report_id" => $reportId);
     $this->ReRender();
 }
コード例 #13
0
 public function checkInstalledVersion()
 {
     $installedVersion = Openbiz::getService("system.lib.ModuleService")->isModuleInstalled("help");
     if (version_compare($installedVersion, "1.1") >= 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #14
0
 protected function _doCreateUser()
 {
     $recArr = $this->readInputRecord();
     $this->setActiveRecord($recArr);
     if (count($recArr) == 0) {
         return;
     }
     if ($this->_checkDupUsername()) {
         $errorMessage = $this->GetMessage("USERNAME_USED");
         $errors['fld_username'] = $errorMessage;
         $this->processFormObjError($errors);
         return;
     }
     if ($this->_checkDupEmail()) {
         $errorMessage = $this->GetMessage("EMAIL_USED");
         $errors['fld_email'] = $errorMessage;
         $this->processFormObjError($errors);
         return;
     }
     try {
         $this->ValidateForm();
     } catch (Openbiz\Validation\Exception $e) {
         $this->processFormObjError($e->errors);
         return;
     }
     $recArr['create_by'] = "0";
     $recArr['update_by'] = "0";
     $password = Openbiz::$app->getClientProxy()->GetFormInputs("fld_password");
     $recArr['password'] = hash(HASH_ALG, $password);
     $this->_doInsert($recArr);
     //set default user role to member
     $userinfo = $this->getActiveRecord();
     $userRoleObj = Openbiz::getObject('system.do.UserRoleDO');
     foreach (Openbiz::getObject('system.do.RoleDO')->directfetch("[default]='1'") as $roleRec) {
         $roleId = $roleRec['Id'];
         $uesrRoleArr = array("user_id" => $userinfo['Id'], "role_id" => $roleId);
         $userRoleObj->insertRecord($uesrRoleArr);
     }
     //set default group to member
     $userGroupObj = Openbiz::getObject('system.do.UserGroupDO');
     foreach (Openbiz::getObject('system.do.GroupDO')->directfetch("[default]='1'") as $groupRec) {
         $groupId = $groupRec['Id'];
         $uesrGroupArr = array("user_id" => $userinfo['Id'], "group_id" => $groupId);
         $userGroupObj->insertRecord($uesrGroupArr);
     }
     //record event log
     $eventlog = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
     $logComment = array($userinfo['username'], $_SERVER['REMOTE_ADDR']);
     $eventlog->log("USER_MANAGEMENT", "MSG_USER_REGISTERED", $logComment);
     //send user email
     $emailObj = Openbiz::getService(CUBI_USER_EMAIL_SERVICE);
     $emailObj->UserWelcomeEmail($userinfo['Id']);
     //init profile for future use like redirect to my account view
     $profile = Openbiz::$app->InituserProfile($userinfo['username']);
     return $userinfo;
 }
コード例 #15
0
 public function observe($event)
 {
     $triggerObj = $event->getTarget();
     $triggerEvent = $event->getName();
     $params = $event->getParams();
     // get eventlog service
     $eventLog = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
     // log message
     $eventLog->Log($triggerEvent, "triggered by " . $triggerObj->objectName);
 }
コード例 #16
0
 public function MakePayment()
 {
     $rec = $this->readInputRecord();
     $orderId = $rec['order_id'];
     $title = $rec['title'];
     $amount = $rec['amount'];
     $providerType = $rec['provider_type'];
     Openbiz::getService($this->paymentService)->goPayment($orderId, $amount, $providerType, $title);
     return true;
 }
コード例 #17
0
 public function switchUser($user_id)
 {
     $userRec = Openbiz::getObject("system.do.UserDO")->fetchById($user_id);
     $username = $userRec['username'];
     $serviceObj = Openbiz::getService(PROFILE_SERVICE);
     if (method_exists($serviceObj, 'SwitchUserProfile')) {
         $serviceObj->SwitchUserProfile($username);
     }
     $pageURL = OPENBIZ_APP_INDEX_URL . '/mystore/profile';
     Openbiz::$app->getClientProxy()->redirectPage($pageURL);
 }
コード例 #18
0
 public function closeTutorial()
 {
     $tutorailId = $this->recordId;
     $rec = $this->readInputs();
     if ($rec['chk_show_on_next']) {
         $showOnNextLogin = 1;
     } else {
         $showOnNextLogin = 0;
     }
     Openbiz::getService("help.lib.TutorialService")->SetTutorialShown($tutorailId, $showOnNextLogin);
     $this->close();
 }
コード例 #19
0
 public function fetchData()
 {
     $svcobj = Openbiz::getService(PROFILE_SERVICE);
     //echo Openbiz::$app->getUserProfile("profile_Id");
     //echo $svcobj->checkExist(Openbiz::$app->getUserProfile("profile_Id"));
     if (!Openbiz::$app->getUserProfile("profile_Id") || !$svcobj->checkExist(Openbiz::$app->getUserProfile("profile_Id"))) {
         $profile_id = $svcobj->CreateProfile();
         $svcobj->InitProfile(Openbiz::$app->getUserProfile("username"));
         $this->updateForm();
     }
     return parent::fetchData();
 }
コード例 #20
0
 public function updateRecord()
 {
     $currentRec = $this->fetchData();
     $recArr = $this->readInputRecord();
     $this->setActiveRecord($recArr);
     //generate fast_index
     if ($currentRec['display_name'] != $recArr['display_name']) {
         $svcobj = Openbiz::getService("service.chineseService");
         if ($svcobj->isChinese($recArr['display_name'])) {
             $fast_index = $svcobj->Chinese2Pinyin($recArr['display_name']);
         } else {
             $fast_index = $recArr['display_name'];
         }
         $recArr['fast_index'] = substr($fast_index, 0, 1);
     }
     if ($currentRec['user_id'] != 0) {
         $user_email = Openbiz::getObject("system.do.UserDO", 1)->fetchById($currentRec['user_id'])->email;
     }
     if ($user_email != $recArr['email'] && $currentRec['user_id'] != 0 && $recArr['email'] != '') {
         //check if email address duplicate
         if ($this->_checkDupEmail($recArr['email'], $currentRec['user_id'])) {
             $this->setActiveRecord($recArr);
             $errorMessage = $this->GetMessage("EMAIL_USED");
             $errors['fld_email'] = $errorMessage;
             $this->processFormObjError($errors);
             return;
         }
         //auto update user's email
         $email = $currentRec['email'];
         $userRec = Openbiz::getObject("system.do.UserDO", 1)->fetchById($currentRec['user_id']);
         $userRec['email'] = $recArr['email'];
         $userRec->save();
     }
     if (count($recArr) != 0) {
         try {
             $this->ValidateForm();
         } catch (Openbiz\Validation\Exception $e) {
             $this->processFormObjError($e->errors);
             return;
         }
         if ($this->_doUpdate($recArr, $currentRec) == false) {
             return;
         }
         $this->commitFormElements();
         // commit change in FormElement
     }
     // in case of popup form, close it, then rerender the parent form
     if ($this->parentFormName) {
         $this->close();
         $this->renderParent();
     }
     $this->processPostAction();
 }
コード例 #21
0
 public function fetchDataSet()
 {
     $resultSet = array();
     $app_id = (int) $_GET['fld:Id'];
     $repo_uri = $this->getDefaultRepoURI();
     $svc = Openbiz::getService("market.lib.PackageService");
     $resultRecords = $svc->discoverAppPics($repo_uri, $app_id);
     foreach ($resultRecords as $record) {
         $record['url'] = $repo_uri . $record['url'];
         $resultSet[] = $record;
     }
     return $resultSet;
 }
コード例 #22
0
 public function getFromList(&$list, $selectFrom = null)
 {
     parent::getFromList($list, $selectFrom);
     $svc = Openbiz::getService("market.lib.PackageService");
     foreach ($list as $key => $record) {
         $repo_uri = $record['pic'];
         unset($record['pic']);
         $repoInfo = $svc->discoverRepository($repo_uri);
         $record['txt'] = $repoInfo['_repo_name'];
         $list[$key] = $record;
     }
     return;
 }
コード例 #23
0
ファイル: QueueForm.php プロジェクト: openbizx/openbizx-cubix
 public function sendSms()
 {
     $Record = $this->getActiveRecord();
     if (is_array($Record) && $Record['status'] != 'sent') {
         $arr[0] = $Record;
         Openbiz::getService('sms.lib.SmsService')->SendSmsFromQueue($arr);
     }
     if (strtoupper($this->formType) == "LIST") {
         $this->rerender();
     }
     $this->runEventLog();
     $this->processPostAction();
     return true;
 }
コード例 #24
0
ファイル: SP18dx.php プロジェクト: openbizx/openbizx-cubix
 public function getMsgBalance()
 {
     $ProviderInfo = $this->_getProviderInfo();
     $Param = array('action' => 'getbalance', 'user' => $ProviderInfo['username'], 'hashcode' => strtoupper(md5($ProviderInfo['password'])));
     $recinfo = Openbiz::getService("sms.lib.SmsUtilService")->curl($this->url, $Param);
     $errorInfo = $this->getMsg($recinfo);
     if ($errorInfo) {
         Openbiz::getService(LOG_SERVICE)->log(LOG_ERR, "SMS", "getSentMessageCount 18dx:" . $errorInfo);
         return false;
     } else {
         $balance = $recinfo;
         $this->updateMsgBalance($balance);
         return $balance;
     }
 }
コード例 #25
0
 public function allowUninstall($repo_id, $app_id)
 {
     $svc = Openbiz::getService("market.lib.PackageService");
     $repoInfo = Openbiz::getObject("market.repository.do.RepositoryDO")->fetchById($repo_id);
     $repo_uri = $repoInfo->repository_uri;
     $repo_uid = $repoInfo->repository_uid;
     //get app module
     $appInfo = $svc->discoverAppInfo($repo_uri, $app_id);
     $app_uid = $appInfo['package_id'];
     if (preg_match("/com.application/si", strtolower($app_uid))) {
         return true;
     } else {
         return false;
     }
 }
コード例 #26
0
 public static function FetchContacts($credential, $provider)
 {
     $dataSource = Openbiz::getObject($provider);
     $result = $dataSource->FetchContacts($credential);
     $svcobj = Openbiz::getService("service.chineseService");
     for ($i = 0; $i < count($result); $i++) {
         if ($svcobj->isChinese($result[$i]['display_name'])) {
             $fast_index = $svcobj->Chinese2Pinyin($result[$i]['display_name']);
         } else {
             $fast_index = $result[$i]['display_name'];
         }
         $result[$i]['fast_index'] = substr($fast_index, 0, 1);
     }
     return $result;
 }
コード例 #27
0
 public function Logout()
 {
     $eventlog = Openbiz::getService(OPENBIZ_EVENTLOG_SERVICE);
     $profile = Openbiz::$app->getUserProfile();
     $logComment = array($profile["username"], $_SERVER['REMOTE_ADDR']);
     $eventlog->log("LOGIN", "MSG_LOGOUT_SUCCESSFUL", $logComment);
     // destroy all data associated with current session:
     Openbiz::$app->getSessionContext()->destroy();
     //clean cookies
     setcookie("SYSTEM_SESSION_USERNAME", null, time() - 100, "/");
     setcookie("SYSTEM_SESSION_PASSWORD", null, time() - 100, "/");
     // Redirect:
     //header("Location: ".OPENBIZ_APP_INDEX_URL."/user_mob/login");
     echo OPENBIZ_APP_INDEX_URL . "/user_mob/login";
     exit;
 }
コード例 #28
0
ファイル: SPemay.php プロジェクト: openbizx/openbizx-cubix
 public function send($mobile, $content, $schedule = null)
 {
     if ($schedule == "0000-00-00 00:00:00") {
         $schedule = '';
     } else {
         $schedule = date('YmdHis', strtotime($schedule));
     }
     $result = $this->getClientObj()->sendSMS(array($mobile), $content, $schedule, '', 'UTF-8');
     if ($result) {
         Openbiz::getService(LOG_SERVICE)->log(LOG_ERR, "SMS", "sendMessage: " . $content . " emay:" . $mobile . ':' . $result);
         return false;
     } else {
         $this->HitMessageCounter();
         $this->_log($mobile, $content, $schedule);
         return true;
     }
 }
コード例 #29
0
 /**
  * load module from the modules/$module/ directory
  *
  * @return void
  */
 public function loadModule($module)
 {
     $loader = new ModuleLoader($module);
     $loader->debug = false;
     if (!$loader->loadModule()) {
         $this->errors[] = nl2br($this->GetMessage("MODULE_LOAD_ERROR") . "\n" . $loader->errors . "\n" . $loader->logs);
     } else {
         $this->notices[] = $this->GetMessage("MODULE_LOAD_COMPLETE", $module);
         //." ".$loader->logs;
     }
     $roles = Openbiz::$app->getUserProfile("roles");
     $role_id = $roles[0];
     $this->giveActionAccess($module, $role_id);
     //reload current profile
     Openbiz::getService(ACL_SERVICE)->clearACLCache();
     $this->rerender();
 }
コード例 #30
0
 public function getFromList(&$list, $selectFrom = null)
 {
     if ($_POST['fld_repo_id']) {
         $repoRec = Openbiz::getObject("market.repository.do.RepositoryDO")->fetchById((int) $_POST['fld_repo_id']);
     } else {
         $repoRec = Openbiz::getObject("market.repository.do.RepositoryDO")->fetchOne("[status]=1");
     }
     $repo_uri = $repoRec['repository_uri'];
     $svc = Openbiz::getService("market.lib.PackageService");
     $catList = $svc->discoverCategory($repo_uri);
     if (is_array($catList)) {
         foreach ($catList as $cat) {
             $list[] = array("val" => $cat['Id'], "txt" => $cat['name']);
         }
     }
     return;
 }