public function cache_imageAction() { $request = $this->getRequest(); $width = (int) $request->getParam('width'); $height = (int) $request->getParam('height'); $cached_file = $request->getParam('cached_file'); $file = $request->getParam('file') . $request->getParam('extension'); $extension = $request->getParam('extension'); $gray = $request->getParam('gray') == 'gray'; $crop = $request->getParam('crop') == 'crop'; $watermark = $request->getParam('watermark') == 'watermark' ? 'watermark.png' : false; $model_images = new Helper_Images(); $image = false; if ($width && $height) { $image = $model_images->resize('/' . $file, $width, $height, $crop, $watermark, $gray); } else { if ($width) { $image = $model_images->resizeWidth('/' . $file, $width, $watermark, $gray); } else { if ($height) { $image = $model_images->resizeHeight('/' . $file, $height, $watermark, $gray); } else { $this->forward('error', 'error404'); } } } if ($image) { $response = $this->getResponse(); $response->addHeader('Content-type:' . JO_File_Ext::getMimeFromFile($image)); $response->appendBody(file_get_contents($image)); exit; } else { $this->forward('error', 'error404'); } }
public function imageAction() { $this->setInvokeArg('noViewRenderer', true); $image = $this->getRequest()->getRequest('image'); if ($image !== null) { $models_images = new Helper_Images(); echo $models_images->resize($image, 100, 100); } }
public function readAction() { $pageIDs = explode('_', $this->getRequest()->getRequest('page_id')); $pageID = end($pageIDs); // if($pageID == JO_Registry::get('page_contact')) { // $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=contacts')); // } if ($this->getRequest()->isXmlHttpRequest() || $this->getRequest()->issetQuery('popup')) { $this->forward('pages', 'ajaxRead'); } $this->view->page = Model_Pages::getPage($pageID); if (!$this->view->page) { $this->forward('error', 'error404'); } if ($this->view->page['parent_id']) { $this->getRequest()->setParams('active_page_id', $this->view->page['parent_id']); } else { $this->getRequest()->setParams('active_page_id', $pageID); } $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->page['description'] = $this->replaceTags($this->view->page['description']); $this->getLayout()->meta_title = $this->view->page['meta_title'] ? $this->view->page['meta_title'] : $this->view->page['title']; $this->getLayout()->meta_description = $this->view->page['meta_description']; $this->getLayout()->meta_keywords = $this->view->page['meta_keywords']; $this->view->images = array(); $images = Model_Gallery::getGalleryImages($pageID, 'pages'); if ($images) { foreach ($images as $image) { $this->view->images[] = array('title' => $image['title'], 'thumb' => $model_images->resize($image['image'], 91, 47, true), 'popup' => $model_images->resizeWidth($image['image'], 582), 'image' => 'uploads' . $image['image']); } } $this->view->full_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $pageID); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pages/left_part'); }
private function getForm() { $request = $this->getRequest(); $categories_id = $request->getRequest('id'); $places_model = new Model_Categories(); if ($categories_id) { $categories_info = $places_model->getCategory($categories_id); } $this->view->cancel_url = $request->getModule() . '/categories/'; if ($request->getPost('status')) { $this->view->status = $request->getPost('status'); } elseif (isset($categories_info)) { $this->view->status = $categories_info['status']; } else { $this->view->status = 1; } if ($request->getPost('title')) { $this->view->title = $request->getPost('title'); } elseif (isset($categories_info)) { $this->view->title = $categories_info['title']; } if ($request->getPost('meta_title')) { $this->view->meta_title = $request->getPost('meta_title'); } elseif (isset($categories_info)) { $this->view->meta_title = $categories_info['meta_title']; } if ($request->getPost('meta_description')) { $this->view->meta_description = $request->getPost('meta_description'); } elseif (isset($categories_info)) { $this->view->meta_description = $categories_info['meta_description']; } if ($request->getPost('meta_keywords')) { $this->view->meta_keywords = $request->getPost('meta_keywords'); } elseif (isset($categories_info)) { $this->view->meta_keywords = $categories_info['meta_keywords']; } if ($request->getRequest('keyword')) { $this->view->keyword = $request->getRequest('keyword'); } elseif (isset($categories_info)) { $this->view->keyword = $categories_info['keyword']; } // image $image_model = new Helper_Images(); if ($request->getRequest('image')) { $this->view->image = $request->getRequest('image'); } elseif (isset($categories_info['image'])) { $this->view->image = $categories_info['image']; } else { $this->view->image = ''; } if ($this->view->image) { $this->view->preview_image = $image_model->resize($this->view->image, 100, 100); } else { $this->view->preview_image = $image_model->resize(Helper_Config::get('no_image'), 100, 100); } if (!$this->view->preview_image) { $this->view->preview_image = $image_model->resize(Helper_Config::get('no_image'), 100, 100); } }
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'] : ''); } } } }
public static function uploadUserAvatar($image, $user_id = 0) { if (($imageinfo = getimagesize($image)) !== false) { self::init(); if (self::$error) { return false; } $added_date = time(); $username = md5($user_id); $user_info = new Model_Users_User($user_id); if ($user_info->count()) { $added_date = $user_info['date_added']; $username = $user_info['username']; } $ext = strtolower(strrchr($image, ".")); if (!$ext) { $mime_ext = explode('/', $imageinfo['mime']); if (isset($mime_ext[1])) { $ext = '.' . $mime_ext[1]; } } $name = $username . '_' . $user_id . $ext; $image_path = 'avatars/' . WM_Date::format($added_date, 'yy/mm/'); if (!file_exists(BASE_PATH . '/uploads/cache_avatars/' . $image_path) || !is_dir(BASE_PATH . '/uploads/cache_avatars/' . $image_path)) { @mkdir(BASE_PATH . '/uploads/cache_avatars/' . $image_path, 0777, true); } $user_agent = ini_get('user_agent'); ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9'); if (!@copy($image, BASE_PATH . '/uploads/cache_avatars/' . $image_path . $name)) { self::$error = self::translate('Unable to upload to the local server!'); return false; } ini_set('user_agent', $user_agent); $max_width = 0; $sizes = self::userThumbSizes(); $pin_sizes = array(); if ($sizes) { $model_images = new Helper_Images(); foreach ($sizes as $size => $prefix) { $sizes = explode('x', $size); $pin_sizes[] = array((int) isset($sizes[0]) ? $sizes[0] : 0, (int) isset($sizes[1]) ? $sizes[1] : 0, basename($name, $ext) . $prefix . $ext); $max_width = max($max_width, (int) isset($sizes[0]) ? $sizes[0] : 0); } if ($max_width) { $thumb_a = $model_images->resizeWidth('/cache_avatars/' . $image_path . $name, $max_width); $thumb_a1 = explode('/uploads/', $thumb_a); if ($thumb_a1 && isset($thumb_a1[1]) && $thumb_a1[1]) { self::upload(BASE_PATH . '/uploads/' . $thumb_a1[1], $image_path . $name); if (self::$error) { return false; } foreach ($pin_sizes as $s) { if (self::$error) { return false; } $thumb_b = ''; if ($s[0] && $s[1]) { $thumb_b = $model_images->resize('/' . $thumb_a1[1], $s[0], $s[1], true); } else { if ($s[0] && !$s[1]) { $thumb_b = $model_images->resizeWidth('/' . $thumb_a1[1], $s[0]); } else { if (!$s[0] && $s[1]) { $thumb_b = $model_images->resizeHeight('/' . $thumb_a1[1], $s[1]); } } } $thumb_b1 = explode('/uploads/', $thumb_b); if ($thumb_b1 && isset($thumb_b1[1]) && $thumb_b1[1]) { self::upload(BASE_PATH . '/uploads/' . $thumb_b1[1], $image_path . $s[2]); if (self::$error) { return false; } } else { self::$error = self::translate('Unable to upload to the local server!'); return false; } } $model_images->deleteImages('/' . $thumb_a1[1]); $model_images->deleteImages('/cache_avatars/' . $image_path . $name); return array('store' => 'Model_Upload_Amazons3', 'image' => $image_path . $name, 'width' => 0, 'height' => 0); } else { self::$error = self::translate('Unable to upload to the local server!'); return false; } } else { self::$error = self::translate('Missing images sizes!'); return false; } } else { self::$error = self::translate('Missing images sizes!'); return false; } } else { self::$error = self::translate('Image format is not valid!'); return false; } self::$error = self::translate('Unknown server error!'); return false; }
public function upload_imagesAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]')) { $image = $request->getFile('file'); if (!$image) { $this->view->error = $this->translate('There is no file selected'); } else { $temporary = '/cache/review/'; $upload_folder = BASE_PATH . $temporary; $upload = new Helper_Upload(); $files_delete = glob($upload_folder . '*.*'); $imageObject = new Helper_Images(); if ($files_delete) { for ($i = 0; $i < min(count($files_delete), 250); $i++) { if (filemtime($files_delete[$i]) + 86400 < time()) { $imageObject->deleteImages('/../' . $temporary . basename($files_delete[$i])); } } } $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder); $new_name = md5(time() . serialize($image)); if ($upload->upload($new_name)) { $info = $upload->getFileInfo(); if ($info) { $files = JO_Session::get('gallery_upload_images'); if (!$files) { $files = array(); } $config_image_minimum_size = (int) Helper_Config::get('config_image_minimum_size'); if (!$config_image_minimum_size) { $config_image_minimum_size = 80; } if (isset($info['image_dimension']['x']) && $info['image_dimension']['x'] >= $config_image_minimum_size && $info['image_dimension']['y'] >= $config_image_minimum_size) { $imageObject->resize('/../' . $temporary . $info['name'], 75, 75, true); $files[] = array('name' => $image['name'], 'tmp_name' => $info['name'], 'path' => $temporary); JO_Session::set('gallery_upload_images', $files); $this->view->success = 1; } else { $this->view->error = sprintf($this->translate('Photo size must be larger width and height of %s px'), $config_image_minimum_size); } } else { $this->view->error = $this->translate('An unknown error'); } } else { $this->view->error = $upload->getError(); } } } else { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); } echo $this->renderScript('json'); }
public function indexAction() { $request = $this->getRequest(); if ($request->isPost()) { Model_Settings::updateAll($request->getParams()); $this->session->set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/payments/'); } $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'paypal')); $confog = $request->getPost('paypal'); if (isset($confog['paypal_sandbox_mode'])) { $this->view->paypal_sandbox_mode = $confog['paypal_sandbox_mode']; } elseif (isset($store_config['paypal_sandbox_mode'])) { $this->view->paypal_sandbox_mode = $store_config['paypal_sandbox_mode']; } else { $this->view->paypal_sandbox_mode = 0; } if (isset($confog['paypal_status'])) { $this->view->paypal_status = $confog['paypal_status']; } elseif (isset($store_config['paypal_status'])) { $this->view->paypal_status = $store_config['paypal_status']; } else { $this->view->paypal_status = 0; } if (isset($confog['paypal_email'])) { $this->view->paypal_email = $confog['paypal_email']; } elseif (isset($store_config['paypal_email'])) { $this->view->paypal_email = $store_config['paypal_email']; } else { $this->view->paypal_email = ''; } if (isset($confog['paypal_sort_order'])) { $this->view->paypal_sort_order = $confog['paypal_sort_order']; } elseif (isset($store_config['paypal_sort_order'])) { $this->view->paypal_sort_order = $store_config['paypal_sort_order']; } else { $this->view->paypal_sort_order = 0; } if (isset($confog['paypal_pdt_token'])) { $this->view->paypal_pdt_token = $confog['paypal_pdt_token']; } elseif (isset($store_config['paypal_pdt_token'])) { $this->view->paypal_pdt_token = $store_config['paypal_pdt_token']; } else { $this->view->paypal_pdt_token = ''; } /**************** STATUSES ****************/ /*if(isset($confog['config_order_status_id'])) { $this->view->config_order_status_id = $confog['config_order_status_id']; } elseif(isset($store_config['config_order_status_id'])) { $this->view->config_order_status_id = $store_config['config_order_status_id']; } else { $this->view->config_order_status_id = ''; }*/ if (isset($confog['pp_standard_canceled_reversal_status_id'])) { $this->view->pp_standard_canceled_reversal_status_id = $confog['pp_standard_canceled_reversal_status_id']; } elseif (isset($store_config['pp_standard_canceled_reversal_status_id'])) { $this->view->pp_standard_canceled_reversal_status_id = $store_config['pp_standard_canceled_reversal_status_id']; } else { $this->view->pp_standard_canceled_reversal_status_id = ''; } if (isset($confog['pp_standard_completed_status_id'])) { $this->view->pp_standard_completed_status_id = $confog['pp_standard_completed_status_id']; } elseif (isset($store_config['pp_standard_completed_status_id'])) { $this->view->pp_standard_completed_status_id = $store_config['pp_standard_completed_status_id']; } else { $this->view->pp_standard_completed_status_id = ''; } if (isset($confog['pp_standard_denied_status_id'])) { $this->view->pp_standard_denied_status_id = $confog['pp_standard_denied_status_id']; } elseif (isset($store_config['pp_standard_denied_status_id'])) { $this->view->pp_standard_denied_status_id = $store_config['pp_standard_denied_status_id']; } else { $this->view->pp_standard_denied_status_id = ''; } if (isset($confog['pp_standard_expired_status_id'])) { $this->view->pp_standard_expired_status_id = $confog['pp_standard_expired_status_id']; } elseif (isset($store_config['pp_standard_expired_status_id'])) { $this->view->pp_standard_expired_status_id = $store_config['pp_standard_expired_status_id']; } else { $this->view->pp_standard_expired_status_id = ''; } if (isset($confog['pp_standard_failed_status_id'])) { $this->view->pp_standard_failed_status_id = $confog['pp_standard_failed_status_id']; } elseif (isset($store_config['pp_standard_failed_status_id'])) { $this->view->pp_standard_failed_status_id = $store_config['pp_standard_failed_status_id']; } else { $this->view->pp_standard_failed_status_id = ''; } if (isset($confog['pp_standard_pending_status_id'])) { $this->view->pp_standard_pending_status_id = $confog['pp_standard_pending_status_id']; } elseif (isset($store_config['pp_standard_pending_status_id'])) { $this->view->pp_standard_pending_status_id = $store_config['pp_standard_pending_status_id']; } else { $this->view->pp_standard_pending_status_id = ''; } if (isset($confog['pp_standard_processed_status_id'])) { $this->view->pp_standard_processed_status_id = $confog['pp_standard_processed_status_id']; } elseif (isset($store_config['pp_standard_processed_status_id'])) { $this->view->pp_standard_processed_status_id = $store_config['pp_standard_processed_status_id']; } else { $this->view->pp_standard_processed_status_id = ''; } if (isset($confog['pp_standard_refunded_status_id'])) { $this->view->pp_standard_refunded_status_id = $confog['pp_standard_refunded_status_id']; } elseif (isset($store_config['pp_standard_refunded_status_id'])) { $this->view->pp_standard_refunded_status_id = $store_config['pp_standard_refunded_status_id']; } else { $this->view->pp_standard_refunded_status_id = ''; } if (isset($confog['pp_standard_reversed_status_id'])) { $this->view->pp_standard_reversed_status_id = $confog['pp_standard_reversed_status_id']; } elseif (isset($store_config['pp_standard_reversed_status_id'])) { $this->view->pp_standard_reversed_status_id = $store_config['pp_standard_reversed_status_id']; } else { $this->view->pp_standard_reversed_status_id = ''; } if (isset($confog['pp_standard_voided_status_id'])) { $this->view->pp_standard_voided_status_id = $confog['pp_standard_voided_status_id']; } elseif (isset($store_config['pp_standard_voided_status_id'])) { $this->view->pp_standard_voided_status_id = $store_config['pp_standard_voided_status_id']; } else { $this->view->pp_standard_voided_status_id = ''; } $this->view->statuses = WM_Orderstatuses::orderStatuses(); /////// logo $image_model = new Helper_Images(); if (isset($confog['paypal_logo']) && $confog['paypal_logo']) { $this->view->paypal_logo = $confog['paypal_logo']; } elseif (isset($store_config['paypal_logo']) && $store_config['paypal_logo']) { $this->view->paypal_logo = $store_config['paypal_logo']; } else { $this->view->paypal_logo = ''; } if ($this->view->paypal_logo) { $this->view->preview_logo = $image_model->resize($this->view->paypal_logo, 100, 100); } else { $this->view->preview_logo = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); } if (!$this->view->preview_logo) { $this->view->preview_logo = $image_model->resize('/no_image.png', 100, 100); } $this->view->preview = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100); if (!$this->view->preview) { $this->view->preview = $image_model->resize('/no_image.png', 100, 100); } }
public function filesAction() { $json = array(); $models_images = new Helper_Images(); $directoryp = $this->getRequest()->getRequest('directory'); if ($directoryp !== null) { $directory = $this->upload_folder . str_replace('../', '', $directoryp); } else { $directory = $this->upload_folder; } $allowed_images = array('.jpg', '.jpeg', '.png', '.gif'); $allowed_files = array('.doc', '.docx', '.rtf', '.txt', '.pdf', '.flv', '.mp4'); $files = glob(rtrim($directory, '/') . '/*'); $files = is_array($files) ? $files : array(); foreach ($files as $file) { if (is_file($file)) { $ext = strrchr($file, '.'); } else { $ext = ''; } if (in_array(strtolower($ext), $allowed_images)) { $size = filesize($file); $file_size = $this->format_bytes($size); $json[] = array('file' => substr($file, strlen($this->upload_folder)), 'filename' => basename($file), 'size' => $file_size, 'thumb' => $models_images->resize(substr($file, strlen($this->upload_folder)), 100, 100)); } elseif (in_array(strtolower($ext), $allowed_files)) { $size = filesize($file); $file_size = $this->format_bytes($size); $json[] = array('file' => substr($file, strlen($this->upload_folder)), 'filename' => basename($file), 'size' => $file_size, 'thumb' => $models_images->resize('/files/file_' . trim(strtolower($ext), '.') . '.png', 100, 100)); } } $response = $this->getResponse(); $response->addHeader('Cache-Control: no-cache, must-revalidate'); $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); $response->addHeader('Content-type: application/json'); $this->setInvokeArg('noViewRenderer', true); echo JO_Json::encode($json); }
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(); } }
public function secondAction() { $request = $this->getRequest(); $this->view->total_following = Model_Boards_Follow::totalBoardFollow(JO_Session::get('user[user_id]')); if ($this->view->total_following < 5) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=welcome')); } //////////// Categories //////////// $this->view->categories = array(); /* v2.2 */ $config_enable_follow_private_profile = ''; if (Helper_Config::get('config_enable_follow_private_profile')) { $config_enable_follow_private_profile = ' AND user_id IN (SELECT user_id FROM users WHERE public = 1)'; } /* v2.2 */ $categories = Model_Categories::getCategories(array('filter_status' => 1, 'where' => new JO_Db_Expr('category.category_id IN (SELECT category_id FROM boards WHERE category_id = category.category_id AND pins > 0 ' . $config_enable_follow_private_profile . ')'))); $model_images = new Helper_Images(); foreach ($categories as $category) { if ($category['image']) { $category['thumb'] = $model_images->resize($category['image'], 113, 113, true); } else { $category['thumb'] = $model_images->resize(Helper_Config::get('no_image'), 113, 113); } $this->view->categories[] = $category; } $this->view->load_boards = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=welcome&action=boardsideas'); $this->view->next_step = WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=third'); $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=createboardwithoutcategory'); $this->view->createBoardWithCat = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create'); //call header and footer childrens $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); }
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; //////////////////////////////////////// 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'; } if (isset($config['config_disable_js'])) { $this->view->config_disable_js = $config['config_disable_js']; } elseif (isset($store_config['config_disable_js'])) { $this->view->config_disable_js = $store_config['config_disable_js']; } else { $this->view->config_disable_js = 0; } if (isset($config['config_pin_prefix'])) { $this->view->config_pin_prefix = $config['config_pin_prefix']; } elseif (isset($store_config['config_pin_prefix'])) { $this->view->config_pin_prefix = $store_config['config_pin_prefix']; } else { $this->view->config_pin_prefix = 'pin'; } if (isset($config['config_user_view'])) { $this->view->config_user_view = $config['config_user_view']; } elseif (isset($store_config['config_user_view'])) { $this->view->config_user_view = $store_config['config_user_view']; } else { $this->view->config_user_view = 'fullname'; } if (isset($config['config_gallery_pin'])) { $this->view->config_gallery_pin = $config['config_gallery_pin']; } elseif (isset($store_config['config_gallery_pin'])) { $this->view->config_gallery_pin = $store_config['config_gallery_pin']; } else { $this->view->config_gallery_pin = 1; } if (isset($config['config_gallery_limit'])) { $this->view->config_gallery_limit = $config['config_gallery_limit']; } elseif (isset($store_config['config_gallery_limit'])) { $this->view->config_gallery_limit = $store_config['config_gallery_limit']; } else { $this->view->config_gallery_limit = 5; } if (isset($config['config_home_page_view_not_loged'])) { $this->view->config_home_page_view_not_loged = $config['config_home_page_view_not_loged']; } elseif (isset($store_config['config_home_page_view_not_loged'])) { $this->view->config_home_page_view_not_loged = $store_config['config_home_page_view_not_loged']; } else { $this->view->config_home_page_view_not_loged = 'randum'; } if (isset($config['config_home_page_view_loged'])) { $this->view->config_home_page_view_loged = $config['config_home_page_view_loged']; } elseif (isset($store_config['config_home_page_view_loged'])) { $this->view->config_home_page_view_loged = $store_config['config_home_page_view_loged']; } else { $this->view->config_home_page_view_loged = 'following'; } if (isset($config['config_image_minimum_size'])) { $this->view->config_image_minimum_size = $config['config_image_minimum_size']; } elseif (isset($store_config['config_image_minimum_size'])) { $this->view->config_image_minimum_size = $store_config['config_image_minimum_size']; } else { $this->view->config_image_minimum_size = 80; } /* v2.2 */ if (isset($config['config_enable_follow_private_profile'])) { $this->view->config_enable_follow_private_profile = $config['config_enable_follow_private_profile']; } elseif (isset($store_config['config_enable_follow_private_profile'])) { $this->view->config_enable_follow_private_profile = $store_config['config_enable_follow_private_profile']; } else { $this->view->config_enable_follow_private_profile = 0; } /* v2.2 */ //////////////////////////////////////// Storage //////////////////////////////////////// $this->view->upload_storage = array(); $this->view->upload_storage[] = array('key' => 'Model_Upload_Locale', 'active' => 'Model_Upload_Locale' == Helper_Config::get('file_upload_method'), 'name' => $this->translate('Locale')); /*$storage = (array)$this->view->callChildrenView('modules_storage'); if(isset($storage['modules']) && $storage['modules']) {*/ $storage_modules = $this->getUploadStorages(); if ($storage_modules) { foreach ($storage_modules as $mod) { if ($mod['is_installed']) { $key = 'Model_Upload_' . ucfirst(strtolower($mod['key'])); $this->view->upload_storage[] = array('key' => $key, 'active' => $key == Helper_Config::get('file_upload_method'), 'name' => $mod['name']); } } } if (isset($config['config_comments_list'])) { $this->view->config_comments_list = $config['config_comments_list']; } elseif (isset($store_config['config_comments_list'])) { $this->view->config_comments_list = $store_config['config_comments_list']; } else { $this->view->config_comments_list = 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; } 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; } //////////////////////////////////////// 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; } if (isset($pages['page_private_boards'])) { $this->view->page_private_boards = $pages['page_private_boards']; } elseif (isset($store_config['page_private_boards'])) { $this->view->page_private_boards = $store_config['page_private_boards']; } else { $this->view->page_private_boards = 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['config_board_description_enable'])) { $this->view->config_board_description_enable = $config['config_board_description_enable']; } elseif (isset($store_config['config_board_description_enable'])) { $this->view->config_board_description_enable = $store_config['config_board_description_enable']; } else { $this->view->config_board_description_enable = 0; } if (isset($config['config_private_boards'])) { $this->view->config_private_boards = $config['config_private_boards']; } elseif (isset($store_config['config_private_boards'])) { $this->view->config_private_boards = $store_config['config_private_boards']; } else { $this->view->config_private_boards = 0; } 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(); } }
public function eventsHistoryAction() { $request = $this->getRequest(); $user_data = $this->profileHelp(); $this->setViewChange('profile'); $this->view->active = 'events'; $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $this->view->boards = ''; $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'sort' => 'DESC', 'order' => 'history_id'); $history = Model_History::getHistory($data, 'from_user_id', $user_data['user_id']); if ($history) { $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); foreach ($history as $key => $data) { $data['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['to_user_id']); $event = Model_Events::getEventSolo($data['pin_id']); $avatar = Helper_Uploadimages::event($event, '_B'); $data['thumb'] = $avatar['image']; $data['thumb_width'] = $avatar['width']; $data['thumb_height'] = $avatar['height']; if (!@getimagesize($data['thumb'])) { $data['thumb'] = $model_images->resize(JO_Registry::get('no_avatar'), 180, 180); $data['thumb_width'] = $model_images->getSizes('width'); $data['thumb_height'] = $model_images->getSizes('height'); } $view->history = $data; if ($data['history_action'] == Model_History::FOLLOW_EVENT) { $view->history['eventIsFollow'] = Model_Events::isFollowEvent("", $view->history['to_user_id']); $view->history['follow_event'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $view->history['pin_id'] . '&userio_id=' . $view->history['to_user_id']); $view->history['fullname'] = $data['user']['fullname']; $view->history['avatar'] = $avatar['image']; $this->view->boards .= $view->render('history/follow_event', 'users'); } elseif ($data['history_action'] == Model_History::UNFOLLOW_EVENT) { $view->history['eventIsFollow'] = Model_Events::isFollowEvent("", $view->history['to_user_id']); $view->history['follow_event'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $view->history['pin_id'] . '&userio_id=' . $view->history['to_user_id']); $view->history['fullname'] = $data['user']['fullname']; $view->history['avatar'] = $avatar['image']; $this->view->boards .= $view->render('history/unfollow_event', 'users'); } } } $agendas = Model_Users::getUserAgenda(array('filter_user_id' => $user_data['user_id'])); $this->view->has_agendas = false; $this->view->agendas_users = ""; if ($agendas) { $this->view->has_agendas = true; foreach ($agendas as $agenda) { $agenda['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopupDelete&agenda_id=' . $agenda['agenda_id'] . '&user_id=' . $user_data['user_id']); $this->view->agenda = $agenda; $this->view->agendas_users .= $this->view->render('agenda', 'users'); } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_agenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopup&user_id=' . $user_data['user_id']); //no mover de esta ubicación $messages = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => 0)); $this->view->has_messages = false; $this->view->messages_users = ""; if ($messages) { $this->view->has_messages = true; foreach ($messages as $message) { $avatar = Helper_Uploadimages::avatar($message, '_A'); $message['avatar'] = $avatar['image']; $message['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $message['user_id']); $message['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $message['message_id'] . '&user_id=' . $user_data['user_id']); $message['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $message['message_id']); $this->view->message = $message; $this->view->messages_users .= $this->view->render('message', 'users'); //ahora vamos a consultar las respuestas a este: $messagesHijos = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => $message['message_id'])); if ($messagesHijos) { foreach ($messagesHijos as $messageHijo) { $avatar = Helper_Uploadimages::avatar($messageHijo, '_A'); $messageHijo['avatar'] = $avatar['image']; $messageHijo['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $messageHijo['user_id']); $messageHijo['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $messageHijo['message_id'] . '&user_id=' . $user_data['user_id']); $messageHijo['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $messageHijo['message_id']); $this->view->message = $messageHijo; $this->view->messages_users .= $this->view->render('message', 'users'); } } } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_messages = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=0'); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activatePopup'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activateDetail'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); $_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate'); $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=activate'); //$this->view->deportes = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=deportes'); $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'); $activate = Model_Users::getActivateUser(JO_Session::get('user[user_id]')); if ($activate) { $this->view->userIsActivate = $activate["activate"]; } if ($user_data['type_user']) { $this->view->userCanActivate = Model_Users::getUserTypeNotOthers($user_data['type_user']); } if (JO_Registry::get('isMobile')) { $this->view->urlagenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agenda&user_id=' . $user_data['user_id']); $this->view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $user_data['user_id']); } if ($request->isXmlHttpRequest()) { echo $this->view->boards; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public static function getEventImage($user, $prefix = null) { $sizes = self::userThumbSizes(); $format_size = false; if ($sizes) { foreach ($sizes as $val => $key) { if ($key == $prefix) { $format_size = $val; break; } } } if (!$format_size) { return false; } $model_images = new Helper_Images(); $sizes = explode('x', $format_size); $width = (int) isset($sizes[0]) ? $sizes[0] : 0; $height = (int) isset($sizes[1]) ? $sizes[1] : 0; if ($width && $height) { $img = $model_images->resize($user['avatar'], $width, $height, true); } else { if ($width && !$height) { $img = $model_images->resizeWidth($user['avatar'], $width); } else { if ($height && !$width) { $img = $model_images->resizeHeight($user['avatar'], $height); } } } if ($img) { return array('image' => $img, 'original' => $model_images->original($user['avatar']), 'width' => $model_images->getSizes('width'), 'height' => $model_images->getSizes('height'), 'mime' => JO_File_Ext::getMimeFromFile($img)); } return false; }
public static function uploadUserAvatar($avatar, $user_id = 0) { //try { if (($imageinfo = getimagesize($avatar)) !== false) { if (!file_exists(BASE_PATH . '/uploads/cache_avatars/' . $user_id) || !is_dir(BASE_PATH . '/uploads/cache_avatars/' . $user_id)) { @mkdir(BASE_PATH . '/uploads/cache_avatars/' . $user_id, 0777, true); } $ext = strtolower(strrchr($avatar, ".")); if (!$ext) { $mime_ext = explode('/', $imageinfo['mime']); if (isset($mime_ext[1])) { $ext = '.' . $mime_ext[1]; } } $name = md5(time() . mt_rand()) . '_' . $user_id . $ext; if (@copy($avatar, BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/' . $name)) { $added_date = time(); if (is_array($user_info = Model_Users::getUser($user_id))) { $added_date = $user_info['date_added']; self::deleteUserImage($user_info); } $user_agent = ini_get('user_agent'); ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9'); $container = 'amatteur_users'; $auth = new JO_Api_Rackspace_Authentication(JO_Registry::get('rsUsername'), JO_Registry::get('rsApiKey')); if ($auth->authenticate()) { $conn = new JO_Api_Rackspace_Connection($auth); $contaners = $conn->list_public_containers(); if (!in_array($container, $contaners)) { $conn->create_container($container); $contaners[] = $container; } if ($contaners && in_array($container, $contaners)) { $images = $conn->get_container($container); $images->make_public(86400 * 365); $images = $conn->get_container($container); if (!$images->cdn_uri) { return false; } $object = $images->create_object($name); $object->load_from_filename(BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/' . $name); $image_info = $images->get_object($name); if (!$image_info->name) { return false; } $model_images = new Helper_Images(); $temp_width = 0; $temp_height = 0; $sizes = self::userThumbSizes(); if ($sizes) { foreach ($sizes as $size => $prefix) { $sizes = explode('x', $size); $width = (int) isset($sizes[0]) ? $sizes[0] : 0; $height = (int) isset($sizes[1]) ? $sizes[1] : 0; $name_pref = basename($name, $ext) . $prefix . $ext; if ($width && $height) { $thumb_a = $model_images->resize('/cache_avatars/' . $user_id . '/' . $name, $width, $height, true); } else { if ($width && !$height) { $thumb_a = $model_images->resizeWidth('/cache_avatars/' . $user_id . '/' . $name, $width); } else { if ($height && !$width) { $thumb_a = $model_images->resizeHeight('/cache_avatars/' . $user_id . '/' . $name, $height); } } } if ($prefix == '_B') { $temp_width = $model_images->getSizes('width'); $temp_height = $model_images->getSizes('height'); } $thumb_a1 = explode('/uploads/', $thumb_a); if ($thumb_a1 && isset($thumb_a1[1])) { $object = $images->create_object($name_pref); $object->load_from_filename(BASE_PATH . '/uploads/' . $thumb_a1[1]); } } } self::recursiveDelete(BASE_PATH . '/uploads/cache_avatars/' . $user_id . '/'); self::recursiveDelete(BASE_PATH . '/uploads/cache/cache_avatars/' . $user_id . '/'); if ($temp_width) { return array('store' => 'rackspace', 'image' => $images->cdn_uri . '/' . $image_info->name, 'width' => $temp_width, 'height' => $temp_height); } } } } } return false; /*} catch (JO_Exception $e) { return false; }*/ return false; }
public function editAction() { $request = $this->getRequest(); if (!JO_Session::get('user_id')) { JO_Session::set('msg_error', $this->translate('You must be logged to change your profile')); $redir = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); if ($request->getRequest('tool') == 'change_avatar') { die(json_encode(array('logout' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=login')))); } else { $this->redirect($redir); } } $this->getLayout()->meta_title = $this->translate('Edit settings'); $this->getLayout()->meta_description = $this->translate('Edit settings'); if (JO_Session::get('msg_success')) { $this->view->msg_success = JO_Session::get('msg_success'); JO_Session::clear('msg_success'); } elseif (JO_Session::get('msg_error')) { $this->view->error = JO_Session::get('msg_error'); JO_Session::clear('msg_error'); } $tool = $request->getRequest('tool'); $username = JO_Session::get('username'); $this->view->user = Model_Users::getByUserName($username); $this->view->author_header = Helper_Author::authorHeader($this->view->user); $this->view->settings_box = Helper_Author::getSettingsBox($tool); $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Profile'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'name' => $this->translate('Settings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'))); switch ($tool) { case 'change_avatar': $image = $request->getFile('file'); if ($image) { $users_path = '/users/' . JO_Date::getInstance(JO_Session::get('register_datetime'), 'yy/mm') . '/' . JO_Session::get('user_id') . '/'; $upload_folder = realpath(BASE_PATH . '/uploads'); $upload_folder .= $users_path; $upload = new JO_Upload(); $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder); $new_name = md5(time() . serialize($image)); if ($upload->upload($new_name)) { $info = $upload->getFileInfo(); if ($info) { $file_path = $users_path . $info['name']; $model_images = new Model_Images(); if (JO_Session::get('avatar')) { $model_images->deleteImages(JO_Session::get('avatar'), true); } $thumb = $model_images->resize($file_path, JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true); Model_Users::editAvatar(JO_Session::get('user_id'), $file_path); die('{ "avatar": "' . $thumb . '", "msg_success": "' . $this->translate('You have successfully changed your avatar') . '"}'); } else { die('{ "msg_error": "' . $this->translate('There was an unexpected error with uploading the file') . '"}'); } } else { die('{ "msg_error": "' . $this->translate('The file must be valid image') . '" }'); } } break; case 'change_password': if ($request->isPost()) { $s = Model_Users::editPassword(JO_Session::get('user_id'), array('password' => $request->getPost('password'), 'new_password' => $request->getPost('new_password'), 'new_password_confirm' => $request->getPost('new_password_confirm'))); if ($s === true) { $this->session->set('msg_success', $this->translate('You have successfully updated your password')); } else { $this->session->set('msg_error', $s); } $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=change_password')); } $this->view->formtitle = $this->translate('Change your password'); $this->view->crumbs[] = array('name' => $this->view->formtitle); $this->view->author_form = $this->view->renderByModule('single_user/change_password', 'users', 'themes'); break; case 'exclusive_author': if ($request->isPost()) { $exclusive_author = $request->getPost('exclusive_author'); Model_Users::editExclusive(JO_Session::get('user_id'), $exclusive_author); if ($exclusive_author == 'true') { JO_Session::set('msg_success', $this->translate('You have successfully changed to exclusive author')); } else { JO_Session::set('msg_success', $this->translate('You have successfully changed to non exclusive author')); } $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=exclusive_author')); } if ($this->view->user['exclusive_author'] == 'true') { $this->view->formtitle = $this->translate('Exclusive Author'); $this->view->button = $this->translate('Unsubscribe me as exclusive author'); } else { $this->view->formtitle = $this->translate('Non-Exclusive Author'); $this->view->button = $this->translate('Subscribe me as exclusive author'); } $this->view->top_text = $this->translate('Agreeing to keep your portfolio of items for sale exclusive to the Marketplaces entitles you to a higher percentage of each sale - from 40% to 70%. You can still sell other items elsewhere (on other marketplaces, your own site) however any items you place on an Marketplace must be exclusively sold there.'); $this->view->bottom_text = $this->translate('You can opt-out of the exclusivity program by clicking the button below. You will be given a 30 day grace period wherein the agreement is still observed after which your payments will return to normal and you may commence selling your items elsewhere.'); $this->view->crumbs[] = array('name' => $this->view->formtitle); $this->view->author_form = $this->view->renderByModule('single_user/exclusive_author', 'users', 'themes'); break; case 'sale_license': if ($request->isPost()) { if ($request->getPost('license')) { Model_Users::editLicense(JO_Session::get('user_id'), $request->getPost('license')); JO_Session::set('msg_success', $this->translate('You have successfully changed the license types')); } else { JO_Session::set('msg_error', $this->translate('You have to choose your license')); } $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=edit&tool=sale_license')); } $this->view->formtitle = $this->translate('Sale License'); $this->view->crumbs[] = array('name' => $this->view->formtitle); $this->view->license = unserialize($this->view->user['license']); $this->view->author_form = $this->view->renderByModule('single_user/sale_license', 'users', 'themes'); break; case 'social': if ($request->issetParam('sn')) { $sn = (int) $request->getParam('sn'); unset($this->view->user['social'][$sn - 1]); $this->view->user['social'] = array_values($this->view->user['social']); Model_Users::editSocial(JO_Session::get('user_id'), $this->view->user['social']); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=social')); } if ($request->isPost()) { $socials = array(); $errors = array(); $social_links = $request->getPost('social_link'); $social_names = $request->getPost('social_name'); $cnt = count($social_links) < count($social_names) ? count($social_names) : count($social_links); for ($i = 0; $i < $cnt; $i++) { $social_names[$i] = trim($social_names[$i]); $social_links[$i] = trim($social_links[$i]); if (empty($social_names[$i]) && empty($social_links[$i])) { break; } if (empty($social_names[$i])) { $errors[$i]['social_name'] = $this->translate('You must fill the name of the social media'); } if (empty($social_links[$i])) { $errors[$i]['social_link'] = $this->translate('You must fill valid link for your profile'); } $socials[] = array('name' => $social_names[$i], 'href' => $social_links[$i]); } if (empty($errors)) { Model_Users::editSocial(JO_Session::get('user_id'), $socials); JO_Session::set('msg_success', $this->translate('You have successfully changed your social media profiles')); } else { JO_Session::set('msg_error', $errors); $this->session->set('data', $socials); } $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=social')); } if ($this->session->issetKey('data')) { $social = $this->session->get('data'); $this->session->clear('data'); if (count($social) > count($this->view->user['social'])) { $last = end($social); $this->view->new_user = $last['name']; $this->view->new_href = $last['href']; } } $this->view->formtitle = $this->translate('Social Media profiles'); $this->view->crumbs[] = array('name' => $this->view->formtitle); $this->view->author_form = $this->view->renderByModule('single_user/social', 'users', 'themes'); break; default: if ($request->isPost()) { $firstname = trim($request->getPost('firstname')); $lastname = trim($request->getPost('lastname')); $email = trim($request->getPost('email')); if (empty($firstname)) { $error['firstname'] = $this->translate('You must fill your firstname'); } if (empty($lastname)) { $error['lastname'] = $this->translate('You must fill your lastname'); } if (empty($email)) { $error['email'] = $this->translate('You must fill your email'); } elseif (!Model_Users::ValidMail($email)) { $this->view->error['email'] = $this->translate('You must fill valid email'); } if ($request->getPost('facebook') == 1) { if ($this->view->user['fb_id'] == 0) { $facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret'))); $fbData = $facebook->api('/me'); $request->setParams('fb_id', $fbData['id']); } else { $request->setParams('fb_id', $this->view->user['fb_id']); } } else { $request->setParams('fb_id', 0); } if (!count($error)) { Model_Users::editPersonal($this->view->user['user_id'], $request->getParams()); JO_Session::set('msg_success', $this->translate('Your personal data has been successfully saved')); } else { JO_Session::set('msg_error', $error); } $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit')); } $this->view->formtitle = $this->translate('Avatar and Personal Information'); $this->view->crumbs[] = array('name' => $this->view->formtitle); $model_images = new Helper_Images(); if ($this->view->user['avatar']) { $thumb = $model_images->resize($this->view->user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true); } else { $this->view->user['avatar'] = 'data/themes/images/noavatar.png'; } $this->view->upl_form_action = WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit&tool=change_avatar'); $this->view->countries = Model_Countries::getCountries(); $this->view->author_form = $this->view->renderByModule('single_user/avatar', 'users', 'themes'); } $this->view->children = array(); $this->view->children['header_part'] = 'layout/header_part'; $this->view->children['footer_part'] = 'layout/footer_part'; }
public function rightsideAction() { $request = $this->getRequest(); $model_images = new Helper_Images(); if ($request->getRequest('item_id')) { $itemID = $request->getRequest('item_id'); } elseif ($request->getRequest('comments')) { $itemID = $request->getRequest('comments'); } else { $itemID = $request->getRequest('faq'); } $item = Model_Items::get($itemID); $user = Model_Users::getUser($item['user_id']); if ($user['avatar']) { $user['avatar'] = $model_images->resize($user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true); } else { $user['avatar'] = 'data/themes/images/noavatar.png'; } if (JO_Session::get('user_id')) { if ($item['user_id'] != JO_Session::get('user_id')) { if (Model_Orders::isBuyed($item['id'], JO_Session::get('user_id'))) { $item['is_buyed'] = $this->translate('You have already bought this item. You can download it from <a href="#">here</a>, but if you like you can buy it again.'); $replace = WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads'); $item['is_buyed'] = str_replace('#', $replace, $item['is_buyed']); } } else { $item['is_buyed'] = $this->translate('This is one of your files'); } } if (JO_Session::get('user_id') && JO_Session::get('user_id') == $item['user_id']) { $this->view->owner = true; } $item['price'] = WM_Currency::format($item['price']); if ($item['extended_price']) { $item['extended_price'] = WM_Currency::format($item['extended_price']); } $item['datetime'] = JO_Date::getInstance($item['datetime'], 'd M yy')->getDate(); $this->view->attributes = Model_Items::getAttributes($item['id']); $this->view->attributes_pic = array(); if ($this->view->attributes) { foreach ($this->view->attributes as $k => $v) { if ($v['search'] == 'true') { $this->view->attributes[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=search&action=attributes/' . urlencode(mb_strtolower($v['category'], 'UTF-8')) . '/' . urlencode(mb_strtolower($v['name'], 'UTF-8'))); } if (!empty($v['photo'])) { $this->view->attributes[$k]['photo'] = 'uploads/attributes/' . $v['photo']; $this->view->attributes_pic[] = $this->view->attributes[$k]; } if (empty($v['name'])) { $this->view->attributes[$k]['name'] = $v['attribute_id']; } } } $user['homeimage'] = $model_images->resize($user['homeimage'], JO_Registry::forceGet('user_profile_photo_width'), JO_Registry::forceGet('user_profile_photo_height'), true); $user['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username'])); $comments = Model_Comments::getTotal("item_id=" . $item['id'] . ' AND reply_to = 0'); $item['comments'] = (int) $comments; $this->view->user_badges = Helper_Author::userBadges($user); if ($item['prepaid_price'] == '0.00') { $this->view->prepaid_price = false; } else { $this->view->prepaid_price = WM_Currency::format($item['prepaid_price']); } #COLLECTIONS $this->view->bookmark_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=add_to_collection'); $this->view->upload_link = WM_Router::create($request->getBaseUrl() . '?controller=collections&action=upload'); $this->view->base_url = urlencode($request->getBaseUrl()); $this->view->full_url = urlencode($request->getFullUrl()); if (JO_Session::get('user_id')) { $this->view->bookcollections = Model_Collections::getByUser(0, 0, JO_Session::get('user_id')); } $this->view->tags = array(); if (isset($item['tags'])) { foreach ($item['tags'] as $key => $tag) { if ($tag) { $this->view->tags[] = array('name' => $tag, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=tags&tag=' . $tag)); } } } if ($request->getAction() != 'comments') { $this->view->comment_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); } if ($request->getAction() == 'index') { $this->view->is_index = true; } $this->view->free_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads&item_id=' . $item['id']); $this->view->login_link = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); $user['license'] = unserialize($user['license']); $this->view->user = $user; $this->view->item = $item; }
public static function getUserImage($user, $prefix = null) { if (!$user['avatar']) { $user['avatar'] = Helper_Config::get('no_avatar'); } $sizes = self::userThumbSizes(); $format_size = false; if ($sizes) { foreach ($sizes as $val => $key) { if ($key == $prefix) { $format_size = $val; break; } } } if (!$format_size) { return false; } $user['user_id'] = $user['user_id'] ? $user['user_id'] : -1; $image_stored = self::userAvatarExist($user['user_id'], $prefix); if ($image_stored) { return $image_stored; } $model_images = new Helper_Images(); $sizes = explode('x', $format_size); $width = (int) isset($sizes[0]) ? $sizes[0] : 0; $height = (int) isset($sizes[1]) ? $sizes[1] : 0; if ($width && $height) { $img = $model_images->resize($user['avatar'], $width, $height, true); } else { if ($width && !$height) { $img = $model_images->resizeWidth($user['avatar'], $width); } else { if ($height && !$width) { $img = $model_images->resizeHeight($user['avatar'], $height); } } } if ($img) { $data = array('image' => $img, 'original' => $model_images->original($user['avatar']), 'width' => $model_images->getSizes('width'), 'height' => $model_images->getSizes('height'), 'mime' => JO_File_Ext::getMimeFromFile($img), 'size' => $prefix, 'user_id' => $user['user_id']); self::userAvatarCreate($data); return $data; } return false; }
public static function uploadEventImage1($avatar, $user_id = 0) { try { $added_date = time(); if (is_array($user_info = Model_Users::getUser($user_id))) { $added_date = $user_info['date_added']; } $date_added = WM_Date::format($added_date, 'yy-mm-dd H:i:s'); $s3 = new JO_Api_Amazon(JO_Registry::get('awsAccessKey'), JO_Registry::get('awsSecretKey')); $s3->putBucket(JO_Registry::get('bucklet'), JO_Api_Amazon::ACL_PUBLIC_READ); if ($s3->getBucketLogging(JO_Registry::get('bucklet'))) { if (($imageinfo = @getimagesize($avatar)) !== false) { $ext = strtolower(strrchr($avatar, ".")); $name = $user_id . $ext; $image_path = 'events/' . WM_Date::format($date_added, 'yy/mm/'); if (!file_exists(BASE_PATH . '/uploads/cache_events/' . $image_path) || !is_dir(BASE_PATH . '/uploads/cache_events/' . $image_path)) { @mkdir(BASE_PATH . '/uploads/cache_events/' . $image_path, 0777, true); } @copy($avatar, BASE_PATH . '/uploads/cache_events/' . $image_path . $name); if (self::uploatToServer(BASE_PATH . '/uploads/cache_events/' . $image_path . $name, $image_path . $name)) { $model_images = new Helper_Images(); $temp_width = 0; $temp_height = 0; $sizes = self::userThumbSizes(); if ($sizes) { foreach ($sizes as $size => $prefix) { $sizes = explode('x', $size); $width = (int) isset($sizes[0]) ? $sizes[0] : 0; $height = (int) isset($sizes[1]) ? $sizes[1] : 0; $name_pref = basename($name, $ext) . $prefix . $ext; if ($width && $height) { $thumb_a = $model_images->resize('/cache_events/' . $image_path . $name, $width, $height, true); } else { if ($width && !$height) { $thumb_a = $model_images->resizeWidth('/cache_events/' . $image_path . $name, $width); } else { if ($height && !$width) { $thumb_a = $model_images->resizeHeight('/cache_events/' . $image_path . $name, $height); } } } if ($prefix == '_B') { $temp_width = $model_images->getSizes('width'); $temp_height = $model_images->getSizes('height'); } $thumb_a1 = explode('/uploads/', $thumb_a); if ($thumb_a1 && isset($thumb_a1[1])) { if (!self::uploatToServer(BASE_PATH . '/uploads/' . $thumb_a1[1], $image_path . $name_pref)) { } } } } //$model_images->deleteImages('/cache_events/' . $image_path . $name); if ($temp_width) { return array('store' => 'amazons3', 'image' => $image_path . $name, 'width' => $temp_width, 'height' => $temp_height); } else { return false; } } else { return false; } } else { return false; } } } catch (JO_Exception $e) { return false; } return false; }
public static function uploadUserAvatar($image, $user_id = 0) { if (($imageinfo = getimagesize($image)) !== false) { self::init(); if (self::$error) { return false; } $added_date = time(); $username = md5($user_id); $user_info = new Model_Users_User($user_id); if ($user_info->count()) { $added_date = $user_info['date_added']; $username = $user_info['username']; } $ext = strtolower(strrchr($image, ".")); if (!$ext) { $mime_ext = explode('/', $imageinfo['mime']); if (isset($mime_ext[1])) { $ext = '.' . $mime_ext[1]; } } $name = $username . '_' . $user_id . $ext; $image_path = 'avatars/' . WM_Date::format($added_date, 'yy/mm/'); if (!file_exists(BASE_PATH . '/uploads/cache_avatars/' . $image_path) || !is_dir(BASE_PATH . '/uploads/cache_avatars/' . $image_path)) { @mkdir(BASE_PATH . '/uploads/cache_avatars/' . $image_path, 0777, true); } $user_agent = ini_get('user_agent'); ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9'); if (!@copy($image, BASE_PATH . '/uploads/cache_avatars/' . $image_path . $name)) { self::$error = self::translate('Unable to upload to the local server!'); return false; } ini_set('user_agent', $user_agent); $max_width = 0; $sizes = self::userThumbSizes(); $pin_sizes = array(); if ($sizes) { $model_images = new Helper_Images(); foreach ($sizes as $size => $prefix) { $sizes = explode('x', $size); $pin_sizes[] = array((int) isset($sizes[0]) ? $sizes[0] : 0, (int) isset($sizes[1]) ? $sizes[1] : 0, basename($name, $ext) . $prefix . $ext); $max_width = max($max_width, (int) isset($sizes[0]) ? $sizes[0] : 0); } if ($max_width) { $thumb_a = $model_images->resizeWidth('/cache_avatars/' . $image_path . $name, $max_width); $thumb_a1 = explode('/uploads/', $thumb_a); if ($thumb_a1 && isset($thumb_a1[1]) && $thumb_a1[1]) { $container = Helper_Config::get('rackspace_users_contaners'); try { $images = self::$connect->get_container($container); //$images->make_public(86400*365); //$images = self::$connect->get_container($container); //if(!$images->cdn_uri) { // self::$error = self::translate("Authentication response did not indicate CDN availability"); // return false; //} $object = $images->create_object($name); $object->load_from_filename(BASE_PATH . '/uploads/' . $thumb_a1[1]); $image_info = $images->get_object($name); if (!$image_info->name) { self::$error = self::translate('Unable to upload to the server!'); return false; } foreach ($pin_sizes as $s) { $thumb_b = ''; if ($s[0] && $s[1]) { $thumb_b = $model_images->resize('/' . $thumb_a1[1], $s[0], $s[1], true); } else { if ($s[0] && !$s[1]) { $thumb_b = $model_images->resizeWidth('/' . $thumb_a1[1], $s[0]); } else { if (!$s[0] && $s[1]) { $thumb_b = $model_images->resizeHeight('/' . $thumb_a1[1], $s[1]); } } } $thumb_b1 = explode('/uploads/', $thumb_b); if ($thumb_b1 && isset($thumb_b1[1]) && $thumb_b1[1]) { $object = $images->create_object($s[2]); $object->load_from_filename(BASE_PATH . '/uploads/' . $thumb_b1[1]); $image_info1 = $images->get_object($s[2]); if (!$image_info1->name) { self::$error = self::translate('Unable to upload to the server!'); return false; } } else { self::$error = self::translate('Unable to upload to the local server!'); return false; } } return array('store' => 'Model_Upload_Rackspace', 'image' => trim(Helper_Config::get('rackspace_users_contaners_cdn'), '/') . '/' . $image_info->name, 'width' => 0, 'height' => 0); } catch (JO_Exception $e) { self::$error = $e->getMessage(); return false; } $model_images->deleteImages('/' . $thumb_a1[1]); $model_images->deleteImages('/cache_avatars/' . $image_path . $name); return array('store' => 'Model_Upload_Amazons3', 'image' => $image_path . $name, 'width' => 0, 'height' => 0); } else { self::$error = self::translate('Unable to upload to the local server!'); return false; } } else { self::$error = self::translate('Missing images sizes!'); return false; } } else { self::$error = self::translate('Missing images sizes!'); return false; } } else { self::$error = self::translate('Image format is not valid!'); return false; } self::$error = self::translate('Unknown server error!'); return false; }
public static function returnFollowing($follower, $owner, $followers = false) { $view = JO_View::getInstance(); $model_images = new Helper_Images(); $request = JO_Request::getInstance(); $list_type = $request->getParam('list_type'); $user = Model_Users::getByUsername($follower['username']); $view->badges = self::userBadges($user); if ($user['avatar']) { $user['avatar'] = $model_images->resize($user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true); } else { $user['avatar'] = 'data/themes/images/noavatar.png'; } $user['portfolio_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'&', '-', $user['username'])); $log_user = JO_Session::get('user_id'); if ($log_user) { $following = JO_Array::multi_array_search(JO_Session::get('following'), 'follow_id', $user['user_id']); if ($following) { $user['follow_href_name'] = $view->translate('Unfollow'); $user['follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=unfollow&username='******'&', '-', $user['username'])); } elseif ($log_user != $user['user_id']) { $user['follow_href_name'] = $view->translate('Follow'); $user['follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&username='******'&', '-', $user['username'])); } } $view->user = $user; $user_items = Model_Items::getByUser($user['user_id'], 0, 3, 'rand()'); if (empty($user_items)) { $user_items = array(array('no_items' => true, 'thumbnail' => 'data/themes/images/missing-item.png', 'module' => 'themes')); } $view->user_items = array(); if ($user_items) { foreach ($user_items as $item) { if (isset($item['demo_url'])) { $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?controller=demo&href=' . $item['demo_url']); } $view->user_items[] = Helper_Items::returnViewIndex($item); } } return $view->renderByModule('single_user/following', 'users', 'themes'); }