Exemplo n.º 1
0
 public function display()
 {
     $disp = Display::current();
     require_once 'packages/magpierss/rss_fetch.inc';
     $rss = fetch_rss('http://shortsoup.net.au/?feed=rss2&p=11');
     $disp->setValue('comments', $rss->items);
     $disp->setValue('add_comment', $rss->channel['link']);
     print_r($rss->items);
     // Include the javascript for the page
     JsRegister::current()->registerScript('home');
     //			if(Application::current()->user()->authorise('SeeingsystemSetup'))
     $disp->setValue('logged_in', true);
     //			else
     //			{
     //				$disp->setValue('login_error',$this->login_error);
     //				$login_form = Form::load('seeingsystem.views.Login');
     //				$disp->addForm($login_form);
     //			}
     $disp->setTitle('SeeingSystem - A Flickr Slideshow of Ordinary Beautiful Things');
     $disp->addView('page_content', 'seeingsystem.views.Home');
     /*
     			echo "<br />DEBUG: Home::display()<br />\n";
     			exit;
     */
     $disp->displaySiteTemplate();
 }
 public function display()
 {
     $disp = Display::current();
     $disp->setValue('page_heading', 'RocketSled Support');
     $disp->setValue('page_subheading', 'Where to get help using RocketSled');
     $disp->addView('page_content', 'sys.views.RocketSledSupport');
     $disp->displaySiteTemplate();
 }
 public function display()
 {
     $disp = Display::current();
     $disp->setTitle('Seeingsystem System Setup');
     $this->setupDisplay($disp);
     $disp->addView('page_content', 'seeingsystem.views.SeeingsystemSetup');
     $disp->displaySiteTemplate();
 }
Exemplo n.º 4
0
 public function display()
 {
     if ($this->do_display) {
         $disp = Display::current();
         $disp->addView('site_template', 'murphy.views.SiteTemplate');
         $this->setupDisplay($disp);
         $disp->displaySiteTemplate();
     }
 }
Exemplo n.º 5
0
 public function display()
 {
     $disp = Display::current();
     if ($this->map) {
         $disp->setValue('map', $this->map);
     } else {
         $form = Form::load('sys.views.rsml_test.RsmlMapForm');
         $disp->addForm($form);
     }
     $disp->addView('page_content', 'sys.views.rsml_test.RsmlMap');
     $disp->view('site_template');
 }
 /**
  * Take an array of files from a form post and copy them to the required directory
  * @param file_vars  - the $_FILES superglobal from a form post
  * @return array     - an array of file names that were uploaded
  */
 function uploadFiles($file_vars = "")
 {
     $util = FileUtility::current();
     // Get the asset group for the file
     $disp = Display::current();
     $asset_group = $disp->getValue('asset_group') . "/";
     if (!is_dir(FileUtility::UPLOAD_DIR . $asset_group)) {
         mkdir(FileUtility::UPLOAD_DIR . $asset_group);
     }
     if (!$util->uploadDone()) {
         if (!$file_vars) {
             $file_vars = $_FILES;
         }
         $pathinfo = pathinfo($file_vars['media_url']['name']);
         $extension = '.' . $pathinfo['extension'];
         $filename = $pathinfo['filename'];
         $ret = array();
         if (!empty($file_vars) && count($file_vars)) {
             foreach ($file_vars as $label => $file) {
                 // Set the filename to an md5 #
                 //$original_name = $file['name'];
                 //$file['name'] = md5($file['name']);
                 $file['name'] = str_replace(' ', '-', $filename);
                 while (file_exists(FileUtility::UPLOAD_DIR . $asset_group . $file['name'] . $extension)) {
                     $file['name'] = md5($file['name']);
                 }
                 $file['name'] = $file['name'] . $extension;
                 $error = ArrayUtility::getArrayValue($file, "error");
                 if (!$error) {
                     if (move_uploaded_file($file['tmp_name'], FileUtility::UPLOAD_DIR . $asset_group . $file['name'])) {
                         $ret[$label] = ArrayUtility::getArrayValue($file, 'name');
                     } else {
                         throw new Exception("Error uploading file " . FileUtility::UPLOAD_DIR . $asset_group . $file['name']);
                     }
                 }
             }
         }
         $util->setUploadedFiles($ret);
     } else {
         $ret = $util->uploadedFiles();
     }
     return $ret;
 }
Exemplo n.º 7
0
        public function display()
        {
            $disp = Display::current();
			$disp->setValue('tree_menu', $disp->treeMenu());

            $disp->addView('page_content', 'frost.views.cms.part.text.TextAdd');
            $form = Form::load('frost.views.cms.part.text.TextAdd');
            $form->setInputValue('module_id', Application::param('module_id'));
            $form->setInputValue('media_type', Application::param('media_type'));
            $form->setInputValue('label', 'Plain text item');
            $form->setInputValue('weight', '1000');

            $disp->setValue('module_id', Application::param('module_id'));
            $disp->setValue('login_error', $this->login_error);

            $disp->setValue('current_handler', Application::current()->handler()->getClass());
            $disp->addForm($form);
            $disp->displaySiteTemplate();
        }
Exemplo n.º 8
0
 public function display()
 {
     $disp = Display::current();
     //require_once('packages/magpierss/rss_fetch.inc');
     //$rss = fetch_rss('http://api.flickr.com/services/feeds/photos_public.gne?id=77411642@N00&lang=en-us&format=rss_200');
     //
     /*
     			if($user_id = Query::clean(Application::param('key')))
     			{
     				$params['key'] = $key;
     			}
     			else
     			{
     				$params['key'] = $system_query->fieldValue('key');
     			}
     */
     if ($fp = fopen('http://api.flickr.com/services/feeds/photos_public.gne?id=77411642@N00&tags=seeingsystem&lang=en-us&format=rss_200', 'r')) {
         $rss = '';
         // keep reading until there's nothing left
         while ($line = fread($fp, 1024)) {
             $rss .= $line;
         }
     } else {
         // an error occured when trying to open the specified url
     }
     $rss = str_replace('Uploads from kynan-stewart-hughes, tagged seeingsystem', 'SeeingSystem - A Flickr Slideshow of Ordinary Beautiful Things', $rss);
     $rss = str_replace('&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/seeing-system/&quot;&gt;kynan-stewart-hughes&lt;/a&gt; posted a photo:&lt;/p&gt;', '', $rss);
     $rss = preg_replace('/http:\\/\\/www.flickr.com\\/photos\\/seeing-system\\/([0-9]+)\\//', 'http://' . $_SERVER['HTTP_HOST'] . '/', $rss);
     $disp->setValue('rss', $rss);
     //print_r($rss->items);
     header('Content-Type: text/xml');
     /*
     Cache-Control: no-store, no-cache, must-revalidate, private, post-check=0, pre-check=0
     Pragma: no-cache
     Vary: Accept-Encoding
     Content-Encoding: gzip
     Content-Length: 4025
     Connection: close
     Content-Type: text/xml; charset=utf-8
     */
     $disp->displayPage('packages/seeingsystem/views/rss.php');
     //$disp->displaySiteTemplate();
 }
 /**
  * Return the string representation for navigation purposes
  * @param secondary_get_vars - key value pairs to be included in the GET query string
  * @param display_class      - display class (usually CSS)
  * @param display_id         - display id (the HTML id="" attribute)
  * @param display_text       - overrides the default text as provided to the constructor
  *                             of the {@link Handler} object this item points to
  * @access public
  */
 function toString($secondary_get_vars = '', $display_class = '', $display_id = '', $display_text = '', $attributes = '')
 {
     if ($display_text) {
         $name = $display_text;
     } else {
         $name = $this->displayInfoValue('text');
     }
     $link = Display::current()->hrefString($this->class_name, $secondary_get_vars);
     $description = $this->displayInfoValue('description');
     $attribute_list = '';
     if ($attributes) {
         $all = array();
         if (is_array($attributes)) {
             foreach ($attributes as $key => $value) {
                 $all[] = $key . '="' . $value . '"';
             }
             $attribute_list = ' ' . implode(' ', $all);
         } else {
             throw new Exception('The attributes passed to NavigationItem::toString must be an array, you gave me: ' . $attributes);
         }
     }
     if ($display_class) {
         $display_class = 'class="' . $display_class . '" ';
     }
     if ($display_id) {
         $display_id = ' id="' . $display_id . '" ';
     }
     if (trim($description) && !isset($attributes['title'])) {
         $title = ' title="' . htmlentities($description) . '" ';
     } else {
         if (!isset($attributes['titles'])) {
             $title = ' ';
         }
     }
     $ret = '<a href="' . $link . '" ' . $display_class . $display_id . $title . ' ' . $attribute_list . '>' . $name . '</a>';
     return $ret;
 }
Exemplo n.º 10
0
 public function display($vars)
 {
     $disp = new Display();
     if (!$vars || is_array($vars) && !count($vars)) {
         $vars = array('dumb', 'dumber');
     }
     $disp->setFilter($vars, '$$');
     if (Application::formPosted()) {
         $params = Application::post();
     } else {
         $params = '';
     }
     $disp->setValue('form_name', $this->name);
     $disp->setValue('form_action', Display::current()->hrefString($this->handler));
     foreach ($this->inputs as $inp) {
         if (!$this->clear) {
             $name = $inp->name();
             if ($inp->valueOverride()) {
                 $value = $inp->value();
             } else {
                 if ($params) {
                     $value = Form::getValueFromArray($name, $params);
                 } else {
                     $value = $inp->value();
                 }
             }
         } else {
             $value = '';
         }
         if ($inp->allowsOptions()) {
             if ($value === '' && !$this->clear) {
                 $value = $inp->selected;
             }
             $inp->setSelected($value);
             $options = $inp->generateInputObjects();
             $disp->setValue($inp->name() . '_options', $options);
         } else {
             if ($inp->getClass() == 'FileInput' || $inp->getClass() == 'ImageInput') {
                 $disp->setValue($inp->name() . '_existing_file', $inp->value());
             } else {
                 if ($inp->getClass() == 'DateInput') {
                     if ($params && $value !== '') {
                         $day = ArrayUtility::getArrayValue($value, 'day');
                         $month = ArrayUtility::getArrayValue($value, 'month');
                         $year = ArrayUtility::getArrayValue($value, 'year');
                     } else {
                         if ($value !== '') {
                             //$inp->setValue($value);
                             $day = $inp->day();
                             $month = $inp->month();
                             $year = $inp->year();
                         } else {
                             if (!$this->clear) {
                                 $day = $inp->day();
                                 $month = $inp->month();
                                 $year = $inp->year();
                             } else {
                                 $year = '';
                                 $month = '';
                                 $day = '';
                             }
                         }
                     }
                     $disp->setValue($inp->name() . '_year_value', $year);
                     $disp->setValue($inp->name() . '_month_value', $month);
                     $disp->setValue($inp->name() . '_day_value', $day);
                 } else {
                     if ($value === '' && !is_numeric($value) && !$this->clear || $inp instanceof HiddenInput && !$this->clear) {
                         $value = $inp->value();
                     }
                     $disp->setValue($inp->name() . '_value', $value);
                 }
             }
         }
     }
     $new_path = '';
     if (is_array($vars) && count($vars)) {
         $path = Application::CACHE . Form::cachePath($this->initPath()) . '.t';
         $new_path = Application::CACHE . 'dead-' . time() . '-' . Form::cachePath($this->initPath()) . '.t';
         $data = file_get_contents($path);
         foreach ($vars as $name => $value) {
             $data = str_replace('$$' . strtoupper(str_replace('-', '_', $name)) . '$$', $value, $data);
         }
         $data = preg_replace('/\\$\\$[A-Z_]*\\$\\$/', '', $data);
         @unlink($new_path);
         file_put_contents($new_path, $data);
         chmod($new_path, 0664);
         $path = $new_path;
     } else {
         $path = Application::CACHE . Form::cachePath($this->initPath()) . '.t';
     }
     foreach ($this->widgets() as $widg) {
         $widg->registerJavascript($disp);
     }
     $disp->displayPage($path);
     if ($new_path) {
         unlink($new_path);
     }
 }
Exemplo n.º 11
0
 /**
  * Static method to initialise the application
  * 
  * This method is called from {@link index.php} and inititalises the an application of
  * the class defined in {@link sys.config.php}. When developing an application with
  * RocketSled, you will usually override the Application class of an 'Application 
  * Level Package'. In order for that class to be used by RocketSled, you need to set
  * the required constant in {@link sys.config.php}, and then it will be returned by
  * {@link index.php}'s call to Application::appInit().
  *
  * The Application::appInit() function also calls several functions that setup the
  * application, which also give any overriding applications a good chance to do some
  * things they may required:
  * - {@link Application::systemSetup()}
  * - {@link Application::initUser()}
  * - {@link Application::siteNavigationInit()}
  *
  * @return Application - an initialised application class
  * @see Session,User,SiteNavigation,NavigationItem,sys.config.php
  * @access public
  * @static
  */
 public static function appInit()
 {
     Application::initSession();
     $app_class = constant('APPLICATION');
     self::$app = new $app_class();
     $ret = self::$app;
     $ret->systemSetup();
     $ret->initUser();
     $ret->siteNavigationInit();
     $ret->setRedirectionListener(Display::current(false));
     $ret->fetchRedirectedParameters();
     return $ret;
 }
 public function display()
 {
     //echo "<br />DEBUG: HERE<br />";
     header('Content-type: application/x-javascript');
     readfile("http://" . $_SERVER['HTTP_HOST'] . "/packages/seeingsystem/views/js/ss_prototype.js");
     readfile("http://" . $_SERVER['HTTP_HOST'] . "/packages/seeingsystem/views/js/ss_effects.js");
     $disp = Display::current();
     if (Application::current()->user()->authorise('SeeingsystemSetup')) {
         $disp->setValue('logged_in', true);
     } else {
         $disp->setValue('login_error', $this->login_error);
         $login_form = Form::load('seeingsystem.views.Login');
         $disp->addForm($login_form);
     }
     // Write to the log
     $fh = fopen('access_logs/access.log', 'a') or die("can't open file");
     $stringData = time() . "," . $_SERVER['HTTP_REFERER'] . "\n";
     fwrite($fh, $stringData);
     fclose($fh);
     $params = $this->getParams();
     if ($params['user_id']) {
         $disp->setValue('user_tags', $this->getFlickrTags($params['api_key'], $params['user_id']));
     } else {
         $disp->setValue('user_tags', '');
     }
     $disp->setValue('timeout_interval', $params['timeout_interval']);
     $disp->setValue('fade_speed', $params['fade_speed']);
     $disp->setValue('domain', $_SERVER['HTTP_HOST']);
     $disp->setValue('ss_key', $params['key']);
     $disp->setValue('slide_div_width', $params['width']);
     $disp->setValue('slide_div_height', $params['height']);
     $disp->setValue('api_key', $params['api_key']);
     // Change the method if there is no user and no tags
     if (!$params['user_id'] && !$params['tags']) {
         $disp->setValue('method', 'flickr.photos.getrecent');
     } else {
         $disp->setValue('method', $params['method']);
     }
     // user_id (Optional) - The NSID of the user who's photo to search.
     // If this parameter isn't passed then everybody's public photos will be searched.
     // A value of "me" will search against the calling user's photos for authenticated calls.
     $disp->setValue('user_id', $params['user_id']);
     //photoset_id (Optional) - The id of the photoset
     $disp->setValue('photoset_id', $params['photoset_id']);
     //tags (Optional) - A comma-delimited list of tags. Photos with one or more of the tags listed will be returned.
     $disp->setValue('tags', $params['tags']);
     // tag_mode (Optional) - Either 'any' for an OR combination of tags, or 'all' for an AND combination.
     // Defaults to 'any' if not specified.
     $disp->setValue('tag_mode', $params['tag_mode']);
     //sort (Optional) - The order in which to sort returned photos. Deafults to date-posted-desc.
     // The possible values are: date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc,
     // interestingness-desc, interestingness-asc, and relevance.
     $disp->setValue('sort', $params['sort']);
     //extras (Optional) - A comma-delimited list of extra information to fetch for each returned record.
     // Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format,
     // last_update, geo, tags, machine_tags.
     $disp->setValue('extras', $params['extras']);
     //content_type (Optional) - Content Type setting: 1 for photos only. 2 for screenshots only.
     // 3 for 'other' only. 4 for all types.
     $disp->setValue('content_type', '1');
     //per_page (Optional) - Number of photos to return per page. If this argument is omitted, it defaults to 100.
     // The maximum allowed value is 500.
     $disp->setValue('per_page', $params['per_page']);
     //page (Optional) - The page of results to return. If this argument is omitted, it defaults to 1.
     $disp->setValue('page', 1);
     $disp->setValue('format', $params['format']);
     //header('Content-type: application/x-javascript');
     $disp->displayPage('packages/seeingsystem/views/flickr_json_slideshow01.php');
     // Load the view that is specific to the 'display' parameter in the databse configuration. The 'default'
     // display is just a call to the init() function of the generic object.
     $disp->displayPage('packages/seeingsystem/views/flickr_json_slideshow01_' . $params['display'] . '.php');
 }
 public function setFormHandler()
 {
     Display::current()->setValue('logbook_handler', $this->getClass());
 }
 public function display()
 {
     $disp = Display::current();
     if (Application::current()->user()->authorise('SeeingsystemSetup')) {
         $disp->setValue('logged_in', true);
     } else {
         $disp->setValue('login_error', $this->login_error);
         $login_form = Form::load('seeingsystem.views.Login');
         $disp->addForm($login_form);
     }
     if (Application::param('tags')) {
         $tags = Application::param('tags');
     } else {
         $tags = 'seeingsystem';
     }
     $page = 0;
     if (Application::param('static') && Application::param('page')) {
         $page = Application::param('page');
         #
         # build the API URL to call
         #
         $params = array('api_key' => '1cd28ef9270b9dad6d02734d6a8d88a9', 'method' => 'flickr.photos.search', 'user_id' => '77411642@N00', 'tags' => $tags, 'tag_mode' => 'all', 'sort' => 'date-posted-desc', 'extras' => 'original_format', 'content_type' => '1', 'per_page' => '1', 'page' => $page, 'format' => 'php_serial');
         $rsp_obj = $this->getFlickrPhotos($params);
         #
         # display the photo title (or an error if it failed)
         #
         if ($rsp_obj['stat'] == 'ok') {
             /*
             Photo Source URLs
             -----------------
                 
             You can construct the source URL to a photo once you know its ID, server ID, farm ID and secret, as returned by many API methods.
                 
             The URL takes the following format:
                 
             http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg
             http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg
                                http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png) 
                 
             Size Suffixes:
                 
             The letter suffixes are as follows:
             s	small square 75x75
             t	thumbnail, 100 on longest side
             m	small, 240 on longest side
             -	medium, 500 on longest side
             b	large, 1024 on longest side (only exists for very large original images)
             o	original image, either a jpg, gif or png, depending on source format
                 
             Note: Original photos behave a little differently. They have their own secret (called originalsecret in responses) and a variable file extension (called originalformat in responses). These values are returned via the API only when the caller has permission to view the original size (based on a user preference and various other criteria). The values are returned by the flickr.photos.getInfo method and by any method that returns a list of photos and allows an extras parameter (with a value of original_format), such as flickr.photos.search. The flickr.photos.getSizes method, as always, will return the full original URL where permissions allow.
                 
             Example:
                 
             http://farm1.static.flickr.com/2/1418878_1e92283336_m.jpg
                 
             farm-id: 1
             server-id: 2
             photo-id: 1418878
             secret: 1e92283336
             size: m
             */
             //print_r($rsp_obj['photos']['photo'][0]);
             //Using - http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg
             $photo_id = $rsp_obj['photos']['photo'][0]['id'];
             $farm_id = $rsp_obj['photos']['photo'][0]['farm'];
             $server_id = $rsp_obj['photos']['photo'][0]['server'];
             $secret = $rsp_obj['photos']['photo'][0]['secret'];
             //$file_name = $rsp_obj['photos']['photo'][0]['title'];
             $photo_url = "http://farm{$farm_id}.static.flickr.com/{$server_id}/{$photo_id}_{$secret}.jpg";
             $size = getimagesize($photo_url);
             $width = $size[0];
             $height = $size[1];
             $top_border = (704 - $height) / 2;
             $bottom_border = (704 - $height) / 2 - 1;
             $left_border = (704 - $width) / 2;
             $right_border = (704 - $width) / 2 - 1;
             $style = "width:{$width}px;height:{$height}px;border-top:{$top_border}px solid black;border-bottom:{$bottom_border}px solid black;border-left:{$left_border}px solid black;border-right:{$right_border}px solid black;";
         } else {
             echo "Call failed!";
         }
         $disp->setValue('photo_url', $photo_url);
         $disp->setValue('style', $style);
     } else {
         $disp->setValue('photo_url', "/assets/start.jpg");
         //$disp->setValue('photo_url', "");
     }
     $disp->setTitle('Seeing System - Slideshow');
     $disp->setValue('page', ++$page);
     $disp->setValue('tags', $tags);
     $disp->addView('page_content', 'seeingsystem.views.Seeingsystem');
     $disp->displaySiteTemplate();
 }