Exemplo n.º 1
0
 public function indexAction()
 {
     $where = '';
     $category = null;
     if ($this->getRequest()->getQuery('username')) {
         $userinfo = Model_Users::getByUsername($this->getRequest()->getQuery('username'));
         if ($userinfo) {
             $where = "users.username = '******'username') . "'";
         }
     }
     if ($this->getRequest()->getQuery('category')) {
         $catinfo = Model_Categories::get($this->getRequest()->getQuery('category'));
         if ($catinfo) {
             $category = $this->getRequest()->getQuery('category');
         }
     }
     $items = Model_Items::getAll($category, 0, 20, 'id desc', $where);
     $this->view->item = array();
     if ($items) {
         $model_images = new Model_Images();
         $categories = Model_Categories::get_all();
         foreach ($items as $item) {
             $categories_string = '';
             if ($category) {
                 foreach ($item['categories'] as $cats) {
                     if (in_array($category, $cats)) {
                         foreach ($cats as $cat) {
                             if (isset($categories[$cat]['name'])) {
                                 $categories_string .= $categories_string ? ' › ' : '';
                                 $categories_string .= $categories[$cat]['name'];
                             }
                         }
                         break;
                     }
                 }
             } else {
                 $cats = array_pop($item['categories']);
                 if ($cats && is_array($cats)) {
                     foreach ($cats as $cat) {
                         if (isset($categories[$cat]['name'])) {
                             $categories_string .= $categories_string ? ' › ' : '';
                             $categories_string .= $categories[$cat]['name'];
                         }
                     }
                 }
             }
             if ((int) JO_Registry::get($item['module'] . '_items_preview_width') && (int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resize($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'), JO_Registry::forceGet($item['module'] . '_items_preview_height'), true);
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_width')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeHeight($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_height'));
             } else {
                 $item['theme_preview_thumbnail'] = false;
             }
             $this->view->item[] = array('title' => $item['name'], 'link' => WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id']), 'description' => html_entity_decode($item['description'], ENT_QUOTES, 'utf-8'), 'author' => $item['username'], 'category' => $categories_string, 'guid' => $item['id'], 'enclosure' => $item['theme_preview_thumbnail'], 'pubDate' => JO_Date::getInstance($item['datetime'], JO_Date::RSS_FULL, true)->toString());
         }
     }
     echo $this->renderScript('rss');
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $pageID = $this->getRequest()->getRequest('page_id');
     $this->view->page = Model_Pages::get($pageID);
     if ($this->view->page['sub_of'] == 0) {
         $headPage = $this->view->page;
         $subPages = Model_Pages::getSubPages($pageID);
         //		if(!$subPages) {
         //			$this->view->usersCount = Model_Users::countUsers();
         //			$this->view->itemsCount = Model_Items::countItems();
         //		}
     } else {
         $headPage = Model_Pages::get($this->view->page['sub_of']);
         $subPages = Model_Pages::getSubPages($this->view->page['sub_of']);
         $crumbs = array();
         $parentPages = Model_Pages::getPageParents($this->view->page['sub_of']);
         if ($parentPages) {
             $cnt = count($parentPages);
             for ($i = 0; $i < $cnt; $i++) {
                 $crumbs[$i + 1] = array('name' => $parentPages[$i]['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $parentPages[$i]['id'] . '&name=' . WM_Router::clearName($parentPages[$i]['name'])));
             }
         }
     }
     $this->view->crumbs = array(array('name' => $this->view->translate('Home'), 'href' => $this->getRequest()->getBaseUrl()));
     if (isset($crumbs)) {
         $this->view->crumbs += $crumbs;
     }
     if ($subPages) {
         $this->view->subPages[] = array('name' => $headPage['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $headPage['id'] . '&name=' . WM_Router::clearName($headPage['name'])), 'is_selected' => $headPage['id'] == $pageID ? true : false);
         foreach ($subPages as $page) {
             $this->view->subPages[] = array('name' => $page['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $page['id'] . '&name=' . WM_Router::clearName($page['name'])), 'is_selected' => $page['id'] == $pageID ? true : false);
         }
     }
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     $model_images = new Model_Images();
     $this->view->page['text'] = html_entity_decode($this->view->page['text'], ENT_QUOTES, 'utf-8');
     $this->view->page['text'] = $model_images->fixEditorText($this->view->page['text']);
     $this->getLayout()->meta_title = $this->view->page['meta_title'];
     $this->getLayout()->meta_description = $this->view->page['meta_description'];
     $this->getLayout()->meta_keywords = $this->view->page['meta_keywords'];
     $this->view->quiz_link = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=quiz');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Exemplo n.º 3
0
 public function displayAction()
 {
     $boobs = $this->_getParam('boobs', null);
     $kittens = $this->_getParam('kittens', null);
     $mogileKey = null;
     if ($boobs !== null) {
         $mogileKey = Model_Images::TYPE_BOOBS . '-' . $boobs;
     } else {
         if ($kittens !== null) {
             $mogileKey = Model_Images::TYPE_KITTENS . '-' . $kittens;
         }
     }
     if ($mogileKey == null) {
         throw new Exception('Invalid request');
     }
     $model = new Model_Images();
     $image = $model->getImage($mogileKey);
     $this->getResponse()->setHeader('Content-Type', 'image/jpeg');
     $this->getResponse()->setHeader('Content-Length', strlen($image));
     $this->getResponse()->setBody($image);
 }
Exemplo n.º 4
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $single_sign_on = $this->getRequest()->getPost('single_sign_on');
         $results = array();
         if (is_array($single_sign_on)) {
             foreach ($single_sign_on as $row => $value) {
                 if ($value['url'] && ($url = JO_Validate::validateHost($value['url']))) {
                     $value['url'] = str_replace('www.', '', $url);
                     $results[] = $value;
                 }
             }
         }
         Model_Settings::updateAll(array('single_sign_on' => $results, 'singlesignon' => $request->getPost('singlesignon')));
         if (file_exists(BASE_PATH . '/cache/extensions/singlesignon/')) {
             self::unlink(BASE_PATH . '/cache/extensions/singlesignon/');
         }
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/extensions/edit/?extension=singlesignon');
     }
     $this->view->dbuser = JO_Db::getDefaultAdapter()->getConfig('username');
     $image_model = new Model_Images();
     $this->view->single_sign_on = array();
     $single_sign_on = Model_Settings::getSettingsPairs(array('filter_group' => 'single_sign_on'));
     $sort_order = array();
     foreach ($single_sign_on as $row => $data) {
         $sort_order[$row] = isset($data['sort_order']) ? $data['sort_order'] : 0;
         $data['preview'] = $image_model->resize($data['site_logo'], 100, 100);
         $this->view->single_sign_on[$row] = $data;
     }
     array_multisort($sort_order, SORT_ASC, $this->view->single_sign_on);
     $this->view->preview = $image_model->resize(JO_Registry::get('no_image'), 100, 100);
     if (!$this->view->preview) {
         $this->view->preview = $image_model->resize('/no_image.png', 100, 100);
     }
     if ($request->isPost()) {
         $this->view->singlesignon_status = $request->getPost('singlesignon[singlesignon_status]');
     } else {
         $this->view->singlesignon_status = JO_Registry::get('singlesignon_status');
     }
     if ($request->isPost()) {
         $this->view->singlesignon_enable_login = $request->getPost('singlesignon[singlesignon_enable_login]');
     } else {
         $this->view->singlesignon_enable_login = JO_Registry::get('singlesignon_enable_login');
     }
     if ($request->isPost()) {
         $this->view->singlesignon_enable_dropdown = $request->getPost('singlesignon[singlesignon_enable_dropdown]');
     } else {
         $this->view->singlesignon_enable_dropdown = JO_Registry::get('singlesignon_enable_dropdown');
     }
     if ($request->isPost()) {
         $this->view->singlesignon_db_users = $request->getPost('singlesignon[singlesignon_db_users]');
     } else {
         $this->view->singlesignon_db_users = JO_Registry::get('singlesignon_db_users');
     }
 }
Exemplo n.º 5
0
 public function threads_for_userAction()
 {
     $request = $this->getRequest();
     $this->setViewChange('index');
     $username = $request->getRequest('threads_for_user');
     $username = trim(mb_strtolower(urldecode($username), 'UTF-8'));
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Forum'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum')), array('name' => $username));
     $this->view->mainCategories = array();
     $this->view->mainCategories = Model_Forum::getAll();
     foreach ($this->view->mainCategories as $k => $v) {
         $this->view->mainCategories[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=thread/' . $this->view->mainCategories[$k]['id'] . '/' . WM_Router::clearName($this->view->mainCategories[$k]['name']));
     }
     $this->view->mainCategories = array_merge(array(0 => array('name' => $this->translate('All Topics'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum'))), $this->view->mainCategories);
     $this->view->headline = $this->translate('All Topics');
     $this->view->sel_thread = -1;
     $this->view->headline = $this->translate('Threads') . ': ' . $username;
     $threads = Model_Forum::getThreadsByUser($username);
     $total_records = count($threads);
     if ($threads) {
         $model_images = new Model_Images();
         $page = (int) $request->getRequest('page', 1);
         if ($page < 1) {
             $page = 1;
         }
         $limit = JO_Registry::get('front_limit');
         if (JO_Session::get('msg_success')) {
             $this->view->msg_success = JO_Session::get('msg_success');
             JO_Session::clear('msg_success');
         }
         if (JO_Session::get('msg_error')) {
             $this->view->error = JO_Session::get('msg_error');
             $this->view->data = JO_Session::get('data');
             JO_Session::clear('msg_error');
             JO_Session::clear('data');
         }
         $total_records = count($threads);
         $start = $page * $limit - $limit;
         if ($start > $total_records) {
             $page = max(ceil($total_records / $limit), 1);
             $start = $page * $limit - $limit;
         } elseif ($start < 0) {
             $start = 0;
         }
         $threads = array_slice($threads, $start, $limit);
         foreach ($threads as $thread) {
             if ($thread['avatar']) {
                 $thread['avatar'] = $model_images->resize($thread['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
             } else {
                 $thread['avatar'] = 'data/themes/images/noavatar.png';
             }
             $thread['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username='******'owner']));
             $thread_link = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=topic/' . $thread['id'] . '/' . WM_Router::clearName($thread['name']));
             $thread['threadhref'] = $thread_link;
             $thread['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=report/' . $thread['id']);
             $thread['badges'] = Helper_Author::userBadges($thread['badges']);
             $thread['first_date'] = WM_Date::format($thread['datetime'], 'dd M yy H:i');
             $last_page = ceil($thread['cnt'] / $limit);
             if (!empty($thread['lusername'])) {
                 if ($thread['lavatar']) {
                     $thread['lavatar'] = $model_images->resize($thread['lavatar'], 50, 50, true);
                 } else {
                     $thread['lavatar'] = 'data/themes/images/small_noavatar.png';
                 }
                 $thread['lasthref'] = $thread_link . ($last_page > 1 ? '/page/' . $last_page : '');
                 $thread['lhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username='******'lusername']));
                 $thread['last_date'] = WM_Date::format($thread['last_post'], 'dd M yy H:i');
             }
             $this->view->threads[] = $thread;
         }
         $pagination = new Model_Pagination();
         $pagination->setLimit($limit);
         $pagination->setPage($page);
         $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
         $pagination->setTotal($total_records);
         $pagination->setUrl(WM_Router::create($request->getBaseUrl() . '?controller=forum&action=index&page={page}'));
         $this->view->pagination = $pagination->render();
         if (!empty($this->view->pagination)) {
             $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
         }
     }
     $this->view->children = array();
     $this->view->children['rightside'] = 'forum/rightside';
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Exemplo n.º 6
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $model_images = new Model_Images();
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     /* LAST ITEM */
     $lastItem = Model_Items::getLastItem();
     if ($lastItem) {
         $thumb = $model_images->resizeWidth($lastItem['theme_preview_thumbnail'], 200);
         $thumb_size = getimagesize($thumb);
         if ($thumb_size[1] > 161) {
             $image = new JO_GDThumb($thumb);
             $image->crop(0, 0, $thumb_size[0], 161);
             $image->save($thumb);
         }
         $this->view->lastItem = array('name' => $lastItem['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $lastItem['module'] . '&controller=items&item_id=' . $lastItem['id'] . '&name=' . $lastItem['name']), 'thumb' => $thumb);
     }
     /* FREE ITEM */
     $this->view->freeItems = '';
     $freeItems = Model_Items::getFreeFiles();
     if ($freeItems) {
         foreach ($freeItems as $fi) {
             $cats = explode(',', $fi['categories']);
             $cat_name = Helper_Items::getCategory($cats[1]);
             $thumb = $model_images->resizeWidth($fi['theme_preview_thumbnail'], JO_Registry::forceGet($fi['module'] . '_items_thumb_width'));
             $thumb_size = getimagesize($thumb);
             if ($thumb_size[1] > JO_Registry::forceGet($fi['module'] . '_items_thumb_height')) {
                 $image = new JO_GDThumb($thumb);
                 $image->crop(0, 0, $thumb_size[0], JO_Registry::forceGet($fi['module'] . '_items_thumb_height'));
                 $image->save($thumb);
             }
             $this->view->freeItems[] = array('href' => WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $fi['id'] . '&name=' . WM_Router::clearName($fi['name'])), 'thumb' => $thumb, 'cat_name' => $cat_name['name'], 'name' => $fi['name']);
         }
     }
     /* ITEMS */
     $this->view->items = array();
     $listType = $request->getParam('list_type');
     if (is_null($listType)) {
         $listType = 'recent';
     }
     $this->view->all_items = array('name' => $this->view->translate('View all items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&action=' . $listType));
     switch ($listType) {
         case 'featured':
             JO_Session::set('redirect', $request->getBaseUrl() . $request->getUri());
             $this->view->title_items = $this->view->translate('Featured Items');
             $featuredItems = Model_Items::getWeekly($request->getParam('category_filter'));
             if ($featuredItems) {
                 foreach ($featuredItems as $n => $item) {
                     if (!empty($item['demo_url'])) {
                         $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                     }
                     $this->view->items[] = Helper_Items::returnViewIndex($item);
                 }
             }
             break;
         case 'author':
             JO_Session::set('redirect', $request->getBaseUrl() . $request->getUri());
             $this->view->title_items = $this->view->translate('Featured Author');
             $this->view->author = Model_Users::getFeatUser();
             if ($this->view->author) {
                 $this->view->author['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username']);
                 $this->view->author['userhref_pf'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username']);
                 if ($this->view->author['avatar']) {
                     $this->view->author['avatar'] = $model_images->resize($this->view->author['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
                 } else {
                     $this->view->author['avatar'] = 'data/themes/images/avatar-author.png';
                 }
                 $this->view->items = array();
                 $items = Model_Items::getByUser($this->view->author['user_id'], 0, 11, false);
                 if (empty($items)) {
                     $items = array(0 => array('no_items' => true, 'thumbnail' => 'data/themes/images/missing-item.png', 'module' => 'themes'));
                 }
                 if ($items) {
                     foreach ($items as $n => $item) {
                         if (!empty($item['demo_url'])) {
                             $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                         }
                         $this->view->items[] = Helper_Items::returnViewIndex($item);
                     }
                 }
             }
             $this->view->all_items = array('name' => $this->view->translate('View portfolio'), 'href' => $this->view->author['userhref_pf']);
             break;
         default:
             /* RECENT ITEMS */
             JO_Session::set('redirect', $request->getBaseUrl());
             $this->view->title_items = $this->view->translate('Recent Items');
             $recentItems = Model_Items::getRecent($request->getParam('category_filter'));
             if ($recentItems) {
                 foreach ($recentItems as $n => $item) {
                     if (!empty($item['demo_url'])) {
                         $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                     }
                     $this->view->items[] = Helper_Items::returnViewIndex($item);
                 }
             }
             shuffle($this->view->items);
     }
     $this->view->listType = $listType;
     $this->view->recent_items = WM_Router::create($request->getBaseUrl() . '?controller=recent');
     $this->view->featured = WM_Router::create($request->getBaseUrl() . '?controller=featured');
     $this->view->featuredAuthor = WM_Router::create($request->getBaseUrl() . '?controller=author');
     /* CATEGORIES */
     $this->view->categories = Model_Categories::getMain();
     $this->view->top_categories = $this->view->categories;
     if ($this->view->categories) {
         if ($this->view->categories) {
             foreach ($this->view->categories as $k => $v) {
                 $this->view->categories[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=' . $listType . '&category_filter=' . $v['id']);
             }
         }
     }
     if ($this->view->top_categories) {
         foreach ($this->view->top_categories as $k => $v) {
             $this->view->top_categories[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . $v['name']);
         }
         shuffle($this->view->top_categories);
         $this->view->top_categories = array_slice($this->view->top_categories, 0, 4);
     }
     $this->view->all_categories = WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $listType);
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Exemplo n.º 7
0
<?php

define('APPLICATION_PATH', realpath(dirname(__FILE__)));
set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path());
if (!isset($argv[1])) {
    echo "Error: missing type\n";
}
if (!isset($argv[2])) {
    echo "Error: missing filename\n";
}
$type = $argv[1];
$filename = $argv[2];
require 'bootstrap.php';
$model = new Model_Images();
$model->addImage($type, $filename);
Exemplo n.º 8
0
 private function getPageForm()
 {
     $request = $this->getRequest();
     $page_id = $request->getQuery('id');
     $pages_module = new Model_Extensions_Topbanner();
     $this->view->page_num = $this->getRequest()->getRequest('page', 1);
     $this->view->cancle = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/extensions/edit/?extension=topbanner&page=' . $this->view->page_num;
     if ($this->error) {
         $this->view->error_warning = implode('; ', $this->error);
     }
     if ($page_id) {
         $page_info = $pages_module->get($page_id);
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($page_info)) {
         $this->view->name = $page_info['name'];
     } else {
         $this->view->name = '';
     }
     if ($request->getPost('url')) {
         $this->view->url = $request->getPost('url');
     } elseif (isset($page_info)) {
         $this->view->url = $page_info['url'];
     } else {
         $this->view->url = '';
     }
     if ($request->getPost('html')) {
         $this->view->html = $request->getPost('html');
     } elseif (isset($page_info)) {
         $this->view->html = $page_info['html'];
     } else {
         $this->view->html = '';
     }
     if ($request->getPost('background')) {
         $this->view->background = $request->getPost('background');
     } elseif (isset($page_info)) {
         $this->view->background = $page_info['background'];
     } else {
         $this->view->background = '';
     }
     if ($request->getPost('from')) {
         $this->view->from = $request->getPost('from');
     } elseif (isset($page_info)) {
         if ($page_info['from'] == '0000-00-00') {
             $this->view->from = '';
         } else {
             $this->view->from = JO_Date::getInstance($page_info['from'], 'dd.mm.yy', true)->toString();
         }
     } else {
         $this->view->from = '';
     }
     if (is_numeric($request->getPost('cookie'))) {
         $this->view->cookie = $request->getPost('cookie');
     } elseif (isset($page_info)) {
         $this->view->cookie = $page_info['cookie'];
     } else {
         $this->view->cookie = '';
     }
     if ($request->getPost('to')) {
         $this->view->to = $request->getPost('to');
     } elseif (isset($page_info)) {
         if ($page_info['to'] == '0000-00-00') {
             $this->view->to = '';
         } else {
             $this->view->to = JO_Date::getInstance($page_info['to'], 'dd.mm.yy', true)->toString();
         }
     } else {
         $this->view->to = '';
     }
     if ($request->getPost('close')) {
         $this->view->close = $request->getPost('close');
     } elseif (isset($page_info)) {
         $this->view->close = $page_info['close'];
     } else {
         $this->view->close = 'true';
     }
     if ($request->getPost('width')) {
         $this->view->width = $request->getPost('width');
     } elseif (isset($page_info)) {
         $this->view->width = $page_info['width'];
     } else {
         $this->view->width = 976;
     }
     if ($request->getPost('height')) {
         $this->view->height = $request->getPost('height');
     } elseif (isset($page_info)) {
         $this->view->height = $page_info['height'];
     } else {
         $this->view->height = 50;
     }
     /////// logo
     $image_model = new Model_Images();
     if ($request->getPost('photo')) {
         $this->view->photo = $request->getPost('photo');
     } elseif (isset($page_info)) {
         $this->view->photo = $page_info['photo'];
     } else {
         $this->view->photo = '';
     }
     if ($this->view->photo) {
         $this->view->preview = $image_model->resize($this->view->photo, 100, 100);
     } else {
         $this->view->preview = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100);
     }
     if (!$this->view->preview) {
         $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);
     }
     $this->view->preview_no_image = $image_model->resize(JO_Registry::forceGet('no_image'), 100, 100);
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
 }
Exemplo n.º 9
0
 public function indexAction()
 {
     $model = new Model_Images();
     $this->view->boobsImage = $model->getBoobsImage();
     $this->view->kittensImage = $model->getKittensImage();
 }
Exemplo n.º 10
0
<?php

define('APPLICATION_PATH', realpath(dirname(__FILE__)));
set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path());
require 'bootstrap.php';
$model = new Model_Images();
foreach ($model->getAllBoobsIDs() as $id) {
    $type = Model_Images::TYPE_BOOBS;
    $key = $type . '-' . $id;
    echo "deleting " . $key . "\n";
    try {
        $model->deleteImage($type, $id);
    } catch (Exception $e) {
        echo $e->getMessage() . "\n";
    }
}
foreach ($model->getAllKittensIDs() as $id) {
    $type = Model_Images::TYPE_KITTENS;
    $key = $type . '-' . $id;
    echo "deleting " . $key . "\n";
    try {
        $model->deleteImage($type, $id);
    } catch (Exception $e) {
        echo $e->getMessage() . "\n";
    }
}
Exemplo n.º 11
0
 public function gallery_imageAction()
 {
     $model_images = new Model_Images();
     $this->noLayout(true);
     $request = $this->getRequest();
     $item_id = $request->getPost('item_id');
     $file_name = $request->getPost('file');
     $item = Model_Items::get($item_id);
     $items_path = '/items/' . JO_Date::getInstance($item['datetime'], 'yy/mm', true) . '/' . $item_id . '/preview/';
     $fileTypes_allow = JO_Registry::get('upload_theme');
     $ext = strtolower(strrchr($file_name, '.'));
     $allow_images = array();
     if (isset($fileTypes_allow['images'])) {
         $ew = explode(',', $fileTypes_allow['images']);
         foreach ($ew as $ar) {
             $allow_images[] = '.' . strtolower($ar);
         }
     }
     $folder = realpath(BASE_PATH . '/uploads') . $items_path;
     if (file_exists($folder . $param[1]) && in_array($ext, $allow_images)) {
         $screenshots_file = $model_images->resizeWidth($items_path . $file_name, (int) JO_Registry::forceGet($item['module'] . '_items_screenshots_width') * 1.5);
     }
     die(json_encode(array('src' => $screenshots_file)));
 }
Exemplo n.º 12
0
 private function getForm()
 {
     $request = $this->getRequest();
     $url = '';
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_name')) {
         $url .= '&filter_name=' . $request->getQuery('filter_name');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username='******'filter_username');
     }
     if ($request->getQuery('filter_price')) {
         $url .= '&filter_price=' . $request->getQuery('filter_price');
     }
     if ($request->getQuery('filter_sales')) {
         $url .= '&filter_sales=' . $request->getQuery('filter_sales');
     }
     if ($request->getQuery('filter_profit')) {
         $url .= '&filter_profit=' . $request->getQuery('filter_profit');
     }
     if ($request->getQuery('filter_free_request')) {
         $url .= '&filter_free_request=' . $request->getQuery('filter_free_request');
     }
     if ($request->getQuery('filter_free_file')) {
         $url .= '&filter_free_file=' . $request->getQuery('filter_free_file');
     }
     if ($request->getQuery('filter_weekly')) {
         $url .= '&filter_weekly=' . $request->getQuery('filter_weekly');
     }
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     $id = $request->getQuery('id');
     $info = Model_Items::getItemUpdate($id);
     if (!$info) {
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url);
     }
     $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url;
     $model_images = new Model_Images();
     $info['thumbnail'] = $model_images->resize($info['thumbnail'], JO_Registry::forceGet($info['module'] . '_items_thumb_width'), JO_Registry::forceGet($info['module'] . '_items_thumb_height'), true);
     if ((int) JO_Registry::get($info['module'] . '_items_preview_width') && (int) JO_Registry::get($info['module'] . '_items_preview_height')) {
         $info['theme_preview_thumbnail'] = $model_images->resize($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'), JO_Registry::forceGet($info['module'] . '_items_preview_height'), true);
     } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_width')) {
         $info['theme_preview_thumbnail'] = $model_images->resizeWidth($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'));
     } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_height')) {
         $info['theme_preview_thumbnail'] = $model_images->resizeHeight($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_height'));
     } else {
         $info['theme_preview_thumbnail'] = false;
     }
     $this->view->info = $info;
     $this->view->price_f = WM_Currency::format($info['suggested_price']);
     $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']);
     $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true));
     $where_attr = '';
     if ($cats_module) {
         $tmp = array();
         foreach ($cats_module as $c) {
             $tmp[] = "categories LIKE '%," . $c . ",%'";
         }
         if ($tmp) {
             $where_attr = implode(' OR ', $tmp);
         }
     }
     $this->view->attributes_list = array();
     $attr_cat = Model_Attributes::getAttributes(array(), $where_attr);
     if ($attr_cat) {
         foreach ($attr_cat as $row => $attr) {
             $attr_list = Model_Attributes::getAttributes(array('filter_sub_of' => $attr['id']));
             if ($attr_list) {
                 $this->view->attributes_list[$row] = $attr;
                 $this->view->attributes_list[$row]['items'] = $attr_list;
             }
         }
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } else {
         $this->view->name = $info['name'];
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } else {
         $this->view->description = $info['description'];
     }
     if ($request->getPost('price')) {
         $this->view->price = $request->getPost('price');
     } else {
         $this->view->price = $info['price'];
     }
     if ($request->getPost('category_id')) {
         $this->view->category_id = $request->getPost('category_id');
     } else {
         $this->view->category_id = Model_Items::getItemCategory($id);
     }
     if ($request->getPost('attributes')) {
         $this->view->attributes = $request->getPost('attributes');
     } else {
         $this->view->attributes = Model_Items::getItemAttributes($id);
     }
     if ($request->getPost('tags')) {
         $this->view->tags = $request->getPost('tags');
     } else {
         //    		$this->view->tags = Model_Items::getItemTagsUpdate($id);
         $this->view->tags = Model_Items::getItemTags($id);
     }
     if ($request->getPost('free_file')) {
         $this->view->free_file = $request->getPost('free_file');
     } else {
         $this->view->free_file = $info['free_file'];
     }
     if ($request->getPost('demo_url')) {
         $this->view->demo_url = $request->getPost('demo_url');
     } else {
         $this->view->demo_url = $info['demo_url'];
     }
     if ($request->getPost('weekly_from')) {
         $this->view->weekly_from = $request->getPost('weekly_from');
     } else {
         $this->view->weekly_from = '';
     }
     if ($request->getPost('weekly_to')) {
         $this->view->weekly_to = $request->getPost('weekly_to');
     } else {
         $this->view->weekly_to = '';
     }
     if ($request->getPost('default_price')) {
         $this->view->default_price = $request->getPost('default_price');
     } else {
         $this->view->default_price = '';
     }
     /* sizes */
     $prices = Model_Items_Image::getPriceItem($id);
     $sizes = Model_Sizes::getAll();
     $this->view->sizes = array();
     if ($sizes) {
         $filesize = false;
         if ($info['main_file'] && file_exists(BASE_PATH . '/uploads/' . $info['main_file'])) {
             $info_file = getimagesize(BASE_PATH . '/uploads/' . $info['main_file']);
             $filesize = $info_file[0] * $info_file[1];
         }
         foreach ($sizes as $k => $size) {
             $price = isset($prices[$size['id']]) ? $prices[$size['id']] : '';
             if ($filesize && $size['size'] * 1000000 <= $filesize) {
                 $size['post_price'] = $request->issetPost('price[' . $size['id'] . ']') ? $request->getPost('price[' . $size['id'] . ']') : $price;
                 $size['size'] = round($size['size'], 2);
                 $this->view->sizes[$k] = $size;
                 $this->view->default_price = $this->view->default_price ? $this->view->default_price : ($size['post_price'] == $info['price'] ? $size['id'] : '');
             }
         }
         if (!$this->view->default_price) {
             foreach ($sizes as $k => $size) {
                 if ($filesize && $size['size'] * 1000000 <= $filesize) {
                     $this->view->default_price = $size['id'];
                     break;
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
 private function getForm()
 {
     $request = $this->getRequest();
     $url = '';
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_name')) {
         $url .= '&filter_name=' . $request->getQuery('filter_name');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username='******'filter_username');
     }
     if ($request->getQuery('filter_price')) {
         $url .= '&filter_price=' . $request->getQuery('filter_price');
     }
     if ($request->getQuery('filter_sales')) {
         $url .= '&filter_sales=' . $request->getQuery('filter_sales');
     }
     if ($request->getQuery('filter_profit')) {
         $url .= '&filter_profit=' . $request->getQuery('filter_profit');
     }
     if ($request->getQuery('filter_free_request')) {
         $url .= '&filter_free_request=' . $request->getQuery('filter_free_request');
     }
     if ($request->getQuery('filter_free_file')) {
         $url .= '&filter_free_file=' . $request->getQuery('filter_free_file');
     }
     if ($request->getQuery('filter_weekly')) {
         $url .= '&filter_weekly=' . $request->getQuery('filter_weekly');
     }
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     $id = $request->getQuery('id');
     $info = Model_Items::getItemUpdate($id);
     if (!$info) {
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url);
     }
     $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/queueupdateditems/?' . $url;
     if ($info['thumbnail']) {
         $model_images = new Model_Images();
         $info['thumbnail'] = $model_images->resize($info['thumbnail'], JO_Registry::forceGet($info['module'] . '_items_thumb_width'), JO_Registry::forceGet($info['module'] . '_items_thumb_height'), true);
         if ((int) JO_Registry::get($info['module'] . '_items_preview_width') && (int) JO_Registry::get($info['module'] . '_items_preview_height')) {
             $info['theme_preview_thumbnail'] = $model_images->resize($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'), JO_Registry::forceGet($info['module'] . '_items_preview_height'), true);
         } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_width')) {
             $info['theme_preview_thumbnail'] = $model_images->resizeWidth($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'));
         } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_height')) {
             $info['theme_preview_thumbnail'] = $model_images->resizeHeight($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_height'));
         } else {
             $info['theme_preview_thumbnail'] = false;
         }
     }
     $this->view->info = $info;
     $this->view->price_f = WM_Currency::format($info['suggested_price']);
     $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']);
     $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true));
     $category = Model_Categories::getParentCategoryByItem($info['id'], true);
     $category = trim($category['categories'], ',');
     $this->view->attributes_list = Model_Attributes::getAllWithCategories("attributes_categories.categories LIKE '%," . (int) $category . ",%'");
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } else {
         $this->view->name = $info['name'];
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } else {
         $this->view->description = $info['description'];
     }
     if ($request->getPost('price')) {
         $this->view->price = $request->getPost('price');
     } else {
         $this->view->price = $info['price'];
     }
     if ($request->getPost('category_id')) {
         $this->view->category_id = $request->getPost('category_id');
     } else {
         $this->view->category_id = Model_Items::getItemCategory($id);
     }
     if ($request->getPost('attributes')) {
         $this->view->attributes = $request->getPost('attributes');
     } else {
         $this->view->attributes = Model_Items::getItemAttributes($id);
     }
     if ($request->getPost('tags')) {
         $this->view->tags = $request->getPost('tags');
     } else {
         $this->view->tags = Model_Items::getItemTagsUpdate($id);
         //    		$this->view->tags = Model_Items::getItemTags($id);
     }
     if ($request->getPost('free_file')) {
         $this->view->free_file = $request->getPost('free_file');
     } else {
         $this->view->free_file = $info['free_file'];
     }
     if ($request->getPost('demo_url')) {
         $this->view->demo_url = $request->getPost('demo_url');
     } else {
         $this->view->demo_url = $info['demo_url'];
     }
     if ($request->getPost('weekly_from')) {
         $this->view->weekly_from = $request->getPost('weekly_from');
     } else {
         $this->view->weekly_from = '';
     }
     if ($request->getPost('weekly_to')) {
         $this->view->weekly_to = $request->getPost('weekly_to');
     } else {
         $this->view->weekly_to = '';
     }
 }
Exemplo n.º 14
0
 public function indexAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->getQuery('openId') && strlen($request->getQuery('openId')) == 32 && $request->getServer('HTTP_REFERER')) {
         $referer = str_replace('www.', '', JO_Validate::validateHost($request->getServer('HTTP_REFERER')));
         $domain = $request->getDomain();
         if ($referer && $referer != $domain && self::allowledReferal($referer)) {
             //check user
             if ($result = Model_Extensions_Singlesignon::checkUser($referer, $domain, $request->getQuery('openId'))) {
                 if ($result && $result['status'] == 'activate') {
                     $groups = unserialize($result['groups']);
                     if (is_array($groups) and count($groups) > 1) {
                         unset($result['groups']);
                         $fetch_all = Model_Users::getGroups($groups);
                         $result['access'] = array();
                         if ($fetch_all) {
                             foreach ($fetch_all as $row) {
                                 $modules = unserialize($row['rights']);
                                 if (is_array($modules)) {
                                     foreach ($modules as $module => $ison) {
                                         $result['access'][$module] = $module;
                                     }
                                 }
                             }
                         }
                     }
                     if (isset($result['access']) && count($result['access'])) {
                         $result['is_admin'] = true;
                     }
                     JO_Session::set($result);
                 }
             } elseif (!JO_Session::get('user_id')) {
                 $url = 'http://' . $referer . '/public/extensions_singlesignon/getUserData/?openId=' . $request->getQuery('openId') . '&referer=' . $referer . '&domain=' . $domain;
                 if (ini_get('allow_url_fopen')) {
                     $response = file_get_contents($url);
                 } elseif (function_exists('curl_init')) {
                     $response = $this->file_get_contents_curl($url);
                 }
                 if ($response) {
                     $response = JO_Json::decode(JO_Encrypt_Md5::decrypt($response, $domain), true);
                     //register user
                     if ($response && is_array($response)) {
                         if ($result = Model_Extensions_Singlesignon::createUser($response)) {
                             $groups = self::mb_unserialize($result['groups']);
                             if (is_array($groups) and count($groups) > 1) {
                                 unset($result['groups']);
                                 $fetch_all = Model_Users::getGroups($groups);
                                 $result['access'] = array();
                                 if ($fetch_all) {
                                     foreach ($fetch_all as $row) {
                                         $modules = self::mb_unserialize($row['rights']);
                                         if (is_array($modules)) {
                                             foreach ($modules as $module => $ison) {
                                                 $result['access'][$module] = $module;
                                             }
                                         }
                                     }
                                 }
                             }
                             if (isset($result['access']) && count($result['access'])) {
                                 $result['is_admin'] = true;
                             }
                             JO_Session::set($result);
                         }
                     }
                 }
             }
         }
         $this->redirect($request->getBaseUrl());
     }
     $this->view->single_sign_on = array();
     $single_sign_on = WM_Store::getSettingsPairs(array('filter_group' => 'single_sign_on'));
     $model_images = new Model_Images();
     $sort_order = array();
     foreach ($single_sign_on as $row => $data) {
         $sort_order[$row] = isset($data['sort_order']) ? $data['sort_order'] : 0;
         if ($data['site_logo'] && file_exists(BASE_PATH . '/uploads/' . $data['site_logo'])) {
             $data['preview'] = 'uploads/' . $data['site_logo'];
         } else {
             $data['preview'] = '';
         }
         $data['preview'] = $model_images->resize($data['site_logo'], 140, 30);
         $data['href'] = 'http://' . $data['url'] . '/public/';
         if (JO_Registry::get('singlesignon_enable_login') && JO_Session::get('user_id')) {
             $data['href'] .= '?openId=' . md5($request->getDomain() . $data['url'] . JO_Session::get('username') . JO_Session::get('email'));
         }
         $this->view->single_sign_on[$row] = $data;
     }
     array_multisort($sort_order, SORT_ASC, $this->view->single_sign_on);
     if (JO_Registry::get('singlesignon_enable_dropdown') && count($this->view->single_sign_on)) {
         $this->view->ext_css = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=css&setFile=css.css');
         $this->view->ext_js = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=js&setFile=js.js');
         $this->getLayout()->placeholder('singlesignon', $this->view->render('index', 'extensions_singlesignon'));
     }
 }
Exemplo n.º 15
0
 public function deleteAction()
 {
     $json = array();
     $pathp = $this->getRequest()->getPost('path');
     if ($pathp !== null) {
         $path = rtrim($this->upload_folder . str_replace('../', '', $pathp), '/');
         if (!file_exists($path)) {
             $json['error'] = $this->translate('Path not found');
         }
         if (rtrim($path, '/') == rtrim($this->upload_folder, '/')) {
             $json['error'] = $this->translate('You can not delete the base path');
         }
     } else {
         $json['error'] = $this->translate('No path is selected');
     }
     if (!isset($json['error'])) {
         if (is_file($path)) {
             $images = new Model_Images();
             $images->deleteImages($pathp);
         } elseif (is_dir($path)) {
             $this->recursiveDelete($path);
             $cache_folder = $this->upload_folder . DS . 'cache' . $pathp;
             $this->recursiveDelete($cache_folder);
         }
         $json['success'] = $this->translate('Deletion is successful');
     }
     $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);
 }
Exemplo n.º 16
0
 public function changeAction()
 {
     $request = $this->getRequest();
     $collectionID = $request->getRequest('change');
     if (!$collectionID || !is_numeric($collectionID)) {
         return $this->forward('error', 'error404');
     }
     $referer = $request->getServer('HTTP_REFERER');
     if ($collectionID) {
         $collection = Model_Collections::get($collectionID);
         if (!$collection) {
             return $this->forward('error', 'error404');
         }
         if (JO_Session::get('user_id') == $collection['user_id']) {
             if ($request->isPost()) {
                 $model_images = new Model_Images();
                 $image = $request->getFile('file_upload');
                 if ($image) {
                     $users_path = '/collections/' . date('Y/m') . '/' . $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_Collections::editImage($collection['id'], $file_path);
                             $model_images->deleteImages($collection['photo']);
                         } else {
                             JO_Session::set('msg_error', $this->translate('There was an unexpected error with uploading the file'));
                         }
                     }
                 }
                 $collection['name'] = $request->getPost('name') ? $request->getPost('name') : $this->translate('Bookmark Collection');
                 $collection['description'] = $request->getPost('description');
                 $collection['public'] = $request->getPost('publically_visible') ? 'false' : 'true';
             }
             Model_Collections::edit(array('collection_id' => $collectionID, 'name' => $collection['name'], 'description' => $collection['description'], 'publically_visible' => $collection['public'] == 'false' ? 'true' : 'false'));
             JO_Session::set('msg_success', 'You have successfully update this collection!');
         }
     }
     $this->redirect($referer);
 }
Exemplo n.º 17
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $avatar_width = $request->getParam('user_avatar_width');
         if ($avatar_width > 120) {
             $request->getParam('user_avatar_width', 120);
         }
         $avatar_height = $request->getParam('user_avatar_height');
         if ($avatar_height > 120) {
             $request->getParam('user_avatar_height', 120);
         }
         Model_Settings::updateAll($request->getParams());
         $config = $request->getPost('config');
         if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) {
             WM_Currency::updateCurrencies($config['config_currency']);
         }
         $this->session->set('successfu_edite', true);
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
     }
     $this->view->templates = $this->getTemplates();
     $this->view->modules = WM_Modules::getList(array('update', 'install', 'admin'));
     $image_setings_get = WM_Modules::getConfig();
     $image_setings = array();
     $watermark_setings = array();
     $domains_setings = array();
     foreach ($image_setings_get as $module_get => $ims) {
         $image_setings[$module_get] = isset($ims['images']) && is_array($ims['images']) ? $ims['images'] : array();
         $watermark_setings[$module_get] = isset($ims['watermark']) && is_array($ims['watermark']) ? $ims['watermark'] : array();
         $domains_setings[$module_get] = isset($ims['domain']) && is_array($ims['domain']) ? $ims['domain'] : array();
     }
     $config = $request->getPost('config');
     $images = $request->getPost('images');
     $pages = $request->getPost('pages');
     $store_config = Model_Settings::getSettingsPairs();
     $this->view->currencies = Model_Currency::getCurrencies();
     $this->view->pages = Model_Pages::getPagesFromParent(0);
     $this->view->languages = array();
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
     }
     //////////////////////////////////////// GENERAL ////////////////////////////////////////
     if (isset($config['referal_sum'])) {
         $this->view->referal_sum = $config['referal_sum'];
     } elseif (isset($store_config['referal_sum'])) {
         $this->view->referal_sum = $store_config['referal_sum'];
     } else {
         $this->view->referal_sum = 0;
     }
     if (isset($config['referal_percent'])) {
         $this->view->referal_percent = str_replace('%', '', $config['referal_percent']) . '%';
     } elseif (isset($store_config['referal_percent'])) {
         $this->view->referal_percent = str_replace('%', '', $store_config['referal_percent']) . '%';
     } else {
         $this->view->referal_percent = 0;
     }
     if (isset($config['prepaid_price_discount'])) {
         $this->view->prepaid_price_discount = $config['prepaid_price_discount'];
     } elseif (isset($store_config['prepaid_price_discount'])) {
         $this->view->prepaid_price_discount = $store_config['prepaid_price_discount'];
     } else {
         $this->view->prepaid_price_discount = 0;
     }
     if (isset($config['extended_price'])) {
         $this->view->extended_price = $config['extended_price'];
     } elseif (isset($store_config['extended_price'])) {
         $this->view->extended_price = $store_config['extended_price'];
     } else {
         $this->view->extended_price = 0;
     }
     if (isset($config['no_exclusive_author_percent'])) {
         $this->view->no_exclusive_author_percent = $config['no_exclusive_author_percent'];
     } elseif (isset($store_config['no_exclusive_author_percent'])) {
         $this->view->no_exclusive_author_percent = $store_config['no_exclusive_author_percent'];
     } else {
         $this->view->no_exclusive_author_percent = 0;
     }
     if (isset($config['exclusive_author_percent'])) {
         $this->view->exclusive_author_percent = $config['exclusive_author_percent'];
     } elseif (isset($store_config['exclusive_author_percent'])) {
         $this->view->exclusive_author_percent = $store_config['exclusive_author_percent'];
     } else {
         $this->view->exclusive_author_percent = 0;
     }
     if (isset($config['facebook_appid'])) {
         $this->view->facebook_appid = $config['facebook_appid'];
     } elseif (isset($store_config['facebook_appid'])) {
         $this->view->facebook_appid = $store_config['facebook_appid'];
     } else {
         $this->view->facebook_appid = '';
     }
     if (isset($config['facebook_secret'])) {
         $this->view->facebook_secret = $config['facebook_secret'];
     } elseif (isset($store_config['facebook_secret'])) {
         $this->view->facebook_secret = $store_config['facebook_secret'];
     } else {
         $this->view->facebook_secret = '';
     }
     if (isset($config['recaptcha_public_key'])) {
         $this->view->recaptcha_public_key = $config['recaptcha_public_key'];
     } elseif (isset($store_config['recaptcha_public_key'])) {
         $this->view->recaptcha_public_key = $store_config['recaptcha_public_key'];
     } else {
         $this->view->recaptcha_public_key = 0;
     }
     if (isset($config['recaptcha_private_key'])) {
         $this->view->recaptcha_private_key = $config['recaptcha_private_key'];
     } elseif (isset($store_config['recaptcha_private_key'])) {
         $this->view->recaptcha_private_key = $store_config['recaptcha_private_key'];
     } else {
         $this->view->recaptcha_private_key = 0;
     }
     if (isset($config['google_translate_key'])) {
         $this->view->google_translate_key = $config['google_translate_key'];
     } elseif (isset($store_config['google_translate_key'])) {
         $this->view->google_translate_key = $store_config['google_translate_key'];
     } else {
         $this->view->google_translate_key = '';
     }
     //////////////////////////////////////// SEO ////////////////////////////////////////
     if (isset($config['meta_title'])) {
         $this->view->meta_title = $config['meta_title'];
     } elseif (isset($store_config['meta_title'])) {
         $this->view->meta_title = $store_config['meta_title'];
     }
     if (isset($config['meta_keywords'])) {
         $this->view->meta_keywords = $config['meta_keywords'];
     } elseif (isset($store_config['meta_keywords'])) {
         $this->view->meta_keywords = $store_config['meta_keywords'];
     }
     if (isset($config['meta_description'])) {
         $this->view->meta_description = $config['meta_description'];
     } elseif (isset($store_config['meta_description'])) {
         $this->view->meta_description = $store_config['meta_description'];
     }
     if (isset($config['google_analytics'])) {
         $this->view->google_analytics = $config['google_analytics'];
     } elseif (isset($store_config['google_analytics'])) {
         $this->view->google_analytics = $store_config['google_analytics'];
     }
     //////////////////////////////////////// Options ////////////////////////////////////////
     if (isset($config['admin_limit'])) {
         $this->view->admin_limit = $config['admin_limit'];
     } elseif (isset($store_config['admin_limit'])) {
         $this->view->admin_limit = $store_config['admin_limit'];
     } else {
         $this->view->admin_limit = 15;
     }
     if (isset($config['front_limit'])) {
         $this->view->front_limit = $config['front_limit'];
     } elseif (isset($store_config['front_limit'])) {
         $this->view->front_limit = $store_config['front_limit'];
     } else {
         $this->view->front_limit = 10;
     }
     if (isset($config['template'])) {
         $this->view->template = $config['template'];
     } elseif (isset($store_config['template'])) {
         $this->view->template = $store_config['template'];
     }
     if (isset($config['default_module'])) {
         $this->view->default_module = $config['default_module'];
     } elseif (isset($store_config['default_module'])) {
         $this->view->default_module = $store_config['default_module'];
     }
     if (isset($config['currency_position'])) {
         $this->view->currency_position = $config['currency_position'];
     } elseif (isset($store_config['currency_position'])) {
         $this->view->currency_position = $store_config['currency_position'];
     } else {
         $this->view->currency_position = 'left';
     }
     if (isset($config['currency_decimal_places'])) {
         $this->view->currency_decimal_places = $config['currency_decimal_places'];
     } elseif (isset($store_config['currency_decimal_places'])) {
         $this->view->currency_decimal_places = $store_config['currency_decimal_places'];
     } else {
         $this->view->currency_decimal_places = 2;
     }
     if (isset($config['currency_decimal_point'])) {
         $this->view->currency_decimal_point = $config['currency_decimal_point'];
     } elseif (isset($store_config['currency_decimal_point'])) {
         $this->view->currency_decimal_point = $store_config['currency_decimal_point'];
     } else {
         $this->view->currency_decimal_point = '.';
     }
     if (isset($config['currency_thousand_point'])) {
         $this->view->currency_thousand_point = $config['currency_thousand_point'];
     } elseif (isset($store_config['currency_thousand_point'])) {
         $this->view->currency_thousand_point = $store_config['currency_thousand_point'];
     } else {
         $this->view->currency_thousand_point = ',';
     }
     if (isset($config['config_language_id'])) {
         $this->view->config_language_id = $config['config_language_id'];
     } elseif (isset($store_config['config_language_id'])) {
         $this->view->config_language_id = $store_config['config_language_id'];
     }
     //////////////////////////////////////// Contacts ////////////////////////////////////////
     if (isset($config['admin_mail'])) {
         $this->view->admin_mail = $config['admin_mail'];
     } elseif (isset($store_config['admin_mail'])) {
         $this->view->admin_mail = $store_config['admin_mail'];
     }
     if (isset($config['report_mail'])) {
         $this->view->report_mail = $config['report_mail'];
     } elseif (isset($store_config['report_mail'])) {
         $this->view->report_mail = $store_config['report_mail'];
     }
     if (isset($config['mail_smtp'])) {
         $this->view->mail_smtp = $config['mail_smtp'];
     } elseif (isset($store_config['mail_smtp'])) {
         $this->view->mail_smtp = $store_config['mail_smtp'];
     } else {
         $this->view->mail_smtp = 0;
     }
     if (isset($config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $config['mail_smtp_host'];
     } elseif (isset($store_config['mail_smtp_host'])) {
         $this->view->mail_smtp_host = $store_config['mail_smtp_host'];
     }
     if (isset($config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $config['mail_smtp_port'];
     } elseif (isset($store_config['mail_smtp_port'])) {
         $this->view->mail_smtp_port = $store_config['mail_smtp_port'];
     }
     if (isset($config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $config['mail_smtp_user'];
     } elseif (isset($store_config['mail_smtp_user'])) {
         $this->view->mail_smtp_user = $store_config['mail_smtp_user'];
     }
     if (isset($config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $config['mail_smtp_password'];
     } elseif (isset($store_config['mail_smtp_password'])) {
         $this->view->mail_smtp_password = $store_config['mail_smtp_password'];
     }
     //////////////////////////////////////// Images ////////////////////////////////////////
     /////// logo
     $image_model = new Model_Images();
     if (isset($images['site_logo']) && $images['site_logo']) {
         $this->view->site_logo = $images['site_logo'];
     } elseif (isset($store_config['site_logo']) && $store_config['site_logo']) {
         $this->view->site_logo = $store_config['site_logo'];
     } else {
         $this->view->site_logo = '';
     }
     if ($this->view->site_logo) {
         $this->view->preview_logo = $image_model->resize($this->view->site_logo, 100, 100);
     } else {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     if (!$this->view->preview_logo) {
         $this->view->preview_logo = $image_model->resize('/logo.png', 100, 100);
     }
     ////// no image
     if (isset($images['no_image']) && $images['no_image']) {
         $this->view->no_image = $images['no_image'];
     } elseif (isset($store_config['no_image']) && $store_config['no_image']) {
         $this->view->no_image = $store_config['no_image'];
     } else {
         $this->view->no_image = '/no_image.png';
     }
     if ($this->view->no_image) {
         $this->view->preview_no_image = $image_model->resize($this->view->no_image, 100, 100);
     } else {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     if (!$this->view->preview_no_image) {
         $this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     }
     $this->view->preview = $image_model->resize('/logo.png', 100, 100);
     //    	$this->view->preview_no_image = $image_model->resize('/no_image.png', 100, 100);
     /////items
     $this->view->generate_item_image_form = array();
     foreach ($image_setings as $mod => $data) {
         foreach ($data as $imagetype => $value) {
             $this->view->generate_item_image_form[$mod][] = array('name' => $value['name'], 'info' => isset($value['info']) ? $value['info'] : '', 'key_width' => $mod . '_items_' . $imagetype . '_width', 'key_height' => $mod . '_items_' . $imagetype . '_height');
             if (isset($config[$mod . '_items_' . $imagetype . '_width'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = $config[$mod . '_items_' . $imagetype . '_width'];
             } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_width'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = $store_config[$mod . '_items_' . $imagetype . '_width'];
             } else {
                 $this->view->{$mod . '_items_' . $imagetype . '_width'} = isset($value['width']) ? $value['width'] : '';
             }
             if (isset($config[$mod . '_items_' . $imagetype . '_height'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = $config[$mod . '_items_' . $imagetype . '_height'];
             } elseif (isset($store_config[$mod . '_items_' . $imagetype . '_height'])) {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = $store_config[$mod . '_items_' . $imagetype . '_height'];
             } else {
                 $this->view->{$mod . '_items_' . $imagetype . '_height'} = isset($value['height']) ? $value['height'] : '';
             }
         }
     }
     //// watermark
     $this->view->generate_watermark_form = array();
     foreach ($watermark_setings as $mod => $data) {
         foreach ($data as $imagetype => $value) {
             $this->view->generate_watermark_form[$mod] = array('name' => $value['name'], 'info' => $value['info'], 'key' => $mod . '_watermark_' . $imagetype);
             if (isset($images[$mod . '_watermark_' . $imagetype]) && $images[$mod . '_watermark_' . $imagetype]) {
                 $this->view->{$mod . '_watermark_' . $imagetype} = $images[$mod . '_watermark_' . $imagetype];
             } elseif (isset($store_config[$mod . '_watermark_' . $imagetype]) && $store_config[$mod . '_watermark_' . $imagetype]) {
                 $this->view->{$mod . '_watermark_' . $imagetype} = $store_config[$mod . '_watermark_' . $imagetype];
             } else {
                 if (file_exists(BASE_PATH . '/uploads' . $value['image'])) {
                     $this->view->{$mod . '_watermark_' . $imagetype} = $value['image'];
                 } else {
                     $this->view->{$mod . '_watermark_' . $imagetype} = '';
                 }
             }
             if ($this->view->{$mod . '_watermark_' . $imagetype}) {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->{$mod . '_watermark_' . $imagetype}, 100, 100);
             } else {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100);
             }
             if (!$this->view->{'preview_' . $mod . '_watermark_' . $imagetype}) {
                 $this->view->{'preview_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($this->view->no_image, 100, 100);
             }
             $this->view->{'default_' . $mod . '_watermark_' . $imagetype} = $image_model->resize($value['image'], 100, 100);
         }
     }
     ////////////////user
     if (isset($config['user_avatar_width'])) {
         $this->view->user_avatar_width = $config['user_avatar_width'];
     } elseif (isset($store_config['user_avatar_width'])) {
         $this->view->user_avatar_width = $store_config['user_avatar_width'];
     } else {
         $this->view->user_avatar_width = 80;
     }
     if (isset($config['user_avatar_height'])) {
         $this->view->user_avatar_height = $config['user_avatar_height'];
     } elseif (isset($store_config['user_avatar_height'])) {
         $this->view->user_avatar_height = $store_config['user_avatar_height'];
     } else {
         $this->view->user_avatar_height = 80;
     }
     if (isset($config['user_avatar2_width'])) {
         $this->view->user_avatar2_width = $config['user_avatar2_width'];
     } elseif (isset($store_config['user_avatar2_width'])) {
         $this->view->user_avatar2_width = $store_config['user_avatar2_width'];
     } else {
         $this->view->user_avatar2_width = 40;
     }
     if (isset($config['user_avatar2_height'])) {
         $this->view->user_avatar2_height = $config['user_avatar2_height'];
     } elseif (isset($store_config['user_avatar2_height'])) {
         $this->view->user_avatar2_height = $store_config['user_avatar2_height'];
     } else {
         $this->view->user_avatar2_height = 40;
     }
     if (isset($config['user_profile_photo_width'])) {
         $this->view->user_profile_photo_width = $config['user_profile_photo_width'];
     } elseif (isset($store_config['user_profile_photo_width'])) {
         $this->view->user_profile_photo_width = $store_config['user_profile_photo_width'];
     } else {
         $this->view->user_profile_photo_width = 590;
     }
     if (isset($config['user_profile_photo_height'])) {
         $this->view->user_profile_photo_height = $config['user_profile_photo_height'];
     } elseif (isset($store_config['user_profile_photo_height'])) {
         $this->view->user_profile_photo_height = $store_config['user_profile_photo_height'];
     } else {
         $this->view->user_profile_photo_height = 242;
     }
     if (isset($config['user_public_collection_width'])) {
         $this->view->user_public_collection_width = $config['user_public_collection_width'];
     } elseif (isset($store_config['user_public_collection_width'])) {
         $this->view->user_public_collection_width = $store_config['user_public_collection_width'];
     } else {
         $this->view->user_public_collection_width = 260;
     }
     if (isset($config['user_public_collection_height'])) {
         $this->view->user_public_collection_height = $config['user_public_collection_height'];
     } elseif (isset($store_config['user_public_collection_height'])) {
         $this->view->user_public_collection_height = $store_config['user_public_collection_height'];
     } else {
         $this->view->user_public_collection_height = 140;
     }
     //////////////////////////////////////// PAGES ////////////////////////////////////////
     if (isset($pages['page_about'])) {
         $this->view->page_about = $pages['page_about'];
     } elseif (isset($store_config['page_about'])) {
         $this->view->page_about = $store_config['page_about'];
     } else {
         $this->view->page_about = 0;
     }
     if (isset($pages['page_upload_item'])) {
         $this->view->page_upload_item = $pages['page_upload_item'];
     } elseif (isset($store_config['page_upload_item'])) {
         $this->view->page_upload_item = $store_config['page_upload_item'];
     } else {
         $this->view->page_upload_item = 0;
     }
     if (isset($pages['page_terms'])) {
         $this->view->page_terms = $pages['page_terms'];
     } elseif (isset($store_config['page_terms'])) {
         $this->view->page_terms = $store_config['page_terms'];
     } else {
         $this->view->page_terms = 0;
     }
     if (isset($pages['page_regular_licence'])) {
         $this->view->page_regular_licence = $pages['page_regular_licence'];
     } elseif (isset($store_config['page_regular_licence'])) {
         $this->view->page_regular_licence = $store_config['page_regular_licence'];
     } else {
         $this->view->page_regular_licence = 0;
     }
     if (isset($pages['page_forum_rules'])) {
         $this->view->page_forum_rules = $pages['page_forum_rules'];
     } elseif (isset($store_config['page_forum_rules'])) {
         $this->view->page_forum_rules = $store_config['page_forum_rules'];
     } else {
         $this->view->page_forum_rules = 0;
     }
     if (isset($pages['page_affiliate_program'])) {
         $this->view->page_affiliate_program = $pages['page_affiliate_program'];
     } elseif (isset($store_config['page_affiliate_program'])) {
         $this->view->page_affiliate_program = $store_config['page_affiliate_program'];
     } else {
         $this->view->page_affiliate_program = 0;
     }
     /////////////////////////////// CURRENCY ///////////////////////
     $this->view->currencies = array();
     $currencies = Model_Currency::getCurrencies(array('status' => 1));
     //WM_Currency::getCurrencies();
     if ($currencies) {
         $this->view->currencies = $currencies;
     }
     if (isset($config['config_currency'])) {
         $this->view->config_currency = $config['config_currency'];
     } elseif (isset($store_config['config_currency'])) {
         $this->view->config_currency = $store_config['config_currency'];
     }
     if (isset($config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $config['config_currency_auto_update'];
     } elseif (isset($store_config['config_currency_auto_update'])) {
         $this->view->config_currency_auto_update = $store_config['config_currency_auto_update'];
     } else {
         $this->view->config_currency_auto_update = 1;
     }
     /////////////////////////////// DOMAINS ///////////////////////
     $this->view->show_domain_tab = count($domains_setings) > 1;
     $this->view->generate_domains_setings_form = array();
     foreach ($domains_setings as $mod => $data) {
         $this->view->generate_domains_setings_form[$mod] = array('key' => $mod);
         if (isset($config['default_domain'][$mod])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $config['default_domain'][$mod];
         } elseif (isset($store_config['default_domain'][$mod])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $store_config['default_domain'][$mod];
         } elseif (isset($data['default'])) {
             $this->view->generate_domains_setings_form[$mod]['value'] = $data['default'];
         } else {
             $this->view->generate_domains_setings_form[$mod]['value'] = '';
         }
     }
     $this->view->show_domain_tab = false;
 }
Exemplo n.º 18
0
Arquivo: Audio.php Projeto: noikiy/PD
 public static function unlink($dir, $deleteRootToo = true)
 {
     $dir = rtrim($dir, '/');
     if (!($dh = @opendir($dir))) {
         return;
     }
     $model_images = new Model_Images();
     while (false !== ($obj = readdir($dh))) {
         if ($obj == '.' || $obj == '..') {
             continue;
         }
         if (!@unlink($dir . '/' . $obj)) {
             if (is_file($dir . '/' . $obj)) {
                 $model_images->deleteImages($dir . '/' . $obj, true);
             }
             self::unlink($dir . '/' . $obj, true);
         }
     }
     closedir($dh);
     if ($deleteRootToo) {
         @rmdir($dir);
     }
     return;
 }
Exemplo n.º 19
0
 public function dashboardAction()
 {
     $request = $this->getRequest();
     $model_images = new Model_Images();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to view your dashboard'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $this->getLayout()->meta_title = $this->translate('Dashboard');
     $this->getLayout()->meta_description = $this->translate('Dashboard');
     $page = (int) $request->getRequest('page', 1);
     if ($page < 1) {
         $page = 1;
     }
     $limit = JO_Registry::get('front_limit');
     if (JO_Session::get('msg_success')) {
         $this->view->msg_success = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     }
     if (JO_Session::get('msg_error')) {
         $this->view->msg_error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $username = JO_Session::get('username');
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $username, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'name' => $this->translate('Dashboard')));
     $user = Model_Users::getByUsername($username);
     $this->view->author_header = Helper_Author::authorHeader($user);
     $where = "`items_comments`.`user_id` = '" . $user['user_id'] . "' AND `items_comments`.`reply_to` = 0";
     $total_records = Model_Comments::getTotal($where);
     $start = $page * $limit - $limit;
     if ($start > $total_records) {
         $page = max(ceil($total_records / $limit), 1);
         $start = $page * $limit - $limit;
     } elseif ($start < 0) {
         $start = 0;
     }
     $bayers = Model_Orders::getClients($user['user_id']);
     $comments = Model_Comments::getAll($start, $limit, $where, true, "datetime DESC");
     $this->view->comments = array();
     if ($comments) {
         $bbcode_parser = new WM_BBCode_Parser();
         $bbcode_parser->loadDefaultCodes();
         foreach ($comments as $comment) {
             if ($comment['avatar']) {
                 $comment['avatar'] = $model_images->resize($comment['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
             } else {
                 $comment['avatar'] = 'data/themes/images/noavatar.png';
             }
             $bbcode_parser->parse($comment['comment']);
             $comment['comment'] = Model_Comments::replaceEmoticons($bbcode_parser->getAsHtml());
             $comment['datetime'] = WM_Date::format($comment['datetime'], 'dd M yy');
             $comment['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username='******'username']));
             $comment['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=report/' . $comment['id']);
             $comment['replyhref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=reply&c_id=' . $comment['id']);
             $comment['item_href'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $comment['item_id'] . '&name=' . WM_Router::clearName($comment['name'])) . '#c_' . $comment['id'];
             foreach ($comment['reply'] as $key => $reply) {
                 if ($comment['reply'][$key]['avatar']) {
                     $comment['reply'][$key]['avatar'] = $model_images->resize($comment['reply'][$key]['avatar'], 50, 50, true);
                 } else {
                     $comment['reply'][$key]['avatar'] = 'data/themes/images/small_noavatar.png';
                 }
                 $bbcode_parser->parse($comment['reply'][$key]['comment']);
                 $comment['reply'][$key]['comment'] = Model_Comments::replaceEmoticons($bbcode_parser->getAsHtml());
                 $comment['reply'][$key]['datetime'] = WM_Date::format($reply['datetime'], 'dd M yy');
                 $comment['reply'][$key]['is_buy'] = $bayers && in_array($reply['user_id'], $bayers);
                 $comment['reply'][$key]['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username='******'reply'][$key]['username']));
                 $comment['reply'][$key]['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=report/' . $comment['reply'][$key]['id']);
             }
             $this->view->comments[] = $comment;
         }
     }
     $pagination = new Model_Pagination();
     $pagination->setLimit($limit);
     $pagination->setPage($page);
     $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
     $pagination->setTotal($total_records);
     $pagination->setUrl(WM_Router::create($request->getBaseUrl() . '?action=users&action=dashboard&page={page}'));
     $this->view->pagination = $pagination->render();
     if (!empty($this->view->pagination)) {
         $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
     }
     //$this->view->add_comment_link = WM_Router::create($request->getBaseUrl() .'?controller=items&action=add_comment&item_id='. $item['id'] .'&name='. WM_Router::clearName($item['name']));
     $this->view->mainCategories = array();
     $categories = Model_Categories::getMain();
     if ($categories) {
         $this->view->mainCategories = array(array('href' => '', 'name' => $this->translate('Please select category')));
         foreach ($categories as $category) {
             $this->view->mainCategories[] = array('href' => WM_Router::create($request->getBaseUrl() . '?controller=upload&action=form&category_id=' . $category['id']), 'name' => $category['name']);
         }
     }
     $this->view->total_balance = WM_Currency::format($user['total']);
     $this->view->total_sales_cnt = JO_Session::get('sales');
     $this->view->percent = Model_Percentes::getPercentRow($user);
     $help = Model_Pages::get(JO_Registry::forceGet('page_upload_item'));
     if ($help) {
         $this->view->page_upload_item = array('name' => $help['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id'] . '&name=' . WM_Router::clearName($help['name'])));
     }
     $weekStats = Model_Orders::getWeekStats($user['user_id']);
     $this->view->weekStats_earning = WM_Currency::format($weekStats['earning']);
     $this->view->weekStats_sold = $weekStats['sold'];
     $user['total'] = WM_Currency::format($user['total']);
     $this->view->user = $user;
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
Exemplo n.º 20
0
 private function getForm()
 {
     $request = $this->getRequest();
     $url = '';
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_name')) {
         $url .= '&filter_name=' . $request->getQuery('filter_name');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username='******'filter_username');
     }
     if ($request->getQuery('filter_user_id')) {
         $url .= '&filter_user_id=' . $request->getQuery('filter_user_id');
     }
     if ($request->getQuery('filter_price')) {
         $url .= '&filter_price=' . $request->getQuery('filter_price');
     }
     if ($request->getQuery('filter_sales')) {
         $url .= '&filter_sales=' . $request->getQuery('filter_sales');
     }
     if ($request->getQuery('filter_profit')) {
         $url .= '&filter_profit=' . $request->getQuery('filter_profit');
     }
     if ($request->getQuery('filter_free_request')) {
         $url .= '&filter_free_request=' . $request->getQuery('filter_free_request');
     }
     if ($request->getQuery('filter_free_file')) {
         $url .= '&filter_free_file=' . $request->getQuery('filter_free_file');
     }
     if ($request->getQuery('filter_weekly')) {
         $url .= '&filter_weekly=' . $request->getQuery('filter_weekly');
     }
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     $id = $request->getQuery('id');
     $info = Model_Items::getItem($id);
     if (!$info) {
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/items/?' . $url);
     }
     $this->view->cancel = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/items/?' . $url;
     $model_images = new Model_Images();
     $info['thumbnail'] = $model_images->resize($info['thumbnail'], JO_Registry::forceGet($info['module'] . '_items_thumb_width'), JO_Registry::forceGet($info['module'] . '_items_thumb_height'), true);
     if ((int) JO_Registry::get($info['module'] . '_items_preview_width') && (int) JO_Registry::get($info['module'] . '_items_preview_height')) {
         $info['theme_preview_thumbnail'] = $model_images->resize($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'), JO_Registry::forceGet($info['module'] . '_items_preview_height'), true);
     } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_width')) {
         $info['theme_preview_thumbnail'] = $model_images->resizeWidth($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_width'));
     } elseif ((int) JO_Registry::get($info['module'] . '_items_preview_height')) {
         $info['theme_preview_thumbnail'] = $model_images->resizeHeight($info['theme_preview_thumbnail'], JO_Registry::forceGet($info['module'] . '_items_preview_height'));
     } else {
         $info['theme_preview_thumbnail'] = false;
     }
     $this->view->info = $info;
     $this->view->price_f = WM_Currency::format($info['suggested_price']);
     $this->view->categories = Model_Categories::getCategoriesFromParentByModule(0, $info['module']);
     $cats_module = Model_Categories::getCategories(array('filter_sub_of' => 0, 'filter_module' => $info['module'], 'filter_concat' => true));
     $where_attr = '';
     if ($cats_module) {
         $tmp = array();
         foreach ($cats_module as $c) {
             $tmp[] = "categories LIKE '%," . $c . ",%'";
         }
         if ($tmp) {
             $where_attr = implode(' OR ', $tmp);
         }
     }
     $this->view->attributes_list = array();
     $attr_cat = Model_Attributes::getAttributes(array(), $where_attr);
     if ($attr_cat) {
         foreach ($attr_cat as $row => $attr) {
             $attr_list = Model_Attributes::getAttributes(array('filter_sub_of' => $attr['id']));
             if ($attr_list) {
                 $this->view->attributes_list[$row] = $attr;
                 $this->view->attributes_list[$row]['items'] = $attr_list;
             }
         }
     }
     //var_dump($this->view->attributes_list);
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } else {
         $this->view->name = $info['name'];
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } else {
         $this->view->description = $info['description'];
     }
     if ($request->getPost('price')) {
         $this->view->price = $request->getPost('price');
     } else {
         $this->view->price = $info['price'];
     }
     if ($request->getPost('category_id')) {
         $this->view->category_id = $request->getPost('category_id');
     } else {
         $this->view->category_id = Model_Items::getItemCategory($id);
     }
     if ($request->getPost('attributes')) {
         $this->view->attributes = $request->getPost('attributes');
     } else {
         $this->view->attributes = Model_Items::getItemAttributes($id);
     }
     if ($request->getPost('tags')) {
         $this->view->tags = $request->getPost('tags');
     } else {
         $this->view->tags = Model_Items::getItemTags($id);
     }
     if ($request->getPost('free_file')) {
         $this->view->free_file = $request->getPost('free_file');
     } else {
         $this->view->free_file = $info['free_file'];
     }
     if ($request->getPost('demo_url')) {
         $this->view->demo_url = $request->getPost('demo_url');
     } else {
         $this->view->demo_url = $info['demo_url'];
     }
     if ($request->getPost('weekly_from')) {
         $this->view->weekly_from = $request->getPost('weekly_from');
     } else {
         if ($info['weekly_from'] != '0000-00-00') {
             $this->view->weekly_from = JO_Date::getInstance($info['weekly_from'], 'dd.mm.yy', true)->toString();
         } else {
             $this->view->weekly_from = '';
         }
     }
     if ($request->getPost('weekly_to')) {
         $this->view->weekly_to = $request->getPost('weekly_to');
     } else {
         if ($info['weekly_to'] != '0000-00-00') {
             $this->view->weekly_to = JO_Date::getInstance($info['weekly_to'], 'dd.mm.yy', true)->toString();
         } else {
             $this->view->weekly_to = '';
         }
     }
 }
Exemplo n.º 21
0
 private function getForm()
 {
     $request = $this->getRequest();
     $user_id = $request->getQuery('id');
     $url = '';
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username='******'filter_username');
     }
     if ($request->getQuery('filter_total')) {
         $url .= '&filter_total=' . $request->getQuery('filter_total');
     }
     if ($request->getQuery('filter_sales')) {
         $url .= '&filter_sales=' . $request->getQuery('filter_sales');
     }
     if ($request->getQuery('filter_sold')) {
         $url .= '&filter_sold=' . $request->getQuery('filter_sold');
     }
     if ($request->getQuery('filter_web_profit2')) {
         $url .= '&filter_web_profit2=' . $request->getQuery('filter_web_profit2');
     }
     if ($request->getQuery('filter_commission')) {
         $url .= '&filter_commission=' . $request->getQuery('filter_commission');
     }
     if ($request->getQuery('filter_items')) {
         $url .= '&filter_items=' . $request->getQuery('filter_items');
     }
     if ($request->getQuery('filter_referals')) {
         $url .= '&filter_referals=' . $request->getQuery('filter_referals');
     }
     if ($request->getQuery('filter_referal_money')) {
         $url .= '&filter_referal_money=' . $request->getQuery('filter_referal_money');
     }
     if ($request->getQuery('filter_featured_author')) {
         $url .= '&filter_featured_author=' . $request->getQuery('filter_featured_author');
     }
     $this->view->cancel_href = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/?' . $url;
     $model_users = new Model_Users();
     if ($user_id) {
         $user_info = $model_users->getUser($user_id);
     }
     if (isset($user_info)) {
         $this->view->user_id = $user_id;
         $this->view->username = $user_info['username'];
         $this->view->names = $user_info['firstname'] . ' ' . $user_info['lastname'];
         $this->view->email = $user_info['email'];
         $this->view->exclusive_author = $user_info['exclusive_author'];
         $model_images = new Model_Images();
         $this->view->avatar = $model_images->resize($user_info['avatar'], 80, 80, true);
         $this->view->profile_title = $user_info['profile_title'];
         $this->view->profile_desc = $user_info['profile_desc'];
         $this->view->country_id = $user_info['country_id'];
         $this->view->author_status = $user_info['author_status'];
         $this->view->author_status_description = $user_info['author_status_description'];
         $country_info = Model_Countries::getCountry($user_info['country_id']);
         if ($country_info) {
             $this->view->country = $country_info['name'];
         }
         $this->view->live_city = $user_info['live_city'];
         $register_datetime = new JO_Date($user_info['register_datetime'], 'dd MM yy');
         $this->view->register_datetime = $register_datetime->toString();
         $last_login_datetime = new JO_Date($user_info['last_login_datetime'], 'dd MM yy');
         $this->view->last_login_datetime = $last_login_datetime->toString();
         $other = Model_Users::getStatistic($user_id);
         $this->view->deposit = WM_Currency::format($other['deposit']);
         $this->view->total = WM_Currency::format($other['total']);
         $this->view->items = array();
         foreach ($other['items'] as $item) {
             $datetime = new JO_Date($item['datetime'], 'dd MM yy');
             $this->view->items[] = array('id' => $item['item_id'], 'item_name' => $item['item_name'], 'price' => WM_Currency::format($item['price']), 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['item_id']), 'datetime' => $datetime->toString());
         }
     }
     if ($request->getPost('commission_percent')) {
         $this->view->commission_percent = $request->getPost('commission_percent');
     } elseif (isset($user_info)) {
         $this->view->commission_percent = $user_info['commission_percent'];
     }
     if ($request->getPost('featured_author')) {
         $this->view->featured_author = $request->getPost('featured_author');
     } elseif (isset($user_info)) {
         $this->view->featured_author = $user_info['featured_author'];
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($user_info)) {
         $this->view->status = $user_info['status'];
     }
     if ($request->getPost('groups')) {
         $this->view->groups = $request->getPost('groups');
     } elseif (isset($user_info)) {
         $this->view->groups = (array) unserialize($user_info['groups']);
     } else {
         $this->view->groups = array();
     }
     if ($request->getPost('badges')) {
         $this->view->badges = $request->getPost('badges');
     } elseif (isset($user_info)) {
         $this->view->badges = explode(',', $user_info['badges']);
     } else {
         $this->view->badges = array();
     }
     $this->view->groups_list = Model_Usergroups::getGroups();
     $this->view->badges_list = Model_Badges::getBadges(array('filter_type' => 'other'));
 }