mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-01 12:40:45 -04:00
Merge branch 'master' of git@github.com:gallery/gallery3
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
name = Comments
|
||||
description = Allows users and guests to leave comments on photos and albums.
|
||||
description = "Allows users and guests to leave comments on photos and albums."
|
||||
version = 2
|
||||
|
||||
@@ -32,8 +32,9 @@ class File_Proxy_Controller extends Controller {
|
||||
$request_uri = $this->input->server("REQUEST_URI");
|
||||
$request_uri = preg_replace("/\?.*/", "", $request_uri);
|
||||
|
||||
// Unescape %7E ("~") and %20 (" ")
|
||||
$request_uri = str_replace(array("%7E", "%20"), array("~", " "), $request_uri);
|
||||
// Unescape %7E (~), %20 ( ) and %27 (')
|
||||
// @todo: figure out why we have to do this and unescape everything appropriate
|
||||
$request_uri = str_replace(array("%7E", "%20", "%27"), array("~", " ", "'"), $request_uri);
|
||||
|
||||
// var_uri: http://example.com/gallery3/var/
|
||||
$var_uri = url::file("var/");
|
||||
|
||||
@@ -21,11 +21,11 @@ class remote extends remote_Core {
|
||||
|
||||
static function post($url, $post_data_array, $extra_headers=array()) {
|
||||
$post_data_raw = self::_encode_post_data($post_data_array, $extra_headers);
|
||||
|
||||
|
||||
/* Read the web page into a buffer */
|
||||
list ($response_status, $response_headers, $response_body) =
|
||||
self::do_request($url, 'POST', $extra_headers, $post_data_raw);
|
||||
|
||||
|
||||
return array($response_body, $response_status, $response_headers);
|
||||
}
|
||||
|
||||
@@ -49,22 +49,23 @@ class remote extends remote_Core {
|
||||
}
|
||||
$post_data_raw .= urlencode($key) . '=' . urlencode($value);
|
||||
}
|
||||
|
||||
|
||||
$extra_headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
$extra_headers['Content-Length'] = strlen($post_data_raw);
|
||||
|
||||
|
||||
return $post_data_raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single request, without following redirects
|
||||
*
|
||||
* @todo: Handle redirects? If so, only for GET (i.e. not for POST), and use G2's WebHelper_simple::_parseLocation logic.
|
||||
* @todo: Handle redirects? If so, only for GET (i.e. not for POST), and use G2's
|
||||
* WebHelper_simple::_parseLocation logic.
|
||||
*/
|
||||
static function do_request($url, $method='GET', $headers=array(), $body='') {
|
||||
/* Convert illegal characters */
|
||||
$url = str_replace(' ', '%20', $url);
|
||||
|
||||
|
||||
$url_components = self::_parse_url_for_fsockopen($url);
|
||||
$handle = fsockopen(
|
||||
$url_components['fsockhost'], $url_components['port'], $errno, $errstr, 5);
|
||||
@@ -72,12 +73,12 @@ class remote extends remote_Core {
|
||||
// log "Error $errno: '$errstr' requesting $url";
|
||||
return array(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
$header_lines = array('Host: ' . $url_components['host']);
|
||||
foreach ($headers as $key => $value) {
|
||||
$header_lines[] = $key . ': ' . $value;
|
||||
}
|
||||
|
||||
|
||||
$success = fwrite($handle, sprintf("%s %s HTTP/1.0\r\n%s\r\n\r\n%s",
|
||||
$method,
|
||||
$url_components['uri'],
|
||||
@@ -89,7 +90,7 @@ class remote extends remote_Core {
|
||||
return array(null, null, null);
|
||||
}
|
||||
fflush($handle);
|
||||
|
||||
|
||||
/*
|
||||
* Read the status line. fgets stops after newlines. The first line is the protocol
|
||||
* version followed by a numeric status code and its associated textual phrase.
|
||||
@@ -99,7 +100,7 @@ class remote extends remote_Core {
|
||||
// 'Empty http response code, maybe timeout'
|
||||
return array(null, null, null);
|
||||
}
|
||||
|
||||
|
||||
/* Read the headers */
|
||||
$response_headers = array();
|
||||
while (!feof($handle)) {
|
||||
@@ -107,10 +108,10 @@ class remote extends remote_Core {
|
||||
if (empty($line)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Normalize the line endings */
|
||||
$line = str_replace("\r", '', $line);
|
||||
|
||||
|
||||
list ($key, $value) = explode(':', $line, 2);
|
||||
if (isset($response_headers[$key])) {
|
||||
if (!is_array($response_headers[$key])) {
|
||||
@@ -121,7 +122,7 @@ class remote extends remote_Core {
|
||||
$response_headers[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read the body */
|
||||
$response_body = '';
|
||||
while (!feof($handle)) {
|
||||
|
||||
@@ -136,7 +136,9 @@ class Menu_Core extends Menu_Element {
|
||||
return new Menu_Element_Dialog($type);
|
||||
|
||||
case "root":
|
||||
return new Menu("root");
|
||||
$menu = new Menu("root");
|
||||
$menu->css_class("gMenu");
|
||||
return $menu;
|
||||
|
||||
case "submenu":
|
||||
return new Menu("submenu");
|
||||
@@ -156,6 +158,7 @@ class Menu_Core extends Menu_Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __construct($type) {
|
||||
@@ -206,8 +209,8 @@ class Menu_Core extends Menu_Element {
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
$html = $this->is_root ? "<ul class=\"gMenu\">" :
|
||||
"<li title=\"$this->label\"><a href=\"#\">$this->label</a><ul class=\"gMenu\">";
|
||||
$html = $this->is_root ? "<ul class=\"$this->css_class\">" :
|
||||
"<li title=\"$this->label\"><a href=\"#\">$this->label</a><ul>";
|
||||
$html .= implode("\n", $this->elements);
|
||||
$html .= $this->is_root ? "</ul>" : "</ul></li>";
|
||||
return $html;
|
||||
|
||||
@@ -99,19 +99,19 @@ class Theme_View_Core extends Gallery_View {
|
||||
}
|
||||
|
||||
public function album_menu() {
|
||||
$this->_menu("album");
|
||||
print $this->_menu("album");
|
||||
}
|
||||
|
||||
public function tag_menu() {
|
||||
$this->_menu("tag");
|
||||
print $this->_menu("tag");
|
||||
}
|
||||
|
||||
public function photo_menu() {
|
||||
$this->_menu("photo");
|
||||
print $this->_menu("photo");
|
||||
}
|
||||
|
||||
public function thumb_menu($item) {
|
||||
$this->_menu("thumb", $item);
|
||||
print $this->_menu("thumb", $item)->css_class("gThumbMenu");
|
||||
}
|
||||
|
||||
private function _menu($type, $item=null) {
|
||||
@@ -127,8 +127,7 @@ class Theme_View_Core extends Gallery_View {
|
||||
}
|
||||
}
|
||||
|
||||
$menu->compact();
|
||||
print $menu;
|
||||
return $menu->compact();
|
||||
}
|
||||
|
||||
public function pager() {
|
||||
|
||||
@@ -37,7 +37,11 @@ class info_theme_Core {
|
||||
}
|
||||
if ($item->owner) {
|
||||
$results .= "<li>";
|
||||
$results .= t("By: %owner_name", array("owner_name" => "<a href=\"#\">{$item->owner->full_name}</a>"));
|
||||
if ($item->owner->url) {
|
||||
$results .= t("By: %owner_name", array("owner_name" => "<a href=\"{$item->owner->url}\">{$item->owner->full_name}</a>"));
|
||||
} else {
|
||||
$results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}"));
|
||||
}
|
||||
$results .= "</li>";
|
||||
}
|
||||
return $results;
|
||||
|
||||
@@ -459,7 +459,7 @@ form .gError,
|
||||
font-size: .7em;
|
||||
height: 240px;
|
||||
overflow: hidden;
|
||||
padding: 14px 8px;
|
||||
padding: 15px 8px 30px 8px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 213px;
|
||||
@@ -594,11 +594,17 @@ form .gError,
|
||||
#gContent .gThumbMenu li {
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#gContent .gThumbMenu li li {
|
||||
padding: .3em;
|
||||
}
|
||||
|
||||
#gContent .gThumbMenu a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* View Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
#gViewMenu {
|
||||
|
||||
@@ -14,8 +14,7 @@ var shortForms = new Array(
|
||||
$(document).ready(function() {
|
||||
|
||||
// Remove .gMenu from thumb menu's before initializing Superfish
|
||||
$("#gContent .gItem .gMenu").removeClass("gMenu");
|
||||
$("#gContent .gQuick + ul").addClass("gThumbMenu")
|
||||
// @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N
|
||||
|
||||
// Initialize Superfish menus
|
||||
$("ul.gMenu").addClass("sf-menu");
|
||||
@@ -40,20 +39,6 @@ $(document).ready(function() {
|
||||
$(dialogLinks[i]).bind("click", handleDialogEvent);
|
||||
}
|
||||
|
||||
// gThumbMenu
|
||||
if ($("#gContent .gThumbMenu").length) {
|
||||
$("#gContent .gThumbMenu li").addClass("ui-state-default");
|
||||
// ui-icon-triangle-1-n
|
||||
$("#gContent .gThumbMenu li a")
|
||||
.not('[class]')
|
||||
.addClass("gButtonLink ui-icon")
|
||||
.css({
|
||||
"height":"10px",
|
||||
"margin":"0",
|
||||
"padding":"0"
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize view menu
|
||||
if ($("#gViewMenu").length) {
|
||||
$("#gViewMenu ul").removeClass("gMenu").removeClass("sf-menu");
|
||||
@@ -109,6 +94,30 @@ $(document).ready(function() {
|
||||
}
|
||||
);
|
||||
|
||||
// Initialize thumbnail menus
|
||||
// @todo Toggle between north and south caret's on hover
|
||||
if ($("#gContent .gThumbMenu").length) {
|
||||
$("#gContent .gThumbMenu li").addClass("ui-state-default");
|
||||
$("#gContent .gThumbMenu li a")
|
||||
.not('[class]')
|
||||
.addClass("gButtonLink ui-icon ui-icon-caret-l-n")
|
||||
.css({
|
||||
height: "10px",
|
||||
margin: "0",
|
||||
padding: "0 0 3px 0"
|
||||
});
|
||||
|
||||
$(".gThumbMenu ul").hide();
|
||||
$(".gThumbMenu").hover(
|
||||
function() {
|
||||
$(this).find("ul").slideDown("fast");
|
||||
},
|
||||
function() {
|
||||
$(this).find("ul").slideUp("slow");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user