コード例 #1
0
ファイル: init.php プロジェクト: hukumonline/idh
 function init()
 {
     define('KUTU_ROOT_DIR', dirname(__FILE__));
     error_reporting(E_ALL | E_STRICT);
     date_default_timezone_set('Asia/Jakarta');
     set_include_path('.' . PATH_SEPARATOR . KUTU_ROOT_DIR . '/library' . PATH_SEPARATOR . get_include_path());
     require_once 'Zend/Loader/Autoloader.php';
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->setFallbackAutoloader(true);
     $loader->suppressNotFoundWarnings(false);
     //		include "Zend/Loader.php";
     //		Zend_Loader::registerAutoload();
     require_once KUTU_ROOT_DIR . '/library/phpgacl/gacl.class.php';
     require_once KUTU_ROOT_DIR . '/library/phpgacl/gacl_api.class.php';
     require_once KUTU_ROOT_DIR . '/js/jcart/jcart.php';
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/application.ini', 'general');
     $registry = Zend_Registry::getInstance();
     $registry->set('config', $config);
     $registry->set('files', $_FILES);
     //$db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());
     //Zend_Db_Table_Abstract::setDefaultAdapter($db);
     $databases = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/application.ini', 'databases');
     $dbAdapters = array();
     foreach ($databases->db as $config_name => $db) {
         $dbAdapters[$config_name] = Zend_Db::factory($db->adapter, $db->config->toArray());
         if ((bool) $db->default) {
             Zend_Db_Table::setDefaultAdapter($dbAdapters[$config_name]);
         }
     }
     Zend_Registry::set('dbAdapters', $dbAdapters);
     $kutuUtil = new Kutu_Core_Util();
     define('KUTU_ROOT_URL', $kutuUtil->getRootUrl(KUTU_ROOT_DIR));
     require_once 'Kutu/Session/Manager.php';
     $kutuSession = new Kutu_Session_Manager();
     $kutuSession->start();
     // set the expiration time for auth session to expire
     $authNamespace = new Zend_Session_Namespace('Zend_Auth');
     $authNamespace->setExpirationSeconds(86400);
     // will expire in one day
     $frontendOptions = array('lifetime' => 7200, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => KUTU_ROOT_DIR . '/data/cache');
     $cacheDbTable = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     // Next, set the cache to be used with all table objects
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cacheDbTable);
     //		define('IN_PHPBB', true);
     //		define('PBB_ROOT_PATH', "../phpBB3");
     //		global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
     //		$phpEx = "php";
     //		$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : PBB_ROOT_PATH . '/';
     //		require_once($phpbb_root_path . 'config.' . $phpEx);
     //		include($phpbb_root_path . 'common.' . $phpEx);
     //		$user->session_begin();
     //		$auth->acl($user->data);
 }
コード例 #2
0
 public function listAction()
 {
     $r = $this->getRequest();
     $guid = $r->getParam('f');
     $g = $r->getParam('g');
     $guid = !empty($g) ? $r->getParam('g') : $guid;
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $row = $tblFolder->find($guid)->current();
     $this->view->folderTitle = $row->title;
     $this->view->currentNode = $guid;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/components/Pages/FolderBreadcrumbs.php';
     $wBread = new Site_Pages_FolderBreadcrumbs($guid, 'root');
     $this->view->breadcrumbs = $wBread;
     if ($r->getParam('h')) {
         $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
         $rowset = $tblCatalog->fetchFromFolder($guid, 0, 1);
         $modDir = $this->getFrontController()->getModuleDirectory();
         require_once $modDir . '/components/Pages/DetailsViewer.php';
         $w = new Site_Pages_DetailsViewer($rowset->current()->guid, 'root');
         $this->view->widget1 = $w;
         $this->view->showHeadline = 1;
         $this->view->listTitle = Kutu_Core_Util::getCatalogAttributeValue($rowset->current()->guid, 'fixedTitle');
     } else {
         //View catalogs
         $limit = $r->getParam('limit') ? $r->getParam('limit') : 12;
         $this->view->limit = $limit;
         $itemsPerPage = $limit;
         $this->view->itemsPerPage = $itemsPerPage;
         $offset = $r->getParam('offset') ? $r->getParam('offset') : 0;
         $this->view->offset = $offset;
         $this->view->currentNode = $guid;
         $sort = $r->getParam('sort') ? $r->getParam('sort') : "createdDate desc";
         //"regulationType desc, year desc";
         $this->view->sort = $sort;
         $db = Zend_Db_Table::getDefaultAdapter()->query("SELECT catalogGuid as guid from KutuCatalogFolder where folderGuid='{$guid}'");
         $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ);
         $solrAdapter = Kutu_Search::manager();
         $numi = count($rowset);
         $sSolr = "id:(";
         for ($i = 0; $i < $numi; $i++) {
             $row = $rowset[$i];
             $sSolr .= $row->guid . ' ';
         }
         $sSolr .= ')';
         if (!$numi) {
             $sSolr = "id:(hfgjhfdfka)";
         }
         $solrResult = $solrAdapter->findAndSort($sSolr, $offset, $limit, array($sort));
         //print_r($solrResult);die('gg');
         $solrNumFound = count($solrResult->response->docs);
         $this->view->totalItems = $solrResult->response->numFound;
         $this->view->hits = $solrResult;
     }
 }
コード例 #3
0
ファイル: baseinit.php プロジェクト: hukumonline/idh
 public function init()
 {
     define('KUTU_ROOT_DIR', dirname(__FILE__));
     date_default_timezone_set('Asia/Jakarta');
     error_reporting(E_ALL | E_STRICT);
     set_include_path('.' . PATH_SEPARATOR . KUTU_ROOT_DIR . '/library' . PATH_SEPARATOR . get_include_path());
     //		$paths = array(realpath(dirname(__FILE__) . '/library'), '.');
     //		set_include_path(implode(PATH_SEPARATOR, $paths));
     require_once 'Zend/Loader/Autoloader.php';
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->setFallbackAutoloader(true);
     $loader->suppressNotFoundWarnings(false);
     //		include "Zend/Loader.php";
     //		Zend_Loader::registerAutoload();
     require_once KUTU_ROOT_DIR . '/library/phpgacl/gacl.class.php';
     require_once KUTU_ROOT_DIR . '/library/phpgacl/gacl_api.class.php';
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/application.ini', 'general');
     $registry = Zend_Registry::getInstance();
     $registry->set('config', $config);
     $registry->set('files', $_FILES);
     //$db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());
     //Zend_Db_Table_Abstract::setDefaultAdapter($db);
     $databases = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/application.ini', 'databases');
     $dbAdapters = array();
     foreach ($databases->db as $config_name => $db) {
         $dbAdapters[$config_name] = Zend_Db::factory($db->adapter, $db->config->toArray());
         if ((bool) $db->default) {
             Zend_Db_Table::setDefaultAdapter($dbAdapters[$config_name]);
         }
     }
     Zend_Registry::set('dbAdapters', $dbAdapters);
     $kutuUtil = new Kutu_Core_Util();
     define('KUTU_ROOT_URL', $kutuUtil->getRootUrl(KUTU_ROOT_DIR));
     $frontendOptions = array('lifetime' => 7200, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => KUTU_ROOT_DIR . '/data/cache');
     $cacheDbTable = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     // Next, set the cache to be used with all table objects
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cacheDbTable);
 }
コード例 #4
0
 protected function completeItem()
 {
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     $bpm = new Kutu_Core_Bpm_Catalog();
     $result = array('subTotal' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $itemId = $cart->items[$iCart];
         $qty = 1;
         $itemPrice = $bpm->getPrice($itemId);
         //$itemPrice=20;
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = Kutu_Core_Util::getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $this->_paymentVars['taxRate'] / 100;
     $result['grandTotal'] = $result['subTotal'] + $result['taxAmount'];
     return $result;
 }
コード例 #5
0
ファイル: baseinit.php プロジェクト: psykomo/kutump-enhanced
<?php

define('KUTU_ROOT_DIR', dirname(__FILE__));
require_once KUTU_ROOT_DIR . '/lib/Kutu/Core/Util.php';
$KUTUUTIL = new Kutu_Core_Util();
define('KUTU_ROOT_URL', $KUTUUTIL->getRootUrl(KUTU_ROOT_DIR));
//print_r($_GET);
/**
 * manage config, memory usage for application
 * 
 * @author HAP
 * @package Kutu
 * 
 */
class Kutu_BaseInit
{
    public function init()
    {
        //define('KUTU_ROOT_DIR',dirname(__FILE__));
        date_default_timezone_set('Asia/Jakarta');
        error_reporting(E_ALL | E_STRICT);
        //set_include_path('.' . PATH_SEPARATOR . KUTU_ROOT_DIR.'/mix_lib' . PATH_SEPARATOR . get_include_path());
        $paths = array(realpath(dirname(__FILE__) . '/lib'), '.');
        set_include_path(implode(PATH_SEPARATOR, $paths));
        include KUTU_ROOT_DIR . '/lib/jcart/jcart.php';
        //include "Zend/Loader.php";
        //Zend_Loader::registerAutoload();
        require_once 'Zend/Loader/Autoloader.php';
        $loader = Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
        require_once KUTU_ROOT_DIR . '/lib/phpgacl/gacl.class.php';
        require_once KUTU_ROOT_DIR . '/lib/phpgacl/gacl_api.class.php';
コード例 #6
0
ファイル: GetControllerUrl.php プロジェクト: hukumonline/idh
 public function getControllerUrl()
 {
     $util = new Kutu_Core_Util();
     return $util->getControllerUrl();
 }
コード例 #7
0
ファイル: StoreController.php プロジェクト: psykomo/kutump
 public function completeorderAction()
 {
     //this is where we generate invoice
     // and then empty cart
     // and then if payment method is paypal, ask if user wants to continue to pay via paypal.
     // if payment method is manual, then print-out the payment instruction.
     // send invoice to user.
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     if (empty($cart) || count($cart->items) == 0) {
         //die("CART IS EMPTY");
         $this->_helper->redirector('cartempty', 'store', 'site');
     }
     $bpm = new Kutu_Core_Bpm_Catalog();
     $result = array('subTotal' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $itemId = $cart->items[$iCart];
         $qty = 1;
         $itemPrice = $bpm->getPrice($itemId);
         //$itemPrice=20;
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = Kutu_Core_Util::getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $result['grandTotal'] = $result['subTotal'] + $result['taxAmount'];
     $method = $this->_request->getParam('paymentMethod');
     $orderId = $this->saveOrder($result, $method);
     $cart = null;
     $data = $this->_request->getParams();
     $this->view->cart = $result;
     $this->view->data = $data;
     $this->view->orderId = $orderId;
     //send notification to user
     // 1. send invoice
     // 2. if paymentmethod=bank, also send instruction
     $mod = new Site_Model_Store_Mailer();
     switch (strtolower($method)) {
         case 'manual':
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'paypal':
             $mod->sendInvoiceToUser($orderId);
             break;
         case 'postpaid':
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
コード例 #8
0
 public function alterdateAction()
 {
     $urlReferer = $_SERVER['HTTP_REFERER'];
     $r = $this->getRequest();
     $guid = $r->getParam('guid');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->find($guid);
     if (count($rowset)) {
         $row = $rowset->current();
         $this->view->row = $row;
         $this->view->guid = $row->guid;
         $this->view->catalogTitle = Kutu_Core_Util::getCatalogAttributeValue($row->guid, 'fixedTitle');
         if ($r->isPost()) {
             $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
             $urlReferer = $sessHistory->urlReferer;
             $createdDate = $r->getParam('createdDate');
             $modifiedDate = $r->getParam('modifiedDate');
             $bpm = new Kutu_Core_Bpm_Catalog();
             $bpm->alterDate($r->getParams());
             $this->view->message = "Date has been altered.";
         } else {
         }
     }
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
 }
コード例 #9
0
ファイル: index.php プロジェクト: hukumonline/gtz
<?php

define('KUTU_ROOT_DIR', dirname(__FILE__));
define('KUTU_ROOT_PATH', dirname(__FILE__));
define('KUTU_LIB_PATH', KUTU_ROOT_PATH . '/library');
define('APPLICATION_PATH', KUTU_ROOT_PATH . '/app');
define('MODULE_PATH', KUTU_ROOT_PATH . '/app/modules');
// define the path for configuration file
define('CONFIG_PATH', KUTU_ROOT_PATH . '/app/configs');
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
// Include path
set_include_path(KUTU_LIB_PATH . PATH_SEPARATOR . get_include_path());
require_once 'Kutu/Core/Util.php';
$kutuUtil = new Kutu_Core_Util();
define('KUTU_ROOT_URL', $kutuUtil->getRootUrl(KUTU_ROOT_DIR));
/** Zend_Application */
define('ZEND_APPLICATION_REGISTER', 'application');
define('APPLICATION_CONFIG_FILENAME', 'config.ini');
// Zend_Application
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . '/' . APPLICATION_CONFIG_FILENAME);
$registry = Zend_Registry::getInstance();
$registry->set(ZEND_APPLICATION_REGISTER, $application);
$application->bootstrap()->run();
コード例 #10
0
ファイル: Util.php プロジェクト: psykomo/kutump
 static function splitWordsFromCatalog($catalogGuid, $iLimit)
 {
     $desc = Kutu_Core_Util::getCatalogAttributeValue($catalogGuid, 'fixedDescription');
     $content = Kutu_Core_Util::getCatalogAttributeValue($catalogGuid, 'fixedContent');
     $desc = Zend_Search_Lucene_Document_Html::loadHTML($desc);
     $content = Zend_Search_Lucene_Document_Html::loadHTML($content);
     $desc = $desc->getFieldValue('body');
     $content = $content->getFieldValue('body');
     if (!empty($desc)) {
         if ($iLimit > str_word_count($desc)) {
             return $desc;
         } else {
             return Kutu_Core_Util::getNumberOfWords($desc, $iLimit);
         }
     }
     if (!empty($content)) {
         if ($iLimit > str_word_count($content)) {
             return $content;
         } else {
             return Kutu_Core_Util::getNumberOfWords($content, $iLimit);
         }
     }
     return '';
 }