Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-08-29 11:05:14 -04:00
commit 8b5f94fa9f
10 changed files with 87 additions and 21 deletions

View file

@ -35,7 +35,7 @@ class Application_Model_Email
);
} else {
$config = array(
'ssl' => 'ssl'
'ssl' => 'tls'
);
}

View file

@ -587,10 +587,14 @@ class Application_Model_Preference
}
}
public static function SetRemindMeDate()
public static function SetRemindMeDate($p_never = false)
{
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
self::setValue("remindme", $weekAfter);
if ($p_never) {
self::setValue("remindme", -1);
} else {
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
self::setValue("remindme", $weekAfter);
}
}
public static function GetRemindMeDate()
@ -1105,9 +1109,13 @@ class Application_Model_Preference
{
$today = mktime(0, 0, 0, gmdate("m"), gmdate("d"), gmdate("Y"));
$remindDate = Application_Model_Preference::GetRemindMeDate();
if ($remindDate == NULL || $today >= $remindDate) {
return true;
$retVal = false;
if ($remindDate == NULL || ($remindDate != -1 && $today >= $remindDate)) {
$retVal = true;
}
return $retVal;
}
public static function getCurrentLibraryTableSetting()

View file

@ -1006,19 +1006,21 @@ class Application_Model_StoredFile
* @param $dir_id - if this is not provided, it returns all files with full path constructed.
* @param $propelObj - if this is true, it returns array of proepl obj
*/
public static function listAllFiles($dir_id=null, $propelObj=false)
public static function listAllFiles($dir_id=null, $all, $propelObj=false)
{
$con = Propel::getConnection();
$file_exists = $all ? "" : "and f.file_exists = 'TRUE'";
if ($propelObj) {
$sql = "SELECT m.directory || f.filepath as fp"
." FROM CC_MUSIC_DIRS m"
." LEFT JOIN CC_FILES f"
." ON m.id = f.directory WHERE m.id = $dir_id and f.file_exists = 'TRUE'";
." ON m.id = f.directory WHERE m.id = $dir_id $file_exists";
} else {
$sql = "SELECT filepath as fp"
." FROM CC_FILES"
." WHERE directory = $dir_id and file_exists = 'TRUE'";
." FROM CC_FILES as f"
." WHERE f.directory = $dir_id $file_exists";
}
$rows = $con->query($sql)->fetchAll();

View file

@ -231,6 +231,25 @@ class Application_Model_User
$this->_userInstance->delete();
}
}
public function getOwnedFiles()
{
$user = $this->_userInstance;
// do we need a find call at the end here?
return $user->getCcFilessRelatedByDbOwnerId();
}
public function donateFilesTo($user)
{
$my_files = $this->getOwnedFiles();
foreach ($my_files as $file) {
$file->reassignTo($user);
}
}
public function deleteAllFiles()
{
$my_files = $this->getOwnedFiles();
}
private function createUser()
{

View file

@ -40,5 +40,8 @@ class CcFiles extends BaseCcFiles {
return $this;
}
public function reassignTo($user) {
$this->setDbOwnerId( $user->getDbId() );
}
} // CcFiles