Exemplo n.º 1
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $goodies = Model_Pages::getPage(Helper_Config::get('page_goodies'));
     $pin_text = $this->translate('Pyng images from any website as you browse the web with the %s"Pyng It" button.%s');
     if ($goodies) {
         $this->view->pin_text = sprintf($pin_text, '<a href="' . WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_goodies')) . '">', '</a>');
     }
     $methods = glob(dirname(__FILE__) . '/Addpin/*.php');
     $this->view->methods = array();
     if ($methods) {
         $front = $this->getFrontController();
         foreach ($methods as $row => $method) {
             $controller = basename($method, 'Controller.php');
             if ($controller) {
                 $name = $front->formatControllerName('addpin_' . strtolower($controller));
                 if (!class_exists($name, true)) {
                     JO_Loader::loadClass($name);
                 }
                 $instance = new $name();
                 $this->view->methods[isset($instance->SORT) ? $instance->SORT : 0] = $this->view->callChildren('addpin_' . strtolower($controller));
             }
         }
     }
     ksort($this->view->methods);
     $this->view->popup_main_box = $this->view->render('popup_main', 'addpin');
     if ($request->isXmlHttpRequest()) {
         $this->noViewRenderer(true);
         echo $this->view->popup_main_box;
     } else {
         $this->forward('error', 'error404');
     }
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     $request = $this->getRequest();
     /*//get pins data
     		if($request->isXmlHttpRequest()) {
     			$this->forward('videos', 'getPins');
     		}*/
     ///// get pins
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $this->view->result_data = '';
     if (!Helper_Config::get('config_disable_js')) {
         //get pins data
         if ($request->isXmlHttpRequest()) {
             $this->forward('videos', 'getPins');
         }
     } else {
         if ($page > 1 && $request->isXmlHttpRequest()) {
             $this->forward('videos', 'getPins');
         }
         $pins = (array) $this->getPinsAction(true);
         foreach ($pins as $pin) {
             $template = new Helper_Tmpl($pin['template'], $pin);
             $this->view->result_data .= $template->render($pin['template']);
         }
     }
     //call header and footer childrens
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Exemplo n.º 3
0
 public function __construct($data = array())
 {
     $db = JO_Db::getDefaultAdapter();
     //select default pin data
     $query = self::getListPinsQueryLite();
     if (isset($data['cover']) && $data['cover']) {
         $query->where('pins.pin_id = ?', (string) $data['cover']);
     } else {
         $query->where('pins.pin_id = 0');
     }
     if (isset($data['pins']) && count($data['pins'])) {
         $query->orWhere('pins.pin_id IN (?)', new JO_Db_Expr(implode(',', $data['pins'])));
     } else {
         $query->orWhere('pins.pin_id = 0');
     }
     //v2.2
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $query = self::filterFriend($query);
     }
     //sort and limit add to query from Model_Pins_Abstract
     if (isset($data['cover']) && $data['cover']) {
         if (isset($data['pins']) && count($data['pins'])) {
             $query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . (string) $data['cover'] . ',' . implode(',', $data['pins']) . '), pins.pin_id DESC'));
         } else {
             $query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . (string) $data['cover'] . '), pins.pin_id DESC'));
         }
     } else {
         $query->order('pins.pin_id DESC');
     }
     $this->data = $db->fetchAll($query);
     // 		parent::__construct($db->fetchAll($query));
 }
Exemplo n.º 4
0
 private function getRandum($query, $data = array())
 {
     $db = JO_Db::getDefaultAdapter();
     //// load from cache
     $check = $db->select()->from('cache_index')->where('start_limit = ?', 'home')->limit(1);
     $cache = $db->fetchRow($check);
     if (!isset($cache['data']) || !$cache['data']) {
         $query->where('pins.pin_id = 0');
         return $query;
     }
     if ($cache && $cache['data']) {
         $query->where('pins.pin_id IN (' . $cache['data'] . ')');
     } else {
         $query->where('pins.pin_id = 0');
     }
     //v2.2
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $query = self::filterFriend($query);
     }
     //sort and limit add to query from Model_Pins_Abstract
     $query = self::sortOrderLimit($query, $data);
     $query->reset(JO_Db_Select::ORDER);
     $query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . $cache['data'] . ')'));
     return $query;
 }
Exemplo n.º 5
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $reques = $this->getRequest();
     $page = $reques->getRequest('page', 1);
     $data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'));
     $this->view->words = array();
     $words = Model_Banners::getBanners($data);
     if ($words) {
         foreach ($words as $word) {
             $word['text_controller'] = $this->positions($word['controller']);
             $this->view->words[] = $word;
         }
     }
     $total_records = Model_Banners::getTotalBanners($data);
     $this->view->total_pages = ceil($total_records / Helper_Config::get('config_admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(Helper_Config::get('config_admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/banners/?page={page}');
     $this->view->pagination = $pagination->render();
 }
Exemplo n.º 6
0
 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('facebook');
     $this->noLayout(true);
     if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
         if (isset($settings['facebook_login_with_facebook']) && $settings['facebook_login_with_facebook']) {
             $request = $this->getRequest();
             $facebook = new Helper_Modules_Facebook();
             if ($facebook->checkValidAppId()) {
                 $connectObject = new Model_Facebook_Login();
                 $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
                 $this->view->facebook_connect = false;
                 $this->view->facebook_timeline = false;
                 if ($user_info) {
                     $this->view->facebook_connect = true;
                     $this->view->facebook_timeline = $user_info['timeline'];
                 }
                 $this->view->site_name = Helper_Config::get('site_name');
                 $this->view->facebook_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=connect');
                 $this->view->facebook_timeline_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=timeline');
                 $this->view->facebook_invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_invates');
                 $this->view->add_pin_to_facebook_timeline = isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline'];
                 /////////
             } else {
                 $this->noViewRenderer(true);
             }
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
Exemplo n.º 7
0
 public static function sendEmail($data)
 {
     $MY =& MY_Controller::get_instance();
     $config_email = Helper_Config::getEmail();
     $MY->load->library('email', $config_email);
     $oBus = new Response_Business();
     $smtp_user = $config_email['smtp_user'];
     $messege = "De: " . $data['name'] . " <br>";
     $messege .= "Email:" . $data['email'] . " <br>";
     $messege .= "Detalle:" . $data['message'] . " <br>";
     try {
         $MY->email->from($smtp_user, $data['name']);
         $MY->email->to('*****@*****.**');
         $MY->email->subject($data['subject']);
         $MY->email->message($messege);
         if (!$MY->email->send()) {
             throw new Exception($MY->email->print_debugger());
         }
         $oBus->isSuccess(TRUE);
         $oBus->message('Email enviado!');
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     return $oBus;
 }
Exemplo n.º 8
0
 public static function send($to, $from, $title, $body = '', $attachmendImagesBody = false)
 {
     $mail = new JO_Mailer_Base();
     // 		$mail->attachmendImagesBody = $attachmendImagesBody;
     $mail->attachmendImagesBody = false;
     if (Helper_Config::get('mail_smtp')) {
         $mail->SMTPAuth = true;
         $mail->IsSMTP();
         $mail->Host = Helper_Config::get('mail_smtp_host');
         $mail->Port = Helper_Config::get('mail_smtp_port');
         $mail->Username = Helper_Config::get('mail_smtp_user');
         $mail->Password = Helper_Config::get('mail_smtp_password');
     }
     $mail->SetFrom($from, '');
     $mail->AddReplyTo($from, "");
     $mail->Subject = $title;
     $mail->AltBody = self::translate("To view the message, please use an HTML compatible email viewer!");
     // optional, comment out and test
     $mail->MsgHTML($body, BASE_PATH);
     $mail->AddAddress($to, "");
     $result = $mail->Send();
     if ($result) {
         return true;
     } else {
         self::$error = $mail->ErrorInfo;
         return false;
     }
 }
Exemplo n.º 9
0
 public function translateApiAction()
 {
     $word = $this->getRequest()->getPost('word');
     $from = $this->getRequest()->getPost('from');
     $to = $this->getRequest()->getPost('to');
     if (!Helper_Config::get('google_translate_key')) {
         $this->view->error = 'No Google Translate API key';
     } else {
         $url = 'https://www.googleapis.com/language/translate/v2?key=' . Helper_Config::get('google_translate_key') . '&q=' . urlencode($word) . '&source=' . $from . '&target=' . $to;
         //			if (ini_get('allow_url_fopen')) {
         //				$response = json_decode(@file_get_contents($url), true);
         //			} else {
         //				$response = json_decode($this->file_get_contents_curl($url), true);
         //			}
         $response = json_decode($this->file_get_contents_curl($url), true);
         if (isset($response['data']['translations'][0]['translatedText'])) {
             $this->view->text = $response['data']['translations'][0]['translatedText'];
         } elseif ($response['error']['message']) {
             $this->view->error = $response['error']['message'];
         } else {
             $this->view->error = 'Error translate';
         }
     }
     echo $this->renderScript('json');
 }
Exemplo n.º 10
0
 public function callRewriteAction($methodName)
 {
     $this->setViewChange('index');
     $request = $this->getRequest();
     $this->view->menuSearch = $this->searchMenu();
     $this->view->query = $request->getRequest('q');
     /*//get pins data
     		if($request->isXmlHttpRequest()) {
     			$this->forward('search_' . $methodName, 'getSearchResult');
     		}*/
     //get pins data
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $this->view->result_data = '';
     if (!Helper_Config::get('config_disable_js')) {
         if ($request->isXmlHttpRequest()) {
             $this->forward('search_' . $methodName, 'getSearchResult');
         }
     } else {
         $class_name = 'search_' . $methodName;
         if ($page > 1 && $request->isXmlHttpRequest()) {
             $this->forward($class_name, 'getSearchResult');
         }
         $controller_name = $this->getFrontController()->formatControllerName($class_name);
         $instance = new $controller_name();
         $pins = (array) $instance->getSearchResultAction(true);
         foreach ($pins as $pin) {
             $template = new Helper_Tmpl($pin['template'], $pin);
             $this->view->result_data .= $template->render($pin['template']);
         }
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
 private function check()
 {
     $this->load->file('application/modules/app/login/login_data.php');
     $resAjax = new Response_Ajax();
     $dataLogin = new Data_App_Login(TRUE);
     $dataLoginError = NULL;
     //Helper_Log::write($_SESSION);
     try {
         $id_company = Helper_Config::getCompanyId();
         if (!$dataLogin->isValid($dataLoginError, FALSE)) {
             throw new Exception('Complete correctamente todos los campos 001');
         }
         $oBus = Business_App_User::login($dataLogin->username, $dataLogin->password);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $data = $oBus->data();
         /* @var $eUser eUser */
         $eUser = $data['eUser'];
         Helper_App_Session::init($id_company, $eUser->id);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->data('login_error', $dataLoginError->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 12
0
 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (isset($settings['instagram_module_status_enable']) && $settings['instagram_module_status_enable']) {
         if (isset($settings['instagram_login_with_instagram']) && $settings['instagram_login_with_instagram']) {
             $request = $this->getRequest();
             $next = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_connect&action=connect');
             $this->view->instagram_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_login&instagram_fnc=connect&action=forward&next=' . $next);
             $this->view->instagram_fetch = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_media');
             $connectObject = new Model_Instagram_Login();
             $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
             $this->view->instagram_connect = false;
             $this->view->fetch_instagram_media = false;
             if ($user_info) {
                 $this->view->instagram_connect = true;
                 $this->view->fetch_instagram_media = isset($settings['instagram_fetch_instagram_media']) && $settings['instagram_fetch_instagram_media'];
             }
             $this->view->site_name = Helper_Config::get('site_name');
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
Exemplo n.º 13
0
 public function __construct($pin_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $query = self::getListPinsQuery();
     //$query->columns(array('pin_next'=>new JO_Db_Expr('('.$db->select()->from(array('next'=>'pins'),'pin_id')->where('pin_id > ?', (string)$pin_id)->order('pin_id ASC')->limit(1).')')));
     //$query->columns(array('pin_prev'=>new JO_Db_Expr('('.$db->select()->from(array('prev'=>'pins'),'pin_id')->where('pin_id < ?', (string)$pin_id)->order('pin_id DESC')->limit(1).')')));
     if (JO_Session::get('user[user_id]')) {
         $query->columns(array('following_board' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . ')-(' . $db->select()->from('users_following_ignore', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
         $query->columns(array('following_user' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
         $query->columns(array('following_via' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->where('board_id = pins.board_id')->limit(1) . '))')));
     } else {
         $query->columns(array('following_board' => new JO_Db_Expr("0")));
         $query->columns(array('following_user' => new JO_Db_Expr("0")));
         $query->columns(array('following_via' => new JO_Db_Expr("0")));
     }
     $rows_source = self::describeTable('pins_sources', 'source_');
     $query->joinLeft('pins_sources', 'pins.source_id = pins_sources.source_id', $rows_source);
     $query->where('pins.pin_id = ?', (string) $pin_id);
     //v2.2
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $query = self::filterFriend($query);
     }
     $response = $db->fetchRow($query);
     $response = is_array($response) ? $response : array();
     $this->data = $response;
     // 		parent::__construct($response);
 }
Exemplo n.º 14
0
 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('twitter');
     if (isset($settings['twitter_module_status_enable']) && $settings['twitter_module_status_enable']) {
         if (isset($settings['twitter_login_with_twitter']) && $settings['twitter_login_with_twitter']) {
             $request = $this->getRequest();
             $next = WM_Router::create($request->getBaseUrl() . '?controller=modules_twitter_connect&action=connect');
             $next2 = WM_Router::create($request->getBaseUrl() . '?controller=modules_twitter_connect&action=twit');
             $this->view->twitter_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_twitter_login&action=forward&twitter_fnc=connect&next=' . $next);
             $this->view->twitter_twit_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_twitter_login&action=forward&twitter_fnc=connect&next=' . $next2);
             $this->view->add_pin_to_twitter = isset($settings['twitter_add_pin_to_twitter']) && $settings['twitter_add_pin_to_twitter'];
             $this->view->site_name = Helper_Config::get('site_name');
             $this->view->twitter_connect = false;
             $connectObject = new Model_Twitter_Login();
             $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
             if ($user_info) {
                 $this->view->twitter_connect = true;
                 $this->view->twitter_twit = $user_info['twit'];
             }
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
Exemplo n.º 15
0
 public static function updateAll($data)
 {
     $db = JO_Db::getDefaultAdapter();
     if (is_array($data)) {
         $delete_pin_no_image = $delete_user_no_image = false;
         if (isset($data['images']['no_image']) && basename($data['images']['no_image']) != Helper_Config::get('no_image')) {
             $delete_pin_no_image = true;
         }
         if (isset($data['images']['no_avatar']) && basename($data['images']['no_avatar']) != Helper_Config::get('no_avatar')) {
             $delete_user_no_image = true;
         }
         foreach ($data as $group => $value) {
             $db->delete('system', array('`group` = ?' => $group));
             if (is_array($value)) {
                 foreach ($value as $key => $val) {
                     $serialize = false;
                     if (is_array($val)) {
                         $serialize = true;
                         $val = serialize($val);
                     }
                     $db->insert('system', array('group' => $group, 'key' => $key, 'value' => $val, 'system' => (int) ($group == 'config'), 'serialize' => $serialize));
                 }
             }
         }
         if ($delete_pin_no_image) {
             Helper_Db::query("TRUNCATE TABLE `pins_images`");
         }
         if ($delete_user_no_image) {
             Helper_Db::query("TRUNCATE TABLE `users_avatars`");
         }
     }
 }
Exemplo n.º 16
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $places_model = new Model_Source();
     $this->view->page_num = $page = $request->getRequest('page', 1);
     $this->view->filter_source = $request->getQuery('filter_source');
     $url = '';
     if ($this->view->filter_source) {
         $url .= '&filter_source=' . $this->view->filter_source;
     }
     $data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'), 'filter_source' => trim($this->view->filter_source));
     $this->view->new_record_url = $request->getBaseUrl() . $request->getModule() . '/sources/create/';
     $this->view->sources = array();
     $sources = $places_model->getSources($data);
     if ($sources) {
         $imgObject = new Helper_Images();
         foreach ($sources as $source) {
             $source['edit'] = $request->getModule() . '/sources/edit/?id=' . $source['source_id'];
             $this->view->sources[] = $source;
         }
     }
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $total = $places_model->getTotalSources($data);
     $pagination = new Model_Pagination();
     $pagination->setLimit(Helper_Config::get('config_admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total);
     $pagination->setUrl($this->getRequest()->getModule() . '/sources/?page={page}' . $url);
     $this->view->pagination = $pagination->render();
 }
Exemplo n.º 17
0
 public function __construct($data = array())
 {
     $db = JO_Db::getDefaultAdapter();
     try {
         $db->beginTransaction();
         $data['user_id'] = isset($data['user_id']) ? $data['user_id'] : JO_Session::get('user[user_id]');
         $data['public'] = isset($data['public']) ? (int) $data['public'] : 1;
         $data['date_added'] = date('Y-m-d H:i:s');
         $board_id = Helper_Db::create('boards', $data);
         if (!$board_id) {
             return $this;
         }
         Helper_Db::insert('users_boards', array('user_id' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'), 'board_id' => $board_id, 'is_author' => 1));
         if (isset($data['friends'])) {
             foreach ($data['friends'] as $fr) {
                 Helper_Db::insert('users_boards', array('user_id' => $fr, 'board_id' => $board_id));
             }
         }
         $config_private_boards = Helper_Config::get('config_private_boards');
         Helper_Db::update('users', array('boards' => new JO_Db_Expr("(SELECT COUNT(board_id) FROM boards WHERE user_id = '" . (isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')) . "' " . ($config_private_boards ? ' AND public = 1' : '') . ")")), array('user_id = ?' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')));
         ////autoseo
         new Model_Boards_Autoseo($board_id);
         $this->board_id = $board_id;
         $db->commit();
     } catch (JO_Exception $e) {
         $db->rollBack();
         $this->error = $e->getMessage();
     }
 }
Exemplo n.º 18
0
 public function __construct($board_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $board_info = new Model_Boards_Board($board_id);
     if ($board_info->count()) {
         $config_private_boards = Helper_Config::get('config_private_boards');
         $db->update('boards', array('pins' => new JO_Db_Expr('(SELECT COUNT(DISTINCT pin_id) FROM pins WHERE board_id = boards.board_id ' . ($config_private_boards ? ' AND (public = 1 OR board_id = boards.board_id)' : '') . ')'), 'followers' => new JO_Db_Expr('( (SELECT COUNT(DISTINCT user_id) FROM users_following_user WHERE following_id = boards.user_id AND user_id != boards.user_id LIMIT 1) + (SELECT COUNT(DISTINCT user_id) FROM users_following WHERE following_id = boards.user_id AND user_id != boards.user_id LIMIT 1) - (SELECT COUNT(DISTINCT user_id) FROM users_following_ignore WHERE following_id = boards.user_id AND board_id = boards.board_id AND user_id != boards.user_id LIMIT 1) )'), 'latest_pins' => new JO_Db_Expr('( SUBSTRING_INDEX( (SELECT GROUP_CONCAT(pin_id ORDER BY `pin_id` DESC) FROM `pins` WHERE board_id = boards.board_id), \',\', 15 ) )')), array('board_id = ?' => (string) $board_id));
     }
 }
Exemplo n.º 19
0
 public function __construct($user_id)
 {
     $db = JO_Db::getDefaultAdapter();
     $user_info = new Model_Users_User($user_id);
     if ($user_info->count()) {
         $config_private_boards = Helper_Config::get('config_private_boards');
         Helper_Db::update('users', array('pins' => new JO_Db_Expr('(SELECT COUNT(DISTINCT pin_id) FROM pins WHERE user_id = users.user_id ' . ($config_private_boards ? ' AND (public = 1 OR user_id = users.user_id)' : '') . ')'), 'boards' => new JO_Db_Expr('(SELECT COUNT(DISTINCT board_id) FROM boards WHERE user_id = users.user_id ' . ($config_private_boards ? ' AND (public = 1 OR user_id = users.user_id)' : '') . ')'), 'likes' => new JO_Db_Expr('(SELECT COUNT(DISTINCT pin_id) FROM pins_likes WHERE user_id = users.user_id)'), 'following' => new JO_Db_Expr('( (SELECT COUNT(DISTINCT following_id) FROM users_following_user WHERE user_id = users.user_id AND following_id != users.user_id LIMIT 1) + (SELECT COUNT(DISTINCT following_id) FROM users_following WHERE user_id = users.user_id AND following_id != users.user_id LIMIT 1) )'), 'followers' => new JO_Db_Expr('( (SELECT COUNT(DISTINCT user_id) FROM users_following_user WHERE following_id = users.user_id AND user_id != users.user_id LIMIT 1) + (SELECT COUNT(DISTINCT user_id) FROM users_following WHERE following_id = users.user_id AND user_id != users.user_id LIMIT 1) )'), 'latest_pins' => new JO_Db_Expr('( SUBSTRING_INDEX( (SELECT GROUP_CONCAT(pin_id ORDER BY `pin_id` DESC) FROM `pins` WHERE user_id = users.user_id), \',\', 15 ) )')), array('user_id = ?' => $user_id));
     }
 }
Exemplo n.º 20
0
 public function __construct($key = null, $secret = null, $redirect_uri = null)
 {
     $this->key = $key ? $key : Helper_Config::get('instagram_oauth_key');
     $this->secret = $secret ? $secret : Helper_Config::get('instagram_oauth_secret');
     if (!$redirect_uri) {
         $redirect_uri = WM_Router::create(JO_Request::getInstance()->getBaseUrl() . '?controller=modules_instagram_login');
     }
     parent::__construct(array('client_id' => $this->key, 'client_secret' => $this->secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri));
 }
Exemplo n.º 21
0
 private function downloadReports()
 {
     $resAjax = new Response_Ajax();
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     $this->library_jasperstarter->dbGeneric('org.firebirdsql.jdbc.FBDriver', 'jdbc:firebirdsql://localhost:3050/C:\\FireBird\\FTT\\DIGIFORTDB.FDB', 'SYSDBA', 'masterkey');
     //$MY =& MY_Controller::get_instance();
     $date_begin = $this->input->post('date_begin');
     $date_end = $this->input->post('date_end');
     $rpte_tipo = $this->input->post('rpte_tipo');
     $rpte_grupo = $this->input->post('rpte_grupo');
     try {
         $condicion = ' AND 1=1 ';
         if ($rpte_tipo == 'RPTE_CAMARAS_GENERAL') {
             $path_file_jasper = BASEPATH . "../application/reports/camaras_general/report.jasper";
             $file_name_download = "CAMARA_EN_GENERAL";
             $file_name_output = 'camaras_general_' . uniqid();
         } else {
             if ($rpte_tipo == 'RPTE_GRUPOS_CAMARAS') {
                 $path_file_jasper = BASEPATH . "../application/reports/grupos_general/rpte_grupos_general.jasper";
                 $file_name_download = "CAMARA_EN_GENERAL";
                 $file_name_output = 'camaras_general_' . uniqid();
                 //$condicion.=' AND 1=1';
                 foreach ($rpte_grupo as $key => $value) {
                     $condicion .= "AND ( GRUPO_CAMARA = '" . $value . "' )";
                 }
             } else {
                 throw new Exception('ERROR DE EJECCIÓN<br/> COMANDO: Tipo de reporte no encontrado');
             }
         }
         $arrParameter = array('fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'condicion' => $condicion);
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, 'xls');
         if (!$oReport->isSuccess()) {
             throw new Exception('ERROR DE EJECCIÓN<br/> COMANDO: ' . $oReport->cmd());
         }
         //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
         //force_download($file_name_output, $data);
         $mime = get_mime_by_extension($oReport->fileExtension());
         //$mime = "application/pdf";
         ob_clean();
         header("Content-Type: application/force-download");
         //header("Content-Disposition: attachment; filename=$file_name_download.xls");
         header("Content-Transfer-Encoding: binary");
         //header("Content-Length: " . $size);
         header("Content-disposition: attachment; filename={$file_name_download}.xls");
         header("Content-type: {$mime}");
         readfile($oReport->filePath());
     } catch (Exception $err) {
         echo $err->getMessage();
     }
     //echo $resAjax->toJsonEncode();
 }
Exemplo n.º 22
0
 public function getSearchResultAction($return_data = false)
 {
     $request = $this->getRequest();
     $response = $this->getResponse();
     $query = $request->getRequest('q');
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $pp = (int) Helper_Config::get('config_front_limit');
     if (!(int) $pp) {
         $pp = 50;
     }
     if ((int) $request->getRequest('per_page') > 0 && (int) $request->getRequest('per_page') < 300) {
         $pp = (int) $request->getRequest('per_page');
     }
     $data = array('start' => $pp * $page - $pp, 'limit' => $pp, 'filter_description' => $query);
     $return = array();
     /* set board count */
     $has_pins = true;
     if (!trim($query)) {
         $has_pins = false;
     }
     // pins data
     $pins = $has_pins ? new Model_Pins_Search($data) : new ArrayObject();
     //format response data
     $formatObject = new Helper_Format();
     if ($has_pins && $pins->count()) {
         $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position >= '" . (int) $data['start'] . "' AND position <= '" . (int) ($data['start'] + $pp) . "'"));
         foreach ($pins->data as $row => $pin) {
             ///banners
             $key = $row + ($pp * $page - $pp);
             if (isset($banners[$key]) && $banners[$key]) {
                 if (($banners_result = $formatObject->fromatListBanners($banners[$key])) !== false) {
                     $return[] = $banners_result;
                 }
             }
             //pins
             $return[] = $formatObject->fromatList($pin);
         }
     } else {
         if ($page == 1) {
             $message = $this->translate('No pyngs!');
         } else {
             $message = $this->translate('No more pyngs!');
         }
         $return[] = $formatObject->fromatListNoResults($message);
     }
     if ($return_data) {
         return $return;
     }
     $formatObject->responseJsonCallback($return);
     $this->noViewRenderer(true);
 }
Exemplo n.º 23
0
 public function resetAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $done = $request->issetQuery('done');
     $this->view->success = false;
     if ($done) {
         $this->view->success = true;
     }
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('email'), $this->translate('E-mail'), 'not_empty;min_length[5];max_length[100];email');
         if ($validate->_valid_form()) {
             $result = Model_Users::forgotPassword($request->getPost('email'));
             if ($result) {
                 if ($result['status']) {
                     $new_password = Model_Users::generatePassword(8);
                     $key_forgot = md5($result['user_id'] . md5($new_password));
                     $add_new_pass = Model_Users::edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot));
                     if ($add_new_pass) {
                         $is_mail_smtp = JO_Registry::forceGet('config_mail_smtp');
                         $mail = new JO_Mail();
                         if ($is_mail_smtp) {
                             $mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password'));
                         }
                         $this->view->new_password = $new_password;
                         $this->view->user_info = $result;
                         $this->view->forgot_password_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot);
                         $this->view->header_title = JO_Registry::get('site_name');
                         $this->view->base_href = WM_Router::create($request->getBaseUrl());
                         $result_send = Model_Email::send($result['email'], Helper_Config::get('noreply_mail'), $this->translate('Request for forgotten password') . ' ' . JO_Registry::get('site_name'), $this->view->render('send_forgot_password_request', 'mail'));
                         if ($result_send) {
                             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset&done='));
                         } else {
                             $this->view->error = $this->translate('There was an error. Please try again later!');
                         }
                     } else {
                         $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                     }
                 } else {
                     $this->view->error = $this->translate('This profile is not active.');
                 }
             } else {
                 $this->view->error = $this->translate('E-mail address was not found!');
             }
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
     }
     $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset');
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Exemplo n.º 24
0
 public static function getHistoryV2($data, $row = 'to_user_id', $user_id = 0)
 {
     $db = JO_Db::getDefaultAdapter();
     if (!$user_id) {
         $user_id = (string) JO_Session::get('user[user_id]');
     }
     $rows_history = self::describeTable('users_history', 'history_');
     $rows_users = self::describeTable('users', 'user_');
     switch (Helper_Config::get('config_user_view')) {
         case 'username':
             $rows_users['user_fullname'] = new JO_Db_Expr('users.username');
             break;
         case 'firstname':
             $rows_users['user_fullname'] = new JO_Db_Expr('users.firstname');
             break;
         case 'fullname':
         default:
             $rows_users['user_fullname'] = new JO_Db_Expr('CONCAT(users.firstname, " ", users.lastname)');
             break;
     }
     $query = $db->select()->from('users_history', $rows_history)->joinLeft('users', ($row == 'to_user_id' ? 'users_history.from_user_id' : 'users_history.to_user_id') . ' = users.user_id', $rows_users)->where($row . ' = ?', $user_id);
     if (isset($data['filter_history_action']) && (int) $data['filter_history_action']) {
         $query->where('users_history.history_action = ?', (int) $data['filter_history_action']);
     }
     if (isset($data['start']) && isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         $query->limit($data['limit'], $data['start']);
     }
     if (isset($data['sort']) && strtolower($data['sort']) == 'asc') {
         $sort = ' ASC';
     } else {
         $sort = ' DESC';
     }
     $allow_sort = array('history_id');
     if (isset($data['order']) && in_array($data['order'], $allow_sort)) {
         $query->order($data['order'] . $sort);
     } else {
         $query->order('history_id' . $sort);
     }
     $results = $db->fetchAll($query);
     $data = array();
     if ($results) {
         foreach ($results as $result) {
             $result['history_text_type'] = self::getType($result['history_history_action']);
             if ($result['history_text_type']) {
                 $result['history_date_dif'] = array_shift(WM_Date::dateDiff($result['history_date_added'], time()));
                 $data[] = $result;
             }
         }
     }
     return $data;
 }
Exemplo n.º 25
0
 public static function avatar($user, $size = null)
 {
     if (!isset($user['store']) || !$user['store']) {
         $user['store'] = 'Model_Upload_Locale';
     }
     $image = call_user_func(array($user['store'], 'getUserImage'), $user, $size);
     if (!$image) {
         $user['avatar'] = Helper_Config::get('no_avatar');
         $image = call_user_func(array('Model_Upload_Locale', 'getUserImage'), $user, $size);
     }
     return $image;
 }
Exemplo n.º 26
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $reques = $this->getRequest();
     $this->view->sort = $reques->getRequest('sort', 'ASC');
     $this->view->order = $reques->getRequest('order', 'id');
     $this->view->page_num = $page = $reques->getRequest('page', 1);
     $this->view->filter_ip_id = $reques->getQuery('filter_ip_id');
     $this->view->filete_ip = $reques->getQuery('filete_ip');
     $url = '';
     if ($this->view->filter_ip_id) {
         $url .= '&filter_ip_id=' . $this->view->filter_ip_id;
     }
     if ($this->view->filete_ip) {
         $url .= '&filter_name=' . $this->view->filete_ip;
     }
     $url1 = '';
     if ($this->view->sort) {
         $url1 .= '&sort=' . $this->view->sort;
     }
     if ($this->view->order) {
         $url1 .= '&order=' . $this->view->order;
     }
     $url2 = '&page=' . $page;
     $data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'), 'sort' => $this->view->sort, 'order' => $this->view->order, 'filter_id' => $this->view->filter_ip_id, 'filete_ip' => $this->view->filete_ip);
     $this->view->ip_addresss = array();
     $ip_addresss = Model_Allowips::getWords($data);
     if ($ip_addresss) {
         foreach ($ip_addresss as $ip_address) {
             $ip_address['ip_address'] = JO_Request_Server::decode_ip($ip_address['ip_address']);
             $this->view->ip_addresss[] = $ip_address;
         }
     }
     $this->view->sort = strtolower($this->view->sort);
     $this->view->sort_ip_address_id = $reques->getModule() . '/allowips/?order=id&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2;
     $this->view->sort_ip_address = $reques->getModule() . '/allowips/?order=ip_address&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2;
     $total_records = Model_Allowips::getTotalWords($data);
     $this->view->total_pages = ceil($total_records / Helper_Config::get('config_admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(Helper_Config::get('config_admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/allowips/?page={page}' . $url . $url1);
     $this->view->pagination = $pagination->render();
 }
Exemplo n.º 27
0
 public function __construct($board_id)
 {
     $db = JO_Db::getDefaultAdapter();
     //select default pin data
     $query = self::getListUsersQuery();
     $query->where('users.user_id IN (?)', new JO_Db_Expr('(' . $db->select()->from('users_boards', 'user_id')->where('board_id = ?', (string) $board_id)->where('allow = 1') . ')'));
     //v2.2
     if (Helper_Config::get('config_enable_follow_private_profile')) {
         $query = self::filterFriend($query);
     }
     parent::__construct($db->fetchAll($query));
 }
Exemplo n.º 28
0
 public static function getByMethod($method)
 {
     $ext = self::getAll();
     $data = array();
     foreach ($ext as $id => $e) {
         $mod = Helper_Config::get($e . '_methods');
         if (in_array($method, $mod)) {
             $data[$id] = $e;
         }
     }
     return $data;
 }
Exemplo n.º 29
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (!isset($settings['facebook_login_with_facebook']) || !$settings['facebook_login_with_facebook']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['facebook_module_status_enable']) || !$settings['facebook_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $facebook = new Helper_Modules_Facebook();
     $user_data = $facebook->getUser(true);
     if ($user_data) {
         $modelLogin = new Model_Facebook_Login($user_data['id']);
         $error = true;
         if ($modelLogin->row) {
             $userObject = new Model_Users_User($modelLogin->row['user_id']);
             if ($userObject->count()) {
                 if (JO_Session::get('user[user_id]')) {
                     if ($modelLogin->row['user_id'] == JO_Session::get('user[user_id]')) {
                         JO_Session::set('user', $userObject->toArray());
                     }
                 } else {
                     JO_Session::set('user', $userObject->toArray());
                 }
                 new Model_Users_Edit($modelLogin->row['user_id'], array('last_login' => new JO_Db_Expr('NOW()')));
                 $modelLogin->facebook = $facebook;
                 $modelLogin->update($user_data);
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         } elseif (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_facebook_register');
         } elseif (JO_Session::get('user[user_id]')) {
             $this->redirect($request->getBaseUrl());
         }
         $this->setViewChange('no_account');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     } else {
         //not session
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     }
 }
Exemplo n.º 30
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $reques = $this->getRequest();
     $this->view->sort = $reques->getRequest('sort', 'ASC');
     $this->view->order = $reques->getRequest('order', 'word');
     $this->view->page_num = $page = $reques->getRequest('page', 1);
     $this->view->filter_dic_id = $reques->getQuery('filter_dic_id');
     $this->view->filter_word = $reques->getQuery('filter_word');
     $url = '';
     if ($this->view->filter_dic_id) {
         $url .= '&filter_dic_id=' . $this->view->filter_dic_id;
     }
     if ($this->view->filter_word) {
         $url .= '&filter_name=' . $this->view->filter_word;
     }
     $url1 = '';
     if ($this->view->sort) {
         $url1 .= '&sort=' . $this->view->sort;
     }
     if ($this->view->order) {
         $url1 .= '&order=' . $this->view->order;
     }
     $url2 = '&page=' . $page;
     $data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'), 'sort' => $this->view->sort, 'order' => $this->view->order, 'filter_dic_id' => $this->view->filter_dic_id, 'filter_word' => $this->view->filter_word);
     $this->view->words = array();
     $words = Model_Dictionary::getWords($data);
     if ($words) {
         foreach ($words as $word) {
             $this->view->words[] = $word;
         }
     }
     $this->view->sort = strtolower($this->view->sort);
     $this->view->sort_dic_id = $reques->getModule() . '/dictionary/?order=dic_id&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2;
     $this->view->sort_word = $reques->getModule() . '/dictionary/?order=word&sort=' . ($this->view->sort == 'asc' ? 'DESC' : 'ASC') . $url . $url2;
     $total_records = Model_Dictionary::getTotalWords($data);
     $this->view->total_pages = ceil($total_records / Helper_Config::get('config_admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(Helper_Config::get('config_admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/dictionary/?page={page}' . $url . $url1);
     $this->view->pagination = $pagination->render();
 }