예제 #1
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->currency = Model_Currency::getCurrencies();
     $this->view->default_currency = WM_Currency::getCurrencyCode();
 }
예제 #2
0
파일: Static.php 프로젝트: noikiy/amatteur
 public function __construct($options = array())
 {
     parent::__construct($options);
     $cache_host = str_replace('www.', '', JO_Request::getInstance()->getServer('HTTP_HOST'));
     $request_path = trim(JO_Request::getInstance()->getFullUri(), ' /');
     $request_path = str_replace(array('?', '&', ' '), '/', $request_path);
     $request_path = date('Y-m-d') . '/' . JO_Request::getInstance()->getController() . '/' . $request_path;
     $request_path = preg_replace('/([\\/]{2,})/', '/', $request_path);
     $request_path = trim($request_path, '/');
     $request_path = self::fixEncoding($request_path);
     //		var_dump($request_path); exit;
     if (strpos($request_path, '/') !== false) {
         $path = dirname($request_path) . '/';
         $tmp = explode('/', $request_path);
         $name = $this->clearString(end($tmp));
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     } else {
         $path = '';
         $name = $this->clearString(trim($request_path) ? $request_path : 'home');
         $name = $name == 'index' ? $name . '.' . mt_rand(00, 5) : $name;
         $this->cache_name = $name . '.cache';
     }
     $folder = '';
     if (class_exists('WM_Currency')) {
         $folder = '/' . WM_Currency::getCurrencyCode();
     }
     //		$cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . JO_Locale::findLocale() . $folder . '/' . $path;
     $cache_folder = BASE_PATH . '/cache/' . $cache_host . '/' . $path;
     if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
         if (!file_exists($cache_folder) || !is_dir($cache_folder)) {
             if (@mkdir($cache_folder, 0777, true)) {
                 $this->is_writable = true;
             }
         } else {
             $this->is_writable = true;
         }
     } elseif (is_writable($cache_folder)) {
         $this->is_writable = true;
     }
     $this->cache_dir = $cache_folder;
     $this->cache_path = BASE_PATH . '/cache/' . $cache_host . '/';
     $this->ignore_cache[] = 'vieworder';
     $this->ignore_cache[] = 'prices';
     $this->ignore_cache[] = 'cron';
     $this->ignore_cache[] = 'bulidUrl';
     $this->ignore_cache[] = 'latest_view';
     if (in_array(JO_Request::getInstance()->getController(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
     if (in_array(JO_Request::getInstance()->getAction(), $this->ignore_cache)) {
         $this->is_writable = false;
     }
 }
예제 #3
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $default_currency = WM_Currency::getCurrencyCode();
     $this->view->currency = array();
     $currencies = Model_Currency::getCurrencies();
     if ($currencies) {
         foreach ($currencies as $currency) {
             $currency['is_set'] = $default_currency == $currency['code'];
             $currency['format'] = WM_Currency::format(1, $currency['code'], 1);
             $this->view->currency[] = $currency;
         }
     }
     $this->view->default_currency = WM_Currency::getCurrencyCode();
 }
예제 #4
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $update_for = 'themes';
     $db = JO_Db::getDefaultAdapter();
     $this->view->msg_error = array();
     $this->view->msg_success = array();
     //begin updater
     $old_sys_config = BASE_PATH . '/old_sys/data/uploads/language/config.php';
     if (!file_exists($old_sys_config)) {
         $this->view->msg_error['old_sys'] = 'Please move the "data" folder of your old system into folder: <strong>' . BASE_PATH . '/old_sys/</strong>';
     }
     if (!$this->view->msg_error && $request->isPost()) {
         self::unlink(BASE_PATH . '/uploads/items/', true);
         self::unlink(BASE_PATH . '/uploads/attributes/', true);
         self::unlink(BASE_PATH . '/uploads/cache/', true);
         self::unlink(BASE_PATH . '/uploads/countries/', true);
         $db_queries = array();
         include_once $old_sys_config;
         $old_config = $db->getConfig();
         $db_config = $old_config;
         $db_config['host'] = $configArr['mysql_host'];
         $db_config['username'] = $configArr['mysql_user'];
         $db_config['password'] = $configArr['mysql_pass'];
         $db_config['dbname'] = $configArr['mysql_db'];
         $old_db_tables = $db->listTables();
         $new_db = JO_Db::setAdapterConfig($db_config);
         $new_db_tables = $new_db->listTables();
         // other tables
         $all_arr = array('bulletin', 'bulletin_emails', 'collections', 'collections_rates', 'contacts', 'contacts_categories', 'deposit', 'history', 'percents', 'quiz', 'quiz_answers', 'users_emails', 'users_followers', 'users_referals_count', 'users_status', 'user_groups', 'withdraw', 'items_attributes', 'items_collections', 'items_comments', 'items_faqs', 'items_rates', 'items_tags', 'items_to_category');
         foreach ($all_arr as $table) {
             if (!in_array($table, $old_db_tables) || !in_array($table, $new_db_tables)) {
                 continue;
             }
             $query = $new_db->select()->from($table);
             $attributes_categories = $new_db->fetchAll($query);
             if ($attributes_categories) {
                 $db_queries['TRUNCATE'][] = array('table' => $table, 'where' => null);
                 foreach ($attributes_categories as $key => $val) {
                     $vals = array();
                     foreach ($val as $k => $d) {
                         if (self::is_serialized($d)) {
                             $vals[$k] = $d;
                         } else {
                             $vals[$k] = htmlspecialchars($d, ENT_QUOTES, 'utf-8');
                         }
                     }
                     if (count($vals) > 0) {
                         $db_queries[$table][] = $vals;
                     }
                 }
             }
         }
         //attributes_categories
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `attributes_categories`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'attributes_categories', 'where' => null);
             foreach ($attributes_categories as $data) {
                 //					$db_queries[] = "INSERT INTO `attributes_categories` (`id`, `name`, `type`, `categories`, `visible`, `order_index`,`required`) VALUES ('".(int)$data['id'] ."', '".htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8') ."', '".htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8') ."', '".(int)$data['order_index'] ."',1);";
                 $db_queries['attributes_categories'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'categories' => htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8'), 'visible' => 'true', 'order_index' => (int) $data['order_index'], 'required' => 1);
             }
         }
         //attributes
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `attributes`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'attributes', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/attributes/' . $data['photo'], '/attributes/' . $data['photo']);
                 $db_queries['attributes'][] = array('id' => (int) $data['id'], 'category_id' => (int) $data['category_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => 'true', 'order_index' => (int) $data['order_index']);
             }
         }
         //attributes
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `badges`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'badges', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/badges/' . $data['photo'], '/badges/' . $data['photo']);
                 $db_queries['badges'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'from' => htmlspecialchars($data['from'], ENT_QUOTES, 'utf-8'), 'to' => htmlspecialchars($data['to']), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'sys_key' => htmlspecialchars($data['sys_key'], ENT_QUOTES, 'utf-8'));
             }
         }
         //categories
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `categories`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'categories', 'where' => null);
             $db_queries['TRUNCATE'][] = array('table' => 'categories_description', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $db_queries['categories'][] = array('id' => (int) $data['id'], 'sub_of' => (int) $data['sub_of'], 'meta_title' => htmlspecialchars($data['meta_title'], ENT_QUOTES, 'utf-8'), 'meta_keywords' => htmlspecialchars($data['meta_keywords'], ENT_QUOTES, 'utf-8'), 'meta_description' => htmlspecialchars($data['meta_description'], ENT_QUOTES, 'utf-8'), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'order_index' => (int) $data['order_index'], 'module' => $update_for);
                 $db_queries['categories_description'][] = array('id' => (int) $data['id'], 'lid' => 1, 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'));
             }
         }
         //countries
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `countries`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'countries', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/countries/' . $data['photo'], '/countries/' . $data['photo']);
                 $db_queries['countries'][] = array('id' => (int) $data['id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'photo' => basename($photo), 'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 'order_index' => (int) $data['order_index']);
             }
         }
         //items
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `items`");
         $temp_items = array();
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'items', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $weekly_from = '0000-00-00';
                 $weekly_to = '0000-00-00';
                 if ($data['weekly_to'] && $data['weekly_to'] != '0000-00-00') {
                     $weekly_from = $data['weekly_to'];
                     $weekly_to = JO_Date::getInstance($data['weekly_to'], 'yy-mm-dd', true)->setInterval('+7 days')->toString();
                 }
                 $old_path = BASE_PATH . '/old_sys/data/uploads/items/' . $data['id'] . '/';
                 $item_path = '/items/' . JO_Date::getInstance($data['datetime'], 'yy/mm/', true)->toString() . $data['id'] . '/';
                 //self::recursiveCopy($old_path . 'preview/', BASE_PATH . '/uploads/' . $item_path . 'preview/');
                 $thumbnail = self::copyFile($old_path . $data['thumbnail'], $item_path . $data['thumbnail']);
                 $main_file = self::copyFile($old_path . $data['main_file'], $item_path . $data['main_file']);
                 $theme_preview = self::copyFile($old_path . $data['theme_preview'], $item_path . $data['theme_preview']);
                 $theme_preview_thumbnail = self::copyFromArchive($theme_preview);
                 $temp_items[(int) $data['id']] = array('id' => (int) $data['id'], 'user_id' => (int) $data['user_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'description' => htmlspecialchars($data['description'], ENT_QUOTES, 'utf-8'), 'thumbnail' => $thumbnail, 'theme_preview_thumbnail' => $theme_preview_thumbnail, 'theme_preview' => $theme_preview, 'main_file' => $main_file, 'main_file_name' => htmlspecialchars($data['main_file_name'], ENT_QUOTES, 'utf-8'), 'categories' => htmlspecialchars($data['categories'], ENT_QUOTES, 'utf-8'), 'demo_url' => htmlspecialchars($data['demo_url'], ENT_QUOTES, 'utf-8'), 'price' => (double) $data['price'], 'suggested_price' => (double) $data['suggested_price'], 'sales' => (double) $data['sales'], 'earning' => (double) $data['earning'], 'rating' => (double) $data['rating'], 'votes' => (double) $data['votes'], 'score' => (double) $data['score'], 'comments' => (double) $data['comments'], 'free_request' => htmlspecialchars($data['free_request'], ENT_QUOTES, 'utf-8'), 'free_file' => htmlspecialchars($data['free_file'], ENT_QUOTES, 'utf-8'), 'weekly_from' => $weekly_from, 'weekly_to' => $weekly_to, 'reviewer_comment' => htmlspecialchars($data['reviewer_comment'], ENT_QUOTES, 'utf-8'), 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'status' => htmlspecialchars($data['status'], ENT_QUOTES, 'utf-8'), 'module' => $update_for, 'video_file' => htmlspecialchars(isset($data['video_file']) ? $data['video_file'] : '', ENT_QUOTES, 'utf-8'), 'item_tags_string' => htmlspecialchars(isset($data['item_tags_string']) ? $data['item_tags_string'] : '', ENT_QUOTES, 'utf-8'), 'preview' => htmlspecialchars(isset($data['preview']) ? $data['preview'] : '', ENT_QUOTES, 'utf-8'));
                 $db_queries['items'][] = $temp_items[(int) $data['id']];
             }
         }
         //orders
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `orders`");
         if ($attributes_categories) {
             JO_Db::setAdapterConfig($old_config);
             $db_queries['TRUNCATE'][] = array('table' => 'orders', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $db_queries['orders'][] = array('id' => (int) $data['id'], 'order_id' => (int) (isset($data['order_id']) ? $data['order_id'] : 0), 'user_id' => (int) $data['user_id'], 'owner_id' => (int) $data['owner_id'], 'item_id' => (int) $data['item_id'], 'item_name' => htmlspecialchars($data['item_name'], ENT_QUOTES, 'utf-8'), 'price' => (double) $data['price'], 'receive' => (double) $data['receive'], 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'paid' => htmlspecialchars($data['paid'], ENT_QUOTES, 'utf-8'), 'paid_datetime' => htmlspecialchars($data['paid_datetime'], ENT_QUOTES, 'utf-8'), 'extended' => htmlspecialchars($data['extended'], ENT_QUOTES, 'utf-8'), 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'), 'currency_code' => WM_Currency::getCurrencyCode(), 'currency_value' => '1.00000000', 'domain' => htmlspecialchars(isset($data['domain']) ? $data['domain'] : '', ENT_QUOTES, 'utf-8'), 'module' => $update_for, 'size_id' => htmlspecialchars(isset($data['size_id']) ? $data['size_id'] : '', ENT_QUOTES, 'utf-8'), 'main_file' => isset($temp_items[$data['item_id']]['main_file']) ? $temp_items[$data['item_id']]['main_file'] : '', 'main_file_info' => htmlspecialchars(isset($data['main_file_info']) ? $data['main_file_info'] : '', ENT_QUOTES, 'utf-8'));
             }
         }
         $new_db = JO_Db::setAdapterConfig($db_config);
         //temp_items
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `temp_items`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'temp_items', 'where' => null);
             foreach ($attributes_categories as $data) {
                 if (!isset($temp_items[$data['item_id']])) {
                     continue;
                 }
                 $old_path = BASE_PATH . '/old_sys/data/uploads/items/' . $data['item_id'] . '/temp/';
                 $item_path = '/items/' . JO_Date::getInstance($data['datetime'], 'yy/mm/', true)->toString() . $data['item_id'] . '/temp/';
                 //self::recursiveCopy($old_path . 'preview/', BASE_PATH . '/uploads/' . $item_path . 'preview/');
                 $thumbnail = self::copyFile($old_path . $data['thumbnail'], $item_path . $data['thumbnail']);
                 $main_file = self::copyFile($old_path . $data['main_file'], $item_path . $data['main_file']);
                 $theme_preview = self::copyFile($old_path . $data['theme_preview'], $item_path . $data['theme_preview']);
                 $theme_preview_thumbnail = self::copyFromArchive($theme_preview);
                 $db_queries['temp_items'][] = array('id' => (int) $data['id'], 'item_id' => (int) $data['item_id'], 'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 'thumbnail' => $thumbnail, 'theme_preview_thumbnail' => $theme_preview_thumbnail, 'theme_preview' => $theme_preview, 'main_file' => $main_file, 'main_file_name' => htmlspecialchars($data['main_file_name'], ENT_QUOTES, 'utf-8'), 'reviewer_comment' => htmlspecialchars($data['reviewer_comment'], ENT_QUOTES, 'utf-8'), 'datetime' => htmlspecialchars($data['datetime'], ENT_QUOTES, 'utf-8'), 'video_file' => htmlspecialchars(isset($data['video_file']) ? $data['video_file'] : '', ENT_QUOTES, 'utf-8'), 'preview' => htmlspecialchars(isset($data['preview']) ? $data['preview'] : '', ENT_QUOTES, 'utf-8'));
             }
         }
         //temp_items_tags
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `temp_items_tags`");
         if ($attributes_categories) {
             foreach ($attributes_categories as $data) {
                 if (!isset($temp_items[$data['item_id']])) {
                     continue;
                 }
                 $db_queries['TRUNCATE'][] = array('table' => 'items_tags', 'where' => "`item_id` = '" . (int) $data['item_id'] . "'");
                 $db_queries['items_tags'][] = array('item_id' => (int) $data['item_id'], 'item_id' => (int) $data['item_id'], 'type' => htmlspecialchars($data['type'], ENT_QUOTES, 'utf-8'));
             }
         }
         /*
         			if(in_array('slider', $old_db_tables) && in_array('slider', $new_db_tables)) {
         				//slider
         				$attributes_categories = $new_db->fetchAll("SELECT * FROM `slider`");
         				if($attributes_categories) {
         					$db_queries['TRUNCATE'][] = array(
         						'table' => 'slider',
         						'where' => null
         					);
         					foreach($attributes_categories AS $data) {
         						$photo = self::copyFile(BASE_PATH . '/old_sys/data/uploads/slider/'.$data['photo'], '/slider/'.$data['photo']);
         						$db_queries['slider'][] = array(
         							'id' => (int)$data['id'], 
         							'name' => htmlspecialchars($data['name'], ENT_QUOTES, 'utf-8'), 
         							'url' => htmlspecialchars($data['url'], ENT_QUOTES, 'utf-8'), 
         							'photo' => ($photo), 
         							'visible' => htmlspecialchars($data['visible'], ENT_QUOTES, 'utf-8'), 
         							'order_index' => (int)$data['order_index']
         						);
         					}
         				}
         			} */
         //users
         $attributes_categories = $new_db->fetchAll("SELECT * FROM `users`");
         if ($attributes_categories) {
             $db_queries['TRUNCATE'][] = array('table' => 'users', 'where' => null);
             foreach ($attributes_categories as $data) {
                 $old_path = BASE_PATH . '/old_sys/data/uploads/users/' . $data['user_id'] . '/';
                 $item_path = '/users/' . JO_Date::getInstance($data['register_datetime'], 'yy/mm/', true)->toString() . $data['user_id'] . '/';
                 $avatar = self::copyFile($old_path . $data['avatar'], $item_path . $data['avatar']);
                 $homeimage = self::copyFile($old_path . $data['homeimage'], $item_path . $data['homeimage']);
                 $db_queries['users'][] = array('user_id' => (int) $data['user_id'], 'username' => htmlspecialchars($data['username'], ENT_QUOTES, 'utf-8'), 'password' => htmlspecialchars($data['password'], ENT_QUOTES, 'utf-8'), 'email' => htmlspecialchars($data['email'], ENT_QUOTES, 'utf-8'), 'firstname' => htmlspecialchars($data['firstname'], ENT_QUOTES, 'utf-8'), 'lastname' => htmlspecialchars($data['lastname'], ENT_QUOTES, 'utf-8'), 'featured_item_id' => htmlspecialchars($data['featured_item_id'], ENT_QUOTES, 'utf-8'), 'exclusive_author' => htmlspecialchars($data['exclusive_author'], ENT_QUOTES, 'utf-8'), 'license' => $data['license'], 'avatar' => $avatar, 'homeimage' => $homeimage, 'firmname' => htmlspecialchars($data['firmname'], ENT_QUOTES, 'utf-8'), 'profile_title' => htmlspecialchars($data['profile_title'], ENT_QUOTES, 'utf-8'), 'profile_desc' => htmlspecialchars($data['profile_desc'], ENT_QUOTES, 'utf-8'), 'live_city' => htmlspecialchars($data['live_city'], ENT_QUOTES, 'utf-8'), 'country_id' => htmlspecialchars($data['country_id'], ENT_QUOTES, 'utf-8'), 'freelance' => htmlspecialchars($data['freelance'], ENT_QUOTES, 'utf-8'), 'social' => $data['social'], 'quiz' => htmlspecialchars($data['quiz'], ENT_QUOTES, 'utf-8'), 'deposit' => htmlspecialchars($data['deposit'], ENT_QUOTES, 'utf-8'), 'earning' => htmlspecialchars($data['earning'], ENT_QUOTES, 'utf-8'), 'total' => htmlspecialchars($data['total'], ENT_QUOTES, 'utf-8'), 'sold' => htmlspecialchars($data['sold'], ENT_QUOTES, 'utf-8'), 'items' => htmlspecialchars($data['items'], ENT_QUOTES, 'utf-8'), 'sales' => htmlspecialchars($data['sales'], ENT_QUOTES, 'utf-8'), 'buy' => htmlspecialchars($data['buy'], ENT_QUOTES, 'utf-8'), 'rating' => htmlspecialchars($data['rating'], ENT_QUOTES, 'utf-8'), 'score' => htmlspecialchars($data['score'], ENT_QUOTES, 'utf-8'), 'votes' => htmlspecialchars($data['votes'], ENT_QUOTES, 'utf-8'), 'referals' => htmlspecialchars($data['referals'], ENT_QUOTES, 'utf-8'), 'referal_money' => htmlspecialchars($data['referal_money'], ENT_QUOTES, 'utf-8'), 'featured_author' => htmlspecialchars($data['featured_author'], ENT_QUOTES, 'utf-8'), 'register_datetime' => htmlspecialchars($data['register_datetime'], ENT_QUOTES, 'utf-8'), 'last_login_datetime' => htmlspecialchars($data['last_login_datetime'], ENT_QUOTES, 'utf-8'), 'ip_address' => htmlspecialchars($data['ip_address'], ENT_QUOTES, 'utf-8'), 'status' => htmlspecialchars($data['status'], ENT_QUOTES, 'utf-8'), 'groups' => $data['groups'], 'remember_key' => htmlspecialchars($data['remember_key'], ENT_QUOTES, 'utf-8'), 'activate_key' => htmlspecialchars($data['activate_key'], ENT_QUOTES, 'utf-8'), 'referal_id' => htmlspecialchars($data['referal_id'], ENT_QUOTES, 'utf-8'), 'commission_percent' => htmlspecialchars($data['commission_percent'], ENT_QUOTES, 'utf-8'), 'badges' => htmlspecialchars($data['badges'], ENT_QUOTES, 'utf-8'));
             }
         }
         JO_Session::clear('inserted');
         JO_Session::clear('deleted');
         if (isset($db_queries['TRUNCATE'])) {
             $truncate = $db_queries['TRUNCATE'];
             unset($db_queries['TRUNCATE']);
             JO_Session::set('deleted', $truncate);
         }
         $tmp = array();
         $checked = array();
         foreach ($db_queries as $table => $data) {
             foreach ($data as $key => $res) {
                 $key = md5(var_export(array($table, $res), true));
                 if (!isset($checked[$key])) {
                     $tmp[] = array('table' => $table, 'data' => $res);
                 }
                 $checked[$key] = true;
             }
         }
         JO_Session::set('inserted', $tmp);
         JO_Session::set('query_error', array());
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?module=update&controller=index&action=stepTwo'));
     }
 }
예제 #5
0
 public function header_partAction()
 {
     $request = $this->getRequest();
     if ($this->getLayout()->meta_title) {
         $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title'));
     } else {
         $this->getLayout()->placeholder('title', JO_Registry::get('meta_title'));
     }
     if ($this->getLayout()->meta_description) {
         $this->getLayout()->placeholder('description', $this->getLayout()->meta_description);
     } else {
         $this->getLayout()->placeholder('description', JO_Registry::get('meta_description'));
     }
     if ($this->getLayout()->meta_keywords) {
         $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords);
     } else {
         $this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords'));
     }
     $this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8'));
     if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads/' . JO_Registry::get('site_logo'))) {
         $this->view->site_logo = JO_Registry::get('site_logo');
     }
     $this->view->home_action = $request->getBaseUrl();
     $this->getCategories();
     $this->view->menuPages = Model_Pages::getPagesMenu();
     if (isset($this->view->menuPages[0])) {
         foreach ($this->view->menuPages[0] as $k => $v) {
             $this->view->menuPages[0][$k]['href'] = $v['url'] ? $v['url'] : WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name']));
             if (isset($this->view->menuPages[$v['id']])) {
                 foreach ($this->view->menuPages[$v['id']] as $r => $t) {
                     $this->view->menuPages[$v['id']][$r]['href'] = $t['url'] ? $t['url'] : WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $t['id'] . '&name=' . WM_Router::clearName($t['name']));
                 }
             }
         }
     }
     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');
     }
     $this->view->recent_href = WM_Router::create($request->getBaseUrl() . '?controller=categories&action=recent');
     $this->view->top_sellers_href = WM_Router::create($request->getBaseUrl() . '?controller=categories&action=popular');
     $this->view->feature_href = WM_Router::create($request->getBaseUrl() . '?controller=categories&action=featured');
     $this->view->collections_href = WM_Router::create($request->getBaseUrl() . '?controller=collections');
     $this->view->top_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=top');
     $this->view->all_authors_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=authors');
     $this->view->search = WM_Router::create($request->getBaseUrl() . '?controller=search');
     ////////// CURRENCY
     //autoupdate currency if set
     if (JO_Registry::get('config_currency_auto_update')) {
         WM_Currency::updateCurrencies();
         $currencies = WM_Currency::getCurrencies();
         $this->view->currencies = array();
         if ($currencies) {
             foreach ($currencies as $currency) {
                 $currency['active'] = $currency['code'] == WM_Currency::getCurrencyCode();
                 $this->view->currencies[] = $currency;
             }
         }
     }
     ///////// LANGUAGES
     $languages = WM_Locale::getLanguages();
     if ($languages && count($languages) > 1) {
         $this->view->languages = array();
         $config_language_id = JO_Registry::get('config_language_id');
         foreach ($languages as $language) {
             if ($language['language_id'] == $config_language_id) {
                 $this->view->current_language = array('name' => $language['name'], 'id' => $language['language_id'], 'image' => 'data/themes/images/flags/' . $language['image']);
             } else {
                 $this->view->languages[] = array('name' => $language['name'], 'id' => $language['language_id'], 'image' => 'data/themes/images/flags/' . $language['image']);
             }
         }
     }
     $username = JO_Session::get('username');
     if ($username) {
         $this->view->user = Model_Users::getUser(JO_Session::get('user_id'));
         $this->view->user['total'] = WM_Currency::format($this->view->user['total']);
         $ind = 0;
         $this->view->options = array(array('name' => $this->view->translate('Portfolio'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('My Account'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Downloads'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Collections'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username='******'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Deposit'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=deposit'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Dashboard'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Upload'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=upload'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Earnings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=earnings'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Statement'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=statement'), 'css' => 'icon-' . ++$ind), array('name' => $this->view->translate('Withdrawal'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=withdrawal'), 'css' => 'icon-' . ++$ind));
         $this->view->user_logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout');
     } else {
         $this->view->user_registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=registration');
         $this->view->user_login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
         $this->view->user_lost_username = WM_Router::create($request->getBaseUrl() . '?controller=users&action=lost_username');
         $this->view->user_reset_password = WM_Router::create($request->getBaseUrl() . '?controller=users&action=reset_password');
     }
     $threads = Model_Forum::getAll();
     if ($threads) {
         $this->view->forum_link = WM_Router::create($request->getBaseUrl() . '?controller=forum');
         $this->view->threads = array();
         foreach ($threads as $thread) {
             $this->view->threads[] = array('name' => $thread['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum&action=thread/' . $thread['id'] . '&name=' . WM_Router::clearName($thread['name'])));
         }
     }
     $facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret')));
     $this->view->facebook_link = $facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=callback_facebook'), 'req_perms' => JO_Registry::forceGet('facebook_req_perms'), 'scope' => JO_Registry::forceGet('facebook_req_perms')));
     $this->view->children = array();
     $this->view->children['extensions_top'] = 'extensions/top';
     //	$this->view->children['extensions_topmiddle'] = 'extensions/topmiddle';
 }