Пример #1
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');
     }
     $request = $this->getRequest();
     $this->setViewChange('form');
     if ($request->isPost()) {
         if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
             $this->session->set('error_permision', $this->translate('You do not have permission to this action'));
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
         }
         if (JO_Registry::get('license_powered_check') != 'false') {
             $request->setParams('config_hide_brand', 0);
         }
         Model_Settings::updateAll($request->getParams());
         $config = $request->getPost('config');
         if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) {
             WM_Currency::updateCurrencies($config['config_currency'], true);
         }
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
     }
     $this->getForm();
 }
Пример #2
0
 private function loginInit($id)
 {
     $event_data = WM_Users::initSession($id);
     if ($event_data) {
         JO_Session::set(array('user' => $event_data));
     }
     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
 }
Пример #3
0
 public function deleteAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         echo $this->translate('You do not have permission to this action');
     } else {
         Model_Usergroups::deleteUserGroup($this->getRequest()->getPost('id'));
     }
 }
Пример #4
0
 public function indexAction()
 {
     $opts = array('root' => BASE_PATH . '/uploads/data/', 'URL' => 'uploads/data/', 'rootAlias' => $this->translate('Home'), 'disabled' => array(), 'uploadAllow' => array('image/', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats', 'application/xml', 'application/vnd.ms-powerpoint'), 'uploadDeny' => array('application/'), 'uploadOrder' => 'deny,allow', 'mimeDetect' => 'jo');
     if (!WM_Users::allow('create', $this->getRequest()->getController())) {
         $opts['disabled'] = array_merge($opts['disabled'], array('rotateRight', 'rotateLeft', 'extract', 'archive', 'upload', 'copy', 'mkdir', 'mkfile', 'rename', 'paste', 'rm', 'duplicate', 'edit', 'resize'));
     } else {
         if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
             $opts['disabled'] = array_merge($opts['disabled'], array('rotateRight', 'rotateLeft', 'extract', 'archive', 'upload', 'copy', 'mkdir', 'mkfile', 'rename', 'paste', 'rm', 'duplicate', 'edit', 'resize'));
         }
     }
     $flm = new Helper_Elfinder($opts);
     $flm->run();
     $this->noViewRenderer(true);
 }
Пример #5
0
 public function inviteAction()
 {
     if (!WM_Users::allow('create', $this->getRequest()->getController())) {
         echo $this->translate('You do not have permission to this action');
     } else {
         $this->setInvokeArg('noViewRenderer', true);
         $info = Model_Users::getWait($this->getRequest()->getPost('id'));
         if ($info) {
             $this->view->shared_content = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=register&user_id=-1&key=' . $info['key']);
             $result = Model_Email::send($info['email'], Helper_Config::get('noreply_mail'), sprintf($this->translate('You have been invited to join %s'), Helper_Config::get('site_name')), $this->view->render('invite', 'invites'));
             Model_Users::invite($this->getRequest()->getPost('id'));
         }
     }
 }
Пример #6
0
 public function editAction()
 {
     if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
         $this->session->set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/languages/');
     }
     $this->setViewChange('language_form');
     if ($this->getRequest()->isPost()) {
         Model_Language::editeLanguage($this->getRequest()->getQuery('id'), $this->getRequest()->getParams());
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/languages/');
     }
     $this->getForm();
 }
Пример #7
0
 public function __construct()
 {
     $request = JO_Request::getInstance();
     parent::__construct();
     if (Model_Allowips::getTotalWords()) {
         if (!Model_Allowips::getTotalWords(array('filete_ip' => $request->getClientIp()))) {
             if (!in_array($request->getController(), array('login', 'error'))) {
                 $this->forward('error', 'noPermission');
             }
         }
     }
     //set default timezone if is not set
     if (!ini_get('date.timezone')) {
         ini_set('date.timezone', 'UTC');
     }
     WM_Users::initSession(JO_Session::get('user[user_id]'));
     if (!JO_Session::get('user[user_id]')) {
         JO_Session::set('user', array('user_id' => 0));
     }
     //admin check login
     $login_page = $request->getController() != 'login';
     if (JO_Session::get('user[is_developer]')) {
         $login_page = false;
     } else {
         if (JO_Session::get('user[is_admin]')) {
             $login_page = false;
         }
     }
     if (in_array($request->getController(), array('login', 'error'))) {
         $login_page = false;
     }
     if ($login_page) {
         $this->forward('login', 'index');
     }
     //admin top menu
     Helper_Config::set('adminmenupermisions', WM_Users::initPermision());
     //no permisions
     $controller_name = JO_Front::getInstance()->formatControllerName($request->getController());
     if (!class_exists($controller_name, false)) {
         JO_Loader::loadFile(APPLICATION_PATH . '/modules/' . $request->getModule() . '/controllers/' . JO_Front::getInstance()->classToFilename($controller_name));
     }
     if (method_exists($controller_name, 'config')) {
         $data = call_user_func(array($controller_name, 'config'));
         if (isset($data['has_permision']) && $data['has_permision'] && !WM_Users::allow('read', $request->getController())) {
             $this->forward('error', 'noPermission');
         }
     }
     WM_Rebuild::getInformation();
     WM_Licensecheck::checkIt();
 }
Пример #8
0
 public function deleteMultiAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         echo $this->translate('You do not have permission to this action');
     } else {
         $action_check = $this->getRequest()->getPost('action_check');
         if ($action_check && is_array($action_check)) {
             foreach ($action_check as $record_id) {
                 Model_Dictionary::delete($record_id);
             }
         }
     }
 }
Пример #9
0
 public function indexAction()
 {
     if (!WM_Users::allow('edit', 'modules')) {
         JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth/');
     }
     $request = $this->getRequest();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         //validate app id
         $validate = new Helper_Modules_Facebook($request->getPost('facebook[facebook_oauth_key]'), $request->getPost('facebook[facebook_oauth_secret]'));
         if ($validate->checkValidAppId()) {
             Model_Settings::updateAll(array('facebook' => $request->getPost('facebook')));
             JO_Session::set('successfu_edite', true);
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth_facebook/');
         } else {
             $this->view->error = $this->translate('Invalid appID');
         }
     }
     $this->view->modules_url = $this->getRequest()->getModule() . '/modules';
     $this->view->modules_oauth_url = $this->getRequest()->getModule() . '/modules_oauth';
     $methods = $this->getClassResources();
     $this->view->methods = array();
     $ignore = array('index', 'error404', 'install', 'uninstall');
     foreach ($methods as $type => $mods) {
         foreach ($mods as $key => $value) {
             if (in_array($value, $ignore)) {
                 continue;
             }
             if ($type == 'actions') {
                 $this->view->methods[$type][] = array('title' => $this->translate($value), 'edit' => $this->getRequest()->getModule() . '/modules_oauth_facebook/' . strtolower($value));
             } elseif ($type == 'radio') {
                 $this->view->methods[$type][] = array('title' => $this->translate(str_replace('_', ' ', $value)), 'key' => 'facebook_' . strtolower($value));
             }
         }
     }
     $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'facebook'));
     foreach ($store_config as $key => $data) {
         if ($request->issetPost('facebook[' . $key . ']')) {
             $this->view->{$key} = $request->getPost('facebook[' . $key . ']');
         } else {
             $this->view->{$key} = $data;
         }
     }
 }
Пример #10
0
 private function loginInit($id)
 {
     $user_data = WM_Users::checkLoginFacebookTwitter($id, 'instagram_profile');
     if ($user_data) {
         JO_Session::set(array('user' => $user_data));
         if ($this->instagram) {
             WM_Users::edit2(JO_Session::get('user[user_id]'), array('instagram_token' => $this->instagram->getAccessToken()));
         }
         if (JO_Session::issetKey('next') && JO_Session::get('next')) {
             $this->redirect(urldecode(JO_Session::get('next')));
         } else {
             $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
         }
     }
     return $user_data;
 }
Пример #11
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $this->view->modules = self::getModulesList();
     if ($request->getQuery('mod') && in_array($request->getQuery('mod'), $this->view->modules)) {
         $this->view->mod = $request->getQuery('mod');
     } else {
         $this->view->mod = 'admin';
         $request->setParams('mod', 'admin');
     }
     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');
     }
     if ($request->isPost()) {
         if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
             $this->session->set('error_permision', $this->translate('You do not have permission to this action'));
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/translate/');
         }
         Model_Translate::setTranslate($request->getParams());
         $this->session->set('successfu_edite', true);
         if ($request->getPost('hidden_mod') != $this->view->mod) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/translate/?mod=' . $request->getPost('hidden_mod'));
         } else {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/translate/?mod=' . $this->view->mod);
         }
     }
     $this->view->translated = Model_Translate::getTranslate($this->view->mod);
     if ($this->view->translated) {
         foreach ($this->view->translated as $k => $v) {
             $this->view->translated[$k]['keyword'] = htmlspecialchars($v['keyword'], ENT_QUOTES, 'utf-8');
         }
     }
 }
Пример #12
0
 public function indexAction()
 {
     if (!WM_Users::allow('create', $this->getRequest()->getController())) {
         $this->forward('error', 'noPermission');
     }
     $request = $this->getRequest();
     $this->view->user = $request->getPost('user');
     $this->view->title = $request->getPost('title');
     $this->view->description = $request->getPost('description');
     $this->view->users = Model_Users::getUsers(array('filter_email' => '@'));
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     $this->view->errors = array();
     if ($request->isPost()) {
         if ($this->getRequest()->issetPost('user')) {
             $result = '';
             if ($this->getRequest()->getPost('user') == 'all') {
                 $email_list = Model_Users::getUsers(array('filter_email' => '@'));
                 foreach ($email_list as $email) {
                     if (JO_Validate::validateEmail($email["email"])) {
                         $result = Model_Email::send($email["email"], Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8'));
                     }
                 }
             } elseif (JO_Validate::validateEmail($this->getRequest()->getPost('user'))) {
                 $result = Model_Email::send($this->getRequest()->getPost('user'), Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8'));
             }
             if ($result) {
                 JO_Session::set('successfu_edite', true);
                 $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/massmail/');
             } else {
                 $this->view->errors['no_emails'] = $this->translate('There was an error with sending the mail!');
             }
         }
     }
 }
Пример #13
0
 public function deleteMultiAction()
 {
     $this->noViewRenderer(true);
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         $this->session->set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/boards/');
     }
     $action_check = $this->getRequest()->getPost('action_check');
     if ($action_check && is_array($action_check)) {
         foreach ($action_check as $record_id) {
             Model_Boards::delete($record_id);
         }
     }
 }
Пример #14
0
 public function indexAction()
 {
     ini_set('memory_limit', '4200M');
     $this->noViewRenderer(true);
     ignore_user_abort(true);
     for ($i = 1; $i < 5; $i++) {
         $html = @file_get_contents('http://pinterest.com/?page=' . $i);
         if ($html) {
             $dom = new JO_Html_Dom();
             $dom->load($html);
             $hrefs = $dom->find('.PinImage');
             if ($hrefs) {
                 foreach ($hrefs as $href) {
                     $price = 0;
                     $url = JO_Url_Relativetoabsolute::toAbsolute('http://pinterest.com/?page=' . $i, $href->href);
                     $html2 = @file_get_contents($url);
                     if ($html2) {
                         $dom = new JO_Html_Dom();
                         $dom->load($html2);
                         $board = $dom->find('h3.serif a', 0)->innertext;
                         $image = $dom->find('#pinCloseupImage', 0)->src;
                         $description = $dom->find('#PinCaption', 0)->innertext;
                         $description = explode('<', $description);
                         $description = $description[0];
                         $from = $dom->find('#PinSource a', 0)->href;
                         $usernames = $dom->find('#PinnerName a', 0)->innertext;
                         $avatar = $dom->find('#PinnerImage img', 0)->src;
                         $username = trim($dom->find('#PinnerName a', 0)->href, '/');
                         $price_o = $dom->find('.buyable', 0);
                         if ($price_o) {
                             $price = $price_o->innertext;
                         }
                         $user_id = Model_Users::getUserByName($username, $usernames, $avatar);
                         if (!$user_id) {
                             continue;
                         }
                         WM_Users::initSession($user_id);
                         $board_id = Model_Boards::getBoardId(trim($board));
                         $price_f = 0;
                         if (preg_match('/([0-9.]{1,})/', $price, $m)) {
                             $price_f = $m[1];
                         }
                         $pin_id = Model_Pins::create(array('board_id' => $board_id, 'description' => htmlspecialchars($description, ENT_QUOTES, 'utf-8'), 'image' => (string) $image, 'price' => (double) $price, 'from' => urldecode($from), 'public' => '1'));
                         $commm = $dom->find('.PinComments .comment');
                         if ($commm) {
                             foreach ($commm as $com) {
                                 $avatar = $com->find('.CommenterImage img', 0)->src;
                                 $usernames = $com->find('.CommenterName', 0)->innertext;
                                 $username = trim($com->find('.CommenterName', 0)->href, '/');
                                 $text = explode('<br />', $com->find('.CommenterMeta', 0)->innertext);
                                 $text = isset($text[1]) ? $text[1] : '';
                                 if ($text) {
                                     $user_id = Model_Users::getUserByName($username, $usernames, $avatar);
                                     if (!$user_id) {
                                         continue;
                                     }
                                     WM_Users::initSession($user_id);
                                     $pin_info = Model_Pins::getPin($pin_id);
                                     Model_Pins::addComment(array('write_comment' => $text, 'pin_id' => $pin_id), $pin_info['latest_comments']);
                                 }
                             }
                             sleep(1);
                         }
                         sleep(1);
                     }
                 }
             }
         }
     }
 }
Пример #15
0
 public static function initPermision()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'admin' && JO_Session::get('user[is_admin]')) {
         $files = glob(APPLICATION_PATH . '/modules/' . $request->getModule() . '/controllers/*.php');
         $temporary_for_menu = array();
         $temporary_for_permision = array();
         $sort_order = $sort_order2 = array();
         if ($files) {
             foreach ($files as $d => $file) {
                 $name = basename($file, '.php');
                 JO_Loader::loadFile($file);
                 if (method_exists($name, 'config')) {
                     $data = call_user_func(array($name, 'config'));
                     if (!isset($data['has_permision']) || !$data['has_permision']) {
                         continue;
                     }
                     if (!$data['in_menu'] || !WM_Users::allow('read', $data['permision_key'])) {
                         continue;
                     }
                     if (isset($sort_order2[$data['menu']])) {
                         $sort_order2[$data['menu']] = min($sort_order[$data['menu']], (int) (isset($data['sort_order']) ? $data['sort_order'] : 0));
                     } else {
                         $sort_order2[$data['menu']] = (int) (isset($data['sort_order']) ? $data['sort_order'] : 0);
                     }
                     $sort_order[$data['menu']][$d] = (int) (isset($data['sort_order']) ? $data['sort_order'] : 0);
                     $temporary_for_menu[$data['menu']][$d] = array('name' => $data['name'], 'key' => $data['permision_key'], 'has_permision' => $data['has_permision'], 'menu' => $data['menu'], 'href' => $request->getBaseUrl() . $request->getModule() . '/' . (strtolower($name) != 'indexcontroller' ? str_replace('controller', '', strtolower($name)) . '/' : ''));
                 }
             }
         }
         array_multisort($sort_order2, SORT_ASC, $temporary_for_menu);
         foreach ($temporary_for_menu as $k => $t) {
             array_multisort($sort_order[$k], SORT_ASC, $temporary_for_menu[$k]);
         }
         return $temporary_for_menu;
     }
 }
Пример #16
0
 public function _initNoPermision()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     if ($request->getModule() == 'admin') {
         $controller_name = JO_Front::getInstance()->formatControllerName($request->getController());
         if (!class_exists($controller_name, false)) {
             JO_Loader::loadFile(APPLICATION_PATH . '/modules/' . $request->getModule() . '/controllers/' . JO_Front::getInstance()->classToFilename($controller_name));
         }
         if (method_exists($controller_name, 'config')) {
             $data = call_user_func(array($controller_name, 'config'));
             if ($data['has_permision'] && !WM_Users::allow('read', $request->getController())) {
                 JO_Action::getInstance()->forward('error', 'noPermission');
             }
         }
     }
 }
Пример #17
0
 public function __construct()
 {
     $request = JO_Request::getInstance();
     parent::__construct();
     //set default timezone if is not set
     if (!ini_get('date.timezone')) {
         ini_set('date.timezone', 'UTC');
     }
     WM_Users::initSession(JO_Session::get('user[user_id]'));
     if (!JO_Session::get('user[user_id]')) {
         JO_Session::set('user', array('user_id' => 0));
     }
     //mobile version
     if ($request->issetParam('full_version')) {
         $re = $request->setCookie('full_version', 1, 86400, '/', '.' . $request->getDomain());
         $this->redirect($request->getBaseUrl());
     } else {
         if ($request->issetParam('remove_full_version')) {
             $re = $request->setCookie('full_version', 0, 86400, '/', '.' . $request->getDomain());
             $this->redirect($request->getBaseUrl());
         }
     }
     $mobile_detect = new JO_Mobile_Detect();
     JO_Registry::set('isMobile', false);
     if ($mobile_detect->isMobile() && !$mobile_detect->isTablet() && in_array('mobile', WM_Modules::getTemplates())) {
         if (!$request->getCookie('full_version')) {
             JO_Registry::set('template', 'mobile');
             Helper_Config::set('config_disable_js', 0);
             if (Helper_Config::get('site_logo_mobile')) {
                 Helper_Config::set('site_logo', Helper_Config::get('site_logo_mobile'));
             }
         }
         JO_Registry::set('isMobile', true);
     }
     //is not ajax
     if (!$request->isXmlHttpRequest()) {
         WM_Licensecheck::checkIt();
         if (Helper_Config::get('config_maintenance')) {
             if ($request->getController() != 'error' && $request->getAction() != 'maintenance') {
                 $this->forward('error', 'maintenance');
             }
         }
         ////first login
         if (JO_Session::get('user[user_id]')) {
             if (JO_Session::get('user[first_login]')) {
                 if (!in_array($request->getController(), array('pages', 'smuk', 'crons', 'pin', 'boards', 'js', 'json', 'cache', 'data'))) {
                     if ($request->getParam('direct_path') != 'true') {
                         if ($request->getController() != 'welcome') {
                             if ($request->getController() == 'users' && $request->getAction() == 'logout') {
                             } else {
                                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=welcome'));
                             }
                         }
                     }
                 }
             } else {
                 if ($request->getController() == 'welcome') {
                     JO_Action::getInstance()->redirect($request->getBaseUrl());
                 }
             }
         } elseif ($request->getController() == 'welcome') {
             JO_Action::getInstance()->redirect($request->getBaseUrl());
         }
     }
     Helper_Config::check();
     WM_Licensecheck::checkIt();
 }
Пример #18
0
 private function loginInit($id, $session = null)
 {
     $user_data = WM_Users::checkLoginFacebookTwitter($id, 'twitter', $session);
     if ($user_data) {
         JO_Session::set(array('user' => $user_data));
         JO_Session::clear('user_info_twitteroauth');
         JO_Session::clear('access_token_twitteroauth');
         if (JO_Session::issetKey('next') && JO_Session::get('next')) {
             $this->redirect(urldecode(JO_Session::get('next')));
         } else {
             $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
         }
     }
     return $user_data;
 }
Пример #19
0
 public function finishRegistrationAction()
 {
     $this->noViewRenderer(true);
     $this->noLayout(true);
     $request = $this->getRequest();
     $user_id = Model_Users::getUserByRegKey($request->getParam('key'));
     if ($user_id) {
         if (Model_Users::setKey('1', $user_id)) {
             WM_Users::initSession($user_id);
             $this->redirect(WM_Router::create($request->getBaseUrl() . "?controller=welcome"));
         } else {
             $this->forward('error', 'error404');
         }
     } else {
         $this->forward('error', 'error404');
     }
 }
Пример #20
0
 public function indexAction()
 {
     if (!WM_Users::allow('edit', 'modules')) {
         JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage/');
     }
     $request = $this->getRequest();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         //validate app id
         $this->view->error = false;
         try {
             $s3 = new JO_Api_Amazon($request->getPost('amazons3[amazons3_access_key]'), $request->getPost('amazons3[amazons3_secret_key]'));
             //$s3->putBucket($request->getPost('amazons3[amazons3_bucklet]'), JO_Api_Amazon::ACL_PUBLIC_READ);
             $loged = $s3->getBucketLogging($request->getPost('amazons3[amazons3_bucklet]'));
             if ($loged) {
                 $upload = $s3->putObjectString('test', $request->getPost('amazons3[amazons3_bucklet]'), 'test_upload.txt', JO_Api_Amazon::ACL_PUBLIC_READ);
                 if (!$upload) {
                     $this->view->error = sprintf($this->translate('Unable to upload to Bucklet "%s"'), $request->getPost('amazons3[amazons3_bucklet]'));
                     $loged = false;
                 } else {
                     $is_file = @file_get_contents(trim($request->getPost('amazons3[amazons3_bucklet_location]'), '/') . '/test_upload.txt');
                     if ($is_file != 'test') {
                         $this->view->error = sprintf($this->translate('Unable to read test file "%s"'), trim($request->getPost('amazons3[amazons3_bucklet_location]'), '/') . '/test_upload.txt');
                         $loged = false;
                     }
                 }
             } else {
                 $this->view->error = sprintf($this->translate('Bucklet "%s" not found'), $request->getPost('amazons3[amazons3_bucklet]'));
                 $loged = false;
             }
         } catch (JO_Exception $e) {
             $this->view->error = $e->getMessage();
             $loged = false;
         }
         if ($loged) {
             Model_Settings::updateAll(array('amazons3' => $request->getPost('amazons3')));
             JO_Session::set('successfu_edite', true);
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage_amazons3/');
         } else {
             if (!$this->view->error) {
                 $this->view->error = $this->translate('Invalid App configuration');
             }
         }
     }
     $this->view->modules_url = $this->getRequest()->getModule() . '/modules';
     $this->view->modules_storage_url = $this->getRequest()->getModule() . '/modules_storage';
     $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'amazons3'));
     if (!isset($store_config['amazons3_access_key'])) {
         $store_config['amazons3_access_key'] = '';
     }
     if (!isset($store_config['amazons3_secret_key'])) {
         $store_config['amazons3_secret_key'] = '';
     }
     if (!isset($store_config['amazons3_bucklet'])) {
         $store_config['amazons3_bucklet'] = '';
     }
     if (!isset($store_config['amazons3_bucklet_location'])) {
         $store_config['amazons3_bucklet_location'] = '';
     }
     foreach ($store_config as $key => $data) {
         if ($request->issetPost('amazons3[' . $key . ']')) {
             $this->view->{$key} = $request->getPost('amazons3[' . $key . ']');
         } else {
             $this->view->{$key} = $data;
         }
     }
 }
Пример #21
0
 public function logintwAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     $response = $this->getResponse();
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $callback = $request->getRequest('callback');
     if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) {
         $callback = false;
     }
     $return = array();
     if (isset($_POST['twitter_id'])) {
         $id = $_POST['twitter_id'];
         $user_data = WM_Users::checkLoginFacebookTwitter($id, 'twitter');
         if ($user_data) {
             JO_Session::set(array('user' => $user_data));
             JO_Session::clear('user_info_twitteroauth');
             JO_Session::clear('access_token_twitteroauth');
             $token = md5($user_data['user_id']);
             $_SESSION['token'] = $token;
             JO_Session::set('token', $token);
             $avatar = Helper_Uploadimages::avatar($user_data, '_A');
             $return = array('id' => $user_data['user_id'], 'username' => $user_data['username'], 'token' => $token, 'firstname' => $user_data['firstname'], 'lastname' => $user_data['lastname'], 'avatar' => $avatar['image']);
         } else {
             $return = array('error' => 14, 'description' => $this->translate("Error en el login de twitter"));
         }
     }
     //$token = md5(uniqid(rand(), true));
     if ($callback) {
         $return = $callback . '(' . JO_Json::encode($return) . ')';
     } else {
         $response->addHeader('Cache-Control: no-cache, must-revalidate');
         $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         $response->addHeader('Content-type: application/json; charset=utf-8');
         $return = JO_Json::encode($return);
     }
     $response->appendBody($return);
 }
Пример #22
0
 public function _initUserSession()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     WM_Users::initSession(JO_Session::get('user_id'));
 }
Пример #23
0
 public function deleteImageAction()
 {
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         $this->forward('error', 'noPermission');
     }
     $gallery_id = (int) $this->getRequest()->getRequest('id');
     $this->setInvokeArg('noViewRenderer', true);
     $image_id = $this->getRequest()->getPost('id');
     if ($gallery_id) {
         echo Model_Gallery::deleteImage($image_id);
     } else {
         $temporary_images = JO_Session::get('temporary_images');
         $temp = array();
         foreach ($temporary_images as $key => $image) {
             if ($key != $image_id) {
                 $temp[] = $image;
             } else {
                 $mi = new Helper_Images();
                 $mi->deleteImages($image['image']);
             }
         }
         echo 'ok';
         JO_Session::set('temporary_images', $temp);
     }
 }
Пример #24
0
 public function indexAction()
 {
     if (!WM_Users::allow('edit', 'modules')) {
         JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage/');
     }
     $request = $this->getRequest();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         //validate app id
         $auth = new JO_Api_Rackspace_Authentication($request->getPost('rackspace[rackspace_api_username]'), $request->getPost('rackspace[rackspace_api_key]'), $request->getPost('rackspace[rackspace_account_name]') ? $request->getPost('rackspace[rackspace_account_name]') : NULL, $request->getPost('rackspace[rackspace_authentication_service_uri]') == 'UK' ? JO_Api_Rackspace_Authentication::UK_AUTHURL : JO_Api_Rackspace_Authentication::US_AUTHURL);
         $loged = false;
         try {
             $loged = $auth->authenticate();
             $connect = new JO_Api_Rackspace_Connection($auth);
             try {
                 $images = $connect->get_container($request->getPost('rackspace[rackspace_pins_contaners]'));
                 if (!$images->cdn_uri) {
                     $this->view->error = sprintf(self::translate('Authentication response did not indicate CDN availability for "%s"'), $request->getPost('rackspace[rackspace_pins_contaners]'));
                     $loged = false;
                 }
             } catch (JO_Exception $e) {
                 $this->view->error = sprintf($this->translate('Container "%s" not found.'), $request->getPost('rackspace[rackspace_pins_contaners]'));
                 $loged = false;
             }
             try {
                 $images = $connect->get_container($request->getPost('rackspace[rackspace_users_contaners]'));
                 if (!$images->cdn_uri) {
                     $this->view->error = sprintf(self::translate('Authentication response did not indicate CDN availability for "%s"'), $request->getPost('rackspace[rackspace_pins_contaners]'));
                     $loged = false;
                 }
             } catch (JO_Exception $e) {
                 $this->view->error = sprintf($this->translate('Container "%s" not found.'), $request->getPost('rackspace[rackspace_pins_contaners]'));
                 $loged = false;
             }
         } catch (JO_Exception $e) {
             $this->view->error = $e->getMessage();
             $loged = false;
         }
         if ($loged) {
             Model_Settings::updateAll(array('rackspace' => $request->getPost('rackspace')));
             JO_Session::set('successfu_edite', true);
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_storage_rackspace/');
         } else {
             //$this->view->error = $this->translate('Invalid App configuration');
         }
     }
     $this->view->modules_url = $this->getRequest()->getModule() . '/modules';
     $this->view->modules_storage_url = $this->getRequest()->getModule() . '/modules_storage';
     $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'rackspace'));
     if (!isset($store_config['rackspace_api_username'])) {
         $store_config['rackspace_api_username'] = '';
     }
     if (!isset($store_config['rackspace_api_key'])) {
         $store_config['rackspace_api_key'] = '';
     }
     if (!isset($store_config['rackspace_pins_contaners'])) {
         $store_config['rackspace_pins_contaners'] = '';
     }
     if (!isset($store_config['rackspace_pins_contaners_cdn'])) {
         $store_config['rackspace_pins_contaners_cdn'] = '';
     }
     if (!isset($store_config['rackspace_users_contaners'])) {
         $store_config['rackspace_users_contaners'] = '';
     }
     if (!isset($store_config['rackspace_users_contaners_cdn'])) {
         $store_config['rackspace_users_contaners_cdn'] = '';
     }
     if (!isset($store_config['rackspace_account_name'])) {
         $store_config['rackspace_account_name'] = '';
     }
     if (!isset($store_config['rackspace_authentication_service_uri'])) {
         $store_config['rackspace_authentication_service_uri'] = '';
     }
     foreach ($store_config as $key => $data) {
         if ($request->issetPost('rackspace[' . $key . ']')) {
             $this->view->{$key} = $request->getPost('rackspace[' . $key . ']');
         } else {
             $this->view->{$key} = $data;
         }
     }
 }
Пример #25
0
 private function loginInit($id, $session, $row = 'id')
 {
     $user_data = WM_Users::checkLoginFacebookTwitter($id, 'facebook', $session, false, $row);
     if ($user_data) {
         JO_Session::set(array('user' => $user_data));
         JO_Session::clear('fb_login');
         /*if(JO_Session::issetKey('next') && JO_Session::get('next')) {
         			$this->redirect( ( urldecode(JO_Session::get('next')) ) );
         		} else {
         			$this->redirect( WM_Router::create( $this->getRequest()->getBaseUrl() ) );
         		}*/
         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
     }
     return $user_data;
 }