public function login() { if ($this->request->is('post')) { if ($this->Auth->login()) { if ($this->referer() == Router::fullbaseUrl() . Router::url(array('controller' => 'users', 'action' => 'login')) || $this->referer() == Router::fullbaseUrl() . Router::url(array('controller' => 'users', 'action' => 'newPassword'))) { return $this->redirect($this->Auth->redirectUrl()); } else { return $this->redirect($this->referer()); } } else { $this->Flash->error('Pseudo ou mot de passe invalide. Veuillez réessayer SVP'); } } }
public function add() { if ($this->request->is('post')) { $this->autoRender = false; $this->loadModel('User'); $user = $this->User->find('first', array('conditions' => array('User.session' => $_POST['session']))); $user_id = current(current($user)); $base = $_REQUEST['image']; $image = $this->base64_to_jpeg($base, $_SERVER['DOCUMENT_ROOT'] . '/app/webroot/avatars/' . $user_id . '.jpg'); $image_url = Router::fullbaseUrl() . '/app/webroot/avatars/' . $user_id . '.jpg'; $this->User->id = $user_id; $this->User->saveField('avatar_url', $image_url); return '{"image_url": ' . json_encode($image_url) . "}"; } }
public function view($mv_id = null, $id = null) { //動画基本情報の取得 $this->Post->id = $id; $view_ret = $this->Post->findById($id); $this->set('post', $view_ret); $this->set('devFlg', $view_ret['Post']['dev_flg']); $this->set('id', $id); $this->set('post_id', $mv_id); $baseUrl = Router::fullbaseUrl(); $webroot = $this->webroot; $url = $baseUrl . $webroot; $this->set('root_url', $url); $params = array('conditions' => array('Fav.user_id' => $this->Auth->user('id'), 'Fav.post_id' => $id)); //関連動画の表示 $tagIds = array(); for ($i = 0; $i < count($view_ret['Tag']); $i++) { array_push($tagIds, $view_ret['Tag'][$i]['id']); } $paramsRelated = array('conditions' => array('PostsTag.tag_id' => $tagIds), 'order' => 'rand()', 'limit' => 3); $this->set('relatedPosts', $this->PostsTag->find('all', $paramsRelated)); //ユーザーがその動画に対していいねを押したかどうかのフラグ。1以上の場合いいね済み $count = 1 <= $this->Fav->find('count', $params) ? 1 : 0; $this->set('favFlag', $count); if ($this->request->is('get')) { $this->Post->updateAll(array('Post.play_num' => 'Post.play_num + 1'), array('Post.id' => $id)); } //お気に入り登録処理 if ($this->request->is('post')) { if (empty($this->Auth->user())) { $this->redirect(array('controller' => 'Users', 'action' => 'login')); } $this->request->data['Fav']['user_id'] = $this->Auth->user('id'); if ($this->Post->updateAll(array('Post.fav' => 'Post.fav + 1'), array('Post.id' => $this->request->data['Fav']['post_id'])) && $this->Fav->save($this->request->data)) { $this->redirect('/posts/view/' . $mv_id . '/' . $id); } else { } } }
/** * To filter url request * @author Gaurav */ public function beforeFilter() { $headersInformation = getallheaders(); // admin email $this->set('AdminEmail', AdminEmail); if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin') { //$this->Auth->loginRedirect = array('plugin' => false, 'controller' => 'dashboard', 'action' => 'index'); $this->layout = 'admin'; AuthComponent::$sessionKey = 'Auth.User'; $this->isAdmin = TRUE; Configure::write('isAdmin', TRUE); } else { //$this->Auth->loginRedirect = array('plugin' => false, 'controller' => 'pages', 'action' => 'home'); $this->layout = 'front'; // get group change request status $bizOwnerId = $this->Session->read('Auth.Front.BusinessOwners.id'); //$crCount = $this->Session->read('Auth.Front.BusinessOwners.group_change'); //$this->set(compact('crCount')); Configure::write('isAdmin', FALSE); AuthComponent::$sessionKey = 'Auth.Front'; } $roleType = $this->Session->read('Auth.User.user_type'); $this->set('common', $this->Common); $frontUserRole = $this->Session->read('Auth.Front.user_type'); $isUserLogin = $frontUserRole == "businessOwner" ? true : false; $this->set(compact("isUserLogin")); $loginUserId = $this->Session->read('Auth.Front.id'); $this->set(compact("loginUserId")); if (empty($headersInformation['HASHKEY']) && $this->params['prefix'] != 'api') { // redirect session after login $checkUrl = Router::fullbaseUrl() . $this->here; if (strpos($checkUrl, Configure::read('SITE_URL') . 'referrals/referralDetails/sent/') !== false) { $this->Session->write('BackUrlAfterLogin', $checkUrl); } elseif (strpos($checkUrl, Configure::read('SITE_URL') . 'referrals/referralDetails/received/') !== false) { $this->Session->write('BackUrlAfterLogin', $checkUrl); } elseif (strpos($checkUrl, Configure::read('SITE_URL') . 'messages/viewMessage/') !== false) { $this->Session->write('BackUrlAfterLogin', $checkUrl); } elseif (strpos($checkUrl, Configure::read('SITE_URL') . 'reviews/index') !== false) { $this->Session->write('BackUrlAfterLogin', $checkUrl); } elseif (strpos($checkUrl, Configure::read('SITE_URL') . 'meetings') !== false) { $this->Session->write('BackUrlAfterLogin', $checkUrl); } if (empty($roleType)) { $this->Auth->allow(array('admin_login', 'admin_forgotPassword', 'admin_resetPassword', 'home', 'login', 'subscribe', 'aboutUs', 'contactUs', 'privacyPolicy', 'termsOfServices', 'careers', 'partners', 'faq', 'faqView', 'faqSearch', 'getCountryList', 'getCountryName', 'getStateList', 'getStateName', 'trainingVideoReminderMail', 'recurringTransaction', 'rating', 'deactivateUser', 'getProfessionList')); } } else { if ($this->params['prefix'] == 'api') { $this->RequestHandler->ext = Configure::read('SERVICEFORMAT'); if (!isset($headersInformation['HASHKEY']) || $headersInformation['HASHKEY'] != Configure::read('HASHKEY')) { echo json_encode(array('code' => Configure::read('RESPONSE_ERROR'), 'message' => 'Invalid Hash Key')); die; } $this->Auth->allow($this->action); //API Post Data in Json if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->__getPostContent(); } //fetch the headers data $this->__getHeaderInformation(); } } // Login user get counter for different entity (ex- message, referrals etc.) if (empty($this->request->data) && empty($this->request->form)) { $this->Common->clearDropzoneData(); } $messageCounter = 0; $referalCounter = 0; if ($loginUserId != "") { $loginUserId = $this->Encryption->decode($loginUserId); $userGroup = $this->Groups->getUserGroupId($loginUserId); // logout user after shuffling $beforeShuffling = $this->Session->read('Auth.Front.BusinessOwner.group_id'); $afterShuffling = $userGroup['BusinessOwner']['group_id']; if (!empty($beforeShuffling) && $beforeShuffling != $afterShuffling) { $this->Auth->logout(); } if ($this->action == "viewMessage") { if (isset($this->params->pass[0])) { $messageId = $this->Encryption->decode($this->params->pass[0]); $this->loadModel('MessageRecipient'); $this->MessageRecipient->updateAll(array('MessageRecipient.is_read' => 1, 'MessageRecipient.is_total_read' => 1), array('MessageRecipient.message_id' => $messageId, 'MessageRecipient.recipient_user_id' => $loginUserId)); } } if ($this->action == "referralDetails") { if (isset($this->params->pass[0]) && isset($this->params->pass[1])) { if ($this->params->pass[0] == "received") { $referralId = $this->Encryption->decode($this->params->pass[1]); $this->loadModel('ReceivedReferral'); $this->ReceivedReferral->updateAll(array('ReceivedReferral.is_read' => 1, 'ReceivedReferral.is_total_read' => 1), array('ReceivedReferral.id' => $referralId, 'ReceivedReferral.to_user_id' => $loginUserId)); } } } $messageCounter = $this->Common->unreadCounter('messages', $loginUserId); $referalCounter = $this->Common->unreadCounter('referrals', $loginUserId); $this->set('userGroup', $userGroup['BusinessOwner']['group_id']); // get profile picture path $profileImage = $this->Businessowner->getProfilePicture($loginUserId); $this->set(compact("profileImage")); // get login user info $loginUserInfo = $this->BusinessOwner->findByUserId($loginUserId); $loginUserName = $loginUserInfo['BusinessOwner']['fname'] . ' ' . $loginUserInfo['BusinessOwner']['lname']; $loginUserRole = $loginUserInfo['BusinessOwner']['group_role']; $this->set(compact("loginUserName", "loginUserRole", "loginUserInfo")); } $this->set(compact("messageCounter")); $this->set(compact("referalCounter")); /*if($this->request->is('ajax')) { $ajaxRinningUrl = parse_url($this->referer()); $serverUrl = parse_url(Configure::read('SITE_URL')); if($ajaxRinningUrl['host'] != $serverUrl['host']){ $result = array( 'response' => __('Unauthorize Access'), 'responsecode' => Configure::read('RESPONSE_ERROR'), ); echo json_encode($result);die; } }*/ }
/** * 初期設定 タグ * * @param int $languageId 言語ID * @param string $pluginName プラグイン名 * @return void */ public function initTags($languageId, $pluginName = null) { if ($pluginName === null) { $pluginName = Current::read('Plugin.name'); } $from = SiteSettingUtil::read('Mail.from'); $fromName = SiteSettingUtil::read('Mail.from_name', null, $languageId); $siteName = SiteSettingUtil::read('App.site_name', null, $languageId); $bodyHeader = SiteSettingUtil::read('Mail.body_header', null, $languageId); $signature = SiteSettingUtil::read('Mail.signature', null, $languageId); $siteTimezone = (new NetCommonsTime())->getSiteTimezone(); $now = NetCommonsTime::getNowDatetime(); $date = new DateTime($now); $date->setTimezone(new DateTimeZone($siteTimezone)); $siteNow = $date->format('Y/m/d H:i:s'); $this->assignTag('X-FROM_EMAIL', $from); $this->assignTag('X-FROM_NAME', $fromName); $this->assignTag('X-SITE_NAME', $siteName); $this->assignTag('X-SITE_URL', Router::fullbaseUrl()); $this->assignTag('X-PLUGIN_NAME', $pluginName); $this->assignTag('X-BLOCK_NAME', Current::read('Block.name')); $this->assignTag('X-TO_DATE', $siteNow); $this->assignTag('X-BODY_HEADER', $bodyHeader); $this->assignTag('X-SIGNATURE', $signature); // X-ROOMタグ $this->setXRoom($languageId); }
public function register() { $this->set('phone_types', $this->PhoneType->findAll()); $this->set('states', $this->State->findAllLongNames()); if ($this->request->is('post') || $this->request->is('put')) { $this->request->data['User']['role_id'] = 1; $this->request->data['User']['status_id'] = 3; if ($this->Employer->User->saveAll($this->request->data, array('validation' => 'only'))) { $organization = $this->Organization->checkAndCreate($this->request->data, 1); unset($this->request->data['Organization']); $this->request->data['Employer']['organization_id'] = $organization['Organization']['id']; $employer = $this->request->data['Employer']; unset($this->request->data['Employer']); $this->Employer->User->saveAll($this->request->data, array('validation' => false)); $employer['user_id'] = $this->Employer->User->getLastInsertID(); $this->Employer->save($employer); $this->Auth->login(); $this->Employer->Company->checkAndCreate($organization); $this->Employer->User->Request->create(); $this->Employer->User->Request->save(array('Request' => array('request_type_id' => 1))); $request_id = $this->Employer->User->Request->getInsertId(); $request = $this->Employer->User->Request->findById($request_id); $Email = new CakeEmail(); $Email->config('gmail'); $Email->to($this->Auth->user('email')); $Email->template('welcome', 'welcome'); $Email->emailFormat('html'); $confirm_url = Router::fullbaseUrl() . "/confirm/" . $request['Request']['url']; $Email->subject('Welcome To FitIn.Today!'); $Email->viewVars(array('confirm_email' => $confirm_url)); $Email->send(); $this->Session->setFlash(__('Welcome! Please check your email to confirm your address'), 'alert', array('plugin' => 'BoostCake', 'class' => 'alert-success')); $applicant_url = $this->Session->read('applicant_url'); $this->Session->delete('applicant_url'); if (!empty($applicant_url)) { $this->redirect(array('controller' => 'applicants', 'action' => 'view', $applicant_url)); } $this->redirect(array('controller' => 'employers', 'action' => 'profile')); } } }
public function add() { if (empty($this->request->data)) { $this->redirect(array('action' => 'index', 'controller' => 'recordtrac')); } App::uses('CakeEmail', 'Network/Email'); if (!empty($this->request->data)) { $requestID = filter_var($this->request->data["Record"]["request_id"], FILTER_VALIDATE_INT); if ($this->Record->validates()) { //clean filename $this->request->data["Record"]["filename"]["name"] = $this->FileSanitize->sanitize($this->request->data["Record"]["filename"]["name"]); // it validated logic if ($this->Record->save($this->request->data)) { //determine type of record $recordType = ''; $url = ''; if ($this->request->data["Record"]["url"] != '') { $recordType = "url"; $url = $this->request->data["Record"]["url"]; } elseif ($this->request->data["Record"]["access"] != '') { $recordType = "offline"; $url = filter_var($this->request->data["Record"]["access"], FILTER_SANITIZE_STRING); } else { $recordType = "file"; $url = Router::fullbaseUrl() . "/files/record/filename/" . $this->Record->id . "/" . $this->request->data["Record"]["filename"]["name"]; } //get the subscribers $this->loadModel('Subscriber'); $subscribers = $this->Subscriber->find('all', array('conditions' => array('Subscriber.request_id' => $requestID))); //get the point of contact $this->loadModel('Owner'); $owner = $this->Owner->find('first', array('conditions' => array('Owner.request_id' => $requestID))); foreach ($subscribers as $subscriber) { //make sure they are set to receive notifications, and have a valid email if ($subscriber["Subscriber"]["should_notify"] == 1 && $subscriber["User"]["email"] != '') { //email subscriber $Email = new CakeEmail(); $Email->template('requestupdated')->emailFormat('html')->to($subscriber["User"]["email"])->from($this->getfromEmail())->bcc($this->getBccEmail())->subject($this->getAgencyName() . ' Public Disclosure Request #' . $requestID . " - Updated")->viewVars(array('agencyName' => $this->getAgencyName(), 'page' => '/requests/view/' . $requestID, 'ownerEmail' => $owner["User"]["email"], 'requestID' => $requestID, 'unsubscribe' => '/requests/unsubscribe/' . $subscriber["Subscriber"]["id"], 'description' => $this->request->data["Record"]["description"], 'fileupload' => $recordType, 'url' => $url))->send(); } } $this->Session->setFlash("<h4>Success</h4><p>Your record has been added and subscribers have been notified by email.</p>", 'success'); } else { if ($this->request->data["Record"]["filename"]["error"] == 1) { $this->Session->setFlash("<h4>ERROR</h4><p>File exceeds maximum upload size. No file uploaded.</p>", 'danger'); } elseif ($this->request->data["Record"]["filename"]["error"] == 0) { $errors = $this->Record->validationErrors; foreach ($errors["filename"] as $error) { $this->Session->setFlash("<h4>ERROR</h4><p>" . $error . "</p>", 'danger'); } } } } else { // didn't validate logic $errors = $this->Record->validationErrors; foreach ($errors["filename"] as $error) { $this->Session->setFlash("<h4>ERROR</h4><p>" . $error . "</p>", 'danger'); } } unset($this->request->data); $this->redirect(array('action' => 'view', 'controller' => 'requests', $requestID)); } }
<?php $config = array('Elfinder' => array('title' => __('Elfinder File Manager'), 'width' => 900, 'height' => 500, 'resizable' => 'yes', 'window_url' => Router::fullbaseUrl() . '/my_controller/elfinder', 'connector_url' => Router::fullbaseUrl() . '/my_controller/connector', 'locale' => 'en', 'options' => array('roots' => array(array('driver' => 'LocalFileSystem', 'URL' => Router::fullbaseUrl() . '/img/Uploads', 'path' => IMAGES . 'Uploads', 'accessControl' => 'access', 'attributes' => array(array('pattern' => '!\\.html$!', 'hidden' => true)), 'tmbPath' => 'tumbnails', 'uploadOverwrite' => false)))));
public function __construct() { $this->admin = AuthComponent::user('isAdmin'); //info $this->local = Router::fullbaseUrl(); //echo $this->getEditionPage(); $this->arr2 = json_decode(file_get_contents(APP . 'cms/base.json'), true); }
public function login() { //debug($this->request); $baseUrl = Router::fullbaseUrl(); $webroot = $this->webroot; $url = $baseUrl . $webroot; $this->set('root_url', $url); $this->set('webroot', $webroot); if ($this->request->is('post')) { if ($this->Auth->login()) { $this->set('user', $this->Auth->user()); return $this->redirect(array('controller' => 'Posts', 'action' => 'index')); } else { $this->Session->setFlash('ユーザー名とパスワードの組み合わせが違います。'); } } }
/** * confirm is the action that a user goes to to request an email confirmation */ public function confirm() { if ($this->request->is('post')) { $this->User->Request->create(); $this->User->Request->save(array('Request' => array('request_type_id' => 1))); $request_id = $this->User->Request->getInsertId(); $request = $this->User->Request->findById($request_id); $Email = new CakeEmail(); $Email->to($this->Auth->user('email')); $Email->subject('FitIn.Today Email Confirmation'); $Email->config('gmail'); $Email->send("Welcome to FitIn.Today! Please confirm your email address by clicking the link below. \n\n " . Router::fullbaseUrl() . "/confirm/" . $request['Request']['url']); $this->Session->setFlash(__('A confirmation email has been sent'), 'alert', array('plugin' => 'BoostCake', 'class' => 'alert-success')); } }
/** * 編集 * * @return void * @access public */ public function edit($postID = null) { //除外処理 if (empty($postID)) { $postID = $this->request->params['id']; } if (empty($postID)) { $this->setMessage('無効なIDです。', true); $this->redirect(array('action' => 'index')); } /* 各種データを取得する */ //携帯投稿TBLからデータを取得する $mobilePostData = $this->MobilePost->find('first', array('conditions' => array('MobilePost.id' => $postID))); //データの取得 $postData = $this->BlogPost->find('first', array('conditions' => array('BlogPost.id' => $mobilePostData['MobilePost']['blog_post_id']))); if (empty($postData)) { $this->setMessage('データが取得できませんでした。', true); $this->redirect(array('action' => 'index')); } //画像を取得する。 if (!empty($mobilePostData['MobilePost']['file'])) { $thumImgName = 'thum_' . $mobilePostData['MobilePost']['file']; $saveThumURL = 'files/mobile_post/' . $thumImgName; $mobilePostImg = Router::fullbaseUrl() . $this->request->webroot . $saveThumURL; $this->set('mobilePostImg', $mobilePostImg); } //モバイルポスト設定を取得する。 $mobilePostConfig = $this->MobilePostConfig->find('first', array('conditions' => array('blog_content_id' => $postData['BlogPost']['blog_content_id']))); $this->set('mobilePostConfig', $mobilePostConfig); //ブログ設定取得 $blogContentData = $this->BlogContent->find('first', array('conditions' => array('BlogContent.id' => $postData['BlogPost']['blog_content_id']))); /* フォーム生成用にデータを整理する */ //セレクトボックスの為に配列化する。 $categoryOptions = $this->MobilePost->getCategoryOptions($postData['BlogPost']['blog_content_id']); $this->set('categoryOptions', $categoryOptions); //タグデータを取得する。 $tagOptions = $this->MobilePost->getTagOptions(); $this->set('tagOptions', $tagOptions); /* データの受信処理 */ //POSTボタン押下後 if (!empty($this->request->data)) { /* データの整理 */ //テキストエリアの改行 if (!empty($this->request->data['BlogPost']['content'])) { $this->request->data['BlogPost']['content'] = nl2br($this->request->data['BlogPost']['content']); } else { $this->request->data['BlogPost']['content'] = ''; //変数定義だけしないとエラーになる? } if (!empty($this->request->data['BlogPost']['detail'])) { $this->request->data['BlogPost']['detail'] = nl2br($this->request->data['BlogPost']['detail']); } //noを生成 $this->request->data['BlogPost']['no'] = $postData['BlogPost']['no']; //公開期日 if (!empty($this->request->data['BlogPost']['publish_begin_date'])) { $this->request->data['BlogPost']['publish_begin'] = $this->request->data['BlogPost']['publish_begin_date'] . " " . $this->request->data['BlogPost']['publish_begin_time']; } else { $this->request->data['BlogPost']['publish_begin'] = null; } if (!empty($this->request->data['BlogPost']['publish_end_date'])) { $this->request->data['BlogPost']['publish_end'] = $this->request->data['BlogPost']['publish_end_date'] . " " . $this->request->data['BlogPost']['publish_end_time']; } else { $this->request->data['BlogPost']['publish_end'] = null; } //投稿日 $this->request->data['BlogPost']['posts_date'] = $this->request->data['BlogPost']['posts_date_date'] . " " . $this->request->data['BlogPost']['posts_date_time']; //携帯投稿専用のデータ整形 $mobileData = array(); $mobileData = $this->request->data; /* 画像に関する処理 */ //画像の削除があれば消してしまう。 if (!empty($this->request->data['MobilePost']['img_delete'][0]) && $this->request->data['MobilePost']['img_delete'][0] == 'yes') { //まずファイルの削除 $this->MobilePost->removeMobilePostImg($mobilePostData); //UNSET if (!empty($mobilePostData['MobilePost']['file'])) { $mobileData['MobilePost']['file'] = ''; $this->MobilePost->id = $postID; $this->MobilePost->saveField('file', ''); //明示的に空にする } //削除指示がない場合で、前の画像が残っていれば指定場所にタグを挿入する。 } else { //元々の画像があれば画像名を取得する。 if (!empty($mobilePostData['MobilePost']['file'])) { //画像URL整形 $webrootPath = Router::fullbaseUrl() . $this->request->webroot; $saveURL = $webrootPath . '/files/mobile_post/' . $mobilePostData['MobilePost']['file']; $saveThumURL = $webrootPath . '/files/mobile_post/thum_' . $mobilePostData['MobilePost']['file']; $imgTag = "<div class='mobilePostImage'><a href='{$saveURL}' rel='colorbox' title=''><img src='{$saveThumURL}' /></a></div>"; //画像の挿入箇所確認と挿入実行 switch ($mobileData['MobilePost']['file_position']) { case 0: $this->request->data['BlogPost']['detail'] = $imgTag . $this->request->data['BlogPost']['detail']; break; case 1: $this->request->data['BlogPost']['detail'] = $this->request->data['BlogPost']['detail'] . $imgTag; break; } } } //画像のリサイズと保存。 $mobileData = $this->MobilePost->saveMobilePostImg($mobileData); //画像アップが本文の前か後かを確認する。 if (!empty($mobileData['MobilePost']['file'])) { //画像URL整形 $webrootPath = Router::fullbaseUrl() . $this->request->webroot; $saveURL = $webrootPath . '/files/mobile_post/' . $mobileData['MobilePost']['file']; $saveThumURL = $webrootPath . '/files/mobile_post/thum_' . $mobileData['MobilePost']['file']; $imgTag = "<div class='mobilePostImage'><a href='{$saveURL}' rel='colorbox' title=''><img src='{$saveThumURL}' /></a></div>"; //画像の挿入箇所確認と挿入実行 switch ($mobileData['MobilePost']['file_position']) { case 0: $this->request->data['BlogPost']['detail'] = $imgTag . $this->request->data['BlogPost']['detail']; break; case 1: $this->request->data['BlogPost']['detail'] = $this->request->data['BlogPost']['detail'] . $imgTag; break; } } if (empty($this->request->data['BlogPost']['content'])) { $this->request->data['BlogPost']['content'] = ''; } /* SAVEとリダイレクト */ //保存処理実行 if ($this->BlogPost->save($this->request->data, false)) { //直前に保存したレコードのIDのを取得 $mobileData['MobilePost']['blog_post_id'] = $mobilePostData['MobilePost']['blog_post_id']; //保存実行 if ($this->MobilePost->save($mobileData)) { $this->setMessage('記事を追加しました。', true); $this->redirect(array('action' => 'post_list', $mobileData['MobilePost']['blog_content_id'])); } else { $this->setMessage('MobilePostの保存処理に失敗しました。', true); } } else { $this->setMessage('保存処理に失敗しました。', true); } //保存ボタンでなかったら } else { //公開日だけ作成する必要あり。 if (!empty($postData['BlogPost']['publish_begin'])) { $timeStamp = strtotime($postData['BlogPost']['publish_begin']); $this->set('setTimeBegin', date("Y/m/d", $timeStamp)); } if (!empty($postData['BlogPost']['publish_end'])) { $timeStamp = strtotime($postData['BlogPost']['publish_end']); $this->set('setTimeEnd', date("Y/m/d", $timeStamp)); } //本文からリンクを削除する。 if (!empty($mobilePostData['MobilePost']['file'])) { //画像URL整形 $webrootPath = Router::fullbaseUrl() . $this->request->webroot; $saveURL = $webrootPath . '/files/mobile_post/' . $mobilePostData['MobilePost']['file']; $saveThumURL = $webrootPath . '/files/mobile_post/thum_' . $mobilePostData['MobilePost']['file']; $imgTag = "<div class='mobilePostImage'><a href='{$saveURL}' rel='colorbox' title=''><img src='{$saveThumURL}' /></a></div>"; //上のHTMLを削除する。 $postData['BlogPost']['detail'] = str_replace($imgTag, '', $postData['BlogPost']['detail']); //HTMLを除去する。 $postData['BlogPost']['detail'] = strip_tags($postData['BlogPost']['detail']); } //表示データを作る。 $this->request->data = $postData; } /* 表示に関する処理 */ //set $this->set('blogContentData', $blogContentData); $this->set('userID', $this->BcAuth->user('id')); $this->set('blogContentID', $postData['BlogPost']['blog_content_id']); $this->set('mobilePostData', $mobilePostData); $this->set('postData', $postData); //render $this->render('form'); }