コード例 #1
0
ファイル: newmember.php プロジェクト: OICTH1/mtpizza
 public function action_commit()
 {
     $post = \Session::get(self::SESSION_KEY_POST);
     $member = new Model_Member();
     $member->name = $post['name'];
     $member->phonetic = $post['kana'];
     $member->sex = $post['sex'];
     $member->birthday = $post['years'] . '-' . $post['month'] . '-' . $post['days'];
     $member->address = $post['address1'] . $post['address2'];
     $member->mailaddress = $post['mail'];
     $member->password = $post['password1'];
     $member->tel = $post['phone'];
     $member->postalcode = $post['postal'];
     $member->save();
     $login_user = Model_Member::find('all', array('where' => array(array('mailaddress' => $post['mail']), array('password' => $post['password1']))));
     if (!empty($login_user)) {
         \Session::set(self::SESSION_KEY_USER_ID, array_shift($login_user)->id);
         if (empty(\Session::get(self::SESSION_KEY_CART))) {
             \Session::set(self::SESSION_KEY_CART, array('orders' => array(), 'total_money' => 0));
         }
         return Response::redirect('mtpizza/message/newmember');
     } else {
         return Response::redirect('mtpizza/auth/err');
     }
 }
コード例 #2
0
ファイル: history.php プロジェクト: OICTH1/mtpizza
 public function action_index($id)
 {
     $user = Model_Member::find($id);
     $data['member'] = $user;
     $data['orders'] = $user->orders;
     return View::forge("controlsystem/members/history", $data);
 }
コード例 #3
0
ファイル: account.php プロジェクト: wxl2012/wx
 /**
  * 根据微信推送的包,创建相关帐户信息
  *
  * @param $openid 微信服务器推送的微信粉丝OpenId
  * @param $account 接受微信服务器推送数据的公众号实体对象
  * @return 创建成功返回微信OpenId数据对象,否则返回False
  */
 public static function createWechatAccount($openid, $account = [])
 {
     //创建微信信息
     $wechat = \Model_Wechat::forge(['nickname' => $openid]);
     //是否创建用户登录信息
     if (isset($account->is_subscribe_create_user) && $account->is_subscribe_create_user) {
         $params = ['username' => "wx_{$openid}", 'password' => "w{$account->id}#{$openid}", 'email' => "wx_{$openid}@{$account->id}.com", 'group_id' => $account->create_user_default_group];
         $user_id = \Model_User::createUser($params);
         $wechat->user_id = $user_id;
         $params = ['user_id' => $user_id];
         $people = \Model_People::forge($params);
         $people->save();
         //是否创建会员信息
         if (isset($account->is_subscribe_create_member) && $account->is_subscribe_create_member) {
             $params = ['no' => "{$account->seller_id}{$wechat->user_id}" . time(), 'user_id' => $wechat->user_id];
             $member = \Model_Member::forge($params);
             $member->save();
         }
     }
     //创建微信OpenID记录
     $params = ['openid' => $openid, 'account_id' => $account->id];
     $wechatOpenid = \Model_WechatOpenid::forge($params);
     $wechat->ids = [$wechatOpenid];
     $wechat->save();
     return $wechatOpenid;
 }
コード例 #4
0
ファイル: api.php プロジェクト: uzura8/flockbird
 /**
  * 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;
     });
 }
コード例 #5
0
ファイル: api.php プロジェクト: uzura8/flockbird
 /**
  * Get list by member
  * 
  * @access  public
  * @param   int  $member_id  target member_id
  * @return  Response (html)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function get_member($member_id = null)
 {
     $this->api_accept_formats = array('html');
     $this->controller_common_api(function () use($member_id) {
         $member_id = \Input::get('member_id', 0) ?: $member_id;
         list($is_mypage, $member) = $member_id ? $this->check_auth_and_is_mypage($member_id, true) : array(null, false);
         list($limit, $page) = $this->common_get_pager_list_params(conf('articles.limit', 'album'), conf('articles.limit_max', 'album'));
         $data = Site_Model::get_album_images($limit, $page, get_uid(), $member, $is_mypage, null, $this->format != 'html');
         $data['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['list']) : array();
         if ($this->format == 'html') {
             if ($member) {
                 $data['member'] = $member;
             }
         } else {
             $list_array = array();
             foreach ($data['list'] as $key => $obj) {
                 $row = $obj->to_array();
                 $row['album']['member'] = \Model_Member::get_one_basic4id($obj->album->member_id);
                 $list_array[] = $row;
             }
             // json response
             $data = $list_array;
         }
         $this->set_response_body_api($data, $this->format == 'html' ? 'image/_parts/list' : null);
     });
 }
コード例 #6
0
ファイル: memberpre.php プロジェクト: uzura8/flockbird
 public static function _init()
 {
     static::$_properties['name'] = Model_Member::get_property('name');
     static::$_properties['email'] = Model_MemberAuth::get_property('email');
     static::$_properties['password'] = Model_MemberAuth::get_property('password', 'required');
     static::$_properties['invite_member_id'] = Model_Member::get_property('invite_member_id');
 }
コード例 #7
0
ファイル: Member.php プロジェクト: uzura8/flockbird
 public function test_recalculate_filesize_total($member_id = null, $expected = null)
 {
     foreach ($this->members as $member) {
         $test = Model_Member::recalculate_filesize_total($member->id);
         $this->assertEquals($member->filesize_total, $test);
     }
 }
コード例 #8
0
ファイル: site.php プロジェクト: uzura8/flockbird
 protected function check_auth_and_is_mypage($member_id = 0, $is_api = false)
 {
     $is_mypage = false;
     $access_from = 'guest';
     $member = null;
     $member_id = (int) $member_id;
     if (!$member_id) {
         $this->check_auth_and_redirect(false);
         $is_mypage = true;
         $member = $this->u;
         $access_from = 'self';
     } elseif ($this->check_is_mypage($member_id)) {
         $is_mypage = true;
         $member = $this->u;
         $access_from = 'self';
     } else {
         $member = Model_Member::check_authority($member_id);
         if (Auth::check()) {
             $access_from = 'member';
             if (Model_MemberRelation::check_relation('friend', $this->u->id, $member_id)) {
                 $access_from = 'friend';
             }
         }
     }
     return array($is_mypage, $member, $access_from);
 }
コード例 #9
0
ファイル: order.php プロジェクト: OICTH1/website
 public function action_commit()
 {
     $user_id = \Session::get(self::SESSION_KEY_USER_ID);
     $user = Model_Member::find($user_id);
     $address = \Session::get(self::SESSION_KEY_ADDRESS);
     /*------make order----------------------------------------------------------*/
     $order = new Model_Order();
     $order->member_id = $user->id;
     $order->postalcode = $address['postalcode'];
     $order->destination = $address['address'] . $address['billname'] . $address['companyname'];
     $date = time();
     $order->order_date = date('Y-m-d H:i:s', $date);
     $order->print_flag = 0;
     $order->status = 0;
     $order->save();
     /*-----make orderline------------------------*/
     $cart = \Session::get(self::SESSION_KEY_CART);
     foreach ($cart['orders'] as $orderline) {
         $item_id = $orderline['item_id'];
         $item = Model_Item::find($item_id);
         $num = $orderline['quantity'];
         $size = $orderline['size'];
         $neworderline = new Model_Orderline();
         $neworderline->order_id = $order->id;
         $neworderline->item_id = $item_id;
         $neworderline->num = $num;
         $neworderline->size = $size;
         $neworderline->save();
         $earning = new Model_Earning();
         $earning->member_id = $user->id;
         $earning->item_id = $item_id;
         $earning->size = $size;
         switch ($size) {
             case 'S':
                 $unit_price = $neworderline->item->unit_price_s;
                 break;
             case 'M':
                 $unit_price = $neworderline->item->unit_price_m;
                 break;
             case 'L':
                 $unit_price = $neworderline->item->unit_price_m;
                 break;
             default:
                 $unit_price = $neworderline->item->unit_price;
                 break;
         }
         $earning->unit_price = $unit_price;
         $earning->num = $num;
         $earning->date = date('Y-m-d H:i:s', $date);
         $earning->category = $item->category;
         $earning->item_name = $item->name;
         $now = date('Ymd');
         $birthday = date('Ymd', strtotime($user->birthday));
         $earning->age = (int) floor(($now - $birthday) / 10000);
         $earning->save();
     }
     \Session::delete(self::SESSION_KEY_CART);
     return Response::redirect('index.php/message/commit');
 }
コード例 #10
0
ファイル: api.php プロジェクト: uzura8/flockbird
 /**
  * Get comments common api controller
  * 
  * @access  protected
  * @param   string  $parent_table  target parent table
  * @param   int     $parent_id  target parent record id
  * @param   string  $public_flag_related  related table for check brows authority
  * @param   array   $parent_member_id_relateds  related table and property array for check edit authority
  * @param   int     $limit  record count for get
  * @param   int     $limit_max  record limited count for get
  * @param   string  $parent_id_prop  parent table id property.
  * @return  Response (json|html)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 protected function api_get_comments_common($parent_table, $parent_id, $public_flag_related = null, $parent_member_id_relateds = array(), $limit = 0, $limit_max = 0, $parent_id_prop = null)
 {
     $this->api_accept_formats = array('json', 'html');
     $this->controller_common_api(function () use($parent_table, $parent_id, $public_flag_related, $parent_member_id_relateds, $limit, $limit_max, $parent_id_prop) {
         $comment_table = $parent_table . '_comment';
         $comment_model = Site_Model::get_model_name($comment_table);
         $parent_id = (int) $parent_id;
         $parent_model = Site_Model::get_model_name($parent_table);
         $parent_obj = $parent_model::check_authority($parent_id, 0, $public_flag_related);
         if (!$parent_id_prop) {
             $parent_id_prop = $parent_table . '_id';
         }
         $auther_member_ids = Util_Orm::get_related_member_ids($parent_obj, $parent_member_id_relateds);
         foreach ($auther_member_ids as $member_id) {
             $this->check_browse_authority($public_flag_related ? $parent_obj->{$public_flag_related}->public_flag : $parent_obj->public_flag, $member_id);
         }
         $member_profile_image_size = Input::get('image_size') ?: 'M';
         if (!in_array($member_profile_image_size, array('SS', 'S', 'M'))) {
             $member_profile_image_size = 'M';
         }
         $default_params = array('latest' => 1, 'limit' => $limit ?: conf('view_params_default.list.comment.limit'));
         list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, $limit_max ?: conf('view_params_default.list.comment.limit_max'));
         list($list, $next_id, $all_comment_count) = $comment_model::get_list(array($parent_id_prop => $parent_id), $limit, $is_latest, $is_desc, $since_id, $max_id, null, $this->format == 'json', $this->format == 'json');
         if (conf('like.isEnabled')) {
             $liked_ids = \Auth::check() ? \Site_Model::get_liked_ids($comment_table, $this->u->id, $list) : array();
         }
         $api_uri_path_prefix = Site_Model::convert_table2controller_path($parent_table);
         $get_uri = sprintf('%s/comment/api/list/%d.json', $api_uri_path_prefix, $parent_id);
         $data = array('list' => $list, 'parent' => $parent_obj, 'next_id' => $next_id, 'delete_uri' => sprintf('%s/comment/api/delete.json', $api_uri_path_prefix), 'image_size' => $member_profile_image_size);
         if ($since_id) {
             $data['since_id'] = $since_id;
         }
         if ($this->format == 'html') {
             $data += array('auther_member_ids' => $auther_member_ids, 'list_more_box_attrs' => array('id' => 'listMoreBox_comment_' . $parent_id, 'data-uri' => $get_uri, 'data-list' => '#comment_list_' . $parent_id), 'counter_selector' => '#comment_count_' . $parent_id);
             if (conf('like.isEnabled')) {
                 $data['liked_ids'] = $liked_ids;
             }
         } else {
             $data += array('count' => $all_comment_count, 'get_uri' => $get_uri);
             $data['parent'] = array('id' => $parent_id, 'member_id' => $parent_member_id_relateds ? array_shift($auther_member_ids) : $parent_obj->member_id);
             $data['image_size'] = array('key' => $member_profile_image_size, 'value' => conf('upload.types.img.types.m.sizes.' . $member_profile_image_size));
             foreach ($list as $key => $row) {
                 $row['body'] = convert_body($row['body'], array('nl2br' => conf('view_params_default.comment.nl2br'), 'is_truncate' => false, 'mention2link' => true));
                 $row['member'] = Model_Member::get_one_basic4id($row['member_id']);
                 if (conf('like.isEnabled')) {
                     $row['get_like_members_uri'] = sprintf('%s/comment/like/api/member/%d.html', $api_uri_path_prefix, $row['id']);
                     $row['post_like_uri'] = sprintf('%s/comment/like/api/update/%d.json', $api_uri_path_prefix, $row['id']);
                     $row['is_liked'] = \Auth::check() && in_array($row['id'], $liked_ids) ? 1 : 0;
                     $row['comment_table'] = $comment_table;
                 }
                 $list[$key] = $row;
             }
             $data['list'] = $list;
         }
         $this->set_response_body_api($data, $this->format == 'html' ? '_parts/comment/list' : null);
     });
 }
コード例 #11
0
ファイル: coupon_info.php プロジェクト: show123456/taiyou
 public function getCoupon()
 {
     $CouponRecordTable = new Model_ApplistCouponRecord();
     $CouponListTable = new Model_ApplistCouponList();
     $cfromuser = $this->fromuser;
     $customer_id = $this->customer_id;
     //搜索条件
     $filter['where'] = " customer_id='{$customer_id}' and state='1' ";
     $sql = $CouponListTable->select($filter);
     //解析结果集
     $couponInfo = $CouponListTable->fetchRow($sql);
     $filter['where'] = "fromuser='******' and pid='{$couponInfo['id']}'";
     $times = $CouponRecordTable->count($filter);
     //如果领取次数未满
     if ($couponInfo && $couponInfo['end_date'] > date("Y-m-d") && $times < $couponInfo['times'] && $couponInfo['stock'] > $couponInfo['use_num']) {
         //插入领取成功记录
         $data['pid'] = (int) $couponInfo['id'];
         $data['end_date'] = $couponInfo['end_date'];
         $data['state'] = 2;
         $data['customer_id'] = $customer_id;
         $data['fromuser'] = $cfromuser;
         $data['create_date'] = date("Y-m-d H:i:s");
         $data['coupon_name'] = str_inmysql($couponInfo['denomination']);
         $memberTable = new Model_Member();
         $nickname = $memberTable->fetchRow("select nickname from member where fromuser='******' and customer_id='{$customer_id}'");
         $data['nickname'] = $nickname['nickname'];
         $id = $CouponRecordTable->upsert($data);
         $CouponListTable->query("update applist_coupon_list set use_num=use_num+1 where id='{$couponInfo['id']}' and customer_id='{$customer_id}'");
         //获取优惠券 规则信息 返回微信单图文格式
         $CouponTable = new Model_ApplistCoupon();
         $info = $CouponTable->fetchRow("select * from applist_coupon where customer_id='{$customer_id}'");
         //返回微信数据
         $data['msgtype'] = 'news';
         $data['title'] = $info['title'];
         $data['description'] = $info['info'];
         $data['picurl'] = 'http://' . $_SERVER['HTTP_HOST'] . "/data/image_c/" . $info['pic'];
         $data['url'] = 'http://' . $_SERVER['HTTP_HOST'] . "/mobile/coupon/index.php?id=" . $id . "&pid=" . $data['pid'] . "&fromuser="******"&sign=" . $this->timesign;
         return $data;
     } else {
         $data['msgtype'] = "text";
         $data['content'] = $couponInfo['cue'];
         return $data;
     }
 }
コード例 #12
0
ファイル: member.php プロジェクト: uzura8/flockbird
 /**
  * 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');
 }
コード例 #13
0
ファイル: api.php プロジェクト: uzura8/flockbird
 /**
  * Api list
  * 
  * @access  public
  * @return  Response (html)
  */
 public function get_list()
 {
     $this->api_accept_formats = array('json', 'html');
     $this->controller_common_api(function () {
         $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->set_response_body_api(array('list' => $list, 'next_id' => $next_id, 'since_id' => $since_id, 'get_uri' => 'member/api/list.json', 'history_key' => 'max_id'), '_parts/member_list');
     });
 }
コード例 #14
0
ファイル: recover.php プロジェクト: uzura8/flockbird
 /**
  * Confirm reset password
  * 
  * @access  public
  * @return  Response
  */
 public function action_send_reset_password_mail()
 {
     // Already logged in
     Auth::check() and Response::redirect('member');
     Util_security::check_method('POST');
     Util_security::check_csrf();
     $form = $this->form_resend_password();
     $val = $form->validation();
     if (!$val->run()) {
         Session::set_flash('error', $val->show_errors());
         $this->action_resend_password();
         return;
     }
     $post = $val->validated();
     $message = term('site.password') . 'のリセット方法をメールで送信しました。';
     if (!($member_auth = Model_MemberAuth::get4email($post['email']))) {
         Session::set_flash('message', $message);
         Response::redirect(conf('login_uri.site'));
         return;
     }
     $member = Model_Member::check_authority($member_auth->member_id);
     $error_message = '';
     $is_transaction_rollback = false;
     try {
         $maildata = array();
         DB::start_transaction();
         $token = Model_MemberPasswordPre::save_with_token($member_auth->member_id, $post['email']);
         DB::commit_transaction();
         $mail = new Site_Mail('memberResendPassword');
         $mail->send($post['email'], array('to_name' => $member->name, 'register_url' => sprintf('%s?token=%s', uri::create('member/recover/reset_password'), $token)));
         Session::set_flash('message', $message);
         Response::redirect(conf('login_uri.site'));
     } 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 (\Database_Exception $e) {
         $is_transaction_rollback = true;
         $error_message = \Site_Controller::get_error_message($e, true);
     } catch (FuelException $e) {
         $is_transaction_rollback = true;
         $error_message = $e->getMessage();
     }
     if ($error_message) {
         if ($is_transaction_rollback && DB::in_transaction()) {
             DB::rollback_transaction();
         }
         Session::set_flash('error', $error_message);
     }
     $this->action_resend_password();
 }
コード例 #15
0
ファイル: page.php プロジェクト: OICTH1/website
 public function before()
 {
     parent::before();
     if (!empty(\Session::get(self::SESSION_KEY_USER_ID))) {
         $id = \Session::get(self::SESSION_KEY_USER_ID);
         $member = Model_Member::find($id);
         if (empty($member)) {
             \Session::delete(self::SESSION_KEY_USER_ID);
         }
         $this->template->member = array('name' => $member->name);
     } else {
         $this->template->member = false;
     }
 }
コード例 #16
0
ファイル: model.php プロジェクト: uzura8/flockbird
 public static function get_mentioned_member_ids4body($body)
 {
     if (!preg_match_all(Site_Util::get_match_pattern2mention(), $body, $matches, PREG_SET_ORDER)) {
         return array();
     }
     $member_names = array();
     foreach ($matches as $match) {
         $member_names[] = $match[2];
     }
     if (!($members = \Model_Member::query()->where('name', 'in', $member_names)->get())) {
         array();
     }
     return \Util_Orm::conv_col2array($members, 'id');
 }
コード例 #17
0
ファイル: user.php プロジェクト: lz1988/stourwebcms
 public function action_dologin()
 {
     $mobile = Arr::get($_POST, 'mobile');
     $pwd = Arr::get($_POST, 'password');
     $backurl = Arr::get($_POST, 'backurl');
     $forwardurl = Arr::get($_POST, 'forwardurl');
     $userinfo = Model_Member::login($mobile, $pwd);
     if (!empty($userinfo['mid'])) {
         $redirecturl = !empty($forwardurl) ? $forwardurl : $backurl;
         Common::showMsg('', $redirecturl);
     } else {
         Common::showMsg('登陆失败,请检查用户名或密码是否正确', '-1');
     }
 }
コード例 #18
0
ファイル: member.php プロジェクト: OICTH1/mtpizza
 public function action_editcommit()
 {
     $user_id = \Session::get(self::SESSION_KEY_USER_ID);
     $user = Model_Member::find($user_id);
     $keys = array('name' => $_POST['name'], 'phonetic' => $_POST['kana'], 'postalcode' => $_POST['postal'], 'address' => $_POST['address1'] . $_POST['address2'], 'mailaddress' => $_POST['mail'], 'tel' => $_POST['phone'], 'password' => $_POST['pass2']);
     foreach ($keys as $key => $value) {
         if ($value != '') {
             $user[$key] = $value;
         }
     }
     $user->save();
     //$this->template->content = var_dump($_POST);
     return Response::redirect('mtpizza/member');
 }
コード例 #19
0
ファイル: test.php プロジェクト: uzura8/flockbird
 public static function get_mention_body($mention_member_ids, $body_prefix = null)
 {
     if (!is_array($mention_member_ids)) {
         $mention_member_ids = (array) $mention_member_ids;
     }
     if (is_null($body_prefix)) {
         $body_prefix = 'mention test.';
     }
     $members = \Model_Member::get_basic4ids($mention_member_ids);
     $body_surffix = '';
     foreach ($members as $member) {
         $body_surffix .= sprintf(' @%s', $member['name']);
     }
     return $body_prefix . $body_surffix;
 }
コード例 #20
0
 public function after_delete(\Orm\Model $obj)
 {
     if ($obj->user_type) {
         return false;
     }
     if (!$obj->{$this->_key_from}) {
         return;
     }
     $member = \Model_Member::find('first', array('where' => array($this->_key_to => $obj->{$this->_key_from})));
     $member->filesize_total -= $obj->{$this->_property_from};
     if ($member->filesize_total < 0) {
         $member->filesize_total = 0;
     }
     $member->save();
 }
コード例 #21
0
 public function before_insert(\Orm\Model $obj)
 {
     if ($obj->user_type) {
         return false;
     }
     if (!$obj->{$this->_key_from}) {
         return false;
     }
     $member = \Model_Member::find('first', array('where' => array($this->_key_to => $obj->{$this->_key_from})));
     $member->filesize_total += $obj->{$this->_property_from};
     // check filesize_total
     if ($member->filesize_total > \Site_Upload::get_accepted_filesize($obj->{$this->_key_from})) {
         throw new LimitUploadFileSizeException('File size is over the limit of the member.');
     }
     $member->save();
 }
コード例 #22
0
ファイル: Borrower.php プロジェクト: nkkromhof/atk4-codepad
 function init()
 {
     parent::init();
     $this->b = $this->join('library_borrowing.library_member_id');
     $this->b->hasOne('Staff', 'verified_by')->sortable(true);
     $this->b->addField('borrowed')->sortable(true);
     $this->b->addField('is_returned')->sortable(true);
     $this->b->addField('returned')->sortable(true);
     $this->b->join('library_book')->addField('book_name', 'name')->sortable(true);
     // Showing only if borrowed
     //$this->addCondition('is_returned',false);
     // We don't want anyone to accidentally insert into this model as it will impact both
     // joined tables, so we create validation to avoid that.
     $this->addHook('beforeInsert', function ($m) {
         throw $m->exception('Do not add borrower directly');
     });
 }
コード例 #23
0
ファイル: auth.php プロジェクト: OICTH1/website
 public function action_login($selectflag = false)
 {
     $login_user = Model_Member::find('all', array('where' => array(array('mailaddress' => $_POST['mail']), array('password' => $_POST['pass']))));
     if (!empty($login_user)) {
         \Session::set(self::SESSION_KEY_USER_ID, array_shift($login_user)->id);
         if (empty(\Session::get(self::SESSION_KEY_CART))) {
             \Session::set(self::SESSION_KEY_CART, array('orders' => array(), 'total_money' => 0));
         }
         if ($selectflag == 'true') {
             return Response::redirect('index.php/order/delivery');
         } else {
             return Response::redirect('index.php/top');
         }
     } else {
         return Response::redirect('index.php/auth/err');
     }
 }
コード例 #24
0
ファイル: model.php プロジェクト: uzura8/flockbird
 public static function set_optional_data2album_image_list($album_images, $start_album_image_id = 0)
 {
     $list_array = array();
     $list_array_post = array();
     $is_set_main = $start_album_image_id ? false : true;
     foreach ($album_images as $key => $row) {
         if (!$is_set_main && $key == $start_album_image_id) {
             $is_set_main = true;
         }
         $row['album'] = Model_Album::get_one_basic4id($row['album_id']);
         $row['member'] = \Model_Member::get_one_basic4id($row['album']['member_id']);
         if ($is_set_main) {
             $list_array[] = $row;
         } else {
             $list_array_post[] = $row;
         }
     }
     return array_merge($list_array, $list_array_post);
 }
コード例 #25
0
ファイル: insernotice.php プロジェクト: uzura8/flockbird
 private function execute($obj)
 {
     list($foreign_table, $foreign_id, $member_id_to, $member_id_from, $type_key) = self::get_variables($obj);
     if (self::check_already_executed($foreign_table, $foreign_id, $member_id_to, $member_id_from, $type_key)) {
         return;
     }
     if (!\Model_Member::check_is_active($member_id_to)) {
         $member_id_to = null;
     }
     // watch content
     if ($member_id_to && $member_id_from != $member_id_to) {
         \Notice\Site_Util::regiser_watch_content($member_id_from, $foreign_table, $foreign_id, $type_key);
     }
     // get mention targets
     $mentioned_member_ids = array();
     if (conf('mention.isEnabled', 'notice') && \Notice\Site_Util::check_mention_target($foreign_table, $type_key)) {
         $body_porp = !empty($this->_update_properties['body_prop_name']) ? $this->_update_properties['body_prop_name'] : 'body';
         $mentioned_member_ids = \Notice\Site_Model::get_mentioned_member_ids4body($obj->{$body_porp});
         $mentioned_member_ids = \Util_Array::delete_in_array($mentioned_member_ids, array($member_id_from));
         // 自分宛の mention は無効
     }
     // get notice targets
     $notice_member_ids = \Notice\Site_Util::get_notice_target_member_ids($member_id_to, $member_id_from, $foreign_table, $foreign_id, $type_key);
     // 重複通知防止
     $notice_member_ids = \Util_Array::delete_in_array($notice_member_ids, $mentioned_member_ids);
     if (!$notice_member_ids && !$mentioned_member_ids) {
         return;
     }
     // notice 実行
     if ($notice_member_ids) {
         \Notice\Site_Model::execut_notice($foreign_table, $foreign_id, $type_key, $member_id_from, $notice_member_ids);
     }
     // mention 実行
     if ($mentioned_member_ids) {
         $mention_type_key = $type_key == 'comment' ? 'comment_mention' : 'parent_mention';
         \Notice\Site_Model::execut_notice($foreign_table, $foreign_id, $mention_type_key, $member_id_from, $mentioned_member_ids);
     }
 }
コード例 #26
0
ファイル: api.php プロジェクト: uzura8/flockbird
 /**
  * Get notice list
  * 
  * @access  public
  * @return  Response (json)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function get_list()
 {
     $this->controller_common_api(function () {
         list($limit, $page) = $this->common_get_pager_list_params(\Config::get('notice.articles.limit'), \Config::get('notice.articles.limit_max'));
         $data = Model_NoticeStatus::get_pager_list4member_id($this->u->id, $limit, $page);
         $list_array = array();
         foreach ($data['list'] as $key => $obj) {
             $row = $obj->to_array();
             $row['members_count'] = Model_NoticeMemberFrom::get_count4notice_id($row['notice_id'], $this->u->id);
             $row['members'] = array();
             $notice_member_froms = Model_NoticeMemberFrom::get4notice_id($row['notice_id'], \Config::get('notice.noticeMemberFrom.limit'), $this->u->id);
             foreach ($notice_member_froms as $notice_member_from) {
                 $row['members'][] = \Model_Member::get_one_basic4id($notice_member_from->member_id);
             }
             $row['is_read'] = (int) $row['is_read'];
             $list_array[] = $row;
         }
         // json response
         $data['list'] = $list_array;
         $data['is_detail'] = (bool) \Input::get('is_detail', 0);
         $this->set_response_body_api($data);
     });
 }
コード例 #27
0
ファイル: member.php プロジェクト: uzura8/flockbird
 /**
  * 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'));
 }
コード例 #28
0
ファイル: member_action.php プロジェクト: show123456/taiyou
    $m = $_POST['month'];
    $y = $_POST['year'];
    $today = $_POST['year'] . '-' . $_POST['month'] . '-' . date('j', mktime(0, 0, 1, $m == 12 ? 1 : $m + 1, 1, $m == 12 ? $y + 1 : $y) - 24 * 3600);
    //echo $d=die();
    $and = " and left(create_date,10)<='{$today}'";
    $start_date = $today = $_POST['year'] . '-' . $_POST['month'] . '-01';
    $smarty->assign('mon', $m);
    $smarty->assign('yea', $y);
} else {
    $today = date("Y-m-d");
    $start_date = date('Y-m-d', strtotime('-29 day'));
    /* $smarty->assign('mon',date('m'));	
    	$smarty->assign('yea',date('Y'));	 */
}
$and = isset($and) ? $and : '';
$member = new Model_Member();
$data = $member->fetchRow("select * from member where customer_id={$customer_id} and fromuser='******'");
$smarty->assign("list", $data);
$message = new Model_Message();
$result = $message->fetchAll("select msg_content,create_date from message where customer_id='{$customer_id}' and fromuser='******'");
if ($result) {
    //互动关键字和日期
    $smarty->assign('Interactive_recording', $result);
}
//最近30天互动量
$filter['where'] = "customer_id='{$customer_id}' and fromuser='******' and left(create_date,10)>='{$start_date}'{$and}";
$filter['group'] = " left(create_date,10) ";
$sql = $message->select($filter, 'count(id) as count_num,left(create_date,10) as count_date');
$messagearray = $message->fetchAll($sql);
foreach ($messagearray as $key => $row) {
    $countinfoc[$row['count_date']] = $row['count_num'];
コード例 #29
0
ファイル: sign.php プロジェクト: show123456/taiyou
    $signModel = new Model_Subtable('sub_sign');
    $data['num']['tid'] = $_GET['tid'];
    $data['num']['uid'] = $userRow['id'];
    $s = $signModel->where("tid=" . $data['num']['tid'] . " and uid=" . $data['num']['uid'])->dataRow();
    if ($s) {
        die('ybm');
    } else {
        $res = $signModel->add($data);
        $res ? die('suc') : die('err');
    }
}
//评论
if ($_REQUEST['a'] == 'reply') {
    $replyModel = new Model_Subtable('sub_reply');
    if ($_GET['tid'] && $_GET['content']) {
        $memberModel = new Model_Member();
        $data['num']['tid'] = $_GET['tid'];
        $data['num']['uid'] = $userRow['id'];
        $data['info']['name'] = $userRow['nicheng'];
        $data['info']['head_pic'] = $memberModel->getPic($userRow['fromuser']);
        $data['str']['content'] = $_GET['content'];
        $res = $replyModel->add($data);
        $res ? die('suc') : die('err');
    }
}
if ($_REQUEST['a'] == 'index') {
    //省
    $pmodel = new Model_Subtable('s_province');
    $smarty->assign('parr', $pmodel->dataArr());
    $pageSize = 1;
    //页大小
コード例 #30
0
ファイル: album.php プロジェクト: uzura8/flockbird
 private static function get_member_filesize_total($member_id)
 {
     $member = \Model_Member::find($member_id);
     return $member->filesize_total;
 }