public function applyRule(ISC_QUOTE $quote)
	{
		if (!customerIsSignedIn()) {
			return null;
		}

		$customerId = getClass('ISC_CUSTOMER')->getCustomerId();
		$query = "
			SELECT COUNT(*)
			FROM [|PREFIX|]orders
			WHERE ordcustid='".$customerId."' AND ordstatus > 0 AND deleted = 0
			LIMIT 1
		";
		$orderCount = $GLOBALS['ISC_CLASS_DB']->fetchOne($query);

		// Discount does not apply
		if($orderCount <= $this->orders) {
			return false;
		}

		$items = $quote->getItems();
		$totalDiscount = 0;
		// The discount needs to come off each item, so that tax is also affected.
		foreach($items as $item) {
			$discountAmount = $item->getDiscountedBaseTotal() * ($this->amount / 100);
			$item->addDiscount($this->getDbId(), $discountAmount);
			$totalDiscount += $discountAmount;
		}

		$quote->addDiscount($this->getDbId(), $totalDiscount);
		$this->banners[] = sprintf(getLang($this->getName().'DiscountMessage'), $this->amount);
		return true;
	}
Ejemplo n.º 2
0
	public function setUp()
	{
		parent::setUp();
		$this->_engine = getClass('ISC_ADMIN_ENGINE');
		$this->_engine->LoadLangFile('settings.emailintegration');
		$this->_log = $GLOBALS['ISC_CLASS_LOG'];
	}
Ejemplo n.º 3
0
	public function autoSaltUserPassword()
	{
		$query = '
			SELECT
				pk_userid, salt, userpass
			FROM
				`[|PREFIX|]users`
			WHERE
				salt = ""
		';
		$result = $GLOBALS['ISC_CLASS_DB']->query($query);
		$total = $GLOBALS['ISC_CLASS_DB']->countResult($result);
		$count = 0;
		while ($user = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
			// auto salt md5-ed user password with a 15 len salt
			$updatedUser = $user;
			$updatedUser['salt'] = substr(md5(uniqid()), 0, 15);
			$updatedUser['userpass'] = getClass('ISC_ADMIN_USER')->generatePasswordHash($user['userpass'], $updatedUser['salt']);
			$GLOBALS['ISC_CLASS_DB']->updateQuery('users', $updatedUser, "pk_userid='".$GLOBALS['ISC_CLASS_DB']->quote($user['pk_userid'])."'");
			$count++;
		}

		echo "\tAuto-salted password for $count/$total user(s)\n";
		if ($count == $total) {
			return true;
		}

		return false;
	}
Ejemplo n.º 4
0
 /**
  * @brief 위젯의 실행 부분
  *
  * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
  * 결과를 만든후 print가 아니라 return 해주어야 한다
  **/
 function proc($args)
 {
     $oDocument =& getClass('document');
     $site_module_info = Context::get('site_module_info');
     Context::set('widget_info', $widget_info);
     $args->site_srl = (int) $site_module_info->site_srl;
     // 회원수 추출
     $output = executeQuery('widgets.site_info.getMemberCount', $args);
     $widget_info->member_count = $output->data->cnt;
     // 새글 추출
     $args->regdate = date("YmdHis", time() - 24 * 60 * 60);
     $output = executeQuery('widgets.site_info.getNewDocument', $args);
     $widget_info->new_documents = $output->data->cnt;
     // 개설일
     $output = executeQuery('widgets.site_info.getCreatedDate', $args);
     $widget_info->created = $output->data->regdate;
     // 가입 여부
     $logged_info = Context::get('logged_info');
     if (count($logged_info->group_list)) {
         $widget_info->joined = true;
     } else {
         $widget_info->joined = false;
     }
     Context::set('widget_info', $widget_info);
     Context::set('colorset', $args->colorset);
     // 템플릿 컴파일
     $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
     $tpl_file = 'site_info';
     $oTemplate =& TemplateHandler::getInstance();
     return $oTemplate->compile($tpl_path, $tpl_file);
 }
Ejemplo n.º 5
0
 /**
  * Get the board module admin simple setting page
  * @return void
  */
 public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl)
 {
     if (!$moduleSrl) {
         return;
     }
     Context::set('module_srl', $moduleSrl);
     // default module info setting
     $oModuleModel = getModel('module');
     $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
     $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status);
     if ($moduleInfo) {
         Context::set('module_info', $moduleInfo);
     }
     // get document status list
     $oDocumentModel = getModel('document');
     $documentStatusList = $oDocumentModel->getStatusNameList();
     Context::set('document_status_list', $documentStatusList);
     // set order target list
     foreach ($this->order_target as $key) {
         $order_target[$key] = Context::getLang($key);
     }
     $order_target['list_order'] = Context::getLang('document_srl');
     $order_target['update_order'] = Context::getLang('last_update');
     Context::set('order_target', $order_target);
     // for advanced language & url
     $oAdmin = getClass('admin');
     Context::set('setupUrl', $setupUrl);
     // Extract admin ID set in the current module
     $admin_member = $oModuleModel->getAdminId($moduleSrl);
     Context::set('admin_member', $admin_member);
     $oTemplate =& TemplateHandler::getInstance();
     $html = $oTemplate->compile($this->module_path . 'tpl/', 'board_setup_basic');
     return $html;
 }
Ejemplo n.º 6
0
function onlineMapRenderCallback($data, $x, $y)
{
    $imgX = 16;
    $imgY = 16;
    $x = round($x - $imgX / 2, 0);
    $y = round($y - $imgY / 2, 0);
    $gender = $data['gender'];
    $class = $data['class'];
    $race = $data['race'];
    $level = $data['level'];
    $faction = getPlayerFaction($race);
    $map_name = getMapName($data['map']);
    $area_name = getAreaNameFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
    $img = $faction == 0 ? "gps_icon1.png" : "gps_icon.png";
    $text = "<table class=online_map>";
    $text .= "<tr><td class=" . ($faction == 0 ? "aname" : "hname") . ">" . $data['name'] . "</td></<tr>";
    if ($area_name) {
        $text .= "<tr><td align=center>{$area_name}<br>";
    }
    $text .= "<tr><td align=center>";
    $text .= "<img width=20 src=" . getRaceImage($race, $gender) . "> <img width=20 src=" . getClassImage($class) . "><br>";
    $text .= getRace($race) . "<br>";
    $text .= getClass($class) . "<br>";
    $text .= "Level - {$level}<br>";
    $text .= "</td></tr>";
    $text .= "</table>";
    return '<img src="images/map_points/' . $img . '" class=point style="left: ' . $x . '; top: ' . $y . ';" ' . addTooltip($text) . '>' . "\n";
}
Ejemplo n.º 7
0
 public function sms()
 {
     $model = M('Sms_mb');
     $mb = $model->where('model="Student"')->find();
     if ($mb) {
         $map['id'] = array('in', $_POST['ids']);
         $name = $this->getActionName();
         $model = M($name);
         $vo = $model->where($map)->select();
         if ($vo > getSmsNum()) {
             $this->error('您的短信剩余条数不足以完成本次发送,剩余条数' . getSmsNum());
         } else {
             foreach ($vo as $key => $value) {
                 $name = getStudentinfo($value['id'], 'nickname');
                 $xuehao = getStudentinfo($value['id'], 'account');
                 $class = getClass(getStudentinfo($value['id'], 'class_id'));
                 $gender = getStudentinfo($value['id'], 'gender');
                 $tel = getStudentinfo($value['id'], 'tel');
                 $content = str_replace('{name}', $name, $mb['content']);
                 $content = str_replace('{xuehao}', $xuehao, $content);
                 $content = str_replace('{class}', $class, $content);
                 $content = str_replace('{gender}', $gender, $content);
                 $content = str_replace('{tel}', $tel, $content);
                 sendSms($tel, $content);
             }
             $this->success('发送成功!');
         }
     } else {
         $this->error('请先设置模板');
     }
 }
Ejemplo n.º 8
0
 private static function ClassData($class)
 {
     $fields = Request::getRequest('page', 'int');
     $page = isset($fields) && $fields > 0 ? $fields : 1;
     $article = self::$models->Article;
     $mem = self::$models->Memcache;
     $configclass = getClass();
     $meunclass = $configclass['menu_class'];
     $articleclass = $configclass['article_class'];
     if (empty($meunclass[$class]) && empty($articleclass[$class])) {
         View::AdminErrorMessage('goback', '入口错误误误!');
     }
     $ret = $mem->get('classController_ClassData_' . $class . $page);
     $memc = $class;
     if (!empty($meunclass[$class]) && is_array($meunclass[$class])) {
         $class = $meunclass[$class];
         array_shift($class);
         $class = array_flip($class);
     }
     if (empty($ret)) {
         $ret = array();
         $ret['articleClassList'] = $article->getArticleClassList($class, $page);
         $ret['pageNav'] = @array_pop($ret['articleClassList']);
         $mem->set('classController_ClassData_' . $memc . $page, $ret);
     }
     $ret['meunclass'] = $meunclass;
     $ret['articleclass'] = $articleclass;
     $ret['nav'] = $class;
     View::Transmit('newclassshow', $ret);
 }
Ejemplo n.º 9
0
 function dispLicenseAdminConfig()
 {
     $oLicenseModel =& getModel('license');
     $oModuleModel =& getModel('module');
     $config = $oLicenseModel->getModuleConfig();
     Context::set('config', $config);
     $products = array();
     // 'nstore', 'nstore_digital', 'elearning');
     if (getClass('nstore')) {
         $products[] = 'nstore';
     }
     if (getClass('nstore_digital')) {
         $products[] = 'nstore_digital';
     }
     if (getClass('elearning')) {
         $products[] = 'elearning';
     }
     Context::set('products', $products);
     foreach ($products as $key => $prodid) {
         $has_license = TRUE;
         $expiration = NULL;
         if ($oLicenseModel->getLicenseFromAgency($prodid, $has_license, $expiration)) {
             $oLicenseModel->getLicenseFromAgency($prodid, $has_license, $expiration);
         }
         Context::set(sprintf('%s_expiration', $prodid), $expiration);
     }
     $this->setTemplateFile('index');
 }
Ejemplo n.º 10
0
function styleClasses($settings)
{
    function getClass($settings, $property)
    {
        return $settings->{$property} ? $property : "";
    }
    return getClass($settings, "caption-italic") . " " . getClass($settings, "caption-caps");
}
Ejemplo n.º 11
0
 /**
  * Regenerate all cache files
  * @return void
  */
 function procAdminRecompileCacheFile()
 {
     // rename cache dir
     Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
     Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
     // remove module extend cache
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/config/module_extend.php');
     // remove debug files
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_message.php');
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_db_query.php');
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_db_slow_query.php');
     $oModuleModel = getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // call recompileCache for each module
     foreach ($module_list as $module) {
         $oModule = NULL;
         $oModule = getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     // remove object cache
     if (!in_array(Rhymix\Framework\Cache::getDriverName(), array('file', 'sqlite', 'dummy'))) {
         Rhymix\Framework\Cache::clearAll();
     }
     // remove old cache dir
     $tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
     if ($tmp_cache_list) {
         foreach ($tmp_cache_list as $tmp_dir) {
             if (strval($tmp_dir) !== '') {
                 $tmp_dir = \RX_BASEDIR . 'files/' . strval($tmp_dir);
                 if (!Rhymix\Framework\Storage::isDirectory($tmp_dir)) {
                     continue;
                 }
                 // If possible, use system command to speed up recursive deletion
                 if (function_exists('exec') && !preg_match('/(?<!_)exec/', ini_get('disable_functions'))) {
                     if (strncasecmp(\PHP_OS, 'win', 3) == 0) {
                         @exec('rmdir /S /Q ' . escapeshellarg($tmp_dir));
                     } else {
                         @exec('rm -rf ' . escapeshellarg($tmp_dir));
                     }
                 }
                 // If the directory still exists, delete using PHP.
                 Rhymix\Framework\Storage::deleteDirectory($tmp_dir);
             }
         }
     }
     // remove duplicate indexes (only for CUBRID)
     $db_type = Context::getDBType();
     if ($db_type == 'cubrid') {
         $db = DB::getInstance();
         $db->deleteDuplicateIndexes();
     }
     // check autoinstall packages
     $oAutoinstallAdminController = getAdminController('autoinstall');
     $oAutoinstallAdminController->checkInstalled();
     $this->setMessage('success_updated');
 }
Ejemplo n.º 12
0
 /**
  * Regenerate all cache files
  * @return void
  */
 function procAdminRecompileCacheFile()
 {
     // rename cache dir
     $temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
     FileHandler::rename('./files/cache', $temp_cache_dir);
     FileHandler::makeDir('./files/cache');
     // remove module extend cache
     FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
     // remove debug files
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
     $oModuleModel = getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // call recompileCache for each module
     foreach ($module_list as $module) {
         $oModule = NULL;
         $oModule = getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     // remove cache
     $truncated = array();
     $oObjectCacheHandler = CacheHandler::getInstance('object');
     $oTemplateCacheHandler = CacheHandler::getInstance('template');
     if ($oObjectCacheHandler->isSupport()) {
         $truncated[] = $oObjectCacheHandler->truncate();
     }
     if ($oTemplateCacheHandler->isSupport()) {
         $truncated[] = $oTemplateCacheHandler->truncate();
     }
     if (count($truncated) && in_array(FALSE, $truncated)) {
         return new Object(-1, 'msg_self_restart_cache_engine');
     }
     // remove cache dir
     $tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
     if ($tmp_cache_list) {
         foreach ($tmp_cache_list as $tmp_dir) {
             if ($tmp_dir) {
                 FileHandler::removeDir('./files/' . $tmp_dir);
             }
         }
     }
     // remove duplicate indexes (only for CUBRID)
     $db_type = Context::getDBType();
     if ($db_type == 'cubrid') {
         $db = DB::getInstance();
         $db->deleteDuplicateIndexes();
     }
     // check autoinstall packages
     $oAutoinstallAdminController = getAdminController('autoinstall');
     $oAutoinstallAdminController->checkInstalled();
     $this->setMessage('success_updated');
 }
Ejemplo n.º 13
0
 public function __get($name)
 {
     if (array_key_exists($name, $this->data)) {
         if (in_array($name, $this->serializable)) {
             return unserialize($this->data[$name]);
         }
         return $this->data[$name];
     }
     $class = getClass($this);
     throw new Exception("Invalid property {$name} for {$class}");
 }
Ejemplo n.º 14
0
function showPlayerTalents($guid, $class, $level, $spec)
{
    global $lang;
    $bild = generateCharacterBild($guid, $class, $spec);
    $calc = array('none', 'warrior', 'paladin', 'hunter', 'rogue', 'priest', 'FUTURE_1', 'shaman', 'mage', 'warlock', 'FUTURE_2', 'druid');
    echo '<div id="talent"></div>';
    echo '<a href="?talent=' . $calc[$class] . '" id=talent_bild_link>' . $lang['player_talent_calc'] . '</a><br>';
    includeTalentScript($class, -1, $level, getClass($class));
    echo '<script type="text/javascript">tc_bildFromStr("' . $bild['calc_bild'] . '");</script>';
    echo '<script type="text/javascript">tc_renderTree("talent");</script>';
}
Ejemplo n.º 15
0
 /**
  * Returns the list fo all skills available to a ninja.
  **/
 function skills($username)
 {
     if (!$username) {
         $username = get_username();
     }
     if (false && DEBUG && $username == 'glassbox') {
         $skills = $this->skill_map['Blue'] + $this->skill_map['White'] + $this->skill_map['Red'] + $this->skill_map['Black'] + $this->skill_map['All'];
         return $skills;
     }
     return $this->skill_map[getClass($username)] + $this->skill_map['All'];
 }
Ejemplo n.º 16
0
 public function __get($name)
 {
     if (array_key_exists($name, $this->data)) {
         if ($name == 'parameters') {
             return json_decode($this->data[$name], true);
         }
         return $this->data[$name];
     }
     $class = getClass($this);
     throw new Exception("Invalid property {$name} for {$class}");
 }
Ejemplo n.º 17
0
	public function setUp()
	{
		parent::setUp();

		GetLib('class.json');
		$this->_keystore = Interspire_KeyStore::instance();
		$this->_prefix = 'ebay:list_products:' . $this->args['id'] . ':';
		$this->_db = $GLOBALS['ISC_CLASS_DB'];
		$this->_engine = getClass('ISC_ADMIN_ENGINE');
		$this->_engine->LoadLangFile('ebay');
		$this->_log = $GLOBALS['ISC_CLASS_LOG'];
	}
Ejemplo n.º 18
0
 /**
  * Regenerate all cache files
  * @return void
  */
 function procAdminRecompileCacheFile()
 {
     // rename cache dir
     $temp_cache_dir = './files/cache_' . time();
     FileHandler::rename('./files/cache', $temp_cache_dir);
     FileHandler::makeDir('./files/cache');
     // remove debug files
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
     $oModuleModel =& getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // call recompileCache for each module
     foreach ($module_list as $module) {
         $oModule = null;
         $oModule =& getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     // remove cache
     $truncated = array();
     $oObjectCacheHandler =& CacheHandler::getInstance('object');
     $oTemplateCacheHandler =& CacheHandler::getInstance('template');
     if ($oObjectCacheHandler->isSupport()) {
         $truncated[] = $oObjectCacheHandler->truncate();
     }
     if ($oTemplateCacheHandler->isSupport()) {
         $truncated[] = $oTemplateCacheHandler->truncate();
     }
     if (count($truncated) && in_array(false, $truncated)) {
         return new Object(-1, 'msg_self_restart_cache_engine');
     }
     // remove cache dir
     $tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
     if ($tmp_cache_list) {
         foreach ($tmp_cache_list as $tmp_dir) {
             if ($tmp_dir) {
                 FileHandler::removeDir('./files/' . $tmp_dir);
             }
         }
     }
     // remove duplicate indexes (only for CUBRID)
     $db_type =& Context::getDBType();
     if ($db_type == 'cubrid') {
         $db =& DB::getInstance();
         $db->deleteDuplicateIndexes();
     }
     $this->setMessage('success_updated');
 }
Ejemplo n.º 19
0
	public function __construct()
	{
		/**
		 * Convert the input character set from the hard coded UTF-8 to their
		 * selected character set
		 */
		convertRequestInput();

		$this->template = Interspire_Template::getInstance('admin');
		$this->db = $GLOBALS['ISC_CLASS_DB'];
		$this->auth = getClass('ISC_ADMIN_AUTH');
		$this->engine = getClass('ISC_ADMIN_ENGINE');
		parent::__construct();
	}
Ejemplo n.º 20
0
	public function __construct()
	{
		if(defined('ISC_ADMIN_CP')) {
			$this->template = Interspire_Template::getInstance('admin');
			$this->auth = getClass('ISC_ADMIN_AUTH');
			$this->engine = getClass('ISC_ADMIN_ENGINE');
		}

		$this->db = $GLOBALS['ISC_CLASS_DB'];

		if (isset($GLOBALS['ISC_CLASS_LOG'])) {
			// the logging global isn't available during installation
			$this->log = $GLOBALS['ISC_CLASS_LOG'];
		}
	}
Ejemplo n.º 21
0
	public function __construct()
	{
		$this->template = Interspire_Template::getInstance('admin');
		$this->auth = getClass('ISC_ADMIN_AUTH');
		$this->engine = getClass('ISC_ADMIN_ENGINE');

		$this->templateDirectories = array(
			ISC_BASE_PATH.'/templates/__master/',
			ISC_BASE_PATH.'/templates/'.GetConfig('template').'/',
		);

		$this->directoryTypes = array(
			'StyleSheet' => 'Styles',
			'Layout' => '',
			'Snippet' => 'Snippets',
			'Panel' => 'Panels'
		);
	}
Ejemplo n.º 22
0
 /**
  * @brief 모든 캐시 파일 재생성
  **/
 function procAdminRecompileCacheFile()
 {
     $oModuleModel =& getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // 개발 디버그 파일들 제거
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
     // 각 모듈마다 돌면서 캐시 파일 제거
     foreach ($module_list as $module) {
         $oModule = null;
         $oModule =& getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     $this->setMessage('success_updated');
 }
	public function applyRule(ISC_QUOTE $quote)
	{
		$customerId = getClass('ISC_CUSTOMER')->getCustomerId();
		$query = "
			SELECT COUNT(*)
			FROM [|PREFIX|]orders
			WHERE ordcustid='".$customerId."' AND ordstatus > 0 AND deleted = 0
			LIMIT 1
		";
		$orderCount = $GLOBALS['ISC_CLASS_DB']->fetchOne($query);

		// Discount does not apply
		if($orderCount <= $this->orders) {
			return false;
		}

		$runningTotal = $this->amount;
		$appliedAmount = 0;
		$items = $quote->getItems();
		foreach ($items as $item) {
			$discountedBase = $item->getDiscountedBaseTotal();
			if($discountedBase - $runningTotal < 0) {
				$item->addDiscount($this->getDbId(), $discountedBase);
				$appliedAmount += $discountedBase;
				$runningTotal -= $discountedBase;
			}
			else {
				$item->addDiscount($this->getDbId(), $runningTotal);
				$appliedAmount += $runningTotal;
				$runningTotal -= $runningTotal;
			}

			if($runningTotal <= 0) {
				break;
			}
		}

		$quote->addDiscount($this->getDbId(), $appliedAmount);

		$amount = currencyConvertFormatPrice($appliedAmount);
		$this->banners[] = sprintf(getLang($this->getName().'DiscountMessage'), $amount);
		return true;
	}
 public function loadByName($value)
 {
     $className = getClass($this);
     if (empty($name)) {
         throw new Exception("Unable to load object {$className}: empty name");
     }
     try {
         $result = $this->database->table($this->schema)->keys(array_keys($this->data))->where(self::$element_name, '=', $value)->get();
         if ($result->getLength() != 1) {
             throw new Exception("Unable to load object {$className}: missing name {$value}");
         }
         $data = $result->getData();
         $return = $this->populate($data[0]);
     } catch (DatabaseException $de) {
         throw $de;
     } catch (Exception $e) {
         throw $e;
     }
     return $return;
 }
Ejemplo n.º 25
0
	public function perform()
	{
        $_engine = getClass('ISC_ADMIN_ENGINE');
        $_engine->LoadLangFile('shoppingcomparison');

		$moduleId = $this->args['module'];
		GetModuleById('shoppingcomparison', $module, $moduleId);

		if(!$module)
			return;

		if(!isset($this->args['controller'])
			|| !($controllerId = $this->args['controller']))
		{
			error_log("No controller for export task. Aborting");
			return;
		}

		$this->initialize($module, $controllerId);
		$this->run();
	}
Ejemplo n.º 26
0
$master_act = array("default", "login", "register", "rank", "contact", "rules", "help");
$user_act = array("logout", "pit", "account", "hellmarket", "rank", "messages", "contact", "rules", "help", "admin", "kody_vip", "create", "vip");
if (empty($_GET['x'])) {
    $_GET['x'] = 'default';
}
if (in_Array($_GET['x'], $user_act) && $player->role >= 0) {
    if (!empty($_GET['set_pit'])) {
        $_GET['set_pit'] = (int) $_GET['set_pit'];
        $is = one("select pit_id from hellpit_pits where pit_id = " . $_GET['set_pit'] . " and pit_user = "******"update hellpit_users set actual_pit = " . $_GET['set_pit'] . " where user = "******"update hellpit_users set exp = exp - exp_lvl, exp_lvl = exp_lvl * 1.666, skills = skills + 3, lvl = lvl + 1 where user = " . $player->user);
        reload($_GET['x']);
    }
    $header = 'templates/user/header.php';
    $footer = 'templates/user/footer.php';
    $page = 'templates/user/' . $_GET['x'] . '.php';
} elseif (in_Array($_GET['x'], $master_act)) {
    $header = 'templates/master/header.php';
    $footer = 'templates/master/footer.php';
    $page = 'templates/master/' . $_GET['x'] . '.php';
} else {
Ejemplo n.º 27
0
 /**
  * Change the module to move a specific article
  * @param array $document_srl_list
  * @param int $module_srl
  * @param int $category_srl
  * @return Object
  */
 function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
 {
     if (!count($document_srl_list)) {
         return;
     }
     $oDocumentModel = getModel('document');
     $oDocumentController = getController('document');
     $oDB =& DB::getInstance();
     $oDB->begin();
     $triggerObj = new stdClass();
     $triggerObj->document_srls = implode(',', $document_srl_list);
     $triggerObj->module_srl = $module_srl;
     $triggerObj->category_srl = $category_srl;
     // Call a trigger (before)
     $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     for ($i = count($document_srl_list) - 1; $i >= 0; $i--) {
         $document_srl = $document_srl_list[$i];
         $oDocument = $oDocumentModel->getDocument($document_srl);
         if (!$oDocument->isExists()) {
             continue;
         }
         $oMemberModel = getModel('member');
         $logged_info = Context::get('logged_info');
         $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
         if ($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') {
             return new Object();
         }
         $source_category_srl = $oDocument->get('category_srl');
         unset($obj);
         $obj = $oDocument->getObjectVars();
         // ISSUE https://github.com/xpressengine/xe-core/issues/32
         $args_doc_origin->document_srl = $document_srl;
         $output_ori = executeQuery('document.getDocument', $args_doc_origin, array('content'));
         $obj->content = $output_ori->data->content;
         // Move the attached file if the target module is different
         if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) {
             $oFileController = getController('file');
             $files = $oDocument->getUploadedFiles();
             $delete_file_srls = array();
             if (is_array($files)) {
                 foreach ($files as $val) {
                     $file_info = array();
                     $file_info['tmp_name'] = $val->uploaded_filename;
                     $file_info['name'] = $val->source_filename;
                     $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
                     if ($inserted_file && $inserted_file->toBool()) {
                         // for image/video files
                         if ($val->direct_download == 'Y') {
                             $source_filename = substr($val->uploaded_filename, 2);
                             $target_filename = substr($inserted_file->get('uploaded_filename'), 2);
                             $obj->content = str_replace($source_filename, $target_filename, $obj->content);
                             // For binary files
                         } else {
                             $obj->content = str_replace('file_srl=' . $val->file_srl, 'file_srl=' . $inserted_file->get('file_srl'), $obj->content);
                             $obj->content = str_replace('sid=' . $val->sid, 'sid=' . $inserted_file->get('sid'), $obj->content);
                         }
                     }
                     $delete_file_srls[] = $val->file_srl;
                 }
                 // Delete an existing file
                 $oFileController->deleteFile($delete_file_srls);
             }
             // Set the all files to be valid
             $oFileController->setFilesValid($obj->document_srl);
         }
         if ($module_srl != $obj->module_srl) {
             $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
         }
         // Move a module of the article
         $obj->module_srl = $module_srl;
         $obj->category_srl = $category_srl;
         $output = executeQuery('document.updateDocumentModule', $obj);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         //Move a module of the extra vars
         $output = executeQuery('document.moveDocumentExtraVars', $obj);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         // Set 0 if a new category doesn't exist after catergory change
         if ($source_category_srl != $category_srl) {
             if ($source_category_srl) {
                 $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
             }
             if ($category_srl) {
                 $oDocumentController->updateCategoryCount($module_srl, $category_srl);
             }
         }
     }
     $args = new stdClass();
     $args->document_srls = implode(',', $document_srl_list);
     $args->module_srl = $module_srl;
     // move the comment
     $output = executeQuery('comment.updateCommentModule', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     $output = executeQuery('comment.updateCommentListModule', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // move the trackback
     if (getClass('trackback')) {
         $output = executeQuery('trackback.updateTrackbackModule', $args);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
     }
     // Tags
     $output = executeQuery('tag.updateTagModule', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // Call a trigger (before)
     $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     $oDB->commit();
     //remove from cache
     $oCacheHandler = CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         foreach ($document_srl_list as $document_srl) {
             $cache_key_item = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
             $oCacheHandler->delete($cache_key_item);
         }
     }
     return new Object();
 }
Ejemplo n.º 28
0
 function allowTrackback()
 {
     static $allow_trackback_status = null;
     if (is_null($allow_trackback_status)) {
         // Check the tarckback module exist
         if (!getClass('trackback')) {
             $allow_trackback_status = false;
         } else {
             // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
             $oModuleModel = getModel('module');
             $trackback_config = $oModuleModel->getModuleConfig('trackback');
             if (!$trackback_config) {
                 $trackback_config = new stdClass();
             }
             if (!isset($trackback_config->enable_trackback)) {
                 $trackback_config->enable_trackback = 'Y';
             }
             if ($trackback_config->enable_trackback != 'Y') {
                 $allow_trackback_status = false;
             } else {
                 $module_srl = $this->get('module_srl');
                 // Check settings of each module
                 $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
                 if ($module_config->enable_trackback == 'N') {
                     $allow_trackback_status = false;
                 } else {
                     if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) {
                         $allow_trackback_status = true;
                     }
                 }
             }
         }
     }
     return $allow_trackback_status;
 }
Ejemplo n.º 29
0
	public function SetPanelSettings()
	{
		$GLOBALS['SNIPPETS']['SideCartItems'] = '';

		// We check $_SESSION['QUOTE'] directly here as to not
		// instantiate the quote if it doesn't already exist.
		if(!isset($_SESSION['QUOTE']) && getCustomerQuote()->getNumItems() == 0) {
			$this->DontDisplay = true;
			return;
		}

		$incTax = false;
		if(getConfig('taxDefaultTaxDisplayCart') != TAX_PRICES_DISPLAY_EXCLUSIVE) {
			$incTax = true;
		}

		$quote = getCustomerQuote();
		$items = $quote->getItems();
		foreach($items as $item) {
			if($item->getProductId()) {
				$GLOBALS['ProductName'] = "<a href=\"".ProdLink($item->getName())."\">".isc_html_escape($item->getName())."</a>";
			}
			else {
				$GLOBALS['ProductName'] = isc_html_escape($item->getName());
			}

			// Is this product a variation?
			$GLOBALS['ProductOptions'] = '';
			$options = $item->getVariationOptions();
			if(!empty($options)) {
				$GLOBALS['ProductOptions'] .= "<br /><small>(";
				$comma = '';
				foreach($options as $name => $value) {
					if(!trim($name) || !trim($value)) {
						continue;
					}
					$GLOBALS['ProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value);
					$comma = ', ';
				}
				$GLOBALS['ProductOptions'] .= ")</small>";
			}

			$GLOBALS['ProductPrice'] = currencyConvertFormatPrice($item->getTotal($incTax));
			$GLOBALS['ProductQuantity'] = $item->getQuantity();
			$GLOBALS['SNIPPETS']['SideCartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCartItem");
		}

		$numItems = $quote->getNumItems();
		if($numItems == 1) {
			$GLOBALS['SideCartItemCount'] = GetLang('SideCartYouHave1Item');
		} else {
			$GLOBALS['SideCartItemCount'] = sprintf(GetLang('SideCartYouHaveXItems'), $numItems);
		}

		$total = $quote->getSubTotal($incTax);
		$GLOBALS['ISC_LANG']['SideCartTotalCost'] = sprintf(GetLang('SideCartTotalCost'), CurrencyConvertFormatPrice($total));

		// Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
		$GLOBALS['AdditionalCheckoutButtons'] = '';
		$HideCheckout = false;
		foreach (GetAvailableModules('checkout', true, true) as $module) {
			if (method_exists($module['object'], 'GetSidePanelCheckoutButton')) {
				$GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetSidePanelCheckoutButton();
			}

			if ($module['object']->disableNonCartCheckoutButtons) {
				$HideCheckout = true;
			}

		}

		if ($HideCheckout) {
			$GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = '';
		} else {
			require_once ISC_BASE_PATH.'/includes/display/CartHeader.php';

			$cartPanel = getClass('ISC_CARTHEADER_PANEL');
			$cartPanel -> insertOptimizerLinkScript();
			$GLOBALS['SNIPPETS']['SideCartContentsCheckoutLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SideCartContentsCheckoutLink');
		}

	}
Ejemplo n.º 30
0
 /**
  * Search Result
  *
  * @return Object
  */
 function IS()
 {
     $oFile = getClass('file');
     $oModuleModel = getModel('module');
     $logged_info = Context::get('logged_info');
     // Check permissions
     if (!$this->grant->access) {
         return new Object(-1, 'msg_not_permitted');
     }
     $config = $oModuleModel->getModuleConfig('integration_search');
     if (!$config) {
         $config = new stdClass();
     }
     if (!$config->skin) {
         $config->skin = 'default';
         $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
     } else {
         //check theme
         $config_parse = explode('|@|', $config->skin);
         if (count($config_parse) > 1) {
             $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
         } else {
             $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
         }
     }
     // Template path
     $this->setTemplatePath($template_path);
     $skin_vars = $config->skin_vars ? unserialize($config->skin_vars) : new stdClass();
     Context::set('module_info', $skin_vars);
     $target = $config->target;
     if (!$target) {
         $target = 'include';
     }
     if (empty($config->target_module_srl)) {
         $module_srl_list = array();
     } else {
         $module_srl_list = explode(',', $config->target_module_srl);
     }
     // https://github.com/xpressengine/xe-core/issues/1522
     // 검색 대상을 지정하지 않았을 때 검색 제한
     if ($target === 'include' && !count($module_srl_list)) {
         $oMessageObject = ModuleHandler::getModuleInstance('message');
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage('msg_not_enabled');
         $oMessageObject->dispMessage();
         $this->setTemplatePath($oMessageObject->getTemplatePath());
         $this->setTemplateFile($oMessageObject->getTemplateFile());
         return;
     }
     // Set a variable for search keyword
     $is_keyword = Context::get('is_keyword');
     // Set page variables
     $page = (int) Context::get('page');
     if (!$page) {
         $page = 1;
     }
     // Search by search tab
     $where = Context::get('where');
     // Create integration search model object
     if ($is_keyword) {
         $oIS = getModel('integration_search');
         switch ($where) {
             case 'document':
                 $search_target = Context::get('search_target');
                 if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) {
                     $search_target = 'title';
                 }
                 Context::set('search_target', $search_target);
                 $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("document", $page);
                 break;
             case 'comment':
                 $output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("comment", $page);
                 break;
             case 'trackback':
                 $search_target = Context::get('search_target');
                 if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) {
                     $search_target = 'title';
                 }
                 Context::set('search_target', $search_target);
                 $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
                 Context::set('output', $output);
                 $this->setTemplateFile("trackback", $page);
                 break;
             case 'multimedia':
                 $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20);
                 Context::set('output', $output);
                 $this->setTemplateFile("multimedia", $page);
                 break;
             case 'file':
                 $output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
                 Context::set('output', $output);
                 $this->setTemplateFile("file", $page);
                 break;
             default:
                 $output['document'] = $oIS->getDocuments($target, $module_srl_list, 'title', $is_keyword, $page, 5);
                 $output['comment'] = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 5);
                 $output['trackback'] = $oIS->getTrackbacks($target, $module_srl_list, 'title', $is_keyword, $page, 5);
                 $output['multimedia'] = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 5);
                 $output['file'] = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 5);
                 Context::set('search_result', $output);
                 Context::set('search_target', 'title');
                 $this->setTemplateFile("index", $page);
                 break;
         }
     } else {
         $this->setTemplateFile("no_keywords");
     }
     $security = new Security();
     $security->encodeHTML('is_keyword', 'search_target', 'where', 'page');
 }