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

Class: mobileconfig_superclass

Source Location: /devices/apple_mobileconfig/mobileconfig_superclass.php

Class mobileconfig_superclass

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_superclass.php [line 34]

DeviceConfig
   |
   --mobileconfig_superclass
Author(s): API Tags:
Abstract:  

Information Tags:

Methods

[ Top ]
Descendants
Child Class Description
Device_mobileconfig_ios This is the main implementation class of the module
Device_mobileconfig_os_x This is the main implementation class of the module
Device_mobileconfig_ios_56 This is the main implementation class of the module

[ 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
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
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 47]

  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.         // not all names and profiles have a name, so be prepared
  25.         if (empty($this->attributes['general:instname'][0]))
  26.             $inst_name "Unnamed Institution";
  27.         else
  28.             $inst_name $this->attributes['general:instname'][0];
  29.  
  30.         if (empty($this->attributes['profile:name'][0]))
  31.             $profile_name "Unnamed Profile";
  32.         else
  33.             $profile_name $this->attributes['profile:name'][0];
  34.  
  35.         $this->massaged_inst htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//TRANSLIT"preg_replace(array('/ /''/\//')'_'$inst_name)))ENT_XML1'UTF-8');
  36.         $this->massaged_profile htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//TRANSLIT"preg_replace(array('/ /''/\//')'_'$profile_name)))ENT_XML1'UTF-8');
  37.         $this->massaged_country htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//TRANSLIT"preg_replace(array('/ /''/\//')'_'$this->attributes['internal:country'][0])))ENT_XML1'UTF-8');
  38.         $this->massaged_consortium htmlspecialchars(strtolower(iconv("UTF-8""US-ASCII//TRANSLIT"preg_replace(array('/ /''/\//')'_'Config::$CONSORTIUM['name'])))ENT_XML1'UTF-8');
  39.         $this->lang preg_replace('/\..+/'''setlocale(LC_ALL"0"));
  40.  
  41.         if (isset($this->attributes['internal:use_anon_outer']&& $this->attributes['internal:use_anon_outer'][0== "1" && isset($this->attributes['internal:realm'])) {
  42.  
  43.             $use_realm "@" $this->attributes['internal:realm'][0];
  44.             if (isset($this->attributes['internal:anon_local_value']))
  45.                 $use_realm $this->attributes['internal:anon_local_value'][0$use_realm;
  46.         }
  47.         else {
  48.             $use_realm 0;
  49.         }
  50.  
  51.         $ssid_list $this->attributes['internal:SSID'];
  52.         $OI_list $this->attributes['internal:consortia'];
  53.         $server_names $this->attributes['eap:server_name'];
  54.         $uuid_list $this->list_ca_uuids($this->attributes['internal:CAs'][0]);
  55.         $eap_type $this->selected_eap;
  56.         $output_xml "";
  57.         $output_xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>
  58. <!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
  59. \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
  60. <plist version=\"1.0\">
  61.    <dict>
  62.       <key>PayloadContent</key>
  63.          <array>";
  64.  
  65.         // did the admin want wired config?
  66.         if (isset($this->attributes['media:wired']&& get_class($this== "Device_mobileconfig_os_x")
  67.             $include_wired TRUE;
  68.         else
  69.             $include_wired FALSE;
  70.  
  71.         $output_xml .= $this->all_network_blocks($ssid_list$OI_list$server_names$uuid_list$eap_type$include_wired$use_realm);
  72.  
  73.         $output_xml .= $this->all_ca($this->attributes['internal:CAs'][0]);
  74.  
  75.         $output_xml .= "
  76.          </array>
  77.       <key>PayloadDescription</key>
  78.          <string>" sprintf(_("Network configuration profile '%s' of '%s' - provided by %s")htmlspecialchars($profile_nameENT_XML1'UTF-8')htmlspecialchars($inst_nameENT_XML1'UTF-8')Config::$CONSORTIUM['name']"</string>
  79.       <key>PayloadDisplayName</key>
  80.          <string>" Config::$CONSORTIUM['name'"</string>
  81.       <key>PayloadIdentifier</key>
  82.          <string>" mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX ".$this->massaged_consortium.$this->massaged_country.$this->massaged_inst.$this->massaged_profile.$this->lang</string>
  83.       <key>PayloadOrganization</key>
  84.          <string>htmlspecialchars(iconv("UTF-8""UTF-8//IGNORE"$this->attributes['general:instname'][0])ENT_XML1'UTF-8'$this->attributes['internal:profile_count'][0" (" htmlspecialchars(iconv("UTF-8""UTF-8//IGNORE"$this->attributes['profile:name'][0])ENT_XML1'UTF-8'")" """</string>
  85.       <key>PayloadType</key>
  86.          <string>Configuration</string>
  87.       <key>PayloadUUID</key>
  88.          <string>" uuid(''mobileconfig_superclass::$IPHONE_PAYLOAD_PREFIX $this->massaged_consortium $this->massaged_country $this->massaged_inst $this->massaged_profile"</string>
  89.       <key>PayloadVersion</key>
  90.          <integer>1</integer>";
  91.         if (isset($this->attributes['support:info_file']))
  92.             $output_xml .= "
  93.       <key>ConsentText</key>
  94.          <dict>
  95.             <key>default</key>
  96.                <string>" htmlspecialchars(iconv("UTF-8""UTF-8//TRANSLIT"$this->attributes['support:info_file'][0])ENT_XML1'UTF-8'"</string>
  97.          </dict>
  98.          ";
  99.  
  100.         $output_xml .= "</dict></plist>";
  101.  
  102.         $xml_f fopen('installer_profile''w');
  103.         fwrite($xml_f$output_xml);
  104.         fclose($xml_f);
  105.  
  106.         $e $this->installerBasename '.mobileconfig';
  107.         if ($this->sign{
  108.             $o system($this->sign " installer_profile '$e' > /dev/null");
  109.             if ($o === FALSE)
  110.                 debug(2"Signing the mobileconfig installer $e FAILED!\n");
  111.         else
  112.             rename("installer_profile"$e);
  113.  
  114.         textdomain($dom);
  115.         return $e;
  116.     }


API Tags:
Access:  public


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

[ Top ]

Documentation generated on Tue, 06 Oct 2015 06:11:17 +0000 by phpDocumentor 1.4.4