Example #1
0
 public function deleteSource()
 {
     $sources = new Sources();
     $sources->deleteSource($this->_id);
     $settings = new SourcesSettings();
     $settings->deleteSettings($this->_id);
     $this->deleteAllItems();
 }
Example #2
0
 public static function forUser($id)
 {
     $properties = new Properties(array(Properties::KEY => $id));
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $id));
     $source_id = $properties->getProperty('stuffpress_source');
     if (!$source_id) {
         $source_id = $sources->addSource('stuffpress');
         $sources->setImported($source_id, 1);
         $properties->setProperty('stuffpress_source', $source_id);
     }
     $source = $sources->getSource($source_id);
     return new StuffpressModel($source);
 }
Example #3
0
 function updateUser($user, &$success, &$failure, &$total)
 {
     $this->logger->log("Updating data for " . $user->username, Zend_Log::INFO);
     // Assign the proper shard id
     Zend_Registry::set("shard", $user->id);
     // Get the user sources
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     if (!$sources) {
         echo "No sources found to update.\r\n";
         $this->logger->log("No sources found to update.", Zend_Log::INFO);
         die;
     }
     // Log an entry
     $this->logger->log("Updating {$user->username}", Zend_Log::INFO);
     shuffle($sources);
     $total = $total + count($sources);
     foreach ($sources as $source) {
         if ($source['service'] == 'stuffpress') {
             continue;
         }
         if (!$source['enabled']) {
             continue;
         }
         if (!is_null($this->cl_source) && $source['service'] != $this->cl_source) {
             continue;
         }
         $model = SourceModel::newInstance($source['service'], $source);
         if (!$model->isActive()) {
             echo "Skipping unactive source {$source['service']}.\r\n ";
             continue;
         }
         try {
             if ($source['imported']) {
                 echo "Updating source {$source['service']} for user {$user->username} [" . ($success + $failure) . "/{$total}] ({$source['id']})....";
                 $items = $model->updateData();
                 $model->onNewItems($items);
                 echo " found " . count($items) . " items\r\n";
             } else {
                 echo "Importing source {$source['service']} ({$source['id']}).\r\n";
                 $items = $model->importData();
             }
             $success++;
         } catch (Exception $e) {
             echo "Could not update source {$source['id']}: " . $e->getMessage();
             $this->logger->log("Could not update source {$source['id']}: " . $e->getMessage(), Zend_Log::ERR);
             echo $e->getTraceAsString();
             $failure++;
         }
     }
 }
Example #4
0
 public function indexAction()
 {
     $application = Stuffpress_Application::getInstance();
     // If we are not logged in, we have a problem
     if ($application->role != 'guest') {
         $sources = new Sources(array(Stuffpress_Db_Table::USER => $application->user->id));
         $mysources = $sources->getSources();
         if (count($mysources) > 1) {
             return $this->_forward('index', 'post', 'admin');
         } else {
             return $this->_forward('index', 'services', 'admin');
         }
     } else {
         return $this->_forward('index', 'auth', 'admin');
     }
 }
Example #5
0
 public static function addCSS($path)
 {
     if (!is_array(self::$css)) {
         self::$css = array();
     }
     array_push(self::$css, $path);
 }
 public function keywordAction()
 {
     // Action parameters
     $search = $this->getRequest()->getParam("search");
     // A bit of filtering
     $search = substr($search, 0, 50);
     // Get all the items; if we are an admin, we also get the hidden one
     $data = new Data();
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $items = array();
     foreach ($sources as $source) {
         $s = SourceModel::newInstance($source['service'], $source);
         $index = $s->getSearchIndex();
         $prefix = $s->getServicePrefix();
         $id = $s->getID();
         if ($index != '') {
             $r = $data->search($id, $prefix, $index, $search, $this->_admin);
             if ($r) {
                 $items = array_merge($items, $r);
             }
         }
     }
     // Sort the result of the search
     $sorter = new Stuffpress_SortItems();
     $sorter->sort($items, 1);
     // Prepare the common elements
     $this->common();
     // Add specifics entries
     $this->view->search = $search;
     $this->view->items = $items;
     $this->view->models = $this->getModels();
     // Set page title
     $title = $this->_properties->getProperty('title');
     $subtitle = $this->_properties->getProperty('subtitle');
     $separator = $title ? "|" : "";
     $this->view->headTitle("{$title} {$separator} Search results for {$search}");
     // Add specific styles and javascripts
     $this->view->headScript()->appendFile('js/controllers/timeline.js');
     $this->view->headLink()->appendStylesheet('style/lightbox.css');
     // Render the index
     $this->render('index');
 }
 public function alter()
 {
     if (!isset($_SESSION['logged'])) {
         return call('pages', 'home');
     } else {
         if (!isset($_GET['name'])) {
             return call('pages', 'error', 2);
         }
         $source = Sources::get($_GET['name']);
         require_once 'views/sources/alter.php';
     }
 }
 public function alter()
 {
     if (!isset($_SESSION['logged'])) {
         return call('pages', 'home');
     } else {
         if (!isset($_GET['code'])) {
             return call('pages', 'error', 2);
         }
         $sources = Sources::all();
         $requirement = Requirement::get($_GET['code']);
         require_once 'views/requirements/alter.php';
     }
 }
Example #9
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get all sources configured for that user
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $mysources = $sources->getSources();
     // If sources are configured, get the links for each source
     $links = array();
     if ($mysources) {
         foreach ($mysources as $source) {
             if (!($source['public'] && $source['enabled'])) {
                 continue;
             }
             if ($source['service'] == 'stuffpress') {
                 continue;
             }
             $model = SourceModel::newInstance($source['service']);
             $model->setSource($source);
             $link['prefix'] = $model->getServicePrefix();
             $link['url'] = $model->getServiceURL();
             $link['name'] = $model->getTitle();
             $links[] = $link;
         }
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "My 2.0 Life";
     // Prepare the view for rendering
     $this->view->links = $links;
 }
Example #10
0
 private function getAvailableSources()
 {
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $s = array();
     if ($sources) {
         foreach ($sources as $source) {
             $model = SourceModel::newInstance($source['service']);
             $model->setSource($source);
             if ($model->isStoryElement()) {
                 $s[$source['id']] = $model->getServiceName() . "(" . $model->getAccountName() . ")";
             }
         }
     }
     return $s;
 }
 private function validateSources($string)
 {
     $sources_db = new Sources();
     $sources_u = $sources_db->getSources();
     $result = array();
     $i_sources = explode(",", $string);
     foreach ($i_sources as $s) {
         if (!isset($sources_u[$s])) {
             return false;
         }
         $result[] = $s;
     }
     return $result;
 }
Example #12
0
 private function getAvailableSources()
 {
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $s = array();
     if ($sources) {
         foreach ($sources as $source) {
             $model = SourceModel::newInstance($source['service'], $source);
             $account = $model->getAccountName() ? "(" . $model->getAccountName() . ")" : "";
             $s[$source['id']] = $model->getServiceName() . $account;
         }
     }
     return $s;
 }
Example #13
0
 public function deleteItems($source_id)
 {
     $sources = new Sources();
     if (!($source = $sources->getSource($source_id))) {
         return;
     }
     $where = $this->getAdapter()->quoteInto('source_id = ?', $source_id);
     $this->delete($where);
 }
Example #14
0
 public function deleteAction()
 {
     // Get the source from the request and initialize the model
     $id = $this->_getParam('id');
     // Get the sources database
     $sources = new Sources();
     // Check if the source exists
     if (!($source = $sources->getSource($id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Check if we own the source
     if ($source['user_id'] != $this->_application->user->id) {
         return $this->_helper->json->sendJson(true);
     }
     // Instantiate a model and remove all the data
     $model = SourceModel::newInstance($source['service']);
     $model->setSource($source);
     $model->deleteItems();
     // Delete the duplicated from the Data table
     $data = new Data();
     $data->deleteItems($source['id']);
     // Delete the source settings
     $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
     $properties->deleteAllProperties();
     // Delete the tags
     $tags = new Tags();
     $tags->deleteSource($source['id']);
     // Remove the source
     $sources->deleteSource($id);
     // We should also delete the associated comments
     $comments = new Comments();
     $comments->deleteComments($source['id']);
     // Forward to the list view with a success message
     return $this->_helper->json->sendJson(false);
 }
Example #15
0
				</div>
			</div>
		</div>
		
		<div id="wrapper" class="col-xs-12">
			<div id="player-playlist-parent" class="col-md-9">
				<div id="player-parent" class="span12">
					<?php 
require_once getcwd() . "/src/Components/Player.php";
?>
				</div>
				
				<div id="playlist-parent" class="span12">
					<?php 
require_once getcwd() . "/src/Components/Playlist.php";
?>
				</div>
			</div>
			
			<div id="search-parent" class="col-md-3">
				<?php 
require_once getcwd() . "/src/Components/Search.php";
?>
			</div>
		</div>
		
		<?php 
Sources::IncludeAll();
?>
	</body>
</html>
Example #16
0
$log_root = isset($config->path->logs) ? $config->path->logs : $root . '/logs';
$logger->addWriter(new Zend_Log_Writer_Stream($log_root . '/updates.log'));
Zend_Registry::set('logger', $logger);
// Prepare models we need to access
echo "Memory usage on startup: " . memory_get_usage() . "\r\n";
$usersTable = new Users();
// Get the user
$user = $usersTable->getUserFromUsername($cl_user);
if (!$user || $user->is_suspended) {
    echo "User {$user->username} is suspended.\r\n";
    $logger->log("User {$user->username} is suspended.\r\n", Zend_Log::INFO);
    die;
}
Zend_Registry::set("shard", $user->id);
// Get the user sources
$sourcesTable = new Sources();
$sources = $sourcesTable->getSources();
if (!$sources) {
    echo "No sources found to update.\r\n";
    $logger->log("No sources found to update.", Zend_Log::INFO);
    die;
}
// Log an entry
$logger->log("Updating {$user->username}", Zend_Log::INFO);
shuffle($sources);
$success = 0;
$failure = 0;
$total = count($sources);
foreach ($sources as $source) {
    if ($source['service'] == 'stuffpress') {
        continue;
Example #17
0
<?php

Sources::AddCSS("src/Player/Search/Search.css");
Sources::AddJS("src/Player/Search/Search.js");
?>

<div id="search-parent-margin">
	<h3 id="search-title">Youtube Search</h3>

	<div id="search-input" class="col-md-12">
		<input id="search-text" type="text" placeholder="Search Query or Video URL" class="form-control" />
		<span id="search-button" class="glyphicon glyphicon-search" title="Search"></span>
	</div>

	<div id="results" class="col-md-12">
	</div>
	
	<hr class="clear-both" />
</div>
Example #18
0
 protected function getModels()
 {
     $sources = new Sources();
     $s = $sources->getSources();
     $models = array();
     if ($s) {
         foreach ($s as $source) {
             $model = SourceModel::newInstance($source['service'], $source);
             $models[$source['id']] = $model;
         }
     }
     return $models;
 }
Example #19
0
<?php

Sources::AddJS("src/Player/Player.js");
Sources::AddJS("src/Player/Audio/Audio.js");
Sources::AddJS("src/Player/Controls/Controls.js");
Sources::AddJS("src/Player/Search/Search.js");
Sources::AddJS("src/Player/Video/Video.js");
Sources::AddJS("lib/css-emoticons/javascripts/jquery.cssemoticons.js");
Sources::AddCSS("src/Player/Player.css");
Sources::AddCSS("src/Player/Controls/Controls.css");
Sources::AddCSS("src/Player/Search/Search.css");
Sources::AddCSS("src/Player/Video/Video.css");
Sources::AddCSS("lib/css-emoticons/stylesheets/jquery.cssemoticons.css");
Sources::AddJS("src/Chat/Chat.js");
Sources::AddJS("src/Chat/emoticons/emoticons.js");
Sources::AddCSS("src/Chat/Chat.css");
?>
<div align="center" class="embed-responsive embed-responsive-16by9">
	<video id="video" class="embed-responsive-item" webkit-playsinline preload="none">
		Your browser does not support the video tag.
	</video>
	
	<canvas id="audio-visualizer"></canvas>
	
	<audio id="audio"></audio>
	
	<div id="video-overlay">
		<img id="large-play-icon" class="large-video-icon" src="Images/Play.png" />
		<img id="large-loading-icon" class="large-video-icon" src="Images/Loading.gif" />
		
		<div id="chat-container" class="col-md-12">
 private function process($source, $target)
 {
     $this->_logger->log("Processing pingback from {$source} for {$target}", Zend_Log::INFO);
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $source);
     curl_setopt($curl, CURLOPT_HEADER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_USERAGENT, 'Storytlr/1.0');
     curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
     $response = curl_exec($curl);
     $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     curl_close($curl);
     if ($http_code != 200) {
         $this->_logger->log("Failed to get content for {$source}", Zend_Log::DEBUG);
         return;
     }
     // Parse the source page for microformats content
     $parser = new Parser($response);
     $output = $parser->parse();
     $this->_logger->log("Parsed output: " . var_export($output, true), Zend_Log::DEBUG);
     // Extract relevant data
     $hcards = array();
     $hentries = array();
     $this->processItems($output["items"], $hcards, $hentries);
     $this->_logger->log("Extracted hcards: " . var_export($hcards, true), Zend_Log::DEBUG);
     $this->_logger->log("Extracted hentries: " . var_export($hentries, true), Zend_Log::DEBUG);
     // Lookup if existing entry
     preg_match('/(?P<source>\\d+)\\-(?P<item>\\d+)\\.html$/', $target, $matches);
     $this->_logger->log("Matches: " . var_export($matches, true), Zend_Log::DEBUG);
     $source_id = $matches["source"];
     $item_id = $matches["item"];
     // Get the source and the user owning it
     $data = new Data();
     $sources = new Sources();
     $users = new Users();
     // Does it relate to an item ?
     if ($source_id && $item_id) {
         $s = $sources->getSource($source_id);
         $i = $data->getItem($source_id, $item_id);
         if ($s && $i) {
             $user = $users->getUser($s['user_id']);
         }
     }
     // Otherwise, can we relate to a user ?
     if (!$user) {
         $user = $this->lookupUser($target);
     }
     // No user ? We have to giveup
     if (!$user) {
         throw new Exception('Failed to find corresponding storytlr user.');
     }
     // Is this a h-entry ?
     if (count($hentries) > 0) {
         $hentry = $hentries[0];
         if (count($hentry["author"]) > 0) {
             $hcard = $hentry["author"][0];
         }
     }
     // If no hcard yet (maybe there was no h-entry, we grab the top-level one
     if (!$hcard && count($hcards) > 0) {
         $hcard = $hcards[0];
     }
     // Find the published date
     if ($hentry && $hentry["published"]) {
         $timestamp = strtotime($hentry["published"]);
     }
     // If no timestamp, we fallback to now
     if (!$timestamp) {
         $timestamp = time();
     }
     // Add the mention to the database
     try {
         $mentions = new Mentions();
         $mentions->addMention($source_id, $item_id, $user->id, $source, $hentry["title"], $hcard["name"], $hcard["url"], "", $hcard["avatar"], $timestamp);
     } catch (Exception $e) {
         $this->_logger->log("Exception when storing mention: " . $e->getMessage(), Zend_Log::ERR);
         return;
     }
     // Send an email alert to owner
     try {
         $on_comment = $this->_properties->getProperty('on_comment');
         if ($on_comment) {
             Stuffpress_Emails::sendMentionEmail($user->email, $user->username, $hcard["name"], $hcard["url"], $hentry["title"], $source, $target);
         }
     } catch (Exception $e) {
         $this->_logger->log("Sending mention notification exception: " . $e->getMessage(), Zend_Log::ERR);
     }
 }
Example #21
0
 public function excelAction()
 {
     // Get the request parameters
     $id = $this->_getParam('id');
     // Get the requested source
     $sources = new Sources();
     if (!($source = $sources->getSource($id))) {
         throw new Stuffpress_Exception("Unknown source id {$id}");
     }
     // Are we the owner of the source
     if ($source['user_id'] != $this->_application->user->id) {
         throw new Stuffpress_Exception("You are not authorized to download this source");
     }
     // Get the source meta data
     $model = SourceModel::newInstance($source['service']);
     $model->setSource($source);
     $service = $model->getServiceName();
     $desc = $model->getServiceDescription();
     // Get the actual data to backup
     $data = new Data();
     $items = $data->getAllItems($source['id']);
     // This is not a layout or rendered page
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     // Start the writer to Excel
     require_once 'PHPExcel.php';
     require_once 'PHPExcel/Writer/Excel2007.php';
     $objPHPExcel = new PHPExcel();
     // Set properties
     $objPHPExcel->getProperties()->setCreator("storytlr.com");
     $objPHPExcel->getProperties()->setLastModifiedBy("storytlr.com");
     $objPHPExcel->getProperties()->setTitle("Backup of {$this->_application->user->username}'s {$service} account");
     //$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
     $objPHPExcel->getProperties()->setDescription($desc);
     // Add some data
     $objPHPExcel->setActiveSheetIndex(0);
     // Write the column titles
     $keys = array_keys($items[0]->getBackup());
     for ($i = 0; $i < count($keys); $i++) {
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, $keys[$i]);
     }
     // Write the data
     for ($i = 0; $i < count($items); $i++) {
         $item = $items[$i]->getBackup();
         for ($j = 0; $j < count($keys); $j++) {
             $value = $item[$keys[$j]];
             if ($value) {
                 $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($j, $i + 2)->setValueExplicit("'{$value}", PHPExcel_Cell_DataType::TYPE_STRING);
             }
         }
     }
     // Rename sheet
     $objPHPExcel->getActiveSheet()->setTitle($service);
     // Save Excel 2007 file
     $root = Zend_Registry::get("root");
     $key = Stuffpress_Token::create(6);
     $file = "{$service}-{$this->_application->user->username}-[{$key}].xls";
     $path = $root . "/public/files/{$file}";
     $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
     $objWriter->save($path);
     $this->_redirect($this->_base . "/files/{$file}");
 }
 /**
  * 给定一个节点,返回该节点对应string name
  * @param Node $node
  * @return base node name string
  */
 public static function getNodeStringName($node)
 {
     if (!$node instanceof Node) {
         return null;
     }
     $type = $node->getType();
     switch ($type) {
         case "Expr_Variable":
         case "Scalar_String":
         case "Scalar_LNumber":
         case "Scalar_DNumber":
             if ($node->name) {
                 return $node->name;
             }
             $names = $node->getSubNodeNames();
             foreach ($names as $name) {
                 return $node->{$name};
             }
             break;
             //负数
         //负数
         case "Expr_UnaryMinus":
             $names = $node->getSubNodeNames();
             //print_r($node->getSubNodeNames());
             foreach ($names as $name) {
                 return "-" . NodeUtils::getNodeStringName($node->{$name});
             }
             break;
             //arg name
         //arg name
         case "Arg":
             return NodeUtils::getNodeStringName($node->value);
             break;
             //param name
         //param name
         case "Param":
             return $node->name;
             break;
         case "Name":
             $names = $node->getSubNodeNames();
             //print_r($node->getSubNodeNames());
             foreach ($names as $name) {
                 foreach ($node->{$name} as $parts) {
                     return $parts;
                 }
             }
             break;
             //$a[],$[a]$a[]][]
         //$a[],$[a]$a[]][]
         case "Expr_ArrayDimFetch":
             //处理GLOBALS
             if ($node->var->name == "GLOBALS") {
                 return $node->dim->value;
             }
             //不处理_GET _POST等
             $userInput = Sources::getUserInput();
             if (in_array($node->var->name, $userInput)) {
                 return $node->var->name;
             }
             $names = $node->getSubNodeNames();
             $temp = "";
             foreach ($names as $name) {
                 if ($name == "dim") {
                     if ($node->{$name}) {
                         $temp .= "[" . NodeUtils::getNodeStringName($node->{$name}) . "]";
                     } else {
                         $temp .= "[]";
                     }
                 } else {
                     $temp .= NodeUtils::getNodeStringName($node->{$name});
                 }
             }
             return $temp;
             break;
             //数组dim
         //数组dim
         case "Expr_ConstFetch":
             $names = $node->getSubNodeNames();
             //print_r($names);
             foreach ($names as $name) {
                 return NodeUtils::getNodeStringName($node->{$name});
             }
             break;
             //$this->property对象属性
         //$this->property对象属性
         case "Expr_PropertyFetch":
             $names = $node->getSubNodeNames();
             $ret = '';
             foreach ($names as $name) {
                 $ret .= NodeUtils::getNodeStringName($node->{$name}) . ":";
             }
             $ret .= $node->name;
             return $ret;
             break;
         default:
             break;
     }
     return "";
 }
Example #23
0
 public function addAction()
 {
     if (!$this->getRequest()->isPost()) {
         return $this->_helper->json->sendJson(true);
     }
     $form = $this->getForm();
     if (!$form->isValid($_POST)) {
         return $this->_helper->json->sendJson($form->getErrorArray());
     }
     // Get the values and proceed
     $values = $form->getValues();
     $source_id = $values['source'];
     $item_id = $values['item'];
     $name = $values['name'];
     $email = $values['email'];
     $website = $values['website'];
     $comment = $values['comment'];
     $options = $values['options'];
     $timestamp = time();
     $notify = @in_array('notify', $options) ? 1 : 0;
     // Get the source and the user owning it
     $data = new Data();
     $sources = new Sources();
     $users = new Users();
     // Does the source exist ?
     if (!($source = $sources->getSource($source_id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Does the item exists?
     if (!($item = $data->getItem($source_id, $item_id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Does the user exist ?
     if (!($user = $users->getUser($source['user_id']))) {
         return $this->_helper->json->sendJson(true);
     }
     // Validate the website URL
     $matches = array();
     if (!preg_match_all("/^http/", $website, $matches)) {
         $website = "http://{$website}";
     }
     // Add the comment to the database
     $comments = new Comments();
     $comments->addComment($source_id, $item_id, $comment, $name, $email, $website, $timestamp, $notify);
     // Send an email alert to owner
     $on_comment = $this->_properties->getProperty('on_comment');
     $owner = $this->_application->user && $this->_application->user->email == $email ? true : false;
     if ($on_comment && !$owner) {
         $slug = $item->getSlug();
         Stuffpress_Emails::sendCommentEmail($user->email, $user->username, $name, $email, $comment, $slug);
     }
     // Send email alerts to everyone else (skip owner and current submiter)
     $subscribers = $comments->getSubscriptions($source_id, $item_id);
     foreach ($subscribers as $subscriber) {
         if ($subscriber['email'] == $user->email || $subscriber['email'] == $email) {
             continue;
         }
         Stuffpress_Emails::sendCommentNotifyEmail($subscriber['email'], $subscriber['name'], $name, $comment, $source_id, $item_id);
     }
     // Ok send the result
     return $this->_helper->json->sendJson(false);
 }
 public function __construct()
 {
     $this->sourcesArr = Sources::getUserInput();
 }
Example #25
0
/* ----- Code to be executed ----- */
// Fetch the user
$udb = new Users();
if (!($user = $udb->getUser($user_id))) {
    die("No such user with id {$user_id}");
}
// Ask for confirmation
fwrite(STDOUT, "Are you sure to delete user {$user->username} ({$user->email}) ? Type 'yes': ");
$answer = trim(fgets(STDIN));
if ($answer != 'yes') {
    die("Operation aborted, nothing was deleted.\r\n");
}
// Assign the shard for the database
Zend_Registry::set("shard", $user->id);
// Fetch all sources and delete them
$sdb = new Sources();
$sources = $sdb->getSources();
// Delete all sources and associated items
if ($sources && count($sources) > 0) {
    foreach ($sources as $source) {
        // Instantiate a model and remove all the data
        $model = SourceModel::newInstance($source['service']);
        $model->setSource($source);
        $model->deleteItems();
        // Delete the duplicated from the Data table
        $data = new Data();
        $data->deleteItems($source['id']);
        // Delete the source settings
        $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
        $properties->deleteAllProperties();
        // Remove the source
Example #26
0
	public function setImported($bool) {
		$sources = new Sources();
		$sources->setImported($this->_source['id'], $bool);
	}
Example #27
0
<?php

Sources::AddJS("src/Playlist/jquery.sortable.min.js");
Sources::AddCSS("src/Playlist/Playlist.css");
Sources::AddJS("src/Playlist/Playlist.js");
?>

<div id="playlist-container">
	<h3 id="current-playlist-title">Playlist:
		<select id="playlist-list" class="form-control">
		</select>

		<span id="playlist-new" class="glyphicon glyphicon-plus" title="New Playlist"></span>		
	</h3>
	
	<span id="playlist-mode" class="glyphicon glyphicon-random" title="Mode"></span>
	
	<hr />
	
	<div id="playlist-overlay-container">		
		<ol id="playlist" class="list-unstyled collapse" aria-expanded="true">
		</ol>
		
		<div id="playlist-overlay" data-toggle="collapse" data-target="#playlist"></div>
	</div>
	
	<span id="currentPlaylist-parent" data-toggle="collapse" data-target="#playlist">
		<a id="hide-show-play-list" class="glyphicon glyphicon-chevron-down"></a>
	</span>
</div>