Example #1
0
 /**
  * Initialises and imports the Shmanic platform and project libraries.
  * This is fired on application initialise typically by the CMS.
  *
  * @return  void
  *
  * @since   2.0
  */
 public function onAfterInitialise()
 {
     // Check if the Shmanic platform has already been imported
     if (!defined('SHPATH_PLATFORM')) {
         $platform = JPATH_PLATFORM . '/shmanic/import.php';
         if (!file_exists($platform)) {
             // Failed to find the import file
             return false;
         }
         // Shmanic Platform import
         if (!(include_once $platform)) {
             // Failed to import the Shmanic platform
             return false;
         }
     }
     // Import the logging method
     SHLog::import($this->params->get('log_group', 'shlog'));
     // Container to store project specific import results
     $results = array();
     // Use the default SQL configuration
     $config = SHFactory::getConfig();
     // Get all the importable projects
     if ($imports = json_decode($config->get('platform.import'))) {
         foreach ($imports as $project) {
             // Attempts to import the specified project
             $results[] = shImport(trim($project));
         }
     }
     // Fire the onAfterInitialise for all the registered imports/projects
     JDispatcher::getInstance()->trigger('onSHPlaformInitialise');
     if (in_array(false, $results, true)) {
         // One of the specific projects failed to import
         return false;
     }
     // Everything imported successfully
     return true;
 }
Example #2
0
}
// Get the J! Framework and CMS libraries.
require_once JPATH_LIBRARIES . '/import.php';
require_once JPATH_LIBRARIES . '/cms.php';
// Load the configuration if one doesn't exist
class_exists('JConfig') or (require_once JPATH_CONFIGURATION . '/configuration.php');
// Configure error reporting to maximum for CLI output.
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load Library language
$lang = JFactory::getLanguage();
// Try the Shmanic LDAP file in the current language (without allowing the loading of the file in the default language)
$lang->load('files_cli_shmanic_ldap', JPATH_SITE, null, false, false) || $lang->load('files_cli_shmanic_ldap', JPATH_SITE, null, true);
// Get the Shmanic platform and Ldap libraries.
require_once JPATH_PLATFORM . '/shmanic/import.php';
shImport('ldap');
/**
 * This script will fetch all the LDAP users in the specified
 * base DN and synchronise them to the Joomla! database.
 *
 * @package  Shmanic.CLI
 * @since    2.0
 */
class LdapCron extends JApplicationCli
{
    /**
     * Entry point for the script.
     *
     * @return  void
     *
     * @since   2.0