/**
  * Returns a new UcConfigurationQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param   UcConfigurationQuery|Criteria $criteria Optional Criteria to build the query from
  *
  * @return UcConfigurationQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof UcConfigurationQuery) {
         return $criteria;
     }
     $query = new UcConfigurationQuery(null, null, $modelAlias);
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Exemple #2
0
<?php

/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
require_once "db-settings.php";
//Require DB connection
//Retrieve settings
$query = UcConfigurationQuery::create()->find();
foreach ($query as $configSetting) {
    $settings[$configSetting->getName()] = array('id' => $configSetting->getId(), 'name' => $configSetting->getName(), 'value' => $configSetting->getValue());
}
global $websiteUrl, $emailActivation, $websiteName, $template;
//Set Settings
$emailActivation = $settings['activation']['value'];
$mail_templates_dir = "models/mail-templates/";
$websiteName = $settings['website_name']['value'];
$websiteUrl = $settings['website_url']['value'];
$emailAddress = $settings['email']['value'];
$resend_activation_threshold = $settings['resend_activation_threshold']['value'];
$emailDate = date('dmy');
$language = $settings['language']['value'];
$template = $settings['template']['value'];
global $master_account;
$master_account = -1;
$default_hooks = array("#WEBSITENAME#", "#WEBSITEURL#", "#DATE#");
$default_replace = array($websiteName, $websiteUrl, $emailDate);
if (!file_exists($language)) {
    $language = "languages/en.php";
}
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(UcConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = UcConfigurationQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Exemple #4
0
function updateConfig($id, $value)
{
    foreach ($id as $cfg) {
        $query = UcConfigurationQuery::create()->findById($cfg);
        $config = $query[0];
        $config->setValue($value[$cfg]);
        $config->save();
    }
}