public function modifypwdAction() { $post = $this->request->getPost(); if (!$this->request->isPost()) { $this->view->setVariable("loginInfo", $this->adminInfo); return $this->view; } else { if (empty($this->adminInfo)) { return $this->response(AdminError::COMMON_ERROR, '请登录'); } else { if (empty($post['oldPassword']) || empty($post['newPassword']) || empty($post['confirmPassword'])) { return $this->response(AdminError::COMMON_ERROR, '新、旧和确认密码不可为空'); } if ($post['newPassword'] != $post['confirmPassword']) { return $this->response(AdminError::COMMON_ERROR, '新密码和确认密码不一致'); } if (md5($post['oldPassword']) != $this->adminInfo['passwd']) { return $this->response(AdminError::COMMON_ERROR, '老密码错误'); } $set['passwd'] = md5($post['newPassword']); $where['adminID'] = $this->adminInfo['adminID']; $status = $this->adminModel->update($set, $where); if ($status) { $session = new \Zend\Authentication\Storage\Session(self::ADMIN_PLATFORM, null, null); $loginInfo = $session->read(); $this->adminInfo['passwd'] = $loginInfo['passwd'] = $set['passwd']; $session->clear(); $session->write($loginInfo); return $this->response(AdminSuccess::COMMON_SUCCESS, '密码修改成功'); } else { return $this->response(AdminError::COMMON_ERROR, '密码修改失败'); } } } }
public function onBootstrap(MvcEvent $e) { $eventManager = $e->getApplication()->getEventManager(); $serviceManager = $e->getApplication()->getServiceManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); // $this->getDbDatos($e); $app = $e->getApplication(); $app->getEventManager()->getSharedManager()->attach('Zend\\Mvc\\Controller\\AbstractActionController', 'dispatch', function ($e) { $locator = $e->getApplication()->getServiceManager(); $authAdapter = $locator->get('AuthService'); $authAdapter2 = $locator->get('AuthService2'); $controller = $e->getTarget(); $routeMatch = $e->getRouteMatch(); // $actionName = $routeMatch->getParam('action', 'not-found'); $actionName = 'auth//authenticate'; $controller->layout()->form = new \SanAuth\Form\UserForm(); $controller->layout()->formCambio = new \SanAuth\Form\PasswordForm(); $controller->layout()->formActualizar = new \SanAuth\Form\UpdatepassForm(); $controller->layout()->accion3 = '/cambio'; // $controller->layout()->accion3 = '/cambio'; $controller->layout()->accion = $actionName; if ($actionName == 'login') { if ($authAdapter->hasIdentity() === true or $authAdapter2->hasIdentity() === true) { $storage = new \Zend\Authentication\Storage\Session('Auth'); $session = $storage->read(); $controller->layout()->session = $session; return $controller->redirect()->toRoute('home'); } else { return; } } else { $storage = new \Zend\Authentication\Storage\Session('Auth'); $session = $storage->read(); $controller->layout()->session = $session; return; } }, 100); }
public function terminosAction() { $view = new ViewModel(); $comidas = $this->joinAction()->toArray(); $storage = new \Zend\Authentication\Storage\Session('Auth'); $session = $storage->read(); if (!isset($session)) { $face = new \Usuario\Controller\ClientesController(); $facebook = $face->facebook(); $this->layout()->loginUrl = $facebook['loginUrl']; $this->layout()->user = $facebook['user']; if ($facebook['id_facebook']) { $url = '/terminos'; $id_face = $this->getClientesTable()->usuarioface($facebook['email']); if (count($id_face) > 0) { if ($id_face[0]['id_facebook'] == '') { $this->getClientesTable()->idfacebook($id_face[0]['in_id'], $facebook['id_facebook'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } else { $this->getClientesTable()->idfacebook2($id_face[0]['in_id'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } } else { $this->getClientesTable()->insertarusuariofacebbok($facebook['name'], $facebook['email'], $facebook['id_facebook'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } } } $this->layout()->comidas = $comidas; // $this->layout('layout/layout-portada'); $this->layout()->clase = 'Terminos'; }
public function loginAction() { $view = new ViewModel(); $this->layout('layout/layout-portada2'); $renderer = $this->serviceLocator->get('Zend\\View\\Renderer\\RendererInterface'); $renderer->inlineScript()->prependFile($this->_options->host->base . '/js/main.js'); $storage = new \Zend\Authentication\Storage\Session('Auth'); $session = $storage->read(); if (!isset($session)) { $face = new \Usuario\Controller\ClientesController(); $facebook = $face->facebook(); $this->layout()->login = $facebook['loginUrl']; $this->layout()->user = $facebook['user']; } $token = $this->params()->fromQuery('token'); if ($token) { $usuario = $this->getClientesTable()->clientes($token); if (count($usuario) > 0) { $this->getClientesTable()->cambiarestado($usuario[0]['in_id']); $mensaje = 'Bienvenido ' . ucwords($usuario[0]['va_nombre_cliente']) . '. Tu cuenta ya esta lista para usarse. '; return new JsonModel(array('menssage' => $mensaje, 'success' => true)); return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/'); } else { $mensaje = 'Esta cuenta ya ha sido activada. Inicie Sesión. '; return new JsonModel(array('menssage' => $mensaje, 'success' => false)); return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/'); } } $form = $this->getForm(); $flashMessenger = $this->flashMessenger(); if ($flashMessenger->hasMessages()) { $mensajes = $flashMessenger->getMessages(); } $view->setVariables(array('form' => $form, 'mensaje' => $mensaje, 'messages' => $mensajes)); return $view; }
public function verplatosAction() { $view = new ViewModel(); if ($_GET['callback']) { header('Content-type: application/x-javascript'); header("Status: 200"); $idplato = (int) $this->params()->fromQuery('id'); $nombre = $this->params()->fromQuery('va_nombre'); $email = $this->params()->fromQuery('va_email'); $comentario = $this->params()->fromQuery('tx_descripcion'); $puntaje = (int) $this->params()->fromQuery('Ta_puntaje_in_id'); $validar = explode('http://', $comentario); if (count($validar) == 2) { $result = array('resultado' => false); echo "jsonpCallback(" . json_encode($result) . ")"; } else { $comentario = $comentario; $envia = array('Ta_plato_in_id' => $idplato, 'va_nombre' => $nombre, 'va_email' => $email, 'tx_descripcion' => $comentario, 'Ta_puntaje_in_id' => $puntaje); $cantidad = $this->getClientesTable()->usuario1($email); if (count($cantidad) == 0) { $this->getClientesTable()->agregarComentariomovil($envia); ClientesController::correomovill($email, $nombre); } else { $this->getClientesTable()->agregarComentariomovil($envia); } $this->getPlatosTable()->cromSolr($idplato, ''); $result = array('resultado' => true); echo "jsonpCallback(" . json_encode($result) . ")"; } exit; $view->setTerminal(true); return $view; } $datos = $this->params()->fromRoute(); $storage = new \Zend\Authentication\Storage\Session('Auth'); $session = $storage->read(); if ($session) { $participa = $this->getClientesTable()->compruebarUsuariox($session->in_id); $activo = $participa->en_estado; } if (!isset($session)) { $face = new \Usuario\Controller\ClientesController(); $facebook = $face->facebook(); $this->layout()->loginUrl = $facebook['loginUrl']; $this->layout()->user = $facebook['user']; if ($facebook['id_facebook']) { $url = $_SERVER['REQUEST_URI']; //$url='/plato/'.$datos['nombre'].'/'.$datos['nombre']; // $url='/plato/'.$datos['nombre']; $id_face = $this->getClientesTable()->usuarioface($facebook['email']); if (count($id_face) > 0) { if ($id_face[0]['id_facebook'] == '') { $this->getClientesTable()->idfacebook($id_face[0]['in_id'], $facebook['id_facebook'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } else { $this->getClientesTable()->idfacebook2($id_face[0]['in_id'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } } else { $this->getClientesTable()->insertarusuariofacebbok($facebook['name'], $facebook['email'], $facebook['id_facebook'], $facebook['logoutUrl']); AuthController::sessionfacebook($facebook['email'], $facebook['id_facebook'], $url); } } } $urlerror = $datos['nombre']; $nombre = explode('-', $datos['nombre']); $id = array_pop($nombre); $listarecomendacion = $this->getPlatosTable()->getPlatoxRestaurant($id)->toArray(); // if(count($listarecomendacion)<1) // {$this->redirect()->toUrl('/');} $texto = 'restaurante:"' . $listarecomendacion[0]['restaurant_nombre'] . '"'; $limit = 10; $palabraBuscar = isset($texto) ? $texto : false; $query = "({$palabraBuscar})"; $fq = array('fq' => 'en_estado:activo AND restaurant_estado:activo AND -id:' . $listarecomendacion[0]['in_id'], 'wt' => 'json'); $results = false; if ($query) { $solr = \Classes\Solr::getInstance()->getSolr(); if (get_magic_quotes_gpc() == 1) { $query = stripslashes($query); } try { $results = $solr->search($query, 0, $limit, $fq); } catch (Exception $e) { echo "<div>ingrese algun valor</div>"; } } if (count($results->response->docs) < 10) { if (count($results->response->docs) == 0) { $consulta = $this->consultaAction(10, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 1) { $consulta = $this->consultaAction(9, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 2) { $consulta = $this->consultaAction(8, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 3) { $consulta = $this->consultaAction(7, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 4) { $consulta = $this->consultaAction(6, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 5) { $consulta = $this->consultaAction(5, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 6) { $consulta = $this->consultaAction(4, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 7) { $consulta = $this->consultaAction(3, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 8) { $consulta = $this->consultaAction(2, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } elseif (count($results->response->docs) == 9) { $consulta = $this->consultaAction(1, $listarecomendacion[0]['in_id'], $listarecomendacion[0]['tipo_plato_nombre']); $resultados = $results->response->docs; } } else { $resultados = $results->response->docs; } $servicios = $this->getPlatosTable()->getServicioxPlato($id); $locales = $this->getPlatosTable()->getLocalesxRestaurante($listarecomendacion[0]['restaurant_id']); $pagos = $this->getPlatosTable()->getPagoxPlato($id); $form = new \Usuario\Form\ComentariosForm(); $canonical = new \Application\View\Helper\Canonical(); $canonicalurl = new \Application\View\Helper\CanonicalUrl(); $resta = $canonicalurl($canonical($listarecomendacion[0]['restaurant_nombre'])); $form->get('submit')->setValue('Agregar'); $request = $this->getRequest(); if ($request->isPost()) { if ($session) { $datos = $this->getRequest()->getPost()->toArray(); $datos['Ta_plato_in_id'] = $id; $datos['tx_descripcion'] = htmlspecialchars($datos['tx_descripcion']); $validar = explode('http://', $datos['tx_descripcion']); // if(count($validar)==2){ // return $this->redirect()->toUrl('/plato/'.$urlerror.'?m=1'); // } // else { $form->setData($datos); if (!$form->isValid()) { $this->getComentariosTable()->agregarComentario($form->getData(), $participa->in_id); $this->getComentariosTable()->cromSolar($id, ''); $datos = $this->params()->fromRoute(); if ($datos['tx_descripcion']) { $this->redirect()->toUrl('/plato/' . $resta . '/' . $datos['nombre']); } } //} } } $this->layout()->clase = 'Detalle'; $listarcomentarios = $this->getPlatosTable()->getComentariosxPlatos($id); $paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\Iterator($listarcomentarios)); $paginator->setCurrentPageNumber((int) $this->params()->fromQuery('page', 1)); $paginator->setItemCountPerPage(10); $config = $this->getServiceLocator()->get('Config'); $this->layout()->title = $listarecomendacion[0]['va_nombre']; $this->layout()->image = $listarecomendacion[0]['va_imagen'] == 'platos-default.png' ? $config['host']['images'] . '/defecto/' . $listarecomendacion[0]['va_imagen'] : $config['host']['images'] . '/plato/principal/' . $listarecomendacion[0]['va_imagen']; $this->layout()->description = trim($listarecomendacion[0]['restaurant_nombre']) . '-' . trim($listarecomendacion[0]['tx_descripcion']) . '-' . trim($listarecomendacion[0]['va_direccion']) . '-' . trim($listarecomendacion[0]['va_direccion_referencia'] . '-(' . trim($listarecomendacion[0]['distrito']) . ')- teléfono:' . trim($listarecomendacion[0]['va_telefono'])); $this->layout()->url = $config['host']['ruta'] . '/plato/' . $resta . '/' . $datos['nombre']; $listatitle = trim($listarecomendacion[0]['va_nombre']) . ':' . trim($listarecomendacion[0]['tx_descripcion']) . ':' . trim($listarecomendacion[0]['tipo_plato_nombre']) . ':' . trim($listarecomendacion[0]['restaurant_nombre']) . ':' . trim($listarecomendacion[0]['distrito']) . ' │ '; $menu = $this->menu(); $view->setVariables(array('lista' => $listarecomendacion, 'comentarios' => $paginator, 'form' => $form, 'servicios' => $servicios, 'urlplato' => $id, 'urlnombre' => $datos['nombre'], 'pagos' => $pagos, 'locales' => $locales, 'cantidad' => $this->getCount($listarcomentarios), 'variable' => $id, 'listatitle' => $listatitle, 'masplatos' => $resultados, 'listades' => $consulta, 'menus' => $menu, 'session' => $session, 'resta' => $resta, 'participa' => $activo)); return $view; }
public function miseventosAction() { $renderer = $this->serviceLocator->get('Zend\\View\\Renderer\\RendererInterface'); $renderer->inlineScript()->prependFile($this->_options->host->base . '/js/main.js')->prependFile($this->_options->host->base . '/js/masonry/post-like.js')->prependFile($this->_options->host->base . '/js/masonry/superfish.js')->prependFile($this->_options->host->base . '/js/masonry/prettify.js')->prependFile($this->_options->host->base . '/js/masonry/retina.js')->prependFile($this->_options->host->base . '/js/masonry/jquery.masonry.min.js')->prependFile($this->_options->host->base . '/js/masonry/jquery.infinitescroll.min.js')->prependFile($this->_options->host->base . '/js/masonry/custom.js'); $categorias = $this->getGrupoTable()->tipoCategoria(); $this->layout()->categorias = $categorias; if ($_COOKIE['tipo'] or $_GET['tipo'] or $_GET['valor']) { if ($_COOKIE['tipo'] == 'Eventos' or $_GET['tipo'] == 'Eventos' or $_GET['valor'] == 'Eventos') { $this->layout()->active1 = 'active'; } else { $this->layout()->active = 'active'; } } else { $this->layout()->active = 'active'; } $id = $this->params()->fromQuery('id'); $storage = new \Zend\Authentication\Storage\Session('Auth'); // var_dump($storage->read()->va_imagen);exit; $id = $storage->read()->in_id; $miseventos = $this->getEventoTable()->miseventos($id); if (count($miseventos) == 0) { $mensaje = 'Aún no has creado ningún evento, ¿qué esperas para crear uno?'; } $valor = $this->headerAction($id); $paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\Iterator($miseventos)); $paginator->setCurrentPageNumber((int) $this->params()->fromQuery('page', 1)); $paginator->setItemCountPerPage(12); return array('grupo' => $valor, 'miseventos' => $paginator, 'mensaje' => $mensaje); }