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 34]

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

Methods

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

Inherited From DeviceConfig

DeviceConfig::$attributes
DeviceConfig::$device_id
DeviceConfig::$FPATH
DeviceConfig::$installerBasename
DeviceConfig::$lang_index
DeviceConfig::$module_path
DeviceConfig::$options
DeviceConfig::$selected_eap
DeviceConfig::$sign
DeviceConfig::$signer
DeviceConfig::$specialities
DeviceConfig::$support_email_substitute
DeviceConfig::$support_url_substitute

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()
Selects the preferred eap method based on profile EAP configuration and device EAP capabilities
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::translateString()
DeviceConfig::writeDeviceInfo()
prepare usage information for the installer every device module should override this method
DeviceConfig::writeInstaller()
placeholder for the main device method

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

[ Top ]
Methods
Constructor __construct  [line 40]

  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 ]
writeDeviceInfo  [line 164]

  void writeDeviceInfo( )


API Tags:
Access:  public


Redefinition of:
DeviceConfig::writeDeviceInfo()
prepare usage information for the installer every device module should override this method

[ Top ]
writeInstaller  [line 57]

  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.           'root' can be 1 for self-signed certificate or 0 otherwise
  14.  
  15.           - save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
  16.          */
  17.         $dom textdomain(NULL);
  18.         textdomain("devices");
  19.  
  20.         debug(4"mobileconfig Module Installer start\n");
  21.  
  22.         // remove spaces and slashes (filename!), make sure it's simple ASCII only, then lowercase it
  23.         // also escape htmlspecialchars
  24.  
  25.         $this->massaged_inst       htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//IGNORE"preg_replace(array('/ /','/\//')'_'$this->attributes['general:instname'][0])))ENT_NOQUOTES'UTF-8');
  26.         $this->massaged_profile    htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//IGNORE"preg_replace(array('/ /','/\//')'_'$this->attributes['profile:name'][0])))ENT_NOQUOTES'UTF-8');
  27.         $this->massaged_country    htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//IGNORE"preg_replace(array('/ /','/\//')'_'$this->attributes['internal:country'][0])))ENT_NOQUOTES'UTF-8');
  28.         $this->massaged_consortium htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//IGNORE"preg_replace(array('/ /','/\//')'_'Config::$CONSORTIUM['name'])))ENT_NOQUOTES'UTF-8');
  29.         $this->lang preg_replace('/\..+/'''setlocale(LC_ALL"0"));
  30.  
  31.         // inst and profile MUST NOT be empty (needed to construct apple OID strings)
  32.         if ($this->massaged_inst == "")
  33.             $this->massaged_inst "unnamed-inst";
  34.         if ($this->massaged_profile == "")
  35.             $this->massaged_profile "unnamed-profile";
  36.         
  37.         if (isset($this->attributes['internal:use_anon_outer']&& $this->attributes['internal:use_anon_outer'][0== "1" && isset($this->attributes['internal:realm'])) {
  38.  
  39.             $use_realm "@" $this->attributes['internal:realm'][0];
  40.             if (isset($this->attributes['internal:anon_local_value']))
  41.                 $use_realm $this->attributes['internal:anon_local_value'][0$use_realm;
  42.         }
  43.         else {
  44.             $use_realm 0;
  45.         }
  46.  
  47.         $ssid_list $this->attributes['internal:SSID'];
  48.         $server_names $this->attributes['eap:server_name'];
  49.         $uuid_list $this->list_ca_uuids($this->attributes['internal:CAs'][0]);
  50.         $eap_type $this->selected_eap;
  51.         $output_xml "";
  52.         $output_xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>
  53. <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
  54. \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
  55. <plist version=\"1.0\">
  56.    <dict>
  57.       <key>PayloadContent</key>
  58.          <array>";
  59.  
  60.         $output_xml .= $this->all_wlan($ssid_list$server_names$uuid_list$eap_type$use_realm);
  61.  
  62.         $output_xml .= $this->all_ca($this->attributes['internal:CAs'][0]);
  63.  
  64.         $output_xml .= "
  65.          </array>
  66.       <key>PayloadDescription</key>
  67.          <string>" sprintf(_("Network configuration profile '%s' of '%s' - provided by %s")htmlspecialchars($this->attributes['profile:name'][0]ENT_NOQUOTES'UTF-8')htmlspecialchars($this->attributes['general:instname'][0]ENT_NOQUOTES'UTF-8')Config::$CONSORTIUM['name']"</string>
  68.       <key>PayloadDisplayName</key>
  69.          <string>" Config::$CONSORTIUM['name'"</string>
  70.       <key>PayloadIdentifier</key>
  71.          <string>" Device_mobileconfig::$IPHONE_PAYLOAD_PREFIX ".$this->massaged_consortium.$this->massaged_country.$this->massaged_inst.$this->massaged_profile.$this->lang</string>
  72.       <key>PayloadOrganization</key>
  73.          <string>htmlspecialchars(iconv("UTF-8""UTF-8//IGNORE",$this->attributes['general:instname'][0]),ENT_NOQUOTES'UTF-8'$this->attributes['internal:profile_count'][0" (" htmlspecialchars(iconv("UTF-8""UTF-8//IGNORE",$this->attributes['profile:name'][0])ENT_NOQUOTES'UTF-8'")" """</string>
  74.       <key>PayloadType</key>
  75.          <string>Configuration</string>
  76.       <key>PayloadUUID</key>
  77.          <string>" uuid("</string>
  78.       <key>PayloadVersion</key>
  79.          <integer>1</integer>";
  80.         if (isset($this->attributes['support:info_file']))
  81.             $output_xml .= "
  82.       <key>ConsentText</key>
  83.          <dict>
  84.             <key>default</key>
  85.                <string>" htmlspecialchars(iconv("UTF-8""UTF-8//IGNORE",$this->attributes['support:info_file'][0])ENT_NOQUOTES 'UTF-8'"</string>
  86.          </dict>
  87.          ";
  88.         
  89.         $output_xml .= "</dict></plist>";
  90.         
  91.         $xml_f fopen('installer_profile''w');        
  92.         fwrite($xml_f$output_xml);
  93.         fclose($xml_f);
  94.         
  95.         $e $this->installerBasename.'.mobileconfig';
  96.         if($this->sign{
  97.            $o system($this->sign." installer_profile '$e' > /dev/null");
  98.            if ($o === FALSE)
  99.                debug(2"Signing the mobileconfig installer $e FAILED!\n");
  100.         }
  101.         else
  102.            rename("installer_profile",$e);
  103.  
  104.         textdomain($dom);
  105.         return $e;
  106.     }


API Tags:
Access:  public


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

[ Top ]

Documentation generated on Wed, 08 Apr 2015 07:12:46 +0000 by phpDocumentor 1.4.4