/**
  * iframeモジュールUpdate
  * @param array(block_id-url-frame_width-frame_height-scrollbar_show-scrollframe_show)
  * @return boolean true or false
  * @access	public
  */
 function updIframe($params = array())
 {
     $result = $this->_db->updateExecute("iframe", $params, "block_id", true);
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * Modules Update
  * @param array(install.iniの設定項目)
  * @return boolean true or false
  * @access	public
  */
 function updModule($install_ini = array())
 {
     $params = array("version" => $install_ini["version"], "action_name" => $install_ini["action_name"], "edit_action_name" => $install_ini["edit_action_name"], "edit_style_action_name" => $install_ini["edit_style_action_name"], "system_flag" => $install_ini["system_flag"], "disposition_flag" => $install_ini["disposition_flag"], "default_enable_flag" => $install_ini["default_enable_flag"], "module_icon" => $install_ini["module_icon"], "theme_name" => $install_ini["theme_name"], "temp_name" => $install_ini["temp_name"], "min_width_size" => $install_ini["min_width_size"], "backup_action" => $install_ini["backup_action"], "restore_action" => $install_ini["restore_action"], "search_action" => $install_ini["search_action"], "delete_action" => $install_ini["delete_action"], "block_add_action" => $install_ini["block_add_action"], "block_delete_action" => $install_ini["block_delete_action"], "move_action" => $install_ini["move_action"], "copy_action" => $install_ini["copy_action"], "shortcut_action" => $install_ini["shortcut_action"], "personalinf_action" => $install_ini["personalinf_action"], "whatnew_flag" => $install_ini["whatnew_flag"]);
     $result = $this->_db->updateExecute("modules", $params, array("module_id" => $install_ini["module_id"]), true);
     if ($result === false) {
         return $result;
     }
     return true;
 }
 /**
  * MenuDetail Update
  * @param array (block_id,page_id,theme_name,temp_name,visibility_flag)
  * @return boolean true or false
  * @access	public
  */
 function updMenuDetail($params)
 {
     $set_params = array("visibility_flag" => $params['visibility_flag']);
     $where_params = array("block_id" => $params['block_id'], "page_id" => $params['page_id']);
     $result = $this->_db->updateExecute("mobile_menu_detail", $set_params, $where_params, true);
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * RSS用ブロックデータを更新する
  *
  * @param	array	$params	変更するRSS用ブロックデータ配列
  * @return boolean	true or false
  * @access	public
  */
 function update($params = array())
 {
     $key = "block_id";
     $params = $this->_serializeXml($params);
     $result = $this->_db->updateExecute("rss_block", $params, $key, true);
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * カウンターのデフォルト値を登録する
  *
  * @return boolean true or false
  * @access	public
  */
 function setCounter()
 {
     $params = array("block_id" => $this->_request->getParameter("block_id"), "counter_digit" => intval($this->_request->getParameter("counter_digit")), "show_type" => $this->_request->getParameter("show_type"), "show_char_before" => $this->_request->getParameter("show_char_before"), "show_char_after" => $this->_request->getParameter("show_char_after"), "comment" => $this->_request->getParameter("comment"));
     if ($this->_request->getParameter("zero_flag") == _ON) {
         $params["counter_num"] = "0";
     }
     if (!$this->_db->updateExecute("counter", $params, "block_id", true)) {
         return false;
     }
     return true;
 }
 /**
  * 回答データを変更する
  *
  * @param	array	$params	登録する回答データ配列
  * @return boolean	true or false
  * @access	public
  */
 function updateAnswer($params = array())
 {
     if (!$this->_db->updateExecute("questionnaire_answer", $params, "answer_id", true)) {
         return false;
     }
     return true;
 }
 /**
  * 投票データを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function vote()
 {
     $postID = $this->_request->getParameter("post_id");
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $userID = $session->getParameter("_user_id");
     if (empty($userID)) {
         $votes = $session->getParameter("bbs_votes");
         $votes[] = $postID;
         $session->setParameter("bbs_votes", $votes);
     } else {
         $where = array("user_id" => $userID, "post_id" => $postID);
         $params = array("vote_flag" => _ON);
         $result = $this->_db->updateExecute("bbs_user_post", $params, $where);
         if ($result === false) {
             return false;
         }
     }
     $params = array($postID);
     $sql = "UPDATE {bbs_post} " . "SET vote_num = vote_num + 1 " . "WHERE post_id = ?";
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     return true;
 }
 /**
  * 項目データを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setItem()
 {
     $itemID = $this->_request->getParameter("item_id");
     if (empty($itemID)) {
         $params = array("registration_id" => $this->_request->getParameter("registration_id"));
         $count = $this->_db->countExecute("registration_item", $params);
         $params["item_sequence"] = $count + 1;
     }
     $params["item_name"] = $this->_request->getParameter("item_name");
     $params["item_type"] = intval($this->_request->getParameter("item_type"));
     $params["option_value"] = $this->_request->getParameter("option_value");
     $params["require_flag"] = intval($this->_request->getParameter("require_flag"));
     $params["list_flag"] = intval($this->_request->getParameter("list_flag"));
     $params["sort_flag"] = intval($this->_request->getParameter("sort_flag"));
     $params["description"] = $this->_request->getParameter("description");
     $itemID = $this->_request->getParameter("item_id");
     if (empty($itemID)) {
         $result = $this->_db->insertExecute("registration_item", $params, true, "item_id");
     } else {
         $params["item_id"] = $itemID;
         $result = $this->_db->updateExecute("registration_item", $params, "item_id", true);
     }
     if (!$result) {
         return false;
     }
     return true;
 }
 /**
  * Config更新処理
  * @param array $params
  * @param array $where_params
  * @return boolean
  * @access	public
  */
 function updConfig($params = array(), $where_params = array(), $footer_flag = true)
 {
     $result = $this->_db->updateExecute("config", $params, $where_params, $footer_flag);
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * 権限モジュールリンクテーブルUpdate
  * 
  * @param   array   $params        パラメータ引数
  * @param   array   $where_params  Whereパラメータ引数
  * @return boolean true or false
  * @access	public
  */
 function updAuthorityModuleLink($params = array(), $where_params = array())
 {
     $result = $this->_db->updateExecute("authorities_modules_link", $params, $where_params, true);
     if ($result === false) {
         return $result;
     }
     return true;
 }
 /**
  * 携帯モジュールの登録
  *
  * @access	public
  */
 function updateMobile($module_id, $params)
 {
     if (!$this->_mobile_obj) {
         return true;
     }
     $result = $this->_db->updateExecute("mobile_modules", $params, array("module_id" => $module_id));
     if ($result === false) {
         return false;
     }
     return true;
 }
 function remove($ids = array(), $parameter = '', $options = array())
 {
     if (is_array($ids)) {
         foreach ($ids as $id) {
             $params = array("receiver_id" => intval($id), "delete_state" => PM_MESSAGE_STATE_TRASH);
             if (!$this->_db->updateExecute("pm_message_receiver", $params, "receiver_id", true)) {
                 return false;
             }
         }
     }
     return true;
 }
 /**
  * コメントデータを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setComment()
 {
     $commentID = $this->_request->getParameter("comment_id");
     if (empty($commentID)) {
         $params = array("photo_id" => $this->_request->getParameter("photo_id"), "album_id" => $this->_request->getParameter("album_id"), "photoalbum_id" => $this->_request->getParameter("photoalbum_id"), "comment_value" => $this->_request->getParameter("comment_value"));
         $result = $this->_db->insertExecute("photoalbum_comment", $params, true, "comment_id");
     } else {
         $params = array("comment_id" => $this->_request->getParameter("comment_id"), "comment_value" => $this->_request->getParameter("comment_value"));
         $result = $this->_db->updateExecute("photoalbum_comment", $params, "comment_id", true);
     }
     if (!$result) {
         return false;
     }
     return true;
 }
 /**
  * abbreviate_urlから削除処理
  *
  * @param string $dir_name
  * @param string $unique_id
  *
  * @return boolean
  * @access  public
  */
 function moveRoom($contents_id, $org_room_id, $move_room_id)
 {
     if ($org_room_id == $move_room_id) {
         return true;
     }
     $dir_name = $this->_abbreviateurlView->getDefaultUniqueKey();
     $dirnameArray = explode("_", $dir_name);
     $module_name = $dirnameArray[0];
     $module_id = $this->_abbreviateurlView->getDefaultModuleId($module_name);
     $where_params = array("module_id" => intval($module_id), "contents_id" => intval($contents_id), "room_id" => intval($org_room_id));
     $params = array("room_id" => intval($move_room_id));
     $result = $this->_db->updateExecute("abbreviate_url", $params, $where_params, false);
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * 権限を登録する
  *
  * @access  public
  */
 function setEditAuth()
 {
     $manage_list = $this->_request->getParameter("manage_list");
     $add_authority = $this->_request->getParameter("add_authority");
     foreach ($add_authority as $room_id => $authority_id) {
         if (isset($manage_list[$room_id])) {
             $params = array("add_authority_id" => $authority_id, "use_flag" => _ON);
             $result = $this->_db->updateExecute("calendar_manage", $params, array("room_id" => $room_id), true);
         } else {
             $params = array("room_id" => $room_id, "add_authority_id" => $authority_id, "use_flag" => _ON);
             $result = $this->_db->insertExecute("calendar_manage", $params, true);
         }
         if ($result === false) {
             return false;
         }
     }
     return true;
 }
 /**
  * コメントデータを登録処理
  *
  * @return boolean	true or false
  * @access	public
  */
 function setComment($update = false)
 {
     $comment_id = $this->_request->getParameter("comment_id");
     if (!$update) {
         $params = array("report_id" => $this->_request->getParameter("report_id"), "assignment_id" => $this->_request->getParameter("assignment_id"), "comment_value" => $this->_request->getParameter("comment_value"));
         $result = $this->_db->insertExecute("assignment_comment", $params, true, "comment_id");
     } else {
         $params = array("comment_id" => $comment_id, "report_id" => $this->_request->getParameter("report_id"), "assignment_id" => $this->_request->getParameter("assignment_id"), "comment_value" => $this->_request->getParameter("comment_value"));
         $result = $this->_db->updateExecute("assignment_comment", $params, "comment_id", true);
     }
     if (!$result) {
         return false;
     }
     if (empty($comment_id)) {
         $comment_id = $result;
     }
     $this->_request->setParameter("comment_id", $comment_id);
     return true;
 }
 /**
  * 予定の変更
  *
  * @access	public
  */
 function _updateReserveByAfter(&$reserve_details_id, $start_time_full, $details_params)
 {
     $calendarAction =& $this->_container->getComponent("calendarAction");
     $reserve = $this->_request->getParameter("reserve");
     $sql = "DELETE FROM {reservation_reserve} " . "WHERE reserve_details_id = ? " . "AND start_time_full >= ? " . "AND reserve_id <> ?";
     $params = array("reserve_details_id" => $reserve_details_id, "start_time_full" => $start_time_full, "reserve_id" => $reserve["reserve_id"]);
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->addError();
         return false;
     }
     $sql = "SELECT COUNT(*) FROM {reservation_reserve} " . "WHERE reserve_details_id = ? " . "AND reserve_id <> ?";
     $params = array("reserve_details_id" => $reserve_details_id, "reserve_id" => $reserve["reserve_id"]);
     $result = $this->_db->execute($sql, $params, null, null, false);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     if ($result[0][0] == 0) {
         $result = $this->_db->deleteExecute("reservation_reserve_details", array("reserve_details_id" => $reserve_details_id));
         if ($result === false) {
             return false;
         }
     } else {
         $rrule_arr = $reserve["rrule_arr"];
         $freq = $rrule_arr["FREQ"];
         $rrule_arr = $rrule_arr[$freq];
         $rrule_arr["FREQ"] = $freq;
         $timestamp = mktime(0, 0, 0, substr($start_time_full, 4, 2), substr($start_time_full, 6, 2) - 1, substr($start_time_full, 0, 4));
         $rrule_arr["UNTIL"] = date("Ymd", $timestamp) . "T" . substr($start_time_full, 8);
         $rrule_before_str = $calendarAction->concatRRule($rrule_arr);
         $result = $this->_db->updateExecute("reservation_reserve_details", array("rrule" => $rrule_before_str), array("reserve_details_id" => $reserve_details_id));
         if ($result === false) {
             return false;
         }
     }
     $reserve_details_id = $this->_db->insertExecute("reservation_reserve_details", $details_params, false, "reserve_details_id");
     if ($reserve_details_id === false) {
         return false;
     }
     return true;
 }
 /**
  * 新着情報の削除
  *
  * @access	public
  */
 function delete($unique_id, $child_flag = 0)
 {
     $module_id = $this->_request->getParameter("module_id");
     $module_whatsnew =& $this->_modulesView->getModuleByDirname("whatsnew");
     if (!$module_whatsnew) {
         return true;
     }
     $sql = "SELECT whatsnew_id, insert_time FROM {whatsnew}" . " WHERE module_id=?" . " AND unique_id=?";
     $params = array("module_id" => $module_id, "unique_id" => $unique_id);
     $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_deleteUser"));
     if ($result === false) {
         return false;
     }
     if ($child_flag == _OFF) {
         $result = $this->_db->deleteExecute("whatsnew", array("module_id" => $module_id, "unique_id" => $unique_id));
     } elseif (isset($result[0])) {
         $result = $this->_db->updateExecute("whatsnew", array("child_update_time" => $result[0]['insert_time'], "count_num" => 0), array("module_id" => $module_id, "unique_id" => $unique_id));
     }
     return true;
 }
 /**
  * ファイル・フォルダの移動
  *
  * @return boolean	true or false
  * @access	public
  */
 function _setDepth($parent_id, $depth)
 {
     $params = array("depth" => $depth + 1);
     $result = $this->_db->updateExecute("cabinet_file", $params, array("parent_id" => $parent_id), true);
     if ($result === false) {
         return false;
     }
     $files =& $this->_db->selectExecute("cabinet_file", array("parent_id" => $parent_id, "file_type" => CABINET_FILETYPE_FOLDER));
     if ($files === false) {
         return false;
     }
     if (isset($files[0])) {
         foreach ($files as $i => $file) {
             $result = $this->_setDepth($file["file_id"], $params["depth"]);
             if ($result === false) {
                 return false;
             }
         }
     }
     return true;
 }
 /**
  * リンク先の更新
  *
  * @access	public
  */
 function clearLink($link_params)
 {
     if (!empty($link_params) && $link_params["link_module"] != "") {
         $params = array("calendar_id" => _OFF);
         $where_params = array("calendar_id" => $link_params["calendar_id"]);
         switch ($link_params["link_module"]) {
             case CALENDAR_LINK_TODO:
                 $table_name = CALENDAR_LINK_TABLE_TODO;
                 break;
             case CALENDAR_LINK_RESERVATION:
                 $table_name = CALENDAR_LINK_TABLE_RESERVATION;
                 break;
         }
         if ($table_name != "") {
             $result = $this->_db->updateExecute($table_name, $params, $where_params);
             if ($result === false) {
                 return false;
             }
         }
     }
     return true;
 }
 /**
  * リンクデータを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setLink()
 {
     $linkID = $this->_request->getParameter("link_id");
     $title = $this->_request->getParameter("title");
     $url = $this->_request->getParameter("url");
     $description = $this->_request->getParameter("description");
     if (empty($linkID)) {
         $params = array("linklist_id" => $this->_request->getParameter("linklist_id"), "category_id" => $this->_request->getParameter("category_id"));
         $sql = "SELECT MAX(link_sequence) " . "FROM {linklist_link} " . "WHERE linklist_id = ? " . "AND category_id = ?";
         $sequences = $this->_db->execute($sql, $params, null, null, false);
         if ($sequences === false) {
             $this->_db->addError();
             return false;
         }
         $params["link_sequence"] = $sequences[0][0] + 1;
         $params["title"] = $title;
         $params["url"] = $url;
         $params["description"] = $description;
         $result = $this->_db->insertExecute("linklist_link", $params, true, "link_id");
     } else {
         $params = array("link_id" => $linkID);
         if (isset($title)) {
             $params["title"] = $title;
         }
         if (isset($url)) {
             $params["url"] = $url;
         }
         if (isset($description)) {
             $params["description"] = $description;
         }
         $result = $this->_db->updateExecute("linklist_link", $params, "link_id", true);
     }
     if (!$result) {
         return false;
     }
     return true;
 }
 /**
  * フイルタデータを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setFilter()
 {
     $user_id = $this->_session->getParameter("_user_id");
     $filter_id = $this->_request->getParameter("filter_id");
     $senders = $this->_request->getParameter("senders");
     $subject = $this->_request->getParameter("subject");
     $keyword_list = $this->_request->getParameter("keyword_list");
     $apply_inbox_flag = $this->_request->getParameter("apply_inbox_flag");
     $actions = $this->_request->getParameter("filter_actions");
     $filter_actions_params = $this->_request->getParameter("filter_actions_params");
     if (!is_array($actions)) {
         $actions = array();
     }
     if (!is_array($filter_actions_params)) {
         $filter_actions_params = array();
     }
     $actions_params = array();
     foreach ($filter_actions_params as $k => $v) {
         $actions_params[(int) $k] = $v;
     }
     if (empty($apply_inbox_flag)) {
         $apply_inbox_flag = 0;
     }
     $sender_array = array();
     $sender_handles = explode(",", $senders);
     if (!is_array($sender_handles)) {
         $sender_handles = array();
     }
     foreach ($sender_handles as $sender_handle) {
         $sender_id = $this->_pmView->getUserIdByHandle(trim($sender_handle));
         $sender_array[] = $sender_id . ":" . $sender_handle;
     }
     $params = array("senders" => join(",", $sender_array), "subject" => $subject, "keyword_list" => $keyword_list, "apply_inbox_flag" => $apply_inbox_flag);
     if (empty($filter_id)) {
         $result = $this->_db->insertExecute("pm_filter", $params, true, "filter_id");
         if (!$result) {
             return false;
         }
         $filter_id = $result;
     } else {
         $params["filter_id"] = $filter_id;
         $result = $this->_db->updateExecute("pm_filter", $params, "filter_id", true);
         if (!$result) {
             return false;
         }
     }
     if (!empty($filter_id)) {
         if (sizeof($actions) > 0) {
             $params = array($filter_id, $user_id);
             $sql = "DELETE FROM {pm_filter_action_link} " . "WHERE filter_id = ? AND insert_user_id = ? AND " . "action_id NOT IN (" . join(",", $actions) . ")";
             if (!$this->_db->execute($sql, $params)) {
                 return false;
             }
             foreach ($actions as $action_id) {
                 $params = array($filter_id, $action_id, $user_id);
                 $sql = "SELECT count(*) as cnt " . "FROM {pm_filter_action_link} " . "WHERE filter_id = ? AND action_id = ? AND insert_user_id = ?";
                 $counts = $this->_db->execute($sql, $params);
                 if (!$counts) {
                     return false;
                 }
                 if (isset($actions_params[$action_id])) {
                     $action_parameters = $actions_params[$action_id];
                 }
                 if (empty($action_parameters)) {
                     $action_parameters = '';
                 }
                 $params = array("filter_id" => $filter_id, "action_id" => $action_id, "action_parameters" => $action_parameters);
                 if ($counts[0]['cnt']) {
                     $where_params = array("filter_id" => $filter_id, "action_id" => $action_id);
                     $result = $this->_db->updateExecute("pm_filter_action_link", $params, $where_params, true);
                 } else {
                     $result = $this->_db->insertExecute("pm_filter_action_link", $params, true);
                 }
                 if (!$result) {
                     return false;
                 }
             }
         }
     }
     if ($apply_inbox_flag == 1) {
         $this->applyFiltering($user_id, $filter_id);
     }
     return true;
 }
 /**
  * タスクデータを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setTask()
 {
     $taskID = $this->_request->getParameter("task_id");
     $todoID = $this->_request->getParameter("todo_id");
     $priority = $this->_request->getParameter("priority");
     $state = $this->_request->getParameter("state");
     $period = $this->_request->getParameter("period");
     $task_value = $this->_request->getParameter("task_value");
     $progress = $this->_request->getParameter("progress");
     $category_id = $this->_request->getParameter("category_id");
     if ($state == _ON) {
         $progress = '100';
     }
     if ($progress == '100') {
         $state = _ON;
     } else {
         $state = _OFF;
     }
     $whatsnewFlag = false;
     $calendarFlag = false;
     $session =& $this->_container->getComponent("Session");
     if (empty($taskID)) {
         $params = array($todoID);
         $sql = "SELECT MAX(task_sequence) " . "FROM {todo_task} " . "WHERE todo_id = ?";
         $sequences = $this->_db->execute($sql, $params, null, null, false);
         if ($sequences === false) {
             $this->_db->addError();
             return false;
         }
         $params = array("todo_id" => $todoID, "task_sequence" => $sequences[0][0] + 1, "priority" => intval($priority), "state" => intval($state), "period" => $period, "progress" => intval($progress), "category_id" => intval($category_id), "task_value" => $task_value);
         $result = $this->_db->insertExecute("todo_task", $params, true, "task_id");
         $whatsnewFlag = true;
         $calendarFlag = true;
     } else {
         $params = array("task_id" => $taskID);
         if (isset($priority)) {
             $params["priority"] = intval($priority);
         }
         if (isset($state) || $session->getParameter("_mobile_flag") == _ON) {
             $params["state"] = intval($state);
         }
         if (isset($period)) {
             $params["period"] = $period;
         }
         if (isset($progress)) {
             $params["progress"] = intval($progress);
         }
         if (isset($category_id)) {
             $params["category_id"] = intval($category_id);
         }
         if (isset($task_value)) {
             $params["task_value"] = $task_value;
             $whatsnewFlag = true;
             $calendarFlag = true;
         }
         $result = $this->_db->updateExecute("todo_task", $params, "task_id", true);
     }
     if (!$result) {
         return false;
     }
     $insertFlag = false;
     if (empty($taskID)) {
         $taskID = $result;
         $this->_request->setParameter("task_id", $taskID);
         $insertFlag = true;
     }
     if ($session->getParameter("_mobile_flag") == _ON) {
         $this->_request->setParameter("target_state", intval($state));
     }
     // -- 新着情報関連 Start --
     if ($whatsnewFlag) {
         $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
         $todo = $this->_request->getParameter("todo");
         $value = $todo["todo_name"] . _SEARCH_SUBJECT_SEPARATOR . $task_value;
         $whatsnew = array("unique_id" => $taskID, "title" => $value, "description" => $value, "action_name" => "todo_view_main_init", "parameters" => "todo_id=" . $todo["todo_id"]);
         if ($insertFlag) {
             $result = $whatsnewAction->insert($whatsnew);
         } else {
             $result = $whatsnewAction->update($whatsnew);
         }
         if ($result === false) {
             return false;
         }
     }
     // -- 新着情報関連 End --
     // -- カレンダ情報関連 Start --
     if ($calendarFlag) {
         $task = $this->_request->getParameter("task");
         $calendarAction =& $this->_container->getComponent("calendarAction");
         $calendar = $this->_request->getParameter("calendar");
         if ($calendar == _ON) {
             $params = array("room_id" => $this->_request->getParameter("room_id"));
             if (!empty($task["task_value"])) {
                 $params["title"] = $task["task_value"];
             }
             if (isset($task_value)) {
                 $params["title"] = $task_value;
             }
             if (isset($period)) {
                 $params["start_time_full"] = date("YmdHis", mktime(intval(substr($period, 8, 2)), intval(substr($period, 10, 2)), intval(substr($period, 12, 2)), intval(substr($period, 4, 2)), intval(substr($period, 6, 2)) - 1, intval(substr($period, 0, 4))));
                 $params["end_time_full"] = $period;
                 $params["allday_flag"] = _ON;
             }
             $params["link_module"] = CALENDAR_LINK_TODO;
             $params["link_id"] = $taskID;
             $params["link_action_name"] = "todo_view_main_init&todo_id=" . $todoID . "&block_id=" . $this->_request->getParameter("block_id");
             if (empty($task["calendar_id"])) {
                 $result = $calendarAction->insertPlan($params);
             } else {
                 $result = $calendarAction->updatePlan($task["calendar_id"], $params);
             }
         } elseif (!empty($task["calendar_id"])) {
             $result = $calendarAction->deletePlan($task["calendar_id"]);
         }
         if ($result === false) {
             return false;
         }
         if ($calendar == _ON && !empty($task["calendar_id"])) {
             return true;
         }
         if ($calendar == _ON) {
             $params = array("task_id" => $taskID, "calendar_id" => $result);
         }
         if ($calendar != _ON) {
             $params = array("task_id" => $taskID, "calendar_id" => 0);
         }
         if (!$this->_db->updateExecute("todo_task", $params, "task_id", true)) {
             return false;
         }
     }
     // -- カレンダ情報関連 End --
     return true;
 }
 /**
  * パーマリンク更新処理
  * @param  array   $page
  * @param  string  $upd_permalink
  * @param  array   $parent_page (1つ上の親、親をセットした場合、親の固定リンクより子の固定リンクを設定)
  * @param  private $ref_flag
  * @return boolean
  * @access	public
  */
 function updPermaLink($page, $upd_permalink, $parent_page = null, $ref_flag = false)
 {
     $permalink = $upd_permalink;
     if (isset($upd_permalink) && ($upd_permalink != "" || $page['space_type'] == _SPACE_TYPE_PUBLIC && $page['thread_num'] == 1 && $page['display_sequence'] == 1)) {
         $replace_permalink = preg_replace(_PERMALINK_PROHIBITION, _PERMALINK_PROHIBITION_REPLACE, $upd_permalink);
         if (isset($parent_page)) {
             $permalink = $parent_page['permalink'];
             /*
             if($ref_flag == true) {
             	$permalink_arr = explode('/', $permalink);
             	$page_permalink_arr = explode('/', $page['permalink']);
             	$count = 0;
             	foreach($page_permalink_arr as $page_permalink) {
             		if(isset($permalink_arr[$count])) {
             			$page_permalink_arr[$count] = $permalink_arr[$count];
             		}
             		$count++;
             	}
             	unset($page_permalink_arr[count($page_permalink_arr)-1]);
             	$permalink = implode('/', $page_permalink_arr);
             }
             */
             if ($page['space_type'] == _SPACE_TYPE_PUBLIC && $page['thread_num'] == 0 || $page['private_flag'] == _OFF && $page['space_type'] == _SPACE_TYPE_GROUP && $page['thread_num'] == 0) {
                 $replace_permalink = "";
             } else {
                 if ($permalink == "") {
                     $permalink .= $replace_permalink;
                 } else {
                     $permalink .= '/' . $replace_permalink;
                 }
             }
         } else {
             $permalink_arr = explode('/', $page['permalink']);
             $current_permalink = $permalink_arr[count($permalink_arr) - 1];
             $permalink_arr[count($permalink_arr) - 1] = $replace_permalink;
             $permalink = implode('/', $permalink_arr);
         }
         // 同じ階層に同じ言語と名称の固定リンクがあればリネーム
         if ($permalink !== "") {
             $permalink = $this->getRenamePermaLink($permalink, $page['page_id'], $page['lang_dirname']);
         }
         if ($permalink == $page['permalink']) {
             // 固定リンク変更なし
             return $permalink;
         }
         $update_params = array("permalink" => $permalink);
         $result = $this->_db->updateExecute("pages", $update_params, array("page_id" => $page['page_id']));
         if ($result === false) {
             return false;
         }
         //
         // 子のページのpermalinkも更新をかける
         // サブグループならば、必ず再帰的に実行
         //
         if ($ref_flag == false || $page['page_id'] == $page['room_id']) {
             $child_pages = $this->_getChildPages($page);
             if ($child_pages === false) {
                 return false;
             }
             if (count($child_pages) > 0) {
                 $page['permalink'] = $permalink;
                 foreach ($child_pages as $key => $child_page) {
                     $permalink_arr = explode('/', $child_page['permalink']);
                     $upd_permalink = $permalink_arr[count($permalink_arr) - 1];
                     $set_page = isset($child_pages[$child_page['parent_id']]) ? $child_pages[$child_page['parent_id']] : $page;
                     $child_pages[$key]['permalink'] = $this->updPermaLink($child_page, $upd_permalink, $set_page, true);
                 }
             }
         }
     }
     return $permalink;
 }
 /**
  * Uploads Update
  *
  * @param   array   $params        パラメータ引数
  * @param   array   $where_params  Whereパラメータ引数
  * @param   boolean $footer_flag
  * @return boolean true or false
  * @access	public
  */
 function updUploads($params = array(), $where_params = array(), $footer_flag = true)
 {
     return $this->_db->updateExecute("uploads", $params, $where_params, $footer_flag);
 }
 /**
  * 会員項目リンクテーブルUpdate
  * 
  * @param   array   $params        パラメータ引数
  * @param   array   $where_params  Whereパラメータ引数
  * @return boolean true or false
  * @access	public
  */
 function updUsersItemsLink($params = array(), $where_params = array())
 {
     return $this->_db->updateExecute("users_items_link", $params, $where_params, false);
 }
 /**
  * セッション処理を開始
  *
  * @access  public
  * @since   3.0.0
  */
 function start($regenerate_flag = _ON)
 {
     @session_set_save_handler(array(&$this, 'sess_open'), array(&$this, 'sess_close'), array(&$this, 'sess_read'), array(&$this, 'sess_write'), array(&$this, 'sess_destroy'), array(&$this, 'sess_gc'));
     @register_shutdown_function('session_write_close');
     @session_start();
     //$_noregenerate_sess_flag = $this->getParameter("_noregenerate_sess_flag");
     //if($_noregenerate_sess_flag && $this->sess_updated != null) {
     //if($this->regenerate_sess_id != null) {
     //
     // 新しいセッションIDに変換($this->old_session_time以内であれば)
     //
     //@register_shutdown_function('session_write_close');
     //@session_id($this->regenerate_sess_id);
     //@session_start();
     //$this->regenerate_sess_id = null;
     //$this->start();
     //return;
     //}
     $_base_sess_id = $this->getParameter("_base_sess_id");
     if (!isset($_base_sess_id)) {
         $_base_sess_id = session_id();
         $this->setParameter("_base_sess_id", $_base_sess_id);
     }
     if ($regenerate_flag) {
         //古いセッションに対してregenerateしないようにする
         //$this->setParameter("_noregenerate_sess_flag", _ON);
         $old_session_id = session_id();
         //$this->setParameter("_old_sess_flag", true);
         if ($this->regenerate_flag && session_regenerate_id()) {
             //$this->setParameter("_old_sess_flag", false);
             //$this->setParameter("_noregenerate_sess_flag", _OFF);
             $this->new_session_id = session_id();
             $this->old_session_id = $old_session_id;
             // smarty_cacheのセッションIDも同時に更新
             // Cacheフィルターがうまく動作しなくなるため
             $adodb =& $this->_db->getAdoDbObject();
             if (is_object($adodb)) {
                 $this->_db->updateExecute("smarty_cache", array("session_id" => $this->new_session_id), array("session_id" => $this->old_session_id));
                 if (rand(0, $this->regenerate_session_num) == 0) {
                     // regenerate_session_num分の1の確立で、regenerate前のセッションデータ削除
                     $params = array("base_sess_id" => $_base_sess_id, "sess_updated_old_session" => date("YmdHis", date("U") - $this->old_session_time));
                     $result = $this->_db->execute("DELETE FROM {session} " . " WHERE old_flag = 1 AND base_sess_id = ? AND sess_updated < ? ", $params);
                 }
             }
         }
     }
     //-------------------------------------------------------------------------------------
     // セッションID変更
     // Ajaxや画像ファイルのダウンロードのリクエストによりセッションIDを切り替えてしまうと
     //( 同じタイミングで複数リクエストがくる)
     // セッション情報がうまく変更されないため
     // ページを切り替えた場合のみ実装
     //-------------------------------------------------------------------------------------
     /*
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     //$actionList  = explode("_", $actionChain->getCurActionName());
     if($actionChain->getCurActionName() == DEFAULT_ACTION || $actionChain->getCurActionName() == "control_view_main") {
     	$sessionids_remove = @$_SESSION['old_session_id'];
     
     	$old_session_id = session_id();
     	if(!empty($sessionids_remove)) {
     		// ページ切り替えの連続的に行うとセッションが切れてしまうため、次のリクエストまでセッションを保持しておく
     		$this->sess_destroy($sessionids_remove);
     	}
     	if(session_regenerate_id()) {
     		$_SESSION['old_session_id'] = $old_session_id;
     
     		$new_session_id = session_id();
     		//$this->sess_destroy($old_session_id);
     		// smarty_cacheのセッションIDも同時に更新
     		// Cacheフィルターがうまく動作しなくなるため
     		$db =& $container->getComponent("DbObject");
     		$db->updateExecute("smarty_cache", array("session_id" => $new_session_id), array("session_id" => $old_session_id));
     	}
     }
     */
 }
 function saveTrackback($trackback)
 {
     //存在しないpostにトラックバックさせない
     $params = array("post_id" => intval($trackback['post_id']));
     $post = $this->_db->selectExecute("journal_post", $params);
     if ($post === false || !isset($post[0])) {
         return false;
     }
     //トラックバックの承認
     $params = array("journal_id" => intval($post[0]['journal_id']));
     $journal = $this->_db->selectExecute("journal", $params);
     if ($journal === false || !isset($journal[0])) {
         return false;
     }
     //偽造のリクエストに記事のタイトルと概要以外の情報が持ってないから、トラックバックをしたユーザが判断できない、管理者でも承認するようにする
     //$session =& $this->_container->getComponent("Session");
     //$_auth_id = $session->getParameter("_auth_id");
     //if($_auth_id < _AUTH_CHIEF && $journal[0]['comment_agree_flag'] == _ON) {
     $session =& $this->_container->getComponent("Session");
     $time = timezone_date();
     $footer_array = array();
     $footer_array['insert_time'] = $time;
     $footer_array['insert_site_id'] = "";
     $footer_array['insert_user_id'] = "";
     $footer_array['insert_user_name'] = "";
     $footer_array['update_time'] = $time;
     $footer_array['update_site_id'] = "";
     $footer_array['update_user_id'] = "";
     $footer_array['update_user_name'] = "";
     if (!empty($trackback['user_id']) && $this->checkSite($trackback['tb_url'])) {
         //自サイトからのトラックバックだったら、user_idを付いている場合
         $userView =& $this->_container->getComponent("usersView");
         $user = $userView->getUserById($trackback['user_id']);
         $user_auth_id = $user['user_authority_id'];
         if ($user_auth_id < _AUTH_CHIEF && $journal[0]['comment_agree_flag'] == _ON && $trackback['direction_flag'] == JOURNAL_TRACKBACK_RECEIVE) {
             $agree_flag = JOURNAL_STATUS_WAIT_AGREE_VALUE;
         } else {
             $agree_flag = JOURNAL_STATUS_AGREE_VALUE;
         }
         $site_id = $session->getParameter("_site_id");
         $footer_array['insert_site_id'] = $site_id;
         $footer_array['insert_user_id'] = $user['user_id'];
         $footer_array['insert_user_name'] = $user['handle'];
         $footer_array['update_site_id'] = $site_id;
         $footer_array['update_user_id'] = $user['user_id'];
         $footer_array['update_user_name'] = $user['handle'];
     } else {
         //自サイト以外のトラックバックだったら
         if ($journal[0]['comment_agree_flag'] == _ON && $trackback['direction_flag'] == JOURNAL_TRACKBACK_RECEIVE) {
             $agree_flag = JOURNAL_STATUS_WAIT_AGREE_VALUE;
         } else {
             $agree_flag = JOURNAL_STATUS_AGREE_VALUE;
         }
     }
     $params = array("parent_id" => intval($trackback['post_id']), "tb_url" => $trackback['tb_url'], "direction_flag" => $trackback['direction_flag']);
     $order_params = array("insert_time" => "DESC");
     $tb_obj = $this->_db->selectExecute("journal_post", $params, $order_params);
     if ($tb_obj === false) {
         return false;
     }
     if (empty($tb_obj)) {
         $params = array("journal_id" => intval($post[0]['journal_id']), "root_id" => intval($trackback['post_id']), "parent_id" => intval($trackback['post_id']), "title" => $trackback['blog_title'], "content" => $trackback['description'], "agree_flag" => $agree_flag, "blog_name" => $trackback['blog_name'], "direction_flag" => $trackback['direction_flag'], "tb_url" => $trackback['tb_url'], "room_id" => $post[0]['room_id']);
         $params = array_merge($params, $footer_array);
         $post_id = $this->_db->insertExecute("journal_post", $params, false, "post_id");
         if ($post_id === false) {
             return false;
         }
         //メール送信データ登録
         if ($journal[0]['comment_agree_flag'] == _ON && $agree_flag == JOURNAL_STATUS_WAIT_AGREE_VALUE) {
             $session->setParameter("journal_mail_post_id", array("post_id" => $post_id, "agree_flag" => JOURNAL_STATUS_WAIT_AGREE_VALUE));
             $preexecute =& $this->_container->getComponent("preexecuteMain");
             $result = $preexecute->preExecute("journal_action_main_mail");
         }
         //--新着情報関連 Start--
         $params = array("journal_id" => intval($post[0]['journal_id']));
         $journal_block = $this->_db->selectExecute("journal_block", $params, null, 1);
         if ($journal_block === false) {
             return false;
         }
         $block_id = isset($journal_block[0]) ? $journal_block[0]['block_id'] : 0;
         $count = $this->_db->countExecute("journal_post", array("parent_id" => $trackback['post_id'], "direction_flag != " . JOURNAL_TRACKBACK_TRANSMIT => null));
         if ($count === false) {
             return false;
         }
         if ($agree_flag == JOURNAL_STATUS_AGREE_VALUE) {
             $commonMain =& $this->_container->getComponent("commonMain");
             $time = timezone_date();
             if (intval($time) < intval($post[0]['journal_date'])) {
                 // 未来ならば、日誌の記事の時間をセット
                 $time = $post[0]['journal_date'];
             }
             $whatsnew = array("unique_id" => $trackback['post_id'], "title" => $post[0]['title'], "description" => $post[0]['content'], "action_name" => "journal_view_main_detail", "parameters" => "post_id=" . $trackback['post_id'] . "&trackback_flag=1&block_id=" . $block_id . "#" . $commonMain->getTopId($block_id), "count_num" => $count, "child_flag" => _ON, "room_id" => $post[0]['room_id'], "insert_time" => $time, "insert_user_id" => $post[0]['insert_user_id'], "insert_user_name" => $post[0]['insert_user_name']);
             $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
             $result = $whatsnewAction->auto($whatsnew, _ON);
             if ($result === false) {
                 return false;
             }
         } else {
             if ($count == 0) {
                 $result = $whatsnewAction->delete($trackback['post_id'], _ON);
             }
         }
         //--新着情報関連 End--
     } else {
         $params = array("blog_name" => $trackback['blog_name'], "title" => $trackback['blog_title'], "content" => $trackback['description'], "agree_flag" => $agree_flag);
         $where_params = array("post_id" => intval($tb_obj[0]['post_id']), "tb_url" => $trackback['tb_url'], "direction_flag" => $trackback['direction_flag']);
         $result = $this->_db->updateExecute("journal_post", $params, $where_params, true);
         if ($result === false) {
             return false;
         }
     }
     return true;
 }