phpDocumentor Developer
[ class tree: Developer ] [ index: Developer ] [ all elements ]

Class: Device_mobileconfig

Source Location: /devices/apple_mobileconfig/mobileconfig.php

Class Device_mobileconfig

Class Overview

This is the main implementation class of the module

The class should only define one public method: writeInstaller.

All other methods and properties should be private. This example sets zipInstaller method to protected, so that it can be seen in the documentation.

Located in /devices/apple_mobileconfig/mobileconfig.php [line 27]

DeviceConfig
   |
   --Device_mobileconfig
Author(s): Information Tags:

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From DeviceConfig

DeviceConfig::$attributes
DeviceConfig::$FPATH
DeviceConfig::$lang_index
DeviceConfig::$module_path
DeviceConfig::$selected_eap
DeviceConfig::$sign

Inherited From DeviceConfig

DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one
DeviceConfig::copyFile()
Copy a file from the module location to the temporary directory.
DeviceConfig::dumpAttibutes()
dumps attributes for debugging purposes
DeviceConfig::getPreferredEapType()
select the preferred eap method
DeviceConfig::saveCertificateFiles()
Save certificate files in either DER or PEM format
DeviceConfig::setup()
Set up working environment for a device module
DeviceConfig::translateFile()
Copy a file from the module location to the temporary directory aplying translation.
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]
Property Summary
static mixed   $my_eap_methods  

[ Top ]
Method Summary
Device_mobileconfig   __construct()   this array holds the list of EAP methods supported by this device
void   writeInstaller()   prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

[ Top ]
Properties
static mixed   $my_eap_methods = array(array("OUTER" => TLS, "INNER" => NONE),array("OUTER"=>PEAP,"INNER"=>MSCHAPv2),array("OUTER"=>TTLS,"INNER"=>NONE)) [line 40]
API Tags:
Access:  public


[ Top ]
Methods
Constructor __construct  [line 33]

  Device_mobileconfig __construct( )

this array holds the list of EAP methods supported by this device


API Tags:
Access:  public


Redefinition of:
DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one

[ Top ]
writeInstaller  [line 52]

  void writeInstaller( )

prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

  1. function writeInstaller({
  2.    /** run innitial setup
  3.       this will:
  4.        - create the temporary directory and save its path as $this->FPATH
  5.        - process the CA certificates and store results in $this->attributes['internal:CAs'][0]
  6.             $this->attributes['internal:CAs'][0] is an array of processed CA certificates
  7.             a processed certifincate is an array 
  8.                'pem' points to pem feromat certificate
  9.                'der' points to der format certificate
  10.                'md5' points to md5 fingerprint
  11.                'sha1' points to sha1 fingerprint
  12.                'name' points to the certificate subject
  13.        - save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
  14.    */
  15.        $dom textdomain(NULL);
  16.       textdomain("devices");
  17.     $this->supportedEapMethods Device_mobileconfig::$my_eap_methods;
  18.  
  19.     debug(4,"mobileconfig Module Installer start\n");
  20. //    $this->setup($profile);
  21.     $this->massaged_inst preg_replace('/ +/','_',$this->attributes['internal:inst_name'][0]);
  22.     $this->massaged_profile preg_replace('/ +/','_',$this->attributes['internal:profile_name'][0]);
  23.     $this->massaged_country strtolower($this->attributes['internal:country'][0]);
  24.     $this->lang preg_replace('/\..+/','',setlocale(LC_ALL,"0"));
  25.  
  26.     if (isset($this->attributes['internal:use_anon_outer']&& $this->attributes['internal:use_anon_outer'][0== "1" && isset($this->attributes['internal:realm']))
  27.             $use_realm $this->attributes['internal:realm'][0];
  28.     else
  29.             $use_realm 0;
  30.  
  31.     $filename $this->attributes['internal:inst_name'][0]."-".$this->attributes['internal:profile_name'][0].".mobileconfig";
  32.     $filename preg_replace('/ +/','_',$filename);
  33.     $xml_f fopen($filename,'w');
  34.  
  35.  
  36.     $ssid_list $this->attributes['general:SSID'];
  37.     $server_names $this->attributes['eap:server_name'];
  38.     $uuid_list $this->list_ca_uuids($this->attributes['internal:CAs'][0]);
  39.     $eap_type $this->selected_eap;
  40.  
  41.     fwrite($xml_f,"<?xml version=\"1.0\" encoding=\"utf-8\"?>
  42. <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
  43. \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
  44. <plist version=\"1.0\">
  45.    <dict>
  46.       <key>PayloadContent</key>
  47.          <array>");
  48.  
  49.     fwrite($xml_f,$this->all_wlan($ssid_list,$server_names,$uuid_list,$eap_type$use_realm));
  50.  
  51.     fwrite($xml_f,$this->all_ca($this->attributes['internal:CAs'][0]));
  52.  
  53.     fwrite($xml_f,"
  54.          </array>
  55.       <key>PayloadDescription</key>
  56.          <string>".sprintf(_("iPhone profile '%s' of '%s' - provided by eduroam.org"),$this->attributes['internal:profile_name'][0],$this->attributes['internal:inst_name'][0])."</string>
  57.       <key>PayloadDisplayName</key>
  58.          <string>".$this->attributes['internal:profile_name'][0]."</string>
  59.       <key>PayloadIdentifier</key>
  60.          <string>".Device_mobileconfig::$IPHONE_PAYLOAD_PREFIX.".$this->massaged_country.$this->massaged_inst.$this->massaged_profile.$this->lang</string>
  61.       <key>PayloadOrganization</key>
  62.          <string>".$this->attributes['internal:inst_name'][0]."</string>
  63.       <key>PayloadType</key>
  64.          <string>Configuration</string>
  65.       <key>PayloadUUID</key>
  66.          <string>".uuid()."</string>
  67.       <key>PayloadVersion</key>
  68.          <integer>1</integer>
  69.    </dict>
  70. </plist>");
  71.  
  72.     fclose($xml_f);
  73.    if($this->sign{
  74.       $e 'signed-'.$filename;
  75.       $o system($this->sign." $filename $e > /dev/null");
  76.    }
  77.    else
  78.       $e $filename;
  79.  
  80.    textdomain($dom);
  81.     return $e;
  82.    }


API Tags:
Access:  public


Redefinition of:
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]

Documentation generated on Thu, 13 Oct 2011 08:42:11 +0200 by phpDocumentor 1.4.3