Changeset 19815


Ignore:
Timestamp:
Jan 5, 2013, 12:11:07 AM (12 years ago)
Author:
julien1311
Message:

first working version

Location:
extensions/Mobile_Theme_for_Tablets
Files:
16 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mobile_Theme_for_Tablets/admin.php

    r19778 r19815  
    11<?php
    22//Chech whether we are indeed included by Piwigo.
    3 if (!defined('MEDIA_ICON_PATH')) die('Hacking attempt!');
     3if (!defined('MTT_PATH')) die('Hacking attempt!');
    44
    55//Load globals
     
    1212check_status(ACCESS_ADMINISTRATOR);
    1313
    14 
     14include_once(MTT_PATH.'admin/admin_config.php');
    1515?>
  • extensions/Mobile_Theme_for_Tablets/include/functions.inc.php

    r19778 r19815  
    11<?
    2         function mtt_activate_mobile_theme() {
    3           $array = array('mobile', 'tablet'); //A remplacer par un $conf
     2function mtt_activate_mobile_theme() {
     3        global $conf;
    44
    5           if (in_array(pwg_get_session_var('device'), $array)) {
    6                 pwg_set_session_var('mobile_theme', true);
    7           } else {
    8                 pwg_set_session_var('mobile_theme', false);
    9           }
    10         }
     5        $conf_mtt = unserialize($conf['mobile_theme_for_tablets']);
     6       
     7        if (isset($conf_mtt['devices'][pwg_get_session_var('device')]) && $conf_mtt['devices'][pwg_get_session_var('device')] == '1') {
     8                        pwg_set_session_var('mobile_theme', true);
     9                } else {
     10                        pwg_set_session_var('mobile_theme', false);
     11                }
     12}
    1113?>
  • extensions/Mobile_Theme_for_Tablets/main.inc.php

    r19778 r19815  
    3838 * +-----------------------------------------------------------------------+ */
    3939include_once(MTT_PATH.'include/functions.inc.php');
    40 add_event_handler('loading_lang', 'activate_mobile_theme');
     40add_event_handler('loading_lang', 'mtt_activate_mobile_theme');
    4141?>
  • extensions/Mobile_Theme_for_Tablets/maintain.inc.php

    r19778 r19815  
    33
    44function plugin_install() {
    5        
     5        include_once(dirname(__FILE__).'/install/functions.inc.php');
     6        include_once(dirname(__FILE__).'/install/config_default.inc.php');
     7
     8        mtt_install($config_default);
    69}
    710
    811function plugin_activate() {
     12        include_once(dirname(__FILE__).'/install/functions.inc.php');
    913       
     14        mtt_update_db();
    1015}
    1116
    1217function plugin_uninstall() {
     18        include_once(dirname(__FILE__).'/install/functions.inc.php');
    1319
     20        mtt_delete_conf("mobile_theme_for_tablets");
    1421}
    1522
Note: See TracChangeset for help on using the changeset viewer.