diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index f7af625b3..33ad21d84 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -27,6 +27,7 @@ require_once "ProvisioningHelper.php"; require_once "GoogleAnalytics.php"; require_once "Timezone.php"; require_once "Auth.php"; +require_once __DIR__ . '/services/SoundCloudService.php'; require_once __DIR__.'/forms/helpers/ValidationTypes.php'; require_once __DIR__.'/forms/helpers/CustomDecorators.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index c58986f1e..cde876b35 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -38,7 +38,8 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('billing')) ->add(new Zend_Acl_Resource('thank-you')) ->add(new Zend_Acl_Resource('provisioning')) - ->add(new Zend_Acl_Resource('player')); + ->add(new Zend_Acl_Resource('player')) + ->add(new Zend_Acl_Resource('soundcloud')); /** Creating permissions */ $ccAcl->allow('G', 'index') @@ -72,6 +73,7 @@ $ccAcl->allow('G', 'index') ->allow('A', 'systemstatus') ->allow('A', 'preference') ->allow('A', 'player') + ->allow('A', 'soundcloud') ->allow('S', 'thank-you') ->allow('S', 'billing'); diff --git a/airtime_mvc/application/configs/airtime-conf.php b/airtime_mvc/application/configs/airtime-conf.php index b23a37334..ad939b2ce 100644 --- a/airtime_mvc/application/configs/airtime-conf.php +++ b/airtime_mvc/application/configs/airtime-conf.php @@ -1,6 +1,6 @@ array ( diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index 814429f76..d6f5159e2 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -103,6 +103,9 @@ return array ( 'BaseCloudFile' => 'airtime/om/BaseCloudFile.php', 'BaseCloudFilePeer' => 'airtime/om/BaseCloudFilePeer.php', 'BaseCloudFileQuery' => 'airtime/om/BaseCloudFileQuery.php', + 'BaseThirdPartyTrackReferences' => 'airtime/om/BaseThirdPartyTrackReferences.php', + 'BaseThirdPartyTrackReferencesPeer' => 'airtime/om/BaseThirdPartyTrackReferencesPeer.php', + 'BaseThirdPartyTrackReferencesQuery' => 'airtime/om/BaseThirdPartyTrackReferencesQuery.php', 'CcBlock' => 'airtime/CcBlock.php', 'CcBlockPeer' => 'airtime/CcBlockPeer.php', 'CcBlockQuery' => 'airtime/CcBlockQuery.php', @@ -239,4 +242,8 @@ return array ( 'CloudFilePeer' => 'airtime/CloudFilePeer.php', 'CloudFileQuery' => 'airtime/CloudFileQuery.php', 'CloudFileTableMap' => 'airtime/map/CloudFileTableMap.php', + 'ThirdPartyTrackReferences' => 'airtime/ThirdPartyTrackReferences.php', + 'ThirdPartyTrackReferencesPeer' => 'airtime/ThirdPartyTrackReferencesPeer.php', + 'ThirdPartyTrackReferencesQuery' => 'airtime/ThirdPartyTrackReferencesQuery.php', + 'ThirdPartyTrackReferencesTableMap' => 'airtime/map/ThirdPartyTrackReferencesTableMap.php', ); \ No newline at end of file diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php index f89a5472e..27c1a0071 100644 --- a/airtime_mvc/application/configs/conf.php +++ b/airtime_mvc/application/configs/conf.php @@ -89,7 +89,17 @@ class Config { $CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries']; $CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries']; - + + $globalAirtimeConfig = "/etc/airtime-saas/".$CC_CONFIG['dev_env']."/airtime.conf"; + if (!file_exists($globalAirtimeConfig)) { + // If the dev env specific airtime.conf doesn't exist default + // to the production airtime.conf + $globalAirtimeConfig = "/etc/airtime-saas/production/airtime.conf"; + } + $globalAirtimeConfigValues = parse_ini_file($globalAirtimeConfig, true); + $CC_CONFIG['soundcloud-client-id'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_id']; + $CC_CONFIG['soundcloud-client-secret'] = $globalAirtimeConfigValues['soundcloud']['soundcloud_client_secret']; + if(isset($values['demo']['demo'])){ $CC_CONFIG['demo'] = $values['demo']['demo']; } diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 490800085..97d7ccb4d 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -717,11 +717,6 @@ class ApiController extends Zend_Controller_Action // fields $file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder"); $file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id); - - if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) { - $id = $file->getId(); - Application_Model_Soundcloud::uploadSoundcloud($id); - } } public function mediaMonitorSetupAction() diff --git a/airtime_mvc/application/controllers/ErrorController.php b/airtime_mvc/application/controllers/ErrorController.php index 8a62d9ea6..315da3ac9 100644 --- a/airtime_mvc/application/controllers/ErrorController.php +++ b/airtime_mvc/application/controllers/ErrorController.php @@ -71,6 +71,7 @@ class ErrorController extends Zend_Controller_Action { * 404 error - route or controller */ public function error404Action() { + Logging::info("404!"); $this->_helper->viewRenderer('error-404'); $this->getResponse()->setHttpResponseCode(404); $this->view->message = _('Page not found.'); diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 212d57521..07bbc109b 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -265,8 +265,9 @@ class LibraryController extends Zend_Controller_Action } } - //SOUNDCLOUD MENU OPTIONS - if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) { + // SOUNDCLOUD MENU OPTION + $soundcloudService = new SoundcloudService(); + if ($type === "audioclip" && $soundcloudService->hasAccessToken()) { //create a menu separator $menu["sep1"] = "-----------"; @@ -274,20 +275,16 @@ class LibraryController extends Zend_Controller_Action //create a sub menu for Soundcloud actions. $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array()); - $scid = $file->getSoundCloudId(); - - if ($scid > 0) { - $url = $file->getSoundCloudLinkToFile(); - $menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url); - } - - if (!is_null($scid)) { + $serviceId = $soundcloudService->getServiceId($id); + if (!is_null($file) && $serviceId != 0) { + $menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $baseUrl."soundcloud/view-on-sound-cloud/id/{$id}"); $text = _("Re-upload to SoundCloud"); } else { $text = _("Upload to SoundCloud"); } - $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."library/upload-file-soundcloud/id/{$id}"); + // TODO: reimplement how this works + $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."soundcloud/upload/id/{$id}"); } if (empty($menu)) { @@ -525,33 +522,4 @@ class LibraryController extends Zend_Controller_Action Logging::info($e->getMessage()); } } - - public function uploadFileSoundcloudAction() - { - $id = $this->_getParam('id'); - Application_Model_Soundcloud::uploadSoundcloud($id); - // we should die with ui info - $this->_helper->json->sendJson(null); - } - - public function getUploadToSoundcloudStatusAction() - { - $id = $this->_getParam('id'); - $type = $this->_getParam('type'); - - if ($type == "show") { - $show_instance = new Application_Model_ShowInstance($id); - $this->view->sc_id = $show_instance->getSoundCloudFileId(); - $file = $show_instance->getRecordedFile(); - $this->view->error_code = $file->getSoundCloudErrorCode(); - $this->view->error_msg = $file->getSoundCloudErrorMsg(); - } elseif ($type == "file") { - $file = Application_Model_StoredFile::RecallById($id); - $this->view->sc_id = $file->getSoundCloudId(); - $this->view->error_code = $file->getSoundCloudErrorCode(); - $this->view->error_msg = $file->getSoundCloudErrorMsg(); - } else { - Logging::warn("Trying to upload unknown type: $type with id: $id"); - } - } } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 3a0df1505..401e58af9 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -62,14 +62,9 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::setTuneinPartnerKey($values["tunein_partner_key"]); Application_Model_Preference::setTuneinPartnerId($values["tunein_partner_id"]); - /*Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]); - Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]); - Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]); - Application_Model_Preference::SetSoundCloudPassword($values["SoundCloudPassword"]); - Application_Model_Preference::SetSoundCloudTags($values["SoundCloudTags"]); - Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]); - Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]); - Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]);*/ + // SoundCloud Preferences + Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]); + Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]); $this->view->statusMsg = "
true is returned; otherwise
+ * an aggregated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ThirdPartyTrackReferencesPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ThirdPartyTrackReferencesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbService();
+ break;
+ case 2:
+ return $this->getDbForeignId();
+ break;
+ case 3:
+ return $this->getDbFileId();
+ break;
+ case 4:
+ return $this->getDbStatus();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ThirdPartyTrackReferences'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ThirdPartyTrackReferences'][$this->getPrimaryKey()] = true;
+ $keys = ThirdPartyTrackReferencesPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbService(),
+ $keys[2] => $this->getDbForeignId(),
+ $keys[3] => $this->getDbFileId(),
+ $keys[4] => $this->getDbStatus(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistoryTemplate) {
+ $result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ThirdPartyTrackReferencesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbService($value);
+ break;
+ case 2:
+ $this->setDbForeignId($value);
+ break;
+ case 3:
+ $this->setDbFileId($value);
+ break;
+ case 4:
+ $this->setDbStatus($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ThirdPartyTrackReferencesPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbService($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbForeignId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbStatus($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ThirdPartyTrackReferencesPeer::ID)) $criteria->add(ThirdPartyTrackReferencesPeer::ID, $this->id);
+ if ($this->isColumnModified(ThirdPartyTrackReferencesPeer::SERVICE)) $criteria->add(ThirdPartyTrackReferencesPeer::SERVICE, $this->service);
+ if ($this->isColumnModified(ThirdPartyTrackReferencesPeer::FOREIGN_ID)) $criteria->add(ThirdPartyTrackReferencesPeer::FOREIGN_ID, $this->foreign_id);
+ if ($this->isColumnModified(ThirdPartyTrackReferencesPeer::FILE_ID)) $criteria->add(ThirdPartyTrackReferencesPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(ThirdPartyTrackReferencesPeer::STATUS)) $criteria->add(ThirdPartyTrackReferencesPeer::STATUS, $this->status);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ $criteria->add(ThirdPartyTrackReferencesPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ThirdPartyTrackReferences (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbService($this->getDbService());
+ $copyObj->setDbForeignId($this->getDbForeignId());
+ $copyObj->setDbFileId($this->getDbFileId());
+ $copyObj->setDbStatus($this->getDbStatus());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ThirdPartyTrackReferences Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ThirdPartyTrackReferencesPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ThirdPartyTrackReferencesPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistoryTemplate object.
+ *
+ * @param CcPlayoutHistoryTemplate $v
+ * @return ThirdPartyTrackReferences The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setDbFileId(NULL);
+ } else {
+ $this->setDbFileId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistoryTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addThirdPartyTrackReferences($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistoryTemplate object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplate(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcPlayoutHistoryTemplate === null && ($this->file_id !== null) && $doQuery) {
+ $this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->file_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcPlayoutHistoryTemplate->addThirdPartyTrackReferencess($this);
+ */
+ }
+
+ return $this->aCcPlayoutHistoryTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->service = null;
+ $this->foreign_id = null;
+ $this->file_id = null;
+ $this->status = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcPlayoutHistoryTemplate instanceof Persistent) {
+ $this->aCcPlayoutHistoryTemplate->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ThirdPartyTrackReferencesPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesPeer.php b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesPeer.php
new file mode 100644
index 000000000..20e769677
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesPeer.php
@@ -0,0 +1,1014 @@
+ array ('DbId', 'DbService', 'DbForeignId', 'DbFileId', 'DbStatus', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbService', 'dbForeignId', 'dbFileId', 'dbStatus', ),
+ BasePeer::TYPE_COLNAME => array (ThirdPartyTrackReferencesPeer::ID, ThirdPartyTrackReferencesPeer::SERVICE, ThirdPartyTrackReferencesPeer::FOREIGN_ID, ThirdPartyTrackReferencesPeer::FILE_ID, ThirdPartyTrackReferencesPeer::STATUS, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SERVICE', 'FOREIGN_ID', 'FILE_ID', 'STATUS', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'service', 'foreign_id', 'file_id', 'status', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ThirdPartyTrackReferencesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbService' => 1, 'DbForeignId' => 2, 'DbFileId' => 3, 'DbStatus' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbService' => 1, 'dbForeignId' => 2, 'dbFileId' => 3, 'dbStatus' => 4, ),
+ BasePeer::TYPE_COLNAME => array (ThirdPartyTrackReferencesPeer::ID => 0, ThirdPartyTrackReferencesPeer::SERVICE => 1, ThirdPartyTrackReferencesPeer::FOREIGN_ID => 2, ThirdPartyTrackReferencesPeer::FILE_ID => 3, ThirdPartyTrackReferencesPeer::STATUS => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SERVICE' => 1, 'FOREIGN_ID' => 2, 'FILE_ID' => 3, 'STATUS' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'service' => 1, 'foreign_id' => 2, 'file_id' => 3, 'status' => 4, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ThirdPartyTrackReferencesPeer::getFieldNames($toType);
+ $key = isset(ThirdPartyTrackReferencesPeer::$fieldKeys[$fromType][$name]) ? ThirdPartyTrackReferencesPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ThirdPartyTrackReferencesPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ThirdPartyTrackReferencesPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ThirdPartyTrackReferencesPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ThirdPartyTrackReferencesPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ThirdPartyTrackReferencesPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ThirdPartyTrackReferencesPeer::ID);
+ $criteria->addSelectColumn(ThirdPartyTrackReferencesPeer::SERVICE);
+ $criteria->addSelectColumn(ThirdPartyTrackReferencesPeer::FOREIGN_ID);
+ $criteria->addSelectColumn(ThirdPartyTrackReferencesPeer::FILE_ID);
+ $criteria->addSelectColumn(ThirdPartyTrackReferencesPeer::STATUS);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.service');
+ $criteria->addSelectColumn($alias . '.foreign_id');
+ $criteria->addSelectColumn($alias . '.file_id');
+ $criteria->addSelectColumn($alias . '.status');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ThirdPartyTrackReferences
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ThirdPartyTrackReferencesPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ThirdPartyTrackReferencesPeer::populateObjects(ThirdPartyTrackReferencesPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement directly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ThirdPartyTrackReferences $obj A ThirdPartyTrackReferences object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ ThirdPartyTrackReferencesPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ThirdPartyTrackReferences object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ThirdPartyTrackReferences) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ThirdPartyTrackReferences object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ThirdPartyTrackReferencesPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ThirdPartyTrackReferences Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ThirdPartyTrackReferencesPeer::$instances[$key])) {
+ return ThirdPartyTrackReferencesPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (ThirdPartyTrackReferencesPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ ThirdPartyTrackReferencesPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to third_party_track_references
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ThirdPartyTrackReferencesPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ThirdPartyTrackReferencesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ThirdPartyTrackReferencesPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ThirdPartyTrackReferencesPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ThirdPartyTrackReferences object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ThirdPartyTrackReferencesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ThirdPartyTrackReferencesPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ThirdPartyTrackReferencesPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ThirdPartyTrackReferencesPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ThirdPartyTrackReferencesPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcPlayoutHistoryTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ThirdPartyTrackReferencesPeer::FILE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ThirdPartyTrackReferences objects pre-filled with their CcPlayoutHistoryTemplate objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ThirdPartyTrackReferences objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistoryTemplate(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ }
+
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ $startcol = ThirdPartyTrackReferencesPeer::NUM_HYDRATE_COLUMNS;
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ThirdPartyTrackReferencesPeer::FILE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ThirdPartyTrackReferencesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ThirdPartyTrackReferencesPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ThirdPartyTrackReferencesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ThirdPartyTrackReferencesPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ThirdPartyTrackReferences) to $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addThirdPartyTrackReferences($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ThirdPartyTrackReferencesPeer::FILE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ThirdPartyTrackReferences objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ThirdPartyTrackReferences objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ }
+
+ ThirdPartyTrackReferencesPeer::addSelectColumns($criteria);
+ $startcol2 = ThirdPartyTrackReferencesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcPlayoutHistoryTemplatePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ThirdPartyTrackReferencesPeer::FILE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ThirdPartyTrackReferencesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ThirdPartyTrackReferencesPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ThirdPartyTrackReferencesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ThirdPartyTrackReferencesPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistoryTemplate rows
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ThirdPartyTrackReferences) to the collection in $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addThirdPartyTrackReferences($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ThirdPartyTrackReferencesPeer::DATABASE_NAME)->getTable(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseThirdPartyTrackReferencesPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \ThirdPartyTrackReferencesTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return ThirdPartyTrackReferencesPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ThirdPartyTrackReferences or Criteria object.
+ *
+ * @param mixed $values Criteria or ThirdPartyTrackReferences object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ThirdPartyTrackReferences object
+ }
+
+ if ($criteria->containsKey(ThirdPartyTrackReferencesPeer::ID) && $criteria->keyContainsValue(ThirdPartyTrackReferencesPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ThirdPartyTrackReferencesPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ThirdPartyTrackReferences or Criteria object.
+ *
+ * @param mixed $values Criteria or ThirdPartyTrackReferences object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ThirdPartyTrackReferencesPeer::ID);
+ $value = $criteria->remove(ThirdPartyTrackReferencesPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ThirdPartyTrackReferencesPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ThirdPartyTrackReferences object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the third_party_track_references table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ThirdPartyTrackReferencesPeer::TABLE_NAME, $con, ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ThirdPartyTrackReferencesPeer::clearInstancePool();
+ ThirdPartyTrackReferencesPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ThirdPartyTrackReferences or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ThirdPartyTrackReferences object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ThirdPartyTrackReferencesPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ThirdPartyTrackReferences) { // it's a model object
+ // invalidate the cache for this single object
+ ThirdPartyTrackReferencesPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ $criteria->add(ThirdPartyTrackReferencesPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ ThirdPartyTrackReferencesPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ThirdPartyTrackReferencesPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ThirdPartyTrackReferences object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ThirdPartyTrackReferences $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ThirdPartyTrackReferencesPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ThirdPartyTrackReferencesPeer::DATABASE_NAME, ThirdPartyTrackReferencesPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return ThirdPartyTrackReferences
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = ThirdPartyTrackReferencesPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ $criteria->add(ThirdPartyTrackReferencesPeer::ID, $pk);
+
+ $v = ThirdPartyTrackReferencesPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @return ThirdPartyTrackReferences[]
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(ThirdPartyTrackReferencesPeer::DATABASE_NAME);
+ $criteria->add(ThirdPartyTrackReferencesPeer::ID, $pks, Criteria::IN);
+ $objs = ThirdPartyTrackReferencesPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BaseThirdPartyTrackReferencesPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseThirdPartyTrackReferencesPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesQuery.php b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesQuery.php
new file mode 100644
index 000000000..29ac981eb
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseThirdPartyTrackReferencesQuery.php
@@ -0,0 +1,516 @@
+mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ThirdPartyTrackReferences|ThirdPartyTrackReferences[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ThirdPartyTrackReferencesPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ThirdPartyTrackReferencesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ThirdPartyTrackReferences A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ThirdPartyTrackReferences A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "service", "foreign_id", "file_id", "status" FROM "third_party_track_references" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ThirdPartyTrackReferences();
+ $obj->hydrate($row);
+ ThirdPartyTrackReferencesPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ThirdPartyTrackReferences|ThirdPartyTrackReferences[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ThirdPartyTrackReferences[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the service column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbService('fooValue'); // WHERE service = 'fooValue'
+ * $query->filterByDbService('%fooValue%'); // WHERE service LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbService The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByDbService($dbService = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbService)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbService)) {
+ $dbService = str_replace('*', '%', $dbService);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::SERVICE, $dbService, $comparison);
+ }
+
+ /**
+ * Filter the query on the foreign_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbForeignId(1234); // WHERE foreign_id = 1234
+ * $query->filterByDbForeignId(array(12, 34)); // WHERE foreign_id IN (12, 34)
+ * $query->filterByDbForeignId(array('min' => 12)); // WHERE foreign_id >= 12
+ * $query->filterByDbForeignId(array('max' => 12)); // WHERE foreign_id <= 12
+ *
+ *
+ * @param mixed $dbForeignId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByDbForeignId($dbForeignId = null, $comparison = null)
+ {
+ if (is_array($dbForeignId)) {
+ $useMinMax = false;
+ if (isset($dbForeignId['min'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FOREIGN_ID, $dbForeignId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbForeignId['max'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FOREIGN_ID, $dbForeignId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FOREIGN_ID, $dbForeignId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileId(1234); // WHERE file_id = 1234
+ * $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcPlayoutHistoryTemplate()
+ *
+ * @param mixed $dbFileId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByDbFileId($dbFileId = null, $comparison = null)
+ {
+ if (is_array($dbFileId)) {
+ $useMinMax = false;
+ if (isset($dbFileId['min'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::FILE_ID, $dbFileId, $comparison);
+ }
+
+ /**
+ * Filter the query on the status column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStatus('fooValue'); // WHERE status = 'fooValue'
+ * $query->filterByDbStatus('%fooValue%'); // WHERE status LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbStatus The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function filterByDbStatus($dbStatus = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbStatus)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbStatus)) {
+ $dbStatus = str_replace('*', '%', $dbStatus);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ThirdPartyTrackReferencesPeer::STATUS, $dbStatus, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplate object
+ *
+ * @param CcPlayoutHistoryTemplate|PropelObjectCollection $ccPlayoutHistoryTemplate The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
+ {
+ if ($ccPlayoutHistoryTemplate instanceof CcPlayoutHistoryTemplate) {
+ return $this
+ ->addUsingAlias(ThirdPartyTrackReferencesPeer::FILE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
+ } elseif ($ccPlayoutHistoryTemplate instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ThirdPartyTrackReferencesPeer::FILE_ID, $ccPlayoutHistoryTemplate->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcPlayoutHistoryTemplate() only accepts arguments of type CcPlayoutHistoryTemplate or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ThirdPartyTrackReferences $thirdPartyTrackReferences Object to remove from the list of results
+ *
+ * @return ThirdPartyTrackReferencesQuery The current query, for fluid interface
+ */
+ public function prune($thirdPartyTrackReferences = null)
+ {
+ if ($thirdPartyTrackReferences) {
+ $this->addUsingAlias(ThirdPartyTrackReferencesPeer::ID, $thirdPartyTrackReferences->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/services/CalendarService.php b/airtime_mvc/application/services/CalendarService.php
index ed879e90d..098aeaa74 100644
--- a/airtime_mvc/application/services/CalendarService.php
+++ b/airtime_mvc/application/services/CalendarService.php
@@ -55,23 +55,6 @@ class Application_Service_CalendarService
"icon" => "overview",
"url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
}
-
- //recorded show can be uploaded to soundcloud
- if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
- $scid = $ccFile->getDbSoundcloudId();
-
- if ($scid > 0) {
- $menu["soundcloud_view"] = array(
- "name" => _("View on Soundcloud"),
- "icon" => "soundcloud",
- "url" => $ccFile->getDbSoundcloudLinkToFile());
- }
-
- $text = is_null($scid) ? _('Upload to SoundCloud') : _('Re-upload to SoundCloud');
- $menu["soundcloud_upload"] = array(
- "name"=> $text,
- "icon" => "soundcloud");
- }
} else {
$menu["content"] = array(
"name"=> _("Show Content"),
diff --git a/airtime_mvc/application/services/SoundCloudService.php b/airtime_mvc/application/services/SoundCloudService.php
new file mode 100644
index 000000000..ec36ec5c1
--- /dev/null
+++ b/airtime_mvc/application/services/SoundCloudService.php
@@ -0,0 +1,164 @@
+ "license",
+ "getDefaultSoundCloudSharingType" => "sharing"
+ );
+
+ /**
+ * Initialize the service
+ */
+ public function __construct() {
+ $CC_CONFIG = Config::getConfig();
+ // FIXME: These values are hardcoded into conf.php right now...
+ // we should move these to a global config file
+ $clientId = $CC_CONFIG['soundcloud-client-id'];
+ $clientSecret = $CC_CONFIG['soundcloud-client-secret'];
+ $baseUrl = $CC_CONFIG['baseUrl'] . ":" . $CC_CONFIG['basePort'];
+ $redirectUri = 'http://' . $baseUrl . '/soundcloud/redirect';
+
+ $this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri);
+ $accessToken = Application_Model_Preference::getSoundCloudRequestToken();
+ if (!empty($accessToken)) {
+ $this->_client->setAccessToken($accessToken);
+ }
+ }
+
+ // TODO: upload functionality will be moved to python, this is just for testing
+ /**
+ * Upload the file with the given identifier to SoundCloud
+ *
+ * @param int $fileId the local CcFiles identifier
+ *
+ * @throws Soundcloud\Exception\InvalidHttpResponseCodeException
+ * thrown when the upload fails for any reason
+ */
+ public function upload($fileId) {
+ $file = Application_Model_StoredFile::RecallById($fileId);
+ try {
+ $track = json_decode($this->_client->post('tracks', $this->_buildTrackArray($file)));
+ parent::_createTrackReference($fileId, $track);
+ } catch(Soundcloud\Exception\InvalidHttpResponseCodeException $e) {
+ Logging::info("Invalid request: " . $e->getMessage());
+ // We should only get here if we have an access token, so attempt to refresh
+ $this->accessTokenRefresh();
+ }
+ }
+
+ /**
+ * Build a parameter array for the track being uploaded to SoundCloud
+ *
+ * @param $file Application_Model_StoredFile the file being uploaded
+ *
+ * @return array the track array to send to SoundCloud
+ */
+ private function _buildTrackArray($file) {
+ $trackArray = array(
+ 'track[title]' => $file->getName(),
+ // TODO: verify that S3 uploads work
+ 'track[asset_data]' => '@'.$file->getFilePaths()[0]
+ );
+
+ foreach($this->_SOUNDCLOUD_PREF_FUNCTIONS as $func => $param) {
+ $val = Application_Model_Preference::$func();
+ if (!empty($val)) {
+ $trackArray["track[$param]"] = $val;
+ }
+ }
+
+ return $trackArray;
+ }
+
+ /**
+ * Given a CcFiles identifier for a file that's been uploaded to SoundCloud,
+ * return a link to the remote file
+ *
+ * @param int $fileId the local CcFiles identifier
+ *
+ * @return string the link to the remote file
+ */
+ public function getLinkToFile($fileId) {
+ $serviceId = $this->getServiceId($fileId);
+ // If we don't find a record for the file we'll get 0 back for the id
+ if ($serviceId == 0) { return ''; }
+ $track = json_decode($this->_client->get('tracks/'. $serviceId));
+ return $track->permalink_url;
+ }
+
+ /**
+ * Check whether an access token exists for the SoundCloud client
+ *
+ * @return bool true if an access token exists, otherwise false
+ */
+ public function hasAccessToken() {
+ $accessToken = $this->_client->getAccessToken();
+ return !empty($accessToken);
+ }
+
+ /**
+ * Get the SoundCloud authorization URL
+ *
+ * @return string the authorization URL
+ */
+ public function getAuthorizeUrl() {
+ // Pass the current URL in the state parameter in order to preserve it
+ // in the redirect. This allows us to create a singular script to redirect
+ // back to any station the request comes from.
+ $url = urlencode('http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
+ return $this->_client->getAuthorizeUrl(array("state" => $url));
+ }
+
+ /**
+ * Request a new access token from SoundCloud and store it in CcPref
+ *
+ * @param $code string exchange authorization code for access token
+ */
+ public function requestNewAccessToken($code) {
+ // Get a non-expiring access token
+ $response = $this->_client->accessToken($code, $postData = array('scope' => 'non-expiring'));
+ $accessToken = $response['access_token'];
+ Application_Model_Preference::setSoundCloudRequestToken($accessToken);
+ }
+
+ /**
+ * Regenerate the SoundCloud client's access token
+ *
+ * @throws Soundcloud\Exception\InvalidHttpResponseCodeException
+ * thrown when attempting to regenerate a stale token
+ */
+ public function accessTokenRefresh() {
+ assert($this->hasAccessToken());
+ try {
+ $accessToken = $this->_client->getAccessToken();
+ $this->_client->accessTokenRefresh($accessToken);
+ } catch(Soundcloud\Exception\InvalidHttpResponseCodeException $e) {
+ // If we get here, then that means our token is stale, so remove it
+ // Because we're using non-expiring tokens, we shouldn't get here (!)
+ Application_Model_Preference::setSoundCloudRequestToken("");
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/services/ThirdPartyService.php b/airtime_mvc/application/services/ThirdPartyService.php
new file mode 100644
index 000000000..48e882a44
--- /dev/null
+++ b/airtime_mvc/application/services/ThirdPartyService.php
@@ -0,0 +1,120 @@
+filterByDbService($this->_SERVICE_NAME)
+ ->findOneByDbFileId($fileId);
+ if (is_null($ref)) {
+ $ref = new ThirdPartyTrackReferences();
+ }
+ $ref->setDbService($this->_SERVICE_NAME);
+ $ref->setDbForeignId($track->id);
+ $ref->setDbFileId($fileId);
+ $ref->setDbStatus($track->state);
+ $ref->save();
+ }
+
+ /**
+ * Remove a ThirdPartyTrackReferences from the database.
+ * This is necessary if the track was removed from the service
+ * or the foreign id in our database is incorrect
+ *
+ * @param $fileId int local CcFiles identifier
+ *
+ * @throws Exception
+ * @throws PropelException
+ */
+ public function removeTrackReference($fileId) {
+ $ref = ThirdPartyTrackReferencesQuery::create()
+ ->filterByDbService($this->_SERVICE_NAME)
+ ->findOneByDbFileId($fileId);
+ $ref->delete();
+ }
+
+ /**
+ * Given a CcFiles identifier for a file that's been uploaded to a third-party service,
+ * return the third-party identifier for the remote file
+ *
+ * @param int $fileId the local CcFiles identifier
+ *
+ * @return int the service foreign identifier
+ */
+ public function getServiceId($fileId) {
+ $ref = ThirdPartyTrackReferencesQuery::create()
+ ->filterByDbService($this->_SERVICE_NAME)
+ ->findOneByDbFileId($fileId); // There shouldn't be duplicates!
+ return is_null($ref) ? 0 : $ref->getDbForeignId();
+ }
+
+ /**
+ * Given a CcFiles identifier for a file that's been uploaded to a third-party service,
+ * return a link to the remote file
+ *
+ * @param int $fileId the local CcFiles identifier
+ *
+ * @return string the link to the remote file
+ */
+ public function getLinkToFile($fileId) {
+ $serviceId = $this->getServiceId($fileId);
+ return $serviceId > 0 ? $this->_THIRD_PARTY_TRACK_URI . $serviceId : '';
+ }
+
+ /**
+ * Check whether an OAuth access token exists for the third-party client
+ *
+ * @return bool true if an access token exists, otherwise false
+ */
+ abstract function hasAccessToken();
+
+ /**
+ * Get the OAuth authorization URL
+ *
+ * @return string the authorization URL
+ */
+ abstract function getAuthorizeUrl();
+
+ /**
+ * Request a new OAuth access token from a third-party service and store it in CcPref
+ *
+ * @param $code string exchange authorization code for access token
+ */
+ abstract function requestNewAccessToken($code);
+
+ /**
+ * Regenerate the third-party client's OAuth access token
+ */
+ abstract function accessTokenRefresh();
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/upgrade/Upgrades.php b/airtime_mvc/application/upgrade/Upgrades.php
index 9468753d6..adb54002c 100644
--- a/airtime_mvc/application/upgrade/Upgrades.php
+++ b/airtime_mvc/application/upgrade/Upgrades.php
@@ -1,5 +1,25 @@
filterByKeystr('system_version')
- ->findOne();
+ ->filterByKeystr('system_version')
+ ->findOne();
$airtime_version = $pref->getValStr();
return $airtime_version;
}
-
- /**
+
+ /**
* This function checks to see if this class can perform an upgrade of your version of Airtime
* @return boolean True if we can upgrade your version of Airtime.
*/
public function checkIfUpgradeSupported()
- {
+ {
if (!in_array(AirtimeUpgrader::getCurrentVersion(), $this->getSupportedVersions())) {
return false;
}
return true;
}
-
+
protected function toggleMaintenanceScreen($toggle)
{
if ($toggle)
@@ -51,7 +71,7 @@ abstract class AirtimeUpgrader
}*/
}
}
-
+
/** Implement this for each new version of Airtime */
abstract public function upgrade();
}
@@ -437,3 +457,49 @@ class AirtimeUpgrader2512 extends AirtimeUpgrader
}
}
+
+class AirtimeUpgrader2513 extends AirtimeUpgrader
+{
+ protected function getSupportedVersions() {
+ return array (
+ '2.5.12'
+ );
+ }
+
+ public function getNewVersion() {
+ return '2.5.13';
+ }
+
+ public function upgrade($dir = __DIR__) {
+ Cache::clear();
+ assert($this->checkIfUpgradeSupported());
+
+ $newVersion = $this->getNewVersion();
+
+ try {
+ $this->toggleMaintenanceScreen(true);
+ Cache::clear();
+
+ // Begin upgrade
+ $airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
+ $values = parse_ini_file($airtimeConf, true);
+
+ $username = $values['database']['dbuser'];
+ $password = $values['database']['dbpass'];
+ $host = $values['database']['host'];
+ $database = $values['database']['dbname'];
+
+ passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_"
+ .$newVersion."/upgrade.sql $database 2>&1 | grep -v -E \"will create implicit sequence|will create implicit index\"");
+
+ Application_Model_Preference::SetAirtimeVersion($newVersion);
+ Cache::clear();
+
+ $this->toggleMaintenanceScreen(false);
+ } catch(Exception $e) {
+ $this->toggleMaintenanceScreen(false);
+ throw $e;
+ }
+ }
+}
+
diff --git a/airtime_mvc/application/views/scripts/error/error-404.phtml b/airtime_mvc/application/views/scripts/error/error-404.phtml
new file mode 100644
index 000000000..a63d44af8
--- /dev/null
+++ b/airtime_mvc/application/views/scripts/error/error-404.phtml
@@ -0,0 +1,18 @@
+
+
+
+
+ try {
- $response = json_decode($soundcloud->get('me'), true);
-} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
- exit($e->getMessage());
-}
-
-### POST
-
-$comment = <<<EOH
-<comment>
- <body>Yeah!</body>
-</comment>
-EOH;
-
-try {
- $response = json_decode(
- $soundcloud->post(
- 'tracks/1/comments',
- $comment,
- array(CURLOPT_HTTPHEADER => array('Content-Type: application/xml'))
- ),
- true
- );
-} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
- exit($e->getMessage());
-}
-
-### PUT
-
-$track = <<<EOH
-<track>
- <downloadable>true</downloadable>
-</track>
-EOH;
-
-try {
- $response = json_decode(
- $soundcloud->put(
- 'tracks/1',
- $track,
- array(CURLOPT_HTTPHEADER => array('Content-Type: application/xml'))
- ),
- true
- );
-} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
- exit($e->getMessage());
-}
-
-### DELETE
-
-try {
- $response = json_decode($soundcloud->delete('tracks/1'), true);
-} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
- exit($e->getMessage());
-}
-
-### DOWNLOAD TRACK
-
-try {
- $track = $soundcloud->download(1337);
-} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
- exit($e->getMessage());
-}
-
-// do something clever with $track. Save to file perhaps?
-
-## Feedback and questions
-
-Found a bug or missing a feature? Don't hesitate to create a new issue here on GitHub. Or contact me [directly](https://github.com/mptre).
-
-Also make sure to check out the official [documentation](https://github.com/soundcloud/api/wiki/) and the join [Google Group](https://groups.google.com/group/soundcloudapi?pli=1) in order to stay updated.
-
-## License
-
-Copyright (c) 2011 Anton Lindqvist
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/airtime_mvc/library/soundcloud-api/Services/Soundcloud.php b/airtime_mvc/library/soundcloud-api/Services/Soundcloud.php
deleted file mode 100644
index 9eba8eade..000000000
--- a/airtime_mvc/library/soundcloud-api/Services/Soundcloud.php
+++ /dev/null
@@ -1,737 +0,0 @@
-
- * @copyright 2010 Anton Lindqvist