Привет, Гость!
Главная
Вход

Последняя активность

Форум / JohnCMS / моды, дизайн / Модули для JohnCMS 7.x.x
Поиск | Файлы топика (1)
  Manual web wap 7.10
Gabriel Gabriel [Off] [#] (03.06.2017 / 20:47)
CyberGhostNet Group
Manual wap web for johncms 7.1.0
By Gabriel

open system/johncms/Environment.php

Find:
  1. public function __invoke(ContainerInterface $container)
  2. {
  3. $this->container = $container;
  4. $this->ipLog($this->getIp());
  5. return $this;
  6. }


Add this line:
  1. $this->AgentWeb();
  2. //access web


And put this code:
  1. /*
  2.   * web view johncms 7.1.0
  3.   * By Gabriel
  4.   */
  5. public function AgentWeb()
  6. {
  7. if (isset($_GET['w']))
  8. $_SESSION['agent_web'] = 'web';
  9. if (isset($_GET['m']))
  10. $_SESSION['agent_web'] = 'wap';
  11. if (isset($_POST['web']))
  12. $_SESSION['agent_web'] = 'web';
  13. if (isset($_POST['wap']))
  14. $_SESSION['agent_web'] = 'wap';
  15. if ($_SESSION['agent_web'] == 'web')
  16. $agent_web = 'web';
  17. elseif ($_SESSION['agent_web'] == 'wap')
  18. $agent_web = 'wap';
  19. else
  20. $agent_web = 'wap';
  21. return $agent_web;
  22. }

close and save Environment.php
Go to system/johncms/Tools.php
open and put this code:
  1. public function getSkins()
  2. {
  3. return $this->user->isValid() && !empty($this->userConfig->skins)
  4. ? $this->userConfig->skins
  5. : $this->config->skinweb;
  6. }

Close and save.

Go to system/johncms/UserConfig.php
Find:
  1. 'kmess' => 20, // Число сообщений на страницу
  2. 'skin' => '', // Тема оформления

Add this line:
  1. 'skins' => '', // Theme web

Close and save.


Now open admin/includes/settings.php
Find:
  1. $config['skindef'] = isset($_POST['skindef']) ? trim($_POST['skindef']) : 'default';

Add this line:
  1. $config['skinweb'] = isset($_POST['skinweb']) ? trim($_POST['skinweb']) : 'default'; //default skin is default


And add the selected style:
  1. echo '<p><h3>' . _t('Themes') . ' Web</h3>&#160;<select name="skinweb">';
  2. $dirs = opendir('../themes');
  3.  
  4. while ($skinweb = readdir($dirs)) {
  5. if (($skinweb != '.') && ($skinweb != '..') && ($skinweb != '.svn')) {
  6. $skinweb = str_replace('.css', '', $skinweb);
  7. echo '<option' . ($config['skinweb'] == $skinweb ? ' selected="selected">' : '>') . $skinweb . '</option>';
  8. }
  9. }
  10.  
  11. closedir($dirs);
  12.  
  13. echo '</select>' .
  14. '</p>';

Close and save
Now open profile/includes/settings.php
Find:
  1. // Устанавливаем скин
  2. foreach (glob('../theme/*/*.css') as $val) {
  3. $theme_list[] = array_pop(explode('/', dirname($val)));
  4. }
  5.  
  6. $set_user['skin'] = isset($_POST['skin']) && in_array($_POST['skin'], $theme_list) ? htmlspecialchars(trim($_POST['skin'])) : $config['skindef'];

Add this line:
  1. // Устанавливаем скин web
  2. foreach (glob('../themes/*/*.css') as $vals) {
  3. $themes_list[] = array_pop(explode('/', dirname($vals)));
  4. }
  5.  
  6. $set_user['skins'] = isset($_POST['skins']) && in_array($_POST['skins'], $themes_list) ? htmlspecialchars(trim($_POST['skins'])) : $config['skinweb'];


Add the selected theme for user
  1. echo '<p><h3>' . _t('Appearance') . ' Web</h3>';
  2. // Выбор темы оформления
  3. echo '<select name="skins">';
  4.  
  5. foreach (glob('../themes/*/*.css') as $vals) {
  6. $dirs = explode('/', dirname($vals));
  7. $themes = array_pop($dirs);
  8. echo '<option' . ($userConfig->skins == $themes ? ' selected="selected">' : '>') . $themes . '</option>';
  9. }
  10.  
  11. echo '</select> ' . _t('Theme') . '</p>';

Close and save!

Go to system/bootstrap.php
add this line:
  1. require __DIR__ . '/Mobile_Detect/Mobile_Detect.php';
  2. # @var Mobile_Detect
  3. $Mobile_Detect = new Mobile_Detect;
  4.  
  5. # @var Mobile_Detect with Version
  6. $OpMin = $Mobile_Detect->version('Opera Mini');
  7. $Android = $Mobile_Detect->version('Android');
  8.  
  9. # @var Mobile_Detect with is
  10. $Mobile = $Mobile_Detect->isMobile();
  11. $Tablet = $Mobile_Detect->isTablet();
  12. if (empty($_SESSION['agent_web'])){
  13. if (!$Mobile) {
  14. $_SESSION['agent_web'] = 'web';
  15. } else {
  16. $_SESSION['agent_web'] = 'wap';
  17. }
  18. }
  19.  
  20. if ($_SESSION['agent_web'] == 'web') {
  21. $agent_web = 'web';
  22. } elseif ($_SESSION['agent_web'] == 'wap') {
  23. $agent_web = 'wap';
  24. } else {
  25. $agent_web = 'wap';
  26. }


Go to system/head.php
This For menu mobile and web
  1. if ($agent_web == 'web') {
  2. echo 'Head Web';
  3. //require(ROOT_PATH . 'themes/' . $tools->getSkins() . '/head.php');
  4. // themes head for web im use and put on dir /themes/
  5. } else {
  6. echo 'Head Mobile';
  7. //head mobile
  8. }


for end.php
  1. if ($agent_web == 'web') {
  2. echo 'End Web';
  3. //require(ROOT_PATH . 'themes/' . $tools->getSkins() . '/end.php');
  4. // themes end for web im use and put on dir /themes/
  5. } else {
  6. echo 'End Mobile';
  7. // end mobile
  8. }


To access web you can use domain/?w
To access wap you can use domain/?m

Or you can use form like this
  1. echo '<form action="" method="post">
  2. <input type="submit" name="web" value="Dekstop Views">
  3. </form>';

Изм. Gabriel (03.06.2017 / 21:18) [4]
Прикреплённый файл:
mdetected.zip (26.04 кб.)
Скачано: 172 раз
  Всего: 1

Фильтр по автору
Скачать тему

Форум

Новые вверху
Главная
2 / 26

JohnCMS 7.1.0

Яндекс.Метрика
© JohnCMS