Example #1
0
 /**
  *
  * @param object $query
  * @return string Rendered string
  * @api
  */
 public function run($query)
 {
     $configurationPath = 'Mia3.Expose.Pagination';
     $this->query = $query;
     $this->settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $configurationPath);
     $this->total = $this->query->count();
     $limits = $this->handleLimits();
     $pagination = $this->handlePagination();
     $content = $this->viewHelperVariableContainer->getView()->renderPartial('Pagination', NULL, array('pagination' => $pagination, 'limits' => $limits));
     $this->addToBlock('bottom', $content);
 }
 public function executeBlank()
 {
     if ($this->getApplication()->getRequest()->hasPostValues() == TRUE) {
         $this->createDatabaseConfigFile();
         $configurationManager = new ConfigurationManager();
         if ($configurationManager->checkConnection() == TRUE) {
             $this->updateRoutesFile($configurationManager->getHomePage());
             $this->page->addVar('file_created', TRUE);
         } else {
             $this->page->addVar('file_created', FALSE);
             unlink("app/config/database.xml");
         }
     }
 }
 /**
  * Méthode qui crée l'unique instance de la classe
  * si elle n'existe pas encore puis la retourne.
  *
  * @param void
  * @return Singleton
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new ConfigurationManager();
     }
     return self::$_instance;
 }
 static function instance()
 {
     if (self::$instance == null) {
         $config = new ConfigurationManager('config.xml');
         self::$instance = $config;
     }
     return self::$instance;
 }
Example #5
0
 public function connect()
 {
     $conn = null;
     try {
         $conn = new PDO(ConfigurationManager::getInstance()->getDatabaseUrl(), ConfigurationManager::getInstance()->getDatabaseUser(), ConfigurationManager::getInstance()->getDatabasePassword());
         $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         $this->logger->error("Cannot connect to database: " . $e->getMessage());
     }
     return $conn;
 }
Example #6
0
 private static function executeHandlers()
 {
     $config = ConfigurationManager::instance();
     if ($handlers = $config->section('handlers')) {
         $uri = $_SERVER['REQUEST_URI'];
         foreach ($handlers as $handler) {
             $pattern = $handler->requestPattern();
             $route = new HandlerRoute($pattern);
             if ($route->match($uri) !== false) {
                 $handler->handleRequest();
                 break;
             }
         }
     }
 }
Example #7
0
 function handleRequest()
 {
     $config = ConfigurationManager::instance();
     $uri = $_SERVER['REQUEST_URI'];
     if (list($route, $matches) = $config->routes->match($uri)) {
         if (!array_key_exists('controller', $route->args)) {
             echo 'No "controller" attribute specified for route.';
             print_r($route);
             exit;
         }
         if (!array_key_exists('action', $route->args)) {
             echo 'No "action" attribute specified for route.';
             print_r($route);
             exit;
         }
         $rd = new RouteDispatcher();
         $rd->dispatch($route, $matches);
     } else {
         header("HTTP/1.0 404 Not Found");
         header("Status: 404 Not Found");
         die('No match found');
     }
 }
Example #8
0
require_once '../config.php';
require_once PATH_SDK_ROOT . 'Core/ServiceContext.php';
require_once PATH_SDK_ROOT . 'DataService/DataService.php';
require_once PATH_SDK_ROOT . 'PlatformService/PlatformService.php';
require_once PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php';
require_once PATH_SDK_ROOT . 'QueryFilter/QueryMessage.php';
//Specify QBO or QBD
$serviceType = IntuitServicesType::QBO;
// Get App Config
$realmId = ConfigurationManager::AppSettings('RealmID');
if (!$realmId) {
    exit("Please add realm to App.Config before running this sample.\n");
}
// Prep Service Context
$requestValidator = new OAuthRequestValidator(ConfigurationManager::AppSettings('AccessToken'), ConfigurationManager::AppSettings('AccessTokenSecret'), ConfigurationManager::AppSettings('ConsumerKey'), ConfigurationManager::AppSettings('ConsumerSecret'));
$serviceContext = new ServiceContext($realmId, $serviceType, $requestValidator);
if (!$serviceContext) {
    exit("Problem while initializing ServiceContext.\n");
}
// Prep Data Services
$dataService = new DataService($serviceContext);
if (!$dataService) {
    exit("Problem while initializing DataService.\n");
}
// Build a query
$oneQuery = new QueryMessage();
$oneQuery->sql = "SELECT";
$oneQuery->entity = "Customer";
$oneQuery->orderByClause = "FamilyName";
$oneQuery->startposition = "1";
Example #9
0
 /**
  * Instanciates the configuration once
  * To avoid using Singletons. Checks if the static property $config
  * exits before re-instanciating config.
  * 
  * @return ConfigurationManager the config
  */
 private function loadConfig()
 {
     if (isset(self::$config)) {
         return self::$config;
     } else {
         $config = new ConfigurationManager(array(BUSINESS . '../conf/apps.ini', BUSINESS . 'conf/' . $this->module . '.ini'), new INIConfigurationParser());
         $config->merge();
         self::$config = $config;
         return $config;
     }
 }
Example #10
0
	    }; 
	 
	    // bind form using 'ajaxForm' 
	    $('#config_form').ajaxForm(options); 
	}); 
	// post-submit callback 
	function showResponse(responseText, statusText)  { 
	    $('.error').fadeTo("slow", 0.7);
	    $('.error').fadeTo("slow", 1);
	    $('.success').fadeTo("slow", 0.7);
	    $('.success').fadeTo("slow", 1);
	} 
	 
	</script>
<?php 
        $configManager = new ConfigurationManager();
        echo "<h2>" . T_("Settings") . " -- " . T_("Manage Configuration") . "</h2>\n";
        echo "<div class=\"content\">\n";
        $prev_group_id = null;
        $token = md5(uniqid(rand(), true));
        $_SESSION['security_token'] = $token;
        if ($message != null && isset($_POST['no_js'])) {
            if ($success) {
                $classMsg = "success";
            } else {
                $classMsg = "error";
            }
            echo "<div id=\"messagesDiv\"><p class=\"{$classMsg}\">" . $message . "</p></div>";
        }
        ?>
	<div id="config_manager">
Example #11
0
                 }
                 if (in_array('UseQuickKeys', $UserColumns)) {
                     $AlterSQL = "alter table " . $DatabaseTables['User'] . " drop column UseQuickKeys";
                     @mysql_query($AlterSQL, $Connection);
                 }
             }
         }
     }
     // Close the database connection
     @mysql_close($Connection);
 }
 // If the database was upgraded successfully, save all parameters to the conf/database.php file
 if ($Context->WarningCollector->Count() == 0) {
     // Save database settings
     $DBFile = $RootDirectory . 'conf/database.php';
     $DBManager = new ConfigurationManager($Context);
     $DBManager->GetSettingsFromFile($DBFile);
     // Only make these changes if the settings haven't been defined already
     if ($DBManager->GetSetting('DATABASE_HOST') == '') {
         $DBManager->DefineSetting("DATABASE_HOST", $DBHost, 1);
         $DBManager->DefineSetting("DATABASE_NAME", $DBName, 1);
         $DBManager->DefineSetting("DATABASE_USER", $DBUser, 1);
         $DBManager->DefineSetting("DATABASE_PASSWORD", $DBPass, 1);
         $DBManager->SaveSettingsToFile($DBFile);
         // Save the general settings as well (now that we know this person is authenticated to
         // a degree - knowing the database access params).
         $SettingsFile = $RootDirectory . 'conf/settings.php';
         $SettingsManager = new ConfigurationManager($Context);
         $SettingsManager->DefineSetting('APPLICATION_PATH', $RootDirectory, 1);
         $SettingsManager->DefineSetting('DATABASE_PATH', $RootDirectory . 'conf/database.php', 1);
         $SettingsManager->DefineSetting('LIBRARY_PATH', $RootDirectory . 'library/', 1);
Example #12
0
        // Mark this extension as enabled using a convenience method.
        AddConfigurationSetting($Context, 'NOTIFY_SETUP');
    }
}
if (!array_key_exists('NOTIFY_VERSION', $Configuration)) {
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_ALL', '1');
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_DISCUSSION', '1');
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_CATEGORY', '1');
    AddConfigurationSetting($Context, 'NOTIFY_VERSION', '1.0.0');
    if (!mysql_query("ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Category` ADD `Subscribeable` INT( 1 ) NOT NULL ;", $Context->Database->Connection)) {
        $Errors = 1;
    }
}
if ($Context->Configuration['NOTIFY_VERSION'] < '1.2.0') {
    AddConfigurationSetting($Context, 'NOTIFY_AUTO_ALL', '0');
    $cm = new ConfigurationManager($Context);
    $cm->GetSettingsFromFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php');
    $cm->DefineSetting('NOTIFY_VERSION', '1.2.0');
    $cm->SaveSettingsToFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php');
}
function CheckNotifySyntax($Context, $Method, $SelectID)
{
    switch ($Method) {
        case 'ALL':
            if ($SelectID == 0) {
                return true;
            } else {
                return false;
            }
        case 'CATEGORY':
            if ($SelectID > 0) {
Example #13
0
 /**
  * Return view variables as json string
  * @return unknown_type
  */
 public function asJson($methodName = "")
 {
     $this->response->setContentType('application/json');
     if ($methodName == "") {
         $bt = debug_backtrace();
         $methodName = $bt[1]['function'];
     }
     $this->actionName = $methodName;
     $json = json_encode($this->variables[$this->actionName]);
     $request = ConfigurationManager::getInstance()->getRequest();
     if ($request->has('jsonpMethod')) {
         $json = $request->get('jsonpMethod') . '(' . $json . ')';
     }
     return $json;
 }
Example #14
0
 function __construct()
 {
     $this->config = ConfigurationManager::instance();
 }
Example #15
0
 /**
  * start publishing
  * @param  function $progressCallback callback function for tracking publish progress
  * @param  function $doneCallback callback function for calling when publish complete
  * @return void
  */
 public function startPublish($progressCallback = null, $doneCallback = null)
 {
     # Copy core files
     $coreDirectoryName = ConfigurationManager::Get("profiles.{$this->getProfileName()}.coreDirectory");
     $coreDirectoryName = Utility::getCorePath($this->getAlias(), $coreDirectoryName);
     $this->ignores[] = 'public';
     Utility::copyFiles(\base_path(), $coreDirectoryName, $progressCallback, $this->getIngoresList());
     $this->ignores = \array_except($this->ignores, ['public']);
     # Copy public files
     $publicDirectoryName = ConfigurationManager::Get("profiles.{$this->getProfileName()}.publicDirectory");
     $publicDirectoryName = Utility::getPublicPath($this->getAlias(), $publicDirectoryName);
     Utility::copyFiles(\base_path('public'), $publicDirectoryName, $progressCallback, $this->getIngoresList());
     # Copy env file
     $envFileName = ConfigurationManager::Get("profiles.{$this->getProfileName()}.env");
     if ($envFileName != null && file_exists(\base_path($envFileName))) {
         @\copy(\base_path($envFileName), Utility::combinePath($coreDirectoryName, '.env'));
     }
     # Completing progress
     if (\is_callable($doneCallback)) {
         \call_user_func($doneCallback);
     }
 }
Example #16
0
require_once PATH_SDK_ROOT . 'DataService/DataService.php';
require_once PATH_SDK_ROOT . 'PlatformService/PlatformService.php';
require_once PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php';
//Specify QBO or QBD
$serviceType = IntuitServicesType::QBO;
// Get App Config
$realmId = ConfigurationManager::AppSettings('RealmID');
if (!$realmId) {
    exit("Please add realm to App.Config before running this sample.\n");
}
// Prep Service Context
$requestValidator = new OAuthRequestValidator(ConfigurationManager::AppSettings('AccessToken'), ConfigurationManager::AppSettings('AccessTokenSecret'), ConfigurationManager::AppSettings('ConsumerKey'), ConfigurationManager::AppSettings('ConsumerSecret'));
$serviceContext = new ServiceContext($realmId, $serviceType, $requestValidator);
$serviceContext->IppConfiguration->Message->Response->SerializationFormat = SerializationFormat::Json;
$serviceContext->IppConfiguration->Message->Request->SerializationFormat = SerializationFormat::Json;
$serviceContext->IppConfiguration->BaseUrl->Qbo = ConfigurationManager::BaseURLSettings(strtolower(IntuitServicesType::QBO));
$serviceContext->baseserviceURL = $serviceContext->GetBaseURL();
if (!$serviceContext) {
    exit("Problem while initializing ServiceContext.\n");
}
// Prep Data Services
$dataService = new DataService($serviceContext);
if (!$dataService) {
    exit("Problem while initializing DataService.\n");
}
$result = $dataService->Add(createTransfer());
echo showMe($result);
print_r($result);
################################################################################
# Domain Objects example                                                       #
################################################################################
Example #17
0
                // $Context->WarningCollector->Add('For some reason we couldn&#8217;t save your general settings to the '.$SettingsFile.' file.');
            }
        }
    }
    if ($Context->WarningCollector->Count() == 0) {
        if ($DBPass == '') {
            $Context->WarningCollector->Add('Your configuration contains a blank MySQL password, please note that this is a potential security risk, and not supported by Vanilla. Make a note that before you will be able to sign in, you will need to add the following line to conf/settings.php: <code>$Configuration[\'DATABASE_PASSWORD\'] = \'\';</code><p /><a href="' . $WebRoot . 'setup/installer.php?Step=3&PostBackAction=None">Continue installation</a> with these settings, or specify a different account.');
        } else {
            // Redirect to the next step (this is done so that refreshes don't cause steps to be redone)
            Redirect($WebRoot . 'setup/installer.php?Step=3&PostBackAction=None');
        }
    }
} elseif ($PostBackAction == 'User') {
    $CurrentStep = 3;
    $SettingsFile = $RootDirectory . 'conf/settings.php';
    $SettingsManager = new ConfigurationManager($Context);
    $SettingsManager->GetSettingsFromFile($SettingsFile);
    if ($SettingsManager->GetSetting('SETUP_COMPLETE') != '0') {
        $Context->WarningCollector->Add('Vanilla seems to have been installed already. You will need to remove the conf/settings.php, conf/database.php files, and all database tables in order to run the installer utility again.');
    } else {
        // Validate user inputs
        if (strip_tags($Username) != $Username) {
            $Context->WarningCollector->Add('You really shouldn&#8217;t have any html into your username.');
        }
        if (strlen($Username) > 20) {
            $Context->WarningCollector->Add('Your username is too long');
        }
        if ($Password != $ConfirmPassword) {
            $Context->WarningCollector->Add('The passwords you entered didn&#8217;t match.');
        }
        if (strip_tags($ApplicationTitle) != $ApplicationTitle) {