Exemple #1
0
 public static function _init()
 {
     static::$_properties['name']['label'] = term('member.name');
     static::$_properties['name']['validation']['min_length'][] = conf('member.name.validation.length.min');
     static::$_properties['name']['validation']['max_length'][] = conf('member.name.validation.length.max');
     if (is_enabled('notice') && conf('mention.isEnabled', 'notice')) {
         static::$_properties['name']['validation']['match_pattern'][] = sprintf('/^(%s)$/u', conf('member.name.validation.match_patterns.register'));
         $method = conf('member.name.validation.blacklist.method');
         if (is_callable($method)) {
             static::$_properties['name']['validation']['not_in_array'][] = call_user_func($method);
         }
     }
     static::$_properties['register_type']['validation']['in_array'][] = Site_Member::get_accept_member_register_types();
     $sex_options = Site_Form::get_form_options4config('term.member.sex.options');
     static::$_properties['sex']['label'] = term('member.sex.label');
     static::$_properties['sex']['form']['options'] = $sex_options;
     static::$_properties['sex']['validation']['in_array'][] = array_keys($sex_options);
     $options_public_flag = Site_Util::get_public_flags();
     static::$_properties['sex_public_flag']['label'] = sprintf('%sの%s', term('member.sex.label'), term('public_flag.label'));
     static::$_properties['sex_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['sex_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['birthyear']['label'] = term('member.birthyear');
     $options = Form_Util::get_year_options(conf('member.profile.birthday.year_from'), conf('member.profile.birthday.year_to'));
     static::$_properties['birthyear']['form']['options'] = $options;
     static::$_properties['birthyear']['validation']['in_array'][] = array_keys($options);
     static::$_properties['birthyear_public_flag']['label'] = sprintf('%sの%s', term('member.birthyear'), term('public_flag.label'));
     static::$_properties['birthyear_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['birthyear_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['birthday']['label'] = term('member.birthday');
     static::$_properties['birthday_public_flag']['label'] = sprintf('%sの%s', term('member.birthday'), term('public_flag.label'));
     static::$_properties['birthday_public_flag']['form'] = Site_Form::get_public_flag_configs();
     static::$_properties['birthday_public_flag']['validation']['in_array'][] = $options_public_flag;
     static::$_properties['invite_member_id'] = Util_Orm::get_relational_numeric_key_prop(false);
 }
Exemple #2
0
 /**
  * Mmeber setting timeline_view
  * 
  * @access  public
  * @return  Response
  */
 public function action_viewtype()
 {
     $page_name = term('timeline', 'site.view', 'site.setting');
     $val = \Form_MemberConfig::get_validation($this->u->id, 'timeline_viewType');
     if (Input::method() == 'POST') {
         Util_security::check_csrf();
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             \Form_MemberConfig::save($this->u->id, $val, $post);
             \DB::commit_transaction();
             \Session::set_flash('message', $page_name . 'を変更しました。');
             \Response::redirect('member/setting');
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
     $this->template->content = \View::forge('member/setting/timeline_viewtype', array('val' => $val));
 }
Exemple #3
0
 /**
  * Notice list
  * 
  * @access  public
  * @return  Response
  */
 public function action_list()
 {
     $data = array();
     $this->set_title_and_breadcrumbs(term('notice'), null, $this->u);
     $this->template->subtitle = \View::forge('_parts/link_read_all', array('tag_attr' => array('class' => 'pull-right')));
     $this->template->content = \View::forge('_parts/list_block', $data);
 }
Exemple #4
0
 /**
  * Mmeber_profile edit
  * 
  * @access  public
  * @return  Response
  */
 public function action_edit($type = null)
 {
     list($type, $is_regist) = self::validate_type($type, $this->u->id);
     $form_member_profile = new Form_MemberProfile($type == 'regist' ? 'regist-config' : 'config', $this->u);
     $form_member_profile->set_validation();
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             $form_member_profile->validate(true);
             \DB::start_transaction();
             $form_member_profile->seve();
             if ($is_regist) {
                 Model_MemberConfig::delete_value($this->u->id, 'terms_un_agreement');
             }
             \DB::commit_transaction();
             $message = $is_regist ? sprintf('%sが%sしました。', term('site.registration'), term('form.complete')) : term('profile') . 'を編集しました。';
             $redirect_uri = $is_regist ? $this->after_auth_uri : 'member/profile';
             \Session::set_flash('message', $message);
             \Response::redirect($redirect_uri);
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs(term('profile') . term($is_regist ? 'site.registration' : 'form.edit'), $is_regist ? array() : array('member/profile' => term('common.my', 'profile')), $is_regist ? null : $this->u);
     $this->template->content = View::forge('member/profile/edit', array('is_regist' => $is_regist, 'val' => $form_member_profile->get_validation(), 'member_public_flags' => $form_member_profile->get_member_public_flags(), 'profiles' => $form_member_profile->get_profiles(), 'member_profile_public_flags' => $form_member_profile->get_member_profile_public_flags()));
 }
Exemple #5
0
 public static function _init()
 {
     //static::$_properties['member_id'] = Util_Orm::get_relational_numeric_key_prop();
     static::$_properties['member_id'] = array('form' => array('type' => false));
     static::$_properties['email']['label'] = term('site.email');
     static::$_properties['password']['label'] = term('site.password');
 }
Exemple #6
0
 /**
  * Mmeber setting viewtype
  * 
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     $page_name = term('notice', 'site.setting');
     $val = \Form_MemberConfig::get_validation($this->u->id, 'notice', 'Notice');
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             \Form_MemberConfig::save($this->u->id, $val, $post);
             \DB::commit_transaction();
             \Session::set_flash('message', $page_name . 'を変更しました。');
             \Response::redirect('member/setting');
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
     $this->template->content = \View::forge('member/setting/_parts/form', array('val' => $val, 'label_size' => 5, 'form_params' => array('common' => array('radio' => array('layout_type' => 'grid')))));
 }
Exemple #7
0
 /**
  * post_update
  * 
  * @access  public
  * @return  Response (json)
  */
 public function post_update($member_id_to = null, $relation_type = null)
 {
     $this->controller_common_api(function () use($member_id_to, $relation_type) {
         $this->response_body['errors']['message_default'] = sprintf('%sの%sに%sしました。', term('follow'), term('form.update'), term('site.failure'));
         if (!self::check_relation_type($relation_type)) {
             throw new HttpNotFoundException();
         }
         if (!is_null(Input::post('id'))) {
             $member_id_to = (int) Input::post('id');
         }
         $member = Model_Member::check_authority($member_id_to);
         if ($member_id_to == $this->u->id) {
             throw new HttpInvalidInputException();
         }
         $member_relation = Model_MemberRelation::get4member_id_from_to($this->u->id, $member_id_to);
         if (!$member_relation) {
             $member_relation = Model_MemberRelation::forge();
         }
         $prop = 'is_' . $relation_type;
         $status_before = (bool) $member_relation->{$prop};
         $status_after = !$status_before;
         \DB::start_transaction();
         $member_relation->{$prop} = $status_after;
         $member_relation->member_id_to = $member_id_to;
         $member_relation->member_id_from = $this->u->id;
         $member_relation->save();
         \DB::commit_transaction();
         $this->response_body['isFollow'] = (int) $status_after;
         $this->response_body['html'] = $status_after ? sprintf('<span class="glyphicon glyphicon-ok"></span> %s', term('followed')) : term('do_follow');
         $this->response_body['attr'] = $status_after ? array('class' => array('add' => 'btn-primary')) : array('class' => array('remove' => 'btn-primary'));
         $this->response_body['message'] = sprintf('%s%s', term('follow'), $status_after ? 'しました。' : 'を解除しました。');
         return $this->response_body;
     });
 }
Exemple #8
0
 /**
  * Update watch status
  * 
  * @access  public
  * @param   string  $foreign_table  target related table
  * @param   int     $foreign_id  target related table id
  * @return  Response (json)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function post_update_watch_status($foreign_table = null, $foreign_id = null)
 {
     $this->controller_common_api(function () use($foreign_table, $foreign_id) {
         if (!is_enabled('notice')) {
             throw new \HttpNotFoundException();
         }
         if (\Input::post('foreign_table')) {
             $foreign_table = \Input::post('foreign_table');
         }
         $foreign_id = intval(\Input::post('foreign_id') ?: $foreign_id);
         if (!$foreign_table || !$foreign_id) {
             throw new \HttpNotFoundException();
         }
         if (!in_array($foreign_table, Site_Util::get_accept_foreign_tables())) {
             throw new \HttpNotFoundException();
         }
         $this->response_body['errors']['message_default'] = term('form.watch') . '状態の変更に失敗しました。';
         $model = \Site_Model::get_model_name($foreign_table);
         $foreign_obj = $model::check_authority($foreign_id);
         $member_id = $foreign_table == 'album_image' ? $foreign_obj->album->member_id : $foreign_obj->member_id;
         $this->check_browse_authority($foreign_obj->public_flag, $member_id);
         if ($member_id == $this->u->id) {
             throw new \HttpBadRequestException();
         }
         \DB::start_transaction();
         $is_registerd = (bool) Model_MemberWatchContent::change_registered_status4unique_key(array('foreign_table' => $foreign_table, 'foreign_id' => $foreign_id, 'member_id' => $this->u->id));
         \DB::commit_transaction();
         $data = array('result' => $is_registerd, 'message' => $is_registerd ? term('form.watch') . '対象に追加しました。' : term('form.watch') . 'を解除しました。', 'html' => icon_label($is_registerd ? 'form.do_unwatch' : 'form.do_watch', 'both', false));
         $this->set_response_body_api($data);
     });
 }
Exemple #9
0
function icon_label($icon_term, $type = 'both', $is_hidden_xs = true, $absolute_icon_key = null, $class_prefix = 'glyphicon glyphicon-', $tag = 'i', $delimitter = ' ')
{
    if (empty($type)) {
        $type = 'both';
    }
    if (!in_array($type, array('both', 'icon', 'label'))) {
        throw new \InvalidArgumentException('Second parameter is invalid.');
    }
    $term = term($icon_term);
    $label = $is_hidden_xs ? sprintf('<span class="hidden-xs-inline">%s%s</span>', $delimitter, $term) : $delimitter . $term;
    if ($type == 'label') {
        return $label;
    }
    if ($absolute_icon_key) {
        $icon_key = $absolute_icon_key;
    } else {
        $icon_key = Config::get('icon.' . $icon_term);
    }
    $icon = '';
    if ($icon_key) {
        if (is_array($icon_key)) {
            $key = isset($icon_key['key']) ? $icon_key['key'] : '';
            if (isset($icon_key['prefix'])) {
                $class_prefix = $icon_key['prefix'];
            }
            $icon = icon($key, $class_prefix, $tag);
        } else {
            $icon = icon($icon_key, $class_prefix, $tag);
        }
    }
    if ($type == 'icon') {
        return $icon;
    }
    return $icon . $label;
}
Exemple #10
0
 public static function get_options_watch($value = null, $is_simple = false)
 {
     $options = array('1' => $is_simple ? term('symbol.bool.true') : term('form.do_watch'), '0' => $is_simple ? term('symbol.bool.false') : term('form.watch') . 'しない');
     if (!is_null($value) && isset($options[$value])) {
         return $options[$value];
     }
     return $options;
 }
Exemple #11
0
 /**
  * Note delete
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_delete($id = null)
 {
     \Util_security::check_csrf(\Input::get(\Config::get('security.csrf_token_key')));
     $comment = Model_NoteComment::check_authority($id, $this->u->id);
     $comment->delete();
     \Session::set_flash('message', term('note') . 'を削除しました。');
     \Response::redirect('note/detail/' . $comment->note_id);
 }
Exemple #12
0
 private static function get_validation_object()
 {
     $val = Validation::forge('invite');
     $email = Form_Util::get_model_field('member_auth', 'email');
     $email['attributes']['placeholder'] = sprintf('%sの%s', term('form.do_invite', 'common.friend'), term('site.email'));
     $val->add('email', $email['label'], $email['attributes'], $email['rules']);
     $val->add('message', term('common.message'), array('rows' => 3, 'placeholder' => sprintf('%sへの%s', term('common.friend'), term('form.invite', 'common.message', 'form._not_required'))), array('trim'));
     return $val;
 }
Exemple #13
0
 public static function get_gruop_name($target_group_key, $is_simple = false)
 {
     $key_prefix = 'admin.user.groups.type';
     if ($is_simple) {
         $key_prefix .= '_simple';
     }
     $key_prefix .= '.';
     return term($key_prefix . $target_group_key);
 }
Exemple #14
0
 public static function _init()
 {
     static::$_properties['member_id'] = Util_Orm::get_relational_numeric_key_prop();
     static::$_properties['email'] = Model_MemberAuth::property('email');
     static::$_properties['token'] = Model_MemberPre::property('token');
     static::$_properties['token']['form']['type'] = false;
     static::$_properties['code']['label'] = term('form.confirm', 'site.code');
     static::$_properties['code']['form']['validation']['exact_length'] = array(conf('member.setting.email.codeLength'));
 }
Exemple #15
0
 /**
  * Mmeber list
  * 
  * @access  public
  * @return  Response
  */
 public function action_list()
 {
     $this->set_title_and_breadcrumbs(term('member.view', 'site.list'));
     $default_params = array('latest' => 1, 'desc' => 1, 'limit' => conf('member.view_params.list.limit'));
     list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, conf('member.view_params.list.limit_max'));
     list($list, $next_id) = Model_Member::get_list(null, $limit, $is_latest, $is_desc, $since_id, $max_id);
     $this->template->main_container_attrs = array('data-not_render_site_summary' => 1);
     $this->template->content = \View::forge('_parts/member_list', array('list' => $list, 'next_id' => $next_id, 'since_id' => $since_id, 'get_uri' => 'member/api/list.json', 'history_key' => 'max_id', 'is_display_load_before_link' => $max_id ? true : false));
     $this->template->post_footer = \View::forge('_parts/load_item');
 }
Exemple #16
0
 /**
  * Define the application's command schedule.
  *
  * @param \Illuminate\Console\Scheduling\Schedule $schedule
  *
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->call(function () {
         $term = new Term();
         $date = Carbon::now()->addDays(15);
         $term->starts_at = $date;
         $term->ends_at = $date->addMonths(3);
         $term->save();
     })->daily()->when(function () {
         return term()->ends_at->diffInDays() == 15 && nextTerm() === null;
     });
 }
Exemple #17
0
 public static function create_instantly($user_id)
 {
     $obj = self::forge();
     $obj->slug = Site_Util::get_slug();
     $obj->title = date(conf('default.dateFormat')) . 'の' . term('news.view');
     $obj->users_id = $user_id;
     $obj->token = \Security::generate_token();
     $obj->is_published = 0;
     $obj->format = conf('form.formats.default', 'news');
     $obj->save();
     return $obj;
 }
Exemple #18
0
 public static function _init()
 {
     $format_options = conf('page.form.formats.options', 'content');
     static::$_properties['format']['form']['options'] = $format_options;
     static::$_properties['format']['validation']['in_array'][] = array_keys($format_options);
     $is_secure_options = \Site_Form::get_form_options4config('term.isSecure.options');
     static::$_properties['is_secure']['label'] = term('isSecure.label');
     static::$_properties['is_secure']['form']['options'] = $is_secure_options;
     static::$_properties['is_secure']['validation']['in_array'][] = array_keys($is_secure_options);
     //if (!Site_Util::check_editor_enabled('html_editor'))
     //{
     //	static::$_properties['body']['validation'][] = 'required';
     //}
 }
Exemple #19
0
 public static function get_content_name($table)
 {
     $table_infos = static::get_parent_table($table, true);
     if (is_array($table_infos)) {
         $parent_table = $table_infos[0];
         $child_type = $table_infos[1];
     } else {
         $parent_table = $table;
         $child_type = '';
     }
     $content_name = term($parent_table);
     if ($child_type) {
         $content_name .= term('form.' . $child_type);
     }
     return $content_name;
 }
Exemple #20
0
 public static function get_group_options()
 {
     $groups = \Config::get('simpleauth.groups');
     unset($groups[-1], $groups[0]);
     $accepted_groups = \Config::get('admin.user.acceptedGroup');
     $return = array();
     if (!$groups) {
         return $return;
     }
     foreach ($groups as $key => $group) {
         if (!in_array($key, $accepted_groups)) {
             continue;
         }
         $return[$key] = term('admin.user.groups.type.' . $key);
     }
     return $return;
 }
Exemple #21
0
 public static function _init()
 {
     static::$_properties['name']['label'] = term('album') . '名';
     static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs();
     static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags();
     static::$_properties['foreign_table']['validation']['in_array'][] = Site_Util::get_album_foreign_tables();
     if (is_enabled('notice')) {
         static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property')));
     }
     if (\Module::loaded('timeline')) {
         // 更新時に timeline の sort_datetime を更新
         $observer_key = \Config::get('timeline.types.album');
         static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($observer_key => 'value')), 'check_changed' => array('check_properties' => array('name', 'body', 'public_flag')), 'update_properties' => array('sort_datetime' => array('updated_at' => 'property'))));
         if (\Config::get('timeline.articles.cache.is_use')) {
             static::$_observers['MyOrm\\Observer_ExecuteToRelations'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'execute_func' => array('method' => '\\Timeline\\Site_Util::delete_cache', 'params' => array('id' => 'property')), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'))));
         }
     }
 }
Exemple #22
0
 /**
  * Action edit
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_edit($module = null, $name = null)
 {
     list($db_key, $configs) = self::get_template_configs($module, $name);
     if (!$configs) {
         throw new \HttpNotFoundException();
     }
     $val = self::get_validation($configs);
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         $error_message = '';
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             if (!($template = \Model_Template::get4name($db_key))) {
                 $template = \Model_Template::forge();
                 $template->name = $db_key;
                 $template->format = $configs['format'];
             }
             $template->title = isset($post['title']) ? $post['title'] : $configs['title'];
             $template->body = isset($post['body']) ? $post['body'] : $configs['body'];
             $template->save();
             \DB::commit_transaction();
             $message = sprintf('%sを%sしました。', term('site.template'), term('form.edit'));
             \Session::set_flash('message', $message);
             \Response::redirect('admin/content/template/mail');
         } catch (\Database_Exception $e) {
             $error_message = \Site_Controller::get_error_message($e, true);
         } catch (\FuelException $e) {
             $error_message = $e->getMessage();
         }
         if ($error_message) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $error_message);
         }
     }
     $this->set_title_and_breadcrumbs(term('site.mail', 'site.template', 'form.edit'), array('admin/content' => term('site.content', 'site.management'), 'admin/content/template/mail' => term('site.mail', 'site.template', 'site.management')));
     $this->template->content = \View::forge('content/template/_parts/form', array('val' => $val, 'configs' => $configs, 'db_key' => $db_key));
 }
Exemple #23
0
 public static function get_viewType_options($value = null, $is_simple = false)
 {
     $options = array('0' => $is_simple ? term('site.view') . '全体' : sprintf('%s全体の%sを表示する', term('site.view'), term('timeline')));
     if (conf('memberRelation.follow.isEnabled')) {
         $options['1'] = $is_simple ? sprintf('%sの%sのみ', term('followed'), term('member.view')) : sprintf('%sの%sの%sのみ表示する', term('followed'), term('member.view'), term('timeline'));
     }
     if (conf('memberRelation.friend.isEnabled')) {
         $options['2'] = $is_simple ? sprintf('%sのみ', term('firiend')) : sprintf('%sの%sのみ表示する', term('friend'), term('timeline'));
     }
     if (conf('memberRelation.follow.isEnabled') && conf('memberRelation.friend.isEnabled')) {
         $options['3'] = sprintf('%sの%sと%s', term('followed'), term('member.view'), term('friend'));
         if (!$is_simple) {
             $options['3'] .= sprintf('の%sを表示する', term('timeline'));
         }
     }
     if (!is_null($value) && isset($options[$value])) {
         return $options[$value];
     }
     return $options;
 }
Exemple #24
0
 public static function _init()
 {
     static::$_properties['name']['label'] = term('site.picture', 'site.title');
     static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs();
     static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags();
     if (conf('albumImageLoction.saveFromExif', 'album')) {
         static::$_observers['MyOrm\\Observer_SaveAlbumImageLocation'] = array('events' => array('after_insert'));
     }
     if (is_enabled('notice')) {
         static::$_observers['MyOrm\\Observer_InsertNotice'] = array('events' => array('after_insert'), 'update_properties' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('album_id' => 'property'), 'type_key' => array('child_data' => 'value'), 'member_id_from' => array('related' => array('album' => 'member_id'))));
         static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property')));
     }
     if (\Module::loaded('timeline')) {
         $type_album_image_profile = \Config::get('timeline.types.album_image_profile');
         // 更新時に timeline の sort_datetime, comment_count を更新
         static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($type_album_image_profile => 'value')), 'check_changed' => array('check_properties' => array('public_flag', 'sort_datetime', 'comment_count', 'like_count')), 'update_properties' => array('public_flag', 'sort_datetime', 'updated_at', 'comment_count', 'like_count')));
         if (\Config::get('timeline.articles.cache.is_use')) {
             static::$_observers['MyOrm\\Observer_ExecuteToRelations'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_TimelineChildData', 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property')), 'check_changed' => array('check_properties' => array('name', 'public_flag')), 'execute_func' => array('method' => '\\Timeline\\Site_Util::delete_cache', 'params' => array('timeline_id' => 'property'))));
         }
     }
 }
Exemple #25
0
 /**
  * News delete
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_delete($id = null)
 {
     $id = (int) $id;
     \Util_security::check_method('POST');
     \Util_security::check_csrf();
     $error_message = '';
     $is_transaction_rollback = false;
     try {
         $member = \Model_Member::check_authority($id);
         $message = \Site_Member::remove($member);
         \Session::set_flash('message', $message);
     } catch (\EmailValidationFailedException $e) {
         \Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error');
         $error_message = 'メール送信エラー';
     } catch (\EmailSendingFailedException $e) {
         \Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error');
         $error_message = 'メール送信エラー';
     } catch (\Auth\SimpleUserUpdateException $e) {
         $is_transaction_rollback = true;
         $error_message = term('member.view') . 'が存在しません。';
     } catch (\Database_Exception $e) {
         $is_transaction_rollback = true;
         $error_message = \Site_Controller::get_error_message($e, true);
     } catch (\FuelException $e) {
         $is_transaction_rollback = true;
         if (!($error_message = $e->getMessage())) {
             $error_message = term('site.left') . 'に失敗しました。';
         }
     }
     if ($error_message) {
         if ($is_transaction_rollback && \DB::in_transaction()) {
             \DB::rollback_transaction();
         }
         \Session::set_flash('error', $error_message);
     }
     \Response::redirect(\Site_Util::get_redirect_uri('admin/member'));
 }
Exemple #26
0
}
?>

<?php 
if ($val->fieldset()->field('member_birthday_month') && $val->fieldset()->field('member_birthday_month')) {
    $optional_public_flag = array();
    if (conf('profile.birthday.birthday.publicFlag.isEdit')) {
        $value = conf('profile.birthday.birthday.publicFlag.default', null, conf('public_flag.default'));
        if (isset($member_public_flags['birthday'])) {
            $value = $member_public_flags['birthday'];
        }
        $optional_public_flag = array('name' => 'member_public_flag[birthday]', 'value' => $value);
    }
    ?>
	<?php 
    echo form_date($val, term('member.birthday'), 'member_birthday_month', 'member_birthday_day', $label_size, null, $optional_public_flag);
}
?>

<?php 
foreach ($profiles as $profile) {
    $optional_public_flag = array();
    if ($profile->is_edit_public_flag) {
        $value = isset($member_profile_public_flags[$profile->id]) ? $member_profile_public_flags[$profile->id] : $profile->default_public_flag;
        $optional_public_flag = array('name' => sprintf('member_profile_public_flag[%s]', $profile->id), 'value' => $value);
    }
    if ($profile->form_type == 'input') {
        ?>
	<?php 
        echo form_input($val, $profile->name, '', 7, $label_size, $profile->information, $optional_public_flag);
    } elseif ($profile->form_type == 'textarea') {
Exemple #27
0
    private function send_change_email_mail($data)
    {
        if (!is_array($data)) {
            $data = (array) $data;
        }
        $term_email = term('site.email');
        $data['body'] = <<<END
こんにちは、{$data['to_name']}さん

{$term_email}の変更が完了しました。

END;
        \Util_Toolkit::sendmail($data);
    }
Exemple #28
0
<div id="btn_menu">
<?php 
if ($is_mypage) {
    echo btn(term('album', 'form.create'), 'album/create', 'mr', true, null, null, null, 'plus', null, null, false);
}
$name = $is_mypage ? '自分' : member_name($member) . 'さん';
$controller = Site_Util::get_controller_name();
if ($controller == 'album') {
    echo btn(sprintf('%sの%sを全て見る', $name, term('album_image')), sprintf('album/member/%d/images', $member->id), 'mr', true, null, null, null, 'picture', null, null, false);
} elseif ($controller == 'image') {
    echo btn(sprintf('%sの%sを全て見る', $name, term('album')), sprintf('album/member/%d', $member->id), 'mr', true, null, null, null, 'picture', null, null, false);
}
?>
</div>
Exemple #29
0
<?php

echo render('_parts/member_contents_box', array('member' => $note->member, 'id' => $note->id, 'public_flag' => $note->public_flag, 'model' => 'note', 'size' => 'M', 'date' => array('datetime' => $note->published_at ? $note->published_at : $note->updated_at, 'label' => $note->published_at ? term('site.datetime') : term('form.updated', 'site.datetime'))));
?>

<?php 
if (Auth::check()) {
    $dropdown_btn_group_attr = array('id' => 'btn_dropdown_' . $note->id, 'class' => array('dropdown', 'boxBtn', 'edit'));
    $dropdown_btn_attr = array('class' => 'js-dropdown_content_menu', 'data-uri' => sprintf('note/api/menu/%d.html?is_detail=1', $note->id), 'data-member_id' => $note->member_id, 'data-menu' => '#menu_' . $note->id, 'data-loaded' => 0);
    echo btn_dropdown('noterm.dropdown', array(), false, 'xs', null, true, $dropdown_btn_group_attr, $dropdown_btn_attr, false);
}
Exemple #30
0
 /**
  * Delete category
  * 
  * @access  public
  * @param   int  $id  target id
  * @return  Response(json)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see     Controller_Base::api_delete_common
  */
 public function post_delete($id = null)
 {
     $this->api_delete_common('news_category', $id, null, term('news.category.view'));
 }