예제 #1
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;
 }
예제 #2
0
 /**
  * 登録フォームデータを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setRegistration()
 {
     $params = array('registration_name' => $this->_request->getParameter('registration_name'), 'image_authentication' => intval($this->_request->getParameter('image_authentication')), 'limit_number' => intval($this->_request->getParameter('limit_number')), 'period' => $this->_request->getParameter('period'), 'accept_message' => $this->_request->getParameter('accept_message'), 'mail_send' => intval($this->_request->getParameter('mail_send')), 'regist_user_send' => intval($this->_request->getParameter('regist_user_send')), 'chief_send' => intval($this->_request->getParameter('chief_send')), 'rcpt_to' => $this->_request->getParameter('rcpt_to'), 'mail_subject' => $this->_request->getParameter('mail_subject'), 'mail_body' => $this->_request->getParameter('mail_body'), 'image_authentication' => intval($this->_request->getParameter('image_authentication')));
     $registration = $this->_request->getParameter("registration");
     $registrationID = $this->_request->getParameter("registration_id");
     if (empty($registrationID)) {
         $params["room_id"] = intval($this->_request->getParameter("room_id"));
         $result = $this->_db->insertExecute("registration", $params, true, "registration_id");
     } else {
         $params["registration_id"] = $registrationID;
         $result = $this->_db->updateExecute("registration", $params, "registration_id", true);
     }
     if (!$result) {
         return false;
     }
     if (!empty($registrationID)) {
         return true;
     }
     $registrationID = $result;
     $this->_request->getParameter('registration_name');
     $old_use = $this->_request->getParameter('old_use');
     if ($old_use == _ON) {
         $defaultItems =& $this->_db->selectExecute("registration_item", array("registration_id" => intval($this->_request->getParameter('old_registration_id'))));
         if ($defaultItems === false) {
             $this->_db->addError();
             return 'error';
         }
     } else {
         $container =& DIContainerFactory::getContainer();
         $filterChain =& $container->getComponent("FilterChain");
         $smartyAssign =& $filterChain->getFilterByName("SmartyAssign");
         $defaultItem = $smartyAssign->getLang("registration_default_item");
         $defaultItems = explode("/", $defaultItem);
     }
     $sequence = 0;
     foreach ($defaultItems as $defaultItem) {
         if ($old_use == _ON) {
             $params = array("registration_id" => $registrationID, "item_name" => $defaultItem["item_name"], "item_sequence" => $defaultItem["item_sequence"], "item_type" => $defaultItem["item_type"], "option_value" => $defaultItem["option_value"], "require_flag" => $defaultItem["require_flag"], "list_flag" => $defaultItem["list_flag"], "sort_flag" => $defaultItem["sort_flag"], "description" => $defaultItem["description"]);
         } else {
             $sequence++;
             $items = explode(",", $defaultItem);
             $params = array("registration_id" => $registrationID, "item_name" => $items[0], "item_sequence" => $sequence, "item_type" => constant($items[1]), "option_value" => $items[2], "require_flag" => constant($items[3]), "list_flag" => constant($items[4]), "sort_flag" => constant($items[5]));
         }
         if (!$this->_db->insertExecute("registration_item", $params, true, "item_id")) {
             return false;
         }
     }
     $this->_request->setParameter("registration_id", $registrationID);
     //if (!$this->setBlock()) {
     //return false;
     //}
     return true;
 }
예제 #3
0
 /**
  * modulesテーブルの一覧を取得する
  * @param array where_params
  * @param array order_params
  * @return array modules
  * @access	public
  */
 function &getModules($where_params = null, $order_params = array("{modules}.module_id" => "ASC"), $limit = null, $offset = null, $func = array("Modules_View", "_fetchcallbackModules"), $func_param = null)
 {
     if (!isset($order_params)) {
         $order_params = array("{modules}.module_id" => "ASC");
     }
     if (!isset($func_param)) {
         $func_param = $this;
     }
     $result = $this->_db->selectExecute("modules", $where_params, $order_params, $limit, $offset, $func, $func_param);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     return $result;
 }
예제 #4
0
 /**
  * 新着情報にセットする(コメント)
  *
  * @return bool
  * @access	public
  */
 function setCommentWhatsnew($comment_id)
 {
     $params = array("post_id" => $comment_id);
     $comment = $this->_db->selectExecute("journal_post", $params);
     if (empty($comment)) {
         return false;
     }
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     $count = $this->_db->countExecute("journal_post", array("parent_id" => $comment[0]['parent_id'], "direction_flag != " . JOURNAL_TRACKBACK_TRANSMIT => null));
     if ($count === false) {
         return false;
     }
     if ($comment[0]["agree_flag"] == JOURNAL_STATUS_AGREE_VALUE) {
         $journal_post = $this->_db->selectExecute("journal_post", array("post_id" => $comment[0]['parent_id']));
         if ($journal_post === false && !isset($journal_post[0])) {
             return false;
         }
         $time = timezone_date();
         if (intval($time) < intval($journal_post[0]['journal_date'])) {
             // 未来ならば、日誌の記事の時間をセット
             $time = $journal_post[0]['journal_date'];
         }
         $whatsnew = array("unique_id" => $comment[0]['parent_id'], "title" => $journal_post[0]['title'], "description" => $journal_post[0]['content'], "action_name" => "journal_view_main_detail", "parameters" => "post_id=" . $comment[0]['parent_id'] . "&comment_flag=1", "count_num" => $count, "child_flag" => _ON, "child_update_time" => $time, "insert_time" => $journal_post[0]['journal_date'], "insert_user_id" => $journal_post[0]['insert_user_id'], "insert_user_name" => $journal_post[0]['insert_user_name']);
         $result = $whatsnewAction->auto($whatsnew);
         if ($result === false) {
             return false;
         }
     } else {
         if ($count == 0) {
             $result = $whatsnewAction->delete($comment[0]['parent_id'], _ON);
         }
     }
     return true;
 }
예제 #5
0
 /**
  * abbreviate_urlから取得
  *
  * @param string $dir_name
  * @param string $unique_id
  *
  * @return boolean
  * @access  public
  */
 function getAbbreviateUrl($unique_id, $dir_name = null)
 {
     //dir_nameが省略されている場合、実行アクションから取得
     if (!isset($dir_name)) {
         $dir_name = $this->getDefaultUniqueKey();
     }
     $params = array('dir_name' => $dir_name, 'unique_id' => $unique_id);
     $result = $this->_db->selectExecute('abbreviate_url', $params);
     if ($result === false) {
         return $result;
     }
     if (isset($result[0])) {
         return $result[0]["short_url"];
     }
     return "";
 }
예제 #6
0
 /**
  * 新着情報にセットする
  *
  * @return bool
  * @access	public
  */
 function setWhatsnew($content_id)
 {
     $params = array("content_id" => $content_id);
     $content = $this->_db->selectExecute("multidatabase_content", $params);
     if (empty($content)) {
         return false;
     }
     $multidatabase = $this->_db->selectExecute("multidatabase", array("multidatabase_id" => $content[0]['multidatabase_id']));
     if (empty($multidatabase)) {
         return false;
     }
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     if ($content[0]["temporary_flag"] == MULTIDATABASE_STATUS_RELEASED_VALUE && $content[0]["agree_flag"] == MULTIDATABASE_STATUS_AGREE_VALUE) {
         $result = $this->getWhatsnewTitle($content_id, $multidatabase[0]['title_metadata_id']);
         if ($result === false) {
             return false;
         }
         $whatsnew = array("unique_id" => $content_id, "title" => $result["title"], "description" => $result["description"], "action_name" => "multidatabase_view_main_detail", "parameters" => "content_id=" . $content_id . "&multidatabase_id=" . $content[0]["multidatabase_id"], "insert_time" => $content[0]["insert_time"], "insert_user_id" => $content[0]["insert_user_id"], "insert_user_name" => $content[0]["insert_user_name"]);
         $result = $whatsnewAction->auto($whatsnew);
         if ($result === false) {
             return false;
         }
     } else {
         $result = $whatsnewAction->delete($content_id);
         if ($result === false) {
             return false;
         }
     }
     return true;
 }
예제 #7
0
 /**
  * conf_nameよりConfig情報取得
  *
  * @param   int      $conf_modid  モジュールID
  * @param   string   $conf_name   conf名
  * @return array
  * @access	public
  */
 function &getConfigByConfname($conf_modid, $conf_name)
 {
     if (!$this->isMultiLanguage) {
         $where_params = array("conf_modid" => $conf_modid, "conf_name" => $conf_name);
         $configs =& $this->_db->selectExecute("config", $where_params);
         if ($configs === false) {
             return $configs;
         }
     } else {
         $params = array($this->_session->getParameter('_lang'), $conf_modid, $conf_name);
         $sql = $this->_getConfigSQL() . "AND C.conf_name = ?";
         $configs = $this->_db->execute($sql, $params);
         if ($configs === false) {
             $this->_db->addError();
             return $configs;
         }
     }
     if (empty($configs)) {
         $configs = null;
         return $configs;
     }
     $config = $configs[0];
     if (isset($config['CLValue'])) {
         $config['conf_value'] = $config['CLValue'];
     }
     return $config;
 }
예제 #8
0
 /**
  * 固定リンクで既に同じものが存在していればリネーム
  * @param string $permalink
  * @param int $page_id : 現在のpage_id 現在見ているページ以外で
  * 						 同じ名称の固定リンクがあるかどうかを検索
  * @param string $lang_dirname
  * @access  private
  */
 function getRenamePermaLink($permalink, $page_id = 0, $lang_dirname = null)
 {
     $count = 1;
     $old_permalink = $permalink;
     $permalink_arr = explode('/', $permalink);
     if (is_array($permalink_arr) && preg_match(_PERMALINK_PROHIBITION_DIR_PATTERN, $permalink_arr[count($permalink_arr) - 1])) {
         $permalink = $permalink . "-" . $count;
         $count++;
     }
     while (1) {
         $where_param = array("page_id!" => $page_id, "permalink" => $permalink);
         if (!empty($lang_dirname)) {
             $where_param["lang_dirname"] = $lang_dirname;
         }
         $same_pages = $this->_db->selectExecute("pages", $where_param, null, 1);
         if (isset($same_pages[0])) {
             $permalink = $old_permalink . "-" . $count;
         } else {
             $permalink_arr = explode("-", $permalink);
             if (empty($permalink_arr[1]) || !empty($permalink_arr[2]) || !is_numeric($permalink_arr[1])) {
                 break;
             }
             $where_param = array("short_url" => $permalink_arr[0]);
             $same_pages = $this->_db->selectExecute("abbreviate_url", $where_param, null, 1);
             if (isset($same_pages[0])) {
                 $permalink = $permalink . "-" . $count;
             } else {
                 break;
             }
         }
         $count++;
     }
     return $permalink;
 }
예제 #9
0
 /**
  * ページモジュールリンクSelect
  * @param array where_params
  * @param array order_params
  * @param function func
  * @param array    func_param
  * @return boolean
  * @access	public
  */
 function &getPageModulesLink($where_params = array(), $order_params = array(), $func = null, $func_param = null)
 {
     $result = $this->_db->selectExecute("pages_modules_link", $where_params, $order_params, null, null, $func, $func_param);
     if ($result === false) {
         return $result;
     }
     return $result;
 }
예제 #10
0
 /**
  * tag_nameからitem_id を取得する
  * @param string tag_name
  * @return item_id
  * @access	public
  */
 function &getItemIdByTagName($tag_name)
 {
     $ret = $this->_db->selectExecute("items", array("tag_name" => $tag_name));
     if (!$ret) {
         return false;
     }
     return $ret[0]['item_id'];
 }
예제 #11
0
 /**
  * sitesの一覧を取得する
  * 
  * @param   array   $where_params  Whereパラメータ引数
  * @param   array   $order_params  Orderパラメータ引数
  * @param   int     $limit
  * @param   int     $start
  * @return array サイトリスト
  * @access	public
  */
 function &getSites($where_params = null, $order_params = array("{sites}.self_flag" => "DESC", "{sites}.url" => "ASC"), $limit = null, $offset = null)
 {
     $result = $this->_db->selectExecute("sites", $where_params, $order_params, $limit, $offset, array($this, "_getSites"));
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     return $result;
 }
예제 #12
0
 /**
  * ブロックのデータを取得
  *
  * @access	public
  */
 function &getBlock($block_id, $show_mode = null, $default_target_module = null, $detail_flag = null)
 {
     $block_id = intval($block_id);
     $result =& $this->_db->selectExecute("search_blocks", array("block_id" => $block_id));
     if (empty($result)) {
         return $result;
     }
     $search_blocks_obj = $result[0];
     if (isset($show_mode)) {
         $search_blocks_obj["show_mode"] = $show_mode;
     }
     if (isset($default_target_module)) {
         $search_blocks_obj["default_target_module"] = $default_target_module;
     }
     $search_blocks_obj["default_target_module_arr"] = explode(",", $search_blocks_obj["default_target_module"]);
     if (isset($detail_flag)) {
         $search_blocks_obj["detail_flag"] = $detail_flag;
     }
     return $search_blocks_obj;
 }
예제 #13
0
 /**
  * 端末IDの取得
  *
  * @access	public
  */
 function getAutoLogin()
 {
     $mobile_info = $this->_session->getParameter("_mobile_info");
     if ($mobile_info["autologin"] != _AUTOLOGIN_OK) {
         return false;
     }
     $result = $this->_db->selectExecute("mobile_users", array("tel_id" => $mobile_info["tel_id"]));
     if (empty($result)) {
         return false;
     }
     return $result[0];
 }
예제 #14
0
 /**
  * 表示言語データを取得する
  *
  * @return array	言語データ配列
  * @access	public
  */
 function &getDisplayLanguage($select_flag = false)
 {
     $request =& $this->_container->getComponent('Request');
     $session =& $this->_container->getComponent("Session");
     $block_id = $request->getParameter('block_id');
     $lang_block = $this->_db->selectExecute('language_block', array('block_id' => $block_id));
     if (empty($lang_block)) {
         return false;
     }
     $name = $request->getParameter("_restful_permalink");
     $where_params = array('permalink' => $name);
     $pages = $this->_db->selectExecute('pages', $where_params, null, null, null, array($this, "_fetchcallbackPages"));
     $uri_arr = explode('?', $_SERVER['REQUEST_URI']);
     $uri = isset($uri_arr[1]) ? $uri_arr[1] : null;
     $_permalink_flag = $session->getParameter("_permalink_flag");
     if (!empty($_permalink_flag)) {
         $restful_permalink = $name;
         if (!empty($restful_permalink)) {
             $restful_permalink = $restful_permalink . '/';
         }
     } else {
         $restful_permalink = "";
     }
     $return_top = strpos($uri, 'action=language_view_main_init');
     if (!empty($uri) && $return_top === false) {
         $patterns = array('/&?lang=[^&]*/i', '/^&/');
         $replacements = array('', '');
         $uri = preg_replace($patterns, $replacements, $uri);
         if ($uri != "") {
             $uri = '?' . $uri . '&';
         } else {
             $uri = '?' . $uri;
         }
     } else {
         $uri = '?';
     }
     $fetch_params = array('select_flag' => $select_flag, 'display_language' => $lang_block[0]['display_language'], 'restful_permalink' => $restful_permalink, 'uri' => $uri, 'pages' => $pages);
     $langs = $this->_db->selectExecute('language', null, array('display_sequence' => 'ASC'), 0, 0, array($this, "_getDisplayLanguagesFetch"), $fetch_params);
     return $langs;
 }
예제 #15
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;
 }
예제 #16
0
 /**
  * 会員テーブルInsert
  * 
  * @param   array   $params     パラメータ引数
  * @return boolean true or false
  * @access	public
  */
 function insUser($params = array())
 {
     $sitesView =& $this->_container->getComponent("sitesView");
     $sites = $sitesView->getSelfSite();
     while (1) {
         $id = $this->_db->nextSeq("users");
         $user_id = sha1(uniqid($sites['site_id'] . $id, true));
         // Hash値で同じものがないか念のためチェック
         $result = $this->_db->selectExecute("users", array("user_id" => $user_id));
         if ($result === false) {
             return false;
         }
         if (!isset($result[0]['user_id'])) {
             break;
         }
     }
     $params = array_merge(array("user_id" => $user_id), $params);
     $result = $this->_db->insertExecute("users", $params, true);
     if ($result === false) {
         return false;
     }
     return $user_id;
 }
예제 #17
0
 /**
  * 写真データを削除する
  *
  * @return boolean	true or false
  * @access	public
  */
 function deletePhoto()
 {
     $params = array("photo_id" => $this->_request->getParameter("photo_id"));
     if (!$this->_db->deleteExecute("photoalbum_comment", $params)) {
         return false;
     }
     $sql = "SELECT photo_id, album_id, upload_id, photo_sequence " . "FROM {photoalbum_photo} " . "WHERE photo_id = ?";
     $photos = $this->_db->execute($sql, $params);
     if ($photos === false) {
         $this->_db->addError();
         return false;
     }
     if (!$this->deletePhotoFile($photos)) {
         return false;
     }
     if (!$this->_db->deleteExecute("photoalbum_photo", $params)) {
         return false;
     }
     $params = array("album_id" => $photos[0]["album_id"]);
     $sequenceParam = array("photo_sequence" => $photos[0]["photo_sequence"]);
     if (!$this->_db->seqExecute("photoalbum_photo", $params, $sequenceParam)) {
         return false;
     }
     $sql = "UPDATE {photoalbum_album} " . "SET photo_count = photo_count - 1 " . "WHERE album_id = ?";
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     //--新着情報関連 Start--
     // 新着にあれば、更新、なければそのまま
     $params = array("unique_id" => $this->_request->getParameter("album_id"), "module_id" => $this->_request->getParameter("module_id"));
     $whatsnew = $this->_db->selectExecute("whatsnew", $params, null, 1);
     if (isset($whatsnew[0])) {
         // データあり
         $container =& DIContainerFactory::getContainer();
         $whatsnewAction =& $container->getComponent("whatsnewAction");
         $whatsnew[0]['count_num'] = intval($whatsnew[0]['count_num']) - 1;
         if ($whatsnew[0]['count_num'] == 0) {
             $result = $whatsnewAction->delete($this->_request->getParameter("album_id"));
         } else {
             $result = $whatsnewAction->update($whatsnew[0]);
         }
         if ($result === false) {
             return false;
         }
     }
     //--新着情報関連 End--
     return true;
 }
예제 #18
0
 /**
  * テーブル名から、INSERTのDumpファイルを作成する
  * @param   string	 $table_name
  * @return  string	 Dump文字列
  * @access	public	
  */
 function getInsertRowSqlDump($table_name)
 {
     $sql_dump = "";
     $adodb = $this->_db->getAdoDbObject();
     // prefixを取り除く
     $prefix_table_name = $table_name;
     $table_name = preg_replace("/^" . preg_quote($this->_db->getPrefix(), "/") . "/", "", $table_name);
     $arrFields = $this->_db->selectExecute($table_name);
     if ($arrFields !== false && is_array($arrFields)) {
         foreach ($arrFields as $arrField) {
             $sql_dump .= $adodb->GetInsertSQL($prefix_table_name, $arrField, false, ADODB_FORCE_VALUE) . ";\n";
         }
     }
     return $sql_dump;
 }
예제 #19
0
 /**
  * デフォルト値取得
  *
  * @access	public
  */
 function getBlock($display_type = null)
 {
     $calendar_block = $this->_request->getParameter("calendar_block");
     if (!empty($calendar_block)) {
         return $calendar_block;
     }
     $default = $this->getDefaultBlock();
     $block_id = $this->_request->getParameter("block_id");
     $result =& $this->_db->selectExecute("calendar_block", array("block_id" => $block_id));
     if (empty($result)) {
         $result[0] = array();
     }
     $block = array_merge($default, $result[0]);
     switch ($block["display_type"]) {
         case CALENDAR_YEARLY:
             $block["start_pos_yearly"] = $block["start_pos"];
             break;
         case CALENDAR_WEEKLY:
         case CALENDAR_T_SCHEDULE:
         case CALENDAR_U_SCHEDULE:
             $block["start_pos_weekly"] = $block["start_pos"];
             break;
     }
     if (isset($display_type) && $display_type > 0) {
         $block["display_type"] = $display_type;
     }
     if ($block["select_room"] == _ON) {
         $sql = "SELECT room_id" . " FROM {calendar_select_room}" . " WHERE block_id = ?";
         $params = array("block_id" => $block_id);
         $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_callbackSelectRoom"));
         if ($result === false) {
             $this->_db->addError();
             return $result;
         }
         $block["select_room_list"] = $result;
     } else {
         $block["myroom_flag"] = _OFF;
     }
     $actionChain =& $this->_container->getComponent("ActionChain");
     $actionName = $actionChain->getCurActionName();
     if ($block["select_room"] == _OFF && strpos(strtolower($actionName), "calendar_view") !== false && empty($block["select_room_list"])) {
         $block["select_room_list"] = array($this->_session->getParameter("_main_room_id"));
     }
     if (!isset($block["block_id"])) {
         $block["block_id"] = _OFF;
     }
     return $block;
 }
예제 #20
0
 /**
  * 新着情報の新規
  *
  * @access	public
  */
 function auto(&$whatsnew, $noblock = 0)
 {
     $module_whatsnew =& $this->_modulesView->getModuleByDirname("whatsnew");
     if (!$module_whatsnew) {
         return true;
     }
     $result = $this->_db->selectExecute("whatsnew", array("module_id" => $this->_request->getParameter("module_id"), "unique_id" => $whatsnew["unique_id"]), null, 1);
     if ($result === false) {
         return false;
     }
     if (count($result) > 0) {
         $result = $this->update($whatsnew, $noblock);
     } else {
         $result = $this->insert($whatsnew, $noblock);
     }
 }
예제 #21
0
 /**
  * キャビネットデータを取得する
  *
  * @return array	キャビネットデータ配列
  * @access	public
  */
 function &getCabinet()
 {
     $params = array("room_id" => $this->_request->getParameter("room_id"), "cabinet_id" => $this->_request->getParameter("cabinet_id"));
     $result = $this->_db->selectExecute("cabinet_manage", $params);
     if ($result === false) {
         return $result;
     }
     $default = $this->getDefaultCabinet();
     $result[0] = array_merge($default, $result[0]);
     $default = $this->getDefaultBlock();
     $result[0] = array_merge($default, $result[0]);
     $result[0]["cabinet_max_size"] = 0;
     $result[0]["hasAddAuthority"] = $this->_hasAddAuthority($result[0]);
     $result[0]["compress_download"] = $this->getCompressDownload();
     return $result[0];
 }
예제 #22
0
 /**
  * 新着で表示するブロックIDを取得
  *
  * @access	public
  */
 function getBlockIdByWhatsnew()
 {
     $reserve_room_id = $this->_request->getParameter("reserve_room_id");
     if (!is_null($reserve_room_id) || $reserve_room_id != 0) {
         $params = array("room_id" => $reserve_room_id);
         $result = $this->_db->selectExecute("reservation_block", $params, null, 1);
         if (!empty($result)) {
             return $result[0]["block_id"];
         }
     }
     $params = array("room_id" => _SPACE_TYPE_PUBLIC);
     $result = $this->_db->selectExecute("reservation_block", $params, null, 1);
     if (!empty($result)) {
         return $result[0]["block_id"];
     }
     return $this->_request->getParameter("block_id");
 }
예제 #23
0
 /**
  * 投稿権限チェック
  *
  * @access	public
  */
 function hasPostAuth($journal_id)
 {
     $session =& $this->_container->getComponent("Session");
     $_user_id = $session->getParameter("_user_id");
     $_auth_id = $session->getParameter("_auth_id");
     if ($_auth_id >= _AUTH_CHIEF) {
         return true;
     }
     $result = $this->_db->selectExecute("journal", array("journal_id" => $journal_id));
     if ($result === false || !isset($result[0])) {
         return false;
     }
     if ($_auth_id >= $result[0]["post_authority"]) {
         return true;
     }
     return false;
 }
예제 #24
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;
 }
예제 #25
0
 /**
  * 予定と新着を一度全て削除。
  *
  * @access	public
  */
 function deletePlanAll($plan_room_id)
 {
     $params = array("room_id" => $plan_room_id);
     $allplan = $this->_db->selectExecute("calendar_plan", $params);
     $result = $this->_db->deleteExecute("calendar_plan", $params);
     if (!$result) {
         return false;
     }
     $result = $this->_db->deleteExecute("calendar_plan_details", $params);
     if (!$result) {
         return false;
     }
     foreach ($allplan as $plan) {
         $result = $this->setWhatsnew($plan);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
예제 #26
0
 /**
  * 施設を削除する
  *
  * @access  public
  */
 function deleteLocation()
 {
     $location_id = $this->_request->getParameter("location_id");
     $location = $this->_db->selectExecute("reservation_location", array("location_id" => $location_id));
     if ($location === false || !isset($location[0])) {
         return false;
     }
     //前詰め処理
     $params = array("category_id" => $location[0]["category_id"]);
     $sequence_param = array("display_sequence" => $location[0]["display_sequence"]);
     $result = $this->_db->seqExecute("reservation_location", $params, $sequence_param);
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("reservation_location", array("location_id" => $location_id));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("reservation_location_details", array("location_id" => $location_id));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("reservation_location_rooms", array("location_id" => $location_id));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("reservation_reserve", array("location_id" => $location_id));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("reservation_reserve_details", array("location_id" => $location_id));
     if ($result === false) {
         return false;
     }
     // 2013.02.12 bugfix 施設=0件か、表示設定方法に削除した施設を指定していた時は、表示方法変更「表示方法」を「日」にアップデート
     $result = $this->setBlock();
     if ($result === false) {
         return false;
     }
     return true;
 }
예제 #27
0
 /**
  * ファイル・フォルダの移動
  *
  * @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;
 }
예제 #28
0
 /**
  * upload_idの一覧取得
  * @param string
  * @return	array
  * @access	public
  **/
 function getUploadId($string, $download_action_name = "common_download_main&amp;upload_id=", $uploads_where_params = array())
 {
     $container =& DIContainerFactory::getContainer();
     $request =& $container->getComponent("Request");
     $upload_id_arr = array();
     $content = $string;
     $count = substr_count($content, $download_action_name);
     if (!$count) {
         return $upload_id_arr;
     }
     $parts = explode($download_action_name, $content);
     for ($i = 1; $i <= $count; $i++) {
         if (preg_match("/^([0-9]+)/", $parts[$i], $matches)) {
             if (isset($matches[1])) {
                 $id = $matches[1];
                 $upload_id_arr[$id] = $id;
             }
         }
     }
     $module_id = $request->getParameter("module_id");
     if (!isset($module_id)) {
         $actionChain =& $container->getComponent("ActionChain");
         $modulesView =& $container->getComponent("modulesView");
         $curAction = $actionChain->getCurActionName();
         $pathList = explode("_", $curAction);
         $module = $modulesView->getModuleByDirname($pathList[0]);
         if (isset($module['module_id'])) {
             $module_id = $module['module_id'];
         }
     }
     $where_params = array("upload_id IN ('" . implode("','", $upload_id_arr) . "') " => null, "room_id" => $request->getParameter("room_id"), "module_id" => $module_id);
     if (count($uploads_where_params) > 0) {
         $where_params = array_merge($where_params, $uploads_where_params);
     }
     $upload_id_arr = $this->_db->selectExecute("uploads", $where_params, null, null, null, array($this, "_fetchcallbackgetUploadId"));
     if ($upload_id_arr === false) {
         return array();
     }
     return $upload_id_arr;
 }
예제 #29
0
 /**
  * Todoデータを削除する
  *
  * @return boolean	true or false
  * @access	public
  */
 function deleteTodo()
 {
     $params = array("todo_id" => $this->_request->getParameter("todo_id"));
     if (!$this->_db->deleteExecute("todo_block", $params)) {
         return false;
     }
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     $tasks = $this->_db->selectExecute('todo_task', $params);
     if (!empty($tasks)) {
         foreach ($tasks as $task) {
             if (!$whatsnewAction->delete($task['task_id'])) {
                 return false;
             }
         }
         if (!$this->_db->deleteExecute("todo_task", $params)) {
             return false;
         }
     }
     if (!$this->_db->deleteExecute("todo", $params)) {
         return false;
     }
     return true;
 }
예제 #30
0
 /**
  * fetch時コールバックメソッド
  * @param result adodb object
  * @return array
  * @access	private
  */
 function &_getMDBDetailFetchcallback($result)
 {
     $session =& $this->_container->getComponent("Session");
     $request =& $this->_container->getComponent("Request");
     $metadatas = $request->getParameter("metadatas");
     $data = array();
     while ($row = $result->fetchRow()) {
         $layout = array();
         $items = array();
         foreach ($metadatas as $metadata) {
             if ($metadata['detail_flag'] == _ON) {
                 $layout[$metadata['display_pos']][$metadata['metadata_id']] = $metadata;
             }
             if ($metadata['type'] == MULTIDATABASE_META_TYPE_IMAGE || $metadata['type'] == MULTIDATABASE_META_TYPE_FILE) {
                 $items[$metadata['metadata_id']] = $this->getFileLink($row['content' . $metadata['metadata_id']], $row['file_name' . $metadata['metadata_id']], $row['physical_file_name' . $metadata['metadata_id']], $metadata, null, $row['insert_user_id'], $row['file_password' . $metadata['metadata_id']]);
                 unset($row['file_name' . $metadata['metadata_id']]);
                 unset($row['physical_file_name' . $metadata['metadata_id']]);
             } elseif ($metadata['type'] == MULTIDATABASE_META_TYPE_MULTIPLE) {
                 $itemArr = explode("|", $row['content' . $metadata['metadata_id']]);
                 $multiple = array();
                 foreach ($itemArr as $val) {
                     $multiple[] = $val;
                 }
                 $items[$metadata['metadata_id']] = $multiple;
             } else {
                 $items[$metadata['metadata_id']] = $row['content' . $metadata['metadata_id']];
             }
             unset($row['content' . $metadata['metadata_id']]);
         }
         $voted = false;
         $comment_count = 0;
         $comments = "";
         foreach ($row as $key => $val) {
             $items[$key] = $val;
         }
         $items['has_edit_auth'] = $this->_hasEditAuthority($items['insert_user_id']);
         $items['has_confirm_auth'] = $this->_hasConfirmAuthority();
         $comment_count = $this->_db->countExecute("multidatabase_comment", array("content_id" => $items['content_id']));
         $order_params = array("insert_time" => "ASC");
         $comments = $this->_db->selectExecute("multidatabase_comment", array("content_id" => $items['content_id']), $order_params);
         if ($comments === false) {
             return 'error';
         }
         foreach ($comments as $key => $val) {
             $edit_auth = $this->_hasEditAuthority($val['insert_user_id']);
             $comments[$key]['edit_auth'] = $edit_auth;
         }
         $items['comment_count'] = $comment_count;
         $items['comments'] = $comments;
         if ($items['vote'] != "") {
             $who_voted = explode(",", $items['vote']);
             $user_id = $session->getParameter("_user_id");
             if (empty($user_id)) {
                 $votes = $session->getParameter("multidatabase_votes");
                 if (!empty($votes)) {
                     if (in_array($items['content_id'], $votes)) {
                         $voted = true;
                     }
                 }
             } else {
                 if (in_array($user_id, $who_voted)) {
                     $voted = true;
                 }
             }
         }
         $items['voted'] = $voted;
         $data['metadata'] = $layout;
         $data['value'] = $items;
     }
     return $data;
 }