<commit_before><?php
    /**
     * @class  boardAdminController
     * @author zero (<EMAIL>)
     * @brief  board module admin controller class
     **/

    class boardAdminController extends board {

        /**
         * @brief initialization
         **/
        function init() {
        }

        /**
         * @brief insert borad module
         **/
        function procBoardAdminInsertBoard($args = null) {
            // igenerate module model/controller object
            $oModuleController = &getController('module');
            $oModuleModel = &getModel('module');

            // setup the board module infortmation
            $args = Context::getRequestVars();
            $args->module = 'board';
            $args->mid = $args->board_name;
			if(is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status);
            unset($args->board_name);

            // setup other variables
            if($args->except_notice!='Y') $args->except_notice = 'N';
            if($args->use_anonymous!='Y') $args->use_anonymous= 'N';
            if($args->consultation!='Y') $args->consultation = 'N';
            if(!in_array($args->order_target,$this->order_target)) $args->order_target = 'list_order';
            if(!in_array($args->order_type,array('asc','desc'))) $args->order_type = 'asc';

            // if there is an existed module
            if($args->module_srl) {
                $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
                if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
            }

            // insert/update the board module based on module_srl
            if(!$args->module_srl) {
                $output = $oModuleController->insertModule($args);
                $msg_code = 'success_registed';
            } else {
                $output = $oModuleController->updateModule($args);
                $msg_code = 'success_updated';
            }

            if(!$output->toBool()) return $output;

			// setup list config
			$list = explode(',',Context::get('list'));
			if(count($list))
			{
				$list_arr = array();
				foreach($list as $val) 
				{
					$val = trim($val);
					if(!$val) continue;
					if(substr($val,0,10)=='extra_vars') $val = substr($val,10);
					$list_arr[] = $val;
				}
				$oModuleController = &getController('module');
				$oModuleController->insertModulePartConfig('board', $output->get('module_srl'), $list_arr);
			}

            $this->setMessage($msg_code);
			if (Context::get('success_return_url')){
				$this->setRedirectUrl(Context::get('success_return_url'));
			}else{
				$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminBoardInfo', 'module_srl', $output->get('module_srl')));
			}
        }

		/**
		 * Board info update in basic setup page
		 * @return void
		 */
		public function procBoardAdminUpdateBoardFroBasic()
		{
			$args = Context::getRequestVars();

			// for board info
			$args->module = 'board';
			$args->mid = $args->board_name;
			if(is_array($args->use_status))
			{
				$args->use_status = implode('|@|', $args->use_status);
			}
			unset($args->board_name);

			if(!in_array($args->order_target, $this->order_target))
			{
				$args->order_target = 'list_order';
			}
			if(!in_array($args->order_type, array('asc', 'desc')))
			{
				$args->order_type = 'asc';
			}

			$oModuleController = &getController('module');
			$output = $oModuleController->updateModule($args);

			// for grant info, Register Admin ID
			$oModuleController->deleteAdminId($args->module_srl);
			if($args->admin_member)
			{
				$admin_members = explode(',',$args->admin_member);
				for($i=0;$i<count($admin_members);$i++)
				{
					$admin_id = trim($admin_members[$i]);
					if(!$admin_id) continue;
					$oModuleController->insertAdminId($args->module_srl, $admin_id);
				}
			}
		}

        /**
         * @brief delete the board module
         **/
        function procBoardAdminDeleteBoard() {
            $module_srl = Context::get('module_srl');

            // get the current module
            $oModuleController = &getController('module');
            $output = $oModuleController->deleteModule($module_srl);
            if(!$output->toBool()) return $output;

            $this->add('module','board');
            $this->add('page',Context::get('page'));
            $this->setMessage('success_deleted');
        }

    }
?>
<commit_msg>issue 170 add changeValueInUrl function in redirect<commit_after><?php
    /**
     * @class  boardAdminController
     * @author zero (<EMAIL>)
     * @brief  board module admin controller class
     **/

    class boardAdminController extends board {

        /**
         * @brief initialization
         **/
        function init() {
        }

        /**
         * @brief insert borad module
         **/
        function procBoardAdminInsertBoard($args = null) {
            // igenerate module model/controller object
            $oModuleController = &getController('module');
            $oModuleModel = &getModel('module');

            // setup the board module infortmation
            $args = Context::getRequestVars();
            $args->module = 'board';
            $args->mid = $args->board_name;
			if(is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status);
            unset($args->board_name);

            // setup other variables
            if($args->except_notice!='Y') $args->except_notice = 'N';
            if($args->use_anonymous!='Y') $args->use_anonymous= 'N';
            if($args->consultation!='Y') $args->consultation = 'N';
            if(!in_array($args->order_target,$this->order_target)) $args->order_target = 'list_order';
            if(!in_array($args->order_type,array('asc','desc'))) $args->order_type = 'asc';

            // if there is an existed module
            if($args->module_srl) {
                $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
                if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
            }

            // insert/update the board module based on module_srl
            if(!$args->module_srl) {
                $output = $oModuleController->insertModule($args);
                $msg_code = 'success_registed';
            } else {
                $output = $oModuleController->updateModule($args);
                $msg_code = 'success_updated';
            }

            if(!$output->toBool()) return $output;

			// setup list config
			$list = explode(',',Context::get('list'));
			if(count($list))
			{
				$list_arr = array();
				foreach($list as $val) 
				{
					$val = trim($val);
					if(!$val) continue;
					if(substr($val,0,10)=='extra_vars') $val = substr($val,10);
					$list_arr[] = $val;
				}
				$oModuleController = &getController('module');
				$oModuleController->insertModulePartConfig('board', $output->get('module_srl'), $list_arr);
			}

            $this->setMessage($msg_code);
			if (Context::get('success_return_url')){
				changeValueInUrl('mid', $args->mid, $module_info->mid);
				$this->setRedirectUrl(Context::get('success_return_url'));
			}else{
				$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminBoardInfo', 'module_srl', $output->get('module_srl')));
			}
        }

		/**
		 * Board info update in basic setup page
		 * @return void
		 */
		public function procBoardAdminUpdateBoardFroBasic()
		{
			$args = Context::getRequestVars();

			// for board info
			$args->module = 'board';
			$args->mid = $args->board_name;
			if(is_array($args->use_status))
			{
				$args->use_status = implode('|@|', $args->use_status);
			}
			unset($args->board_name);

			if(!in_array($args->order_target, $this->order_target))
			{
				$args->order_target = 'list_order';
			}
			if(!in_array($args->order_type, array('asc', 'desc')))
			{
				$args->order_type = 'asc';
			}

			$oModuleController = &getController('module');
			$output = $oModuleController->updateModule($args);

			// for grant info, Register Admin ID
			$oModuleController->deleteAdminId($args->module_srl);
			if($args->admin_member)
			{
				$admin_members = explode(',',$args->admin_member);
				for($i=0;$i<count($admin_members);$i++)
				{
					$admin_id = trim($admin_members[$i]);
					if(!$admin_id) continue;
					$oModuleController->insertAdminId($args->module_srl, $admin_id);
				}
			}
		}

        /**
         * @brief delete the board module
         **/
        function procBoardAdminDeleteBoard() {
            $module_srl = Context::get('module_srl');

            // get the current module
            $oModuleController = &getController('module');
            $output = $oModuleController->deleteModule($module_srl);
            if(!$output->toBool()) return $output;

            $this->add('module','board');
            $this->add('page',Context::get('page'));
            $this->setMessage('success_deleted');
        }

    }
?>

{'fraction_non_alphanumeric': 0.16722074468085107, 'fraction_numerical': 0.0016622340425531915, 'mean_word_length': 2.587042925278219, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 125, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3712759', 'n_tokens_mistral': 3071, 'n_tokens_neox': 2730, 'n_words': 443}