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');
     }
 }
Beispiel #2
0
 public static function add_fanpage($page)
 {
     $item = Model_Pages::forge(array('fanpage_id' => $page['fanpage_id'], 'name' => $page['name'], 'long_lived_access_token' => $page['long_lived_access_token'], 'cover' => $page['cover']));
     if (!$item->save()) {
         return false;
     }
     return true;
 }
 public function action_index()
 {
     //*** Get Page list of user
     $data['page_list'] = Model_Pages::get_page_list(Session::get('user_id'));
     $data['user_pages'] = Libs\Helper\Filter::filter_fb_page(Session::get('user_id'), Session::get('user_token'));
     $this->template->content = View::forge('contents/user_dashboard.twig', $data);
     $this->template->modals = array(View::forge('contents/modals/add_new_fanpage.twig', $data));
 }
 public static function post_photo_to_fb_by_url($data)
 {
     $data = json_decode($data);
     $flag = false;
     $facebook = new \Libs\Facebook();
     $page = \Model_Pages::find(\Fuel\Core\Input::post('page_id'));
     $flag = $facebook->post_photo_by_url($page->long_lived_access_token, $page->fanpage_id, $data);
     return $flag;
 }
 /**
  * indexAllPublicPages
  * @return void
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function indexAllPublicPages()
 {
     try {
         $this->getModelPages();
         $objPagesData = $this->objModelPages->loadAllPublicPages();
         foreach ($objPagesData as $objPageData) {
             $this->indexPage($objPageData->pageId, $objPageData->version, $objPageData->idLanguages);
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
 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']));
         }
     }
 }
Beispiel #7
0
 public static function add_new_post($data)
 {
     $user = Model_Users::find('first', array('where' => array('fb_id' => $data['author'])));
     $page = Model_Pages::find($data['page_id']);
     $post = Model_Posts::forge($data);
     $post->author = $user->id;
     $post->modifier = $user->id;
     $post->page_id = $page->id;
     if (!$post->save()) {
         return false;
     }
     return true;
 }
Beispiel #8
0
 public function loginAction()
 {
     $request = $this->getRequest();
     //		if( JO_Session::get('user[user_id]') ) {
     //			$this->redirect( WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]') ) );
     //		}
     /*if($request->getQuery('session')) {
     			$session = JO_Json::decode( html_entity_decode($request->getQuery('session')), true );
     			if($session) {
     				$this->facebook->setSession($session);
     				if($request->getQuery('next')) {
     					JO_Session::set('next', $request->getQuery('next'));
     				}
     			}
     		}*/
     $session = $this->facebook->getUser();
     $fbData = null;
     if ($session) {
         $fbData = $this->facebook->api('/me');
     }
     if ($fbData) {
         if (!isset($fbData['email'])) {
             $fbData['email'] = '';
         }
         if (!self::loginInit($fbData['id'], $session)) {
             //if(!self::loginInit($fbData['email'], $session, 'email')) {
             if (JO_Registry::get('enable_free_registration')) {
                 $this->forward('facebook', 'register', array('fbData' => $fbData, 'session' => $session, 'shared_content' => array()));
             }
             $shared_content = Model_Users::checkInvateFacebookID($fbData['id']);
             if ($shared_content) {
                 $this->forward('facebook', 'register', array('fbData' => $fbData, 'session' => $session, 'shared_content' => $shared_content));
             } else {
                 $this->setViewChange('no_account');
                 $page_login_trouble = Model_Pages::getPage(JO_Registry::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 {
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(JO_Registry::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']));
         }
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
 /**
  * getModelPages
  * @return Model_Pages
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected function getModelPages()
 {
     if (null === $this->objModelPages) {
         /**
          * autoload only handles "library" compoennts.
          * Since this is an application model, we need to require it
          * from its modules path location.
          */
         require_once GLOBAL_ROOT_PATH . $this->core->sysConfig->path->zoolu_modules . 'cms/models/Pages.php';
         $this->objModelPages = new Model_Pages();
         $this->objModelPages->setLanguageId($this->objElement->Setup()->getLanguageId());
     }
     return $this->objModelPages;
 }
Beispiel #10
0
 public function indexAction()
 {
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $pageID = $this->getRequest()->getRequest('page_id');
     $this->view->page = Model_Pages::get($pageID);
     if ($this->view->page['sub_of'] == 0) {
         $headPage = $this->view->page;
         $subPages = Model_Pages::getSubPages($pageID);
         //		if(!$subPages) {
         //			$this->view->usersCount = Model_Users::countUsers();
         //			$this->view->itemsCount = Model_Items::countItems();
         //		}
     } else {
         $headPage = Model_Pages::get($this->view->page['sub_of']);
         $subPages = Model_Pages::getSubPages($this->view->page['sub_of']);
         $crumbs = array();
         $parentPages = Model_Pages::getPageParents($this->view->page['sub_of']);
         if ($parentPages) {
             $cnt = count($parentPages);
             for ($i = 0; $i < $cnt; $i++) {
                 $crumbs[$i + 1] = array('name' => $parentPages[$i]['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $parentPages[$i]['id'] . '&name=' . WM_Router::clearName($parentPages[$i]['name'])));
             }
         }
     }
     $this->view->crumbs = array(array('name' => $this->view->translate('Home'), 'href' => $this->getRequest()->getBaseUrl()));
     if (isset($crumbs)) {
         $this->view->crumbs += $crumbs;
     }
     if ($subPages) {
         $this->view->subPages[] = array('name' => $headPage['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $headPage['id'] . '&name=' . WM_Router::clearName($headPage['name'])), 'is_selected' => $headPage['id'] == $pageID ? true : false);
         foreach ($subPages as $page) {
             $this->view->subPages[] = array('name' => $page['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $page['id'] . '&name=' . WM_Router::clearName($page['name'])), 'is_selected' => $page['id'] == $pageID ? true : false);
         }
     }
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     $model_images = new Model_Images();
     $this->view->page['text'] = html_entity_decode($this->view->page['text'], ENT_QUOTES, 'utf-8');
     $this->view->page['text'] = $model_images->fixEditorText($this->view->page['text']);
     $this->getLayout()->meta_title = $this->view->page['meta_title'];
     $this->getLayout()->meta_description = $this->view->page['meta_description'];
     $this->getLayout()->meta_keywords = $this->view->page['meta_keywords'];
     $this->view->quiz_link = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=quiz');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Beispiel #11
0
 public function loginAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         /* @var $twitteroauth JO_Api_Twitter_OAuth */
         $twitteroauth = new JO_Api_Twitter_OAuth(JO_Registry::get('oauth_tw_key'), JO_Registry::get('oauth_tw_secret'), JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'));
         $access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
         $user_info = $twitteroauth->get('account/verify_credentials');
         if ($user_info && $user_info->id) {
             Model_Users::edit(JO_Session::get('user[user_id]'), array('twitter_connect' => 1, 'twitter_id' => $user_info->id, 'twitter_username' => $user_info->screen_name));
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=settings'));
         }
     }
     $twitteroauth = new JO_Api_Twitter_OAuth(JO_Registry::get('oauth_tw_key'), JO_Registry::get('oauth_tw_secret'), JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'));
     //		$data = $twitteroauth->getAccessToken( );
     //		echo '<pre>';
     //		var_dump(JO_Session::get('twitter[oauth_token]'), JO_Session::get('twitter[oauth_token_secret]'),$twitteroauth->getAccessToken()); exit;
     if (!JO_Session::get('user_info_twitteroauth')) {
         $access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
         $user_info = $twitteroauth->get('account/verify_credentials');
         JO_Session::set('user_info_twitteroauth', $user_info);
         JO_Session::set('access_token_twitteroauth', $access_token);
     } else {
         $user_info = JO_Session::get('user_info_twitteroauth');
     }
     if ($request->issetQuery('next')) {
         JO_Session::set('next', html_entity_decode($request->getQuery('next')));
     }
     //		$access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
     //		$user_info = $twitteroauth->get('account/verify_credentials');
     if (isset($user_info->id) && $user_info->id) {
         if (!self::loginInit($user_info->id)) {
             $this->setViewChange('no_account');
             $page_login_trouble = Model_Pages::getPage(JO_Registry::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']));
             }
             $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
         }
     } else {
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(JO_Registry::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']));
         }
         $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
     }
 }
Beispiel #12
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $invate = Model_Users::checkInvateFacebook($request->getQuery('code'));
     if (!$invate) {
         $this->setViewChange('../facebook/no_account');
         $page_login_trouble = Model_Pages::getPage(JO_Registry::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 {
         // 			$this->facebook->setNextUrl( WM_Router::create( $request->getBaseUrl() . '?controller=facebook&action=login&next='.urlencode('/').'&code=' . $request->getQuery('code') ) );
         // 			$this->view->facebook_login_url = $this->facebook->getLoginUrl();
         $this->view->facebook_login_url = $this->facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=facebook&action=login&next=' . urlencode('/') . '&code=' . $request->getQuery('code')), 'req_perms' => 'email,user_birthday,status_update,user_videos,user_status,user_photos,offline_access,read_friendlists'));
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
 public function indexAction()
 {
     $request = $this->getRequest();
     $facebookCheck = new Model_Facebook_Login();
     $invate = $facebookCheck->checkInvateFacebook($request->getQuery('code'));
     if (!$invate) {
         $this->setViewChange('../login/no_account');
         $page_login_trouble = Model_Pages::getPage(JO_Registry::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 {
         $facebookObject = new Helper_Modules_Facebook();
         $this->view->facebook_login_url = $facebookObject->getLoginUrl(null, 'modules_facebook_register');
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Beispiel #14
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=fromurl');
     $this->view->from_file = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=fromfile');
     $this->view->add_board = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create');
     $goodies = Model_Pages::getPage(JO_Registry::get('page_goodies'));
     $pin_text = $this->translate('Pin images from any website as you browse the web with the %s"Pin 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=' . JO_Registry::get('page_goodies')) . '">', '</a>');
     }
     $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->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'layout/left_part');
     }
 }
Beispiel #15
0
 /**
  * getModel
  * @return type Model
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected function getModel()
 {
     if ($this->objModel === null) {
         /**
          * autoload only handles "library" compoennts.
          * Since this is an application model, we need to require it
          * from its modules path location.
          */
         $strModelFilePath = GLOBAL_ROOT_PATH . $this->core->sysConfig->path->zoolu_modules . $this->objElement->Setup()->getModelSubPath() . (substr($this->strType, strlen($this->strType) - 1) == 'y' ? ucfirst(rtrim($this->strType, 'y')) . 'ies' : ucfirst($this->strType) . 's') . '.php';
         if (file_exists($strModelFilePath)) {
             require_once $strModelFilePath;
             $this->objModel = new Model_Pages();
             $this->objModel->setLanguageId($this->objElement->Setup()->getLanguageId());
         } else {
             throw new Exception('Not able to load type specific model, because the file didn\'t exist! - strType: "' . $this->strType . '"');
         }
     }
     return $this->objModel;
 }
Beispiel #16
0
 public function ajaxReadAction()
 {
     if ($this->getRequest()->isXmlHttpRequest() || $this->getRequest()->issetQuery('popup')) {
         //	    	$this->noLayout(true);
     } else {
         $this->forward('pages', 'read');
     }
     $pageIDs = explode('_', $this->getRequest()->getRequest('page_id'));
     $pageID = end($pageIDs);
     $this->view->page = Model_Pages::getPage($pageID);
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     $model_images = new Helper_Images();
     $this->view->page['description'] = html_entity_decode($this->view->page['description'], ENT_QUOTES, 'utf-8');
     if (JO_Registry::get('config_fix_image_thumb_editor')) {
         $this->view->page['description'] = $model_images->fixEditorText($this->view->page['description']);
     }
     if (JO_Registry::get('config_fix_external_urls')) {
         $this->view->page['description'] = $this->fixUrl($this->view->page['description']);
     }
     $this->view->full_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $pageID);
 }
Beispiel #17
0
 public function rightsideAction()
 {
     $request = $this->getRequest();
     $limit = JO_Registry::get('front_limit');
     if ($request->getAction() == 'topic') {
         $this->view->add_link_head = $this->translate('Post a reply');
     } else {
         $this->view->add_link_head = $this->translate('Post new thread');
     }
     $help = Model_Pages::get(JO_Registry::forceGet('page_forum_rules'));
     if ($help) {
         $this->view->rules_link = WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id'] . '&name=' . WM_Router::clearName($help['name']));
     }
     if (JO_Session::get('user_id')) {
         $lnk = $request->getFullUrl();
         $lnk = explode('#', $lnk);
         $this->view->post_link = $lnk[0] . '#cform';
     } else {
         $this->view->post_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
     }
     $threads = Model_Forum::getLastThreads();
     $this->view->threads = array();
     if ($threads) {
         foreach ($threads as $thread) {
             $thread['href'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=topic/' . $thread['id'] . '/' . WM_Router::clearName($thread['name']));
             if ($thread['lusername']) {
                 $thread['last_href'] = '';
                 $thread['datetime'] = WM_Date::format($thread['last_post'], 'dd M yy H:i');
                 $last_page = ceil($thread['cnt'] / $limit);
                 $thread['lasthref'] = $thread['href'] . ($last_page > 1 ? '/page/' . $last_page : '');
             }
             $this->view->threads[] = $thread;
         }
     }
     if (JO_Session::get('user_id')) {
         $rthreads = Model_Forum::getRecentThreads(JO_Session::get('user_id'));
         $this->view->recent_threads = array();
         if ($rthreads) {
             foreach ($rthreads as $rthread) {
                 $rthread['href'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=topic/' . $rthread['id'] . '/' . WM_Router::clearName($rthread['name']));
                 if ($rthread['lusername']) {
                     $rthread['last_href'] = '';
                     $rthread['datetime'] = WM_Date::format($rthread['last_post'], 'dd M yy H:i');
                     $last_page = ceil($rthread['cnt'] / $limit);
                     $rthread['lasthref'] = $rthread['href'] . ($last_page > 1 ? '/page/' . $last_page : '');
                 }
                 $this->view->recent_threads[] = $rthread;
             }
         }
     }
     $this->view->srch_link = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=search');
     $this->view->rss_link = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=rss');
 }
Beispiel #18
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('twitter');
     if (!isset($settings['twitter_login_with_twitter']) || !$settings['twitter_login_with_twitter']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['twitter_module_status_enable']) || !$settings['twitter_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $twitteroauth = new Helper_Modules_Twitter(null, null, JO_Session::get('twitter_oauth[oauth_token]'), JO_Session::get('twitter_oauth[oauth_token_secret]'));
     $user_data = JO_Session::get('user_info_twitteroauth');
     if (!$user_data || isset($user_data->errors) && $user_data->errors) {
         $access_token = $twitteroauth->getAccessToken($request->getQuery('oauth_verifier'));
         $user_data = $twitteroauth->get('account/verify_credentials');
         JO_Session::set('user_info_twitteroauth', $user_data);
         JO_Session::set('access_token_twitteroauth', $access_token);
     } else {
         $user_data = JO_Session::get('user_info_twitteroauth');
     }
     if ((!isset($user_data->error) || !$user_data->error) && $user_data->id) {
         $modelLogin = new Model_Twitter_Login($user_data->id);
         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()')));
                 $up = $modelLogin->update(array('twitter_oauth_token' => JO_Session::get('twitter_oauth[oauth_token]'), 'twitter_oauth_token_secret' => JO_Session::get('twitter_oauth[oauth_token_secret]'), 'username' => $user_data->screen_name));
                 //JO_Session::clear('user_info_twitteroauth');
                 //JO_Session::clear('access_token_twitteroauth');
                 //JO_Session::get('twitter_oauth');
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         }
         if ((Helper_Config::get('enable_free_registration') || $request->getQuery('twitter_fnc') == 'connect') && $request->getQuery('next')) {
             $full = html_entity_decode($request->getFullUrl());
             $next = parse_url(urldecode($full));
             if (isset($next['query'])) {
                 parse_str($next['query'], $query);
                 if (isset($query['next']) && $query['next'] && isset($query['twitter_fnc']) && $query['twitter_fnc']) {
                     $this->redirect($query['next']);
                 } elseif (Helper_Config::get('enable_free_registration')) {
                     $this->forward('modules_twitter_register');
                 }
             }
         }
         $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 {
         if ($request->getQuery('twitter_fnc') == 'connect' && $request->getQuery('next')) {
             $full = html_entity_decode($request->getFullUrl());
             $next = parse_url(urldecode($full));
             if (isset($next['query'])) {
                 parse_str($next['query'], $query);
                 if (isset($query['next']) && $query['next'] && isset($query['twitter_fnc']) && $query['twitter_fnc']) {
                     $this->redirect($query['next']);
                 }
             }
         }
         //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']));
         }
     }
 }
Beispiel #19
0
 private function getPageForm()
 {
     $request = $this->getRequest();
     $page_id = $request->getQuery('id');
     $pages_module = new Model_Pages();
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($page_id) {
         $page_info = $pages_module->getPage($page_id);
     }
     $this->view->languages = array();
     $this->view->def_lang = false;
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
         foreach ($languages as $language) {
             if ($language['language_id'] == JO_Registry::get('default_config_language_id')) {
                 $this->view->def_lang = $language['code'];
             }
             $this->view->name[$language['language_id']] = '';
             $this->view->text[$language['language_id']] = '';
         }
     }
     if ($sub_of) {
         $category_info = $pages_module->getPagePath($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/pages/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/pages/?sub_of=' . $category_info['sub_of'];
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($page_info)) {
         $this->view->name = array();
         foreach ($page_info as $i) {
             $this->view->name[$i['lid']] = $i['name'];
         }
     }
     if ($request->getPost('text')) {
         $this->view->text = $request->getPost('text');
     } elseif (isset($page_info)) {
         $this->view->text = array();
         foreach ($page_info as $i) {
             $this->view->text[$i['lid']] = $i['text'];
         }
     }
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($page_info)) {
         $this->view->visible = $page_info[0]['visible'];
     } else {
         $this->view->visible = 'true';
     }
     if ($request->getPost('meta_title')) {
         $this->view->meta_title = $request->getPost('meta_title');
     } elseif (isset($page_info)) {
         $this->view->meta_title = $page_info[0]['meta_title'];
     } else {
         $this->view->meta_title = '';
     }
     if ($request->getPost('meta_keywords')) {
         $this->view->meta_keywords = $request->getPost('meta_keywords');
     } elseif (isset($page_info)) {
         $this->view->meta_keywords = $page_info[0]['meta_keywords'];
     } else {
         $this->view->meta_keywords = '';
     }
     if ($request->getPost('meta_description')) {
         $this->view->meta_description = $request->getPost('meta_description');
     } elseif (isset($page_info)) {
         $this->view->meta_description = $page_info[0]['meta_description'];
     } else {
         $this->view->meta_description = '';
     }
     if ($request->getPost('menu')) {
         $this->view->menu = $request->getPost('menu');
     } elseif (isset($page_info)) {
         $this->view->menu = $page_info[0]['menu'];
     } else {
         $this->view->menu = '';
     }
     if ($request->getPost('footer')) {
         $this->view->footer = $request->getPost('footer');
     } elseif (isset($page_info)) {
         $this->view->footer = $page_info[0]['footer'];
     } else {
         $this->view->footer = 'false';
     }
     if ($request->getPost('key')) {
         $this->view->key = $request->getPost('key');
     } elseif (isset($page_info)) {
         $this->view->key = $page_info[0]['key'];
     } else {
         $this->view->key = '';
     }
     if ($request->getPost('url')) {
         $this->view->url = $request->getPost('url');
     } elseif (isset($page_info)) {
         $this->view->url = $page_info[0]['url'];
     } else {
         $this->view->url = '';
     }
 }
Beispiel #20
0
 public function getForm()
 {
     $request = $this->getRequest();
     $this->view->templates = $this->getTemplates(array('mobile'));
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->pages_about = array();
     $this->view->pages_about[] = array('title' => $this->translate('SEPARATOR MENU'), 'page_id' => -1);
     if ($this->view->pages) {
         foreach ($this->view->pages as $p) {
             $this->view->pages_about[] = array('title' => $p['title'], 'page_id' => $p['page_id']);
         }
     }
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->app_path = BASE_PATH;
     //////////////////////////////////////// OAUTH ////////////////////////////////////////
     //facebook
     if (isset($config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $config['oauth_fb_key'];
     } elseif (isset($store_config['oauth_fb_key'])) {
         $this->view->oauth_fb_key = $store_config['oauth_fb_key'];
     }
     if (isset($config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $config['oauth_fb_secret'];
     } elseif (isset($store_config['oauth_fb_secret'])) {
         $this->view->oauth_fb_secret = $store_config['oauth_fb_secret'];
     }
     if (isset($config['og_namespace'])) {
         $this->view->og_namespace = $config['og_namespace'];
     } elseif (isset($store_config['og_namespace'])) {
         $this->view->og_namespace = $store_config['og_namespace'];
     }
     if (isset($config['og_recipe'])) {
         $this->view->og_recipe = $config['og_recipe'];
     } elseif (isset($store_config['og_recipe'])) {
         $this->view->og_recipe = $store_config['og_recipe'];
     }
     //twitter
     if (isset($config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $config['oauth_tw_key'];
     } elseif (isset($store_config['oauth_tw_key'])) {
         $this->view->oauth_tw_key = $store_config['oauth_tw_key'];
     }
     if (isset($config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $config['oauth_tw_secret'];
     } elseif (isset($store_config['oauth_tw_secret'])) {
         $this->view->oauth_tw_secret = $store_config['oauth_tw_secret'];
     }
     ///instagram
     if (isset($config['oauth_in_key'])) {
         $this->view->oauth_in_key = $config['oauth_in_key'];
     } elseif (isset($store_config['oauth_in_key'])) {
         $this->view->oauth_in_key = $store_config['oauth_in_key'];
     }
     if (isset($config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $config['oauth_in_secret'];
     } elseif (isset($store_config['oauth_in_secret'])) {
         $this->view->oauth_in_secret = $store_config['oauth_in_secret'];
     }
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['config_base_domain'])) {
         $this->view->config_base_domain = $config['config_base_domain'];
     } elseif (isset($store_config['config_base_domain'])) {
         $this->view->config_base_domain = $store_config['config_base_domain'];
     } else {
         $this->view->config_base_domain = $request->getBaseUrl();
     }
     if (isset($config['config_on_facebook'])) {
         $this->view->config_on_facebook = $config['config_on_facebook'];
     } elseif (isset($store_config['config_on_facebook'])) {
         $this->view->config_on_facebook = $store_config['config_on_facebook'];
     } else {
         $this->view->config_on_facebook = '';
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     if (isset($config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $config['config_fix_image_thumb_editor'];
     } elseif (isset($store_config['config_fix_image_thumb_editor'])) {
         $this->view->config_fix_image_thumb_editor = $store_config['config_fix_image_thumb_editor'];
     }
     if (isset($config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $config['config_fix_external_urls'];
     } elseif (isset($store_config['config_fix_external_urls'])) {
         $this->view->config_fix_external_urls = $store_config['config_fix_external_urls'];
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['site_name'])) {
         $this->view->site_name = $config['site_name'];
     } elseif (isset($store_config['site_name'])) {
         $this->view->site_name = $store_config['site_name'];
     }
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['config_admin_limit'])) {
         $this->view->config_admin_limit = $config['config_admin_limit'];
     } elseif (isset($store_config['config_admin_limit'])) {
         $this->view->config_admin_limit = $store_config['config_admin_limit'];
     } else {
         $this->view->config_admin_limit = 15;
     }
     if (isset($config['config_front_limit'])) {
         $this->view->config_front_limit = $config['config_front_limit'];
     } elseif (isset($store_config['config_front_limit'])) {
         $this->view->config_front_limit = $store_config['config_front_limit'];
     } else {
         $this->view->config_front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['config_maintenance'])) {
         $this->view->config_maintenance = $config['config_maintenance'];
     } elseif (isset($store_config['config_maintenance'])) {
         $this->view->config_maintenance = $store_config['config_maintenance'];
     } else {
         $this->view->config_maintenance = 0;
     }
     if (isset($config['config_hide_brand'])) {
         $this->view->config_hide_brand = $config['config_hide_brand'];
     } elseif (isset($store_config['config_hide_brand'])) {
         $this->view->config_hide_brand = $store_config['config_hide_brand'];
     } else {
         $this->view->config_hide_brand = 0;
     }
     $this->view->data_timezones = JO_Date_Timezones::getTimezonse();
     if (isset($config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $config['phpSettings']['date.timezone'];
     } elseif (isset($store_config['phpSettings']['date.timezone'])) {
         $this->view->date_timezone = $store_config['phpSettings']['date.timezone'];
     } else {
         $this->view->date_timezone = 'UTC';
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     if (isset($config['config_cache_live'])) {
         $this->view->config_cache_live = $config['config_cache_live'];
     } elseif (isset($store_config['config_cache_live'])) {
         $this->view->config_cache_live = $store_config['config_cache_live'];
     } else {
         $this->view->config_cache_live = 0;
     }
     if (isset($config['enable_free_registration'])) {
         $this->view->enable_free_registration = $config['enable_free_registration'];
     } elseif (isset($store_config['enable_free_registration'])) {
         $this->view->enable_free_registration = $store_config['enable_free_registration'];
     } else {
         $this->view->enable_free_registration = 0;
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['noreply_mail'])) {
         $this->view->noreply_mail = $config['noreply_mail'];
     } elseif (isset($store_config['noreply_mail'])) {
         $this->view->noreply_mail = $store_config['noreply_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     if (isset($config['mail_footer'])) {
         $this->view->mail_footer = $config['mail_footer'];
     } elseif (isset($store_config['mail_footer'])) {
         $this->view->mail_footer = $store_config['mail_footer'];
     }
     if (isset($config['not_rp'])) {
         $this->view->not_rp = $config['not_rp'];
     } elseif (isset($store_config['not_rp'])) {
         $this->view->not_rp = $store_config['not_rp'];
     } else {
         $this->view->not_rp = 0;
     }
     if (isset($config['not_rc'])) {
         $this->view->not_rc = $config['not_rc'];
     } elseif (isset($store_config['not_rc'])) {
         $this->view->not_rc = $store_config['not_rc'];
     } else {
         $this->view->not_rc = 0;
     }
     if (isset($config['not_ri'])) {
         $this->view->not_ri = $config['not_ri'];
     } elseif (isset($store_config['not_ri'])) {
         $this->view->not_ri = $store_config['not_ri'];
     } else {
         $this->view->not_ri = 0;
     }
     //////////////////////////////////////// AMAZON ////////////////////////////////////////
     $uploads_methods = $this->uploadsMethods();
     $this->view->uploads_methods = array();
     foreach ($uploads_methods as $method) {
         $this->view->uploads_methods[] = $this->view->callChildren('upload_' . $method);
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Helper_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     ////mobile logo
     if (isset($images['site_logo_mobile']) && $images['site_logo_mobile']) {
         $this->view->site_logo_mobile = $images['site_logo_mobile'];
     } elseif (isset($store_config['site_logo_mobile']) && $store_config['site_logo_mobile']) {
         $this->view->site_logo_mobile = $store_config['site_logo_mobile'];
     } else {
         $this->view->site_logo_mobile = '';
     }
     if ($this->view->site_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize($this->view->site_logo_mobile, 100, 100);
     } else {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo_mobile) {
         $this->view->preview_logo_mobile = $image_model->resize('/logo.png', 100, 100);
     }
     $this->view->preview_mobile = $image_model->resize('/logo.png', 100, 100);
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// no avatar
     if (isset($images['no_avatar']) && $images['no_avatar']) {
         $this->view->no_avatar = $images['no_avatar'];
     } elseif (isset($store_config['no_avatar']) && $store_config['no_avatar']) {
         $this->view->no_avatar = $store_config['no_avatar'];
     } else {
         $this->view->no_avatar = '/no-avatar.png';
     }
     if ($this->view->no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize($this->view->no_avatar, 100, 100);
     } else {
         $this->view->preview_no_avatar = $image_model->resize('/no-avatar.png', 100, 100);
     }
     if (!$this->view->preview_no_avatar) {
         $this->view->preview_no_avatar = $image_model->resize('/no_image.png', 100, 100);
     }
     ////// favicon
     if (isset($images['favicon']) && $images['favicon']) {
         $this->view->favicon = $images['favicon'];
     } elseif (isset($store_config['favicon']) && $store_config['favicon']) {
         $this->view->favicon = $store_config['favicon'];
     } else {
         $this->view->favicon = '';
     }
     if ($this->view->favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->favicon, 100, 100);
     } else {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     if (!$this->view->preview_favicon) {
         $this->view->preview_favicon = $image_model->resize($this->view->no_image, 100, 100);
     }
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['about_menu'])) {
         $this->view->about_menu = $pages['about_menu'];
     } elseif (isset($store_config['about_menu'])) {
         $this->view->about_menu = $store_config['about_menu'];
     } else {
         $this->view->about_menu = array();
     }
     if (isset($pages['page_login_trouble'])) {
         $this->view->page_login_trouble = $pages['page_login_trouble'];
     } elseif (isset($store_config['page_login_trouble'])) {
         $this->view->page_login_trouble = $store_config['page_login_trouble'];
     } else {
         $this->view->page_login_trouble = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_contact'])) {
         $this->view->page_contact = $pages['page_contact'];
     } elseif (isset($store_config['page_contact'])) {
         $this->view->page_contact = $store_config['page_contact'];
     } else {
         $this->view->page_contact = 0;
     }
     if (isset($pages['page_goodies'])) {
         $this->view->page_goodies = $pages['page_goodies'];
     } elseif (isset($store_config['page_goodies'])) {
         $this->view->page_goodies = $store_config['page_goodies'];
     } else {
         $this->view->page_goodies = 0;
     }
     if (isset($pages['delete_account'])) {
         $this->view->delete_account = $pages['delete_account'];
     } elseif (isset($store_config['delete_account'])) {
         $this->view->delete_account = $store_config['delete_account'];
     } else {
         $this->view->delete_account = 0;
     }
     if (isset($pages['support_page'])) {
         $this->view->support_page = $pages['support_page'];
     } elseif (isset($store_config['support_page'])) {
         $this->view->support_page = $store_config['support_page'];
     } else {
         $this->view->support_page = 0;
     }
     if (isset($pages['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $pages['page_pinmarklet'];
     } elseif (isset($store_config['page_pinmarklet'])) {
         $this->view->page_pinmarklet = $store_config['page_pinmarklet'];
     } else {
         $this->view->page_pinmarklet = 0;
     }
     if (isset($pages['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $pages['page_privacy_policy'];
     } elseif (isset($store_config['page_privacy_policy'])) {
         $this->view->page_privacy_policy = $store_config['page_privacy_policy'];
     } else {
         $this->view->page_privacy_policy = 0;
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->short_dates = array('dd.mm.yy', 'yy-mm-dd');
     $this->view->medium_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy');
     $this->view->long_dates = array('dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy');
     $this->view->long_dates_times = array('dd MM yy H:i:s', 'D, d MM y H:i:s', 'DD, dd-MM-y H:i:s', 'D, d MM yy H:i:s');
     $this->view->news_dates = array('dd M yy', 'D, d M y', 'DD, dd-M-y', 'D, d M yy', 'dd MM yy', 'D, d MM y', 'DD, dd-MM-y', 'D, d MM yy', 'dd MM yy | H:i', 'D, d MM y | H:i', 'DD, dd-MM-y | H:i', 'D, d MM yy | H:i', 'dd MM yy | H:i:s', 'D, d MM y | H:i:s', 'DD, dd-MM-y | H:i:s', 'D, d MM yy | H:i:s');
     if (isset($config['config_date_format_short'])) {
         $this->view->config_date_format_short = $config['config_date_format_short'];
     } elseif (isset($store_config['config_date_format_short'])) {
         $this->view->config_date_format_short = $store_config['config_date_format_short'];
     } else {
         $this->view->config_date_format_short = 'dd.mm.yy';
     }
     if (isset($config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $config['config_date_format_medium'];
     } elseif (isset($store_config['config_date_format_medium'])) {
         $this->view->config_date_format_medium = $store_config['config_date_format_medium'];
     } else {
         $this->view->config_date_format_medium = 'dd M yy';
     }
     if (isset($config['config_date_format_long'])) {
         $this->view->config_date_format_long = $config['config_date_format_long'];
     } elseif (isset($store_config['config_date_format_long'])) {
         $this->view->config_date_format_long = $store_config['config_date_format_long'];
     } else {
         $this->view->config_date_format_long = 'dd MM yy';
     }
     if (isset($config['config_date_format_news'])) {
         $this->view->config_date_format_news = $config['config_date_format_news'];
     } elseif (isset($store_config['config_date_format_news'])) {
         $this->view->config_date_format_news = $store_config['config_date_format_news'];
     } else {
         $this->view->config_date_format_news = 'dd MM yy | H:i';
     }
     if (isset($config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $config['config_date_format_long_time'];
     } elseif (isset($store_config['config_date_format_long_time'])) {
         $this->view->config_date_format_long_time = $store_config['config_date_format_long_time'];
     } else {
         $this->view->config_date_format_long_time = 'dd MM yy H:i:s';
     }
     //////////////////////////////////////// DATES ////////////////////////////////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_without_children' => true));
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = $category;
         }
     }
     if (isset($config['default_category_id'])) {
         $this->view->default_category_id = $config['default_category_id'];
     } elseif (isset($store_config['default_category_id'])) {
         $this->view->default_category_id = $store_config['default_category_id'];
     } else {
         $this->view->default_category_id = 0;
     }
     if (isset($config['default_boards'])) {
         $this->view->default_boards = $config['default_boards'];
     } elseif (isset($store_config['default_boards'])) {
         $this->view->default_boards = $store_config['default_boards'];
     } else {
         $this->view->default_boards = array();
     }
 }
Beispiel #21
0
 public function sendWeeklyAction()
 {
     $request = $this->getRequest();
     $this->view->base_href = $request->getBaseUrl();
     $this->view->site_name = JO_Registry::get('site_name');
     $this->view->on_facebook = JO_Registry::get('config_on_facebook');
     $this->view->site_logo = $this->view->base_href . 'data/images/logo.png';
     if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) {
         $this->view->site_logo = $this->view->base_href . 'uploads' . JO_Registry::get('site_logo');
     }
     $this->view->settings = WM_Router::create($this->view->base_href . '?controller=prefs');
     $goodies = Model_Pages::getPage(JO_Registry::get('page_goodies'));
     if ($goodies) {
         //$this->view->pin_it = WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_goodies'));
         $this->view->pin_it = 'http://amatteur.com/apps';
     }
     $this->view->pages = array();
     $page = Model_Pages::getPage(JO_Registry::get('page_privacy_policy'));
     if ($page) {
         $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy')));
     }
     $page = Model_Pages::getPage(JO_Registry::get('page_terms'));
     if ($page) {
         $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy')));
     }
     $histories = Model_History::getHistoryToday(array('week_range' => WM_Date::x_week_range($this->now)));
     $no_avatar = JO_Registry::get('no_avatar');
     if ($histories) {
         $model_images = new Helper_Images();
         /* BOARDS */
         $this->view->popular_bards = array();
         $populars = Model_Boards::getBoards(array('start' => 0, 'limit' => 6, 'sort' => 'DESC', 'order' => 'boards.total_views', 'where' => new JO_Db_Expr('pins > 4')));
         if ($populars) {
             foreach ($populars as $board) {
                 $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']);
                 $board['thumbs'] = array();
                 $get_big = false;
                 for ($i = 0; $i < 5; $i++) {
                     $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false;
                     if ($image) {
                         if ($get_big) {
                             $size = '_A';
                         } else {
                             $size = '_C';
                             $get_big = true;
                         }
                         $data_img = call_user_func(array(Helper_Pin::formatUploadModule($board['pins_array'][$i]['store']), 'getPinImage'), $board['pins_array'][$i], $size);
                         if ($data_img) {
                             $board['thumbs'][] = $data_img['image'];
                         } else {
                             $board['thumbs'][] = false;
                         }
                     } else {
                         $board['thumbs'][] = false;
                     }
                 }
                 $board['user'] = Model_Users::getUser($board['user_id']);
                 $board['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $board['user_id']);
                 $avatar = Helper_Uploadimages::avatar($board['user'], '_A');
                 $board['user']['avatar'] = $avatar['image'];
                 $this->view->popular_bards[] = $board;
             }
         }
         /* VIDEO */
         //			$this->view->video = array();
         //			$video = Model_Pins::getPins(array(
         //				'start' => 0,
         //				'limit' => 1,
         //				'filter_is_video' => 1
         //			));
         //
         //			if($video) {
         //				foreach($video AS $pin) {
         //					$pin['thumb'] = $model_images->resizeWidth($pin['image'], 194);
         //					$pin['thumb_width'] = $model_images->getSizes('width');
         //					$pin['thumb_height'] = $model_images->getSizes('height');
         //					$pin['description'] = Helper_Pin::descriptionFix($pin['description']);
         //					$pin['href'] = WM_Router::create( $request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id'] );
         //
         //				}
         //			}
         /* HISTORY */
         foreach ($histories as $history) {
             if (!isset($history['store'])) {
                 continue;
             }
             $avatar = Helper_Uploadimages::avatar($history, '_B');
             $history['avatar'] = $avatar['image'];
             $history['user_followers'] = WM_Router::create($this->view->base_href . '?controller=users&action=followers&user_id=' . $history['user_id']);
             $history['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $history['user_id']);
             $history['history_comments_total'] = count($history['history_comments']);
             $history['history_follow_total'] = count($history['history_follow']);
             $history['history_like_total'] = count($history['history_like']);
             $history['history_repin_total'] = count($history['history_repin']);
             $history['history_event_total'] = count($history['history_event']);
             /////comments
             if ($history['history_comments_total']) {
                 foreach ($history['history_comments'] as $k => $v) {
                     if (!isset($v['store'])) {
                         continue;
                     }
                     $avatar = Helper_Uploadimages::avatar($v, '_A');
                     $history['history_comments'][$k]['avatar'] = $avatar['image'];
                     $history['history_comments'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']);
                 }
             }
             /////follow
             if ($history['history_follow_total']) {
                 foreach ($history['history_follow'] as $k => $v) {
                     if (!isset($v['store'])) {
                         continue;
                     }
                     $avatar = Helper_Uploadimages::avatar($v, '_A');
                     $history['history_follow'][$k]['avatar'] = $avatar['image'];
                     $history['history_follow'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']);
                 }
             }
             /////like
             if ($history['history_like_total']) {
                 foreach ($history['history_like'] as $k => $v) {
                     if (!isset($v['store'])) {
                         continue;
                     }
                     $avatar = Helper_Uploadimages::avatar($v, '_A');
                     $history['history_like'][$k]['avatar'] = $avatar['image'];
                     $history['history_like'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']);
                 }
             }
             /////repin
             if ($history['history_repin_total']) {
                 foreach ($history['history_repin'] as $k => $v) {
                     if (!isset($v['store'])) {
                         continue;
                     }
                     $avatar = Helper_Uploadimages::avatar($v, '_A');
                     $history['history_repin'][$k]['avatar'] = $avatar['image'];
                     $history['history_repin'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']);
                 }
             }
             ////events
             if ($history['history_event_total']) {
                 foreach ($history['history_event'] as $k => $v) {
                     if (!isset($v['store'])) {
                         continue;
                     }
                     $avatar = Helper_Uploadimages::event($v, '_A');
                     $history['history_event'][$k]['avatar'] = $avatar['image'];
                     $history['history_event'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']);
                 }
             }
             $this->view->events = array();
             $this->view->event = array();
             $dataEvents = array('filter_cron' => $history['user_id']);
             $events = Model_Events::getEvents($dataEvents);
             if ($events) {
                 foreach ($events as $key => $event) {
                     $href = "";
                     $view = JO_View::getInstance();
                     $view->loged = JO_Session::get('user[user_id]');
                     $model_images = new Helper_Images();
                     $avatar = Helper_Uploadimages::avatar($event, '_B');
                     $event['avatar'] = $avatar['image'];
                     $event['thumbs'] = $avatar['image'];
                     $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]);
                     $data = array('filter_user_id' => $event["user_id"]);
                     $users = Model_Users::getUsers($data);
                     if ($users) {
                         $event['fullname'] = $users[0]["fullname"];
                         $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']);
                         $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']);
                     }
                     //$view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=boxeventdetail&event_id=' . $event['event_id']);
                     $view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']);
                     $this->view->event[] = $event;
                     $view->event = $event;
                     $this->view->events[] = $view->render('boxEvent', 'events');
                 }
             }
             /* PINS */
             $likes = Model_History::getHistory(array('history_action' => Model_History::LIKEPIN, 'start' => 0, 'limit' => 30), 'from_user_id', $history['user_id']);
             $history['pins_likes'] = array();
             if ($likes) {
                 $temp = array();
                 foreach ($likes as $like) {
                     $temp[$like['pin_id']] = $like['pin_id'];
                 }
                 if ($temp) {
                     $pins = Model_Pins::getPins(array('start' => 0, 'limit' => 9, 'filter_id_in' => implode(',', $temp)));
                     if ($pins) {
                         foreach ($pins as $pin) {
                             $image = call_user_func(array(Helper_Pin::formatUploadModule($pin['store']), 'getPinImage'), $pin, '_B');
                             if ($image) {
                                 $pin['thumb'] = $image['image'];
                                 $pin['thumb_width'] = $image['width'];
                                 $pin['thumb_height'] = $image['height'];
                             } else {
                                 continue;
                             }
                             $pin['description'] = Helper_Pin::descriptionFix($pin['description']);
                             $pin['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']);
                             $pin['onto_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin['user_id'] . '&board_id=' . $pin['board_id']);
                             $pin['price_formated'] = WM_Currency::format($pin['price']);
                             $avatar = Helper_Uploadimages::avatar($pin['user'], '_A');
                             $pin['user']['avatar'] = $avatar['image'];
                             $pin['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['user_id']);
                             $pin['via_profile'] = array();
                             if ($pin['via'] && $pin['user_via']) {
                                 $pin['via_profile'] = array('profile' => WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['via']), 'fullname' => $pin['user_via']['fullname']);
                             }
                             $history['pins_likes'][] = $pin;
                         }
                     }
                 }
             }
             $this->view->history = $history;
             $html = $this->view->render('sendWeekly', 'crons');
             Model_Email::send($history['email'], JO_Registry::get('noreply_mail'), sprintf($this->translate('Weekly %s'), $this->view->site_name), $html);
         }
     }
 }
Beispiel #22
0
 public function header_partAction()
 {
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) {
         Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
         JO_Session::clear('category_id');
         $this->view->user_info = JO_Session::get('user');
         Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail'));
     }
     $this->view->og_namespace = trim(JO_Registry::get('og_namespace'));
     $this->view->og_recipe = trim(JO_Registry::get('og_recipe'));
     if (!$this->view->og_recipe) {
         $this->view->og_namespace = '';
     }
     $this->view->show_landing = !JO_Registry::get('enable_free_registration');
     $to_title = '';
     if (JO_Session::get('user[user_id]')) {
         $to_title = JO_Session::get('user[fullname]') . ' / ';
     }
     if ($this->getLayout()->meta_title) {
         $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title'));
     } else {
         $this->getLayout()->placeholder('title', $to_title . JO_Registry::get('meta_title'));
     }
     if ($this->getLayout()->meta_description) {
         $this->getLayout()->placeholder('description', $this->getLayout()->meta_description);
     } else {
         $this->getLayout()->placeholder('description', JO_Registry::get('meta_description'));
     }
     if ($this->getLayout()->meta_keywords) {
         $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords);
     } else {
         $this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords'));
     }
     $this->getLayout()->placeholder('site_name', JO_Registry::get('site_name'));
     $this->view->site_name = JO_Registry::get('site_name');
     $this->view->meta_title = JO_Registry::get('meta_title');
     $this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8'));
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png';
     if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) {
         $this->view->site_logo = $request->getBaseUrl() . 'uploads' . JO_Registry::get('site_logo');
     }
     if (JO_Registry::get('favicon') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('favicon'))) {
         $this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . JO_Registry::get('favicon'));
     }
     $this->getLayout()->placeholder('site_logo', $this->view->site_logo);
     $this->view->show_header_invate = !JO_Session::get('user[user_id]');
     if (!JO_Session::get('user[user_id]')) {
         switch (true) {
             case $request->getAction() == 'login':
                 $this->view->show_header_invate = true;
             case $request->getAction() == 'register':
                 $this->view->show_header_invate = true;
                 break;
         }
     }
     $this->view->controller_open = $request->getController();
     $this->view->show_header_line = !in_array($request->getController(), array('pin'));
     $this->view->show_slider = !in_array($request->getController(), array('users', 'pin', 'settings', 'prefs', 'password'));
     if ($request->getController() == 'users') {
         $this->view->show_header_line = false;
     }
     //==== brand =====//
     $this->view->show_brand = true;
     if (JO_Registry::get('license_powered_check') == 'false' && JO_Registry::get('config_hide_brand')) {
         $this->view->show_brand = false;
     }
     ////////// CURRENCY
     //autoupdate currency if set
     if (JO_Registry::get('config_currency_auto_update')) {
         WM_Currency::updateCurrencies();
     }
     $currencies = WM_Currency::getCurrencies();
     $price_left = array();
     $price_right = array();
     if ($currencies) {
         foreach ($currencies as $currency) {
             if (trim($currency['symbol_left'])) {
                 $price_left[] = preg_quote(trim($currency['symbol_left']));
             }
             if (trim($currency['symbol_right'])) {
                 $price_right[] = preg_quote(trim($currency['symbol_right']));
             }
         }
     }
     $this->view->price_left = implode('|', $price_left);
     $this->view->price_right = implode('|', $price_right);
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories1 = array("0" => array("category_id" => "9999", "title" => "TODO", "image" => ""));
     $this->view->category_active = false;
     $categories2 = Model_Categories::getCategories(array('filter_status' => 1));
     $categories = array_merge($categories1, $categories2);
     $x = 0;
     foreach ($categories as $category) {
         if ($x == 0) {
             $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
             $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=all&category_id=' . $category['category_id']);
             if ($request->getRequest('category_id') == 9999) {
                 $category['active'] = TRUE;
                 $this->view->category_active = $category['title'];
             } else {
                 $category['active'] = FALSE;
             }
             $this->view->categories[] = $category;
         } else {
             $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
             $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $category['category_id']);
             $category['active'] = $category['category_id'] == $request->getRequest('category_id');
             if ($category['active']) {
                 $this->view->category_active = $category['title'];
             } else {
                 $i = 0;
                 foreach ($category['subcategories'] as $subcategory) {
                     $category['subcategories'][$i]['active'] = $subcategory['category_id'] == $request->getRequest('category_id');
                     if ($category['subcategories'][$i]['active']) {
                         $this->view->category_active = $subcategory['title'];
                     }
                     $i++;
                 }
             }
             $this->view->categories[] = $category;
         }
         $x = 1;
     }
     ////////////////////////////// USER MENU ///////////////////////////
     $this->view->is_loged = JO_Session::get('user[user_id]');
     if ($this->view->is_loged) {
         $model_images = new Helper_Images();
         $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A');
         $this->view->self_avatar = $avatar['image'];
         $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $this->view->is_loged);
         $this->view->mails = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mails');
         $this->view->self_firstname = JO_Session::get('user[firstname]');
         $this->view->logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout');
         $this->view->invites = WM_Router::create($request->getBaseUrl() . '?controller=invites');
         $this->view->invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=invites&action=facebook');
         $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged);
         $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged . '&filter=likes');
         $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings');
     }
     $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
     $this->view->landing = WM_Router::create($request->getBaseUrl() . '?controller=landing');
     $this->view->site_name = JO_Registry::get('site_name');
     $this->view->registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
     $category_id = null;
     if ($request->getRequest('category_id')) {
         $category_id = $request->getRequest('category_id');
         ////////////////////////////// GIFTS ///////////////////////////
         $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts&category_id=' . $category_id);
         $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20&category_id=' . $category_id);
         $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50&category_id=' . $category_id);
         $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100&category_id=' . $category_id);
         $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200&category_id=' . $category_id);
         $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500&category_id=' . $category_id);
         $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500&category_id=' . $category_id);
         //////////// Video ////////////
         $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos&category_id=' . $category_id);
         /*
                             //////////// Popular ////////////
                             $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular&category_id='.$category_id );
         */
         //////////// Articles ////////////
         $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles&category_id=' . $category_id);
         //////////// Ranking ////////////
         $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1&category_id=' . $category_id);
         $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2&category_id=' . $category_id);
         $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3&category_id=' . $category_id);
         $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4&category_id=' . $category_id);
     } else {
         ////////////////////////////// GIFTS ///////////////////////////
         $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts');
         $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20');
         $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50');
         $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100');
         $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200');
         $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500');
         $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500');
         //////////// Video ////////////
         $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos');
         /*
                             //////////// Popular ////////////
                             $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular' );
         */
         //////////// Articles ////////////
         $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles');
         //////////// Ranking ////////////
         $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1');
         $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2');
         $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3');
         $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4');
     }
     //////////// Popular ////////////
     $this->view->popular_url = WM_Router::create($request->getBaseUrl() . '?controller=premiostt');
     //////////// ALL PINS ////////////
     $this->view->all_url = WM_Router::create($request->getBaseUrl() . '?controller=all');
     //////////// activate ////////////
     $this->view->activate_url = WM_Router::create($request->getBaseUrl() . '?controller=index&action=indexActivate');
     //////////// Eventtos ////////////
     $this->view->events_url = WM_Router::create($request->getBaseUrl() . '?controller=events');
     //////////// Volunttarios ////////////
     if ($this->view->is_loged) {
         $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup&user_id=' . $this->view->is_loged);
     } else {
         $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup');
     }
     ////////////////////////////// SEARCH ///////////////////////////
     //$this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
     if (in_array($request->getAction(), array('advanced', 'page', 'view'))) {
         $with_action = $request->getAction();
         $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction());
     } elseif (in_array($request->getAction(), array('advanced', 'advanced'))) {
         $with_action = $request->getAction();
         $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction());
     } else {
         $with_action = 0;
         $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search');
     }
     //$this->view->search_autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete');
     if (strpos($this->view->search, '?') !== false) {
         $this->view->show_hidden = true;
         $this->view->with_action = $with_action;
     }
     //$this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...');
     /*
     		if(in_array($request->getAction(), array('amatteur'))) {
     			$with_action = 0;
     			$this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search');
     		} elseif( in_array($request->getAction(), array('activate', 'services')) ) {
     			$with_action = $request->getAction();
     			$this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action='.$request->getAction());
     } else {
     			$with_action = 0;
     			$this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search');
     		}
     		
     		$this->view->search_autocomplete_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete');
     		if(strpos($this->view->search_advanced, '?') !== false) {
     			$this->view->show_hidden = true;
     			$this->view->with_action = $with_action;    
     		}
     		
     		$this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...');
     */
     $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=amatteur');
     ////////////////////////////// ADD PIN ///////////////////////////
     $this->view->addPin = WM_Router::create($request->getBaseUrl() . '?controller=addpin');
     ////////////////////////////// MAILS ///////////////////////////
     $this->view->addMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=create');
     $this->view->stateMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=state');
     $this->view->viewMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=view');
     ////////////////////////////// FULL URL ///////////////////////////
     $this->view->full_url_js = false;
     switch (true) {
         case 'index' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl());
             break;
         case 'search' == $request->getController():
             if (in_array($request->getAction(), array('index', 'page', 'view'))) {
                 $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getRequest('q'));
             } else {
                 $parametros = "";
                 $this->view->keywords = $request->issetQuery('location') ? $request->getQuery('location') : $this->translate('Search...');
                 /*
                                                     if ($request->issetPost('firstname'))
                                                     {
                    $parametros .= "&firstname=". $request->getPost('firstname');
                                                     } 
                 
                                                     if ($request->issetPost('words'))
                                                     {
                    $parametros .= "&words=". $request->getPost('words');
                                                     } 
                                                     if ($request->issetPost('location'))
                                                     {
                    $parametros .= "&location=". $request->getPost('location');
                                                     } 
                                                     if ($request->issetPost('sport_category_1'))
                                                     {
                    $parametros .= "&sport_category_1=". $request->getPost('sport_category_1');
                                                     }         
                                                     if ($request->issetPost('sport_category_2'))
                                                     {
                    $parametros .= "&sport_category_2=". $request->getPost('sport_category_2');
                                                     }
                                                     if ($request->issetPost('sport_category_3'))
                                                     {
                    $parametros .= "&sport_category_3=". $request->getPost('sport_category_3');
                                                     } 
                                                     if ($request->issetPost('type_user'))
                                                     {
                    $parametros .= "&type_user="******"&gender=". $request->getRequest('gender');
                                                     } 
                 
                                                     //location		
                                                     if ($request->issetPost('location'))
                                                     {
                    $parametros .= "&location=". $request->getPost('location');
                                                     } 
                 
                                                     //sport category
                                                     if ($request->issetPost('sport_category'))
                                                     {
                    $parametros .= "&sport_category=". $request->getPost('sport_category');
                                                     } 
                 
                                                     //age
                                                     if ($request->issetPost('age'))
                                                     {
                    $parametros .= "&age=". $request->getPost('age');
                                                     } 
                 
                                                     //level
                                                     if ($request->issetPost('level'))
                                                     {
                    $parametros .= "&level=". $request->getPost('level');
                                                     } 
                 
                                                     //option1		
                                                     if ($request->issetPost('option1'))
                                                     {
                    $parametros .= "&option1=". $request->getPost('option1');
                                                     } 
                 
                                                     //option2		
                                                     if ($request->issetPost('option2'))
                                                     {
                    $parametros .= "&option2=". $request->getPost('option2');
                                                     } 
                 
                                                     //option3
                                                     if ($request->issetPost('option3'))
                                                     {
                    $parametros .= "&option3=". $request->getPost('option3');
                                                     } 
                 
                                                     //option4		
                                                     if ($request->issetPost('option4'))
                                                     {
                    $parametros .= "&option4=". $request->getPost('option4');
                                                     } 
                 
                                                     //option5		
                                                     if ($request->issetPost('option5'))
                                                     {
                    $parametros .= "&option5=". $request->getPost('option5');
                                                     } 
                 
                                                     //option6		
                                                     if ($request->issetPost('option6'))
                                                     {
                    $parametros .= "&option6=". $request->getPost('option6');
                                                     } 
                 
                                                     //option7		
                                                     if ($request->issetPost('option7'))
                                                     {
                    $parametros .= "&option7=". $request->getPost('option7');
                                                     } 
                 
                                                     //option8		
                                                     if ($request->issetPost('option8'))
                                                     {
                    $parametros .= "&option8=". $request->getPost('option8');
                                                     } 
                 
                                                     //option9		
                                                     if ($request->issetPost('option9'))
                                                     {
                    $parametros .= "&option9=". $request->getPost('option9');
                                                     } 
                 
                                                     //option10		
                                                     if ($request->issetPost('option10'))
                                                     {
                    $parametros .= "&option10=". $request->getPost('option10');
                                                     }
                                                     
                                                     //option11		
                                                     if ($request->issetPost('option11'))
                                                     {
                    $parametros .= "&option11=". $request->getPost('option11');
                                                     } 
                 
                                                     //option12		
                                                     if ($request->issetPost('option12'))
                                                     {
                    $parametros .= "&option12=". $request->getPost('option12');
                                                     } 
                 
                                                     //option13
                                                     if ($request->issetPost('option13'))
                                                     {
                    $parametros .= "&option13=". $request->getPost('option13');
                                                     } 
                 
                                                     //option14		
                                                     if ($request->issetPost('option14'))
                                                     {
                    $parametros .= "&option14=". $request->getPost('option14');
                                                     } 
                 
                                                     //option15		
                                                     if ($request->issetPost('option15'))
                                                     {
                    $parametros .= "&option15=". $request->getPost('option15');
                                                     } 
                 
                                                     //option16		
                                                     if ($request->issetPost('option16'))
                                                     {
                    $parametros .= "&option16=". $request->getPost('option16');
                                                     } 
                 
                                                     //option17		
                                                     if ($request->issetPost('option17'))
                                                     {
                    $parametros .= "&option17=". $request->getPost('option17');
                                                     } 
                 
                                                     //option18		
                                                     if ($request->issetPost('option18'))
                                                     {
                    $parametros .= "&option18=". $request->getPost('option18');
                                                     } 
                 * 
                 */
                 if ($request->issetRequest('zoom')) {
                     $parametros .= "&zoom=" . $request->getRequest('zoom');
                 }
                 if ($request->issetRequest('id')) {
                     $parametros .= "&id=" . $request->getRequest('id');
                 }
                 if ($request->issetRequest('firstname')) {
                     $parametros .= "&firstname=" . $request->getRequest('firstname');
                 }
                 if ($request->issetRequest('words')) {
                     $parametros .= "&words=" . $request->getRequest('words');
                 }
                 if ($request->issetRequest('location')) {
                     $parametros .= "&location=" . $request->getRequest('location');
                 }
                 if ($request->issetRequest('sport_category_1')) {
                     $parametros .= "&sport_category_1=" . $request->getRequest('sport_category_1');
                 }
                 if ($request->issetRequest('sport_category_2')) {
                     $parametros .= "&sport_category_2=" . $request->getRequest('sport_category_2');
                 }
                 if ($request->issetRequest('sport_category_3')) {
                     $parametros .= "&sport_category_3=" . $request->getRequest('sport_category_3');
                 }
                 if ($request->issetRequest('type_user')) {
                     $parametros .= "&type_user="******"&gender=" . $request->getRequest('gender');
                 }
                 //location
                 if ($request->issetRequest('location')) {
                     $parametros .= "&location=" . $request->getRequest('location');
                 }
                 //sport category
                 if ($request->issetRequest('sport_category')) {
                     $parametros .= "&sport_category=" . $request->getRequest('sport_category');
                 }
                 //age
                 if ($request->issetRequest('age')) {
                     $parametros .= "&age=" . $request->getRequest('age');
                 }
                 //level
                 if ($request->issetRequest('level')) {
                     $parametros .= "&level=" . $request->getRequest('level');
                 }
                 //option1
                 if ($request->issetRequest('option1')) {
                     $parametros .= "&option1=" . $request->getRequest('option1');
                 }
                 //option2
                 if ($request->issetRequest('option2')) {
                     $parametros .= "&option2=" . $request->getRequest('option2');
                 }
                 //option3
                 if ($request->issetRequest('option3')) {
                     $parametros .= "&option3=" . $request->getRequest('option3');
                 }
                 //option4
                 if ($request->issetRequest('option4')) {
                     $parametros .= "&option4=" . $request->getRequest('option4');
                 }
                 //option5
                 if ($request->issetRequest('option5')) {
                     $parametros .= "&option5=" . $request->getRequest('option5');
                 }
                 //option6
                 if ($request->issetRequest('option6')) {
                     $parametros .= "&option6=" . $request->getRequest('option6');
                 }
                 //option7
                 if ($request->issetRequest('option7')) {
                     $parametros .= "&option7=" . $request->getRequest('option7');
                 }
                 //option8
                 if ($request->issetRequest('option8')) {
                     $parametros .= "&option8=" . $request->getRequest('option8');
                 }
                 //option9
                 if ($request->issetRequest('option9')) {
                     $parametros .= "&option9=" . $request->getRequest('option9');
                 }
                 //option10
                 if ($request->issetRequest('option10')) {
                     $parametros .= "&option10=" . $request->getRequest('option10');
                 }
                 //option11
                 if ($request->issetRequest('option11')) {
                     $parametros .= "&option11=" . $request->getRequest('option11');
                 }
                 //option12
                 if ($request->issetRequest('option12')) {
                     $parametros .= "&option12=" . $request->getRequest('option12');
                 }
                 //option13
                 if ($request->issetRequest('option13')) {
                     $parametros .= "&option13=" . $request->getRequest('option13');
                 }
                 //option14
                 if ($request->issetRequest('option14')) {
                     $parametros .= "&option14=" . $request->getRequest('option14');
                 }
                 //option15
                 if ($request->issetRequest('option15')) {
                     $parametros .= "&option15=" . $request->getRequest('option15');
                 }
                 //option16
                 if ($request->issetRequest('option16')) {
                     $parametros .= "&option16=" . $request->getRequest('option16');
                 }
                 //option17
                 if ($request->issetRequest('option17')) {
                     $parametros .= "&option17=" . $request->getRequest('option17');
                 }
                 //option18
                 if ($request->issetRequest('option18')) {
                     $parametros .= "&option18=" . $request->getRequest('option18');
                 }
                 $parametros .= "&kk=kk";
                 $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction() . '&q=' . $request->getRequest('q') . '&id=' . $request->getRequest('id') . $parametros);
             }
             break;
         case 'all' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=all');
             break;
         case 'videos' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=videos');
             break;
         case 'popular' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=popular');
             break;
         case 'category' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $request->getRequest('category_id'));
             break;
         case 'source' == $request->getController():
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=source&source_id=' . $request->getRequest('source_id'));
             break;
         case 'boards' == $request->getController() && in_array($request->getAction(), array('index', 'page')):
             $url = '';
             if ($request->getRequest('user_id')) {
                 $url = '&user_id=' . $request->getRequest('user_id');
             }
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view' . $url . '&board_id=' . $request->getRequest('board_id'));
             break;
         case 'gifts' == $request->getController():
             $url = '';
             if ($request->issetParam('price_from')) {
                 $url .= (int) $request->getRequest('price_from');
             }
             if ($request->issetParam('price_to')) {
                 $url .= ':' . (int) $request->getRequest('price_to');
             }
             $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=gifts' . ($url ? '&action=' . $url : ''));
             break;
         case 'users' == $request->getController():
             if (in_array($request->getAction(), array('pins', 'followers', 'following', 'likers', 'liking', 'activity')) && $request->getRequest('user_id')) {
                 $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=users&action=' . $request->getAction() . '&user_id=' . $request->getRequest('user_id') . ($request->getQuery('filter') ? '&filter=' . $request->getQuery('filter') : ''));
             }
             break;
     }
     if ($request->getRequest('user_id')) {
         $user_info = Model_Users::getUser($request->getRequest('user_id'));
         if ($user_info && $user_info['dont_search_index']) {
             $this->getLayout()->placeholder('inhead', '<meta name="robots" content="noindex"/>');
         }
     }
     ////////////////////////////// ABOUT MENU ///////////////////////////
     $this->view->about_menu = array();
     $has = false;
     if (is_array(JO_Registry::forceGet('about_menu'))) {
         foreach (JO_Registry::forceGet('about_menu') as $row => $page_id) {
             if ($row == 0) {
                 $class = 'first';
             } else {
                 if (count(JO_Registry::forceGet('about_menu')) - 1 == $row) {
                     $class = 'last';
                 } else {
                     $class = '';
                 }
             }
             //				$class = $row==0?' first':'';
             if ($page_id == -1) {
                 $has = true;
             } else {
                 $pinfo = Model_Pages::getPage($page_id);
                 if ($pinfo && $pinfo['status']) {
                     if ($has) {
                         $class .= " group";
                         $has = false;
                     }
                     $this->view->about_menu[] = array('class' => trim($class), 'title' => $pinfo['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_id));
                 }
             }
         }
     }
     ////////////////////////////// NEW PASSWORD ///////////////////////////
     $this->view->show_new_password = false;
     if (JO_Session::get('user[user_id]') && JO_Session::get('user[email]') != JO_Session::get('user[new_email]')) {
         switch (true) {
             case 'index' == $request->getController():
             case 'all' == $request->getController():
             case 'category' == $request->getController():
             case 'videos' == $request->getController():
             case 'popular' == $request->getController():
             case 'gifts' == $request->getController():
                 $this->view->show_new_password = true;
                 break;
         }
     }
     ////////////////////////////// Board category ///////////////////////////
     if (is_array($board_info = JO_Registry::forceGet('board_category_change'))) {
         $this->view->board_category_change = array('title' => $board_info['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']));
     }
 }
Beispiel #23
0
 public function reportCommentAction()
 {
     $request = $this->getRequest();
     $comment_id = $request->getRequest('comment_id');
     $comment_info = new Model_Pins_GetComment($comment_id);
     if (!$comment_info->count()) {
         $this->forward('error', 'error404');
     }
     $comment_info = $comment_info->data;
     $reportcategories = new Model_Pins_CommentReportCategories();
     $this->view->reportcategories = $reportcategories->toArray();
     $this->view->url_form = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=reportComment&comment_id=' . $comment_id);
     $this->view->comment_id = $comment_id;
     $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $comment_info['pin_id']);
     if ($request->issetPost('report_category')) {
         $this->view->report_category = $request->getPost('report_category');
     } else {
         if ($this->view->reportcategories) {
             list($firstKey) = array_keys($this->view->reportcategories);
             $this->view->report_category = $firstKey;
         } else {
             $this->view->report_category = 0;
         }
     }
     $this->view->comment_is = true;
     $this->view->pin_id = $comment_info['pin_id'];
     $this->setViewChange('report');
     if ($request->isPost()) {
         $this->view->is_posted = true;
         if (Model_Pins::commentIsReported($comment_id)) {
             $this->view->error = $this->translate('You are already reported this comment!');
         } else {
             $result = Model_Pins::reportComment($comment_id, $request->getPost('report_category'), $request->getPost('report_message'));
             if (!$result) {
                 $this->view->error = $this->translate('Error reporting experience. Try again!');
             } else {
                 if (Helper_Config::get('not_rc')) {
                     Model_Email::send(Helper_Config::get('report_mail'), Helper_Config::get('noreply_mail'), $this->translate('New reported comment'), $this->translate('Hello, there is new reported comment in ') . ' ' . Helper_Config::get('site_name'));
                 }
                 $terms = Model_Pages::getPage(Helper_Config::get('page_terms'));
                 if ($terms) {
                     $this->view->terms = $terms['title'];
                 }
                 $this->view->terms_href = WM_Router::create($request->getBaseUrl() . '?controller=about&action=terms');
                 $this->setViewChange('message_report');
             }
         }
     }
     $this->noLayout(true);
 }
 public function indexAction($user_data = null)
 {
     $request = $this->getRequest();
     if (!Helper_Config::get('enable_free_registration')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
     }
     if (JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
     }
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (!isset($settings['instagram_register_with_instagram']) || !$settings['instagram_register_with_instagram']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['instagram_module_status_enable']) || !$settings['instagram_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $InstagramAccessToken = JO_Session::get('InstagramAccessToken');
     $user_data = $user_data ? $user_data : JO_Session::get('instagram_user_data');
     if ($user_data && isset($user_data['id']) && $user_data['id']) {
         $modelLogin = new Model_Instagram_Login($user_data['id']);
         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());
                 }
                 $up = $modelLogin->update(array('access_token' => $InstagramAccessToken, 'username' => $user_data['username']));
                 $next = JO_Session::get('instagram_next');
                 if ($next) {
                     $this->redirect(urldecode($next));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         }
         if (isset($user_data['profile_picture']) && @getimagesize($user_data['profile_picture'])) {
             $image = $user_data['profile_picture'];
             $user_data['avatar'] = $image;
         } else {
             $image = 'uploads' . Helper_Config::get('no_image');
             $user_data['avatar'];
         }
         $names = explode(' ', $user_data['full_name']);
         $user_data['first_name'] = array_shift($names);
         $user_data['last_name'] = implode(' ', $names);
         if ($request->isPost()) {
             $validate = new Helper_Validate();
             $validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
             $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
             $validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
             if ($validate->_valid_form()) {
                 if (Model_Users::isExistEmail($request->getPost('email'))) {
                     $validate->_set_form_errors($this->translate('This e-mail address is already used'));
                     $validate->_set_valid_form(false);
                 }
                 if (Model_Users::isExistUsername($request->getPost('username'))) {
                     $validate->_set_form_errors($this->translate('This username is already used'));
                     $validate->_set_valid_form(false);
                 }
             }
             if ($validate->_valid_form()) {
                 $result = new Model_Users_Create(array('avatar' => $user_data['avatar'], 'website' => isset($user_data['website']) ? $user_data['website'] : '', 'username' => $request->getPost('username'), 'firstname' => isset($user_data['first_name']) ? $user_data['first_name'] : '', 'lastname' => isset($user_data['last_name']) ? $user_data['last_name'] : '', 'email' => $request->getPost('email'), 'password' => $request->getPost('password')));
                 if (!$result->error) {
                     $userObject = new Model_Users_User($result->user_id);
                     JO_Session::set('user', $userObject->toArray());
                     $modelObject = new Model_Instagram_Login();
                     $modelObject->insert(array('username' => $user_data['username'], 'user_id' => $result->user_id, 'oauth_uid' => $user_data['id'], 'access_token' => JO_Session::get('InstagramAccessToken')));
                     $next = JO_Session::get('instagram_next');
                     JO_Session::clear('instagram_user_data');
                     JO_Session::clear('instagram_next');
                     JO_Session::clear('instagram_fnc');
                     if ($next) {
                         $this->redirect(urldecode($next));
                     } else {
                         $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                     }
                 } else {
                     $this->view->error = implode('<br />', $result->error);
                     //$this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->error = $validate->_get_error_messages();
             }
         }
         $this->view->avatar = $image;
         $this->view->baseUrl = $request->getBaseUrl();
         if ($request->issetPost('email')) {
             $this->view->email = $request->getPost('email');
         } else {
             if (isset($user_data['email'])) {
                 $this->view->email = $user_data['email'];
             } else {
                 $this->view->email = '';
             }
         }
         if ($request->issetPost('username')) {
             $this->view->username = $request->getPost('username');
         } else {
             if (isset($user_data['username'])) {
                 $this->view->username = $user_data['username'];
             } else {
                 $this->view->username = '';
             }
         }
         $this->view->password = $request->getPost('password');
     } else {
         //not session
         $this->setViewChange('../login/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']));
         }
     }
     if ($this->getLayout()->meta_title) {
         $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . Helper_Config::get('meta_title'));
     } else {
         $this->getLayout()->placeholder('title', Helper_Config::get('meta_title'));
     }
     if ($this->getLayout()->meta_description) {
         $this->getLayout()->placeholder('description', $this->getLayout()->meta_description);
     } else {
         $this->getLayout()->placeholder('description', Helper_Config::get('meta_description'));
     }
     if ($this->getLayout()->meta_keywords) {
         $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords);
     } else {
         $this->getLayout()->placeholder('keywords', Helper_Config::get('meta_keywords'));
     }
     $this->getLayout()->placeholder('site_name', Helper_Config::get('site_name'));
     $this->view->site_name = Helper_Config::get('site_name');
     $this->view->meta_title = Helper_Config::get('meta_title');
     $this->getLayout()->placeholder('google_analytics', html_entity_decode(Helper_Config::get('google_analytics'), ENT_QUOTES, 'utf-8'));
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png';
     if (Helper_Config::get('site_logo') && file_exists(BASE_PATH . '/uploads' . Helper_Config::get('site_logo'))) {
         $this->view->site_logo = $request->getBaseUrl() . 'uploads' . Helper_Config::get('site_logo');
     }
     $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
     $this->view->check_username = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_register&action=check_username');
     $this->view->check_email = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_register&action=check_email');
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Beispiel #25
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (!isset($settings['instagram_login_with_instagram']) || !$settings['instagram_login_with_instagram']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['instagram_module_status_enable']) || !$settings['instagram_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $instagramoauth = null;
     $this->initInstagram($instagramoauth);
     $InstagramAccessToken = JO_Session::get('InstagramAccessToken');
     $user_data = $this->user_data;
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (!isset($settings['instagram_login_with_instagram']) || !$settings['instagram_login_with_instagram']) {
         $this->forward('error', 'error404');
     }
     if ($user_data && isset($user_data['id']) && $user_data['id']) {
         $modelLogin = new Model_Instagram_Login($user_data['id']);
         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()')));
                 $up = $modelLogin->update(array('access_token' => $InstagramAccessToken, 'username' => $user_data['username']));
                 $next = JO_Session::get('instagram_next');
                 // 					JO_Session::clear('instagram_user_data');
                 // 					JO_Session::clear('instagram_next');
                 // 					JO_Session::clear('instagram_fnc');
                 if ($next) {
                     $this->redirect(urldecode($next));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         }
         if ((Helper_Config::get('enable_free_registration') || JO_Session::get('instagram_fnc') == 'connect') && JO_Session::get('instagram_next') && JO_Session::get('instagram_fnc')) {
             $this->redirect(urldecode(JO_Session::get('instagram_next')));
         }
         if (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_instagram_register', 'index', $user_data);
         }
         $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 {
         if (JO_Session::get('instagram_fnc') == 'connect' && JO_Session::get('instagram_next')) {
             $this->redirect(urldecode(JO_Session::get('instagram_next')));
         } elseif (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_instagram_register');
         }
         //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']));
         }
     }
 }
Beispiel #26
0
 public function doneAction()
 {
     $this->view->site_name = JO_Registry::get('site_name');
     $this->view->support_page = '';
     if (JO_Registry::get('support_page')) {
         $page_description = Model_Pages::getPage(JO_Registry::get('support_page'));
         if ($page_description) {
             $this->view->support_page = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('support_page'));
         }
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
Beispiel #27
0
 private function getPageForm()
 {
     $request = $this->getRequest();
     $page_id = $request->getQuery('id');
     $pages_module = new Model_Pages();
     if ($page_id) {
         $page_info = $pages_module->getPage($page_id);
     }
     $parent_id = (int) $request->getQuery('parent_id');
     $parent_info = Model_Pages::getPage($parent_id);
     if ($parent_info) {
         $this->view->parent_title = $parent_info['title'];
     }
     $this->view->page_id = $page_id;
     $this->view->cancel_url = $request->getModule() . '/pages/' . ($parent_id ? '?parent_id=' . $parent_id : '');
     if ($request->getPost('in_footer')) {
         $this->view->in_footer = $request->getPost('in_footer');
     } elseif (isset($page_info)) {
         $this->view->in_footer = $page_info['in_footer'];
     } else {
         $this->view->in_footer = 0;
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($page_info)) {
         $this->view->status = $page_info['status'];
     } else {
         $this->view->status = 1;
     }
     if ($request->getPost('title')) {
         $this->view->title = $request->getPost('title');
     } elseif (isset($page_info)) {
         $this->view->title = $page_info['title'];
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } elseif (isset($page_info)) {
         $this->view->description = $page_info['description'];
     }
     if ($request->getPost('meta_title')) {
         $this->view->meta_title = $request->getPost('meta_title');
     } elseif (isset($page_info)) {
         $this->view->meta_title = $page_info['meta_title'];
     }
     if ($request->getPost('meta_description')) {
         $this->view->meta_description = $request->getPost('meta_description');
     } elseif (isset($page_info)) {
         $this->view->meta_description = $page_info['meta_description'];
     }
     if ($request->getPost('meta_keywords')) {
         $this->view->meta_keywords = $request->getPost('meta_keywords');
     } elseif (isset($page_info)) {
         $this->view->meta_keywords = $page_info['meta_keywords'];
     }
     if ($request->getRequest('keyword')) {
         $this->view->keyword = $request->getRequest('keyword');
     } elseif (isset($page_info)) {
         $this->view->keyword = $page_info['keyword'];
     }
     if (isset($page_info)) {
         $images = Model_Gallery::getGalleryImages($page_id, 'pages');
         if ($images) {
             $model_images = new Helper_Images();
             $this->view->images = array();
             foreach ($images as $image) {
                 $this->view->images[] = array('image_id' => $image['image_id'], 'image' => 'uploads' . $image['image'], 'thumb' => $model_images->resize($image['image'], 100, 100), 'title' => $image['title']);
             }
         }
     } else {
         $temporary_images = JO_Session::get('temporary_images');
         if ($temporary_images) {
             $model_images = new Helper_Images();
             $this->view->images = array();
             foreach ($temporary_images as $key => $image) {
                 $this->view->images[] = array('image_id' => $key, 'image' => 'uploads' . $image['image'], 'thumb' => $model_images->resize($image['image'], 100, 100), 'title' => isset($image[JO_Registry::get('config_language_id')]['title']) ? $image[JO_Registry::get('config_language_id')]['title'] : '');
             }
         }
     }
 }
Beispiel #28
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $avatar_width = $request->getParam('user_avatar_width');
         if ($avatar_width > 120) {
             $request->getParam('user_avatar_width', 120);
         }
         $avatar_height = $request->getParam('user_avatar_height');
         if ($avatar_height > 120) {
             $request->getParam('user_avatar_height', 120);
         }
         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']);
         }
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
     }
     $this->view->templates = $this->getTemplates();
     $this->view->modules = WM_Modules::getList(array('update', 'install', 'admin'));
     $image_setings_get = WM_Modules::getConfig();
     $image_setings = array();
     $watermark_setings = array();
     $domains_setings = array();
     foreach ($image_setings_get as $module_get => $ims) {
         $image_setings[$module_get] = isset($ims['images']) && is_array($ims['images']) ? $ims['images'] : array();
         $watermark_setings[$module_get] = isset($ims['watermark']) && is_array($ims['watermark']) ? $ims['watermark'] : array();
         $domains_setings[$module_get] = isset($ims['domain']) && is_array($ims['domain']) ? $ims['domain'] : array();
     }
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->languages = array();
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
     }
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['referal_sum'])) {
         $this->view->referal_sum = $config['referal_sum'];
     } elseif (isset($store_config['referal_sum'])) {
         $this->view->referal_sum = $store_config['referal_sum'];
     } else {
         $this->view->referal_sum = 0;
     }
     if (isset($config['referal_percent'])) {
         $this->view->referal_percent = str_replace('%', '', $config['referal_percent']) . '%';
     } elseif (isset($store_config['referal_percent'])) {
         $this->view->referal_percent = str_replace('%', '', $store_config['referal_percent']) . '%';
     } else {
         $this->view->referal_percent = 0;
     }
     if (isset($config['prepaid_price_discount'])) {
         $this->view->prepaid_price_discount = $config['prepaid_price_discount'];
     } elseif (isset($store_config['prepaid_price_discount'])) {
         $this->view->prepaid_price_discount = $store_config['prepaid_price_discount'];
     } else {
         $this->view->prepaid_price_discount = 0;
     }
     if (isset($config['extended_price'])) {
         $this->view->extended_price = $config['extended_price'];
     } elseif (isset($store_config['extended_price'])) {
         $this->view->extended_price = $store_config['extended_price'];
     } else {
         $this->view->extended_price = 0;
     }
     if (isset($config['no_exclusive_author_percent'])) {
         $this->view->no_exclusive_author_percent = $config['no_exclusive_author_percent'];
     } elseif (isset($store_config['no_exclusive_author_percent'])) {
         $this->view->no_exclusive_author_percent = $store_config['no_exclusive_author_percent'];
     } else {
         $this->view->no_exclusive_author_percent = 0;
     }
     if (isset($config['exclusive_author_percent'])) {
         $this->view->exclusive_author_percent = $config['exclusive_author_percent'];
     } elseif (isset($store_config['exclusive_author_percent'])) {
         $this->view->exclusive_author_percent = $store_config['exclusive_author_percent'];
     } else {
         $this->view->exclusive_author_percent = 0;
     }
     if (isset($config['facebook_appid'])) {
         $this->view->facebook_appid = $config['facebook_appid'];
     } elseif (isset($store_config['facebook_appid'])) {
         $this->view->facebook_appid = $store_config['facebook_appid'];
     } else {
         $this->view->facebook_appid = '';
     }
     if (isset($config['facebook_secret'])) {
         $this->view->facebook_secret = $config['facebook_secret'];
     } elseif (isset($store_config['facebook_secret'])) {
         $this->view->facebook_secret = $store_config['facebook_secret'];
     } else {
         $this->view->facebook_secret = '';
     }
     if (isset($config['recaptcha_public_key'])) {
         $this->view->recaptcha_public_key = $config['recaptcha_public_key'];
     } elseif (isset($store_config['recaptcha_public_key'])) {
         $this->view->recaptcha_public_key = $store_config['recaptcha_public_key'];
     } else {
         $this->view->recaptcha_public_key = 0;
     }
     if (isset($config['recaptcha_private_key'])) {
         $this->view->recaptcha_private_key = $config['recaptcha_private_key'];
     } elseif (isset($store_config['recaptcha_private_key'])) {
         $this->view->recaptcha_private_key = $store_config['recaptcha_private_key'];
     } else {
         $this->view->recaptcha_private_key = 0;
     }
     if (isset($config['google_translate_key'])) {
         $this->view->google_translate_key = $config['google_translate_key'];
     } elseif (isset($store_config['google_translate_key'])) {
         $this->view->google_translate_key = $store_config['google_translate_key'];
     } else {
         $this->view->google_translate_key = '';
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['admin_limit'])) {
         $this->view->admin_limit = $config['admin_limit'];
     } elseif (isset($store_config['admin_limit'])) {
         $this->view->admin_limit = $store_config['admin_limit'];
     } else {
         $this->view->admin_limit = 15;
     }
     if (isset($config['front_limit'])) {
         $this->view->front_limit = $config['front_limit'];
     } elseif (isset($store_config['front_limit'])) {
         $this->view->front_limit = $store_config['front_limit'];
     } else {
         $this->view->front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['default_module'])) {
         $this->view->default_module = $config['default_module'];
     } elseif (isset($store_config['default_module'])) {
         $this->view->default_module = $store_config['default_module'];
     }
     if (isset($config['currency_position'])) {
         $this->view->currency_position = $config['currency_position'];
     } elseif (isset($store_config['currency_position'])) {
         $this->view->currency_position = $store_config['currency_position'];
     } else {
         $this->view->currency_position = 'left';
     }
     if (isset($config['currency_decimal_places'])) {
         $this->view->currency_decimal_places = $config['currency_decimal_places'];
     } elseif (isset($store_config['currency_decimal_places'])) {
         $this->view->currency_decimal_places = $store_config['currency_decimal_places'];
     } else {
         $this->view->currency_decimal_places = 2;
     }
     if (isset($config['currency_decimal_point'])) {
         $this->view->currency_decimal_point = $config['currency_decimal_point'];
     } elseif (isset($store_config['currency_decimal_point'])) {
         $this->view->currency_decimal_point = $store_config['currency_decimal_point'];
     } else {
         $this->view->currency_decimal_point = '.';
     }
     if (isset($config['currency_thousand_point'])) {
         $this->view->currency_thousand_point = $config['currency_thousand_point'];
     } elseif (isset($store_config['currency_thousand_point'])) {
         $this->view->currency_thousand_point = $store_config['currency_thousand_point'];
     } else {
         $this->view->currency_thousand_point = ',';
     }
     if (isset($config['config_language_id'])) {
         $this->view->config_language_id = $config['config_language_id'];
     } elseif (isset($store_config['config_language_id'])) {
         $this->view->config_language_id = $store_config['config_language_id'];
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Model_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     /////items
     $this->view->generate_item_image_form = array();
     foreach ($image_setings as $mod => $data) {
         foreach ($data as $imagetype => $value) {
             $this->view->generate_item_image_form[$mod][] = array('name' => $value['name'], 'info' => isset($value['info']) ? $value['info'] : '', 'key_width' => $mod . '_items_' . $imagetype . '_width', 'key_height' => $mod . '_items_' . $imagetype . '_height');
             if (isset($config[$mod . '_items_' . $imagetype . '_width'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = $config[$mod . '_items_' . $imagetype . '_width'];
             } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_width'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = $store_config[$mod . '_items_' . $imagetype . '_width'];
             } else {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = isset($value['width']) ? $value['width'] : '';
             }
             if (isset($config[$mod . '_items_' . $imagetype . '_height'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = $config[$mod . '_items_' . $imagetype . '_height'];
             } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_height'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = $store_config[$mod . '_items_' . $imagetype . '_height'];
             } else {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = isset($value['height']) ? $value['height'] : '';
             }
         }
     }
     //// watermark
     $this->view->generate_watermark_form = array();
     foreach ($watermark_setings as $mod => $data) {
         foreach ($data as $imagetype => $value) {
             $this->view->generate_watermark_form[$mod] = array('name' => $value['name'], 'info' => $value['info'], 'key' => $mod . '_watermark_' . $imagetype);
             if (isset($images[$mod . '_watermark_' . $imagetype]) && $images[$mod . '_watermark_' . $imagetype]) {
                 $this->view->{$mod . '_watermark_' . $imagetype} = $images[$mod . '_watermark_' . $imagetype];
             } elseif (isset($store_config[$mod . '_watermark_' . $imagetype]) && $store_config[$mod . '_watermark_' . $imagetype]) {
                 $this->view->{$mod . '_watermark_' . $imagetype} = $store_config[$mod . '_watermark_' . $imagetype];
             } else {
                 if (file_exists(BASE_PATH . '/uploads' . $value['image'])) {
                     $this->view->{$mod . '_watermark_' . $imagetype} = $value['image'];
                 } else {
                     $this->view->{$mod . '_watermark_' . $imagetype} = '';
                 }
             }
             if ($this->view->{$mod . '_watermark_' . $imagetype}) {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->{$mod . '_watermark_' . $imagetype}, 100, 100);
             } else {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100);
             }
             if (!$this->view->{'preview_' . $mod . '_watermark_' . $imagetype}) {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->no_image, 100, 100);
             }
             $this->view->{'default_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100);
         }
     }
     ////////////////user
     if (isset($config['user_avatar_width'])) {
         $this->view->user_avatar_width = $config['user_avatar_width'];
     } elseif (isset($store_config['user_avatar_width'])) {
         $this->view->user_avatar_width = $store_config['user_avatar_width'];
     } else {
         $this->view->user_avatar_width = 80;
     }
     if (isset($config['user_avatar_height'])) {
         $this->view->user_avatar_height = $config['user_avatar_height'];
     } elseif (isset($store_config['user_avatar_height'])) {
         $this->view->user_avatar_height = $store_config['user_avatar_height'];
     } else {
         $this->view->user_avatar_height = 80;
     }
     if (isset($config['user_avatar2_width'])) {
         $this->view->user_avatar2_width = $config['user_avatar2_width'];
     } elseif (isset($store_config['user_avatar2_width'])) {
         $this->view->user_avatar2_width = $store_config['user_avatar2_width'];
     } else {
         $this->view->user_avatar2_width = 40;
     }
     if (isset($config['user_avatar2_height'])) {
         $this->view->user_avatar2_height = $config['user_avatar2_height'];
     } elseif (isset($store_config['user_avatar2_height'])) {
         $this->view->user_avatar2_height = $store_config['user_avatar2_height'];
     } else {
         $this->view->user_avatar2_height = 40;
     }
     if (isset($config['user_profile_photo_width'])) {
         $this->view->user_profile_photo_width = $config['user_profile_photo_width'];
     } elseif (isset($store_config['user_profile_photo_width'])) {
         $this->view->user_profile_photo_width = $store_config['user_profile_photo_width'];
     } else {
         $this->view->user_profile_photo_width = 590;
     }
     if (isset($config['user_profile_photo_height'])) {
         $this->view->user_profile_photo_height = $config['user_profile_photo_height'];
     } elseif (isset($store_config['user_profile_photo_height'])) {
         $this->view->user_profile_photo_height = $store_config['user_profile_photo_height'];
     } else {
         $this->view->user_profile_photo_height = 242;
     }
     if (isset($config['user_public_collection_width'])) {
         $this->view->user_public_collection_width = $config['user_public_collection_width'];
     } elseif (isset($store_config['user_public_collection_width'])) {
         $this->view->user_public_collection_width = $store_config['user_public_collection_width'];
     } else {
         $this->view->user_public_collection_width = 260;
     }
     if (isset($config['user_public_collection_height'])) {
         $this->view->user_public_collection_height = $config['user_public_collection_height'];
     } elseif (isset($store_config['user_public_collection_height'])) {
         $this->view->user_public_collection_height = $store_config['user_public_collection_height'];
     } else {
         $this->view->user_public_collection_height = 140;
     }
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['page_about'])) {
         $this->view->page_about = $pages['page_about'];
     } elseif (isset($store_config['page_about'])) {
         $this->view->page_about = $store_config['page_about'];
     } else {
         $this->view->page_about = 0;
     }
     if (isset($pages['page_upload_item'])) {
         $this->view->page_upload_item = $pages['page_upload_item'];
     } elseif (isset($store_config['page_upload_item'])) {
         $this->view->page_upload_item = $store_config['page_upload_item'];
     } else {
         $this->view->page_upload_item = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_regular_licence'])) {
         $this->view->page_regular_licence = $pages['page_regular_licence'];
     } elseif (isset($store_config['page_regular_licence'])) {
         $this->view->page_regular_licence = $store_config['page_regular_licence'];
     } else {
         $this->view->page_regular_licence = 0;
     }
     if (isset($pages['page_forum_rules'])) {
         $this->view->page_forum_rules = $pages['page_forum_rules'];
     } elseif (isset($store_config['page_forum_rules'])) {
         $this->view->page_forum_rules = $store_config['page_forum_rules'];
     } else {
         $this->view->page_forum_rules = 0;
     }
     if (isset($pages['page_affiliate_program'])) {
         $this->view->page_affiliate_program = $pages['page_affiliate_program'];
     } elseif (isset($store_config['page_affiliate_program'])) {
         $this->view->page_affiliate_program = $store_config['page_affiliate_program'];
     } else {
         $this->view->page_affiliate_program = 0;
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     /////////////////////////////// DOMAINS ///////////////////////
     $this->view->show_domain_tab = count($domains_setings) > 1;
     $this->view->generate_domains_setings_form = array();
     foreach ($domains_setings as $mod => $data) {
         $this->view->generate_domains_setings_form[$mod] = array('key' => $mod);
         if (isset($config['default_domain'][$mod])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $config['default_domain'][$mod];
         } elseif (isset($store_config['default_domain'][$mod])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $store_config['default_domain'][$mod];
         } elseif (isset($data['default'])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $data['default'];
         } else {
             $this->view->generate_domains_setings_form[$mod]['value'] = '';
         }
     }
     $this->view->show_domain_tab = false;
 }
Beispiel #29
0
    public function registrationAction()
    {
        $request = $this->getRequest();
        if (JO_Session::get('user_id')) {
            $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'));
        }
        $this->view->usersCount = Model_Users::countUsers();
        $this->view->itemsCount = Model_Items::countItems();
        $this->getLayout()->meta_title = $this->translate('Registration');
        $this->getLayout()->meta_description = $this->translate('Registration');
        $captcha = new Model_Recaptcha();
        $captcha->publicKey = JO_Registry::get('recaptcha_public_key');
        $captcha->privateKey = JO_Registry::get('recaptcha_private_key');
        if (JO_Session::issetKey('data')) {
            if (JO_Session::issetKey('msg_error')) {
                $this->view->msg_error = JO_Session::get('msg_error');
                JO_Session::clear('msg_error');
            } elseif (JO_Session::issetKey('error')) {
                $this->view->error = JO_Session::get('error');
                JO_Session::clear('error');
            }
            $this->view->user = JO_Session::get('data');
            JO_Session::clear('data');
        }
        if (JO_Session::issetKey('fb_data')) {
            $this->view->user = JO_Session::get('fb_data');
            JO_Session::clear('fb_data');
        }
        if ($request->isPost()) {
            $captcha->checkCaptcha();
            $error = array();
            $this->view->firstname = trim($request->getPost('firstname'));
            $this->view->lastname = trim($request->getPost('lastname'));
            $this->view->email = trim($request->getPost('email'));
            $this->view->email_confirm = trim($request->getPost('email_confirm'));
            $this->view->username = trim($request->getPost('username'));
            $this->view->password = trim($this->getRequest()->getPost('password'));
            $this->view->password_confirm = trim($request->getPost('password_confirm'));
            if (empty($this->view->firstname)) {
                $error['efirstname'] = $this->translate('You must type your first name');
            }
            if (empty($this->view->lastname)) {
                $error['elastname'] = $this->translate('You must type your last name');
            }
            if (empty($this->view->email)) {
                $error['eemail'] = $this->translate('You must type your email');
            } elseif (!Model_Users::ValidMail($this->view->email)) {
                $error['eemail'] = $this->translate('You must type valid email');
            } elseif (Model_Users::isExistEmail($this->view->email)) {
                $error['eemail'] = $this->translate('The email you have entered is already in our database');
            }
            if (empty($this->view->email_confirm)) {
                $error['eemail_confirm'] = $this->translate('You must retype your email');
            } elseif ($this->view->email_confirm != $this->view->email) {
                $error['eemail_confirm'] = $this->translate('The email adresses you have entered, does not match');
            }
            $methodNames = array();
            if (version_compare(PHP_VERSION, '5.2.6') === -1) {
                $class = new ReflectionObject($this);
                $classMethods = $class->getMethods();
                foreach ($classMethods as $method) {
                    $methodNames[] = $method->getName();
                }
            } else {
                $methodNames = get_class_methods($this);
            }
            $temp_methodNames = array();
            foreach ($methodNames as $methodName) {
                if (preg_match('/^([\\w]{1,})Action$/i', $methodName, $match)) {
                    $temp_methodNames[] = $match[1];
                }
            }
            $temp_methodNames = array_change_key_case($temp_methodNames, CASE_LOWER);
            if (empty($this->view->username)) {
                $error['eusername'] = $this->translate('You must type your username');
            } elseif (!preg_match('/^[a-zA-Z0-9_]+$/i', $this->view->username)) {
                $error['eusername'] = $this->translate('The username you have entered is not valid');
            } elseif (Model_Users::isExistUsername($this->view->username)) {
                $error['eusername'] = $this->translate('There is already registration with that username');
            } elseif (in_array(strtolower($this->view->username), $temp_methodNames)) {
                $error['eusername'] = $this->translate('This username can not be registered');
            }
            if (empty($this->view->password)) {
                $error['epassword'] = $this->translate('You must type your password');
            }
            if (empty($this->view->password_confirm)) {
                $error['epassword_confirm'] = $this->translate('You must retype your password');
            } elseif ($this->view->password_confirm != $this->view->password) {
                $error['epassword_confirm'] = $this->translate('The passwords you have entered does not match');
            }
            if ($captcha->getError()) {
                $error['ecaptcha'] = $this->translate('You must fill correct captcha');
            }
            if (!$request->getPost('terms')) {
                $error['eterms'] = $this->translate('You must agree with the terms');
            }
            if (!count($error)) {
                $activationKey = md5(rand(0, 10000) . date('HisdmY') . rand(0, 10000));
                if (!is_null(JO_Cookie::get('referral'))) {
                    $referal = Model_Users::getUser(JO_Cookie::get('referral'));
                    JO_Cookie::delete('referral');
                }
                Model_Users::register(array('username' => $this->view->username, 'password' => md5(md5($this->view->password)), 'email' => $this->view->email, 'firstname' => $this->view->firstname, 'lastname' => $this->view->lastname, 'activate_key' => $activationKey, 'referal_id' => isset($referal['user_id']) ? $referal['user_id'] : 0, 'fb_id' => $request->issetPost('fb_id') ? $request->getPost('fb_id') : 0));
                if ($request->getPost('subscribed')) {
                    Model_Bulletin::add(array('fname' => $this->view->firstname, 'lname' => $this->view->lastname, 'email' => $this->view->email));
                }
                $is_mail_smtp = JO_Registry::forceGet('config_mail_smtp');
                $not_template = Model_Notification::getNotification('registration');
                $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'));
                }
                $domain = $request->getDomain();
                $mail->setFrom('noreply@' . $domain);
                $mail->setReturnPath('noreply@' . $domain);
                $mail->setSubject($this->translate('Email activation') . ' ' . JO_Registry::get('store_meta_title'));
                if ($not_template) {
                    $title = $not_template['title'];
                    $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8');
                    $html = str_replace('{USERNAME}', $this->view->username, $html);
                    $html = str_replace('{URL}', WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&command=activate&user='******'&key=' . $activationKey), $html);
                } else {
                    $link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&command=activate&user='******'&key=' . $activationKey);
                    $html = nl2br('To activate your profile in ' . JO_Registry::get('meta_title') . ', please click the following link:
							<a href="' . $link . '">' . $link . '</a>');
                }
                $mail->setHTML($html);
                $result = (int) $mail->send(array($this->view->email), $is_mail_smtp ? 'smtp' : 'mail');
                if ($result) {
                    $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=verify'));
                } else {
                    JO_Session::set('msg_error', $this->translate('The email was not send. Please try again later'));
                }
            } else {
                JO_Session::set('error', $error);
            }
            $request->setParams('username', $this->view->username);
            JO_Session::set('data', $request->getParams());
            $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=registration'));
        }
        $this->view->recaptcha = $captcha->getCaptcha();
        $this->view->terms = Model_Pages::get(JO_Registry::forceGet('page_terms'));
        $this->view->checkAvaibility = WM_Router::create($request->getBaseUrl() . '?controller=users&action=checkAvaibility');
        if ($this->view->terms) {
            $this->view->terms['text'] = html_entity_decode($this->view->terms['text'], ENT_QUOTES, 'utf-8');
        }
        $facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret')));
        $this->view->facebook_link = $facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=callback_facebook'), 'req_perms' => JO_Registry::forceGet('facebook_req_perms'), 'scope' => JO_Registry::forceGet('facebook_req_perms')));
        $this->view->children = array();
        $this->view->children['header_part'] = 'layout/header_part';
        $this->view->children['footer_part'] = 'layout/footer_part';
    }
 /**
  * save
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function save()
 {
     $this->core->logger->debug('massiveart->generic->data->GenericDataTypePage->save()');
     try {
         $this->getModelPages()->setLanguageId($this->setup->getLanguageId());
         $intUserId = Zend_Auth::getInstance()->getIdentity()->id;
         /**
          * add|edit|newVersion core and instance data
          */
         switch ($this->setup->getActionType()) {
             case $this->core->sysConfig->generic->actions->add:
                 $strPageId = uniqid();
                 $intPageVersion = 1;
                 $intSortPosition = GenericSetup::DEFAULT_SORT_POSITION;
                 /**
                  * check if parent element is rootlevel or folder
                  */
                 if ($this->setup->getParentId() != '' && $this->setup->getParentId() > 0) {
                     $this->setup->setParentTypeId($this->core->sysConfig->parent_types->folder);
                     $objNaviData = $this->getModelFolders()->loadChildNavigation($this->setup->getParentId());
                 } else {
                     if ($this->setup->getRootLevelId() != '' && $this->setup->getRootLevelId() > 0) {
                         $this->setup->setParentId($this->setup->getRootLevelId());
                     } else {
                         $this->core->logger->err('massiveart->generic->data->GenericDataTypePage->save(): intRootLevelId is empty!');
                     }
                     $this->setup->setParentTypeId($this->core->sysConfig->parent_types->rootlevel);
                     $objNaviData = $this->getModelFolders()->loadRootNavigation($this->setup->getRootLevelId());
                 }
                 $intSortPosition = count($objNaviData);
                 $arrMainData = array('idGenericForms' => $this->setup->getGenFormId(), 'idTemplates' => $this->setup->getTemplateId(), 'idPageTypes' => $this->setup->getElementTypeId(), 'isStartPage' => $this->setup->getIsStartElement(), 'showInNavigation' => $this->setup->getShowInNavigation(), 'idParent' => $this->setup->getParentId(), 'idParentTypes' => $this->setup->getParentTypeId(), 'pageId' => $strPageId, 'version' => $intPageVersion, 'sortPosition' => $intSortPosition, 'sortTimestamp' => date('Y-m-d H:i:s'), 'idUsers' => $intUserId, 'creator' => $this->setup->getCreatorId(), 'created' => date('Y-m-d H:i:s'), 'idStatus' => $this->setup->getStatusId());
                 $this->setup->setElementId($this->objModelPages->getPageTable()->insert($arrMainData));
                 $this->insertCoreData('page', $strPageId, $intPageVersion);
                 $this->insertFileData('page', array('Id' => $strPageId, 'Version' => $intPageVersion));
                 $this->insertMultiFieldData('page', array('Id' => $strPageId, 'Version' => $intPageVersion));
                 $this->insertInstanceData('page', array('Id' => $strPageId, 'Version' => $intPageVersion));
                 $this->insertMultiplyRegionData('page', $strPageId, $intPageVersion);
                 break;
             case $this->core->sysConfig->generic->actions->edit:
                 $objSelect = $this->objModelPages->getPageTable()->select();
                 $objSelect->from('pages', array('pageId', 'version'));
                 $objSelect->where('id = ?', $this->setup->getElementId());
                 $objRowSet = $this->objModelPages->getPageTable()->fetchAll($objSelect);
                 if (count($objRowSet) == 1) {
                     $objPages = $objRowSet->current();
                     $strPageId = $objPages->pageId;
                     $intPageVersion = $objPages->version;
                     $strWhere = $this->objModelPages->getPageTable()->getAdapter()->quoteInto('pageId = ?', $objPages->pageId);
                     $strWhere .= $this->objModelPages->getPageTable()->getAdapter()->quoteInto(' AND version = ?', $objPages->version);
                     $this->objModelPages->getPageTable()->update(array('idGenericForms' => $this->setup->getGenFormId(), 'idTemplates' => $this->setup->getTemplateId(), 'idUsers' => $intUserId, 'creator' => $this->setup->getCreatorId(), 'idStatus' => $this->setup->getStatusId(), 'published' => $this->setup->getPublishDate(), 'idPageTypes' => $this->setup->getElementTypeId(), 'showInNavigation' => $this->setup->getShowInNavigation(), 'changed' => date('Y-m-d H:i:s')), $strWhere);
                     $this->updateCoreData('page', $objPages->pageId, $objPages->version);
                     $this->updateFileData('page', array('Id' => $objPages->pageId, 'Version' => $objPages->version));
                     $this->updateMultiFieldData('page', $objPages->pageId, $objPages->version);
                     $this->updateInstanceData('page', $objPages->pageId, $objPages->version);
                     $this->updateMultiplyRegionData('page', $objPages->pageId, $objPages->version);
                 }
                 break;
             case $this->core->sysConfig->generic->actions->change_template:
                 $objSelect = $this->objModelPages->getPageTable()->select();
                 $objSelect->from('pages', array('pageId', 'version'));
                 $objSelect->where('id = ?', $this->setup->getElementId());
                 $objRowSet = $this->objModelPages->getPageTable()->fetchAll($objSelect);
                 if (count($objRowSet) == 1) {
                     $objPages = $objRowSet->current();
                     $strPageId = $objPages->pageId;
                     $intPageVersion = $objPages->version;
                     $strWhere = $this->objModelPages->getPageTable()->getAdapter()->quoteInto('pageId = ?', $objPages->pageId);
                     $strWhere .= $this->objModelPages->getPageTable()->getAdapter()->quoteInto(' AND version = ?', $objPages->version);
                     $this->objModelPages->getPageTable()->update(array('idGenericForms' => $this->setup->getGenFormId(), 'idTemplates' => $this->setup->getTemplateId(), 'idUsers' => $intUserId), $strWhere);
                     $this->insertCoreData('page', $objPages->pageId, $objPages->version);
                     if ($this->blnHasLoadedFileData) {
                         $this->updateFileData('page', array('Id' => $objPages->pageId, 'Version' => $objPages->version));
                     } else {
                         $this->insertFileData('page', array('Id' => $objPages->pageId, 'Version' => $objPages->version));
                     }
                     if ($this->blnHasLoadedMultiFieldData) {
                         $this->updateMultiFieldData('page', $objPages->pageId, $objPages->version);
                     } else {
                         $this->insertMultiFieldData('page', array('Id' => $objPages->pageId, 'Version' => $objPages->version));
                     }
                     if ($this->blnHasLoadedInstanceData) {
                         $this->updateInstanceData('page', $objPages->pageId, $objPages->version);
                     } else {
                         $this->insertInstanceData('page', array('Id' => $objPages->pageId, 'Version' => $objPages->version));
                     }
                 }
                 break;
             case $this->core->sysConfig->generic->actions->change_template_id:
                 $objSelect = $this->objModelPages->getPageTable()->select();
                 $objSelect->from('pages', array('pageId', 'version'));
                 $objSelect->where('id = ?', $this->setup->getElementId());
                 $objRowSet = $this->objModelPages->getPageTable()->fetchAll($objSelect);
                 if (count($objRowSet) == 1) {
                     $objPages = $objRowSet->current();
                     $strPageId = $objPages->pageId;
                     $intPageVersion = $objPages->version;
                     $strWhere = $this->objModelPages->getPageTable()->getAdapter()->quoteInto('pageId = ?', $objPages->pageId);
                     $strWhere .= $this->objModelPages->getPageTable()->getAdapter()->quoteInto(' AND version = ?', $objPages->version);
                     $this->objModelPages->getPageTable()->update(array('idGenericForms' => $this->setup->getGenFormId(), 'idTemplates' => $this->setup->getTemplateId(), 'idUsers' => $intUserId), $strWhere);
                 }
                 break;
         }
         /**
          * now save all the special fields
          */
         if (count($this->setup->SpecialFields()) > 0) {
             foreach ($this->setup->SpecialFields() as $objField) {
                 $objField->setGenericSetup($this->setup);
                 $objField->save($this->setup->getElementId(), 'page', $strPageId, $intPageVersion);
             }
         }
         //page index
         if ($this->setup->getElementTypeId() != $this->core->sysConfig->page_types->link->id && $this->setup->getStatusId() == $this->core->sysConfig->status->live) {
             if (substr(PHP_OS, 0, 3) === 'WIN') {
                 $this->core->logger->warning('slow page index on windows based OS!');
                 $this->updateIndex(GLOBAL_ROOT_PATH . $this->core->sysConfig->path->search_index->page, $strPageId);
             } else {
                 $strIndexPageFilePath = GLOBAL_ROOT_PATH . 'cli/IndexPage.php';
                 //run page index in background
                 exec("php {$strIndexPageFilePath} --pageId='" . $strPageId . "' --version=" . $intPageVersion . " --languageId=" . $this->setup->getLanguageId() . " > /dev/null &#038;");
             }
         } else {
             $this->removeFromIndex(GLOBAL_ROOT_PATH . $this->core->sysConfig->path->search_index->page, $strPageId);
         }
         //cache expiring
         if ($this->Setup()->getField('url')) {
             $strUrl = $this->Setup()->getField('url')->getValue();
             $arrFrontendOptions = array('lifetime' => null, 'automatic_serialization' => true);
             $arrBackendOptions = array('cache_dir' => GLOBAL_ROOT_PATH . 'tmp/cache/pages/');
             // getting a Zend_Cache_Core object
             $objCache = Zend_Cache::factory('Output', 'File', $arrFrontendOptions, $arrBackendOptions);
             $strCacheId = 'page' . preg_replace('/[^a-zA-Z0-9_]/', '_', $strUrl);
             $objCache->remove($strCacheId);
             $objCache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('StartPage', 'PageType' . $this->core->sysConfig->page_types->overview->id));
         }
         return $this->setup->getElementId();
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }