コード例 #1
0
ファイル: planet.class.php プロジェクト: hottaro/xpressengine
 /**
  * @brief 설치시 추가 작업이 필요할시 구현
  **/
 function moduleInstall()
 {
     /**
      * planet 이라는 mid를 미리 입력해 놓음
      * 이 mid는 차후 수정 가능하고 planet 메인 페이지를 사용하기 위한 더미 형식의 mid로 사용됨.
      * 만약 이미 존재하는 경우를 대비해서 뒤에 숫자를 붙이도록 함.
      **/
     $oModuleModel =& getModel('module');
     $oModuleController =& getController('module');
     $oPlanetController =& getController('planet');
     $module_info = $oModuleModel->getModuleConfig('planet');
     if ($module_info->mid) {
         $_o = executeQuery('module.getMidInfo', $module_info);
         if (!$_o->data) {
             unset($module_info);
         }
     }
     if (!$module_info->mid) {
         $args->module = 'planet';
         $args->browser_title = 'planetXE';
         $args->skin = 'xe_planet';
         $args->is_default = 'N';
         $args->mid = 'planet';
         $args->module_srl = getNextSequence();
         $output = $oModuleController->insertModule($args);
         $planet_args->mid = $args->mid;
         $oPlanetController->insertPlanetConfig($planet_args);
     }
     // 2009. 01. 29 아이디 클릭시 나타나는 팝업메뉴에 플래닛 보기 기능 추가
     $oModuleController->insertTrigger('member.getMemberMenu', 'planet', 'controller', 'triggerMemberMenu', 'after');
     // 2009. 05. 07 개별 플래닛에서 메인 플래닛의 레이아웃을 승계하기 위한 트리거 추가
     $oModuleController->insertTrigger('moduleHandler.init', 'planet', 'controller', 'triggerSetLayout', 'after');
 }
コード例 #2
0
 public function insertCart(Cart &$cart)
 {
     if ($cart->cart_srl) {
         throw new ShopException('A srl must NOT be specified for the insert operation!');
     }
     $cart->cart_srl = getNextSequence();
     return $this->query('insertCart', get_object_vars($cart));
 }
コード例 #3
0
 /**
  * Inserts a plugin in the database
  *
  * @param AbstractPlugin $payment_method
  * @return mixed|void
  * @throws ShopException
  */
 protected function insertPluginInfo(AbstractPlugin $payment_method)
 {
     $payment_method->id = getNextSequence();
     $output = executeQuery('shop.insertPaymentMethod', $payment_method);
     if (!$output->toBool()) {
         throw new ShopException($output->getMessage(), $output->getError());
     }
 }
コード例 #4
0
 /**
  * insert function
  * @param Shipment $shipment
  * @return object
  * @throws ShopException
  */
 public function insert(Shipment &$shipment)
 {
     if ($shipment->shipment_srl) {
         throw new ShopException('A srl must NOT be specified for the insert operation!');
     }
     $shipment->shipment_srl = getNextSequence();
     return $this->query('insertShipment', get_object_vars($shipment));
 }
コード例 #5
0
 /**
  * insert Address
  * @param Address $address
  * @return object
  * @throws ShopException
  */
 public function insert(Address &$address)
 {
     if ($address->address_srl) {
         throw new ShopException('A srl must NOT be specified for the insert operation!');
     }
     $address->address_srl = getNextSequence();
     return $this->query('insertAddress', get_object_vars($address));
 }
コード例 #6
0
 /**
  * insert function
  * @param Invoice $invoice
  * @return object
  * @throws ShopException
  */
 public function insert(Invoice &$invoice)
 {
     if ($invoice->invoice_srl) {
         throw new ShopException('A srl must NOT be specified for the insert operation!');
     }
     $invoice->invoice_srl = getNextSequence();
     return $this->query('insertInvoice', get_object_vars($invoice));
 }
コード例 #7
0
 public function insert(Order &$order)
 {
     if ($order->order_srl) {
         throw new ShopException('A srl must NOT be specified for the insert operation!');
     }
     $order->order_srl = getNextSequence();
     return $this->query('insertOrder', get_object_vars($order));
 }
コード例 #8
0
 /**
  * Insert a new Product category; returns the ID of the newly created record.
  *
  * @param Category $category Category to inserted
  *
  * @throws ShopException
  * @return category_srl int
  */
 public function insertCategory(Category $category)
 {
     $category->category_srl = getNextSequence();
     $category->list_order = $category->parent_srl;
     $output = executeQuery('shop.insertCategory', $category);
     if (!$output->toBool()) {
         throw new ShopException($output->getMessage(), $output->getError());
     }
     return $category->category_srl;
 }
コード例 #9
0
 /**
  * @brief 메시지 기록
  */
 function insertMessage($obj)
 {
     $this->_filter($obj->type, array('S', 'R'), 'R');
     $this->_filter($obj->is_readed, array('Y', 'N'), 'N');
     $args->message_srl = $obj->message_srl ? $obj->message_srl : getNextSequence();
     $args->domain = $this->cleanDomain($obj->domain);
     $args->type = $obj->type;
     $args->is_readed = $obj->is_readed;
     $args->title = $obj->title;
     $args->content = $obj->content;
     return executeQuery('alliance.insertMessage', $args);
 }
コード例 #10
0
 /**
  * @brief notification append
  **/
 function procNotificationAdminInsert()
 {
     $params = Context::gets('content', 'mail_content', 'module_srls', 'msgtype', 'sending_method', 'cellphone_fieldname', 'use_authdata');
     $extra_vars = new StdClass();
     $extra_vars->sender_phone = Context::get('sender_phone');
     $extra_vars->admin_phones = Context::get('admin_phones');
     $extra_vars->admin_emails = Context::get('admin_emails');
     $extra_vars->cellphone_fieldname = Context::get('cellphone_fieldname');
     $extra_vars->use_authdata = Context::get('use_authdata');
     $extra_vars->reverse_notify = Context::get('reverse_notify');
     $extra_vars->use_extravar = Context::get('use_extravar');
     $extra_vars->use_extravar_email = Context::get('use_extravar_email');
     $extra_vars->force_notify = Context::get('force_notify');
     $extra_vars->email_sender_name = Context::get('email_sender_name');
     $extra_vars->email_sender_address = Context::get('email_sender_address');
     $params->notification_srl = Context::get('noti_srl');
     if ($params->notification_srl) {
         // delete existences
         $args->notification_srl = $params->notification_srl;
         $output = executeQuery('notification.deleteNotiCom', $args);
         if (!$output->toBool()) {
             return $output;
         }
         $output = executeQuery('notification.deleteNotificationModuleSrl', $args);
         if (!$output->toBool()) {
             return $output;
         }
     } else {
         // new sequence
         $params->notification_srl = getNextSequence();
     }
     // insert module srls
     $module_srls = explode(',', $params->module_srls);
     foreach ($module_srls as $srl) {
         unset($args);
         $args->notification_srl = $params->notification_srl;
         $args->module_srl = $srl;
         $output = executeQuery('notification.insertNotificationModuleSrl', $args);
         if (!$output->toBool()) {
             return $output;
         }
     }
     $params->extra_vars = serialize($extra_vars);
     // insert notification
     $output = executeQuery('notification.insertNotiCom', $params);
     if (!$output->toBool()) {
         return $output;
     }
     $redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNotificationAdminModify', 'notification_srl', $params->notification_srl);
     $this->setRedirectUrl($redirectUrl);
 }
コード例 #11
0
 /**
  * object insert to trash
  * @param TrashVO $obj
  * @return Object
  */
 function insertTrash($obj)
 {
     $logged_info = Context::get('logged_info');
     $oTrashVO = new TrashVO();
     $oTrashVO =& $obj;
     if (!$oTrashVO->getTrashSrl()) {
         $oTrashVO->setTrashSrl(getNextSequence());
     }
     if (!is_string($oTrashVO->getSerializedObject())) {
         $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
     }
     $oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
     $oTrashVO->setRemoverSrl($logged_info->member_srl);
     $oTrashVO->setRegdate(date('YmdHis'));
     return executeQuery('trash.insertTrash', $oTrashVO);
 }
コード例 #12
0
 /**
  * Insert a new attribute; returns the ID of the newly created record
  *
  * @author Florin Ercus (dev@xpressengine.org)
  * @param $attribute Attribute
  * @return int
  */
 public function insertAttribute(Attribute &$attribute)
 {
     if ($attribute->attribute_srl) {
         throw new ShopException('A srl must NOT be specified');
     }
     $attribute->attribute_srl = getNextSequence();
     if (count($attribute->values) == 0) {
         unset($attribute->values);
     } else {
         $attribute->values = implode('|', array_map('trim', explode('|', $attribute->values)));
     }
     $output = executeQuery('shop.insertAttribute', $attribute);
     self::check($output);
     $this->insertAttributeScope($attribute);
     return $output;
 }
コード例 #13
0
	/**
	 * @brief saving config values.
	 **/
	function procPaynotyAdminInsert() 
	{
		$params = Context::gets('admin_phones','admin_emails','sender_name','sender_email','content','mail_content','module_srls','msgtype','sending_method');
		$params->config_srl = Context::get('config_srl');

		if ($params->config_srl) 
		{
			// delete existences
			$args->config_srl = $params->config_srl;
			$output = executeQuery('paynoty.deleteConfig', $args);
			if (!$output->toBool()) return $output;
			$output = executeQuery('paynoty.deleteModule', $args);
			if (!$output->toBool()) return $output;
		}
		else
		{
			// new sequence
			$params->config_srl = getNextSequence();
		}

		// insert module srls
		$module_srls = explode(',', $params->module_srls);
		foreach ($module_srls as $srl) 
		{
			unset($args);
			$args->config_srl = $params->config_srl;
			$args->module_srl = $srl;
			$output = executeQuery('paynoty.insertModuleSrl', $args);
			if (!$output->toBool()) return $output;
		}

		//$params->extra_vars = serialize($extra_vars);

		debugPrint('params : ' . serialize($params));
		// insert paynoty
		$output = executeQuery('paynoty.insertConfig', $params);
		debugPrint('insertConfig : ' . serialize($output));
		if (!$output->toBool()) 
		{
			return $output;
		}

		$redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPaynotyAdminModify','config_srl',$params->config_srl);
		$this->setRedirectUrl($redirectUrl);
	}
コード例 #14
0
 /**
  * @brief 레이아웃 신규 생성
  * 레이아웃의 신규 생성은 제목만 받아서 layouts테이블에 입력함
  **/
 function procLayoutAdminInsert()
 {
     // 레이아웃 생성과 관련된 기본 정보를 받음
     $site_module_info = Context::get('site_module_info');
     $args->site_srl = (int) $site_module_info->site_srl;
     $args->layout_srl = getNextSequence();
     $args->layout = Context::get('layout');
     $args->title = Context::get('title');
     // DB 입력
     $output = $this->insertLayout($args);
     if (!$output->toBool()) {
         return $output;
     }
     // faceOff 레이아웃일 경우 init 필요
     $this->initLayout($args->layout_srl, $args->layout);
     // 결과 리턴
     $this->add('layout_srl', $args->layout_srl);
 }
コード例 #15
0
 function addNewTrans($content)
 {
     $args->translation_content_srl = getNextSequence();
     $args->content_node = $key;
     $args->content = strval($content);
     $oTranslationModel =& getModel('translation');
     $default_contents = $oTranslationModel->getDefaultTargetContents($args);
     if ($default_contents) {
         $args->is_new_lang = 0;
     } else {
         $args->is_new_lang = 1;
     }
     $output = executeQuery('translation.insertXMLContents', $args);
     if (!$output->toBool()) {
         return $output;
     }
     $this->add('translation_content_srl', $args->translation_content_srl);
 }
コード例 #16
0
 /**
  * @brief insert plugin info. (it will be deleted in the future)
  */
 function procEpayAdminInsertPlugin()
 {
     $plugin_srl = getNextSequence();
     $args->plugin_srl = $plugin_srl;
     $args->plugin = Context::get('plugin');
     $args->title = Context::get('title');
     $output = executeQuery("epay.insertPlugin", $args);
     if (!$output->toBool()) {
         return $output;
     }
     require_once _XE_PATH_ . 'modules/epay/epay.plugin.php';
     require_once _XE_PATH_ . 'modules/epay/plugins/' . $args->plugin . '/' . $args->plugin . '.plugin.php';
     $tmp_fn = create_function('', "return new {$args->plugin}();");
     $oPlugin = $tmp_fn();
     if (@method_exists($oPlugin, 'pluginInstall')) {
         $oPlugin->pluginInstall($args);
     }
     // 결과 리턴
     $this->add('plugin_srl', $plugin_srl);
 }
コード例 #17
0
 /**
  * Insert a new Product  returns the ID of the newly created record
  * @param Product $product
  * @return mixed
  * @throws ShopException
  */
 public function insertProduct(Product $product)
 {
     $product->product_srl = getNextSequence();
     if ($product->discount_price >= $product->price) {
         throw new ShopException("Discount price is bigger than normal price");
     }
     $output = executeQuery('shop.insertProduct', $product);
     if (!$output->toBool()) {
         throw new ShopException($output->getMessage(), $output->getError());
     } else {
         $this->insertProductCategories($product);
         $this->insertProductAttributes($product);
         if ($product->product_type == 'configurable') {
             $this->insertProductConfigurableAttributes($product);
         }
         $this->insertProductImages($product);
     }
     $slug = ShopUtils::slugify($product->title);
     return $product->product_srl;
 }
コード例 #18
0
 function procMagiccontentSetup()
 {
     $req = Context::getRequestVars();
     $widget_sequence = $req->widget_sequence;
     $is_complete = $req->is_complete;
     unset($req->is_complete);
     unset($req->widget_sequence);
     unset($req->act);
     foreach ($req as $key => $value) {
         if ($value == '') {
             unset($req->{$key});
         }
     }
     $serialize_data = serialize($req);
     $args = new stdClass();
     $args->data = $serialize_data;
     $args->widget_sequence = $widget_sequence;
     $args->is_complete = $is_complete;
     if ($is_complete == 1) {
         $dargs = new stdClass();
         $dargs->widget_sequence = $widget_sequence;
         $dargs->is_complete = 0;
         $output = executeQuery('magiccontent.deleteMagicContentData', $dargs);
     }
     $oMagiccontentModel =& getModel('magiccontent');
     if ($oMagiccontentModel->getSetupData($widget_sequence, $is_complete) === false) {
         $args->data_srl = getNextSequence();
         $output = executeQuery('magiccontent.insertMagicContentData', $args);
     } else {
         $output = executeQuery('magiccontent.updateMagicContentData', $args);
     }
     $oCacheHandler = CacheHandler::getInstance('template');
     if ($oCacheHandler->isSupport()) {
         $key = 'widget_cache:' . $widget_sequence;
         $oCacheHandler->delete($key);
     }
     $lang_type = Context::getLangType();
     $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
     FileHandler::removeFile($cache_file);
     return new Object(0, 'success');
 }
コード例 #19
0
 /**
  * After mail send trigger.
  */
 public function triggerAfterMailSend($mail)
 {
     $config = $this->getConfig();
     if (toBool($config->log_sent_mail) || toBool($config->log_errors) && count($mail->errors)) {
         $obj = new \stdClass();
         $obj->mail_srl = getNextSequence();
         $obj->mail_from = '';
         $obj->mail_to = '';
         if ($real_sender = $mail->message->getFrom()) {
             foreach ($real_sender as $email => $name) {
                 $obj->mail_from .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_to = $mail->message->getTo()) {
             foreach ($real_to as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_cc = $mail->message->getCc()) {
             foreach ($real_cc as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_bcc = $mail->message->getBcc()) {
             foreach ($real_bcc as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         $obj->mail_from = trim($obj->mail_from);
         $obj->mail_to = trim($obj->mail_to);
         $obj->subject = $mail->message->getSubject();
         $obj->calling_script = $mail->getCaller();
         $obj->sending_method = strtolower(class_basename($mail->driver));
         $obj->status = !count($mail->errors) ? 'success' : 'error';
         $obj->errors = count($mail->errors) ? implode("\n", $mail->errors) : null;
         $output = executeQuery('advanced_mailer.insertLog', $obj);
         if (!$output->toBool()) {
             return $output;
         }
     }
 }
コード例 #20
0
 /**
  * @brief 외부페이지 추가
  **/
 function procOpageAdminInsert()
 {
     // module 모듈의 model/controller 객체 생성
     $oModuleController =& getController('module');
     $oModuleModel =& getModel('module');
     // 게시판 모듈의 정보 설정
     $args = Context::getRequestVars();
     $args->module = 'opage';
     $args->mid = $args->opage_name;
     unset($args->opage_name);
     // module_srl이 넘어오면 원 모듈이 있는지 확인
     if ($args->module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
         if ($module_info->module_srl != $args->module_srl) {
             unset($args->module_srl);
         }
     }
     // module_srl의 값에 따라 insert/update
     if (!$args->module_srl) {
         $args->module_srl = getNextSequence();
         $output = $oModuleController->insertModule($args);
         $msg_code = 'success_registed';
     } else {
         $output = $oModuleController->updateModule($args);
         $msg_code = 'success_updated';
         // 캐시 파일 삭제
         $cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl);
         if (file_exists($cache_file)) {
             FileHandler::removeFile($cache_file);
         }
     }
     if (!$output->toBool()) {
         return $output;
     }
     // 등록 성공후 return될 메세지 정리
     $this->add("module_srl", $output->get('module_srl'));
     $this->add("opage", Context::get('opage'));
     $this->setMessage($msg_code);
 }
コード例 #21
0
 /**
  * Insert a new image; returns the ID of the newly created record
  * @param ProductImage $image
  * @return object
  * @throws ShopException
  */
 public function insertImage(ProductImage &$image)
 {
     if ($image->image_srl) {
         throw new ShopException('A srl must NOT be specified');
     }
     $image->image_srl = getNextSequence();
     if ($image->file_size > 0) {
         $output = executeQuery('shop.insertImage', $image);
         $this->saveImage($image);
         if (!$output->toBool()) {
             if ($image->is_primary == 'Y') {
                 $args = new stdClass();
                 $args->filename = $image->filename;
                 $args->product_srl = $image->product_srl;
                 $args->is_primary = 'Y';
                 $output = executeQuery('shop.updatePrimaryImage', $args);
             }
         }
         return $output;
     } else {
         return;
     }
 }
コード例 #22
0
 /**
  * @brief
  */
 function dispNproductAdminInsertItem()
 {
     $oEditorModel = getModel('editor');
     $oNproductAdminController = getAdminController('nproduct');
     $oNproductModel = getModel('nproduct');
     //dynamic ruleset 재생성
     $extra_vars = $oNproductModel->getItemExtraFormList($this->module_info->module_srl);
     $oNproductAdminController->_createInsertItemRuleset($extra_vars);
     $document_srl = getNextSequence();
     Context::set('document_srl', $document_srl);
     Context::set('editor', $oEditorModel->getModuleEditor('document', $this->module_info->module_srl, $document_srl, 'document_srl', 'description'));
     //Context::set('editor2', $oEditorModel->getModuleEditor('document', $this->module_info->module_srl, 0, 0, 'delivery_info'));
     // extra vars
     $item_info = new stdclass();
     $item_info->module_srl = $this->module_info->module_srl;
     Context::set('extra_vars', NExtraItemList::getList($item_info));
     $module_list = array();
     $output = ModuleHandler::triggerCall('nproduct.getProcModules', 'before', $module_list);
     if (!$output->toBool()) {
         return $output;
     }
     //$module_name = Context::get('proc_module');
     Context::set('module_list', $module_list);
 }
コード例 #23
0
 /**
  * @brief insert extra item
  **/
 function insertItemExtra($args)
 {
     $oNproductModel =& getModel('nproduct');
     // Default values
     $args->default_value = '';
     if (in_array($args->column_type, array('checkbox', 'select', 'radio')) && count($args->default_value)) {
         $args->default_value = serialize($args->default_value);
     }
     // Update if extra_srl exists, otherwise insert.
     $isInsert;
     if (!$args->extra_srl) {
         $isInsert = true;
         $args->list_order = $args->extra_srl = getNextSequence();
         $output = executeQuery('nproduct.insertItemExtra', $args);
         $this->setMessage('success_registed');
     } else {
         $output = executeQuery('nproduct.updateItemExtra', $args);
         $this->setMessage('success_updated');
     }
     if (!$output->toBool()) {
         return $output;
     }
     // create dynamic ruleset
     $extra_vars = $oNproductModel->getItemExtraFormList($args->module_srl);
     $this->_createInsertItemRuleset($extra_vars);
 }
コード例 #24
0
 function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode)
 {
     // 원본 메뉴들을 구함
     $oMenuAdminModel =& getAdminModel('menu');
     $target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
     if ($target_item->menu_item_srl != $target_srl) {
         return new Object(-1, 'msg_invalid_request');
     }
     // 위치 이동 (순서 조절)
     if ($mode == 'move') {
         $args->parent_srl = $parent_srl;
         $args->menu_srl = $menu_srl;
         if ($source_srl) {
             $source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
             if ($source_item->menu_item_srl != $source_srl) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $args->listorder = $source_item->listorder - 1;
         } else {
             $output = executeQuery('menu.getMaxListorder', $args);
             if (!$output->toBool()) {
                 return $output;
             }
             $args->listorder = (int) $output->data->listorder;
             if (!$args->listorder) {
                 $args->listorder = 0;
             }
         }
         $args->parent_srl = $parent_srl;
         $output = executeQuery('menu.updateMenuItemListorder', $args);
         if (!$output->toBool()) {
             return $output;
         }
         $args->parent_srl = $parent_srl;
         $args->menu_item_srl = $target_srl;
         $output = executeQuery('menu.updateMenuItemNode', $args);
         if (!$output->toBool()) {
             return $output;
         }
         // 자식으로 추가
     } elseif ($mode == 'insert') {
         $args->menu_item_srl = $target_srl;
         $args->parent_srl = $parent_srl;
         $args->listorder = -1 * getNextSequence();
         $output = executeQuery('menu.updateMenuItemNode', $args);
         if (!$output->toBool()) {
             return $output;
         }
     }
     $xml_file = $this->makeXmlFile($menu_srl);
     return $xml_file;
 }
コード例 #25
0
 /**
  * Insert alias for document
  * @return void|object
  */
 function procDocumentAdminInsertAlias()
 {
     $args = Context::gets('module_srl', 'document_srl', 'alias_title');
     $alias_srl = Context::get('alias_srl');
     if (!$alias_srl) {
         $args->alias_srl = getNextSequence();
         $query = "document.insertAlias";
     } else {
         $args->alias_srl = $alias_srl;
         $query = "document.updateAlias";
     }
     $output = executeQuery($query, $args);
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl);
     return $this->setRedirectUrl($returnUrl, $output);
 }
コード例 #26
0
ファイル: board.controller.php プロジェクト: 1Sam/rhymix
 /**
  * @brief insert comments
  **/
 function procBoardInsertComment()
 {
     // check grant
     if (!$this->grant->write_comment) {
         return new Object(-1, 'msg_not_permitted');
     }
     $logged_info = Context::get('logged_info');
     // get the relevant data for inserting comment
     $obj = Context::getRequestVars();
     $obj->module_srl = $this->module_srl;
     if (!$this->module_info->use_status) {
         $this->module_info->use_status = 'PUBLIC';
     }
     if (!is_array($this->module_info->use_status)) {
         $this->module_info->use_status = explode('|@|', $this->module_info->use_status);
     }
     if (in_array('SECRET', $this->module_info->use_status)) {
         $this->module_info->secret = 'Y';
     } else {
         unset($obj->is_secret);
         $this->module_info->secret = 'N';
     }
     // check if the doument is existed
     $oDocumentModel = getModel('document');
     $oDocument = $oDocumentModel->getDocument($obj->document_srl);
     if (!$oDocument->isExists()) {
         return new Object(-1, 'msg_not_founded');
     }
     // For anonymous use, remove writer's information and notifying information
     if ($this->module_info->use_anonymous == 'Y') {
         $this->module_info->admin_mail = '';
         $obj->notify_message = 'N';
         $obj->member_srl = -1 * $logged_info->member_srl;
         $obj->email_address = $obj->homepage = $obj->user_id = '';
         $obj->user_name = $obj->nick_name = 'anonymous';
         $bAnonymous = true;
     } else {
         $bAnonymous = false;
     }
     // generate comment  module model object
     $oCommentModel = getModel('comment');
     // generate comment module controller object
     $oCommentController = getController('comment');
     // check the comment is existed
     // if the comment is not existed, then generate a new sequence
     if (!$obj->comment_srl) {
         $obj->comment_srl = getNextSequence();
     } else {
         $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
     }
     $oMemberModel = getModel('member');
     $member_info = $oMemberModel->getMemberInfoByMemberSrl($comment->member_srl);
     if ($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') {
         return new Object(-1, 'msg_admin_comment_no_modify');
     }
     // if comment_srl is not existed, then insert the comment
     if ($comment->comment_srl != $obj->comment_srl) {
         // parent_srl is existed
         if ($obj->parent_srl) {
             $parent_comment = $oCommentModel->getComment($obj->parent_srl);
             if (!$parent_comment->comment_srl) {
                 return new Object(-1, 'msg_invalid_request');
             }
             $output = $oCommentController->insertComment($obj, $bAnonymous);
             // parent_srl is not existed
         } else {
             $output = $oCommentController->insertComment($obj, $bAnonymous);
         }
         // update the comment if it is not existed
     } else {
         // check the grant
         if (!$comment->isGranted()) {
             return new Object(-1, 'msg_not_permitted');
         }
         $obj->parent_srl = $comment->parent_srl;
         $output = $oCommentController->updateComment($obj, $this->grant->manager);
         $comment_srl = $obj->comment_srl;
     }
     if (!$output->toBool()) {
         return $output;
     }
     $this->setMessage('success_registed');
     $this->add('mid', Context::get('mid'));
     $this->add('document_srl', $obj->document_srl);
     $this->add('comment_srl', $obj->comment_srl);
 }
コード例 #27
0
ファイル: member.controller.php プロジェクト: rhymix/rhymix
 /**
  * Add users to the member table
  */
 function insertMember(&$args, $password_is_hashed = false)
 {
     // Call a trigger (before)
     $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args);
     if (!$output->toBool()) {
         return $output;
     }
     // Terms and Conditions portion of the information set up by members reaffirmed
     $oMemberModel = getModel('member');
     $config = $oMemberModel->getMemberConfig();
     $logged_info = Context::get('logged_info');
     // limit_date format is YYYYMMDD
     if ($args->limit_date) {
         // mobile input date format can be different
         if ($args->limit_date !== intval($args->limit_date)) {
             $args->limit_date = date('Ymd', strtotime($args->limit_date));
         } else {
             $args->limit_date = intval($args->limit_date);
         }
     }
     // If the date of the temporary restrictions limit further information on the date of
     if ($config->limit_day) {
         $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24);
     }
     $args->member_srl = getNextSequence();
     $args->list_order = -1 * $args->member_srl;
     // Execute insert or update depending on the value of member_srl
     if (!$args->user_id) {
         $args->user_id = 't' . $args->member_srl;
     } else {
         $args->user_id = strtolower($args->user_id);
     }
     if (!$args->user_name) {
         $args->user_name = $args->member_srl;
     }
     if (!$args->nick_name) {
         $args->nick_name = $args->member_srl;
     }
     // Control of essential parameters
     if ($args->allow_mailing != 'Y') {
         $args->allow_mailing = 'N';
     }
     if ($args->denied != 'Y') {
         $args->denied = 'N';
     }
     $args->allow_message = 'Y';
     if ($logged_info->is_admin == 'Y') {
         if ($args->is_admin != 'Y') {
             $args->is_admin = 'N';
         }
     } else {
         unset($args->is_admin);
     }
     list($args->email_id, $args->email_host) = explode('@', $args->email_address);
     // Sanitize user ID, username, nickname, homepage, blog
     $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
     $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
     $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
     $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
     $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
     if ($args->homepage && !preg_match("/^[a-z]+:\\/\\//i", $args->homepage)) {
         $args->homepage = 'http://' . $args->homepage;
     }
     if ($args->blog && !preg_match("/^[a-z]+:\\/\\//i", $args->blog)) {
         $args->blog = 'http://' . $args->blog;
     }
     $extend_form_list = $oMemberModel->getCombineJoinForm($memberInfo);
     $security = new Security($extend_form_list);
     $security->encodeHTML('..column_title', '..description', '..default_value.');
     if ($config->signupForm) {
         foreach ($config->signupForm as $no => $formInfo) {
             if (!$formInfo->isUse) {
                 continue;
             }
             if ($formInfo->isDefaultForm) {
                 // birthday format is YYYYMMDD
                 if ($formInfo->name === 'birthday' && $args->{$formInfo->name}) {
                     // mobile input date format can be different
                     if ($args->{$formInfo->name} !== intval($args->{$formInfo->name})) {
                         $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name}));
                     } else {
                         $args->{$formInfo->name} = intval($args->{$formInfo->name});
                     }
                 }
             } else {
                 $extendForm = $extend_form_list[$formInfo->member_join_form_srl];
                 // date format is YYYYMMDD
                 if ($extendForm->column_type == 'date' && $args->{$formInfo->name}) {
                     if ($args->{$formInfo->name} !== intval($args->{$formInfo->name})) {
                         $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name}));
                     } else {
                         $args->{$formInfo->name} = intval($args->{$formInfo->name});
                     }
                 }
             }
         }
     }
     // Create a model object
     $oMemberModel = getModel('member');
     // Check password strength
     if ($args->password && !$password_is_hashed) {
         if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) {
             $message = lang('about_password_strength');
             return new Object(-1, $message[$config->password_strength]);
         }
         $args->password = $oMemberModel->hashPassword($args->password);
     } elseif (!$args->password) {
         unset($args->password);
     }
     // Check if ID is prohibited
     if ($logged_info->is_admin !== 'Y' && $oMemberModel->isDeniedID($args->user_id)) {
         return new Object(-1, 'denied_user_id');
     }
     // Check if ID is duplicate
     $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_user_id');
     }
     // Check if nickname is prohibited
     if ($logged_info->is_admin !== 'Y' && $oMemberModel->isDeniedNickName($args->nick_name)) {
         return new Object(-1, 'denied_nick_name');
     }
     // Check if nickname is duplicate
     $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_nick_name');
     }
     // Check managed Email Host
     if ($logged_info->is_admin !== 'Y' && $oMemberModel->isDeniedEmailHost($args->email_address)) {
         $config = $oMemberModel->getMemberConfig();
         $emailhost_check = $config->emailhost_check;
         $managed_email_host = lang('managed_email_host');
         $email_hosts = $oMemberModel->getManagedEmailHosts();
         foreach ($email_hosts as $host) {
             $hosts[] = $host->email_host;
         }
         $message = sprintf($managed_email_host[$emailhost_check], implode(', ', $hosts), 'id@' . implode(', id@', $hosts));
         return new Object(-1, $message);
     }
     // Check if email address is duplicate
     $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
     if ($member_srl) {
         return new Object(-1, 'msg_exists_email_address');
     }
     // Insert data into the DB
     $args->list_order = -1 * $args->member_srl;
     if (!$args->user_id) {
         $args->user_id = 't' . $args->member_srl;
     }
     if (!$args->user_name) {
         $args->user_name = $args->member_srl;
     }
     $oDB =& DB::getInstance();
     $oDB->begin();
     $output = executeQuery('member.insertMember', $args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     if (is_array($args->group_srl_list)) {
         $group_srl_list = $args->group_srl_list;
     } else {
         $group_srl_list = explode('|@|', $args->group_srl_list);
     }
     // If no value is entered the default group, the value of group registration
     if (!$args->group_srl_list) {
         $columnList = array('site_srl', 'group_srl');
         $default_group = $oMemberModel->getDefaultGroup(0, $columnList);
         if ($default_group) {
             // Add to the default group
             $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl);
             if (!$output->toBool()) {
                 $oDB->rollback();
                 return $output;
             }
         }
         // If the value is the value of the group entered the group registration
     } else {
         for ($i = 0; $i < count($group_srl_list); $i++) {
             $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]);
             if (!$output->toBool()) {
                 $oDB->rollback();
                 return $output;
             }
         }
     }
     // When using email authentication mode (when you subscribed members denied a) certified mail sent
     if ($args->denied == 'Y') {
         // Insert data into the authentication DB
         $auth_args = new stdClass();
         $auth_args->user_id = $args->user_id;
         $auth_args->member_srl = $args->member_srl;
         $auth_args->new_password = $args->password;
         $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex');
         $auth_args->is_register = 'Y';
         $output = executeQuery('member.insertAuthMail', $auth_args);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         $this->_sendAuthMail($auth_args, $args);
     }
     ModuleHandler::triggerCall('member.insertMember', 'after', $args);
     $oDB->commit(true);
     $output->add('member_srl', $args->member_srl);
     return $output;
 }
コード例 #28
0
 function procMaterialInsert()
 {
     $var = Context::getRequestVars();
     if (!$var->auth || !$var->type) {
         return new Object(-1, 'msg_not_permitted');
     }
     $oMaterialModel =& getModel('material');
     $member_srl = $oMaterialModel->getMemberSrlByAuth($var->auth);
     if (!$member_srl) {
         return new Object(-1, 'msg_invalid_request');
     }
     if ($var->type == 'img') {
         if ($var->image) {
             $path = sprintf('files/cache/material/tmp/%s/', getNumberingPath($member_srl));
             $filename = basename($var->image);
             $file = $path . $filename;
             FileHandler::makeDir($path);
             FileHandler::getRemoteFile($var->image, $file);
             if (file_exists($file)) {
                 $material_srl = getNextSequence();
                 $ext = substr(strrchr($filename, '.'), 1);
                 $ext = array_shift(explode('?', $ext));
                 // insert file module
                 $file_info = array();
                 $file_info['tmp_name'] = $file;
                 $file_info['name'] = sprintf("%s.%s", $material_srl, $ext);
                 $oFileController =& getController('file');
                 $output = $oFileController->insertFile($file_info, $member_srl, $material_srl, 0, true);
                 if (!$output->toBool()) {
                     return $output;
                 }
                 //set File valid
                 $oFileController->setFilesValid($output->get('upload_target_srl'));
                 // delete temp file
                 FileHandler::removeFile($filename);
                 $uploaded_filename = $output->get('uploaded_filename');
                 $_filename = sprintf("%s%s.%%s.%s", preg_replace("/\\/[^\\/]*\$/", "/", $uploaded_filename), $material_srl, $ext);
                 $s_filename = sprintf($_filename, 'S');
                 list($w, $h) = @getimagesize($uploaded_filename);
                 if ($w > $this->thum['S']['width'] || $h > $this->thum['S']['height']) {
                     FileHandler::createImageFile($uploaded_filename, $s_filename, $this->thum['S']['width'], $h, '', 'ratio');
                 } else {
                     FileHandler::copyFile($uploaded_filename, $s_filename);
                 }
                 // replace image src
                 $var->content = str_replace($var->image, $uploaded_filename, $var->content);
             } else {
                 $var->image = null;
             }
         } else {
             return new Object(-1, 'msg_not_select_image');
         }
     }
     // there is no file or copy failed
     if ($var->type == 'img' && !$var->image) {
         return new Object(-1, 'msg_fail_image_save');
     }
     $args->material_srl = $material_srl ? $material_srl : getNextSequence();
     $args->member_srl = $member_srl;
     $args->type = $var->type;
     $args->content = $var->content;
     $output = executeQuery('material.insertMaterial', $args);
     return $output;
 }
コード例 #29
0
ファイル: layout.model.php プロジェクト: rhymix/rhymix
 /**
  * Get layout instance list
  * @param int $siteSrl
  * @param string $layoutType (P : PC, M : Mobile)
  * @param string $layout name of layout
  * @param array $columnList
  * @return array layout lists in site
  */
 function getLayoutInstanceList($siteSrl = 0, $layoutType = 'P', $layout = null, $columnList = array())
 {
     if (!$siteSrl) {
         $siteModuleInfo = Context::get('site_module_info');
         $siteSrl = (int) $siteModuleInfo->site_srl;
     }
     $args = new stdClass();
     $args->site_srl = $siteSrl;
     $args->layout_type = $layoutType;
     $args->layout = $layout;
     $output = executeQueryArray('layout.getLayoutList', $args, $columnList);
     // Create instance name list
     $instanceList = array();
     if (is_array($output->data)) {
         foreach ($output->data as $no => $iInfo) {
             if ($this->isExistsLayoutFile($iInfo->layout, $layoutType)) {
                 $instanceList[] = $iInfo->layout;
             } else {
                 unset($output->data[$no]);
             }
         }
     }
     // Create downloaded name list
     $downloadedList = array();
     $titleList = array();
     $_downloadedList = $this->getDownloadedLayoutList($layoutType);
     if (is_array($_downloadedList)) {
         foreach ($_downloadedList as $dLayoutInfo) {
             $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout;
             $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title;
         }
     }
     if ($layout) {
         if (count($instanceList) < 1 && $downloadedList[$layout]) {
             $insertArgs = new stdClass();
             $insertArgs->site_srl = $siteSrl;
             $insertArgs->layout_srl = getNextSequence();
             $insertArgs->layout = $layout;
             $insertArgs->title = $titleList[$layout];
             $insertArgs->layout_type = $layoutType;
             $oLayoutAdminController = getAdminController('layout');
             $oLayoutAdminController->insertLayout($insertArgs);
             $isCreateInstance = TRUE;
         }
     } else {
         // Get downloaded name list have no instance
         $noInstanceList = array_diff($downloadedList, $instanceList);
         foreach ($noInstanceList as $layoutName) {
             $insertArgs = new stdClass();
             $insertArgs->site_srl = $siteSrl;
             $insertArgs->layout_srl = getNextSequence();
             $insertArgs->layout = $layoutName;
             $insertArgs->title = $titleList[$layoutName];
             $insertArgs->layout_type = $layoutType;
             $oLayoutAdminController = getAdminController('layout');
             $oLayoutAdminController->insertLayout($insertArgs);
             $isCreateInstance = TRUE;
         }
     }
     // If create layout instance, reload instance list
     if ($isCreateInstance) {
         $output = executeQueryArray('layout.getLayoutList', $args, $columnList);
         if (is_array($output->data)) {
             foreach ($output->data as $no => $iInfo) {
                 if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) {
                     unset($output->data[$no]);
                 }
             }
         }
     }
     return $output->data;
 }
コード例 #30
0
 function insertMileageHistory($args, $order_srl = 0)
 {
     $args->history_srl = getNextSequence();
     $args->order_srl = $order_srl;
     return executeQuery('nmileage.insertMileageHistory', $args);
 }