/** static: applies changes suggested by objects forwarded from other nodes. */
 function saveForwardObjects($objects)
 {
     global $repository;
     if (count($objects) > 0) {
         reset($objects);
         while (list(, $obj) = each($objects)) {
             debug("saving forward object", $obj);
             $data = $obj['data'];
             switch ($obj['type']) {
                 case 'stat':
                     sotf_Statistics::addRemoteStat($data);
                     $count++;
                     break;
                 case 'rating':
                     $rating = new sotf_Rating();
                     $rating->setRemoteRating($data);
                     $count++;
                     break;
                 case 'event':
                     $repository->processPortalEvent($data);
                     break;
                 default:
                     logError("Unknown forward object type: " . $obj['type']);
             }
         }
     }
     return $count;
 }
Exemple #2
0
        $audioFiles[$i]['playtime_string'] = strftime('%M:%S', $audioFiles[$i]['play_length']);
    }
    $smarty->assign('AUDIO_FILES', $audioFiles);
    // other files
    $otherFiles = $prg->getAssociatedObjects('sotf_other_files', 'filename');
    $smarty->assign('OTHER_FILES', $otherFiles);
    // links
    $smarty->assign('LINKS', $prg->getAssociatedObjects('sotf_links', 'caption'));
    // referencing portals
    $smarty->assign('REFS', $prg->getRefs());
    // statistics
    $smarty->assign('STATS', $prg->getStats());
    // add this visit to statistics
    $prg->addStat('', "visits");
    // rating
    $rating = new sotf_Rating();
    $smarty->assign('RATING', $rating->getInstantRating($id));
    // my rating?
    $myRating = $rating->getMyRating($id);
    debug("r", $myRating);
    $smarty->assign('MY_RATING', $myRating);
    if ($page->loggedIn()) {
        // is in my playlist?
        $smarty->assign('inplaylist', sotf_UserPlaylist::contains($id));
    }
}
$db->commit();
if (sotf_Utils::getParameter('popup')) {
    $smarty->assign('POPUP', 1);
    $page->sendPopup();
} else {
Exemple #3
0
 for ($i = 0; $i < count($audioFiles); $i++) {
     $audioFiles[$i] = array_merge($audioFiles[$i], sotf_AudioFile::decodeFormatFilename($audioFiles[$i]['format']));
     $audioFiles[$i]['playtime_string'] = strftime('%M:%S', $audioFiles[$i]['play_length']);
 }
 $smarty->assign('AUDIO_FILES', $audioFiles);
 $text = $smarty->fetch('rssListen.htm');
 $properties["description"] = $text;
 $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId . '#mfiles';
 //$properties["link"]= $config['rootUrl'] . '/listen.php/audio.m3u?id=' . $prgId;
 $properties["title"] = $page->getlocalized('listen');
 //$properties["dc:date"]= $prog->get('production_date');
 $rss_writer_object->additem($properties);
 // add statistics as item
 $properties = array();
 // rating
 $rating = new sotf_Rating();
 $smarty->assign('RATING', $rating->getInstantRating($prgId));
 // referencing portals
 // $smarty->assign('REFS', $prg->getRefs());
 // statistics
 $smarty->assign('STATS', $prg->getStats());
 $text = $smarty->fetch('rssRating.htm');
 $properties["description"] = $text;
 $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId . "#stats";
 $properties["title"] = $page->getlocalized('Statistics');
 //$properties["dc:date"]= $prog->get('production_date');
 $rss_writer_object->additem($properties);
 // add links
 $properties = array();
 $links = $prg->getAssociatedObjects('sotf_links', 'caption');
 $text = '<br clear="all" />';
 /** static */
 function doUpdates()
 {
     global $db, $repository;
     debug("object updates started");
     $list = $db->getAll("SELECT * FROM sotf_to_update");
     while (list(, $item) = each($list)) {
         $db->begin(true);
         $tablename = $item['tablename'];
         $rowId = $item['row_id'];
         debug("to_update", "{$tablename}, {$rowId}");
         switch ($tablename) {
             case 'ratingUpdate':
                 $rating = new sotf_Rating();
                 $rating->updateInstant($rowId);
                 break;
             case 'sotf_stats':
                 $obj = new sotf_Statistics($rowId);
                 if ($obj->exists()) {
                     $obj->updateStats();
                 }
                 break;
             case 'updateMeta':
                 $obj = $repository->getObject($rowId);
                 if (is_object($obj)) {
                     $obj->saveMetadataFile();
                 }
                 break;
             default:
                 logError("Unknown to_update type: " . $tablename);
         }
         $db->query("DELETE FROM sotf_to_update WHERE tablename='{$tablename}' AND row_id='{$rowId}'");
         $db->commit();
     }
     debug("object updates finished");
 }
Exemple #5
0
function windowclose()

{

	if (noerror) window.close();

}

</script>



<?php 
//<body>
if ($name == 'rating') {
    $rating = new sotf_Rating();
    $obj = $repository->getObject($id);
    if ($obj->isLocal()) {
        $rating->setRating($id, $value);
        $page->alertWithErrors();
        print "</body></html>";
        exit;
    } else {
        // rating for remote object
        $rating->sendRemoteRating($obj, $value);
        exit;
    }
}
$page->forceLogin();
//var_dump($_GET);
//die();
{
	if (noerror) window.close();
}
</script>

<?php 
//<body>
//TODO: test
//$name = sotf_Utils::magicQuotes($_GET["name"]);
//$id = sotf_Utils::magicQuotes($_GET["id"]);
//$value = sotf_Utils::magicQuotes($_GET["value"]);
$name = $_GET["name"];
$id = $_GET["id"];
$value = $_GET["value"];
if ($name == 'rating') {
    $rating = new sotf_Rating();
    $rating->setRating($id, $value);
    $page->alertWithErrors();
    print "</body></html>";
    exit;
}
$page->forceLogin();
//var_dump($_GET);
//die();
print "Name=" . $name . "<br>ID=" . $id . "<br>Value=" . $value;
if ($name == "links") {
    $x = new sotf_NodeObject("sotf_links", $id);
    if ($value == 'true') {
        $x->set('public_access', 'true');
    } elseif ($value == 'false') {
        $x->set('public_access', 'false');
Exemple #7
0
        $audioFiles[$i] = array_merge($audioFiles[$i], sotf_AudioFile::decodeFormatFilename($audioFiles[$i]['format']));
    }
    $smarty->assign('AUDIO_FILES', $audioFiles);
    // other files
    $otherFiles = $prg->getAssociatedObjects('sotf_other_files', 'filename');
    $smarty->assign('OTHER_FILES', $otherFiles);
    // links
    $smarty->assign('LINKS', $prg->getAssociatedObjects('sotf_links', 'caption'));
    // referencing portals
    $smarty->assign('REFS', $prg->getRefs());
    // statistics
    $smarty->assign('STATS', $prg->getStats());
    // add this visit to statistics
    $prg->addStat('', "visits");
    // rating
    $rating = new sotf_Rating();
    $smarty->assign('RATING', $rating->getInstantRating($id));
    // my rating?
    debug("r", $rating->getMyRating($id));
    $smarty->assign('MY_RATING', $rating->getMyRating($id));
    if ($page->loggedIn()) {
        // is in my playlist?
        $smarty->assign('inplaylist', sotf_Playlist::contains($id));
    }
}
if (sotf_Utils::getParameter('popup')) {
    $smarty->assign('POPUP', 1);
    $page->sendPopup();
} else {
    $page->send();
}