Beispiel #1
1
 /**
  * send
  * 必有方法,发送时调用.
  *
  * config参数为getOptions取得的所有项的配置结果
  *
  * @param mixed $target ['email']
  * @param mixed $title
  * @param mixed $config
  */
 public function send($target, $title, $content, $config)
 {
     logger::debug(__CLASS__ . var_export(func_get_args(), 1));
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!($email_to = $target['email'])) {
         return false;
     }
     if ($config['sendway'] == 'mail') {
         $this->email = vmc::singleton('desktop_email_email');
     }
     $this->email->Sender = $this->Sender = $config['usermail'];
     $this->email->Subject = $this->Subject = $this->email->inlineCode($title);
     $From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
     $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
     $body = chunk_split(base64_encode($content));
     $header = $this->email->buildHeader($header);
     $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
     switch ($config['sendway']) {
         case 'sendmail':
             $result = $this->email->SendmailSend($email_to, $header, $body);
             break;
         case 'mail':
             $result = $this->email->MailSend($email_to, $header, $body);
             break;
         case 'smtp':
             $result = $this->email->SmtpSend($email_to, $header, $body, $config);
             break;
         default:
             $result = false;
             break;
     }
     return $result;
 }
Beispiel #2
0
 function get_output()
 {
     $render = $this->app->render();
     $act = app::get('desktop')->model('menus')->getList('menu_id,app_id,menu_title,menu_path,workground', array('menu_type' => 'workground', 'disabled' => 'false'));
     $user = vmc::singleton('desktop_user');
     if ($user->is_super()) {
         $aData = $act;
     } else {
         $group = $user->group();
         //print_r($group);
         $meuns = app::get('desktop')->model('menus');
         $data = array();
         foreach ($group as $key => $val) {
             $aTmp = $meuns->workgroup($val);
             foreach ($aTmp as $val) {
                 $data[] = $val;
             }
         }
         $aData = $data;
     }
     $menu_id = array();
     $wrokground = array();
     foreach ((array) $aData as $value) {
         if (!in_array($value['menu_id'], (array) $menu_id)) {
             $workground[] = $value;
         }
         $menu_id[] = $value['menu_id'];
     }
     $render->pagedata['actions'] = $workground;
     $render->pagedata['side'] = "sidepanel";
     return $render->fetch('sidepanel.html');
 }
Beispiel #3
0
 function save()
 {
     $this->begin('index.php?app=b2c&ctl=admin_brand&act=index');
     $objBrand = $this->app->model('brand');
     $brandname = $objBrand->dump(array('brand_name' => $_POST['brand_name'], 'brand_id'));
     if (empty($_POST['brand_id']) && is_array($brandname)) {
         $this->end(false, '品牌名重复');
     }
     $_POST['ordernum'] = intval($_POST['ordernum']);
     $data = $this->_preparegtype($_POST);
     #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
     if ($obj_operatorlogs = vmc::service('operatorlog.goods')) {
         $olddata = app::get('b2c')->model('brand')->dump($_POST['brand_id']);
     }
     #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
     if ($objBrand->save($data)) {
         #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
         if ($obj_operatorlogs = vmc::service('operatorlog.goods')) {
             if (method_exists($obj_operatorlogs, 'brand_log')) {
                 $obj_operatorlogs->brand_log($_POST, $olddata);
             }
         }
         #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
         $this->end(true, '品牌保存成功');
     } else {
         $this->end(false, '品牌保存失败');
     }
 }
Beispiel #4
0
 public function detail_columns_modifier(&$detail_pages)
 {
     if ($this->app->getConf('site.get_policy.method') == 1 && $detail_pages['detail_point']) {
         unset($detail_pages['detail_point']);
     }
     $objuser = vmc::singleton('desktop_user');
     if ($objuser->is_super()) {
         return;
     }
     $perss = $objuser->group();
     $get = $_GET;
     $menu_path = 'app=' . $_GET['app'] . '&' . 'ctl=' . $_GET['ctl'] . '&' . 'act=' . $_GET['act'];
     $menus = app::get('desktop')->model('menus');
     $filter = array('menu_type' => 'menu', 'menu_path' => $menu_path);
     $row = $menus->getList('*', $filter);
     $detail_action = array_keys($detail_pages);
     foreach ($row as $key => $v) {
         if ($v['addon']) {
             $addon = unserialize($v['addon']);
             if ($addon['url_params'] && $addon['url_params']['action'] == 'detail') {
                 if (!in_array($v['permission'], (array) $perss)) {
                     if ($detail_pages[$addon['url_params']['finderview']]) {
                         unset($detail_pages[$addon['url_params']['finderview']]);
                     }
                 }
             }
         }
         continue;
     }
 }
Beispiel #5
0
 public function create_ftp_file($data, $params, $page = 1)
 {
     $local_file = tempnam(DATA_DIR . "/backup/", $params['model']);
     if (is_null($this->remote_file)) {
         $this->remote_file = $params['model'] . '.' . $params['post']['_io_type'];
     }
     $file = fopen($local_file, "w");
     $model = app::get($params['app_id'])->model($params['model']);
     if (method_exists($model, 'export_csv')) {
         $rs = $model->export_csv($data);
     } else {
         $rs = '';
         if (is_array($data)) {
             $data = (array) $data;
             if (empty($data['title']) && empty($data['contents'])) {
                 $rs = implode("\n", $data);
             } else {
                 if ($page == 1) {
                     $rs = $data['title'] . "\n" . implode("\n", (array) $data['contents']);
                 } else {
                     $rs = implode("\n", (array) $data['contents']);
                 }
             }
         } else {
             $rs = (string) $data;
         }
     }
     fwrite($file, $rs);
     fclose($file);
     $obj_ftp = vmc::singleton('base_ftp');
     $resume = $obj_ftp->size($this->remote_file);
     $obj_ftp->nb_put($this->remote_file, $local_file, FTP_BINARY, $resume);
     unlink($local_file);
     return true;
 }
Beispiel #6
0
 function __construct()
 {
     $obj = vmc::service('base_charset');
     if ($obj instanceof base_charset_interface) {
         $this->set_instance($obj);
     }
 }
Beispiel #7
0
 public function parse_url(&$url)
 {
     $val = vmc::singleton('routeplus_rstatics')->get_genurl($url);
     if ($val) {
         $url = $val;
     }
 }
Beispiel #8
0
 function __construct($app)
 {
     $act = vmc::singleton('base_component_request')->get_get('act');
     if ($act == 'index') {
         $this->column_edit = '操作';
     }
 }
Beispiel #9
0
 public final function install()
 {
     $modules = $this->parse_moduels_params($this->current);
     $this->insert_modules($modules);
     vmc::singleton('mobile_module_base')->create_site_config();
     //生成config文件
 }
Beispiel #10
0
 public function seller_login($userData, $vcode = false, &$msg)
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     if (!$vcode || !base_vcode::verify('passport', $vcode)) {
         $msg = '验证码错误';
         return false;
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = vmc::singleton('seller_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']);
     $account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter);
     if (!$account) {
         $msg = '不存在的用户';
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = '登录密码错误';
         return false;
     }
     return $account[0]['member_id'];
 }
Beispiel #11
0
 /**
  * 下拉参数数据的展示的实现
  * @param string payment id支付单序号
  * @return string 详情内容
  */
 public function detail_payments($payment_id)
 {
     $payment = $this->app->model('payments');
     if ($_POST['payment_id']) {
         $sdf = $_POST;
         unset($_POST['_method']);
         if ($payment->save($sdf)) {
             echo 'ok';
         }
     } else {
         $sdf_payment = $payment->dump($payment_id, '*', array('orders' => '*'));
         if ($sdf_payment) {
             $render = $this->app->render();
             $render->pagedata['payments'] = $sdf_payment;
             if (isset($render->pagedata['payments']['op_id']) && $render->pagedata['payments']['op_id']) {
                 $arr_pam['login_name'] = vmc::singleton('b2c_user_object')->get_member_name(null, $render->pagedata['payments']['op_id']);
                 if (!$arr_pam['login_name']) {
                     $obj_pam = app::get('pam')->model('account');
                     $arr_pam = $obj_pam->dump(array('account_id' => $render->pagedata['payments']['op_id']), 'login_name');
                 }
                 $render->pagedata['payments']['op_id'] = $arr_pam['login_name'] ? $arr_pam['login_name'] : '-';
             } else {
                 $render->pagedata['payments']['op_id'] = '-';
             }
             if (isset($render->pagedata['payments']['orders']) && $render->pagedata['payments']['orders']) {
                 foreach ($render->pagedata['payments']['orders'] as $key => $arr_order_bills) {
                     $render->pagedata['payments']['order_id'] = $key;
                 }
             }
             return $render->fetch('payments/payments.html', $this->app->app_id);
         } else {
             return '无内容';
         }
     }
 }
Beispiel #12
0
 function index($key = 'passport')
 {
     $vcode = vmc::singleton('base_vcode');
     $vcode->length(4);
     $vcode->verify_key($key);
     $vcode->display();
 }
Beispiel #13
0
 /**
  * 实例化存储方式类.
  */
 private function _instance()
 {
     $params = $this->storage_policy();
     $obj_name = 'importexport_policy_' . $params['policy'];
     $this->policy_obj = vmc::singleton($obj_name);
     return true;
 }
Beispiel #14
0
 public function index()
 {
     header('Location:index.php?app=b2c&ctl=admin_setting&act=index');
     die;
     $dashboard_from = $this->_request->get_post('f');
     $dashboard_to = $this->_request->get_post('t');
     $default_enter = true;
     if (!$dashboard_to) {
         $dashboard_to = strtotime(date('Y-m-d'));
     } else {
         $default_enter = false;
     }
     if (!$dashboard_from) {
         $dashboard_from = strtotime('-1 week', $dashboard_to);
     } else {
         $default_enter = false;
     }
     //权限带入
     $user = vmc::singleton('desktop_user');
     $is_super = $user->is_super();
     $group = $user->group();
     $group = (array) $group;
     //统一时间格式
     if (strpos($dashboard_from, ':')) {
         $dashboard_from = strtotime($dashboard_from);
         $dashboard_to = strtotime($dashboard_to);
     }
     if ($dashboard_from > $dashboard_to) {
         $tmp_t = $dashboard_to;
         $dashboard_to = $dashboard_from;
         $dashboard_from = $tmp_t;
     }
     //桌面挂件排序,用户自定义
     if ($default_enter && cacheobject::get('desktop.dashboard.widgets' . $dashboard_to, $cache_data) && isset($cache_data['data'])) {
         $this->pagedata['cached_time'] = $cache_data['cached_time'];
         $widgets = $cache_data['data'];
     } else {
         foreach (vmc::servicelist('desktop.widgets') as $key => $obj) {
             if ($is_super || in_array(get_class($obj), $group)) {
                 $item = array('title' => $obj->get_title(), 'layout' => $obj->get_layout(), 'html' => $obj->get_html($dashboard_from, $dashboard_to), 'order' => $obj->get_order());
                 if (method_exists($obj, 'get_classname')) {
                     $item['classname'] = $obj->get_classname();
                 }
                 $widgets[$item['layout']][] = $item;
             }
         }
         if ($default_enter) {
             $cache_data = array('cached_time' => time(), 'data' => $widgets);
             cacheobject::set('desktop.dashboard.widgets' . $dashboard_to, $cache_data, time() + 86400);
             //缓存24小时
         }
     }
     $this->pagedata['widgets'] = $widgets;
     $this->pagedata['dashboard_from'] = $dashboard_from;
     $this->pagedata['dashboard_to'] = $dashboard_to;
     //快捷
     $this->pagedata['tody'] = date('Y-m-d H:i', strtotime(date('Y-m-d')));
     $this->pagedata['from_arr'] = array('w' => date('Y-m-d H:i', strtotime('-1 week', strtotime($this->pagedata['tody']))), 'm' => date('Y-m-d H:i', strtotime('-1 month', strtotime($this->pagedata['tody']))), 'q' => date('Y-m-d H:i', strtotime('-3 month', strtotime($this->pagedata['tody']))));
     $this->display('dashboard.html');
 }
Beispiel #15
0
 public function login($userData, $vcode = false, &$msg, $type = 'b2c')
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     //快速登录不用验证码
     if ($vcode != 'quick') {
         if (!$vcode || !base_vcode::verify('passport', $vcode)) {
             $msg = '验证码错误';
             return false;
         }
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = vmc::singleton('b2c_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
     $model = 'members';
     $id = 'member_id';
     if ($type == 'sellers') {
         $model = 'sellers';
         $id = 'seller_id';
     }
     $account = app::get('pam')->model($model)->getList($id . ',password_account,login_password,createtime', $filter);
     if (!$account) {
         $msg = '不存在的用户';
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = '登录密码错误';
         return false;
     }
     return $account[0][$id];
 }
Beispiel #16
0
 public function watch_login()
 {
     if ($member_id = vmc::singleton('b2c_user_object')->get_member_session()) {
         vmc::singleton('b2c_frontpage')->bind_member($member_id);
         echo 'success';
     }
 }
Beispiel #17
0
 public function exec(&$order_sdf, &$msg = '')
 {
     $pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $order_sdf['member_id']);
     $env_list = array('order_id' => $order_sdf['order_id'], 'timestr' => date('Y-m-d H:i:s', $order_sdf['last_modify']));
     vmc::singleton('b2c_messenger_stage')->trigger('orders-end', $env_list, array('email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'member_id' => $order_sdf['member_id']));
     return true;
 }
Beispiel #18
0
 public function monitor_change($theme)
 {
     $config_file_path = vmc::get_themes_root_dir() . '/' . $theme . '/config.xml';
     $last_modify_time = filemtime($config_file_path);
     if (!$last_modify_time) {
         return false;
     }
     $exist_last_time = app::get('site')->getConf($theme . '_theme_last_config');
     $exist_last_time = $exist_last_time ? $exist_last_time : 0;
     if ($exist_last_time - $last_modify_time == 0) {
         return true;
     } else {
         app::get('site')->setConf($theme . '_theme_last_config', $last_modify_time);
     }
     $config_xml_content = file_get_contents($config_file_path);
     if ($config_xml_content) {
         $theme_info = vmc::singleton('site_utility_xml')->xml2arrayValues($config_xml_content);
     }
     if (empty($theme_info)) {
         return false;
     }
     $config = $theme_info;
     $theme_sdf = array('theme_id' => $config['theme']['id']['value'], 'theme_dir' => $theme, 'name' => $config['theme']['name']['value'], 'version' => $config['theme']['version']['value'], 'info' => $config['theme']['info']['value'], 'author' => $config['theme']['author']['value'], 'config' => array());
     $theme_sdf = vmc_('site', 'theme_install_config', $theme_sdf, $config);
     if (!vmc::singleton('site_theme_base')->update_theme($theme_sdf)) {
         return false;
     }
     return $theme_sdf;
 }
Beispiel #19
0
 public function __construct()
 {
     if (!defined('MESSAGE_QUEUE') || !constant('MESSAGE_QUEUE')) {
         define('MESSAGE_QUEUE', 'base_queue_mysql');
     }
     return $this->set_queue(vmc::singleton(MESSAGE_QUEUE));
 }
Beispiel #20
0
 function retry($task_id)
 {
     $this->begin();
     $queue_controller_name = system_queue::get_controller_name();
     $support_queue_controller_name = 'system_queue_adapter_mysql';
     if ($queue_controller_name == $support_queue_controller_name) {
         $mdl_queue_mysql = $this->app->model('queue_mysql');
         $task = $mdl_queue_mysql->dump($task_id);
         try {
             $params = $task['params'];
             if (!is_array($params)) {
                 $params = unserialize($params);
             }
             vmc::singleton($task['worker'])->exec($params);
         } catch (Exception $e) {
             $exception_msg = $e->getTrace() . $e->getMessage();
             $mdl_queue_mysql->update(array('exception_msg' => $exception_msg), array('id' => $tatask_id));
             $this->end(false, '出现异常!');
         }
         $mdl_queue_mysql->delete(array('id' => $task_id));
         $this->end(true, '重试成功!');
     } else {
         $this->end(fase, '暂不支持');
     }
 }
Beispiel #21
0
 public function index()
 {
     $desktop_user = vmc::singleton('desktop_user');
     $menus = $desktop_user->get_work_menu();
     $user_id = $this->user->get_id();
     foreach ((array) $menus['workground'] as $key => $value) {
         //if($i++>$workground_count) break;
         $fav_menus[] = $key;
     }
     $this->pagedata['title'] = $title;
     $this->pagedata['title_desc'] = $title_desc;
     $this->pagedata['session_id'] = vmc::singleton('base_session')->sess_id();
     $this->pagedata['uname'] = $this->user->get_login_name();
     $this->pagedata['avatar'] = $this->user->get_avatar();
     $this->pagedata['is_super'] = $this->user->is_super();
     $this->pagedata['param_id'] = $user_id;
     $this->pagedata['menus'] = $menus;
     $this->pagedata['fav_menus'] = (array) $fav_menus;
     $this->pagedata['shop_base'] = vmc::base_url(1);
     $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI'];
     // 桌面内容替换埋点
     foreach (vmc::servicelist('desktop_content') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'changeContent')) {
                 $services->changeContent(app::get('desktop'));
                 $services->changeContent($desktop_menu);
             }
         }
     }
     $this->display('index.html');
 }
Beispiel #22
0
 function to_reply()
 {
     $this->begin("javascript:finderGroup[" . "'" . $_GET["finder_id"] . "'" . "].refresh()");
     $comment_id = $_POST['comment_id'];
     $comment = $_POST['reply_content'];
     if ($comment_id && $comment) {
         $member_comments = vmc::singleton('b2c_message_msg');
         if ($member_comments->to_reply($_POST)) {
             #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
             if ($obj_operatorlogs = vmc::service('operatorlog.members')) {
                 if (method_exists($obj_operatorlogs, 'reply_comment')) {
                     $sdf['comment'] = $comment_id;
                     $sdf['title'] = $comment;
                     $sdf['object_type'] = 'msg';
                     $obj_operatorlogs->reply_comment($sdf);
                 }
             }
             #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
             $this->end(true, '回复成功');
         } else {
             $this->end(false, '回复失败');
         }
     } else {
         $this->end(false, '内容不能为空');
     }
 }
Beispiel #23
0
 public function __construct($app)
 {
     $this->app = $app;
     $this->column_editbutton = '操作';
     $this->column_uname = '登录账号';
     $this->userObject = vmc::singleton('b2c_user_object');
 }
Beispiel #24
0
 /**
  * 订单完成\归档.
  *
  * @param $sdf array 订单ID\操作者ID\操作者名称
  *
  * @return bool - 成功与否
  */
 public function generate($sdf, &$msg = '')
 {
     $mdl_order = app::get('b2c')->model('orders');
     $order_sdf = $mdl_order->dump($sdf['order_id']);
     //订单作废前验证
     foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
         if (!$service->exec($order_sdf, $msg)) {
             return false;
         }
     }
     $order_sdf['status'] = 'finish';
     // 更新退款日志结果
     if ($mdl_order->save($order_sdf)) {
         //订单日志记录
         vmc::singleton('b2c_order_log')->set_operator(array('ident' => $sdf['op_id'] ? $sdf['op_id'] : $order_sdf['member_id'], 'model' => $sdf['op_id'] ? 'shopadmin' : 'members', 'name' => $sdf['op_name'] ? $sdf['op_name'] : '会员'))->set_order_id($order_sdf['order_id'])->success('finish', '订单已完成归档!', $order_sdf);
     } else {
         $msg = '完成\\归档失败!';
         return false;
     }
     //订单作废时同步扩展服务
     foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
         if (!$service->exec($order_sdf, $msg)) {
             //记录日志,不中断
             logger::error($sdf['order_id'] . '完成归档时出错!' . $msg);
         }
     }
     return true;
 }
Beispiel #25
0
 private function member_avatar($content)
 {
     $blocks = preg_split('/%AVATAR_([0-9a-z]*)_S_([a-z0-9\\:]*)_AVATAR%/', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     $c = count($blocks);
     $block_lib = array();
     $block = array();
     for ($i = 0; $i < $c; $i++) {
         switch ($i % 3) {
             case 1:
                 $mid = $blocks[$i];
                 $block[$mid][$i] = array($blocks[$i + 1]);
                 $blocks[$i] =& $block[$mid][$i][0];
                 break;
             case 2:
                 $block[$mid][$i - 1][1] = $blocks[$i];
                 $blocks[$i] = '';
                 break;
         }
     }
     if ($block) {
         $db = vmc::database();
         foreach ($db->select('select avatar,member_id from vmc_b2c_members where member_id in(\'' . implode("','", array_keys($block)) . '\')') as $r) {
             $block_lib[$r['member_id']] = $r;
         }
         foreach ($block as $mid => $sizes) {
             foreach ($sizes as $i => $item) {
                 $block[$mid][$i][0] = '%IMG_' . $block_lib[$mid]['avatar'] . '_S_' . $item[0] . '_IMG%';
             }
         }
     }
     return implode('', $blocks);
 }
Beispiel #26
0
 function dorecycle($mdl_name, $filter = null)
 {
     $oRecycle = app::get('desktop')->model('recycle');
     list($app_id, $table) = explode('_mdl_', $mdl_name);
     $o = app::get($app_id)->model($table);
     $recycle_item = array();
     $recycle_item['drop_time'] = time();
     $recycle_item['item_type'] = $o->table_name();
     $dbschema = $o->get_schema();
     $textColumn = $dbschema['textColumn'];
     $pkey = $dbschema['idColumn'];
     foreach ($dbschema['columns'] as $k => $col) {
         if ($col['is_title'] && $col['sdfpath']) {
             $textColumn = $col['sdfpath'];
             break;
         }
     }
     $rows = $o->getList('*', $filter, 0, -1);
     if (method_exists($o, 'pre_recycle')) {
         if (!$o->pre_recycle($rows)) {
             return false;
         }
     }
     $menus = app::get('desktop')->model('menus');
     $permission_id = $menus->permissionId($_GET);
     foreach ($rows as $k => $v) {
         $pkey_value = $v[$pkey];
         $v = $o->dump($v[$pkey], '*', 'delete');
         $recycle_item['item_sdf'] = $v;
         $recycle_item['app_key'] = $app_id;
         $recycle_item['item_title'] = $v[$textColumn];
         if (method_exists($o, 'title_recycle')) {
             $recycle_item['item_title'] = $o->title_recycle($v);
         }
         $tmp = $recycle_item;
         $tmp['permission'] = $permission_id;
         $return = $oRecycle->save($tmp);
         unset($tmp[$pkey]);
         $o->delete(array($pkey => $pkey_value));
         #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
         if ($obj_operatorlogs = vmc::service('operatorlog.system')) {
             if (method_exists($obj_operatorlogs, 'dorecycle')) {
                 $obj_operatorlogs->dorecycle($v);
             }
         }
         #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
     }
     if (method_exists($o, 'suf_recycle')) {
         if (!$o->suf_recycle($_POST)) {
             return false;
         }
     }
     $services = vmc::serviceList('desktop_finder_callback.' . get_class($o));
     foreach ($services as $service) {
         if (method_exists($service, 'recycle')) {
             $service->recycle($_POST);
         }
     }
     return true;
 }
Beispiel #27
0
 public function index()
 {
     $article_id = $this->_request->get_param(0);
     if ($article_id < 1) {
         vmc::singleton('site_router')->http_status(404);
         //exit;
     }
     $detail = vmc::singleton('content_article_detail')->get_detail($article_id, true);
     if ($detail['indexs']['ifpub'] != 'true') {
         vmc::singleton('site_router')->http_status(404);
         //exit;
     }
     $node = vmc::singleton('content_article_node');
     $node_info = $node->get_node($detail['indexs']['node_id'], true);
     if ($node_info['ifpub'] != 'true') {
         vmc::singleton('site_router')->http_status(404);
         //exit;
     }
     $runtime_path = $node->get_node_path($detail['indexs']['node_id'], true);
     $runtime_path[] = array('link' => $this->app->router()->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'index', 'arg0' => $article_id)), 'title' => $detail['indexs']['title']);
     $this->get_seo_info($detail['bodys'], $runtime_path);
     switch ($detail['indexs']['type']) {
         case 1:
             $this->_index1($detail);
             break;
         case 2:
         default:
             $this->_index2($detail);
     }
     //End Switch
 }
Beispiel #28
0
 protected function _init_aggregator()
 {
     if (is_null($this->_aAggregator)) {
         $aResult = array();
         /*
                     // 这里会产生死循环的递归操作
                     // 暂时使用vmc::servicelist 内部的代码进行处理
                     foreach(vmc::servicelist($this->aggregator_apps) as $object) {
                         //if(get_class($this))
                         $aResult = array_merge($aResult,$object->getItem());
                     }*/
         // 多个的时候也会出现递归的问题 这个得好好想想解决方案 2010-05-17 14:27 wubin
         // todo 这里只是暂时的处理 等待解决方案 2010-05-14 15:21
         $apps = app::get('base')->model('app_content')->getlist('content_path,app_id', array('content_type' => 'service', 'content_name' => $this->aggregator_apps));
         foreach ($apps as $row) {
             if ($row['content_path']) {
                 if ($row['content_path'] == get_class($this)) {
                     $aResult = array_merge($aResult, $this->getItem());
                 } else {
                     $aResult = array_merge($aResult, vmc::singleton($row['content_path'], app::get($row['app_id']))->getItem());
                 }
             }
         }
         $this->_aAggregator = $aResult;
     }
 }
Beispiel #29
-1
 public function save()
 {
     $this->begin();
     $mdl_bills = $this->app->model('bills');
     if (!$_POST['bill_id']) {
         $this->end(false);
     }
     $bill = $mdl_bills->dump($_POST['bill_id']);
     if ($_POST['status'] && $bill['status'] != $_POST['status'] && ($bill['status'] != 'ready' || $bill['status'] != 'progress')) {
         $bill['status'] = $_POST['status'];
         $bill['payer_account'] = $_POST['payer_account'];
         $bill['payer_bank'] = $_POST['payer_bank'];
         $bill['out_trade_no'] = $_POST['out_trade_no'];
         $bill['memo'] = $_POST['memo'];
         $bill['pay_app_id'] = '-1';
         //手动即线下
         $flag = vmc::singleton('ectools_bill')->generate($bill, $msg);
         $this->end($flag, $msg);
     } else {
         $up_data['payer_account'] = $_POST['payer_account'];
         $up_data['payer_bank'] = $_POST['payer_bank'];
         $up_data['out_trade_no'] = $_POST['out_trade_no'];
         $up_data['memo'] = $_POST['memo'];
         $flag = $mdl_bills->update($up_data, array('bill_id' => $_POST['bill_id']));
         $this->end($flag);
     }
 }
Beispiel #30
-1
 public function create($intext, $long_touch)
 {
     $mdl_image = app::get('image')->model('image');
     if ($exits_image = $mdl_image->dump(md5($intext . $long_touch))) {
         return $exits_image;
     }
     $tmp_file = tempnam(TMP_DIR, 'qrcode');
     wechat_qrcode_QRcode::png($intext, $tmp_file, 'L', 8, 4);
     list($w, $h, $type) = getimagesize($tmp_file);
     if ($long_touch) {
         //加入额外图像
         $resize_tmp_file = tempnam(TMP_DIR, 'qrcode_resize');
         $image_tool = vmc::singleton('image_tools_gd');
         $image_tool->resize($tmp_file, $resize_tmp_file, $w, $h, $type, $w + 180, $h + 220, false, 20);
         $water_file = PUBLIC_DIR . '/misc/long_touch.gif';
         list($w_w, $w_h, $w_type) = getimagesize($water_file);
         $warermark_set = array('wm_opacity' => 100, 'watermark_width' => $w_w, 'watermark_height' => $w_h, 'type' => $w_type, 'src_width' => $w + 180, 'src_height' => $h + 180, 'dest_x' => ($w + 180 - 120) / 2, 'dest_y' => $h + 50);
         $image_tool->watermark($resize_tmp_file, $water_file, $warermark_set);
     }
     $storager = new base_storager();
     if ($long_touch) {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($resize_tmp_file, 'image', '', $msg, '.png'));
     } else {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($tmp_file, 'image', '', $msg, '.png'));
     }
     $tmp_qrcode_image = array('image_id' => md5($intext . $long_touch), 'storage' => $storage, 'image_name' => 'TMP_QRCODE', 'ident' => $ident, 'url' => $url, 'width' => $w, 'height' => $h, 'last_modified' => time());
     $mdl_image->save($tmp_qrcode_image);
     unlink($tmp_file);
     if ($long_touch) {
         unlink($resize_tmp_file);
     }
     return $tmp_qrcode_image;
 }