/**
  * This function is used to create a new playlist 
  * in add video page without refreshing the page
  * 
  * @param    string    $name 
  * @param    string    $media
  */
 public function hd_ajax_add_playlist($name, $media)
 {
     global $wpdb;
     /** Get name from param */
     $p_name = addslashes(trim($name));
     /** sanitize name and get slug name */
     $p_slugname = sanitize_title($name);
     $p_description = '';
     /** Query to get last palylist order from playlist table */
     $playlist_order = getAllPlaylistCount();
     /** Query to get playlist name from playlist table if the given name is exist */
     $playlistname1 = 'SELECT playlist_name FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist WHERE playlist_name="' . $p_name . '"';
     $planame1 = $wpdb->get_row($playlistname1);
     /** Check the playlist name is already exist */
     if (count($planame1) > 0) {
         /** Display error message category already exist */
         render_error(__('Failed, category name already exist', APPTHA_VGALLERY)) . $this->get_playlist_for_dbx($media);
         return;
     }
     /** If new playlist name is exist, then create new data */
     if (!empty($p_name)) {
         /** Set palylsit details as array */
         $videoData = array('playlist_name' => $p_name, 'playlist_desc' => $p_description, 'is_publish' => 1, 'playlist_order' => $playlist_order, 'playlist_slugname' => $p_slugname);
         /** Insert the new data array into playlist table */
         $insert_plist = $wpdb->insert($wpdb->prefix . 'hdflvvideoshare_playlist', $videoData);
         /** Check data is insert into database */
         if ($insert_plist != 0) {
             /** Display success message */
             $this->render_message(__('Category', APPTHA_VGALLERY) . ' ' . $name . ' ' . __('added successfully', APPTHA_VGALLERY)) . $this->get_playlist_for_dbx($media);
         }
     }
     /** Return to new videos page */
     return;
 }
Example #2
0
/**
 * Load a partial file.
 * Partials live in the views directory and are prefixed with an underscore (ex: section/_a_partial.inc).
 * @param string $name The name of the partial without the leading underscore (ex: section/a_partial).
 * @param array $local A hash of variables to include into the local scope of the partial.
 * @return string The partial's result.
 */
function partial($name, $local = array())
{
    $name = preg_replace('#/([^/]+)$', '/_\\1', $name);
    if (($path = fe_check('views/' . $name . '.inc')) !== false) {
        extract($local);
        ob_start();
        include $path;
        return ob_get_clean();
    } else {
        render_error("No partial named {$name} found!");
    }
}
Example #3
0
 /**
  * Generate a placeholder image.
  * 
  * Using the specified sevice provide a placeholder image.
  * 
  * Placeholder Services available are described here @ref placeholders.
  *
  * To implement your service please check the @ref placeholderservices.
  * 
  * @param int $width
  *   The width of the placeholder image.
  * @param int $height
  *   The height of the placeholder image.
  * @param array $options
  *   (optional) An option array to be passed to the PHP Class handling the 
  *   placeholder service. See the placeholder service docs for details.
  * 
  * @return @e string
  *   The @e URL of the placeholder image generated with the specified service.
  * 
  * @ingroup helperfunc
  */
 public function placeholder_image($width, $height, $options = array())
 {
     $services_class = array('placehold' => 'PlaceholdImage', 'lorem_pixel' => 'LoremPixelImage');
     $service = $options['service'];
     $service = isset($service) ? $service : 'placehold';
     $service_class = $services_class[$service];
     if (class_exists($service_class)) {
         $service = new $service_class($width, $height, $options);
         return $service->url();
     } else {
         render_error("No placeholder image service called #{$service} exists!");
     }
 }
Example #4
0
function controler_send_mail()
{
    if ($_SERVER["REQUEST_METHOD"] != "POST") {
        render_error("attend un formulaire envoyé en POST!");
        exit;
    }
    $message = $_REQUEST['message'];
    if (empty($message)) {
        render_error("Le paramètre 'message' non vide est attendu");
        exit;
    }
    $resp = service_send_sms($message, 'nico');
    if ($resp == false) {
        render_error("problème lors de l'envoie du sms.");
        exit;
    }
    render_page($resp);
}
Example #5
0
 function render_template($name)
 {
     $tmp_dir = Wordless::theme_temp_path();
     $template_path = Wordless::join_paths(Wordless::theme_views_path(), "{$name}.haml");
     if (!is_file($template_path)) {
         render_error("Template missing", "<strong>Ouch!!</strong> It seems that <code>{$template_path}</code> doesn't exist!");
     }
     if (!file_exists($tmp_dir)) {
         mkdir($tmp_dir, 0760);
     }
     if (!is_writable($tmp_dir)) {
         chmod($tmp_dir, 0760);
     }
     if (is_writable($tmp_dir)) {
         $haml = new HamlParser(array('style' => 'expanded', 'ugly' => false));
         include $haml->parse($template_path, $tmp_dir);
     } else {
         render_error("Temp dir not writable", "<strong>Ouch!!</strong> It seems that the <code>{$tmp_dir}</code> directory is not writable by the server! Go fix it!");
     }
 }
Example #6
0
 /**
  * Renders a template and its contained plartials. Accepts
  * a list of locals variables which will be available inside
  * the code of the template
  *
  * @param  string $name   The template filenames (those not starting
  *                        with an underscore by convention)
  *
  * @param  array  $locals An associative array. Keys will be variables'
  *                        names and values will be variable values inside
  *                        the template
  *
  * @see php.bet/extract
  *
  */
 function render_template($name, $locals = array())
 {
     $valid_filenames = array("{$name}.html.haml", "{$name}.haml", "{$name}.html.php", "{$name}.php");
     foreach ($valid_filenames as $filename) {
         $path = Wordless::join_paths(Wordless::theme_views_path(), $filename);
         if (is_file($path)) {
             $template_path = $path;
             $arr = explode('.', $path);
             $format = array_pop($arr);
             break;
         }
     }
     if (!isset($template_path)) {
         render_error("Template missing", "<strong>Ouch!!</strong> It seems that <code>{$name}.html.haml</code> or <code>{$name}.html.php</code> doesn't exist!");
     }
     extract($locals);
     switch ($format) {
         case 'haml':
             $tmp_dir = Wordless::theme_temp_path();
             if (!file_exists($tmp_dir)) {
                 mkdir($tmp_dir, 0760);
             }
             if (!is_writable($tmp_dir)) {
                 chmod($tmp_dir, 0760);
             }
             if (is_writable($tmp_dir)) {
                 $haml = new HamlParser(array('style' => 'expanded', 'ugly' => false));
                 include $haml->parse($template_path, $tmp_dir);
             } else {
                 render_error("Temp dir not writable", "<strong>Ouch!!</strong> It seems that the <code>{$tmp_dir}</code> directory is not writable by the server! Go fix it!");
             }
             break;
         case 'php':
             include $template_path;
             break;
     }
 }
Example #7
0
function render_header()
{
    // Might want to serve this out of a canvas sometimes to test
    // out fbml, so if so then don't serve the JS stuff
    if (isset($_POST['fb_sig_in_canvas'])) {
        return;
    }
    prevent_cache_headers();
    $html = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
   <title>The Run Around</title>
    <link type="text/css" rel="stylesheet" href="style.css" />
    <script type="text/javascript" src="base.js"></script>
  ';
    $html .= '
  </head>
  <body>';
    if (is_fbconnect_enabled()) {
        ensure_loaded_on_correct_url();
    }
    $html .= '

  <div id="header">
  <div class="header_content">
  <a href="index.php" class="title"><img src="./images/runaround_logo.gif" /></a>';
    // Show either "Welcome User Name" or "Welcome Guest"
    $user = User::getLoggedIn();
    if ($user) {
        if ($user->is_facebook_user()) {
            $html .= '<div id="header-profilepic">';
            $html .= $user->getProfilePic(true);
            $html .= '</div>';
        }
        $html .= '<div id="header-account">';
        $html .= '<b>Welcome, ' . $user->getName() . '</b>';
        $html .= '<div class="account_links">';
        $html .= '<a href="account.php">Account Settings</a> | ';
        if ($user->is_facebook_user()) {
            $html .= sprintf('<a href="#" onclick="FB.Connect.logout(function() { refresh_page(); })">' . 'Logout of Facebook' . '</a>', $_SERVER['REQUEST_URI']);
        } else {
            $html .= '<a href="logout.php">Logout</a>';
        }
        $html .= '<br /></div>';
        $html .= '</div>';
    } else {
        $html .= '<div class="account">';
        $html .= 'Hello Guest | ';
        $html .= '<a href="./register.php">Register for an account</a>';
        $html .= '</div>';
    }
    $html .= '</div></div>';
    // header & header_content
    $html .= '<div class="body_content">';
    // Catch misconfiguration errors.
    if (!is_config_setup()) {
        $html .= render_error('Your configuration is not complete. ' . 'Follow the directions in <tt><b>lib/config.php.sample</b></tt> to get set up');
        $html .= '</body>';
        echo $html;
        exit;
    }
    return $html;
}
/**
 * Video Detail Page action Ends Here
 *
 * Function for adding video ends
 *
 * @param unknown $youtube_media
 * @return void|unknown
 */
function hd_getsingleyoutubevideo($youtube_media)
{
    /** Check YouTube video id is exist */
    if ($youtube_media == '') {
        /** If not then return empty */
        return;
    }
    /** Get YouTube Api key form settings */
    $setting_youtube = getPlayerColorArray();
    $youtube_api_key = $setting_youtube['youtube_key'];
    /** Check Api key is applied in settings */
    if (!empty($youtube_api_key)) {
        /** Get URL to get Youtube video details */
        $url = 'https://www.googleapis.com/youtube/v3/videos?id=' . $youtube_media . '&part=contentDetails,snippet,statistics&key=' . $youtube_api_key;
        /** Call function to get detila from the given URL */
        $video_details = hd_getyoutubepage($url);
        /** Decode json data and get details */
        $decoded_data = json_decode($video_details);
        /** return YouTube video details */
        return get_object_vars($decoded_data);
    } else {
        /** If key is not applied, then dipslya error message */
        render_error(__('Could not retrieve Youtube video information. API Key is missing', APPTHA_VGALLERY));
    }
    exitAction('');
}
Example #9
0
function ensure_loaded_on_correct_url()
{
    $current_url = get_current_url();
    $callback_url = get_callback_url();
    if (!$callback_url) {
        $error = 'You need to specify $callback_url in lib/config.php';
    }
    if (!$current_url) {
        error_log("therunaround: Unable to figure out what server the " . "user is currently on, skipping check ...");
        return;
    }
    if (get_domain($callback_url) != get_domain($current_url)) {
        // do a redirect
        $url = 'http://' . get_domain($callback_url) . $_SERVER['REQUEST_URI'];
        $error = 'You need to access your website on the same url as your callback. ' . 'Accessed at ' . get_domain($current_url) . ' instead of ' . get_domain($callback_url) . '. Redirecting to <a href="' . $url . '">' . $url . '</a>...';
        $redirect = '<META HTTP-EQUIV=Refresh CONTENT="10; URL=' . $url . '">';
    }
    if (isset($error)) {
        echo '<head>' . '<title>The Run Around</title>' . '<link type="text/css" rel="stylesheet" href="style.css" />' . isset($redirect) ? $redirect : '' . '</head>';
        echo render_error($error);
        exit;
    }
}
/**
 * Youtube function Starts Here
 * Fucntion to get YouTube video title, description
 */
function youtubeurl()
{
    /** Get Youtube video id from filepath param */
    $video_id = addslashes(trim($_GET['filepath']));
    /** Check Youtube video id is exist */
    if (!empty($video_id)) {
        /** Make an YouTube URl with the given id */
        $act[4] = 'http://www.youtube.com/watch?v=' . $video_id;
        /** Call function to get YouTube video details */
        $ydetails = hd_getsingleyoutubevideo($video_id);
        /** If details exist */
        if ($ydetails) {
            /** Get YouTube video title */
            $act[0] = $ydetails['items'][0]->snippet->title;
            /** Get YouTube video description */
            if (isset($ydetails['items'][0]->snippet->description)) {
                $act[5] = $ydetails['items'][0]->snippet->description;
            }
        } else {
            /** Display error message if details are not fetched */
            render_error(__('Could not retrieve Youtube video information', APPTHA_VGALLERY));
        }
        return $act;
    }
}
Example #11
0
define(MAIN_PATH, realpath('.'));
include_once MAIN_PATH . '/init.php';
echo render_header();
$user = User::getLoggedIn();
if (!$user) {
    echo render_logged_out_index();
    echo render_footer();
    exit;
}
$params = parse_http_args($_POST, array('time', 'miles', 'route', 'date_month', 'date_day', 'date_year', 'publish_to_facebook'));
// If the user has added a run, then handle the form post
if (!empty($params['miles'])) {
    $run = new Run($user, $params);
    if (!$run->save()) {
        echo render_error('Something went wrong while saving the run.');
    } else {
        $success = 'Added a new run!';
        // This will only be true if the checkbox on the previous page was checked
        // The feed_loading div will be killed by JS that runs once the feed form
        // is generated  (since it can sometimes take a second or two)
        if ($params['publish_to_facebook']) {
            register_feed_form_js($run);
            $success .= '<div id="feed_loading">Publishing to Facebook... ' . '<img src="http://static.ak.fbcdn.net/images/upload_progress.gif?0:25923" /></div>';
        }
        echo render_success($success);
    }
}
// Show the basic add run form on the home page
echo '<div class="clearfix">';
echo '<div class="bluebox">';
 /** Function for adding video and update status / featured. */
 public function add_newvideo()
 {
     /** Variable declaration and initialization */
     $match = '';
     /** Assign youtube URL without id */
     $youtubeVideoURL = 'http://www.youtube.com/watch?v=';
     /** Check video status is exists  */
     if (isset($this->_status) || isset($this->_featured)) {
         /** Call function to update video status */
         $this->status_update($this->_videoId, $this->_status, $this->_featured);
     }
     /** Check whether to add / update video */
     if ($this->_addnewVideo) {
         /** Get video name parameters from the request */
         $videoName = filter_input(INPUT_POST, 'name');
         /** Get video description parameters from the request */
         $videoDescription = filter_input(INPUT_POST, 'description');
         /** Get embed_code parameters from the request */
         $embedcode = filter_input(INPUT_POST, 'embed_code');
         /** Get publish parameters from the request */
         $videoPublish = filter_input(INPUT_POST, 'publish');
         /** Get feature parameters from the request */
         $videoFeatured = filter_input(INPUT_POST, 'feature');
         /** Get download parameters from the request */
         $videoDownload = filter_input(INPUT_POST, 'download');
         /** Get midrollads parameters from the request */
         $videomidrollads = filter_input(INPUT_POST, 'midrollads');
         /** Get imaad parameters from the request */
         $videoimaad = filter_input(INPUT_POST, 'imaad');
         /** Get postrollads parameters from the request */
         $videoPostrollads = filter_input(INPUT_POST, 'postrollads');
         /** Get prerollads parameters from the request */
         $videoPrerollads = filter_input(INPUT_POST, 'prerollads');
         /** Get googleadsense parameters from the request */
         $google_adsense = filter_input(INPUT_POST, 'googleadsense');
         /** Get google_adsense_value parameters from the request */
         $google_adsense_value = filter_input(INPUT_POST, 'google_adsense_value');
         /**
          * Get member id from request.
          * If not get current user id
          */
         $member_id = filter_input(INPUT_POST, 'member_id');
         if (empty($member_id)) {
             $current_user = wp_get_current_user();
             $member_id = $current_user->ID;
         }
         /** Get upload video form params */
         $video1 = filter_input(INPUT_POST, 'normalvideoform-value');
         /** Get upload hd video form params */
         $video2 = filter_input(INPUT_POST, 'hdvideoform-value');
         /** Get thumb image form params */
         $img1 = filter_input(INPUT_POST, 'thumbimageform-value');
         /** Get preview image form params */
         $img2 = filter_input(INPUT_POST, 'previewimageform-value');
         /**  Get streamer path option for rtmp streaming */
         $islive = filter_input(INPUT_POST, 'islive-value');
         /**  Get is live option for rtmp streaming */
         $streamname = filter_input(INPUT_POST, 'streamerpath-value');
         /** Get Youtube video url from request */
         $videoLinkurl = filter_input(INPUT_POST, 'youtube-value');
         /** Set video duration */
         $duration = '0:00';
         /** Get video added method */
         $video_added_method = filter_input(INPUT_POST, 'filetypevalue');
         /** Get amazon bucket params */
         $amazon_buckets = filter_input(INPUT_POST, 'amazon_buckets');
         /** Check youtbe / youtu.be / dailymotion / viddler video url is exists */
         if ($videoLinkurl != '') {
             /** Attach http with video url */
             if (preg_match('#https?://#', $videoLinkurl) === 0) {
                 $videoLinkurl = 'http://' . $videoLinkurl;
             }
             /** Remove spaces in video url */
             $act_filepath = addslashes(trim($videoLinkurl));
         }
         if ($videoLinkurl != '' && $act_filepath != '') {
             /** Set file type 1 for YouTube/ viddler /dailymotion  */
             $file_type = '1';
             /** Check video url contains youtbe / youtu.be / dailymotion / viddler */
             if (strpos($act_filepath, 'youtube') > 0 || strpos($act_filepath, 'youtu.be') > 0) {
                 /** Get youtube video id from plugin helper */
                 $youtubeVideoID = getYoutubeVideoID($act_filepath);
                 /** Get thumb URL for YouTube videos */
                 $act_opimage = $previewurl = 'http://img.youtube.com/vi/' . $youtubeVideoID . '/maxresdefault.jpg';
                 /** Get preview URL for YouTube videos */
                 $act_image = $img = 'http://img.youtube.com/vi/' . $youtubeVideoID . '/mqdefault.jpg';
                 /** Get YouTube video URL and fetch information  */
                 $act_filepath = $youtubeVideoURL . $youtubeVideoID;
                 $ydetails = hd_getsingleyoutubevideo($youtubeVideoID);
                 /** Get youTube video duration */
                 $youtube_time = $ydetails['items'][0]->contentDetails->duration;
                 if (!empty($youtube_time)) {
                     /** Convert duration into h:m:s format */
                     $di = new DateInterval($youtube_time);
                     $string = '';
                     $min = $di->i;
                     if ($di->h > 0) {
                         $string .= $di->h . ':';
                         /** Check if minutes is <= 9 while hours value is exist */
                         if ($min <= 9) {
                             $min = '0' . $min;
                         }
                     }
                     $duration = $string . $min . ':' . $di->s;
                 }
             } else {
                 if (strpos($act_filepath, 'dailymotion') > 0) {
                     /** Check video URL is dailymotion
                      * If yes, then get id from the url and get thumb, preview image */
                     $split_id = getDailymotionVideoID($act_filepath);
                     $img = $act_image = $act_opimage = $previewurl = 'http://www.dailymotion.com/thumbnail/video/' . $split_id[0];
                 } else {
                     if (strpos($act_filepath, 'viddler') > 0) {
                         /** Check video url is viddler
                          * If yes, then get id from the url and get thumb, preview image */
                         $imgstr = explode('/', $act_filepath);
                         $img = $act_image = $act_opimage = $previewurl = 'http://cdn-thumbs.viddler.com/thumbnail_2_' . $imgstr[4] . '_v1.jpg';
                     } else {
                         $img = '';
                     }
                 }
             }
         } else {
             /** Get video upload form value */
             $act_filepath1 = $_REQUEST['normalvideoform-value'];
             /** Combine upload directory path and file name */
             $act_filepath1 = $this->_srt_path . $act_filepath1;
             /**
              * Check whether custom url option is used
              * If yes, then get video url, thumb url and remove spaces
              * Else, set video url, thumb url as empty
              */
             $act_filepath = $act_optimage = '';
             if (isset($_POST['custom_url'])) {
                 $act_filepath = addslashes(trim($_POST['customurl']));
                 $act_optimage = addslashes(trim('thumb_' . $_POST['custom_url']));
             }
             /** Get ffmpeg settings value */
             $ffmpeg_path = $this->_settingsData->ffmpeg_path;
             /** Set file type as 2 for upload method */
             $file_type = '2';
             /** Get uploaded video duration from plugin helper using ffmpeg */
             $ffmpegResult = getVideoDuration($ffmpeg_path, $act_filepath1);
             $duration = $ffmpegResult[0];
             $matches = $ffmpegResult[1];
             if (!empty($duration)) {
                 /** Convert duration into hours:minutes format */
                 $duration_array = explode(':', $matches[1][0]);
                 $sec = ceil($duration_array[0] * 3600 + $duration_array[1] * 60 + $duration_array[2]);
                 $duration = $this->converttime($sec);
             }
         }
         /** If upload new image for existing video, then rename the images name */
         if ($this->_videoId) {
             $newImagePath = $this->_srt_path . $img1;
             $newPreviewImagePath = $this->_srt_path . $img2;
             $newThumbFileName = explode('_', $img1);
             $newPreviewThumbFileName = explode('_', $img2);
             /**
              * Check if added method is upload
              */
             if ($video_added_method == 2) {
                 /**
                  * Check thumb image is exst in the directory
                  * If exit then rename the new thumb image with the video id
                  */
                 if (file_exists($newImagePath)) {
                     $img1 = $this->_videoId . '_' . $newThumbFileName[1];
                     rename($newImagePath, $this->_srt_path . $img1);
                 }
                 if (file_exists($newPreviewImagePath) && !empty($newPreviewThumbFileName[1])) {
                     /**
                      * Check preview image is exst in the directory
                      * If exit then rename the new preview image with the video id
                      */
                     $img2 = $this->_videoId . '_' . $newPreviewThumbFileName[1];
                     rename($newPreviewImagePath, $this->_srt_path . $img2);
                 }
             }
             /**
              * Check if video added method is embed code
              */
             if ($video_added_method == 5) {
                 $newThumbFileName = explode('_', $img1);
                 /**
                  * Check image is exst in the directory
                  * If exit then rename the new image with the video id
                  */
                 if (file_exists($newImagePath)) {
                     $img1 = $img2 = $this->_videoId . '_' . $newThumbFileName[1];
                     rename($newImagePath, $this->_srt_path . $img1);
                 }
             }
         }
         /**
          * Get Amazon S3 bucket settings from database
          */
         $player_colors = getPlayerColorArray();
         /**
          * Check if bucket option is enabled and name is exist
          */
         if ($player_colors['amazonbuckets_enable'] && $player_colors['amazonbuckets_name']) {
             /**
              * Get bucket name
              */
             $s3bucket_name = $player_colors['amazonbuckets_name'];
             /**
              * Check video is exist
              * If exist then get bucket video for uploaded videos
              */
             $video1 = $this->getAmazonURLOrUploadFile($video1, $s3bucket_name);
             /** Get bucket hd video for uploaded videos */
             $video2 = $this->getAmazonURLOrUploadFile($video2, $s3bucket_name);
             /** Get bucket thumb image for uploaded videos */
             $img1 = $this->getAmazonURLOrUploadFile($img1, $s3bucket_name);
             /** Get bucket preview image for uploaded videos */
             $img2 = $this->getAmazonURLOrUploadFile($img2, $s3bucket_name);
         }
         /** Get customurl parameter */
         $act_image = addslashes(trim($_POST['customurl']));
         $act_hdpath = $act_name = $act_opimage = '';
         /** If video url is not empty then get image and preview image */
         if (!empty($act_filepath)) {
             /** Set file type 1 for YouTube, dailymotion and viddler videos */
             $file_type = '1';
             if (strpos($act_filepath, 'youtube') > 0 || strpos($act_filepath, 'youtu.be') > 0) {
                 /**
                  * Get Youtube video id
                  * Based on that get video URL , image, preview image 
                  */
                 $match = getYoutubeVideoID($act_filepath);
                 $act_filepath = $youtubeVideoURL . $match;
                 /** Get thumbimage for youtube video */
                 $act_image = 'http://i3.ytimg.com/vi/' . $match . '/mqdefault.jpg';
                 /** Get previewimage for youtube video */
                 $act_opimage = 'http://i3.ytimg.com/vi/' . $match . '/maxresdefault.jpg';
                 /** Call fucntion to get YouTube video information */
                 $ydetails = hd_getsingleyoutubevideo($match);
                 if ($ydetails) {
                     if ($act_name == '') {
                         /** Get youtube video title */
                         $act_name = addslashes($ydetails['items'][0]->snippet->title);
                     }
                 } else {
                     /** Else display error for youtube videos*/
                     render_error(__('Could not retrieve Youtube video information', APPTHA_VGALLERY));
                 }
             } else {
                 if (strpos($act_filepath, 'dailymotion') > 0) {
                     /** Get dailymotion video id */
                     $split_id = getDailymotionVideoID($act_filepath);
                     /** Get dailymotion video and thumb url */
                     $act_image = $act_opimage = 'http://www.dailymotion.com/thumbnail/video/' . $split_id[0];
                 } else {
                     if (strpos($act_filepath, 'viddler') > 0) {
                         /** Get viddler video id */
                         $imgstr = explode('/', $act_filepath);
                         /** Get viddler video thumb and preview image */
                         $act_image = $act_opimage = 'http://cdn-thumbs.viddler.com/thumbnail_2_' . $imgstr[4] . '_v1.jpg';
                     } else {
                         $imgstr = '';
                     }
                 }
             }
         } else {
             if ($video1 != '') {
                 $act_filepath = $video1;
             }
             if ($video2 != '') {
                 $act_hdpath = $video2;
             }
             if ($img1 != '') {
                 $act_image = $img1;
             }
             if ($img2 != '') {
                 $act_opimage = $img2;
             }
         }
         /** Set filetype as 5 for embed method */
         if (!empty($embedcode)) {
             $video_added_method = $file_type = '5';
         }
         /** Get video details for URL type videos */
         if ($video_added_method == 3) {
             $act_filepath = $_POST['customurl'];
             $act_image = $_POST['customimage'];
             $act_opimage = $_POST['custompreimage'];
             $act_hdpath = $_POST['customhd'];
         }
         /** Get video details for rtmp videos */
         if (!empty($streamname)) {
             $file_type = '4';
             /** Get filepath3 from params */
             $thumb_image = filter_input(INPUT_POST, 'filepath3');
             $act_image = $thumb_image;
             $act_opimage = $thumb_image;
         }
         if ($video_added_method == 4) {
             /** Get custom url from params */
             $act_filepath = filter_input(INPUT_POST, 'customurl');
             /** Get customhd from params */
             $act_hdpath = filter_input(INPUT_POST, 'customhd');
             /** Get customimage from params */
             $act_image = filter_input(INPUT_POST, 'customimage');
             /** Get custompreimage from params */
             $act_opimage = filter_input(INPUT_POST, 'custompreimage');
         }
         /** Store video form values into single array */
         $videoData = array('name' => $videoName, 'description' => $videoDescription, 'embedcode' => $embedcode, 'file' => $act_filepath, 'file_type' => $video_added_method, 'member_id' => $member_id, 'duration' => $duration, 'hdfile' => $act_hdpath, 'streamer_path' => $streamname, 'islive' => $islive, 'image' => $act_image, 'opimage' => $act_opimage, 'link' => $videoLinkurl, 'featured' => $videoFeatured, 'download' => $videoDownload, 'postrollads' => $videoPostrollads, 'midrollads' => $videomidrollads, 'imaad' => $videoimaad, 'prerollads' => $videoPrerollads, 'publish' => $videoPublish, 'google_adsense' => $google_adsense, 'google_adsense_value' => $google_adsense_value, 'amazon_buckets' => $amazon_buckets);
         /**
          * Get current date and assign default value
          * for srt files, language and slug
          */
         //$videoData ['post_date']  = date ( 'Y-m-d H:i:s' );
         if (empty($this->_videoId)) {
             $videoData['ordering'] = getAllVideosCount();
             $videoData['slug'] = $videoData['srtfile1'] = $videoData['srtfile2'] = $videoData['subtitle_lang1'] = $videoData['subtitle_lang2'] = '';
         }
         /** Call funtion to perform add / update action */
         $this->addUpdateVideoData($videoData);
     }
 }
Example #13
0
//PAGE INCLUDES END
if (isset($_POST['petcreate'])) {
    //Let's define some variables and create the check if the created pet has the posted name
    $pet_owned = stripinput($_POST['petname_cancer']);
    $check = dbrows(dbquery("SELECT name FROM " . DB_UBERPETS_PETS . " WHERE name='" . $pet_owned . "'"));
    //Now let's see if a name was entered
    if (empty($pet_owned)) {
        echo render_error("No pet name", "You didn't enter a pet name!", "-1");
    } elseif (empty($_POST[petcolor_cancer])) {
        echo render_error("No pet color", "You didn't choose a pet color!", "-1");
    } elseif (!preg_match("/^[\\w\\s\\-]+\$/", $pet_owned)) {
        echo render_error("A-Z, 0-9, Underscores, and Spaces only!", "Sorry, but you must only use letters, numbers, underscores, and spaces in your pet's name!", "-1");
    } elseif ($pets_of_user == 4) {
        echo render_error("Maximum number of pets", "Sorry, but you already have 4 pets...", "-1");
    } elseif ($check != 0) {
        echo render_error("Name already taken", "Sorry, but the name " . $pet_owned . " is already taken.", "-1");
    } else {
        //If the checks are bypassed, then create a pet and redirect to step 3
        if (!isset($pets_of_user) || $pets_of_user <= 0) {
            $active_pet_if_no_pets_defined = 1;
        } else {
            $active_pet_if_no_pets_defined = 0;
        }
        if (!isset($pets_of_user)) {
            $create_entry == 1;
        } else {
            $create_enrty == 0;
        }
        if ($active_pet_if_no_pets_defined == 1) {
            $usrpet = 1;
        } elseif ($pets_of_user == 1) {
function render_header($user = null)
{
    // Might want to serve this out of a canvas sometimes to test
    // out fbml, so if so then don't serve the JS stuff
    if (isset($_POST['fb_sig_in_canvas'])) {
        return;
    }
    prevent_cache_headers();
    $html = '
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<meta name="KEYWORDS" content="facebook connect php tutorial"/>
			<meta name="description" content="Demo of facebook connect using php and javascript"/>
			<title>Facebook Connect Demo</title>
			<link type="text/css" rel="stylesheet" href="' . CONNECT_CSS_PATH . 'style.css" />
		</head>
		<body>
	';
    if (is_fbconnect_enabled()) {
        ensure_loaded_on_correct_url();
    }
    $html .= '<div class="header">';
    if ($user) {
        // USER LOGGED IN
        if ($user->fbc_is_facebook_user()) {
            $html .= '<div id="header-profilepic">';
            $html .= $user->fbc_getProfilePic_xfbml(true);
            $html .= '</div>';
        }
        $html .= '<div id="header-account">';
        $html .= '<b>Welcome, ' . $user->fbc_getName() . '</b>';
        $html .= '<div class="account_links">';
        if ($user->fbc_is_facebook_user()) {
            $html .= sprintf('<a href="#" onClick="FB.Connect.logout(function() { refresh_page(); })">' . 'Logout of Facebook' . '</a>', $_SERVER['REQUEST_URI']);
        } else {
            // PUT YOUR SITES LOGOUT URL HERE
        }
        $html .= '</div>';
        $html .= '</div>';
    } else {
        // NOT LOGGED IN
        $html .= '<div id="header-account">';
        $html .= 'Hello Guest ';
        $html .= '</div>';
    }
    $html .= '</div>';
    // header & header_content
    $html .= '<div class="content">';
    $html .= "<div class='fbconnect_welcome'>";
    $html .= "<img src='" . CONNECT_IMG_PATH . "connect_logo.jpg' class='logo' />";
    $html .= "Welcome to a demo of the Quick Start Facebook Connect PHP API.  This is an optimized version of Facebook's Runaround demo that allows you to quickly implement the FB Connect PHP library onto your website.<br/><br/>";
    $html .= "You can also check out a FB Connect <a href='http://www.pakt.com/pakt/?id=5e17b48f5679ab47&t=How_to_add_Facebook_Connect_to_your_website_using_PHP_API' title='Facebook Connect Tutorial'>setup tutorial</a> as well as the <a href='http://code.google.com/p/facebook-connect-php5-library/downloads/list' title='Facebook Connect PHP library'>code library</a> used for this demo.";
    $html .= "</div>";
    // Catch misconfiguration errors.
    if (!is_config_setup()) {
        $html .= render_error('Your FB Connect configuration is not complete.');
        $html .= '</body>';
        echo $html;
        exit;
    }
    return $html;
}
function render($param)
{
    list($actor, $accion, $sujeto) = explode("/", $param['ruta']);
    // Descomponemos la ruta !!
    switch ($actor) {
        case 'static':
            require_once "static/static.inc.php";
            $contenido = render_static($accion, $sujeto, $param);
            break;
        case 'usuarios':
            require_once "usuarios/usuarios.inc.php";
            $contenido = render_usuario($accion, $sujeto, $param);
            break;
        case 'autorizaciones':
            require_once "autorizaciones/autorizaciones.inc.php";
            $contenido = render_autorizaciones($accion, $sujeto, $param);
            break;
        case 'archivos':
            require_once "archivos/archivos.inc.php";
            $contenido = render_archivo($accion, $sujeto, $param);
            break;
        case 'secciones':
            require_once "secciones/secciones.inc.php";
            $contenido = render_secciones($accion, $sujeto, $param);
            break;
        case 'documentos':
            require_once "documentos/documentos.inc.php";
            $contenido = render_documentos($accion, $sujeto, $param);
            break;
        case 'buscador':
            require_once "buscador.inc.php";
            $contenido = render_buscador($accion, $sujeto, $param);
            break;
        case 'error':
            $contenido = render_error($accion, $sujeto, $param);
            break;
        case 'backup':
            require_once "backup.inc.php";
            $contenido = render_backup($accion, $sujeto, $param);
            break;
        case 'estadisticas':
            require_once "estadisticas/estadisticas.inc.php";
            $contenido = render_estadistica($accion, $sujeto, $param);
            break;
        default:
            require_once "static/static.inc.php";
            $contenido = render_static("mostrar", "inicio", $param);
            break;
    }
    $cabecera = render_cabecera($param);
    $pie = render_pie($param);
    $bloques = render_bloques($param);
    $pagina = SmartyInit();
    $pagina->assign('Titulo', "Historia de peñaranda de Bracamonte");
    $pagina->assign('Cabecera', $cabecera);
    $pagina->assign('Pie', $pie);
    $pagina->assign('Bloques', $bloques);
    $pagina->assign('Contenido', $contenido);
    $pagina->display('master.tpl');
    die;
}
Example #16
0
 /**
  * Default server error output
  *
  * @param string $errno 
  * @param string $errstr 
  * @param string $errfile 
  * @param string $errline 
  * @return string
  */
 function server_error($errno, $errstr, $errfile = null, $errline = null)
 {
     $is_http_error = http_response_status_is_valid($errno);
     $html = render_error($errno, $errstr, $errfile, $errline, $is_http_error);
     return error_html($html);
 }
Example #17
0
<?php

auto_set_params(array('forum_post' => array()));
$forum_post = ForumPost::create(array_merge(request::$params->forum_post, array('creator_id' => user::$current->id)));
if ($forum_post->record_errors->blank()) {
    if (empty(request::$params->forum_post['parent_id'])) {
        notice("Forum topic created");
        redirect_to("#show", array('id' => $forum_post->root_id));
    } else {
        notice("Response posted");
        redirect_to("#show", array('id' => $forum_post->root_id, 'page' => ceil($forum_post->root->response_count / 30)));
    }
} else {
    render_error($forum_post);
}
Example #18
0
{
    echo '<textarea>' . json_encode($data) . '</textarea>';
    exit;
}
function render_error($message = 'oops')
{
    return render_response(array('error' => $message));
}
$config = load_config('./fuze.ini');
init_session();
if (!$_POST) {
    render_error('I get POSTs only');
}
if (!$_SESSION['has_user']) {
    render_error('no user sesssion present');
}
if (!isset($_FILES['media']) || $_FILES['media']['error']) {
    render_error('file was not uploaded: ' . print_r($_FILES, true));
}
$media = $_FILES['media'];
$ret = false;
try {
    $client = getFuzeClient($config['fuze.url']);
    $ret = $client->uploadMedia($media['tmp_name'], $media['name'], $_POST['meetingId']);
} catch (Exception $e) {
    render_error($e->getMessage());
}
if (!$ret) {
    render_error('upload to fuze failed');
}
render_response($ret);