Exemplo n.º 1
0
 /**
  * iframeモジュールInsert
  * @param array(block_id-url-frame_width-frame_height-scrollbar_show-scrollframe_show)
  * @return boolean true or false
  * @access	public
  */
 function insIframe($params = array())
 {
     $result = $this->_db->insertExecute("iframe", $params, true);
     if ($result === false) {
         return false;
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * MenuDetail Insert
  * @param array (block_id,page_id,visibility_flag)
  * @return boolean true or false
  * @access	public
  */
 function insMenuDetail($params)
 {
     $result = $this->_db->insertExecute("menu_detail", $params, true);
     if ($result === false) {
         return false;
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * 権限モジュールリンクテーブルInsert
  * 
  * @param   array   $params     パラメータ引数
  * @return boolean true or false
  * @access	public
  */
 function insAuthorityModuleLink($params = array())
 {
     $result = $this->_db->insertExecute("authorities_modules_link", $params, true);
     if ($result === false) {
         return $result;
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * RSS用ブロックデータを登録する
  *
  * @param	array	$params	登録するRSS用ブロックデータ配列
  * @return boolean	true or false
  * @access	public
  */
 function insert($params = array())
 {
     $params = $this->_serializeXml($params);
     $result = $this->_db->insertExecute("rss_block", $params, true);
     if (!$result) {
         $this->_db->addError();
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * Modules Insert
  * @param array(install.iniの設定項目)
  * @return boolean false or int $module_id
  * @access	public
  */
 function insModule($install_ini = array())
 {
     //MAX表示順取得
     $configView =& $this->_container->getComponent("modulesView");
     $display_sequence = $configView->getMaxDisplaySeq($install_ini["system_flag"]) + 1;
     $params = array("version" => $install_ini["version"], "display_sequence" => $display_sequence, "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"]);
     $module_id = $this->_db->insertExecute("modules", $params, true, "module_id");
     if ($module_id === false) {
         return $result;
     }
     return $module_id;
 }
Exemplo n.º 6
0
 /**
  * ConfigValue登録処理
  * @return boolean true or false
  * @access	public
  **/
 function insConfigValue($conf_modid, $conf_name, $conf_value)
 {
     $regs = array();
     if (preg_match("/^([^\\[\\]>]+)(\\[([0-9]*)\\])?\$/", $conf_name, $regs)) {
         $conf_name = $regs[1];
     }
     $conf_catid = isset($regs[3]) ? intval($regs[3]) : 0;
     $params = array("conf_modid" => $conf_modid, "conf_catid" => $conf_catid, "conf_name" => $conf_name, "conf_value" => $conf_value);
     $result = $this->_db->insertExecute("config", $params, true, "conf_id");
     if ($result === false) {
         return false;
     }
     return true;
 }
Exemplo n.º 7
0
 /**
  * カウンターのデフォルト値を登録する
  *
  * @return boolean true or false
  * @access	public
  */
 function setDefault()
 {
     $container =& DIContainerFactory::getContainer();
     $configView =& $container->getComponent("configView");
     $moduleID = $this->_request->getParameter("module_id");
     $config = $configView->getConfig($moduleID, false);
     if ($config === false) {
         return $config;
     }
     $params = array("block_id" => $this->_request->getParameter("block_id"), "counter_digit" => $config["counter_digit"]["conf_value"], "counter_num" => "0", "show_type" => $config["show_type"]["conf_value"], "show_char_before" => SHOW_CHAR_BEFORE, "show_char_after" => SHOW_CHAR_AFTER, "comment" => OTHER_DISP_CHAR);
     if (!$this->_db->insertExecute("counter", $params, true)) {
         return false;
     }
     return true;
 }
Exemplo n.º 8
0
 /**
  * プライベートキー取得時使用
  * @return array
  * @access	public
  */
 function &getEncryptionKeys()
 {
     // 有効期限が切れてないものを取得
     $int_time = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - $this->expiration_day, date("Y"));
     $time = date("YmdHis", $int_time);
     $where_params = array("expiration_time >= " . $time => null);
     $result = $this->_db->selectExecute("encryption", $where_params, null, 1);
     if ($result === false) {
         return $result;
     }
     if (!isset($result[0])) {
         // 有効期限が切れている or 新規作成
         $key_pair = new Crypt_RSA_KeyPair($this->key_length);
         $public_key = $key_pair->getPublicKey();
         $private_key = $key_pair->getPrivateKey();
         //insert
         $update_time = timezone_date();
         $container =& DIContainerFactory::getContainer();
         $session =& $container->getComponent("Session");
         $user_id = $session->getParameter("_user_id");
         $int_time = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $this->expiration_day, date("Y"));
         $time = date("YmdHis", $int_time);
         $params = array("public_key" => $public_key->toString(), "private_key" => $private_key->toString(), "key_length" => $this->key_length, "expiration_time" => $time, "update_time" => $update_time, "update_user" => $user_id);
         $result = $this->_db->insertExecute("encryption", $params, false);
         if ($result === false) {
             return $result;
         }
     } else {
         $params = $result[0];
         //$private_key = $result[0]['private_key'];
     }
     return $params;
 }
Exemplo n.º 9
0
 /**
  * 解凍のデータベースに登録処理
  *
  * @return boolean
  * @access private
  */
 function execDecompress($params, $file_path = "")
 {
     if ($params["file_type"] == CABINET_FILETYPE_FILE) {
         $upload_params = array("room_id" => $this->_request->getParameter("room_id"), "module_id" => $this->_request->getParameter("module_id"), "unique_id" => $this->_request->getParameter("cabinet_id"), "file_name" => $params["file_name"] . "." . $params["extension"], "physical_file_name" => "", "file_path" => "cabinet/", "action_name" => "common_download_main", "file_size" => $params["size"], "mimetype" => $this->_uploadsView->mimeinfo("type", $params["file_name"] . "." . $params["extension"]), "extension" => $params['extension'], "garbage_flag" => _OFF);
         $upload_id = $this->_uploadsAction->insUploads($upload_params);
         if ($upload_id === false) {
             return false;
         }
         $result = $this->_uploadsView->getUploadById($upload_id);
         if ($result === false) {
             return false;
         }
         copy($file_path, FILEUPLOADS_DIR . $result[0]["file_path"] . $result[0]["physical_file_name"]);
         chmod(FILEUPLOADS_DIR . $result[0]["file_path"] . $result[0]["physical_file_name"], 0666);
         $params["upload_id"] = $upload_id;
     }
     $file_params = array("cabinet_id" => $this->_request->getParameter("cabinet_id"), "upload_id" => $params["upload_id"], "parent_id" => $params["parent_id"], "file_name" => $params["file_name"], "extension" => $params["extension"], "depth" => $params["depth"], "size" => $params["size"], "download_num" => 0, "file_type" => $params["file_type"], "display_sequence" => 0);
     $file_id = $this->_db->insertExecute("cabinet_file", $file_params, true, "file_id");
     if ($file_id === false) {
         return false;
     }
     $file_params = array("file_id" => $file_id, "comment" => "");
     $result = $this->_db->insertExecute("cabinet_comment", $file_params, true);
     if ($result === false) {
         return false;
     }
     return $file_id;
 }
Exemplo n.º 10
0
 /**
  * 既読データを登録する
  *
  * @param	stirng	$postID	記事ID
  * @return boolean	true or false
  * @access	public
  */
 function read($postID)
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $userID = $session->getParameter("_user_id");
     $room_id = $this->_request->getParameter("room_id");
     if (empty($userID)) {
         return true;
     }
     $params = array("user_id" => $userID, "post_id" => $postID);
     $sql = "SELECT post_id " . "FROM {bbs_user_post} " . "WHERE user_id = ? " . "AND post_id = ?";
     $postIDs = $this->_db->execute($sql, $params);
     if ($postIDs === false) {
         $this->_db->addError();
         return false;
     }
     if (!empty($postIDs)) {
         return true;
     }
     $params["read_flag"] = _ON;
     $params["room_id"] = $room_id;
     if (!$this->_db->insertExecute("bbs_user_post", $params)) {
         return false;
     }
     return true;
 }
Exemplo n.º 11
0
 /**
  * ログイン
  *
  * @access	public
  */
 function setLogin($user_id, $login_id, $password, $user_name)
 {
     $mobile_info = $this->_session->getParameter("_mobile_info");
     if ($mobile_info["autologin"] != _AUTOLOGIN_OK) {
         return true;
     }
     if (empty($mobile_info["tel_id"])) {
         return true;
     }
     $container =& DIContainerFactory::getContainer();
     $request =& $container->getComponent('Request');
     $mobileAutoLogin = $request->getParameter('mobile_auto_login');
     if ($mobileAutoLogin != _ON) {
         return true;
     }
     $result = $this->_db->deleteExecute("mobile_users", array("user_id" => $user_id));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("mobile_users", array("tel_id" => $mobile_info["tel_id"]));
     if ($result === false) {
         return false;
     }
     $time = timezone_date();
     $params = array("user_id" => $user_id, "tel_id" => $mobile_info["tel_id"], "login_id" => $login_id, "password" => $password, "insert_time" => $time, "insert_site_id" => 0, "insert_user_id" => $user_id, "insert_user_name" => $user_name, "update_time" => $time, "update_site_id" => 0, "update_user_id" => $user_id, "update_user_name" => $user_name);
     $result = $this->_db->insertExecute("mobile_users", $params);
     if ($result === false) {
         return false;
     }
     return true;
 }
Exemplo n.º 12
0
 /**
  * 評価値データを登録処理
  *
  * @return boolean	true or false
  * @access	public
  */
 function setGradeValue()
 {
     $params = array("room_id" => $this->_request->getParameter("room_id"));
     $result = $this->_db->deleteExecute("assignment_grade_value", $params);
     if ($result === false) {
         return false;
     }
     $grade_values = $this->_request->getParameter("grade_value");
     if (empty($grade_values)) {
         return true;
     }
     $disp_seq = 0;
     foreach ($grade_values as $i => $grade_value) {
         if (empty($grade_value)) {
             continue;
         }
         $disp_seq++;
         $params = array("grade_value" => $grade_value, "display_sequence" => $disp_seq);
         $result = $this->_db->insertExecute("assignment_grade_value", $params, true);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 13
0
 /**
  * 投票データを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function vote()
 {
     $photoID = $this->_request->getParameter("photo_id");
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $userID = $session->getParameter("_user_id");
     if (empty($userID)) {
         $votes = $session->getParameter("photoalbum_votes");
         $votes[] = $photoID;
         $session->setParameter("photoalbum_votes", $votes);
     } else {
         $params = array("user_id" => $userID, "photo_id" => $photoID, "vote_flag" => _ON);
         if (!$this->_db->insertExecute("photoalbum_user_photo", $params, true)) {
             return false;
         }
     }
     $params = array($photoID);
     $sql = "UPDATE {photoalbum_photo} " . "SET photo_vote_count = photo_vote_count + 1 " . "WHERE photo_id = ?";
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     $params = array($this->_request->getParameter("album_id"));
     $sql = "UPDATE {photoalbum_album} " . "SET album_vote_count = album_vote_count + 1 " . "WHERE album_id = ?";
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     return true;
 }
Exemplo n.º 14
0
 /**
  * 回答データを登録する
  *
  * @param	array	$params	登録する回答データ配列
  * @return boolean	true or false
  * @access	public
  */
 function insertAnswer($params = array())
 {
     if (!$this->_db->insertExecute("questionnaire_answer", $params, true, "answer_id")) {
         return false;
     }
     return true;
 }
Exemplo n.º 15
0
 /**
  * プライベートスペースのデフォルトモジュール配置処理
  * (TODOと新着を配置)
  * TODO:現状、汎用的には作成していない。
  *
  * @param   int      $page_id       ページID
  * @param   string   $user_id       会員ID
  * @param   string   $handle        ハンドル
  * 
  * @return boolean true or false
  * @access	public
  */
 function defaultPrivateRoomInsert($page_id, $user_id, $handle)
 {
     $modulesView =& $this->_container->getComponent("modulesView");
     $session =& $this->_container->getComponent("Session");
     $col_num = 1;
     $row_num = 1;
     $module = $modulesView->getModuleByDirname("todo");
     $time = timezone_date();
     $site_id = $session->getParameter("_site_id");
     if (isset($module['module_id'])) {
         $block_obj = $this->_getBlockByDefaultPrivateRoom($page_id, $col_num, $row_num, $module);
         $block_id = $this->insBlock($block_obj);
         if (!$block_id) {
             return false;
         }
         $row_num++;
         $todo = array("room_id" => $page_id, "todo_name" => "TODO", "task_authority" => _AUTH_CHIEF, "insert_time" => $time, "insert_site_id" => $site_id, "insert_user_id" => $user_id, "insert_user_name" => $handle, "update_time" => $time, "update_site_id" => $site_id, "update_user_id" => $user_id, "update_user_name" => $handle);
         $todo_id = $this->_db->insertExecute("todo", $todo, false, "todo_id");
         if ($todo_id === false) {
             return false;
         }
         $todo_block = array("block_id" => $block_id, "todo_id" => $todo_id, "default_sort" => 0, "room_id" => $page_id, "insert_time" => $time, "insert_site_id" => $site_id, "insert_user_id" => $user_id, "insert_user_name" => $handle, "update_time" => $time, "update_site_id" => $site_id, "update_user_id" => $user_id, "update_user_name" => $handle);
         $result = $this->_db->insertExecute("todo_block", $todo_block, true);
         if ($result === false) {
             return false;
         }
     }
     $module = $modulesView->getModuleByDirname("whatsnew");
     if (isset($module['module_id'])) {
         $block_obj = $this->_getBlockByDefaultPrivateRoom($page_id, $col_num, $row_num, $module);
         $block_id = $this->insBlock($block_obj);
         if (!$block_id) {
             return false;
         }
         $row_num++;
         // 掲示板、日誌、カレンダーをチェック
         $display_modules_arr = array();
         $sub_module = $modulesView->getModuleByDirname("bbs");
         if (isset($sub_module['module_id'])) {
             $display_modules_arr[] = $sub_module['module_id'];
         }
         $sub_module = $modulesView->getModuleByDirname("journal");
         if (isset($sub_module['module_id'])) {
             $display_modules_arr[] = $sub_module['module_id'];
         }
         $sub_module = $modulesView->getModuleByDirname("calendar");
         if (isset($sub_module['module_id'])) {
             $display_modules_arr[] = $sub_module['module_id'];
         }
         $display_modules = implode(",", $display_modules_arr);
         $whatsnew_block = array("block_id" => $block_id, "display_type" => 2, "display_days" => 5, "display_modules" => $display_modules, "display_title" => _ON, "display_room_name" => _OFF, "display_module_name" => _OFF, "display_user_name" => _OFF, "display_insert_time" => _ON, "display_description" => _OFF, "allow_rss_feed" => _OFF, "select_room" => _OFF, "rss_title" => "WHATSNEW_RSS_TITLE", "rss_description" => "WHATSNEW_RSS_DESCRIPTION", "room_id" => $page_id, "insert_time" => $time, "insert_site_id" => $site_id, "insert_user_id" => $user_id, "insert_user_name" => $handle, "update_time" => $time, "update_site_id" => $site_id, "update_user_id" => $user_id, "update_user_name" => $handle);
         $result = $this->_db->insertExecute("whatsnew_block", $whatsnew_block, false);
         if ($result === false) {
             return false;
         }
     }
     $row_num++;
     return true;
 }
Exemplo n.º 16
0
 /**
  * ページスタイルテーブルInsert
  * @param array()
  * @return boolean
  * @access	public
  */
 function insPageStyle($params = array())
 {
     $result = $this->_db->insertExecute("pages_style", $params);
     if ($result === false) {
         return false;
     }
     return true;
 }
Exemplo n.º 17
0
 function insMenuDetailByPageId($page_id, $visibility_flag = _ON)
 {
     $params = array("block_id" => 0, "page_id" => $page_id, "visibility_flag" => $visibility_flag);
     $result = $this->_db->insertExecute("mobile_menu_detail", $params, true);
     if ($result === false) {
         return false;
     }
     return true;
 }
Exemplo n.º 18
0
 function addTag($ids = array(), $parameter = '', $options = array())
 {
     $pmView =& $this->_container->getComponent("pmView");
     if (is_array($ids)) {
         foreach ($ids as $id) {
             $tag_id = intval($parameter);
             $receiver_id = intval($id);
             if ($tag_id > 0) {
                 $params = array("tag_id" => $tag_id, "receiver_id" => $receiver_id);
                 $count = $this->_db->countExecute("pm_message_tag_link", $params);
                 if ($count == 0) {
                     $params["message_id"] = $pmView->getMessageID($receiver_id);
                     if (!$this->_db->insertExecute("pm_message_tag_link", $params)) {
                         return false;
                     }
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 19
0
 /**
  * 入力項目データを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setData()
 {
     $registrationID = $this->_request->getParameter("registration_id");
     $params = array("registration_id" => $registrationID);
     $dataID = $this->_db->insertExecute("registration_data", $params, true, "data_id");
     if (empty($dataID)) {
         return false;
     }
     $this->_request->setParameter('dataID', $dataID);
     $container =& DIContainerFactory::getContainer();
     $commonMain =& $container->getComponent("commonMain");
     $uploadsAction =& $commonMain->registerClass(WEBAPP_DIR . '/components/uploads/Action.class.php', "Uploads_Action", "uploadsAction");
     $session =& $container->getComponent("Session");
     $entryDatas =& $session->getParameter("registration_entry_datas" . $this->_request->getParameter("block_id"));
     foreach ($entryDatas as $entryData) {
         $itemID = $entryData["item_id"];
         if ($entryData["item_type"] == REGISTRATION_TYPE_FILE) {
             if (!empty($entryData["item_data_value"]["upload_id"])) {
                 $uploadID = $entryData["item_data_value"]["upload_id"];
                 $itemDataValue = "?" . ACTION_KEY . "=" . $entryData["item_data_value"]["action_name"] . "&upload_id=" . $uploadID;
                 if (!$uploadsAction->updGarbageFlag($uploadID)) {
                     return false;
                 }
             } else {
                 $itemDataValue = "";
             }
         } elseif ($entryData["item_type"] == REGISTRATION_TYPE_CHECKBOX && is_array($entryData["item_data_value"])) {
             $itemDataValue = implode(REGISTRATION_OPTION_SEPARATOR, $entryData["item_data_value"]);
         } elseif ($entryData["item_type"] == REGISTRATION_TYPE_EMAIL) {
             $itemDataValue = $entryData["item_data_value"]["first"];
         } else {
             $itemDataValue = $entryData["item_data_value"];
         }
         $params = array("registration_id" => $registrationID, "item_id" => $entryData["item_id"], "data_id" => $dataID, "item_data_value" => $itemDataValue);
         $itemDataID = $this->_db->insertExecute("registration_item_data", $params, true, "item_data_id");
         if (empty($itemDataID)) {
             return false;
         }
         if ($entryData["item_type"] != REGISTRATION_TYPE_FILE || empty($entryData["item_data_value"]["upload_id"])) {
             continue;
         }
         $params = array("item_data_id" => $itemDataID, "upload_id" => $entryData["item_data_value"]["upload_id"], "file_name" => $entryData["item_data_value"]["file_name"], "room_id" => $this->_request->getParameter("room_id"));
         if (!$this->_db->insertExecute("registration_file", $params)) {
             return false;
         }
     }
     $registration = $this->_request->getParameter("registration");
     if ($registration["mail_send"] == _ON) {
         $session->setParameter("registration_mail_data_id", $dataID);
     }
     return true;
 }
Exemplo n.º 20
0
 /**
  * インストール時、site_id作成処理
  * @access	public
  */
 function insertSite($url = "BASE_URL", $self_flag = _ON)
 {
     $sessionID = $this->_session->getID();
     // $new_site_id = crc32($sessionID).crc32(microtime());
     while (1) {
         $new_site_id = sha1(uniqid($sessionID . microtime(), true));
         // Hash値で同じものがないか念のためチェック
         $result = $this->_db->selectExecute("sites", array("site_id" => $new_site_id));
         if ($result === false) {
             return false;
         }
         if (!isset($result[0]['site_id'])) {
             break;
         }
     }
     $params = array("site_id" => $new_site_id, "url" => $url, "self_flag" => $self_flag, "commons_flag" => _ON, "certify_flag" => _ON);
     $result = $this->_db->insertExecute("sites", $params, true);
     if ($result === false) {
         return false;
     }
     return $new_site_id;
 }
Exemplo n.º 21
0
 /**
  * 新着情報の新規
  *
  * @access	public
  */
 function insert(&$whatsnew, $noblock = 0)
 {
     $module_whatsnew =& $this->_modulesView->getModuleByDirname("whatsnew");
     if (!$module_whatsnew) {
         return true;
     }
     $site_id = $this->_session->getParameter("_site_id");
     $user_id = $this->_session->getParameter("_user_id");
     $user_name = $this->_session->getParameter("_handle");
     if (!isset($whatsnew["insert_user_id"])) {
         $whatsnew["insert_user_id"] = $user_id;
     }
     if (!isset($whatsnew["insert_user_name"])) {
         $whatsnew["insert_user_name"] = $user_name;
     }
     $whatsnew["update_user_id"] = $whatsnew["insert_user_id"];
     $whatsnew["update_user_name"] = $whatsnew["insert_user_name"];
     $result = $this->_default($whatsnew, $noblock);
     if (!isset($whatsnew["child_update_time"])) {
         $whatsnew["child_update_time"] = $whatsnew["update_time"];
     }
     $whatsnew["insert_time"] = $whatsnew["update_time"];
     if ($result === false) {
         return false;
     }
     $params = array("room_id" => 0, "module_id" => $whatsnew["module_id"], "user_id" => $whatsnew["user_id"], "authority_id" => $whatsnew["authority_id"], "unique_id" => $whatsnew["unique_id"], "title" => $whatsnew["title"], "description" => $whatsnew["description"], "action_name" => $whatsnew["action_name"], "parameters" => $whatsnew["parameters"], "count_num" => $whatsnew["count_num"], "child_update_time" => $whatsnew["child_update_time"], "insert_time" => $whatsnew["insert_time"], "insert_site_id" => $site_id, "insert_user_id" => $whatsnew["insert_user_id"], "insert_user_name" => $whatsnew["insert_user_name"], "update_time" => $whatsnew["update_time"], "update_site_id" => $site_id, "update_user_id" => $whatsnew["update_user_id"], "update_user_name" => $whatsnew["update_user_name"]);
     if (isset($whatsnew["room_id"]) && is_array($whatsnew["room_id"])) {
         foreach ($whatsnew["room_id"] as $i => $room_id) {
             $params["room_id"] = $room_id;
             $result = $this->_db->insertExecute("whatsnew", $params, false, "whatsnew_id");
             if ($result === false) {
                 return false;
             }
         }
     } else {
         if (!isset($whatsnew["room_id"])) {
             $whatsnew["room_id"] = $this->_request->getParameter("room_id");
         }
         $params["room_id"] = $whatsnew["room_id"];
         $result = $this->_db->insertExecute("whatsnew", $params, false, "whatsnew_id");
         if ($result === false) {
             return false;
         }
     }
     return $this->_deletePeriod($whatsnew["module_id"], $whatsnew["room_id"]);
 }
Exemplo n.º 22
0
 /**
  * 登録処理
  *
  * @access	private
  */
 function _insert($params, &$r_params, $start_time, $end_time)
 {
     if (empty($this->details_param)) {
         $result = $this->_db->selectExecute("calendar_plan_details", array("plan_id" => $params["plan_id"]));
         if ($result === false) {
             return $result;
         }
         $this->details_param = $result[0];
     }
     $insert_start_time = timezone_date($start_time, true, "YmdHis");
     $insert_end_time = timezone_date($end_time, true, "YmdHis");
     $r_params = array("plan_id" => $params["plan_id"], "room_id" => $params["room_id"], "user_id" => $params["user_id"], "user_name" => $params["user_name"], "title" => $params["title"], "title_icon" => $params["title_icon"], "allday_flag" => $params["allday_flag"], "start_date" => substr($insert_start_time, 0, 8), "start_time" => substr($insert_start_time, 8), "start_time_full" => $insert_start_time, "end_date" => substr($insert_end_time, 0, 8), "end_time" => substr($insert_end_time, 8), "end_time_full" => $insert_end_time, "timezone_offset" => $params["timezone_offset"], "link_module" => $params["link_module"], "link_id" => $params["link_id"], "link_action_name" => $params["link_action_name"]);
     if (isset($params["insert_time"])) {
         $r_params["insert_time"] = $params["insert_time"];
     }
     if (isset($params["insert_site_id"])) {
         $r_params["insert_site_id"] = $params["insert_site_id"];
     }
     if (isset($params["insert_user_id"])) {
         $r_params["insert_user_id"] = $params["insert_user_id"];
     }
     if (isset($params["insert_user_name"])) {
         $r_params["insert_user_name"] = $params["insert_user_name"];
     }
     if (isset($params["update_time"])) {
         $r_params["update_time"] = $params["update_time"];
     }
     if (isset($params["update_site_id"])) {
         $r_params["update_site_id"] = $params["update_site_id"];
     }
     if (isset($params["update_user_id"])) {
         $r_params["update_user_id"] = $params["update_user_id"];
     }
     if (isset($params["update_user_name"])) {
         $r_params["update_user_name"] = $params["update_user_name"];
     }
     $calendar_id = $this->_db->insertExecute("calendar_plan", $r_params, false, "calendar_id");
     if ($r_params["link_module"] != "") {
         $r_params["calendar_id"] = $calendar_id;
         $result = $this->updateLink($r_params);
         if ($result === false) {
             return false;
         }
     }
     return $calendar_id;
 }
Exemplo n.º 23
0
 /**
  * ルーム指定
  *
  * @access	public
  */
 function setSelectRoom()
 {
     $block_id = $this->_request->getParameter("block_id");
     $select_room = intval($this->_request->getParameter("select_room"));
     if ($select_room == _ON) {
         $not_enroll_room = $this->_session->getParameter(array("whatsnew", "not_enroll_room", $block_id));
         $enroll_room = $this->_session->getParameter(array("whatsnew", "enroll_room", $block_id));
         if (!isset($not_enroll_room) && !isset($enroll_room)) {
             $enroll_room = array($this->_session->getParameter("_main_room_id"));
         }
         $whatsnewView =& $this->_container->getComponent("whatsnewView");
         $whatsnew_obj = $whatsnewView->getBlock($block_id);
         if (!$whatsnew_obj) {
             return false;
         }
         if (!empty($whatsnew_obj["select_room_list"]) && !empty($not_enroll_room)) {
             foreach ($not_enroll_room as $i => $room_id) {
                 if (in_array($room_id, $whatsnew_obj["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->deleteExecute("whatsnew_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
         if (!empty($enroll_room)) {
             foreach ($enroll_room as $i => $room_id) {
                 if (empty($whatsnew_obj["select_room_list"]) || !in_array($room_id, $whatsnew_obj["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->insertExecute("whatsnew_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
     } else {
         $params = array("block_id" => $block_id);
         $result = $this->_db->deleteExecute("whatsnew_select_room", $params);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 24
0
 /**
  * ルーム指定
  *
  * @access	public
  */
 function setSelectRoom()
 {
     $block_id = $this->_request->getParameter("block_id");
     $select_room = intval($this->_request->getParameter("select_room"));
     if ($select_room == _ON) {
         $not_enroll_room = $this->_session->getParameter(array("calendar", "not_enroll_room", $block_id));
         $enroll_room = $this->_session->getParameter(array("calendar", "enroll_room", $block_id));
         if (!isset($not_enroll_room) && !isset($enroll_room)) {
             $enroll_room = array($this->_session->getParameter("_main_room_id"));
         }
         $calendar_block = $this->_calendarView->getBlock();
         if (!$calendar_block) {
             return false;
         }
         if (!empty($calendar_block["select_room_list"]) && !empty($not_enroll_room)) {
             foreach ($not_enroll_room as $i => $room_id) {
                 if (in_array($room_id, $calendar_block["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->deleteExecute("calendar_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
         if (!empty($enroll_room)) {
             foreach ($enroll_room as $i => $room_id) {
                 if (empty($calendar_block["select_room_list"]) || !in_array($room_id, $calendar_block["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->insertExecute("calendar_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
     } else {
         $params = array("block_id" => $block_id);
         $result = $this->_db->deleteExecute("calendar_select_room", $params);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 25
0
 /**
  * 予定の変更
  *
  * @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;
 }
Exemplo n.º 26
0
 /**
  * Uploads Insert
  * @param array(page_id, module_id, file_name, file_path, action_name, file_size, mimetype, extension, garbage_flag)
  * @return int upload_id
  * @access	public
  */
 function insUploads($params)
 {
     $upload_id = $this->_db->nextSeq("uploads");
     $params['upload_id'] = $upload_id;
     if ($params['physical_file_name'] == "") {
         $params['physical_file_name'] = $params['upload_id'] . "." . $params['extension'];
     }
     if (!isset($params['sess_id']) || $params['sess_id'] == "") {
         $session =& $this->_container->getComponent("Session");
         $params['sess_id'] = $session->getID();
     }
     $footer_flag = false;
     if (!isset($params['insert_time'])) {
         $footer_flag = true;
     }
     $result = $this->_db->insertExecute("uploads", $params, $footer_flag);
     if ($result === false) {
         return false;
     }
     return $upload_id;
 }
Exemplo n.º 27
0
 /**
  * リンクデータを登録する
  *
  * @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;
 }
Exemplo n.º 28
0
 /**
  * abbreviate_urlへ登録処理
  *
  * @param string $dir_name
  * @param string $contents_id
  * @param string $unique_id
  * @param string $url
  * @param string $room_id
  *
  * @return boolean
  * @access  public
  */
 function setAbbreviateUrl($contents_id, $unique_id, $dir_name = null, $module_id = null, $room_id = null)
 {
     //dir_nameが省略されている場合、実行アクションから取得
     if (!isset($dir_name)) {
         $dir_name = $this->_abbreviateurlView->getDefaultUniqueKey();
     }
     //module_idが省略されている場合、module_nameから取得
     $dirnameArray = explode("_", $dir_name);
     $module_name = $dirnameArray[0];
     if (empty($module_id)) {
         $module_id = $this->_abbreviateurlView->getDefaultModuleId($module_name);
     }
     //URL短縮形の重複チェック
     $params = array('dir_name' => $dir_name, 'unique_id' => $unique_id);
     $abbreviate = $this->_db->selectExecute('abbreviate_url', $params, null, 1);
     if ($abbreviate === false) {
         return $abbreviate;
     }
     if (empty($abbreviate)) {
         //登録する短縮URLの重複チェック
         $prefix = count($dirnameArray) > 1 ? substr($dirnameArray[0], 0, 1) . substr($dirnameArray[1], 0, 1) : substr($dirnameArray[0], 0, 2);
         for ($length = _ABBREVIATE_URL_LENGTH; $length < 17; $length++) {
             for ($j = 0; $j < 50; $j++) {
                 $short_url = $this->_abbreviateurlView->randString($length, $prefix);
                 $params = array("short_url" => $short_url);
                 $countUrl = $this->_db->countExecute('abbreviate_url', $params);
                 if ($countUrl === false) {
                     return $countUrl;
                 }
                 if ($countUrl > 0) {
                     continue;
                 }
                 $params = array("permalink" => $short_url);
                 $countPage = $this->_db->countExecute('pages', $params);
                 if ($countPage === false) {
                     return $countPage;
                 }
                 if ($countPage > 0) {
                     continue;
                 }
                 break;
             }
             if ($countUrl == 0 && $countPage == 0) {
                 break;
             }
         }
         if ($countUrl > 0 || $countPage > 0) {
             $result = false;
             return $result;
         }
         //URL短縮形の登録
         $setParams = array('short_url' => $short_url, 'dir_name' => $dir_name, 'module_id' => $module_id, 'contents_id' => $contents_id, 'unique_id' => $unique_id);
         if (isset($room_id)) {
             $setParams['room_id'] = $room_id;
         }
         $result = $this->_db->insertExecute('abbreviate_url', $setParams, true);
         if ($result === false) {
             return $result;
         }
     }
     $result = true;
     return $result;
 }
Exemplo n.º 29
0
 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;
 }
Exemplo n.º 30
0
 /**
  * フイルタデータを登録する
  *
  * @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;
 }