protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $num_iid = MRequest::post('iid');
     //  商品id
     $cid = MRequest::post('cid');
     //  分类id
     $title = MRequest::post('title');
     $imgmd5 = MRequest::post('imgmd5');
     $imgtype = MRequest::post('imgtype');
     $price = MRequest::post('price');
     $stock = null;
     // $stock = MRequest::post('stock');
     $onsale = MRequest::post('onsale');
     $listtime = MRequest::post('listtime');
     $delisttime = MRequest::post('delisttime');
     $listtime = strtotime($listtime);
     $delisttime = strtotime($delisttime);
     DalItem::beginTransaction();
     try {
         DalItem::updateShopItem($num_iid, $shop->getID(), $cid, $title, $imgmd5, $imgtype, $price, $stock, $onsale, $listtime, $delisttime);
         $item = DalItem::getShopItem($shop->getID(), $num_iid, 'w');
         if (!$item) {
             throw new Exception("item not exists", -100);
         }
     } catch (Exception $e) {
         DalItem::rollback();
         return MJsonRespond::respondFail($e->getMessage());
     }
     DalItem::commit();
     return MJsonRespond::respondSuccess('成功', array('item' => $item));
 }
示例#2
0
    function _default()
    {
        $this->authAndDie("open");
        $syntax = MRequest::clean("syntax");
        $sid = MRequest::int("sid", null);
        $height = MRequest::int("height", 550);
        $syntax = $syntax == "text" ? "robotstxt" : $syntax;
        header('Content-type: text/javascript');
        echo '
		var mCodeMirror' . $sid . ' = CodeMirror.fromTextArea(
				_("mEditArea-' . $sid . '"), 
				{  lineNumbers: true,
				   theme: "eclipse",
				   matchBrackets: true,
				   mode: "' . $syntax . '",
				   indentUnit: 4,
				   indentWithTabs: true,
				   enterMode: "keep",
				   tabMode: "shift"
  				});
  				
  		mCodeMirror' . $sid . '.setSize("100%","' . $height . 'px");	
		';
        exit;
    }
示例#3
0
 public function edit()
 {
     MRequest::setVar('hidemainmenu', 1);
     MRequest::setVar('view', 'edit');
     MRequest::setVar('edit', true);
     parent::display();
 }
示例#4
0
 public function run()
 {
     // Check for request forgeries
     //MRequest::checkToken() or mexit('Invalid Token');
     MRequest::setVar('view', 'miwosql');
     parent::display();
 }
示例#5
0
 protected static function _loadBehavior($group, $params = array())
 {
     static $loaded = array();
     if (!array_key_exists($group, $loaded)) {
         $loaded[$group] = true;
         // Include mootools framework.
         MHtml::_('behavior.framework', true);
         $document = MFactory::getDocument();
         $display = isset($params['startOffset']) && isset($params['startTransition']) && $params['startTransition'] ? (int) $params['startOffset'] : null;
         $show = isset($params['startOffset']) && !(isset($params['startTransition']) && $params['startTransition']) ? (int) $params['startOffset'] : null;
         $options = '{';
         $opt['onActive'] = "function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_" . $group . "',\$\$('div#" . $group . ".pane-sliders > .panel > h3').indexOf(toggler));}";
         $opt['onBackground'] = "function(toggler, i) {toggler.addClass('pane-toggler');" . "toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if(\$\$('div#" . $group . ".pane-sliders > .panel > h3').length==\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_" . $group . "',-1);}";
         $opt['duration'] = isset($params['duration']) ? (int) $params['duration'] : 300;
         $opt['display'] = isset($params['useCookie']) && $params['useCookie'] ? MRequest::getInt('jpanesliders_' . $group, $display, 'cookie') : $display;
         $opt['show'] = isset($params['useCookie']) && $params['useCookie'] ? MRequest::getInt('jpanesliders_' . $group, $show, 'cookie') : $show;
         $opt['opacity'] = isset($params['opacityTransition']) && $params['opacityTransition'] ? 'true' : 'false';
         $opt['alwaysHide'] = isset($params['allowAllClose']) && !$params['allowAllClose'] ? 'false' : 'true';
         foreach ($opt as $k => $v) {
             if ($v) {
                 $options .= $k . ': ' . $v . ',';
             }
         }
         if (substr($options, -1) == ',') {
             $options = substr($options, 0, -1);
         }
         $options .= '}';
         $js = "jQuery(document).ready(function () { new Fx.Accordion(\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler'), \$\$('div#" . $group . ".pane-sliders > .panel > div.pane-slider'), " . $options . "); });";
         $document->addScriptDeclaration($js);
     }
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     //  所属类别id
     $title = MRequest::request('title');
     $imgmd5 = MRequest::request('imgmd5');
     //  图片MD5
     $imgtype = MRequest::request('imgtype');
     //  图片类型(image/png, image/jpeg)
     $price = MRequest::request('price');
     // $stock = MRequest::request('stock');    //  库存
     $stock = 999;
     //  库存
     $onsale = MRequest::request('onsale');
     //  是否在售
     $listtime = MRequest::request('listtime');
     //  上架时间
     $delisttime = MRequest::request('delisttime');
     //  下架时间
     $listtime = strtotime($listtime);
     $delisttime = strtotime($delisttime);
     DalItem::beginTransaction();
     try {
         DalItem::addItem($shop->getID(), $cid, $title, $imgmd5, $imgtype, $price, $stock, $onsale, $listtime, $delisttime);
         $num_iid = DalItem::getInsertId();
         $item = DalItem::getShopItem($shop->getID(), $num_iid, 'w');
         DalItem::commit();
     } catch (Exception $e) {
         DalItem::rollback();
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功', array('item' => $item));
 }
示例#7
0
文件: edit.php 项目: vanie3/appland
 public function cancel()
 {
     // Check for request forgeries
     MRequest::checkToken() or mexit('Invalid Token');
     $vars = '&ja_tbl_g=' . base64_encode($this->_table) . '&ja_qry_g=' . base64_encode($this->_query);
     $this->setRedirect('index.php?option=com_miwosql' . $vars, $msg);
 }
示例#8
0
 function display($tpl = null)
 {
     $mainframe = MFactory::getApplication();
     $option = MRequest::getCmd('option');
     $document = MFactory::getDocument();
     $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
     MToolBarHelper::title(MText::_('MiwoSQL') . ' - ' . MText::_('COM_MIWOSQL_SAVED_QUERIES'), 'miwosql');
     MToolBarHelper::editList();
     MToolBarHelper::deleteList();
     // ACL
     if (version_compare(MVERSION, '1.6.0', 'ge') && MFactory::getUser()->authorise('core.admin', 'com_miwosql')) {
         MToolBarHelper::divider();
         MToolBarHelper::preferences('com_miwosql', '550');
     }
     $this->mainframe = MFactory::getApplication();
     $this->option = MRequest::getWord('option');
     $filter_order = $mainframe->getUserStateFromRequest($option . '.queries.filter_order', 'filter_order', 'title', 'string');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.queries.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($option . '.queries.search', 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->lists = $lists;
     $this->items = $this->get('Data');
     $this->pagination = $this->get('Pagination');
     parent::display($tpl);
 }
示例#9
0
	public static function _(){
		$isSaved = MRequest::getCookie("profilesissaved",0, MREQUEST_INT);
		
		if($isSaved){
			MRequest::setCookie("profilesissaved", 0);
			$css = _FM_IS_DEMO ? "rejectedAdvice" : "savedAdvice";
			$text = _FM_IS_DEMO ? "notfordemo" : "datasaved";
			echo '
				<div id="mSavedAdvice" class="'.$css.'"><div>'.MText::_($text).'</div></div>
				<script type="text/javascript">
					dojo.addOnLoad(function(){
							var node = dojo.byId("mSavedAdvice");
							dojo.style(node,{opacity: 0});
							_fx.fadeOpacity(node,300,0,1,function(){
								setTimeout(function(){
									var node = dojo.byId("mSavedAdvice");
									dojo.style(node,{opacity: 1});
									_fx.fadeOpacity(node,400,1,0,function(){
										 _removeNode(dojo.byId("mSavedAdvice"));
									});
								},2000);
							});
					});
				</script>
			';
		}
		
		
	}
 public function pageExecute()
 {
     $shopname = MRequest::post('shopname');
     $username = MRequest::post('username');
     $password = MRequest::post('password');
     $email = MRequest::post('email');
     $this->assign('shopname', $shopname);
     $this->assign('email', $email);
     $this->page = 'sign/validemail.tpl.php';
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $numiid = MRequest::get('iid');
     try {
         $item = $shop->getItem($numiid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('获取商品列表失败');
     }
     return MJsonRespond::respondSuccess('成功', array('item' => $item->getMain()));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $num_iid = MRequest::request('iid');
     try {
         DalItem::deleteShopItem($num_iid, $shop->getID());
         Observer::postNotify('item.delete', $num_iid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('删除失败');
     }
     return MJsonRespond::respondSuccess('成功');
 }
 public function execute()
 {
     $username = MRequest::post('username');
     $password = MRequest::post('password');
     $md5password = md5($password);
     $me = MUser::signin($username, $md5password);
     if (!$me) {
         redirect('/signin');
         return;
     }
     redirect('/');
 }
示例#14
0
 function _default()
 {
     $isGet = MRequest::int("isget");
     $name = MRequest::clean("name");
     $value = MRequest::clean("value");
     if (isGet == 1) {
         $this->view->add2Content($_COOKIE["name"]);
     } else {
         setcookie($name, $value, _FM_COOKIE_EXPIRE);
         $this->view->add2Content("1");
     }
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $oid = MRequest::request('oid');
     try {
         LibOrder::shipShopOrder($shop->getID(), $oid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     $order = DalOrder::getShopOrder($shop->getID(), $oid);
     $order = array_pop(LibOrder::fillOrders(array($order)));
     return MJsonRespond::respondSuccess('成功', array('order' => $order));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     $newName = MRequest::request('name');
     try {
         $shop->updateCategory($cid, $newName);
         $category = $shop->getCategory($cid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('更新失败');
     }
     return MJsonRespond::respondSuccess('成功', array('category' => $category));
 }
 public function execute()
 {
     $shopname = MRequest::post('shopname');
     $username = MRequest::post('username');
     $password = MRequest::post('password');
     $email = MRequest::post('email');
     $md5Password = md5($password);
     $uid = LibPCUser::signup($username, $password, $email);
     LibPCUser::setUserVerification($uid);
     DalShop::addOrUpdateShop($shopname, $uid, '', '', '', '', '', 1, 0);
     // redirect('/valid-email');
     redirect('/dashboard/shop/geo');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     try {
         $shop->deleteCategory($cid);
     } catch (Exception $e) {
         if (in_array($e->getCode(), array(ERR_CATEGORY_NOT_EXIST))) {
             return MJsonRespond::respondFail($e->getMessage());
         }
         return MJsonRespond::respondFail('删除失败');
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $lng = MRequest::post('lng');
     $lat = MRequest::post('lat');
     $address = MRequest::post('address');
     $radius = MRequest::post('radius');
     $servetime = MRequest::post('servetime');
     try {
         DalShop::addOrUpdateShopGeo($shop->getID(), $lng, $lat, $address, $radius, $servetime);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $img = MRequest::file('img');
     $tmpName = $img['tmp_name'];
     $md5 = md5_file($tmpName);
     $imgPath = MShopImageService::getImagePath($md5, true);
     if (!move_uploaded_file($tmpName, $imgPath)) {
         return MJsonRespond::respondFail();
     }
     $imgType = $img['type'];
     $imgUrl = MShopImageService::getImageUrl($md5);
     $response = array('md5' => $md5, 'imgType' => $imgType, 'imgUrl' => $imgUrl);
     return MJsonRespond::respondSuccess('上传成功', $response);
 }
 protected function signinExecute(MUser $me)
 {
     $img = MRequest::file('img');
     $context = MRequest::request('context');
     $tmpName = $img['tmp_name'];
     $md5 = md5_file($tmpName);
     $imgPath = MShopImageService::getImagePath($md5, true);
     if (!move_uploaded_file($tmpName, $imgPath)) {
         echo '<script>try{ window.parent.uploadImageFail(-1, "upload fail", "' . $context . '");}catch(e){}</script>';
         return;
     }
     $imgType = $img['type'];
     $imgUrl = MShopImageService::getImageUrl($md5);
     echo '<script>try{ window.parent.uploadImageSuccess("' . $md5 . '","' . $imgType . '", "' . $imgUrl . '", "' . $context . '");}catch(e){}</script>';
 }
 protected function ajaxExecute()
 {
     $tel = MRequest::request('tel');
     $invitecode = MRequest::request('invitecode');
     try {
         $verify = DalUser::getUserVerify($tel);
         if ($verify) {
             return MJsonRespond::respond(ERR_VERIFY_CODE_ALREADY_SEND, '验证码已发出,请不要频繁请求');
         }
         $verify = LibUser::generateUserVerify($tel, $invitecode);
         //TODO:send verify code
     } catch (DBException $e) {
         return MJsonRespond::respondFail('获取验证码失败');
     }
     return MJsonRespond::respondSuccess('获取验证码成功', array('verify' => $verify));
 }
示例#23
0
 public function delete($table)
 {
     $sql = MiwosqlHelper::getVar('qry');
     $key = MRequest::getString('key', null, 'get');
     if (!is_null($sql) && !is_null($key)) {
         $id = MRequest::getCmd('id', null, 'get');
         $this->_db->setQuery("DELETE FROM {$table} WHERE {$key} = '{$id}'");
         $this->_db->query();
         if (!empty($this->_db->_errorMsg)) {
             echo '<small style="color:red;">' . $this->_db->_errorMsg . '</small><br/>';
             return false;
         } else {
             return true;
         }
     }
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::post('cid');
     $ps = (int) MRequest::post('ps');
     $pn = (int) MRequest::post('pn');
     $ps = max(0, $ps);
     if (!$pn) {
         $pn = 20;
     }
     try {
         $itemlist = $shop->getShopItems($cid, $ps, $pn);
         $foundrows = $shop->totalCount();
     } catch (Exception $e) {
         return MJsonRespond::respondFail('获取商品列表失败');
     }
     return MJsonRespond::respondSuccess('成功', array('itemlist' => $itemlist, 'total' => $foundrows));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $shopname = MRequest::post('shopname');
     $intro = MRequest::post('intro');
     $imgmd5 = MRequest::post('imgmd5');
     $imgtype = MRequest::post('imgtype');
     $tel = MRequest::post('tel');
     $bulletin = '';
     $qq = '';
     $email = '';
     try {
         DalShop::updateShop($shop->getID(), $shopname, $intro, $bulletin, $qq, $tel, $email, $imgmd5, $imgtype);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $parent_cid = intval(MRequest::request('parent_cid'));
     $name = MRequest::request('name');
     $sid = $shop->getID();
     $intro = '';
     try {
         $cid = $shop->addCategory($parent_cid, $name, time());
     } catch (DBException $e) {
         return MJsonRespond::respondFail('创建失败');
     }
     try {
         $category = DalCategory::getCategory($cid, $shop->getID());
     } catch (DBException $e) {
         return MJsonRespond::respondFail('数据库访问失败');
     }
     return MJsonRespond::respondSuccess('创建成功', array('category' => $category));
 }
示例#27
0
 public function remove()
 {
     // Check for request forgeries
     MRequest::checkToken() or jexit('Invalid Token');
     $cid = MRequest::getVar('cid', array(), '', 'array');
     MArrayHelper::toInteger($cid);
     $msg = '';
     for ($i = 0, $n = count($cid); $i < $n; $i++) {
         $query = MTable::getInstance('Query', 'Table');
         if (!$query->delete($cid[$i])) {
             $msg .= $query->getError();
             $tom = "error";
         } else {
             $msg = MTEXT::_('COM_MIWOSQL_QUERY_DELETED');
             $tom = "";
         }
     }
     $this->setRedirect('index.php?option=com_miwosql&controller=queries', $msg, $tom);
 }
示例#28
0
    function save()
    {
        if (!MRights::can("edit")) {
            return $this->_noAuth("edit");
        }
        global $dir;
        $is_close = MRequest::int("close", 0);
        $info = MFile::info($dir);
        $content = MRequest::raw("content");
        $sid = MRequest::int("sid", null);
        MFile::writeData($dir, $content);
        if ($is_close) {
            $this->view->content('<script noCache="1">
					_Delayed500(function(){
					_LoadTo("' . MURL::_("xhrfiles", MURL::safePath($info->dirName)) . '", "splitInnerRight", function() {
					parseAll(_("splitInnerRight")); evalButtons();});  });
					closePopup("Edit' . $sid . '");</script>');
        } else {
            $this->_default();
            $this->view->add2Content('
				<div id="mSavedAdvice" class="savedAdvice"><div>' . MText::_("saved") . '</div></div>
				<script noCache="1" type="text/javascript">
					dojo.addOnLoad(function(){
							var node = dojo.byId("mSavedAdvice");
							dojo.style(node,{opacity: 0});
							_fx.fadeOpacity(node,300,0,1,function(){
								setTimeout(function(){
									var node = dojo.byId("mSavedAdvice");
									dojo.style(node,{opacity: 1});
									_fx.fadeOpacity(node,400,1,0,function(){
										 _removeNode(dojo.byId("mSavedAdvice"));
									});
								},2000);
							});
					});
				</script>
			');
        }
    }
示例#29
0
文件: config.php 项目: utopszkij/lmp
 public function main()
 {
     global $task;
     $isSend = MRequest::int("send", 0);
     $_task = !$task || $task == "default" ? "main" : $task;
     $this->view->add2Menu(MConfigHelper::getMenu());
     $config = MConfig::instance();
     $err = array();
     if ($isSend) {
         $request = $config->request();
         if (!sizeof($request->error)) {
             if (!_FM_IS_DEMO) {
                 $config->mixinAndSave($request->data);
             }
             MPeer::redirect(MURL::_("config", null, "main") . MSaved::url());
         } else {
             $config->mixin($request->data);
             $err = $request->error;
         }
     }
     $this->view->add2Content(MConfigHelper::generate($_task, $config, $err));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $ps = (int) MRequest::get('ps');
     $pn = (int) MRequest::get('pn');
     $sid = $shop->getID();
     $status = (int) MRequest::get('st');
     $sort = (int) MRequest::get('sort');
     $ps = max(0, $ps);
     if (!$pn) {
         $pn = 20;
     }
     if ($sort === 0) {
         $orders = DalOrder::getShopEarliestOrders($sid, $status, $ps, $pn);
     } else {
         $orders = DalOrder::getShopLatestOrders($sid, $status, $ps, $pn);
     }
     $total = DalOrder::totalCount();
     if (empty($orders)) {
         return MJsonRespond::respondSuccess('', array('orders' => $orders, 'total' => $total));
     }
     $orders = LibOrder::fillOrders($orders);
     return MJsonRespond::respondSuccess('成功', array('orders' => $orders, 'total' => $total));
 }