/**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数(items,item_id=0を許すかどうか)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $mdbView =& $container->getComponent("mdbView");
     // metadata_id取得
     $metadata_id = intval($attributes);
     if (isset($params[1]) && $params[1] == _ON && $metadata_id == 0) {
         return;
     }
     $metadata =& $mdbView->getMetadataById($metadata_id);
     if ($metadata === false) {
         return $errStr;
     }
     //
     // Actionにデータセット
     //
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $metadata));
     } else {
         BeanUtils::setAttributes($action, array("metadata" => $metadata));
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数(items,item_id=0を許すかどうか)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $usersView =& $container->getComponent("usersView");
     // item_id取得
     $item_id = intval($attributes);
     if (isset($params[1]) && $params[1] == _ON && $item_id == 0) {
         return;
     }
     $items =& $usersView->getItemById($item_id);
     if ($items === false) {
         return $errStr;
     }
     //
     // Actionにデータセット
     //
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $items));
     } else {
         BeanUtils::setAttributes($action, array("items" => $items));
     }
     return;
 }
 /**
  * Injectionを行う
  *
  * @access  public
  * @since   3.0.0
  */
 function execute()
 {
     $log =& LogFactory::getLog();
     $log->trace("Filter_InjectSessionの前処理が実行されました", "Filter_InjectSession#execute");
     //
     // 設定ファイルに入っていた値を元に設定
     //
     $container =& DIContainerFactory::getContainer();
     if ($this->getSize() > 0) {
         $session =& $container->getComponent("Session");
         $params = $session->getParameters();
         if (count($params) > 0) {
             foreach ($this->getAttributes() as $key => $value) {
                 $component =& $container->getComponent($key);
                 if (is_object($component)) {
                     BeanUtils::setAttributes($component, $params, true);
                 } else {
                     $log->error("不正なコンポーネントが設定ファイルで指定されています({$key})", "Filter_InjectSession#execute");
                 }
             }
         }
     }
     $filterChain =& $container->getComponent("FilterChain");
     $filterChain->execute();
     $log->trace("Filter_InjectSessionの後処理が実行されました", "Filter_InjectSession#execute");
 }
 /**
  * ブロックグルーピング時チェック
  *
  * @param   mixed   $attributes チェックする値(配列の場合あり)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     (使用しない)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $grouping_list = $attributes;
     $getdata =& $container->getComponent("GetData");
     //$request =& $container->getComponent("Request");
     $blocksView =& $container->getComponent("blocksView");
     $blocks_obj = $getdata->getParameter("blocks");
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if ($grouping_list == "" || $grouping_list == null) {
         return $errStr;
     }
     $cellLists = explode(":", $grouping_list);
     foreach ($cellLists as $cellList) {
         $rowLists = explode(",", $cellList);
         foreach ($rowLists as $rowList) {
             $block_id = $rowList;
             $blocks_obj[$block_id] =& $blocksView->getBlockById($block_id);
             //ブロックが存在しないならばエラー
             if (!$blocks_obj[$block_id] && !is_array($blocks_obj[$block_id])) {
                 return $errStr;
             }
         }
     }
     $getdata->setParameter("blocks", $blocks_obj);
     BeanUtils::setAttributes($action, array("grouping_list" => $grouping_list));
 }
 /**
  * @covers BeanUtils::getValues
  */
 public function testGetValues()
 {
     $beans = $this->generateBeans(4);
     $actual = \BeanUtils::getValues($beans, "getId");
     $expected = array(0, 1, 2, 3);
     $this->assertEquals($expected, $actual);
 }
 /**
  * 配置ブロックがショートカットならばエラー
  *
  * @param   mixed   $attributes チェックする値(int block_id)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     (使用しない)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $block_id = $attributes;
     $container =& DIContainerFactory::getContainer();
     $getdata =& $container->getComponent("GetData");
     $blocksView =& $container->getComponent("blocksView");
     if ($block_id != null && $block_id != 0) {
         //block_idが指定されていない場合、チェックしない
         $blocks = $getdata->getParameter("blocks");
         if (!isset($blocks[$block_id])) {
             $block =& $blocksView->getBlockById($block_id);
         } else {
             $block =& $blocks[$block_id];
         }
         if (!isset($block)) {
             //ブロックがなければエラー
             return $errStr;
         }
         if ($block['shortcut_flag'] == _ON) {
             //ショートカットされたモジュールならばエラー
             return $errStr;
         }
         if (isset($params[0])) {
             $actionChain =& $container->getComponent("ActionChain");
             $action =& $actionChain->getCurAction();
             BeanUtils::setAttributes($action, array($params[0] => $block));
         }
     }
 }
 /**
  * 固定リンクエラーチェック
  *
  * @param   mixed   $attributes チェックする値(配列の場合あり)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     (使用しない)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $pagesView =& $container->getComponent("pagesView");
     $session =& $container->getComponent("Session");
     $db =& $container->getComponent("DbObject");
     if ($session->getParameter("_permalink_flag") == _OFF) {
         // 固定リンクを使用しない
         return;
     }
     $permalink = $attributes[0];
     $titletag = $attributes[1];
     $main_page_id = $attributes[2];
     $page =& $pagesView->getPageById($main_page_id);
     if (preg_match(_PERMALINK_PROHIBITION, $permalink) || preg_match(_PERMALINK_PROHIBITION_DIR_PATTERN, $permalink)) {
         return $errStr;
     }
     $meta = $pagesView->getDafaultMeta($page);
     $permalink_arr = explode('/', $meta['permalink']);
     $all_count = count($permalink_arr);
     $count = 1;
     $perma_parent_permalink = "";
     foreach ($permalink_arr as $cur_permalink) {
         if ($all_count == $count) {
             $last_permalink = $cur_permalink;
         } else {
             if ($perma_parent_permalink != "") {
                 $perma_parent_permalink .= '/';
             }
             $perma_parent_permalink .= $cur_permalink;
         }
         $count++;
     }
     if ($last_permalink != $permalink) {
         $perma_parent_permalink = $perma_parent_permalink != "" ? $perma_parent_permalink . '/' : $perma_parent_permalink;
         $set_permalink = $perma_parent_permalink . $permalink;
         $where_params = array("permalink" => $set_permalink, 'lang_dirname' => $session->getParameter('_lang'), "page_id!=" . intval($main_page_id) => null);
         $pages = $db->selectExecute("pages", $where_params);
         if (isset($pages[0])) {
             //同名の固定リンクあり
             return DIALOG_PAGESTYLE_ERR_MES_PERMALINK_SAMENAME;
         }
     } else {
         // 変更なし
         $set_permalink = "";
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $set_permalink));
     }
     if (isset($params[1])) {
         BeanUtils::setAttributes($action, array($params[1] => $meta));
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値(emai, code_date)
  *
  * @param   string  $errStr エラー文字列(未使用:エラーメッセージ固定)
  * @param   array   $params オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $usersView =& $container->getComponent("usersView");
     $db =& $container->getComponent("DbObject");
     $email = preg_replace("/[ \\s]+/u", "", $attributes[0]);
     $code_date = $attributes[1];
     $login_forgetpass_count = $session->getParameter("login_forgetpass_count");
     if (isset($login_forgetpass_count) && $login_forgetpass_count >= 3) {
         // 入力を受け付けない
         return LOGIN_MISS_EMAIL;
     }
     // 入力文字チェック
     if ($email != "" && !strpos($email, "@")) {
         return sprintf(_FORMAT_WRONG_ERROR, "e-mail");
     }
     // 存在チェック
     $userIdByMail = $usersView->getUserIdByMail($email, true);
     if (empty($userIdByMail)) {
         if (!isset($login_forgetpass_count) || !is_int($login_forgetpass_count)) {
             $login_forgetpass_count = 1;
         } else {
             $login_forgetpass_count++;
         }
         $session->setParameter("login_forgetpass_count", $login_forgetpass_count);
         if ($login_forgetpass_count >= 3) {
             //3回目以降
             return LOGIN_MISS_EMAIL;
         } else {
             return LOGIN_INCORRECT_EMAIL;
         }
     }
     // 存在しているものでも何度も送信されるのを防ぐ必要があるかも
     // 現状、処理しない
     $user =& $usersView->getUserById($userIdByMail);
     if ($user === false || !isset($user['user_id'])) {
         return sprintf(_INVALID_SELECTDB, "users");
     }
     if (isset($code_date)) {
         if ($code_date != substr($user['password'], 0, 10)) {
             // 正しくないcode_dataがきた場合
             return LOGIN_MISS_CODEDATA;
         }
     }
     // Actionにデータセット
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("user" => $user));
     BeanUtils::setAttributes($action, array("send_email" => $email));
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $mdbView =& $container->getComponent("mdbView");
     // metadata_id取得
     $metadata_id = intval($attributes["metadata_id"]);
     if ($metadata_id != 0) {
         // 項目編集
         $metadata =& $mdbView->getMetadataById($metadata_id);
         if ($metadata === false) {
             return $errStr;
         }
         //
         // Actionにデータセット
         //
         // actionChain取得
         $actionChain =& $container->getComponent("ActionChain");
         $action =& $actionChain->getCurAction();
         if (isset($params[0])) {
             BeanUtils::setAttributes($action, array($params[0] => $metadata));
         } else {
             BeanUtils::setAttributes($action, array("items" => $metadata));
         }
     }
     if ($attributes["type"] == MULTIDATABASE_META_TYPE_SECTION || $attributes["type"] == MULTIDATABASE_META_TYPE_MULTIPLE) {
         //
         // 選択式
         //
         if (!isset($attributes["options"]) || count($attributes["options"]) == 0) {
             //選択肢に1項目も指定していない
             return MULTIDATABASE_ERR_NONEEXISTS_OPTIONS;
         }
         $select_count = 0;
         $option_arr = array();
         foreach ($attributes["options"] as $key => $options) {
             if (!strlen(trim($options))) {
                 return MULTIDATABASE_ERR_OPTION_EMPTY_NAME;
             }
             if (in_array($options, $option_arr, true)) {
                 //同じ選択肢値が存在する
                 return MULTIDATABASE_ERR_DUPLICATION_CHAR_OPTIONS;
             }
             array_push($option_arr, $options);
             if (preg_match("/\\|/", $options)) {
                 //禁止文字「|」
                 return MULTIDATABASE_ERR_PROHIBITION_CHAR_OPTIONS;
             }
         }
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $modulesView =& $container->getComponent("modulesView");
     $module_id = intval($attributes);
     $module_obj = $modulesView->getModulesById($module_id);
     if ($module_obj["search_action"] == "") {
         return $errStr;
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("module_obj" => $module_obj));
 }
 /**
  * ブロックに配置しているかどうかをチェック
  *
  * @param   mixed   $attributes block_id_arr(ブロックIDの配列)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     なし
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  * @since   3.0.0
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $modulesView =& $container->getComponent("modulesView");
     $module_name = $modulesView->loadModuleName("questionnaire");
     if (empty($attributes)) {
         return sprintf($errStr, $module_name);
     }
     $questionnaireView =& $container->getComponent("questionnaireView");
     $questionnaire_list = $questionnaireView->getBlocksForMobile($attributes);
     if (empty($questionnaire_list)) {
         return sprintf($errStr, $module_name);
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("questionnaire_list" => $questionnaire_list));
 }
 /**
  * ブロックに配置してあるかどうか
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $chatView =& $container->getComponent("chatView");
     $actionChain =& $container->getComponent("ActionChain");
     $actionName = $actionChain->getCurActionName();
     $block_id = $attributes;
     if (empty($block_id) || $actionName == "chat_action_edit_create") {
         $chat_obj = $chatView->getDefaultChat();
     } else {
         $chat_obj = $chatView->getChatById($block_id);
     }
     if ($chat_obj === false || !isset($chat_obj)) {
         return $errStr;
     }
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("chat_obj" => $chat_obj));
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     //0であれば新規作成なのでエラーとしない
     $role_authority_id = intval($attributes);
     if ($role_authority_id == 0) {
         return;
     }
     // 権限管理データ取得
     $authoritiesView =& $container->getComponent("authoritiesView");
     $auth =& $authoritiesView->getAuthorityById($role_authority_id);
     if ($auth === false || !isset($auth['role_authority_id'])) {
         return $errStr;
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("authority" => $auth));
     return;
 }
    public function run()
    {
        reset($_GET);
        $map = sizeof($_GET) > 0 ? $this->getAction(key($_GET)) : $this->getWelcome();
        if ($map->hasInput()) {
            $this->loadForward($map->getInputForward(), $this->getRequest());
        } else {
            $form = new ActionForm();
            $fname = $map->getFormName();
            if (!empty($fname)) {
                //generate form class
                $form = $this->getForm($map->getFormName());
                //populate form class
                BeanUtils::populate($_REQUEST, $form);
                //validate if necessary
                if ($map->getValidate()) {
                    if (!$form->validate($map)) {
                        ?>
<script>history.go(-1);</script><?php 
                        exit;
                    }
                }
            }
            //require the class file if not declared
            if (!class_exists($map->getClass())) {
                if (file_exists($map->getPath())) {
                    require_once $map->getPath();
                } else {
                    throw new FileNotFoundException($map->getPath());
                }
            }
            //get the class name in mapping
            $class = $map->getClass();
            //create the class
            $action = new $class();
            //execute & forward
            $forward = $action->execute($map, $form, $this->getRequest());
            if ($forward instanceof ActionForward) {
                $this->loadForward($forward, $this->getRequest());
            }
        }
    }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     if (empty($attributes["display_modules"])) {
         return $errStr;
     }
     $req_display_modules = $attributes["display_modules"];
     $ret_display_modules = array();
     foreach ($req_display_modules as $i => $value) {
         if (intval($value) == 0) {
             continue;
         }
         $ret_display_modules[] = intval($value);
     }
     if (empty($ret_display_modules)) {
         return $errStr;
     }
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("display_modules" => $ret_display_modules));
 }
Example #16
0
 /**
  * Call all the necessary methods
  */
 public function read($directory, $fileName, $parameters, $config = array(), $left = 0, $top = 0, $subreport = false)
 {
     //geting the bean
     $xmlContent = FileUtils::readFile($directory . trim($fileName));
     //Turn the jrxml to bean
     $jasper = BeanUtils::xmlToBean($xmlContent, 'Jasper');
     //Get the db stuff
     $dbResult = null;
     if ($jasper->queryString) {
         $dbResult = DbConnection::getInstance()->listAll($jasper->queryString->content, $parameters);
     }
     $left += $jasper->leftMargin;
     $top += $jasper->topMargin;
     $jasperXml = new JasperXml();
     $jasperXml->dbResult = $dbResult;
     $jasperXml->config = $config;
     $jasperXml->jasper = $jasper;
     $jasperXml->parameters = $parameters;
     $jasperXml->directory = $directory;
     return $jasperXml->printJasper($left, $top, $subreport);
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $commonMain =& $container->getComponent("commonMain");
     if (isset($attributes["timezone_offset"])) {
         $array = explode("|", CALENDAR_DEF_TIMEZONE);
         if (!in_array($attributes["timezone_offset"], $array)) {
             return $errStr;
         }
         $timezoneMain =& $commonMain->registerClass(WEBAPP_DIR . '/components/timezone/Main.class.php', "Timezone_Main", "timezoneMain");
         $timezone_offset = $timezoneMain->getFloatTimeZone(constant($attributes["timezone_offset"]));
     } else {
         $timezone_offset = $session->getParameter("_timezone_offset");
     }
     $request =& $container->getComponent("Request");
     $request->setParameter("timezone_offset", $timezone_offset);
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("timezone_offset" => $timezone_offset));
 }
 /**
  * ブロック移動時のチェック
  *
  * @param   mixed   $attributes チェックする値(配列の場合あり)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     (使用しない)
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $show_count = $attributes['_show_count'];
     $getdata =& $container->getComponent("GetData");
     $pages_obj = $getdata->getParameter("pages");
     $blocks_obj = $getdata->getParameter("blocks");
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     //ブロックオブジェクトチェック
     $page_id = null;
     if (isset($attributes['block_id']) && $attributes['block_id'] != 0) {
         $block_id = $attributes['block_id'];
     } else {
         if (isset($attributes['page_id']) && $attributes['page_id'] != 0) {
             $page_id = $attributes['page_id'];
         }
     }
     if (!$page_id) {
         if (!$block_id || !is_array($blocks_obj[$block_id])) {
             return $errStr;
         } else {
             $page_id = $blocks_obj[$block_id]['page_id'];
         }
     }
     //ページオブジェクトがないならばエラー
     //TODO:左右カラムの場合、page_idが0であるので処理を追加する必要性あり。
     //左右カラムもpage_idをふる仕様に後に変更
     if (!is_array($pages_obj[$page_id])) {
         return $errStr;
     }
     //不整合チェック
     //  page-show_countが画面と変わっていた場合、不整合とする
     if ($show_count != $pages_obj[$page_id]['show_count']) {
         return $errStr;
     }
     if (!isset($attributes['page_id'])) {
         BeanUtils::setAttributes($action, array("page_id" => $page_id));
     }
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     $module_id = $attributes;
     $module =& $container->getComponent("modulesView");
     $module_obj =& $module->getModulesById($module_id);
     // module_idが0ならば、念のためアインストールを実行させる
     if (intval($module_id) != 0) {
         if ($module_obj['system_flag']) {
             //システムモジュール
             return $errStr;
         }
         $pathList = explode("_", $module_obj["action_name"]);
         if ($pathList[0] == "login" || $pathList[0] == "menu") {
             //ログインモジュール
             return $errStr;
         }
     }
     //アクションにmodule_objセット
     BeanUtils::setAttributes($action, array("module_obj" => $module_obj));
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値		user_id
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $pagesView =& $container->getComponent("pagesView");
     $user_auth_id = $session->getParameter("_user_auth_id");
     $page_id = intval($attributes);
     if ($page_id == 0) {
         if ($user_auth_id != _AUTH_ADMIN) {
             return $errStr;
         }
         return;
     }
     $page = $pagesView->getPageById($page_id);
     if ($page === false || !isset($page['page_id']) || $page['page_id'] != $page['room_id'] || $page['authority_id'] < _AUTH_CHIEF || $page['shortcut_flag'] == _ON || $page["display_flag"] == _PAGES_DISPLAY_FLAG_DISABLED) {
         return $errStr;
     }
     // パブリックスペース直下ならば、管理者以外はバックアップできない
     if ($user_auth_id != _AUTH_ADMIN && $page['thread_num'] == 0 && $page['space_type'] == _SPACE_TYPE_PUBLIC && $page['private_flag'] == _OFF) {
         return $errStr;
     }
     // サブグループでサブグループ作成権限がなければエラー
     if ($page['thread_num'] == 2 && $page['space_type'] == _SPACE_TYPE_GROUP && $page['private_flag'] == _OFF) {
         $parent_page = $pagesView->getPageById($page['parent_id']);
         if ($parent_page === false || !isset($parent_page['page_id'])) {
             return $errStr;
         }
         if ($parent_page['createroom_flag'] == _OFF) {
             return $errStr;
         }
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("page" => $page));
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値(user_id, items, items_public, items_reception)
  *
  * @param   string  $errStr エラー文字列(未使用:エラーメッセージ固定)
  * @param   array   $params オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $usersView =& $container->getComponent("usersView");
     $_system_user_id = $session->getParameter("_system_user_id");
     if (!isset($attributes['user_id'])) {
         $attributes['user_id'] = "0";
     }
     if ($attributes['user_id'] != "0") {
         $user =& $usersView->getUserById($attributes['user_id']);
         if ($user === false) {
             return $errStr;
         }
         $edit_flag = true;
     } else {
         $attributes['user_id'] = "0";
         $edit_flag = false;
     }
     if ($session->getParameter(array("user", "regist", $attributes['user_id'])) !== null) {
         // 既に取得済み
         // 権限設定から戻る場合なのでスルー
         // すでにセッション情報が登録されているのに、itemsパラメータがくるとエラー
         if (isset($attributes['items'])) {
             return $errStr;
         }
         return;
     }
     // システム管理者がシステム管理者以外で編集されそうになっている場合、エラー
     if ($attributes['user_id'] == $_system_user_id && $session->getParameter("_user_id") != $_system_user_id) {
         return _INVALID_INPUT;
     }
     $where_params = array("user_authority_id" => _AUTH_ADMIN);
     $show_items =& $usersView->getItems($where_params, null, null, null, array($this, "_getItemsFetchcallback"));
     if ($show_items === false) {
         return $errStr;
     }
     foreach ($show_items as $items) {
         $err_prefix = $items['item_id'] . ":";
         if (isset($attributes['items']) && isset($attributes['items'][$items['item_id']])) {
             $content = $attributes['items'][$items['item_id']];
         } else {
             $content = "";
         }
         if ($items['define_flag'] == _ON && defined($items['item_name'])) {
             $items['item_name'] = constant($items['item_name']);
         }
         // 必須入力チェック
         if ($items['require_flag'] == _ON && !($edit_flag == _ON && $items['tag_name'] == "password")) {
             // 必須項目
             if ($content == "") {
                 return $err_prefix . sprintf(_REQUIRED, $items['item_name']);
             }
         }
         if ($items['tag_name'] == "login_id") {
             // 入力文字チェック
             $login_id = $content;
             $login_len = strlen($content);
             if ($login_len < USER_LOGIN_ID_MINSIZE || $login_len > USER_LOGIN_ID_MAXSIZE) {
                 return $err_prefix . sprintf(_MAXRANGE_ERROR, USER_ITEM_LOGIN, USER_LOGIN_ID_MINSIZE, USER_LOGIN_ID_MAXSIZE);
             }
             // 半角英数または、記号
             if (preg_match(_REGEXP_ALLOW_HALFSIZE_SYMBOL, $login_id)) {
                 return $err_prefix . sprintf(_HALFSIZESYMBOL_ERROR, USER_ITEM_LOGIN);
             }
             // 重複チェック
             $where_params = array("login_id" => $login_id);
             $users =& $usersView->getUsers($where_params);
             $count = count($users);
             if ($count >= 1 && $users[0]['user_id'] != $attributes['user_id']) {
                 return $err_prefix . sprintf(USER_MES_ERROR_DUPLICATE, USER_ITEM_LOGIN, USER_ITEM_LOGIN);
             }
         } else {
             if ($items['tag_name'] == "password" && $content != "") {
                 $new_password = $content;
                 // 入力文字チェック
                 $pass_len = strlen($new_password);
                 if ($pass_len < USER_PASSWORD_MINSIZE || $pass_len > USER_PASSWORD_MAXSIZE) {
                     return $err_prefix . sprintf(_MAXRANGE_ERROR, USER_ITEM_PASSWORD, USER_PASSWORD_MINSIZE, USER_PASSWORD_MAXSIZE);
                 }
                 // 半角英数または、記号
                 if (preg_match(_REGEXP_ALLOW_HALFSIZE_SYMBOL, $new_password)) {
                     return $err_prefix . sprintf(_HALFSIZESYMBOL_ERROR, USER_ITEM_PASSWORD);
                 }
             } else {
                 if ($items['tag_name'] == "handle") {
                     // 重複チェック
                     $handle = $content;
                     $where_params = array("handle" => $handle);
                     $users =& $usersView->getUsers($where_params);
                     $count = count($users);
                     if ($count >= 1 && $users[0]['user_id'] != $attributes['user_id']) {
                         return $err_prefix . sprintf(USER_MES_ERROR_DUPLICATE, USER_ITEM_HANDLE, USER_ITEM_HANDLE);
                     }
                 } else {
                     if ($items['tag_name'] == "active_flag_lang") {
                         //システム管理者の場合、使用不可にはできない
                         if ($attributes['user_id'] == $_system_user_id && $content == _OFF) {
                             return $err_prefix . _INVALID_INPUT;
                         }
                     } else {
                         if ($items['tag_name'] == "role_authority_name") {
                             //システム管理者の場合、変更不可
                             if ($attributes['user_id'] == $_system_user_id && $content != _SYSTEM_ROLE_AUTH_ID) {
                                 return $err_prefix . _INVALID_INPUT;
                             }
                         }
                     }
                 }
             }
         }
         if ($items['type'] == "email" || $items['type'] == "mobile_email") {
             $email = $content;
             // 入力文字チェック
             if ($email != "" && !strpos($email, "@")) {
                 return $err_prefix . sprintf(_FORMAT_WRONG_ERROR, $items['item_name']);
             }
             // 重複チェック
             $userIdByMail = $usersView->getUserIdByMail($email);
             if (!empty($userIdByMail) && $userIdByMail != $attributes['user_id']) {
                 $errorMessage = $err_prefix . sprintf(USER_MES_ERROR_DUPLICATE, $items['item_name'], $items['item_name']);
                 return $errorMessage;
             }
             // メール受信可否
             if (isset($attributes['items_reception']) && isset($attributes['items_reception'][$items['item_id']])) {
                 if ($items['allow_email_reception_flag'] == _OFF || !($attributes['items_reception'][$items['item_id']] == _ON || $attributes['items_reception'][$items['item_id']] == _OFF)) {
                     return $err_prefix . _INVALID_INPUT;
                 }
             }
         }
         // 公開設定
         if (isset($attributes['items_public']) && isset($attributes['items_public'][$items['item_id']])) {
             if ($items['allow_public_flag'] == _OFF || !($attributes['items_public'][$items['item_id']] == _ON || $attributes['items_public'][$items['item_id']] == _OFF)) {
                 return $err_prefix . _INVALID_INPUT;
             }
         }
     }
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $show_items));
     } else {
         BeanUtils::setAttributes($action, array("show_items" => $show_items));
     }
     if (isset($user)) {
         //会員情報
         if (isset($params[1])) {
             BeanUtils::setAttributes($action, array($params[1] => $user));
         } else {
             BeanUtils::setAttributes($action, array("user" => $user));
         }
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $usersView =& $container->getComponent("usersView");
     //編集するuser情報
     $user_id = $session->getParameter("_user_id");
     if ($user_id == "0") {
         return $errStr;
     }
     $_user_auth_id = $session->getParameter("_user_auth_id");
     $user =& $usersView->getUserById($user_id);
     if ($user === false) {
         return $errStr;
     }
     // item_id取得
     if (is_array($attributes) && $attributes[1] != "0") {
         $item_id = intval($attributes[0]);
         //編集先user情報
         $edit_user_id = $attributes[1];
         $edit_users =& $usersView->getUserById($edit_user_id);
         if ($edit_users === false) {
             return $errStr;
         }
         $edit_user_auth_id = $edit_users['user_authority_id'];
     } else {
         if (is_array($attributes)) {
             $item_id = intval($attributes[0]);
         } else {
             $item_id = intval($attributes);
         }
         //編集先user情報(自分自身)
         $edit_user_id = $user_id;
         $edit_user_auth_id = $_user_auth_id;
         $edit_users =& $user;
     }
     $items = $usersView->getItemById($item_id);
     if ($items === false) {
         return $errStr;
     }
     if (!isset($items['item_id'])) {
         return USERINF_ERR_NONEEXISTS;
     }
     //
     // display_flag
     //
     if ($items['display_flag'] == _OFF) {
         //非表示項目
         return $errStr;
     }
     //
     // 権限チェック
     //
     //if($users['system_flag'] == _ON && $_user_auth_id == _AUTH_ADMIN) {
     if ($user['system_flag'] == _ON) {
         // システム管理者
         // すべて許す
         //} else if($_user_auth_id < $edit_user_auth_id) {
         //	// 自分より権限が上のものは編集できない
         //	return $errStr;
     } else {
         if ($user_id != $edit_user_id) {
             // 他人
             if ($_user_auth_id <= $edit_user_auth_id && $items['over_public_flag'] != USER_EDIT) {
                 // 自分の権限と同じか、自分の権限より大きいものを編集しようとしている
                 return $errStr;
             } else {
                 if ($_user_auth_id > $edit_user_auth_id && $items['under_public_flag'] != USER_EDIT) {
                     // 小さいものを編集しようとしている
                     return $errStr;
                 }
             }
         } else {
             //自分自身(self)
             if ($items['self_public_flag'] != USER_EDIT) {
                 return $errStr;
             }
         }
         /*
          			if($_user_auth_id == _AUTH_ADMIN) {
         	// 管理者はすべて許す
         } else if($_user_auth_id == _AUTH_CHIEF) {
         	// chief_public_flag
         	if($user_id != $edit_user_id && $items['other_chief_public_flag'] != USER_EDIT) {
         		// 他人
         		return $errStr;
         				} else if($user_id == $edit_user_id && $items['self_chief_public_flag'] != USER_EDIT) {
         					// 自分自身
         					return $errStr;
         	}
         } else {
         	// self_public_flag  other_public_flag
         	if($user_id != $edit_user_id && $items['other_public_flag'] != USER_EDIT) {
         		// 他人
         		return $errStr;
         				} else if($user_id == $edit_user_id && $items['self_public_flag'] != USER_EDIT) {
         					// 自分自身
         					return $errStr;
         	}
         }
         */
     }
     //
     // Actionにデータセット
     //
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $items));
     } else {
         BeanUtils::setAttributes($action, array("items" => $items));
     }
     if (isset($params[1])) {
         BeanUtils::setAttributes($action, array($params[1] => $edit_users));
     } else {
         BeanUtils::setAttributes($action, array("user" => $edit_users));
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値array(parent_page_id,current_page_id)
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $pagesView =& $container->getComponent("pagesView");
     $authCheck =& $container->getComponent("authCheck");
     //$request =& $container->getComponent("Request");
     $parent_page_id = intval($attributes[0]);
     $current_page_id = intval($attributes[1]);
     // mode inf or create or delete or chgdisplay
     $mode = "create";
     if (isset($params[0])) {
         $mode = $params[0];
     }
     $user_id = $session->getParameter('_user_id');
     $page = null;
     if ($parent_page_id != 0) {
         $page =& $pagesView->getPageById($parent_page_id);
         if ($page === false || !isset($page['page_id'])) {
             //親ページなし
             return $errStr;
         }
         if ($mode != "inf" && $session->getParameter("_open_private_space") == _OFF && $page['private_flag']) {
             //プライベートスペース
             return $errStr;
         } else {
             if ($page['thread_num'] > 1) {
                 //サブグループは一階層のみ
                 return $errStr;
             }
         }
     }
     $current_page = null;
     if (isset($current_page_id) && $current_page_id != 0) {
         //
         // ルーム編集時チェック
         //
         //カレントページ権限チェック
         $current_page =& $pagesView->getPageById($current_page_id);
         if ($current_page === false || !isset($current_page['page_id'])) {
             //カレントページなし
             return $errStr;
         }
         $_user_auth_id = $session->getParameter("_user_auth_id");
         if ($current_page['thread_num'] != 0 && $parent_page_id == 0) {
             //親ページ指定なし
             return $errStr;
         } else {
             if ($parent_page_id != 0 && $current_page['parent_id'] != 0 && $current_page['parent_id'] != $parent_page_id) {
                 //親子関係相違あり
                 return $errStr;
             }
         }
         // 編集権限チェック
         if ($mode != "inf" && $session->getParameter("_open_private_space") == _OFF && $current_page['private_flag']) {
             //プライベートスペース
             return $errStr;
         } else {
             if ($current_page['thread_num'] == 0 && ($mode == "delete" || $mode == "chgdisplay")) {
                 return $errStr;
             } else {
                 if ($current_page['thread_num'] == 0 && $_user_auth_id != _AUTH_ADMIN && !($mode == "inf" && $current_page['private_flag']) && $current_page['private_flag'] == _OFF) {
                     // 深さが0の編集する権限は、管理者のみ
                     // 深さ0のものは削除不可
                     return $errStr;
                 } else {
                     if ($current_page['thread_num'] == 1) {
                         // ルーム
                         $auth_id = $authCheck->getPageAuthId($user_id, $current_page_id);
                         if ($auth_id < _AUTH_CHIEF) {
                             //ルーム編集権限なし
                             return $errStr;
                         }
                     } else {
                         if ($current_page['thread_num'] == 2) {
                             // サブグループ
                             //if($mode != "inf") {
                             // 作った本人であれば、チェックしない
                             if ($current_page['insert_user_id'] != $user_id) {
                                 $auth_id = $authCheck->getPageAuthId($user_id, $parent_page_id);
                                 if ($auth_id < _AUTH_CHIEF) {
                                     //ルーム編集権限なし
                                     return $errStr;
                                 }
                             }
                             $auth_id = $authCheck->getPageAuthId($user_id, $current_page_id);
                             if ($auth_id < _AUTH_CHIEF) {
                                 //ルーム編集権限なし
                                 return $errStr;
                             }
                             //}
                         } else {
                             if ($current_page['thread_num'] > 2) {
                                 return $errStr;
                             }
                         }
                     }
                 }
             }
         }
         // 削除する場合は、常に親のルーム作成権限+そのルームで主担である必要あり
         if ($mode == "delete") {
             $createroom_flag = $authCheck->getPageCreateroomFlag($user_id, $parent_page_id);
             if ($createroom_flag == _OFF) {
                 //ルーム作成権限なし
                 return $errStr;
             }
         }
     } else {
         //
         // ルーム新規作成時チェック
         //
         //ルーム作成時チェック
         $current_page = null;
         $createroom_flag = $authCheck->getPageCreateroomFlag($user_id, $parent_page_id);
         if (!$createroom_flag) {
             //ルーム作成権限なし
             return $errStr;
         }
     }
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("parent_page" => $page));
     BeanUtils::setAttributes($action, array("page" => $current_page));
 }
 /**
  * Actionを実行
  *
  * @access  public
  * @since   3.0.0
  */
 function execute()
 {
     $log =& LogFactory::getLog();
     $log->trace("Filter_Actionの前処理が実行されました", "Filter_Action#execute");
     //
     // カレントのActionを取得
     //
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     //
     // 設定ファイルに入っていた値を設定
     //
     $request =& $container->getComponent("Request");
     $params = $request->getParameters();
     if ($this->getSize() > 0) {
         $attributes = $this->getAttributes();
         foreach ($attributes as $key => $value) {
             if (strncmp("ref:", $value, 4) == 0) {
                 $value = substr($value, 4, strlen($value) - 4);
                 //$value = preg_replace("/^ref:/", "", $value);
                 $component =& $container->getComponent($value);
                 if (is_object($component)) {
                     $attributes[$key] =& $component;
                 } else {
                     $log->error("不正なコンポーネントが設定ファイルで指定されています({$value})", "Filter_Action#execute");
                 }
             }
             //
             // DIされるパラメータはリクエストパラメータで
             // 上書きされないようにする
             //
             if (isset($params[$key])) {
                 unset($params[$key]);
             }
         }
         BeanUtils::setAttributes($action, $attributes);
     }
     //
     // Requestの値をActionに移す
     //
     if (count($params) > 0) {
         BeanUtils::setAttributes($action, $params, true);
     }
     //
     // Filter_Actionにたどりつく前にエラーが発生していたら
     // Actionは実行しない(そのかわりエラータイプをViewの種類とする)
     //
     $errorList =& $actionChain->getCurErrorList();
     $type = $errorList->getType();
     if ($type == "") {
         $view = $actionChain->execute();
     } else {
         $view = $type;
     }
     if ($view != "") {
         $response =& $container->getComponent("Response");
         $response->setView($view);
     }
     $filterChain =& $container->getComponent("FilterChain");
     $filterChain->execute();
     $log->trace("Filter_Actionの後処理が実行されました", "Filter_Action#execute");
 }
 /**
  * Componentに属性をInjection
  *
  * @param   Object  $component  Componentのインスタンス
  * @param   array   $attributes 値が入った配列
  * @access  public
  * @since   3.0.0
  */
 function setAttributes(&$component, $attributes)
 {
     BeanUtils::setAttributes($component, $attributes);
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $usersView =& $container->getComponent("usersView");
     // item_id取得
     $item_id = intval($attributes["item_id"]);
     if ($item_id != 0) {
         // 項目編集
         $items =& $usersView->getItemById($item_id, array($usersView, "_getShowItemsFetchcallback"), array(true));
         if ($items === false) {
             return $errStr;
         }
         if ($items['system_flag'] == _ON && $items['type'] != $attributes["type"]) {
             //システムで使用するのものなのに、タイプが変更された
             return $errStr;
         }
         if (!isset($attributes["require_flag"])) {
             $attributes["require_flag"] = _OFF;
         }
         if (($items['tag_name'] == "login_id" || $items['tag_name'] == "handle" || $items['tag_name'] == "password") && $attributes["require_flag"] == _OFF) {
             //ログインID、パスワード、ハンドルは必ず必須
             return $errStr;
         }
         if ($items['tag_name'] != "" && $items['tag_name'] != "email" && $items['tag_name'] != "user_name" && isset($attributes["allow_public_flag"]) && $attributes["allow_public_flag"] == _ON) {
             //公開非公開の設定ができない項目
             return $errStr;
         }
         if ($items['type'] != "email" && $items['type'] != "mobile_email" && isset($attributes["allow_email_reception_flag"]) && $attributes["allow_email_reception_flag"] == _ON) {
             //メールでないのに受け取りフラグがON
             return $errStr . $attributes["allow_email_reception_flag"];
         }
         //
         // Actionにデータセット
         //
         // actionChain取得
         $actionChain =& $container->getComponent("ActionChain");
         $action =& $actionChain->getCurAction();
         if (isset($params[0])) {
             BeanUtils::setAttributes($action, array($params[0] => $items));
         } else {
             BeanUtils::setAttributes($action, array("items" => $items));
         }
     }
     if (($item_id == 0 || $items['system_flag'] == _OFF) && ($attributes["type"] == USER_TYPE_RADIO || $attributes["type"] == USER_TYPE_SELECT || $attributes["type"] == USER_TYPE_CHECKBOX)) {
         //
         // 選択式
         //
         if (!isset($attributes["options"]) || count($attributes["options"]) == 0) {
             //リストに1項目も指定していない
             return USER_ERR_NONEEXISTS_OPTIONS;
         }
         $select_count = 0;
         $option_arr = array();
         foreach ($attributes["options"] as $key => $options) {
             if (in_array($options, $option_arr, true)) {
                 //同じリスト値が存在する
                 return USER_ERR_DUPLICATION_CHAR_OPTIONS;
             }
             array_push($option_arr, $options);
             if (preg_match("/\\|/", $options)) {
                 //禁止文字「|」
                 return USER_ERR_PROHIBITION_CHAR_OPTIONS;
             }
             $default_selected = isset($attributes["default_selected"][$key]) ? _ON : _OFF;
             if ($attributes["type"] == USER_TYPE_RADIO || $attributes["type"] == USER_TYPE_SELECT) {
                 if ($default_selected) {
                     $select_count++;
                 }
                 //複数選択されている
                 if ($select_count > 1) {
                     return USER_ERR_PROHIBITION_MULTIPLE_OPTIONS;
                 }
             }
         }
     }
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値(user_id, items, items_public, items_reception)
  *                  
  * @param   string  $errStr     エラー文字列(未使用:エラーメッセージ固定)
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $log =& LogFactory::getLog();
     $log->trace("MobileItemsInputsの処理にはいりました", "Validator_MobileItemsInputs.class.php#validate");
     // container取得
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $usersView =& $container->getComponent("usersView");
     $configView =& $container->getComponent("configView");
     ////		$fileUpload =& $container->getComponent("FileUpload");
     $commonMain =& $container->getComponent("commonMain");
     $uploadsAction =& $commonMain->registerClass(WEBAPP_DIR . '/components/uploads/Action.class.php', "Uploads_Action", "uploadsAction");
     $userinfCheck =& $container->getComponent("userinfCheck");
     ////		$uploadAction =& $container->getComponent("uploadAction");
     // 編集するuser情報
     // 現在は基本的に自分の情報しか編集できないことになっている
     // 自分
     $user_id = $session->getParameter("_user_id");
     if ($user_id == "0") {
         return $errStr;
     }
     // 自分の権限
     $_user_auth_id = $session->getParameter("_user_auth_id");
     // 自分の情報
     $user =& $usersView->getUserById($user_id);
     if ($user === false) {
         return $errStr;
     }
     //
     // 編集対象の人物のuser_id
     //
     if (isset($attributes['user_id'])) {
         $edit_user_id = $attributes['user_id'];
     } else {
         $edit_user_id = $session->getParameter("_user_id");
     }
     if ($user_id != $edit_user_id) {
         return $errStr;
     }
     //
     // システムユーザーID
     //
     $system_user_id = $session->getParameter("_system_user_id");
     // エラーリターンすると、元の編集画面に戻るので
     // その場合、userデータが必要になるから
     $edit_user =& $usersView->getUserById($edit_user_id, array($usersView, "_getUsersFetchcallback"));
     BeanUtils::setAttributes($action, array("user" => $edit_user));
     // システム管理者がシステム管理者以外で編集されそうになっている場合、エラー
     if ($edit_user_id == $system_user_id && $user_id != $system_user_id) {
         return _INVALID_INPUT;
     }
     // ここではまだFileUploadが実現化されてない
     //        // UPloadされるアバター画像
     //    	$files = $fileUpload->getOriginalName();
     //    	$files_key = array_keys($files);
     $item_err_msg = array();
     //
     // 自分自身か、自分自身より低い権限か、高い権限かをセット
     //
     if ($edit_user_id == $user_id) {
         // 自分自身
         $public_flag_colname = "self_public_flag";
     } else {
         if ($edit_user['user_authority_id'] >= $_user_auth_id) {
             // 自分と同じか高い権限
             $public_flag_colname = "over_public_flag";
         } else {
             // 低い権限
             $public_flag_colname = "under_public_flag";
         }
     }
     $tmp_show_items =& $usersView->getShowItems($edit_user_id, $_user_auth_id);
     if ($tmp_show_items === false) {
         return $errStr;
     }
     $show_items = array();
     foreach ($tmp_show_items as $col) {
         foreach ($col as $it) {
             $show_items[$it['item_id']] = $it;
         }
     }
     // 必須チェックはshowItemsをベースに考えないといけない
     foreach ($show_items as $s_i) {
         // 必須入力チェック
         // passwordは未入力は「変更なし」を意味するので特にチェックしない
         // type==fileの場合も未入力は「変更なし」を意味することに
         // またtype==fileの場合は、ここではチェックできない
         //     ActionChainの並びのため、このvalidate、まだFileUpLoadが実行できない。(らしい)
         if ($s_i['tag_name'] == 'password') {
             continue;
         }
         if ($s_i['type'] == 'file') {
             continue;
         }
         //
         // login_id, authority, active_flagは管理者といえども変更できないようにする
         // なのでチェックは入れない
         //
         if ($s_i['tag_name'] == 'login_id' || $s_i['tag_name'] == 'active_flag_lang' || $s_i['tag_name'] == 'role_authority_name') {
             continue;
         }
         if ($s_i['require_flag'] == _ON) {
             // 編集されようとしているのが管理者ではない または 自分が管理者
             // かつ、項目は編集可能と設定されている
             // かつ、管理者以外の編集で状態や権限項目ではない
             // かつ、状態が使用可能以外ではない
             if (($edit_user_id != $system_user_id || $user_id == $system_user_id) && $s_i[$public_flag_colname] == USER_EDIT && !($user_id == $system_user_id && ($s_i['tag_name'] == "active_flag_lang" || $s_i['tag_name'] == 'role_authority_name')) && !($s_i['tag_name'] == "active_flag_lang" && ($edit_user['active_flag_lang'] == USER_ITEM_ACTIVE_FLAG_PENDING || $edit_user['active_flag_lang'] == USER_ITEM_ACTIVE_FLAG_MAILED))) {
                 if (!isset($attributes['userinf_items'][$s_i['item_id']])) {
                     $item_err_msg[] = $s_i['item_id'] . ":" . sprintf(_REQUIRED, $s_i['item_name']);
                     continue;
                 }
                 if (is_array($attributes['userinf_items'][$s_i['item_id']])) {
                     if (count($attributes['userinf_items'][$s_i['item_id']]) == 0) {
                         $item_err_msg[] = $s_i['item_id'] . ":" . sprintf(_REQUIRED, $s_i['item_name']);
                     }
                 } else {
                     if ($attributes['userinf_items'][$s_i['item_id']] == "") {
                         $item_err_msg[] = $s_i['item_id'] . ":" . sprintf(_REQUIRED, $s_i['item_name']);
                     }
                 }
             }
         }
     }
     foreach ($attributes['userinf_items'] as $userinf_items_key => $input_item) {
         // 入力項目IDに該当する情報がない
         if (!isset($show_items[$userinf_items_key])) {
             return _INVALID_INPUT;
         }
         $items =& $show_items[$userinf_items_key];
         if (!isset($items['item_id'])) {
             return _INVALID_INPUT;
         }
         if ($items['define_flag'] == _ON && defined($items['item_name'])) {
             $items['item_name'] = constant($items['item_name']);
         }
         // 入力情報がlogin_idだったら
         if ($items['tag_name'] == "login_id") {
             $ret = $userinfCheck->checkLoginId($input_item);
             if ($ret != "") {
                 //return $ret;
                 $item_err_msg[] = $userinf_items_key . ":" . $ret;
             }
         } else {
             if ($items['tag_name'] == "password") {
                 $new_password = $input_item;
                 $cur_password = $attributes['userinf_items_currentpwd'][$userinf_items_key];
                 $confirm_password = $attributes['userinf_items_confirmpwd'][$userinf_items_key];
                 if ($new_password != "") {
                     $ret = $userinfCheck->checkPassword($edit_user_id, $items['item_name'], $new_password, $cur_password, $confirm_password);
                     if ($ret != "") {
                         //return $ret;
                         $item_err_msg[] = $userinf_items_key . ":" . $ret;
                     }
                 }
             } else {
                 if ($items['tag_name'] == "handle") {
                     $ret = $userinfCheck->checkHandle($edit_user_id, $items['item_name'], $input_item);
                     if ($ret != "") {
                         //return $ret;
                         $item_err_msg[] = $userinf_items_key . ":" . $ret;
                     }
                 } else {
                     if ($items['tag_name'] == "role_authority_name") {
                         $ret = $userinfCheck->checkRoleAuth($edit_user_id, $items['item_name'], $input_item);
                         if ($ret != "") {
                             //return $ret;
                             $item_err_msg[] = $userinf_items_key . ":" . $ret;
                         }
                     } else {
                         if ($items['tag_name'] == "active_flag_lang") {
                             $ret = $userinfCheck->checkActiveFlag($edit_user_id, $items['item_name'], $input_item);
                             if ($ret != "") {
                                 //return $ret;
                                 $item_err_msg[] = $userinf_items_key . ":" . $ret;
                             }
                         }
                     }
                 }
             }
         }
         // それぞれの入力項目について、メールタイプであると設定されているならば
         // メールアドレス用のチェックを通す
         if ($items['type'] == "email" || $items['type'] == "mobile_email") {
             if (!isset($attributes['userinf_items_email_reception_flag'][$userinf_items_key])) {
                 $email_reception_flag = false;
             } else {
                 $email_reception_flag = $attributes['userinf_items_email_reception_flag'][$userinf_items_key];
             }
             $ret = $userinfCheck->checkEmail($edit_user_id, $items, $input_item, $email_reception_flag);
             if ($ret != "") {
                 //return $ret;
                 $item_err_msg[] = $userinf_items_key . ":" . $ret;
             }
         }
         // それぞれの入力項目について、公開非公開の設定があるならば
         if (isset($attributes['userinf_items_public_flag'][$userinf_items_key])) {
             $ret = $userinfCheck->checkPublicFlag($edit_user_id, $items, $attributes['userinf_items_public_flag'][$userinf_items_key]);
             if ($ret != "") {
                 //return $ret;
                 $item_err_msg[] = $userinf_items_key . ":" . $ret;
             }
         }
         /*
         			if($items['type'] == "file") {
         				// File
         				// 必須入力チェック
         				if($items['require_flag'] == _ON || (isset($autoregist_use_items_req[$items['item_id']]) && $autoregist_use_items_req[$items['item_id']] == _ON)) {
         					
         					$error_flag = true;
         					foreach($files_key as $file_key) {
         						if($items['item_id'] == $file_key && ($files[$file_key] != "" && $files[$file_key] != null)) {
         							$error_flag = false;
         							break;
         						}
         					}
         					if($error_flag) {
         						//ファイルアップロード未対応携帯なのに、このファイルは必須扱いになっている...
         						//
         						//つまり、この携帯からは登録できないので、PCから登録していただくか、
         						//管理者にお願いして、必須から任意にかえていただくことを薦めます。
         						//
         						if (empty($files)) {
         							return $err_prefix.LOGIN_ERR_FILE_UPLOAD_NOABILITY;
         						} else {
         							return $err_prefix.sprintf(_REQUIRED, $items['item_name']);	
         						}
         					}
         				}
         				continue;
         			}
         */
     }
     if (count($item_err_msg) > 0) {
         $item_err_msg_str = implode("|", $item_err_msg);
         return $item_err_msg_str;
     }
     /*
         	// File
         	$garbage_flag = _OFF;
         	$filelist = $uploadsAction->uploads($garbage_flag);
     		foreach($filelist as $key => $file) {
     			if(isset($file['error_mes']) && $file['error_mes'] != "" && $file['error_mes'] != _FILE_UPLOAD_ERR_UPLOAD_NOFILE) {
     				$err_prefix = $key.":";
     				return $err_prefix.$file['error_mes'];
                 }
     		}
     */
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     BeanUtils::setAttributes($action, array("show_items" => $show_items));
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値(user_id, items, items_public, items_reception)
  *
  * @param   string  $errStr エラー文字列(未使用:エラーメッセージ固定)
  * @param   array   $params オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     // container取得
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $usersView =& $container->getComponent("usersView");
     $configView =& $container->getComponent("configView");
     $fileUpload =& $container->getComponent("FileUpload");
     $commonMain =& $container->getComponent("commonMain");
     $authoritiesView =& $container->getComponent("authoritiesView");
     $uploadsAction =& $commonMain->registerClass(WEBAPP_DIR . '/components/uploads/Action.class.php', "Uploads_Action", "uploadsAction");
     $db =& $container->getComponent("DbObject");
     $config = $configView->getConfigByCatid(_SYS_CONF_MODID, _ENTER_EXIT_CONF_CATID);
     if ($config['autoregist_use']['conf_value'] != _ON) {
         return $errStr;
     }
     $where_params = array("user_authority_id" => _AUTH_ADMIN);
     $show_items =& $usersView->getItems($where_params, null, null, null, array($this, "_getItemsFetchcallback"));
     if ($show_items === false) {
         return $errStr;
     }
     $configs = explode("|", $config['autoregist_use_items']['conf_value']);
     foreach ($configs as $autoregist_use_item) {
         $buf_arr = explode(":", $autoregist_use_item);
         if (isset($buf_arr[0]) && $buf_arr[0] != "") {
             $autoregist_use_items[$buf_arr[0]] = $buf_arr[0];
             $autoregist_use_items_req[$buf_arr[0]] = $buf_arr[1];
         }
     }
     $files = $fileUpload->getOriginalName();
     $files_key = array_keys($files);
     foreach ($show_items as $show_items_key => $items) {
         if (!isset($autoregist_use_items[$items['item_id']])) {
             // 自動ログインの項目ではない
             if (isset($attributes['items']) && isset($attributes['items'][$items['item_id']])) {
                 return $errStr;
             }
             continue;
         }
         $err_prefix = $items['item_id'] . ":";
         if ($items['define_flag'] == _ON && defined($items['item_name'])) {
             $items['item_name'] = constant($items['item_name']);
             $show_items[$show_items_key]['item_name'] = $items['item_name'];
         }
         if ($items['type'] == "file") {
             // File
             // 必須入力チェック
             if ($items['require_flag'] == _ON || isset($autoregist_use_items_req[$items['item_id']]) && $autoregist_use_items_req[$items['item_id']] == _ON) {
                 $error_flag = true;
                 foreach ($files_key as $file_key) {
                     if ($items['item_id'] == $file_key && ($files[$file_key] != "" && $files[$file_key] != null)) {
                         $error_flag = false;
                         break;
                     }
                 }
                 if ($error_flag) {
                     //ファイルアップロード未対応携帯なのに、このファイルは必須扱いになっている...
                     //
                     //つまり、この携帯からは登録できないので、PCから登録していただくか、
                     //管理者にお願いして、必須から任意にかえていただくことを薦めます。
                     //
                     if (empty($files)) {
                         return $err_prefix . LOGIN_ERR_FILE_UPLOAD_NOABILITY;
                     } else {
                         return $err_prefix . sprintf(_REQUIRED, $items['item_name']);
                     }
                 }
             }
             continue;
         }
         if (isset($attributes['items']) && isset($attributes['items'][$items['item_id']])) {
             $content = $attributes['items'][$items['item_id']];
         } else {
             $content = "";
         }
         // 必須入力チェック
         if ($items['require_flag'] == _ON || isset($autoregist_use_items_req[$items['item_id']]) && $autoregist_use_items_req[$items['item_id']] == _ON) {
             // 必須項目
             if ($content == "") {
                 return $err_prefix . sprintf(_REQUIRED, $items['item_name']);
             }
         }
         if ($items['tag_name'] == "login_id") {
             // 入力文字チェック
             $login_id = $content;
             $login_len = strlen($content);
             if ($login_len < USER_LOGIN_ID_MINSIZE || $login_len > USER_LOGIN_ID_MAXSIZE) {
                 return $err_prefix . sprintf(_MAXRANGE_ERROR, USER_ITEM_LOGIN, USER_LOGIN_ID_MINSIZE, USER_LOGIN_ID_MAXSIZE);
             }
             // 半角英数または、記号
             if (preg_match(_REGEXP_ALLOW_HALFSIZE_SYMBOL, $login_id)) {
                 return $err_prefix . sprintf(_HALFSIZESYMBOL_ERROR, USER_ITEM_LOGIN);
             }
             // 重複チェック
             $where_params = array("login_id" => $login_id);
             $users =& $usersView->getUsers($where_params);
             $count = count($users);
             if ($count >= 1) {
                 return $err_prefix . sprintf(LOGIN_MES_ERROR_DUPLICATE, USER_ITEM_LOGIN, USER_ITEM_LOGIN);
             }
         } else {
             if ($items['tag_name'] == "password") {
                 $new_password = $content;
                 // 入力文字チェック
                 $pass_len = strlen($new_password);
                 if ($pass_len < USER_PASSWORD_MINSIZE || $pass_len > USER_PASSWORD_MAXSIZE) {
                     return $err_prefix . sprintf(_MAXRANGE_ERROR, USER_ITEM_PASSWORD, USER_PASSWORD_MINSIZE, USER_PASSWORD_MAXSIZE);
                 }
                 if (!isset($attributes['items_password_confirm'][$items['item_id']]) || $new_password != $attributes['items_password_confirm'][$items['item_id']]) {
                     return $err_prefix . LOGIN_ERR_PASS_DISACCORD;
                 }
                 // 半角英数または、記号
                 if (preg_match(_REGEXP_ALLOW_HALFSIZE_SYMBOL, $new_password)) {
                     return $err_prefix . sprintf(_HALFSIZESYMBOL_ERROR, USER_ITEM_PASSWORD);
                 }
             } else {
                 if ($items['tag_name'] == "handle") {
                     // 重複チェック
                     $handle = $content;
                     $where_params = array("handle" => $handle);
                     $users =& $usersView->getUsers($where_params);
                     $count = count($users);
                     if ($count >= 1) {
                         return $err_prefix . sprintf(LOGIN_MES_ERROR_DUPLICATE, USER_ITEM_HANDLE, USER_ITEM_HANDLE);
                     }
                 }
             }
         }
         if ($items['type'] == "email" || $items['type'] == "mobile_email") {
             $email = $content;
             // 入力文字チェック
             if ($email != "" && !strpos($email, "@")) {
                 return $err_prefix . sprintf(_FORMAT_WRONG_ERROR, $items['item_name']);
             }
             // 確認用アドレスチェック
             if ($email != $attributes['items_mail_confirm'][$items['item_id']]) {
                 $errorMessage = $err_prefix;
                 if ($items['type'] == "email") {
                     $errorMessage .= LOGIN_ERR_EMAIL_DISACCORD;
                 } else {
                     if ($items['type'] == "mobile_email") {
                         $errorMessage .= LOGIN_ERR_MOBILE_EMAIL_DISACCORD;
                     }
                 }
                 return $errorMessage;
             }
             // 重複チェック
             $userIdByMail = $usersView->getUserIdByMail($email);
             if (!empty($userIdByMail)) {
                 $errorMessage = $err_prefix . sprintf(LOGIN_MES_ERROR_DUPLICATE, $items['item_name'], $items['item_name']);
                 return $errorMessage;
             }
             // メール受信可否
             if (isset($attributes['items_reception']) && isset($attributes['items_reception'][$items['item_id']])) {
                 if ($items['allow_email_reception_flag'] == _OFF || !($attributes['items_reception'][$items['item_id']] == _ON || $attributes['items_reception'][$items['item_id']] == _OFF)) {
                     return $err_prefix . _INVALID_INPUT;
                 }
             }
         }
         // 公開設定
         if (isset($attributes['items_public']) && isset($attributes['items_public'][$items['item_id']])) {
             if ($items['allow_public_flag'] == _OFF || !($attributes['items_public'][$items['item_id']] == _ON || $attributes['items_public'][$items['item_id']] == _OFF)) {
                 return $err_prefix . _INVALID_INPUT;
             }
         }
     }
     // 利用許諾
     if (!isset($attributes['autoregist_disclaimer_ok'])) {
         return LOGIN_ERR_MES_DISCLAIMER;
     }
     // 入力キー
     if ($config['autoregist_use_input_key']['conf_value'] == _ON && $config['autoregist_input_key']['conf_value'] != $attributes['autoregist_input_key']) {
         return LOGIN_ERR_MES_INPUT_KEY;
     }
     // File
     $garbage_flag = _OFF;
     $filelist = $uploadsAction->uploads($garbage_flag, '', array(_UPLOAD_THUMBNAIL_MAX_WIDTH_IMAGE, _UPLOAD_THUMBNAIL_MAX_HEIGHT_IMAGE));
     foreach ($filelist as $key => $file) {
         if (isset($file['error_mes']) && $file['error_mes'] != "" && $file['error_mes'] != _FILE_UPLOAD_ERR_UPLOAD_NOFILE) {
             $err_prefix = $key . ":";
             return $err_prefix . $file['error_mes'];
         }
     }
     // actionChain取得
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     if (isset($params[0])) {
         BeanUtils::setAttributes($action, array($params[0] => $show_items));
     } else {
         BeanUtils::setAttributes($action, array("show_items" => $show_items));
     }
     BeanUtils::setAttributes($action, array("autoregist_approver" => $config['autoregist_approver']['conf_value']));
     BeanUtils::setAttributes($action, array("autoregist_author" => $config['autoregist_author']['conf_value']));
     BeanUtils::setAttributes($action, array("autoregist_defroom" => $config['autoregist_defroom']['conf_value']));
     BeanUtils::setAttributes($action, array("config" => $config));
     BeanUtils::setAttributes($action, array("filelist" => $filelist));
     return;
 }
 /**
  * validate実行
  *
  * @param   mixed   $attributes チェックする値
  * @param   string  $errStr     エラー文字列
  * @param   array   $params     オプション引数
  * @return  string  エラー文字列(エラーの場合)
  * @access  public
  */
 function validate($attributes, $errStr, $params)
 {
     $details_flag = intval($attributes["details_flag"]);
     if ($details_flag == _OFF) {
         return;
     }
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     $action =& $actionChain->getCurAction();
     $rrule = array();
     $repeat_flag = intval($attributes["repeat_flag"]);
     if ($repeat_flag == _OFF) {
         $rrule["FREQ"] = "NONE";
         BeanUtils::setAttributes($action, array("rrule" => $rrule));
         return;
     }
     $rrule_term = $attributes["rrule_term"];
     if ($rrule_term != "COUNT" && $rrule_term != "UNTIL") {
         return _INVALID_INPUT;
     }
     if ($rrule_term == "COUNT") {
         $rrule_count = intval($attributes["rrule_count"]);
         if (empty($attributes["rrule_count"]) && $rrule_count !== 0) {
             return sprintf(_REQUIRED, CALENDAR_RRULE_LBL_COUNT);
         }
         if ($rrule_count <= 0) {
             return sprintf(_NUMBER_ERROR, CALENDAR_RRULE_LBL_COUNT, 1, 999);
         }
         $rrule["COUNT"] = $rrule_count;
     }
     if ($rrule_term == "UNTIL") {
         $rrule_until = $attributes["rrule_until"];
         if (empty($rrule_until)) {
             return sprintf(_REQUIRED, CALENDAR_RRULE_LBL_UNTIL);
         }
         if (!preg_match("/^([0-9]{4})([0-9]{2})([0-9]{2})\$/", $rrule_until, $matches)) {
             return sprintf(_INVALID_DATE, CALENDAR_RRULE_LBL_UNTIL);
         }
         if (!checkdate($matches[2], $matches[3], $matches[1])) {
             return sprintf(_INVALID_DATE, CALENDAR_RRULE_LBL_UNTIL);
         }
         $date = timezone_date($matches[1] . $matches[2] . $matches[3] . "240000", true, "YmdHis");
         if ($attributes["start_time_full"] > $date) {
             return CALENDAR_RRULE_ERR_UNTIL_OVER;
         }
         $rrule["UNTIL"] = substr($date, 0, 8) . "T" . substr($date, 8);
     }
     $repeat_freq = $attributes["repeat_freq"];
     if (!isset($repeat_freq)) {
         return _INVALID_INPUT;
     }
     $rrule_interval = $attributes["rrule_interval"];
     if ($repeat_freq != "NONE" && !isset($rrule_interval) && !isset($rrule_interval[$repeat_freq])) {
         return _INVALID_INPUT;
     }
     $wday_array = explode("|", CALENDAR_REPEAT_WDAY);
     $rrule_byday = $attributes["rrule_byday"];
     $rrule_bymonthday = $attributes["rrule_bymonthday"];
     $rrule_bymonth = $attributes["rrule_bymonth"];
     switch ($repeat_freq) {
         case "DAILY":
             $rrule["FREQ"] = $repeat_freq;
             $rrule["INTERVAL"] = intval($rrule_interval[$repeat_freq]);
             break;
         case "WEEKLY":
             $rrule["FREQ"] = $repeat_freq;
             $rrule["INTERVAL"] = intval($rrule_interval[$repeat_freq]);
             if (!isset($rrule_byday) && !isset($rrule_byday[$repeat_freq])) {
                 return CALENDAR_RRULE_ERR_WDAY;
             }
             $byday = array();
             foreach ($rrule_byday[$repeat_freq] as $i => $w) {
                 if (!in_array($w, $wday_array)) {
                     continue;
                 }
                 $byday[] = $w;
             }
             if (empty($byday)) {
                 return CALENDAR_RRULE_ERR_WDAY;
             }
             $rrule["BYDAY"] = $byday;
             break;
         case "MONTHLY":
             $rrule["FREQ"] = $repeat_freq;
             $rrule["INTERVAL"] = intval($rrule_interval[$repeat_freq]);
             if (!isset($rrule_byday) && !isset($rrule_byday[$repeat_freq]) && !isset($rrule_bymonthday) && !isset($rrule_bymonthday[$repeat_freq])) {
                 return CALENDAR_RRULE_ERR_WDAY_OR_DAY;
             }
             if (isset($rrule_byday) && isset($rrule_byday[$repeat_freq])) {
                 $byday = array();
                 foreach ($rrule_byday[$repeat_freq] as $i => $val) {
                     $w = substr($val, -2);
                     $n = intval(substr($val, 0, -2));
                     if ($n == 0) {
                         $val = $w;
                     }
                     if (!in_array($w, $wday_array)) {
                         continue;
                     }
                     if (!($n >= -1 && $n <= 4)) {
                         continue;
                     }
                     $byday[] = $val;
                 }
                 $rrule["BYDAY"] = $byday;
             }
             if (isset($rrule_bymonthday) && isset($rrule_bymonthday[$repeat_freq])) {
                 $bymonthday = array();
                 foreach ($rrule_bymonthday[$repeat_freq] as $i => $val) {
                     $val = intval($val);
                     if ($val > 0 && $val <= 31) {
                         $bymonthday[] = $val;
                     }
                 }
                 $rrule["BYMONTHDAY"] = $bymonthday;
             }
             if (empty($byday) && empty($bymonthday)) {
                 return CALENDAR_RRULE_ERR_WDAY_OR_DAY;
             }
             break;
         case "YEARLY":
             $rrule["FREQ"] = $repeat_freq;
             $rrule["INTERVAL"] = intval($rrule_interval[$repeat_freq]);
             if (!isset($rrule_bymonth) && !isset($rrule_bymonth[$repeat_freq])) {
                 return CALENDAR_RRULE_ERR_MONTH;
             }
             $bymonth = array();
             foreach ($rrule_bymonth[$repeat_freq] as $i => $val) {
                 $val = intval($val);
                 if ($val > 0 && $val <= 12) {
                     $bymonth[] = $val;
                 }
             }
             if (empty($bymonth)) {
                 return CALENDAR_RRULE_ERR_MONTH;
             }
             $rrule["BYMONTH"] = $bymonth;
             if (isset($rrule_byday) && isset($rrule_byday[$repeat_freq])) {
                 $byday = array();
                 foreach ($rrule_byday[$repeat_freq] as $i => $val) {
                     $w = substr($val, -2);
                     $n = intval(substr($val, 0, -2));
                     if ($n == 0) {
                         $val = $w;
                     }
                     if (!in_array($w, $wday_array)) {
                         continue;
                     }
                     if (!($n >= -1 && $n <= 4)) {
                         continue;
                     }
                     $byday[] = $val;
                 }
                 $rrule["BYDAY"] = $byday;
             }
             break;
         default:
             $rrule["FREQ"] = "NONE";
     }
     $request =& $container->getComponent("Request");
     $request->setParameter("rrule", $rrule);
 }
 /**
  * プリフィルタ
  *
  * @access  private
  */
 function _preFilter()
 {
     $action =& $this->_actionChain->getCurAction();
     $attributes = $this->getAttributes();
     // リクエストを受け取るため
     $keyword = $this->_request->getParameter("keyword");
     $select_kind = $this->_request->getParameter("select_kind");
     $handle = $this->_request->getParameter("handle");
     $display_days = $this->_request->getParameter("display_days");
     if (isset($display_days)) {
         $today = timezone_date(null, false, "Ymd");
         $fm_target_date = date("Ymd", mktime(0, 0, 0, intval(substr($today, 4, 2)), intval(substr($today, 6, 2)) - $display_days, intval(substr($today, 0, 4))));
         $to_target_date = $today;
     } else {
         $fm_target_date = str_replace(_DAYSEPARATOR, "", $this->_request->getParameter("fm_target_date"));
         $to_target_date = str_replace(_DAYSEPARATOR, "", $this->_request->getParameter("to_target_date"));
     }
     //
     // セットパラメータ名称取得
     // sqlwhere		:default sqlwhere
     // params		:default params
     //
     $request_sqlwhere = isset($attributes['sqlwhere']) ? $attributes['sqlwhere'] : "sqlwhere";
     $request_params = isset($attributes['params']) ? $attributes['params'] : "params";
     //
     // カラム名称取得
     // keyword			:default 複数カラム検索する場合、「,」区切りにすること
     // wysiwyg			:default 複数カラム検索する場合、「,」区切りにすること
     //        keyword or wysiwyg どちらか必須
     // handle			:default insert_user_name
     // fm_target_date	:default insert_time
     // to_target_date	:default insert_time
     //
     $col_keyword = isset($attributes['keyword']) ? explode(",", $attributes['keyword']) : null;
     $col_wysiwyg = isset($attributes['wysiwyg']) ? explode(",", $attributes['wysiwyg']) : null;
     $col_handle = isset($attributes['handle']) ? $attributes['handle'] : "insert_user_name";
     $col_target_time = isset($attributes['target_time']) ? explode(",", $attributes['target_time']) : array("insert_time");
     $sqlwhere = "";
     $params = array();
     //// 日付 ////
     // 対象日(from)
     if ($fm_target_date) {
         if (strlen($fm_target_date) == 8) {
             $fm_target_date = $fm_target_date . "000000";
         }
         $fm_target_date = timezone_date($fm_target_date, true, "YmdHis");
     }
     // 対象日(to)
     if ($to_target_date) {
         if (strlen($to_target_date) == 8) {
             $to_target_date = $to_target_date . "240000";
         }
         $to_target_date = timezone_date($to_target_date, true, "YmdHis");
     }
     if ($fm_target_date || $to_target_date) {
         $sqlwhere .= " AND (";
         $col_count = 0;
         foreach ($col_target_time as $col_target_time_name) {
             if ($col_count > 0) {
                 $sqlwhere .= " OR ";
             }
             $sqlwhere .= "(";
             if ($fm_target_date) {
                 $params['fm_target_date' . $col_count] = $fm_target_date;
                 $sqlwhere .= $col_target_time_name . " >= ?";
             } else {
                 $sqlwhere .= "1=1";
             }
             $sqlwhere .= " AND ";
             if ($to_target_date) {
                 $params['to_target_date' . $col_count] = $to_target_date;
                 $sqlwhere .= $col_target_time_name . " < ?";
             } else {
                 $sqlwhere .= "1=1";
             }
             $sqlwhere .= ")";
             $col_count++;
         }
         $sqlwhere .= ")";
     }
     //// ハンドル(検索のみ) ////
     if ($handle != "" && $handle != null) {
         $handle = str_replace(_SEARCH_EM_SIZE_SPACE, " ", $handle);
         $handle_arr = explode(" ", $handle);
         $sqlwhere .= " AND (";
         $count = 0;
         $querysql = array();
         foreach ($handle_arr as $handle) {
             if (trim($handle) == "") {
                 continue;
             }
             $params["handle" . $count] = "%" . $handle . "%";
             $querysql[] = $col_handle . " LIKE ?";
             $count++;
         }
         $sqlwhere .= '(' . join(' OR ', $querysql) . ')';
         $sqlwhere .= ")";
     }
     //// キーワード ////
     if ($keyword != "" && $keyword != null) {
         $col_keyword_count = count($col_keyword);
         $col_wysiwyg_count = count($col_wysiwyg);
         if ($col_keyword_count > 0 || $col_wysiwyg_count > 0) {
             $sqlwhere .= " AND (";
         }
         if ($select_kind == _SELECT_KIND_PHRASE) {
             //フレーズ
             $col_count = 0;
             if ($col_keyword_count > 0) {
                 foreach ($col_keyword as $col_keyword_name) {
                     if ($col_count > 0) {
                         $sqlwhere .= " OR ";
                     }
                     if (preg_match('/:text$/', $col_keyword_name)) {
                         $col_keyword_name = preg_replace('/:text$/', '', $col_keyword_name);
                         $params['content' . $col_count] = '"' . $keyword . '"';
                         $sqlwhere .= " MATCH(" . $col_keyword_name . ") AGAINST (? IN BOOLEAN MODE)";
                     } else {
                         $params['content' . $col_count] = "%" . $keyword . "%";
                         $sqlwhere .= $col_keyword_name . " LIKE ?";
                     }
                     $col_count++;
                 }
             }
             if ($col_wysiwyg_count > 0) {
                 foreach ($col_wysiwyg as $col_wysiwyg_name) {
                     if ($col_count > 0) {
                         $sqlwhere .= " OR ";
                     }
                     if (preg_match('/:text$/', $col_wysiwyg_name)) {
                         $col_wysiwyg_name = preg_replace('/:text$/', '', $col_wysiwyg_name);
                         $params['content' . $col_count] = '"' . htmlspecialchars($keyword) . '"';
                         $sqlwhere .= " MATCH(" . $col_wysiwyg_name . ") AGAINST (? IN BOOLEAN MODE)";
                     } else {
                         $params['content' . $col_count] = "%" . htmlspecialchars($keyword) . "%";
                         $sqlwhere .= $col_wysiwyg_name . " LIKE ?";
                     }
                     $col_count++;
                 }
             }
         } else {
             if ($select_kind == _SELECT_KIND_AND) {
                 //すべて(AND検索)
                 $andor = "AND";
             } else {
                 //いずれか(OR検索)
                 $andor = "OR";
             }
             $col_count = 0;
             if ($col_keyword_count > 0) {
                 foreach ($col_keyword as $col_keyword_name) {
                     if ($col_count > 0) {
                         $sqlwhere .= " OR ";
                     }
                     $keyword = str_replace(_SEARCH_EM_SIZE_SPACE, " ", $keyword);
                     $keyword_arr = explode(" ", $keyword);
                     $count = 0;
                     $querysql = array();
                     $text_flag = false;
                     if (preg_match('/:text$/', $col_keyword_name)) {
                         $text_flag = true;
                         $col_keyword_name = preg_replace('/:text$/', '', $col_keyword_name);
                     }
                     if ($text_flag) {
                         $match_against = '';
                         foreach ($keyword_arr as $word) {
                             if (trim($word) == "") {
                                 continue;
                             }
                             if ($match_against != '') {
                                 $match_against .= ' ';
                             }
                             $match_against .= '+' . $this->_db->stringMatchAgainst($word);
                         }
                         if ($match_against != '') {
                             $params['content' . $col_count] = $match_against;
                             $querysql[] = " MATCH(" . $col_keyword_name . ") AGAINST (? IN BOOLEAN MODE)";
                         }
                     } else {
                         foreach ($keyword_arr as $word) {
                             if (trim($word) == "") {
                                 continue;
                             }
                             $params['content' . $col_count . $count] = "%" . $word . "%";
                             $querysql[] = $col_keyword_name . " LIKE ?";
                             $count++;
                         }
                     }
                     $sqlwhere .= '(' . join(' ' . $andor . ' ', $querysql) . ')';
                     $col_count++;
                 }
             }
             if ($col_wysiwyg_count > 0) {
                 foreach ($col_wysiwyg as $col_wysiwyg_name) {
                     if ($col_count > 0) {
                         $sqlwhere .= " OR ";
                     }
                     $keyword = str_replace(_SEARCH_EM_SIZE_SPACE, " ", $keyword);
                     $keyword_arr = explode(" ", $keyword);
                     $count = 0;
                     $querysql = array();
                     $text_flag = false;
                     if (preg_match('/:text$/', $col_wysiwyg_name)) {
                         $text_flag = true;
                         $col_wysiwyg_name = preg_replace('/:text$/', '', $col_wysiwyg_name);
                     }
                     if ($text_flag) {
                         $match_against = '';
                         foreach ($keyword_arr as $word) {
                             if (trim($word) == "") {
                                 continue;
                             }
                             if ($match_against != '') {
                                 $match_against .= ' ';
                             }
                             $match_against .= '+' . $this->_db->stringMatchAgainst($word);
                         }
                         if ($match_against != '') {
                             $params['content' . $col_count] = $match_against;
                             $querysql[] = " MATCH(" . $col_wysiwyg_name . ") AGAINST (? IN BOOLEAN MODE)";
                         }
                     } else {
                         foreach ($keyword_arr as $word) {
                             if (trim($word) == "") {
                                 continue;
                             }
                             $params['content' . $col_count . $count] = "%" . htmlspecialchars($word) . "%";
                             $querysql[] = $col_wysiwyg_name . " LIKE ?";
                             $count++;
                         }
                     }
                     $sqlwhere .= '(' . join(' ' . $andor . ' ', $querysql) . ')';
                     $col_count++;
                 }
             }
         }
         $sqlwhere .= ")";
     }
     $set_arr = array();
     $set_arr[$request_sqlwhere] = $sqlwhere;
     $set_arr[$request_params] = $params;
     BeanUtils::setAttributes($action, $set_arr, true);
 }