static function header_top($theme)
 {
     $session = Session::instance();
     $highroller_theme = $session->get("highroller_theme", "");
     if ($highroller_theme) {
         print html::stylesheet(url::abs_file("modules/highroller/themes/{$highroller_theme}/theme.css"));
     }
 }
Example #2
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/create/{$parent->id}", "", "post", array("id" => "g-add-album-form"));
     $group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"))->error_messages("required", t("You must provide a title"))->error_messages("length", t("Your title is too long"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Directory name"))->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"))->error_messages("required", t("You must provide a directory name"))->error_messages("length", t("Your directory name is too long"));
     $group->input("slug")->label(t("Internet Address"))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"))->error_messages("required", t("You must provide an internet address"))->error_messages("length", t("Your internet address is too long"));
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Create"));
     $form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
     return $form;
 }
Example #3
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
     $group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Directory Name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Create"));
     $form->add_rules_from(ORM::factory("item"));
     $form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
     return $form;
 }
Example #4
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/create/{$parent->id}", "", "post", array("id" => "g-add-album-form"));
     $group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"))->error_messages("required", t("You must provide a title"))->error_messages("length", t("Your title is too long"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Directory name"))->error_messages("no_slashes", t("The directory name can't contain a \"/\""))->error_messages("no_backslashes", t("The directory name can't contain a \"\\\""))->error_messages("no_trailing_period", t("The directory name can't end in \".\""))->error_messages("required", t("You must provide a directory name"))->error_messages("length", t("Your directory name is too long"))->error_messages("conflict", t("There is already a movie, photo or album with this name"));
     $group->input("slug")->label(t("Internet Address"))->error_messages("conflict", t("There is already a movie, photo or album with this internet address"))->error_messages("reserved", t("This address is reserved and can't be used."))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"))->error_messages("required", t("You must provide an internet address"))->error_messages("length", t("Your internet address is too long"));
     $group->hidden("type")->value("album");
     module::event("album_add_form", $parent, $form);
     $group->submit("")->value(t("Create"));
     $form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
     return $form;
 }
 /**
  * Display the EXIF data for an item.
  */
 public function showhtml($item_id)
 {
     // Generate the Dialog Box for HTML links.
     $item = ORM::factory("item", $item_id);
     access::required("view", $item);
     // If the current page is an album, only display two links.
     if ($item->is_album()) {
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Album:", 2);
         // If the item is a movie, don't display resize links, do display an embed link.
     } elseif ($item->is_movie()) {
         // Link to the current page.
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Page:", 2);
         // If the visitor has suficient privlidges to see the fullsized
         //    version of the current image, then display links to it.
         if (access::can("view_full", $item)) {
             $linkArray[2] = array("Text:", "<a href=&quot;" . $item->file_url(true) . "&quot;>Click Here</a>");
             $linkArray[3] = array("Thumbnail:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
             $linkArray[4] = array("Embed:", "<object width=&quot;" . $item->width . "&quot; height=&quot;" . $item->height . "&quot; data=&quot;" . url::abs_file("lib/flowplayer.swf") . "&quot; type=&quot;application/x-shockwave-flash&quot;><param name=&quot;movie&quot; value=&quot;" . url::abs_file("lib/flowplayer.swf") . "&quot; /><param name=&quot;allowfullscreen&quot; value=&quot;true&quot; /><param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /><param name=&quot;flashvars&quot; value='config={&quot;plugins&quot;:{&quot;pseudo&quot;:{&quot;url&quot;:&quot;flowplayer.h264streaming.swf&quot;},&quot;controls&quot;:{&quot;backgroundColor&quot;:&quot;#000000&quot;,&quot;backgroundGradient&quot;:&quot;low&quot;}},&quot;clip&quot;:{&quot;provider&quot;:&quot;pseudo&quot;,&quot;url&quot;:&quot;" . $item->file_url(true) . "&quot;},&quot;playlist&quot;:[{&quot;provider&quot;:&quot;pseudo&quot;,&quot;url&quot;:&quot;" . $item->file_url(true) . "&quot;}]}' /></object>");
             $linkTitles[1] = array("Link To The Video File:", 3);
         }
         // Or else assume the item is a photo.
     } else {
         // Link to the current page.
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkArray[2] = array("Resized:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->resize_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Page:", 3);
         // Link to the "resized" version of the current image.
         $linkArray[3] = array("Text:", "<a href=&quot;" . $item->resize_url(true) . "&quot;>Click Here</a>");
         $linkArray[4] = array("Thumbnail:", "<a href=&quot;" . $item->resize_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkArray[5] = array("Image:", "<img src=&quot;" . $item->resize_url(true) . "&quot;>");
         $linkTitles[1] = array("Link To The Resized Image:", 3);
         // If the visitor has suficient privlidges to see the fullsized
         //    version of the current image, then display links to it.
         if (access::can("view_full", $item)) {
             $linkArray[6] = array("Text:", "<a href=&quot;" . $item->file_url(true) . "&quot;>Click Here</a>");
             $linkArray[7] = array("Thumbnail:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
             $linkArray[8] = array("Resized:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->resize_url(true) . "&quot;></a>");
             $linkTitles[2] = array("Link To The Full Size Image:", 3);
         }
     }
     $view = new View("embedlinks_htmldialog.html");
     $view->titles = $linkTitles;
     $view->details = $linkArray;
     print $view;
 }
Example #6
0
 public function queue($state)
 {
     $page = max(Input::instance()->get("page"), 1);
     $view = new Gallery_View("admin_manage_comments_queue.html");
     $view->counts = $this->_counts();
     $view->menu = $this->_menu($view->counts);
     $view->state = $state;
     $view->comments = ORM::factory("comment")->order_by("created", "DESC")->order_by("id", "DESC")->where("state", "=", $state)->limit(self::$items_per_page)->offset(($page - 1) * self::$items_per_page)->find_all();
     // This view is not themed so we can't use $theme->url() in the view and have to
     // reproduce Gallery_View::url() logic here.
     $atn = theme::$admin_theme_name;
     $view->fallback_avatar_url = url::abs_file("themes/{$atn}/images/avatar.jpg");
     $view->page = $page;
     $view->page_type = "collection";
     $view->page_subtype = "admin_comments";
     $view->page_size = self::$items_per_page;
     $view->children_count = $this->_counts()->{$state};
     $view->max_pages = ceil($view->children_count / $view->page_size);
     // Also we want to use $theme->paginator() so we need a dummy theme
     $view->theme = $view;
     print $view;
 }
echo $attrs["id"];
?>
",
    {
      src: "<?php 
echo url::abs_file("lib/flowplayer.swf");
?>
",
      wmode: "transparent",
      provider: "pseudostreaming"
    },
    {
      clip: {
        scaling: 'fit'
      },
      plugins: {
        pseudostreaming: {
          url: "<?php 
echo url::abs_file("lib/flowplayer.pseudostreaming.swf");
?>
"
        },
        controls: {
          autoHide: 'always',
          hideDelay: 2000
        }
      }
    }
  )
</script>
Example #8
0
 /**
  * Return a flowplayer <script> tag for movies
  * @param array $extra_attrs
  * @return string
  */
 public function movie_img($extra_attrs)
 {
     $attrs = array_merge($extra_attrs, array("id" => "player", "style" => "display:block;width:400px;height:300px"));
     return html::anchor($this->file_url(true), "", $attrs) . "<script>flowplayer('player', '" . url::abs_file("lib/flowplayer-3.0.5.swf") . "'); </script>";
 }
Example #9
0
>
  </video>
</div>
<script type="text/javascript">
  $("#<?php 
echo $div_attrs["id"];
?>
 video").mediaelementplayer(
    $.extend(true, {
      defaultVideoWidth: <?php 
echo $width;
?>
,
      defaultVideoHeight: <?php 
echo $height;
?>
,
      startVolume: 1.0,
      features: ["playpause", "progress", "current", "duration", "volume", "fullscreen"],
      pluginPath: "<?php 
echo url::abs_file("lib/mediaelementjs/");
?>
",
      flashName: "flashmediaelement.swf.php"
    }, <?php 
echo json_encode($player_options);
?>
)
  );
</script>
Example #10
0
 /**
  * album: http://example.com/gallery3/var/resizes/album1/.resize.jpg
  * photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
  */
 public function resize_url($full_uri = false)
 {
     return ($full_uri ? url::abs_file("var/resizes/" . $this->relative_path()) : url::file("var/resizes/" . $this->relative_path())) . ($this->is_album() ? "/.album.jpg" : "");
 }
Example #11
0
 /**
  * album: http://example.com/gallery3/var/resizes/album1/.resize.jpg
  * photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
  */
 public function resize_url($full_uri = false)
 {
     $relative_path = "var/resizes/" . $this->relative_path();
     $cache_buster = $this->_cache_buster($this->resize_path());
     return ($full_uri ? url::abs_file($relative_path) : url::file($relative_path)) . ($this->is_album() ? "/.album.jpg" : "") . $cache_buster;
 }
            ?>
 x <?php 
            echo $r[1];
            ?>
</option>
            <?php 
        }
        ?>
        </select>
        <script type="text/javascript">
            var fpItmId = "g-item-id-<?php 
        echo $item->id;
        ?>
";
            var fpBaseUrl = "<?php 
        echo url::abs_file("var/modules/transcode/flv/" . $item->id);
        ?>
/";
            $f(fpItmId).onLoad(function() {
		changeVideo($('#resolution-select').val());
                //var url = fpBaseUrl + $('#resolution-select').val() + ".flv";
                //$('#' + fpItmId).flowplayer(0).play(url);
            });
            function changeVideo(res) {
                var id = "g-item-id-<?php 
        echo $item->id;
        ?>
";
                var dim = res.split('x');
		$('#' + fpItmId).css({width: dim[0] + 'px', height: dim[1] + 'px'});
                $('#' + id).flowplayer(0).play(fpBaseUrl + res + ".flv");
Example #13
0
<?php

defined("SYSPATH") or die("No direct script access.");
echo html::anchor($item->file_url(true), "", $attrs);
?>
<script>
  flowplayer("<?php 
echo $attrs["id"];
?>
", {src: "<?php 
echo url::abs_file("lib/flowplayer.swf");
?>
",
      wmode: "transparent"}, {
    plugins: {
      h264streaming: {
        url: "<?php 
echo url::abs_file("lib/flowplayer.h264streaming.swf");
?>
"
      },
      controls: {
        autoHide: 'always',
        hideDelay: 2000
      }
    }
  })
</script>
 static function get($request)
 {
     $db = db::build();
     $start = microtime(true);
     $rest_base = url::abs_site("rest");
     $file_base = url::abs_file('');
     #'var/' . $size . '/'
     /* Build basic limiters */
     $limit = unrest_rest::getBasicLimiters($request);
     $limit = unrest_rest::getFreetextLimiters($request, $limit);
     /* Build numeric limiters */
     /* ...at some point. */
     /* Figure out an array of albums we got permissions to access */
     $permitted = unrest_rest::albumsICanAccess();
     $display = unrest_rest::getDisplayOptions($request);
     $items = unrest_rest::baseItemQuery($db);
     /*
     	Introduce some WHERE statements that'll make sure that we don't get to see stuff we
     	shouldn't be seeing.
     */
     unrest_rest::queryLimitByPermission(&$items, $permitted);
     unrest_rest::queryLimitByLimiter(&$items, $limit);
     unrest_rest::queryOrder(&$items, $request);
     $return = array();
     $filler = array();
     $relationshipCandidates = array();
     foreach ($items->execute() as $item) {
         $data = array('id' => intval($item->id), 'parent' => intval($item->parent_id), 'owner_id' => intval($item->{'owner_id'}), 'public' => $item->view_1 ? true : false, 'type' => $item->type);
         if (in_array('uitext', $display)) {
             $ui = array('title' => $item->title, 'description' => $item->description, 'name' => $item->name, 'slug' => $item->slug);
             $data = array_merge($data, $ui);
         }
         if (in_array('uiimage', $display)) {
             $ui = array('height' => $item->height, 'width' => $item->width, 'resize_height' => $item->resize_height, 'resize_width' => $item->resize_width, 'thumb_height' => $item->resize_height, 'thumb_width' => $item->resize_width);
             $ui['thumb_url_public'] = unrest_rest::size_url('thumbs', $item->relative_path_cache, $item->type, $file_base);
             $public = $item->view_1 ? true : false;
             $fullPublic = $item->view_full_1 ? true : false;
             if ($item->type != 'album') {
                 $ui['file_url'] = unrest_rest::makeRestURL('data', $item->id . '?size=full', $rest_base);
                 $ui['thumb_url'] = unrest_rest::makeRestURL('data', $item->id . '?size=thumb', $rest_base);
                 $ui['resize_url'] = unrest_rest::makeRestURL('data', $item->id . '?size=resize', $rest_base);
                 if ($public) {
                     $ui['resize_url_public'] = unrest_rest::size_url('resizes', $item->relative_path_cache, $item->type, $file_base);
                     if ($fullPublic) {
                         $ui['file_url_public'] = unrest_rest::size_url('albums', $item->relative_path_cache, $item->type, $file_base);
                     }
                 }
             }
             $data = array_merge($data, $ui);
         }
         if (in_array('members', $display)) {
             $filler['children_of'][] = $item->id;
         }
         $return[] = array('url' => unrest_rest::makeRestURL('item', $item->id, $rest_base), 'entity' => $data);
     }
     /* Do we need to fetch children? */
     if (array_key_exists('children_of', $filler)) {
         unrest_rest::addChildren($request, $db, $filler, $permitted, $display, &$return, $rest_base);
     }
     $end = microtime(true);
     error_log("Inner " . ($end - $start) . " seconds taken");
     return $return;
 }
    <tr>
      <th><?php 
echo t("Embed:");
?>
</th>
      <td><input type="text" value="<object width=&quot;<?php 
echo $item->width;
?>
&quot; height=&quot;<?php 
echo $item->height;
?>
&quot; data=&quot;<?php 
echo url::abs_file("lib/flowplayer.swf");
?>
&quot; type=&quot;application/x-shockwave-flash&quot;><param name=&quot;movie&quot; value=&quot;<?php 
echo url::abs_file("lib/flowplayer.swf");
?>
&quot; /><param name=&quot;allowfullscreen&quot; value=&quot;true&quot; /><param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /><param name=&quot;flashvars&quot; value='config={&quot;plugins&quot;:{&quot;pseudo&quot;:{&quot;url&quot;:&quot;flowplayer.h264streaming.swf&quot;},&quot;controls&quot;:{&quot;backgroundColor&quot;:&quot;#000000&quot;,&quot;backgroundGradient&quot;:&quot;low&quot;}},&quot;clip&quot;:{&quot;provider&quot;:&quot;pseudo&quot;,&quot;url&quot;:&quot;<?php 
echo $item->file_url(true);
?>
&quot;},&quot;playlist&quot;:[{&quot;provider&quot;:&quot;pseudo&quot;,&quot;url&quot;:&quot;<?php 
echo $item->file_url(true);
?>
&quot;}]}' /></object>" onclick="this.focus(); this.select();" readonly></td>
    </tr>
  <? } ?>
<? } ?>

<? if ($item->is_photo()) { ?>
    <tr>
      <th colspan="2"><br/><?php 
 static function album_add_form($parent, $form)
 {
     $group = $form->group("privacy")->label(t("album privacy settings"));
     $group->checkbox("private")->label(t("Private"))->id("uh_private")->onClick("pc()");
     $group->input("username")->label(t("Username"))->id("uh_username")->callback("user_homes_event::valid_name")->error_messages("in_use", t("There is already a user with that username"))->error_messages("required", t("You must enter a username"))->callback("user_homes_event::valid_name")->rules("length[1,32]");
     $group->password("password")->label(t("Password"))->id("uh_password")->callback("user_homes_event::valid_password")->error_messages("required", t("You must enter a password"))->error_messages("minlength", t("Password is not long enough"));
     $group->password("password2")->label(t("Confirm password"))->id("uh_password2")->error_messages("matches", t("Passwords do not match"))->matches($group->password);
     $form->script("")->url(url::abs_file("modules/user_homes/js/user_homes_add_album.js"));
 }
Example #17
0
    <li><span class="ui-icon ui-icon-seek-prev"></span><a href="<?= $previous_item->url() ?>"><?= t("previous") ?></a></li>
    <? endif ?>
    <? if ($next_item): ?>
    <li><a href="<?= $next_item->url() ?>"><?= t("next") ?></a><span class="ui-icon ui-icon-seek-next"></span></li>
    <? endif ?>
  </ul>

  <a id="gMovieId-<?= $item->id ?>"
     href="<?= $item->file_url(true) ?>"
     style="display: block; width: <?= $item->width ?>px; height: <?= $item->height ?>px">
  </a>
  <script>
    flowplayer("gMovieId-<?= $item->id ?>", "<?= url::abs_file("lib/flowplayer.swf") ?>", {
      plugins: {
        h264streaming: {
          url: "<?= url::abs_file("lib/flowplayer.h264streaming.swf") ?>"
        },
        controls: {
          autoHide: 'always',
          hideDelay: 2000
        }
      }
    })
  </script>

  <div id="gInfo">
    <h1><?= p::clean($item->title) ?></h1>
    <div><?= p::clean($item->description) ?></div>
  </div>

  <script type="text/javascript">
Example #18
0
 public function url($path, $absolute_url = false)
 {
     $arg = "themes/{$this->theme_name}/{$path}";
     return $absolute_url ? url::abs_file($arg) : url::file($arg);
 }
Example #19
0
 /**
  * Convert relative references inside a CSS file to absolute ones so that when it's served from
  * a new location as part of a combined bundle the references are still correct.
  * @param string  the path to the css file
  */
 private function process_css($css_file)
 {
     static $PATTERN = "#url\\(\\s*['|\"]{0,1}(.*?)['|\"]{0,1}\\s*\\)#";
     $docroot_length = strlen(DOCROOT);
     $css = file_get_contents($css_file);
     if (preg_match_all($PATTERN, $css, $matches, PREG_SET_ORDER)) {
         $search = $replace = array();
         foreach ($matches as $match) {
             $relative = dirname($css_file) . "/{$match['1']}";
             if (!empty($relative)) {
                 $search[] = $match[0];
                 $replace[] = "url('" . url::abs_file($relative) . "')";
             } else {
                 Kohana_Log::add("error", "Missing URL reference '{$match[1]}' in CSS file '{$css_file}'");
             }
         }
         $replace = str_replace(DIRECTORY_SEPARATOR, "/", $replace);
         $css = str_replace($search, $replace, $css);
     }
     $imports = preg_match_all("#@import\\s*['|\"]{0,1}(.*?)['|\"]{0,1};#", $css, $matches, PREG_SET_ORDER);
     if ($imports) {
         $search = $replace = array();
         foreach ($matches as $match) {
             $search[] = $match[0];
             $replace[] = $this->process_css(dirname($css_file) . "/{$match['1']}");
         }
         $css = str_replace($search, $replace, $css);
     }
     return $css;
 }
    $.extend(true, {
      "src": "<?php 
echo url::abs_file("lib/flowplayer.swf");
?>
",
      "wmode": "transparent",
      "provider": "pseudostreaming"
    }, <?php 
echo json_encode($fp_params);
?>
),
    $.extend(true, {
      "plugins": {
        "pseudostreaming": {
          "url": "<?php 
echo url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf");
?>
"
        },
        "controls": {
          "autoHide": "always",
          "hideDelay": 2000,
          "height": 24
        }
      },
      "clip": {
        "scaling": "fit",
        "onMetaData": function(clip) {
          // set movie size a second time using actual size from metadata
          set_movie_size(parseInt(clip.metaData.width), parseInt(clip.metaData.height));
        }
Example #21
0
 /**
  * Display delete confirmation message and form
  * @param object $item
  * @return string form
  */
 static function get_delete_form($item)
 {
     $page_type = Input::instance()->get("page_type");
     $from_id = Input::instance()->get("from_id");
     $form = new Forge("quick/delete/{$item->id}?page_type={$page_type}&from_id={$from_id}", "", "post", array("id" => "g-confirm-delete"));
     $group = $form->group("confirm_delete")->label(t("Confirm Deletion"));
     $group->submit("")->value(t("Delete"));
     $form->script("")->url(url::abs_file("modules/gallery/js/item_form_delete.js"));
     return $form;
 }
Example #22
0
 /**
  * album: http://example.com/gallery3/var/resizes/album1/.resize.jpg
  * photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
  */
 public function resize_url($full_uri = true)
 {
     return ($full_uri ? url::abs_file("var/resizes/" . $this->relative_path()) : url::file("var/resizes/" . $this->relative_path())) . ($this->type == "album" ? "/.album.jpg" : "");
 }
Example #23
0
 /**
  * Verify that our htaccess based permission system actually works.  Create a temporary
  * directory containing an .htaccess file that uses mod_rewrite to redirect /verify to
  * /success.  Then request that url.  If we retrieve it successfully, then our redirects are
  * working and our permission system works.
  */
 static function htaccess_works()
 {
     $success_url = url::file("var/tmp/security_test/success");
     @mkdir(VARPATH . "tmp/security_test");
     if ($fp = @fopen(VARPATH . "tmp/security_test/.htaccess", "w+")) {
         fwrite($fp, "RewriteEngine On\n");
         fwrite($fp, "RewriteRule verify {$success_url} [L]\n");
         fclose($fp);
     }
     if ($fp = @fopen(VARPATH . "tmp/security_test/success", "w+")) {
         fwrite($fp, "success");
         fclose($fp);
     }
     list($response) = remote::do_request(url::abs_file("var/tmp/security_test/verify"));
     $works = $response == "HTTP/1.1 200 OK";
     @dir::unlink(VARPATH . "tmp/security_test");
     return $works;
 }
Example #24
0
 /**
  * Verify that our htaccess based permission system actually works.  Create a temporary
  * directory containing an .htaccess file that uses mod_rewrite to redirect /verify to
  * /success.  Then request that url.  If we retrieve it successfully, then our redirects are
  * working and our permission system works.
  */
 static function htaccess_works()
 {
     $success_url = url::file("var/security_test/success");
     @mkdir(VARPATH . "security_test");
     try {
         if ($fp = @fopen(VARPATH . "security_test/.htaccess", "w+")) {
             fwrite($fp, "Options +FollowSymLinks\n");
             fwrite($fp, "RewriteEngine On\n");
             fwrite($fp, "RewriteRule verify {$success_url} [L]\n");
             fclose($fp);
         }
         if ($fp = @fopen(VARPATH . "security_test/success", "w+")) {
             fwrite($fp, "success");
             fclose($fp);
         }
         // Proxy our authorization headers so that if the entire Gallery is covered by Basic Auth
         // this callback will still work.
         $headers = array();
         if (function_exists("apache_request_headers")) {
             $arh = apache_request_headers();
             if (!empty($arh["Authorization"])) {
                 $headers["Authorization"] = $arh["Authorization"];
             }
         }
         list($status, $headers, $body) = remote::do_request(url::abs_file("var/security_test/verify"), "GET", $headers);
         $works = $status == "HTTP/1.1 200 OK" && $body == "success";
     } catch (Exception $e) {
         @dir::unlink(VARPATH . "security_test");
         throw $e;
     }
     @dir::unlink(VARPATH . "security_test");
     return $works;
 }
Example #25
0
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
 */
// If var/database.php doesn't exist, then we assume that the Gallery is not properly installed
// and send users to the installer.
if (!file_exists(VARPATH . "database.php")) {
    url::redirect(url::abs_file("installer"));
}
// Simple and cheap test to make sure that the database config is ok.  Do this before we do
// anything else database related.
try {
    Database::instance()->connect();
} catch (Kohana_PHP_Exception $e) {
    print "Database configuration error.  Please check var/database.php";
    exit;
}
Event::add("system.ready", array("Gallery_I18n", "instance"));
Event::add("system.ready", array("module", "load_modules"));
Event::add("system.ready", array("gallery", "ready"));
Event::add("system.post_routing", array("url", "parse_url"));
Event::add("system.post_routing", array("gallery", "maintenance_mode"));
Event::add("system.post_routing", array("gallery", "private_gallery"));
Example #26
0
 /**
  * album: http://example.com/gallery3/var/resizes/album1/.resize.jpg
  * photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
  */
 public function resize_url($full_uri = false)
 {
     $relative_path = "var/resizes/" . $this->relative_path();
     return ($full_uri ? url::abs_file($relative_path) : url::file($relative_path)) . ($this->is_album() ? "/.album.jpg" : "") . "?m={$this->updated}";
 }
Example #27
0
?>
),
    $.extend(true, {
      "plugins": {
        "pseudostreaming": {
          "url": "<?php 
echo url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf.php");
?>
"
        },
        "controls": {
          "autoHide": "always",
          "hideDelay": 2000,
          "height": 24,
          "url": "<?php 
echo url::abs_file("lib/flowplayer.controls.swf.php");
?>
"
        }
      },
      "clip": {
        "scaling": "fit",
        "onMetaData": function(clip) {
          // set movie size a second time using actual size from metadata
          set_movie_size(parseInt(clip.metaData.width), parseInt(clip.metaData.height));
        }
      }
    }, <?php 
echo json_encode($fp_config);
?>
)
Example #28
0
 public function showhtml($item_id)
 {
     // Generate the Dialog Box for HTML links.
     $item = ORM::factory("item", $item_id);
     access::required("view", $item);
     // If the current page is an album, only display two links.
     if ($item->is_album()) {
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Album:", 2);
         // If the item is a movie, don't display resize links, do display an embed link.
     } elseif ($item->is_movie()) {
         // Link to the current page.
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Page:", 2);
         // If the visitor has suficient privlidges to see the fullsized
         //    version of the current image, then display links to it.
         if (access::can("view_full", $item)) {
             $linkArray[2] = array("Text:", "<a href=&quot;" . $item->file_url(true) . "&quot;>Click Here</a>");
             $linkArray[3] = array("Thumbnail:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
             // Figure out what the path of the .flv file is.
             $str_movie_path = $item->file_url(true);
             if (module::is_active("videos")) {
                 $items_video = ORM::factory("items_video")->where("item_id", "=", $item->id)->find();
                 if ($items_video->loaded()) {
                     if (file_exists($item->resize_path() . ".flv")) {
                         $str_movie_path = str_replace("?m=", ".flv?m=", $item->resize_url(true));
                     } else {
                         $str_movie_path = "";
                     }
                 }
             }
             if ($str_movie_path != "") {
                 $linkArray[4] = array("Embed:", "<object id=&quot;flowplayer&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;" . "width=&quot;" . $item->width . "&quot; height=&quot;" . $item->height . "&quot;><param name=&quot;movie&quot; value=&quot;" . url::abs_file("lib/flowplayer.swf") . "&quot; /><param name=&quot;flashvars&quot; value='config={&quot;clip&quot;:&quot;" . $str_movie_path . "&quot;}' /><embed type=&quot;application/x-shockwave-flash&quot; width=&quot;" . $item->width . "&quot; height=&quot;" . $item->height . "&quot; src=&quot;" . url::abs_file("lib/flowplayer.swf") . "&quot; flashvars=" . "'config={&quot;clip&quot;:&quot;" . $str_movie_path . "&quot;}'/></object>");
                 $linkTitles[1] = array("Link To The Video File:", 3);
             } else {
                 $linkTitles[1] = array("Link To The Video File:", 2);
             }
         }
         // Or else assume the item is a photo.
     } else {
         // Link to the current page.
         $linkArray[0] = array("Text:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;>Click Here</a>");
         $linkArray[1] = array("Thumbnail:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkArray[2] = array("Resized:", "<a href=&quot;" . url::abs_site("{$item->type}s/{$item->id}") . "&quot;><img src=&quot;" . $item->resize_url(true) . "&quot;></a>");
         $linkTitles[0] = array("Link To This Page:", 3);
         // Link to the "resized" version of the current image.
         $linkArray[3] = array("Text:", "<a href=&quot;" . $item->resize_url(true) . "&quot;>Click Here</a>");
         $linkArray[4] = array("Thumbnail:", "<a href=&quot;" . $item->resize_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
         $linkArray[5] = array("Image:", "<img src=&quot;" . $item->resize_url(true) . "&quot;>");
         $linkTitles[1] = array("Link To The Resized Image:", 3);
         // If the visitor has suficient privlidges to see the fullsized
         //    version of the current image, then display links to it.
         if (access::can("view_full", $item)) {
             $linkArray[6] = array("Text:", "<a href=&quot;" . $item->file_url(true) . "&quot;>Click Here</a>");
             $linkArray[7] = array("Thumbnail:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->thumb_url(true) . "&quot;></a>");
             $linkArray[8] = array("Resized:", "<a href=&quot;" . $item->file_url(true) . "&quot;><img src=&quot;" . $item->resize_url(true) . "&quot;></a>");
             $linkTitles[2] = array("Link To The Full Size Image:", 3);
         }
     }
     $view = new View("embedlinks_htmldialog.html");
     $view->titles = $linkTitles;
     $view->details = $linkArray;
     print $view;
 }