Exemplo n.º 1
0
 /**
  * Render the chart output
  *
  * @param string $objName object name which is the bizform name
  * @return void
  */
 public function render($objName)
 {
     // get the value of the control that issues the call
     $chartName = Openbiz::$app->getClientProxy()->getFormInputs("__this");
     // get the current UI bizobj
     $formObj = Openbiz::getObject($objName);
     // get the existing bizform object
     $bizDataObj = $formObj->getDataObj();
     // get chart config xml file
     $chartXmlFile = ObjectFactoryHelper::getXmlFileWithPath($objName . "_chart");
     $xmlArr = ObjectFactoryHelper::getXmlArray($chartXmlFile);
     ob_clean();
     // get the chart section from config xml file
     foreach ($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"] as $chart) {
         if (count($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"]) == 1) {
             $chart = $xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"];
         }
         // try to match the chartName, if no chartName given, always draw the first chart defined in xml file
         if ($chartName && $chart["ATTRIBUTES"]["NAME"] == $chartName || !$chartName) {
             if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'XY') {
                 $this->xyGraphRender($bizDataObj, $chart);
                 break;
             }
             if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'Pie') {
                 $this->pieGraphRender($bizDataObj, $chart);
                 break;
             }
         }
     }
 }
Exemplo n.º 2
0
/**
 * Openbiz Cubi Application Platform
 *
 * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 *
 * @package   \
 * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
 * @license   http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 * @link      http://code.google.com/p/openbiz-cubi/
 * @version   $Id: license_exception.php 5261 2013-01-23 07:00:16Z hellojixian@gmail.com $
 */
function ioncube_event_handler($err_code, $params)
{
    $current_file = $params['current_file'];
    $current_file = str_replace(Openbiz::$app->getModulePath(), "", $current_file);
    preg_match("|[\\\\/]?(.*?)[\\\\/]{1}|si", $current_file, $matches);
    $moduleName = $matches[1];
    Openbiz::$app->getSessionContext()->setVar("LIC_SOURCE_URL", $_SERVER['REQUEST_URI']);
    Openbiz::$app->getSessionContext()->setVar("LIC_MODULE", $moduleName);
    $rh_file = Openbiz::$app->getModulePath() . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR . 'register_handler.php';
    $rh_func = false;
    if (is_file($rh_file)) {
        include_once $rh_file;
        if (function_exists($moduleName . "_register_handler")) {
            $rh_func = true;
        }
    }
    $lic_file = Openbiz::$app->getModulePath() . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR . 'license.key';
    if (!is_file($lic_file) && $rh_func) {
        $formObj = Openbiz::getObject("common.form.LicenseInitializeForm");
        $formObj->sourceURL = $_SERVER['REQUEST_URI'];
        $formObj->errorCode = $err_code;
        $formObj->errorParams = $params;
        $viewObj = Openbiz::getObject("common.view.LicenseInitializeView");
        $viewObj->render();
    } else {
        $formObj = Openbiz::getObject("common.form.LicenseInvalidForm");
        $formObj->sourceURL = $_SERVER['REQUEST_URI'];
        $formObj->errorCode = $err_code;
        $formObj->errorParams = $params;
        $viewObj = Openbiz::getObject("common.view.LicenseInvalidView");
        $viewObj->render();
    }
    exit;
}
Exemplo n.º 3
0
 protected function executeJob($cronRecord)
 {
     $name = $cronRecord['name'];
     $maxRun = $cronRecord['max_run'];
     $numRun = $this->getRealNumRun($cronRecord);
     $command = $cronRecord['command'];
     $message = "To execute cron job name={$name}, maxrun={$maxRun}, numrun={$numRun}";
     $this->log($cronRecord, $message);
     // check job max_run and num_run
     if ($cronRecord['max_run'] <= 0 || $cronRecord['max_run'] <= $numRun) {
         $this->log($cronRecord, "Skip cron job {$name} due to reaching maxrun");
         return;
     }
     // mark job num_run++
     $this->updateNumRun($cronRecord, true);
     // execute the command and write log
     $command = Expression::evaluateExpression($command, null);
     $output = array();
     exec($command, $output);
     foreach ($output as $out) {
         $outputStr .= $out . "\n";
     }
     $this->log($cronRecord, "Exec results of '{$command}'\n" . $outputStr);
     // mark job num_run--
     $this->updateNumRun($cronRecord, false);
     // send email
     $emails = trim($cronRecord['sendmail']);
     if ($emails != "") {
         $this->log($cronRecord, "Send job output to '{$emails}'");
         $emailService = Openbiz::getObject(self::emailService);
         $emailService->CronJobEmail($emails, $name, $outputStr);
     }
 }
Exemplo n.º 4
0
 public function getLocationInfo($id)
 {
     $locationRec = Openbiz::getObject("backup.do.BackupDeviceDO")->fetchById($id);
     if ($locationRec) {
         $this->folder = Expression::evaluateExpression($locationRec['location'], null);
         $this->folder = Expression::evaluateExpression($locationRec['location'], null);
     }
 }
Exemplo n.º 5
0
 public function loadDialog($formName = null, $id = null)
 {
     $formObj1 = Openbiz::getObject($formName);
     $formObj1->setRecordId($id);
     //$formObj1->setParentForm($this->formObj->objectName);
     $output = $formObj1->render();
     if (!empty($output)) {
         Openbiz::$app->getClientProxy()->redrawForm("DIALOG", $output);
     }
 }
Exemplo n.º 6
0
 protected function inheritParentObj()
 {
     if (!$this->inheritFrom) {
         return;
     }
     $parentObj = Openbiz::getObject($this->inheritFrom);
     parent::inheritParentObj();
     $this->range = $this->range ? $this->range : $parentObj->range;
     $this->fixSearchRule = $this->fixSearchRule ? $this->fixSearchRule : $parentObj->fixSearchRule;
     $this->defaultFixSearchRule = $this->defaultFixSearchRule ? $this->defaultFixSearchRule : $parentObj->defaultFixSearchRule;
 }
Exemplo n.º 7
0
 /**
  * Render the pdf output
  *
  * @global BizSystem $g_BizSystem
  * @param string $viewName name of view object
  * @return void
  */
 public function renderView($viewName)
 {
     $viewObj = Openbiz::getObject($viewName);
     if ($viewObj) {
         $viewObj->setConsoleOutput(false);
         $sHTML = $viewObj->render();
         //$sHTML = "Test";
         //require_once("dompdf/dompdf_config.inc.php");
         $domPdf = new DOMPDF();
         $domPdf->load_html($sHTML);
         //$dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
         $domPdf->render();
         $this->output($domPdf);
         //$dompdf->stream("dompdf_out.pdf");
     }
 }
Exemplo n.º 8
0
 /**
  * Process URL to get the form param and add the form in the FormRefs
  *
  * @return void
  */
 protected function processURL()
 {
     // if url has form=...
     $paramForm = isset($_GET['form']) ? $_GET['form'] : null;
     $paramCForm = isset($_GET['cform']) ? $_GET['cform'] : null;
     if (!$paramForm) {
         return;
     }
     // add the form in FormRefs
     if ($paramForm) {
         if ($this->isInFormRefLibs($paramForm)) {
             $xmlArr["ATTRIBUTES"]["NAME"] = $paramForm;
             $xmlArr["ATTRIBUTES"]["SUBFORMS"] = $paramCForm ? $paramCForm : "";
             $formRef = new FormReference($xmlArr);
             $this->formRefs->set($paramForm, $formRef);
             if ($paramCForm) {
                 if ($this->isInFormRefLibs($paramCForm)) {
                     $xmlArr["ATTRIBUTES"]["NAME"] = $paramCForm;
                     $xmlArr["ATTRIBUTES"]["SUBFORMS"] = "";
                     $cformRef = new FormReference($xmlArr);
                     $this->formRefs->set($paramCForm, $cformRef);
                 }
             }
         }
     }
     // check url arg as fld:name=val
     $getKeys = array_keys($_GET);
     $paramFields = null;
     foreach ($getKeys as $key) {
         if (substr($key, 0, 4) == "fld:") {
             $fieldName = substr($key, 4);
             $fieldValue = $_GET[$key];
             $paramFields[$fieldName] = $fieldValue;
         }
     }
     if (!$paramFields) {
         return;
     }
     $paramForm = $this->prefixPackage($paramForm);
     $formObj = Openbiz::getObject($paramForm);
     $formObj->setRequestParams($paramFields);
 }
Exemplo n.º 9
0
 /**
  * Audit DataObj
  *
  * @param string $dataObjName
  * @return boolean
  * @todo all return false? really?
  */
 public function audit($dataObjName)
 {
     // get audit dataobj
     $auditDataObj = Openbiz::getObject($this->auditDataObj);
     if (!$auditDataObj) {
         return false;
     }
     // get the source dataobj
     $srcDataObj = Openbiz::getObject($dataObjName);
     if (!$srcDataObj) {
         return false;
     }
     // for each onaudit field, add a record in audit dataobj
     $auditFields = $srcDataObj->getOnAuditFields();
     foreach ($auditFields as $field) {
         if ($field->oldValue == $field->value) {
             continue;
         }
         $recArr = $auditDataObj->newRecord();
         if ($recArr == false) {
             Openbiz::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
             return false;
         }
         $profile = Openbiz::$app->getUserProfile();
         $recArr['DataObjName'] = $dataObjName;
         $recArr['ObjectId'] = $srcDataObj->getFieldValue("Id");
         $recArr['FieldName'] = $field->objectName;
         $recArr['OldValue'] = $field->oldValue;
         $recArr['NewValue'] = $field->value;
         $recArr['ChangeTime'] = date("Y-m-d H:i:s");
         $recArr['ChangeBy'] = $profile["USERID"];
         $recArr['ChangeFrom'] = $_SERVER['REMOTE_ADDR'];
         $recArr['RequestURI'] = $_SERVER['REQUEST_URI'];
         $recArr['Timestamp'] = date("Y-m-d H:i:s");
         $ok = $auditDataObj->insertRecord($recArr);
         if ($ok == false) {
             Openbiz::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
             return false;
         }
     }
 }
Exemplo n.º 10
0
 protected function prepareSubFormsDataObj()
 {
     if ($this->subForms && $this->getDataObj()) {
         foreach ($this->subForms as $subForm) {
             $formObj = Openbiz::getObject($subForm);
             $dataObj = $this->getDataObj()->getRefObject($formObj->dataObjName);
             if ($dataObj) {
                 $formObj->setDataObj($dataObj);
             }
         }
     }
 }
Exemplo n.º 11
0
 /**
  * Cancel, clean up the sessions of view and all forms
  *
  * @return void
  */
 public function cancel()
 {
     // call all step forms Cancel method
     if (is_array($this->formStates)) {
         foreach ($this->formStates as $formName => $state) {
             if ($state['visited']) {
                 Openbiz::getObject($formName)->cancel();
             }
         }
     }
     $this->dropSession = true;
 }
Exemplo n.º 12
0
<?php

/**
 * Openbiz Cubi Application Platform
 *
 * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 *
 * @package   example
 * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
 * @license   http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 * @link      http://code.google.com/p/openbiz-cubi/
 * @version   $Id: index.php 5185 2013-01-19 15:34:13Z hellojixian@gmail.com $
 */
//include openbiz initail script
require_once dirname(dirname(__FILE__)) . '/bin/app_init.php';
$objectName = "system.form.UserListForm";
//get the form object instance
$userForm = Openbiz::getFormObject($objectName);
//render the form to a html string
$formHTML = $userForm->render();
//output the html string
echo $formHTML;
Exemplo n.º 13
0
 /**
  * Audit trail
  *
  * @param array $argList
  * @return void
  */
 protected function auditTrail($argList)
 {
     $auditServiceName = $argList["AuditService"];
     $auditService = Openbiz::getObject($auditServiceName);
     if ($auditService == null) {
         return;
     }
     $dataObjName = $argList["DataObjectName"];
     $ok = $auditService->audit($dataObjName);
     if ($ok == false) {
         // log $auditSvc->getErrorMsg();
     }
 }
Exemplo n.º 14
0
 /**
  * Render single menu item
  *
  * @param array $menuItem menu item metadata xml array
  * @return string html content of each menu item
  */
 protected function renderSingleMenuItem(&$menuItem)
 {
     $profile = Openbiz::$app->getUserProfile();
     $svcobj = Openbiz::getService(ACCESS_SERVICE);
     $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null;
     if (isset($menuItem["ATTRIBUTES"]['URL'])) {
         $url = $menuItem["ATTRIBUTES"]["URL"];
     } elseif (isset($menuItem["ATTRIBUTES"]['VIEW'])) {
         $view = $menuItem["ATTRIBUTES"]["VIEW"];
         // menuitem's containing VIEW attribute is renderd if access is granted in accessservice.xml
         // menuitem's are rendered if no definition is found in accessservice.xml (default)
         if ($svcobj->allowViewAccess($view, $role)) {
             $url = "javascript:GoToView('" . $view . "')";
         } else {
             return '';
         }
     }
     $caption = $this->translate($menuItem["ATTRIBUTES"]["CAPTION"]);
     $target = $menuItem["ATTRIBUTES"]["TARGET"];
     $icon = $menuItem["ATTRIBUTES"]["ICON"];
     $img = $icon ? "<img src='" . Openbiz::$app->getImageUrl() . "/{$icon}' class=menu_img> " : "";
     if ($view) {
         $url = "javascript:GoToView('" . $view . "')";
     }
     if ($target) {
         $sHTML .= "<li><a href=\"" . $url . "\" target='{$target}'>{$img}" . $caption . "</a>";
     } else {
         $sHTML .= "<li><a href=\"" . $url . "\">{$img}" . $caption . "</a>";
     }
     if ($menuItem["MENUITEM"]) {
         $sHTML .= "\n<ul>\n";
         $sHTML .= $this->renderMenuItems($menuItem["MENUITEM"]);
         $sHTML .= "</ul>";
     }
     $sHTML .= "</li>\n";
     return $sHTML;
 }
Exemplo n.º 15
0
 /**
  * Render the html tabs
  *
  * @global BizSystem $g_BizSystem
  * @return string html content of the tabs
  */
 public function render()
 {
     $curView = Openbiz::$app->getCurrentViewName();
     $curViewobj = $curView ? Openbiz::getObject($curView) : null;
     $profile = Openbiz::$app->getUserProfile();
     $svcobj = Openbiz::getService(ACCESS_SERVICE);
     $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null;
     // list all views and highlight the current view
     // pass $tabs(caption, url, target, icon, current) to template
     $smarty = TemplateHelper::getSmartyTemplate();
     $tabs = array();
     $i = 0;
     $hasForms = false;
     foreach ($this->tabViews as $tview) {
         // tab is renderd if  no definition  is found in accessservice.xml (default)
         if ($svcobj->allowViewAccess($tview->view, $role)) {
             $tabs[$i]['name'] = $tview->objectName;
             //Name of each tab--jmmz
             $tabs[$i]['forms'] = $this->_renderJSCodeForForms($tview->forms);
             //Configuration of the forms to hide or show--jmmz
             $tabs[$i]['caption'] = $tview->caption;
             $tabs[$i]['url'] = $this->_renderURL($tview);
             //Call the method to render the url--jmmz
             //If I have forms to hide or show I add the event because I don't need an URL, I need an event
             if ((bool) $tview->hasForms()) {
                 $tabs[$i]['event'] = $tabs[$i]['url'];
                 //Assign The url rendered to the event on click
                 $tabs[$i]['url'] = 'javascript:void(0)';
                 //If I put url in '' then the href want send me to another direction
                 $this->setCurrentTabInSession($tview, $curViewobj, $curView);
                 //I set the current tab wrote in session
                 $hasForms = TRUE;
             }
             $tabs[$i]['target'] = $tview->target;
             $tabs[$i]['icon'] = $tview->icon;
             $tabs[$i]['current'] = $this->isCurrentTab($tview, $curViewobj, $curView);
             //I get the current tab.
             $i++;
         }
     }
     $this->setClientScripts($tabs, $hasForms);
     $smarty->assign("tabs", $tabs);
     $smarty->assign("tabs_Name", $this->objectName);
     return $smarty->fetch(TemplateHelper::getTplFileWithPath($this->templateFile, $this->package));
 }
Exemplo n.º 16
0
 /**
  * Add a record (popup) to the parent form if OK button clicked, (M-M or M-1/1-1)
  *
  * @return void
  */
 public function addToParent($recIds = null)
 {
     if (!is_array($recIds)) {
         $recIdArr = array();
         $recIdArr[] = $recIds;
     } else {
         $recIdArr = $recIds;
     }
     /* @var $parentForm EasyForm */
     $parentForm = Openbiz::getObject($this->parentFormName);
     foreach ($recIdArr as $recId) {
         //clear parent form search rules
         $this->searchRule = "";
         $parentForm->getDataObj()->clearSearchRule();
         $do = $this->getDataObj();
         $baseSearchRule = $do->baseSearchRule;
         $do->baseSearchRule = "";
         $do->clearSearchRule();
         $rec = $do->fetchById($recId);
         $do->baseSearchRule = $baseSearchRule;
         if (!$rec) {
             $rec = Openbiz::getObject($do->objectName, 1)->fetchById($recId);
         }
         // add record to parent form's dataObj who is M-M or M-1/1-1 to its parent dataobj
         $ok = $parentForm->getDataObj()->addRecord($rec, $bPrtObjUpdated);
         if (!$ok) {
             return $parentForm->processDataObjError($ok);
         }
     }
     $this->close();
     $parentForm->rerender();
     if ($parentForm->parentFormName) {
         $parentForm->renderParent();
     }
 }
 * @version   $Id: oauth_callback_handler.php 4032 2012-08-26 06:33:15Z hellojixian@gmail.com $
 */
include_once 'bin/app_init.php';
include_once OPENBIZ_PATH . "/bin/ErrorHandler.php";
$type = Openbiz::$app->getClientProxy()->getRequestParam("type");
$service = Openbiz::$app->getClientProxy()->getRequestParam("service");
$redirectURL = Openbiz::$app->getClientProxy()->getRequestParam("redirect_url");
if ($redirectURL) {
    Openbiz::$app->getSessionContext()->setVar("oauth_redirect_url", $redirectURL);
}
$assocURL = Openbiz::$app->getClientProxy()->getRequestParam("assoc_url");
if ($assocURL) {
    Openbiz::$app->getSessionContext()->setVar("oauth_assoc_url", $assocURL);
}
//$whitelist_arr=array('qq','sina','alipay','google','facebook','qzone','twitter');
$whitelist_arr = Openbiz::getService(CUBI_LOV_SERVICE)->getDictionary("oauth.lov.ProviderLOV(Provider)");
if (!in_array($type, $whitelist_arr)) {
    throw new Exception('Unknown service');
    return;
}
$oatuthType = Openbiz::$app->getModulePath() . "/oauth/libs/{$type}.class.php";
if (!file_exists($oatuthType)) {
    throw new Exception('Unknown type');
    return;
}
include_once $oatuthType;
$obj = new $type();
switch (strtolower($service)) {
    case "callback":
    case "login":
        break;
Exemplo n.º 18
0
#!/usr/bin/env php
<?php 
/*
 * Cubi package discovery
 */
include_once "../app_init.php";
if (!defined("CLI")) {
    exit;
}
$packageService = "package.lib.PackageService";
// get package service
$pkgsvc = Openbiz::getObject($packageService);
$categories = $pkgsvc->discoverCategories();
print_r($categories);
$packages = $pkgsvc->discoverPackages();
print_r($packages);
//$pkgsvc->downloadPackage('grm');
Exemplo n.º 19
0
#!/usr/bin/env php
<?php 
/*
 * Cubi license acquisition
 */
include_once "../app_init.php";
if (!defined("CLI")) {
    exit;
}
$licenseClient = "service.licenseClient";
// get package service
//echo "get license client service";
$licsvc = Openbiz::getObject($licenseClient);
$activationCode = "hacq2b";
$contactEmail = "*****@*****.**";
$serverData = "";
//base64_encode(ioncube_server_data());
$license = $licsvc->acquireLicense($activationCode, $contactEmail, $serverData);
print_r($license);
Exemplo n.º 20
0
 /**
  * Get raw data to display in the spreadsheet. header and data table
  *
  * @param string $objName
  * @return array
  */
 protected function getDataTable($objName)
 {
     /* @var $formObj EasyForm */
     $formObj = Openbiz::getObject($objName);
     // get the existing EasyForm|BizForm object
     // if BizForm, call BizForm::renderTable
     if ($formObj instanceof BizForm) {
         $dataTable = $formObj->renderTable();
     }
     // if EasyForm, call EasyForm->DataPanel::renderTable
     if ($formObj instanceof EasyForm) {
         $recordSet = $formObj->fetchDataSet();
         $dataSet = $formObj->dataPanel->renderTable($recordSet);
         foreach ($dataSet['elems'] as $elem) {
             $labelRow[] = $elem['label'];
         }
         $dataTable = array_merge(array($labelRow), $dataSet['data']);
     }
     return $dataTable;
 }
Exemplo n.º 21
0
 /**
  * Authenticate User that stored in database
  *
  * @param string $userName
  * @param string $password
  * @return boolean
  */
 protected function authDBUser($userName, $password)
 {
     $boAuth = Openbiz::getObject($this->authticationDataObj);
     if (!$boAuth) {
         return false;
     }
     $searchRule = "[login]='{$userName}'";
     $recordList = array();
     $boAuth->fetchRecords($searchRule, $recordList, 1);
     $encType = $recordList[0]["enctype"];
     $realPassword = $recordList[0]["password"];
     if ($this->checkPassword($encType, $password, $realPassword)) {
         return true;
     }
     return false;
 }
Exemplo n.º 22
0
    $app = \Slim\Slim::getInstance();
    // forward to module rest service implementation
    $restServiceName = $module . ".websvc." . "RestService";
    $restSvc = Openbiz::getObject($restServiceName);
    $restSvc->get($resource, $id, $app->request(), $app->response());
});
// POST request
$app->post('/:module/:resource', function ($module, $resource) {
    $app = \Slim\Slim::getInstance();
    // forward to module rest service implementation
    $restServiceName = $module . ".websvc." . "RestService";
    $restSvc = Openbiz::getObject($restServiceName);
    $restSvc->post($resource, $app->request(), $app->response());
});
// PUT request
$app->put('/:module/:resource/:id', function ($module, $resource, $id) {
    $app = \Slim\Slim::getInstance();
    // forward to module rest service implementation
    $restServiceName = $module . ".websvc." . "RestService";
    $restSvc = Openbiz::getObject($restServiceName);
    $restSvc->put($resource, $id, $app->request(), $app->response());
});
// DELETE request
$app->delete('/:module/:resource/:id', function ($module, $resource, $id) {
    $app = \Slim\Slim::getInstance();
    // forward to module rest service implementation
    $restServiceName = $module . ".websvc." . "RestService";
    $restSvc = Openbiz::getObject($restServiceName);
    $restSvc->delete($resource, $id, $app->request(), $app->response());
});
$app->run();
Exemplo n.º 23
0
 /**
  * Validate input on EasyForm level
  * default form validation do nothing.
  * developers need to override this method to implement their logic
  *
  * @return boolean
  */
 protected function validateForm($cleanError = true)
 {
     if ($cleanError == true) {
         $this->validateErrors = array();
     }
     $this->dataPanel->rewind();
     while ($this->dataPanel->valid()) {
         /* @var $element Element */
         $element = $this->dataPanel->current();
         if ($element->label) {
             $elementName = $element->label;
         } else {
             $elementName = $element->text;
         }
         if ($element->checkRequired() === true && ($element->value == null || $element->value == "")) {
             $errorMessage = $this->getMessage("FORM_ELEMENT_REQUIRED", array($elementName));
             $this->validateErrors[$element->objectName] = $errorMessage;
             //return false;
         } elseif ($element->value !== null && $element->Validate() == false) {
             $validateService = Openbiz::getService(VALIDATE_SERVICE);
             $errorMessage = $this->getMessage("FORM_ELEMENT_INVALID_INPUT", array($elementName, $value, $element->validator));
             if ($errorMessage == false) {
                 //Couldn't get a clear error message so let's try this
                 $errorMessage = $validateService->getErrorMessage($element->validator, $elementName);
             }
             $this->validateErrors[$element->objectName] = $errorMessage;
             //return false;
         }
         $this->dataPanel->next();
     }
     if (count($this->validateErrors) > 0) {
         throw new Openbiz\Validation\Exception($this->validateErrors);
         return false;
     }
     return true;
 }
Exemplo n.º 24
0
<?php

/**
 * Openbiz Cubi Application Platform
 *
 * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 *
 * @package   example
 * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
 * @license   http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 * @link      http://code.google.com/p/openbiz-cubi/
 * @version   $Id: index.php 5185 2013-01-19 15:34:13Z hellojixian@gmail.com $
 */
//include openbiz initail script
require_once dirname(dirname(__FILE__)) . '/bin/app_init.php';
$objectName = "system.view.UserListView";
//get the view object instance
$userView = Openbiz::getViewObject($objectName);
//render the view to a html string
$viewHTML = $userView->render();
//output the html string
echo $viewHTML;
Exemplo n.º 25
0
<?php

/**
 * Openbiz Cubi Application Platform
 *
 * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 *
 * @package   example
 * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
 * @license   http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
 * @link      http://code.google.com/p/openbiz-cubi/
 * @version   $Id: index.php 5185 2013-01-19 15:34:13Z hellojixian@gmail.com $
 */
//include openbiz initail script
require_once dirname(dirname(__FILE__)) . '/bin/app_init.php';
$objectName = "system.view.UserListView";
//get the view object instance
$userView = Openbiz::getWebpageObject($objectName);
//render the view to a html string
$viewHTML = $userView->render();
//output the html string
echo $viewHTML;
Exemplo n.º 26
0
 * it reads the cronjob table and runs command based on the command settings 
 */
include_once dirname(dirname(__FILE__)) . "/app_init.php";
if ($argc < 3) {
    echo "usage: php run_svc.php service_name method parameter1 parameter2 ...\n";
    exit;
}
// read service name and parameters
$svcName = $argv[1];
$methodName = $argv[2];
$arg_list = array();
for ($i = 3; $i < $argc; $i++) {
    $arg_list[] = $argv[$i];
}
// get service object
$obj = Openbiz::getService($svcName);
if ($obj) {
    if (method_exists($obj, $methodName)) {
        echo "START - Call {$svcName}" . "::" . "{$methodName}(" . implode(',', $arg_list) . ")\n";
        switch (count($arg_list)) {
            case 0:
                $rt_val = $obj->{$methodName}();
                break;
            case 1:
                $rt_val = $obj->{$methodName}($arg_list[0]);
                break;
            case 2:
                $rt_val = $obj->{$methodName}($arg_list[0], $arg_list[1]);
                break;
            case 3:
                $rt_val = $obj->{$methodName}($arg_list[0], $arg_list[1], $arg_list[2]);
Exemplo n.º 27
0
$inputs = explode("/", $url);
$module = $inputs[0];
$service = isset($inputs[1]) ? $inputs[1] : $_REQUEST['service'];
if (isset($inputs[2]) && !preg_match("/^\\?.*/si", $inputs[2])) {
    //http://local.openbiz.me/ws.php/oauth/callback/login/?type=qzone
    $_REQUEST['method'] = $inputs[2];
}
if (count($inputs) >= 3) {
    for ($i = 3; $i < count($inputs); $i++) {
        $param = $inputs[$i];
        if ($param) {
            preg_match("/^(.*?)_(.*)\$/s", $param, $match);
            $key = $match[1];
            $value = $match[2];
            $_REQUEST[$key] = $value;
        }
    }
}
ErrorHandler::$errorMode = 'text';
if ($module && $service) {
    if (!preg_match("/Service\$/s", $service)) {
        $service .= "Service";
    }
    $websvc = $module . ".websvc." . $service;
    // get service object
    $svcObj = Openbiz::getObject($websvc);
    // invoke the method
    $svcObj->invoke();
} else {
    echo "Openbiz Webservice Ready!";
}
Exemplo n.º 28
0
 /**
  * Import from XML file, the file read from client (uploaded by user)
  *
  * @param string $objName
  * @return void
  */
 public function importXML($objName)
 {
     // read in file from $_FILE
     // read in file data and attributes
     foreach ($_FILES as $file) {
         $error = $file['error'];
         if ($error != 0) {
             $this->reportError($error);
             return;
         }
         $tmpName = $file['tmp_name'];
         $xml = simplexml_load_file($tmpName);
         if (!$xml) {
             $errorMsg = "Invalid input data format, could not create xml object.";
             Openbiz::$app->getClientProxy()->showErrorMessage($errorMsg);
             return;
         }
         // only read the first one
         break;
     }
     // get the current UI bizobj
     /* @var $form EasyForm */
     $form = Openbiz::getObject($objName);
     // get the existing bizform object
     /* @var $parentForm EasyForm */
     $parentForm = Openbiz::getObject($form->GetParentForm());
     /* @var $dataObj BizDataObj */
     $dataObj = $parentForm->getDataObj();
     //$oldCacheMode = $dataObj->GetCacheMode();
     //$dataObj->SetCacheMode(0);    // turn off cache mode, not affect the current cache
     // check if BizDataObj name matches
     $dataObjName = $xml['Name'];
     if ($dataObj->objectName != ${$dataObjName}) {
         $errorMsg = "Invalid input data. Input data object is not same as the current data object.";
         Openbiz::$app->getClientProxy()->showErrorMessage($errorMsg);
         return;
     }
     // read records
     foreach ($xml->Record as $record) {
         // insert record
         // todo: check if there's same user keys in the table
         $recArray = null;
         $recArray = $dataObj->newRecord();
         foreach ($record as $field) {
             $value = "";
             foreach ($field->attributes() as $attributeName => $attributeValue) {
                 if ($attributeName == 'Name') {
                     $name = $attributeValue . "";
                 } else {
                     if ($attributeName == 'Value') {
                         $value = $attributeValue . "";
                     }
                 }
             }
             if ($name != "Id") {
                 $recArray[$name] = $value;
             }
         }
         if (!$dataObj->insertRecord($recArray)) {
             $errorMsg = $dataObj->getErrorMessage();
             Openbiz::$app->getClientProxy()->showErrorMessage($errorMsg);
             return;
         }
     }
     $form->setFormState(1);
     // indicate the import is done
 }
Exemplo n.º 29
0
     $svcobj = Openbiz::getService(AUTH_SERVICE);
     $result = $svcobj->authenticateUser($username, $password_preset);
     if ($result) {
         echo "Authentication Sucessed! " . PHP_EOL;
         echo "Access Grant! " . PHP_EOL;
         break;
     } else {
         echo PHP_EOL . "Access Denied! " . PHP_EOL;
         exit;
     }
 }
 system('stty -echo');
 $password_input = trim(fgets(STDIN));
 system('stty echo');
 echo PHP_EOL;
 $svcobj = Openbiz::getService(AUTH_SERVICE);
 $result = $svcobj->authenticateUser($username, $password_input);
 if ($result) {
     echo "Authentication Sucessed! " . PHP_EOL;
     echo "Access Grant! " . PHP_EOL;
     break;
 } else {
     echo "Authentication Failed! ";
 }
 $auth_counter++;
 if ($auth_counter > 3) {
     echo PHP_EOL . "Access Denied! " . PHP_EOL;
     exit;
 } else {
     echo "Please Try again ({$auth_counter}/3) " . PHP_EOL;
     echo "Password: ";
Exemplo n.º 30
0
 private static function _removeRecord1toM($dataObj, $recArr)
 {
     $column = $dataObj->association['Column'];
     $field = $dataObj->getFieldNameByColumn($column);
     $column2 = $dataObj->association['Column2'];
     $field2 = $dataObj->getFieldNameByColumn($column2);
     $newRecArr["Id"] = $recArr["Id"];
     $newRecArr[$field] = '';
     if ($field2) {
         $newRecArr[$field2] = '';
     }
     $cond_column = $dataObj->association['CondColumn'];
     $cond_value = $dataObj->association['CondValue'];
     if ($cond_column) {
         $cond_field = $dataObj->getFieldNameByColumn($cond_column);
         $newRecArr[$cond_field] = $cond_value;
     }
     $ok = Openbiz::getObject($dataObj->objectName, 1)->updateRecord($newRecArr, $recArr);
     if ($ok == false) {
         return false;
     }
     // requery on this object
     return true;
 }