Merge remote-tracking branch 'gallery3-contrib/master'
This commit is contained in:
commit
512ae22931
@ -40,7 +40,7 @@ class Admin_Albumpassword_Controller extends Admin_Controller {
|
|||||||
// Should protected items be hidden, or completely in-accessable?
|
// Should protected items be hidden, or completely in-accessable?
|
||||||
$albumpassword_group = $form->group("album_password_group");
|
$albumpassword_group = $form->group("album_password_group");
|
||||||
$albumpassword_group->checkbox("hideonly")
|
$albumpassword_group->checkbox("hideonly")
|
||||||
->label("Only hide protected albums?")
|
->label(t("Do not require passwords"))
|
||||||
->checked(module::get_var("albumpassword", "hideonly"));
|
->checked(module::get_var("albumpassword", "hideonly"));
|
||||||
|
|
||||||
// Add a save button to the form.
|
// Add a save button to the form.
|
||||||
|
@ -115,6 +115,7 @@ class albumpassword_Controller extends Controller {
|
|||||||
public function logout() {
|
public function logout() {
|
||||||
// Delete a stored password cookie.
|
// Delete a stored password cookie.
|
||||||
cookie::delete("g3_albumpassword");
|
cookie::delete("g3_albumpassword");
|
||||||
|
cookie::delete("g3_albumpassword_id");
|
||||||
url::redirect(url::abs_site("albums/1"));
|
url::redirect(url::abs_site("albums/1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ class albumpassword_Controller extends Controller {
|
|||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
// If the password if valid, then store it, and display a success message.
|
// If the password if valid, then store it, and display a success message.
|
||||||
// If not, close the dialog and display a rejected message.
|
// If not, close the dialog and display a rejected message.
|
||||||
|
cookie::delete("g3_albumpassword_id");
|
||||||
cookie::set("g3_albumpassword", $album_password);
|
cookie::set("g3_albumpassword", $album_password);
|
||||||
message::success(t("Password Accepted."));
|
message::success(t("Password Accepted."));
|
||||||
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
|
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
|
||||||
|
@ -34,12 +34,32 @@ class item extends item_Core {
|
|||||||
$model->and_open()->join("albumpassword_idcaches", "items.id", "albumpassword_idcaches.item_id", "LEFT OUTER")
|
$model->and_open()->join("albumpassword_idcaches", "items.id", "albumpassword_idcaches.item_id", "LEFT OUTER")
|
||||||
->and_where("albumpassword_idcaches.item_id", "IS", NULL);
|
->and_where("albumpassword_idcaches.item_id", "IS", NULL);
|
||||||
|
|
||||||
|
// If in hide only mode, check and see if the current item is protected.
|
||||||
|
// If it is, log the user in with the password to view it.
|
||||||
|
if (module::get_var("albumpassword", "hideonly") == true) {
|
||||||
|
$existing_cacheditem = ORM::factory("albumpassword_idcache")->where("item_id", "=", $model->id)->order_by("cache_id")->find_all();
|
||||||
|
if (count($existing_cacheditem) > 0) {
|
||||||
|
$existing_cacheditem_password = ORM::factory("items_albumpassword")->where("id", "=", $existing_cacheditem[0]->password_id)->find_all();
|
||||||
|
if (cookie::get("g3_albumpassword") != $existing_cacheditem_password[0]->password) {
|
||||||
|
cookie::set("g3_albumpassword", $existing_cacheditem_password[0]->password);
|
||||||
|
cookie::set("g3_albumpassword_id", $existing_cacheditem_password[0]->id);
|
||||||
|
$model->or_where("albumpassword_idcaches.password_id", "=", $existing_cacheditem_password[0]->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ... Unless their password id corresponds with a valid password.
|
// ... Unless their password id corresponds with a valid password.
|
||||||
$existing_password = ORM::factory("items_albumpassword")->where("password", "=", cookie::get("g3_albumpassword"))->find_all();
|
$existing_password = ORM::factory("items_albumpassword")->where("password", "=", cookie::get("g3_albumpassword"))->find_all();
|
||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
foreach ($existing_password as $one_password) {
|
foreach ($existing_password as $one_password) {
|
||||||
|
if (cookie::get("g3_albumpassword_id") != "") {
|
||||||
|
if (cookie::get("g3_albumpassword_id") == $one_password->id) {
|
||||||
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Or the current user is the owner of the item.
|
// Or the current user is the owner of the item.
|
||||||
|
@ -48,9 +48,17 @@ class albumpassword_event_Core {
|
|||||||
->css_id("g-album-password-logout")
|
->css_id("g-album-password-logout")
|
||||||
->url(url::site("albumpassword/logout"))
|
->url(url::site("albumpassword/logout"))
|
||||||
->label(t("Clear password")));
|
->label(t("Clear password")));
|
||||||
|
$existing_password = "";
|
||||||
|
if (cookie::get("g3_albumpassword_id") != "") {
|
||||||
|
$existing_password = ORM::factory("items_albumpassword")
|
||||||
|
->where("password", "=", cookie::get("g3_albumpassword"))
|
||||||
|
->where("id", "=", cookie::get("g3_albumpassword_id"))
|
||||||
|
->find_all();
|
||||||
|
} else {
|
||||||
$existing_password = ORM::factory("items_albumpassword")
|
$existing_password = ORM::factory("items_albumpassword")
|
||||||
->where("password", "=", cookie::get("g3_albumpassword"))
|
->where("password", "=", cookie::get("g3_albumpassword"))
|
||||||
->find_all();
|
->find_all();
|
||||||
|
}
|
||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
while ($counter < count($existing_password)) {
|
while ($counter < count($existing_password)) {
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
<div class="g-block">
|
<div class="g-block">
|
||||||
<?= t("If this box is checked, protected albums will only be hidden. Anyone with the URL to either the album or it's contents will be able to access it without a password.") ?><br /><br />
|
|
||||||
<?= $albumpassword_form ?>
|
<?= $albumpassword_form ?>
|
||||||
|
<?= t("If this box is checked, accessing a protected album/photo/video will automatically log the visitor in with that items password.") ?><br /><br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,6 +18,12 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class batchtag_event_Core {
|
class batchtag_event_Core {
|
||||||
|
static function pre_deactivate($data) {
|
||||||
|
if ($data->module == "tag") {
|
||||||
|
$data->messages["warn"][] = t("The BatchTag module requires the Tags module.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static function module_change($changes) {
|
static function module_change($changes) {
|
||||||
// See if the Tags module is installed,
|
// See if the Tags module is installed,
|
||||||
// tell the user to install it if it isn't.
|
// tell the user to install it if it isn't.
|
||||||
|
@ -24,10 +24,17 @@ class batchtag_installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function deactivate() {
|
static function deactivate() {
|
||||||
// Clear the require tags message when metadescription is deactivated.
|
|
||||||
site_status::clear("batchtag_needs_tag");
|
site_status::clear("batchtag_needs_tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function can_activate() {
|
||||||
|
$messages = array();
|
||||||
|
if (!module::is_active("tag")) {
|
||||||
|
$messages["warn"][] = t("The BatchTag module requires the Tags module.");
|
||||||
|
}
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
static function uninstall() {
|
static function uninstall() {
|
||||||
module::delete("batchtag");
|
module::delete("batchtag");
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,15 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#g-batch-tag-form").ready(function() {
|
||||||
|
var url = "<?= url::site("tags") ?>" + "/autocomplete";
|
||||||
|
$("#g-batch-tag-form input:text").autocomplete(
|
||||||
|
url, {
|
||||||
|
max: 30,
|
||||||
|
multiple: true,
|
||||||
|
multipleSeparator: ',',
|
||||||
|
cacheLength: 1
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?= $batch_tag_form ?>
|
<?= $batch_tag_form ?>
|
@ -32,7 +32,6 @@ class CalendarView_Controller extends Controller {
|
|||||||
|
|
||||||
// Draw the page.
|
// Draw the page.
|
||||||
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
||||||
$template->css("calendarview_calendar.css");
|
|
||||||
$template->set_global("calendar_user", $display_user);
|
$template->set_global("calendar_user", $display_user);
|
||||||
$template->page_title = t("Gallery :: Calendar");
|
$template->page_title = t("Gallery :: Calendar");
|
||||||
$template->content = new View("calendarview_year.html");
|
$template->content = new View("calendarview_year.html");
|
||||||
|
@ -26,6 +26,14 @@ class calendarview_installer {
|
|||||||
site_status::clear("calendarview_needs_exif");
|
site_status::clear("calendarview_needs_exif");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function can_activate() {
|
||||||
|
$messages = array();
|
||||||
|
if (!module::is_active("exif")) {
|
||||||
|
$messages["warn"][] = t("The CalendarView module requires the EXIF module.");
|
||||||
|
}
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
static function uninstall() {
|
static function uninstall() {
|
||||||
module::delete("calendarview");
|
module::delete("calendarview");
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
class calendarview_theme_Core {
|
class calendarview_theme_Core {
|
||||||
|
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
return $theme->css("calendarview_menu.css");
|
$theme->css("calendarview_menu.css");
|
||||||
|
return $theme->css("calendarview_calendar.css");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,170 +9,87 @@
|
|||||||
<br/><?= $calendar_user_year_form ?><br /><br />
|
<br/><?= $calendar_user_year_form ?><br /><br />
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
// Search the db for all photos that were taken during the selected year.
|
||||||
|
if ($calendar_user == "-1") {
|
||||||
|
$items_for_year = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", ">=", mktime(0, 0, 0, 1, 1, $calendar_year))
|
||||||
|
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||||
|
->order_by("captured")
|
||||||
|
->find_all();
|
||||||
|
} else {
|
||||||
|
$items_for_year = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("owner_id", "=", $calendar_user)
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", ">=", mktime(0, 0, 0, 1, 1, $calendar_year))
|
||||||
|
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||||
|
->order_by("captured")
|
||||||
|
->find_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up some initial variables.
|
||||||
$counter_months = 1;
|
$counter_months = 1;
|
||||||
// Loop through January to November in the current year.
|
$counter_days = 0;
|
||||||
while ($counter_months <12) {
|
$counter = 0;
|
||||||
print "<div id=\"g-calendar-grid\">";
|
|
||||||
|
|
||||||
// Figure out if any photos were taken for the current month.
|
// Set up the January Calendar.
|
||||||
if ($calendar_user == "-1") {
|
// Check and see if any photos were taken in January,
|
||||||
$month_count = ORM::factory("item")
|
// If so, make the month title into a clickable link.
|
||||||
->viewable()
|
print "<div id=\"g-calendar-grid\">";
|
||||||
->where("type", "!=", "album")
|
if (date("n", $items_for_year[$counter]->captured) == 1) {
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($month_count > 0) {
|
|
||||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||||
} else {
|
} else {
|
||||||
$month_url = "";
|
$month_url = "";
|
||||||
}
|
}
|
||||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
|
||||||
// If there are photos, loop through each day in the month and display links on the correct dates.
|
// Loop through each photo taken during this year, and see what month and day they were taken on.
|
||||||
if ($month_count > 0) {
|
// Make the corresponding dates on the calendars into clickable links.
|
||||||
$curr_day = 1;
|
while ($counter < (count($items_for_year))) {
|
||||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
|
||||||
while ($curr_day < $MAX_DAYS) {
|
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
|
||||||
}
|
|
||||||
$curr_day++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the last day of the month seperately, because the mktime code is different.
|
// Check and see if we've switched to a new month.
|
||||||
if ($calendar_user == "-1") {
|
// If so, render the current calendar and set up a new one.
|
||||||
$day_count = ORM::factory("item")
|
while (date("n", $items_for_year[$counter]->captured) > $counter_months) {
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<",mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo $calendar->render();
|
echo $calendar->render();
|
||||||
print "</div>";
|
print "</div>";
|
||||||
$counter_months++;
|
$counter_months++;
|
||||||
}
|
$counter_days = 0;
|
||||||
|
|
||||||
// Do December seperately, because the mktime code is different.
|
|
||||||
print "<div id=\"g-calendar-grid\">";
|
print "<div id=\"g-calendar-grid\">";
|
||||||
if ($calendar_user == "-1") {
|
if (date("n", $items_for_year[$counter]->captured) == $counter_months) {
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($month_count > 0) {
|
|
||||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||||
} else {
|
} else {
|
||||||
$month_url = "";
|
$month_url = "";
|
||||||
}
|
}
|
||||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
if ($month_count > 0) {
|
|
||||||
$curr_day = 1;
|
|
||||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
|
||||||
while ($curr_day < $MAX_DAYS) {
|
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
}
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
// If the day of the current photo is different then the day of the previous photo,
|
||||||
|
// then add a link to the calendar for this date and set the current day to this day.
|
||||||
|
if (date("j", $items_for_year[$counter]->captured) > $counter_days) {
|
||||||
|
$counter_days = date("j", $items_for_year[$counter]->captured);
|
||||||
|
$calendar->event($counter_days, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $counter_days));
|
||||||
}
|
}
|
||||||
$curr_day++;
|
|
||||||
|
// Move onto the next photo.
|
||||||
|
$counter++;
|
||||||
}
|
}
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
// Print out the last calendar to be generated.
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$counter_months++;
|
|
||||||
echo $calendar->render();
|
echo $calendar->render();
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
|
||||||
|
// If the calendar that was previously rendered was not December,
|
||||||
|
// then print out a few empty months for the rest of the year.
|
||||||
|
while ($counter_months < 13) {
|
||||||
|
print "<div id=\"g-calendar-grid\">";
|
||||||
|
$month_url = "";
|
||||||
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
echo $calendar->render();
|
||||||
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
<?= $theme->dynamic_bottom() ?>
|
||||||
|
@ -1,44 +1,33 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||||
|
<? $theme->start_combining("script,css") ?>
|
||||||
<title>
|
<title>
|
||||||
<? if ($page_title): ?>
|
<? if ($page_title): ?>
|
||||||
<?= $page_title ?>
|
<?= $page_title ?>
|
||||||
<? else: ?>
|
<? else: ?>
|
||||||
<? if ($theme->item()): ?>
|
<? if ($theme->item()): ?>
|
||||||
<? if ($theme->item()->is_album()): ?>
|
<?= $theme->item()->title ?>
|
||||||
<?= t("Browse Album :: %album_title", array("album_title" => $theme->item()->title)) ?>
|
|
||||||
<? elseif ($theme->item()->is_photo()): ?>
|
|
||||||
<?= t("Photo :: %photo_title", array("photo_title" => $theme->item()->title)) ?>
|
|
||||||
<? else: ?>
|
|
||||||
<?= t("Movie :: %movie_title", array("movie_title" => $theme->item()->title)) ?>
|
|
||||||
<? endif ?>
|
|
||||||
<? elseif ($theme->tag()): ?>
|
<? elseif ($theme->tag()): ?>
|
||||||
<?= t("Browse Tag :: %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
||||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||||
<?= t("Gallery") ?>
|
<?= item::root()->title ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
</title>
|
</title>
|
||||||
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
|
<link rel="shortcut icon"
|
||||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
|
||||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
type="image/x-icon" />
|
||||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
|
||||||
<?= $theme->css("gallery.common.css") ?>
|
|
||||||
<?= $theme->css("screen.css") ?>
|
|
||||||
<!--[if lt IE 8]>
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
|
||||||
media="screen,print,projection" />
|
|
||||||
<![endif]-->
|
|
||||||
<? if ($theme->page_type == "collection"): ?>
|
<? if ($theme->page_type == "collection"): ?>
|
||||||
<? if ($thumb_proportion != 1): ?>
|
<? if ($thumb_proportion != 1): ?>
|
||||||
<? $new_width = $thumb_proportion * 213 ?>
|
<? $new_width = round($thumb_proportion * 213) ?>
|
||||||
<? $new_height = $thumb_proportion * 240 ?>
|
<? $new_height = round($thumb_proportion * 240) ?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#g-content #g-album-grid .g-item {
|
.g-view #g-content #g-album-grid .g-item {
|
||||||
width: <?= $new_width ?>px;
|
width: <?= $new_width ?>px;
|
||||||
height: <?= $new_height ?>px;
|
height: <?= $new_height ?>px;
|
||||||
/* <?= $thumb_proportion ?> */
|
/* <?= $thumb_proportion ?> */
|
||||||
@ -46,6 +35,8 @@
|
|||||||
</style>
|
</style>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
|
||||||
|
<?= $theme->script("json2-min.js") ?>
|
||||||
<?= $theme->script("jquery.js") ?>
|
<?= $theme->script("jquery.js") ?>
|
||||||
<?= $theme->script("jquery.form.js") ?>
|
<?= $theme->script("jquery.form.js") ?>
|
||||||
<?= $theme->script("jquery-ui.js") ?>
|
<?= $theme->script("jquery-ui.js") ?>
|
||||||
@ -58,9 +49,8 @@
|
|||||||
<?= $theme->script("gallery.dialog.js") ?>
|
<?= $theme->script("gallery.dialog.js") ?>
|
||||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
<?= $theme->script("superfish/js/superfish.js") ?>
|
||||||
<?= $theme->script("jquery.localscroll.js") ?>
|
<?= $theme->script("jquery.localscroll.js") ?>
|
||||||
<?= $theme->script("ui.init.js") ?>
|
|
||||||
|
|
||||||
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
|
<? /* These are page specific but they get combined */ ?>
|
||||||
<? if ($theme->page_subtype == "photo"): ?>
|
<? if ($theme->page_subtype == "photo"): ?>
|
||||||
<?= $theme->script("jquery.scrollTo.js") ?>
|
<?= $theme->script("jquery.scrollTo.js") ?>
|
||||||
<?= $theme->script("gallery.show_full_size.js") ?>
|
<?= $theme->script("gallery.show_full_size.js") ?>
|
||||||
@ -69,6 +59,23 @@
|
|||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
|
||||||
<?= $theme->head() ?>
|
<?= $theme->head() ?>
|
||||||
|
|
||||||
|
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
|
||||||
|
<?= $theme->script("ui.init.js") ?>
|
||||||
|
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||||
|
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||||
|
<?= $theme->css("themeroller/ui.base.css") ?>
|
||||||
|
<?= $theme->css("screen.css") ?>
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
||||||
|
media="screen,print,projection" />
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
|
||||||
|
<?= $theme->get_combined("script") ?>
|
||||||
|
|
||||||
|
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
|
||||||
|
<?= $theme->get_combined("css") ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body <?= $theme->body_attributes() ?>>
|
<body <?= $theme->body_attributes() ?>>
|
||||||
@ -87,15 +94,16 @@
|
|||||||
<?= $theme->user_menu() ?>
|
<?= $theme->user_menu() ?>
|
||||||
<?= $theme->header_top() ?>
|
<?= $theme->header_top() ?>
|
||||||
|
|
||||||
<!-- hide the menu and make it visible after the page has loaded, to minimize menu flicker -->
|
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
|
||||||
<div id="g-site-menu" style="visibility: hidden">
|
<div id="g-site-menu" style="visibility: hidden">
|
||||||
<?= $theme->site_menu() ?>
|
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
||||||
|
|
||||||
<?= $theme->header_bottom() ?>
|
<?= $theme->header_bottom() ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<? // The following code was modifed to allow module-defined breadcrumbs.
|
<? // The following code was modifed to allow module-defined breadcrumbs.
|
||||||
// Everything else in this file is a copy of the default page.html.php file.
|
// Everything else in this file is a copy of the default page.html.php file.
|
||||||
?>
|
?>
|
||||||
@ -120,6 +128,8 @@
|
|||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? // End modified code ?>
|
<? // End modified code ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="bd">
|
<div id="bd">
|
||||||
<div id="yui-main">
|
<div id="yui-main">
|
||||||
|
9
3.0/modules/editcaptured/css/editcaptured.css
Normal file
9
3.0/modules/editcaptured/css/editcaptured.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#g-dialog select {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.g-editcaptured-usedate {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.g-editcaptured-setsubitems {
|
||||||
|
display: inline;
|
||||||
|
}
|
154
3.0/modules/editcaptured/helpers/editcaptured_event.php
Normal file
154
3.0/modules/editcaptured/helpers/editcaptured_event.php
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
class editcaptured_event_Core {
|
||||||
|
static function item_edit_form($item, $form) {
|
||||||
|
// Add a couple of drop-down boxes to allow the user to edit the date
|
||||||
|
// that $item was captured.
|
||||||
|
|
||||||
|
// We don't want to allow changes of the root album
|
||||||
|
if ($item->id == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Search if there are at least some child items containing a captured date
|
||||||
|
$model = ORM::factory("item")
|
||||||
|
->where("parent_id", "=", $item->id)
|
||||||
|
->where("captured", "IS NOT", null)
|
||||||
|
->order_by("captured", "ASC");
|
||||||
|
$first_child = $model->find();
|
||||||
|
if (!$first_child->id) $first_child = null;
|
||||||
|
|
||||||
|
// Chose preselected option, depending on wheather item already has captured date or not
|
||||||
|
if ($item->captured) {
|
||||||
|
$dateoptions_preselect = "selected";
|
||||||
|
} else {
|
||||||
|
$dateoptions_preselect = "remove";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Depending on wheather there are child items or not, we generate the dropdown options
|
||||||
|
if ($first_child) {
|
||||||
|
$dateoptions = array("selected" => t("Selected Date"),
|
||||||
|
"oldest" => t("Date of oldest Child"),
|
||||||
|
"youngest" => t("Date of youngest Child"),
|
||||||
|
"now" => t("Current Date"),
|
||||||
|
"remove" => t("Remove Date"));
|
||||||
|
|
||||||
|
// If there are child items with captured date, we preset the date field with the oldest item
|
||||||
|
if (!$item->captured && $first_child) {
|
||||||
|
$item->captured = $first_child->captured;
|
||||||
|
$dateoptions_preselect = "oldest";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$dateoptions = array("selected" => t("Selected Date"),
|
||||||
|
"now" => t("Current Date"),
|
||||||
|
"remove" => t("Remove Date"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add captured date field to the form
|
||||||
|
$form->edit_item->dateselect("capturedate")
|
||||||
|
->label(t("Captured"))
|
||||||
|
->minutes(1)
|
||||||
|
->years(1970, date('Y')+1)
|
||||||
|
->value($item->captured);
|
||||||
|
|
||||||
|
// Add dropdown menu for options to the form
|
||||||
|
$form->edit_item->dropdown("capturedate_usedate")
|
||||||
|
->options($dateoptions)
|
||||||
|
->id("g-editcaptured-usedate")
|
||||||
|
->selected($dateoptions_preselect);
|
||||||
|
|
||||||
|
// Add checkbox for users who want to change the captured date of subitems, too
|
||||||
|
if ($item->is_album()) {
|
||||||
|
$form->edit_item->checkbox("capturedate_setsubitems")
|
||||||
|
->label(t("Set also subitems's date"))
|
||||||
|
->id("g-editcaptured-setsubitems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function item_edit_form_completed($item, $form) {
|
||||||
|
// Change the item's captured field to the specified value.
|
||||||
|
|
||||||
|
// We don't want to change the root element, so check for that
|
||||||
|
if ($item->id == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Depending on the dropdown option, we set the date
|
||||||
|
switch ($form->edit_item->capturedate_usedate->value) {
|
||||||
|
|
||||||
|
// Just use the date selected in the form
|
||||||
|
case "selected":
|
||||||
|
$item->captured = $form->edit_item->capturedate->value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Use the date of the oldest child (we check again if there is such a child)
|
||||||
|
case "oldest":
|
||||||
|
$model = ORM::factory("item")
|
||||||
|
->where("parent_id", "=", $item->id)
|
||||||
|
->where("captured", "IS NOT", null)
|
||||||
|
->order_by("captured", "ASC");
|
||||||
|
$first_child = $model->find();
|
||||||
|
if ($first_child->id) {
|
||||||
|
$item->captured = $first_child->captured;
|
||||||
|
} else {
|
||||||
|
$item->captured = null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Use the date of the youngest child (we check again if there is such a child)
|
||||||
|
case "youngest":
|
||||||
|
$model = ORM::factory("item")
|
||||||
|
->where("parent_id", "=", $item->id)
|
||||||
|
->where("captured", "IS NOT", null)
|
||||||
|
->order_by("captured", "DESC");
|
||||||
|
$first_child = $model->find();
|
||||||
|
if ($first_child->id) {
|
||||||
|
$item->captured = $first_child->captured;
|
||||||
|
} else {
|
||||||
|
$item->captured = null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Use the current date
|
||||||
|
case "now":
|
||||||
|
$item->captured = time();
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Remove the date
|
||||||
|
case "remove":
|
||||||
|
$item->captured = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->save();
|
||||||
|
|
||||||
|
// Set the date also for all subitems (at the moment only direct subitems are supported
|
||||||
|
if ($item->is_album() && $form->edit_item->capturedate_setsubitems->checked) {
|
||||||
|
foreach (ORM::factory("item")->where("parent_id", "=", $item->id)->find_all() as $subitem) {
|
||||||
|
if ($subitem->loaded() && access::can("edit", $subitem)) {
|
||||||
|
$subitem->captured = $item->captured;
|
||||||
|
$subitem->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//message::success(t("Changed captured date of subitems"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
31
3.0/modules/editcaptured/helpers/editcaptured_theme.php
Normal file
31
3.0/modules/editcaptured/helpers/editcaptured_theme.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class editcaptured_theme_Core {
|
||||||
|
static function head($theme) {
|
||||||
|
if (!$theme->item()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$item = $theme->item();
|
||||||
|
if ( $item && access::can("edit", $item) ) {
|
||||||
|
$theme->css("editcaptured.css");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
3.0/modules/editcaptured/module.info
Normal file
3
3.0/modules/editcaptured/module.info
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = "Edit Captured Date"
|
||||||
|
description = "Edit the capture date of an element manually or semiautomatically based on date of subitems."
|
||||||
|
version = 2
|
@ -18,7 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class embed_videos_theme_Core {
|
class embed_videos_theme_Core {
|
||||||
static function head($theme) {
|
static function page_top($theme) {
|
||||||
$item = $theme->item();
|
$item = $theme->item();
|
||||||
if ($item && $item->is_photo()) {
|
if ($item && $item->is_photo()) {
|
||||||
$embedded_video = ORM::factory("embedded_video")
|
$embedded_video = ORM::factory("embedded_video")
|
||||||
|
@ -40,7 +40,7 @@ class Admin_Albumpassword_Controller extends Admin_Controller {
|
|||||||
// Should protected items be hidden, or completely in-accessable?
|
// Should protected items be hidden, or completely in-accessable?
|
||||||
$albumpassword_group = $form->group("album_password_group");
|
$albumpassword_group = $form->group("album_password_group");
|
||||||
$albumpassword_group->checkbox("hideonly")
|
$albumpassword_group->checkbox("hideonly")
|
||||||
->label("Only hide protected albums?")
|
->label(t("Do not require passwords"))
|
||||||
->checked(module::get_var("albumpassword", "hideonly"));
|
->checked(module::get_var("albumpassword", "hideonly"));
|
||||||
|
|
||||||
// Add a save button to the form.
|
// Add a save button to the form.
|
||||||
|
@ -115,6 +115,7 @@ class albumpassword_Controller extends Controller {
|
|||||||
public function logout() {
|
public function logout() {
|
||||||
// Delete a stored password cookie.
|
// Delete a stored password cookie.
|
||||||
cookie::delete("g3_albumpassword");
|
cookie::delete("g3_albumpassword");
|
||||||
|
cookie::delete("g3_albumpassword_id");
|
||||||
url::redirect(url::abs_site("albums/1"));
|
url::redirect(url::abs_site("albums/1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ class albumpassword_Controller extends Controller {
|
|||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
// If the password if valid, then store it, and display a success message.
|
// If the password if valid, then store it, and display a success message.
|
||||||
// If not, close the dialog and display a rejected message.
|
// If not, close the dialog and display a rejected message.
|
||||||
|
cookie::delete("g3_albumpassword_id");
|
||||||
cookie::set("g3_albumpassword", $album_password);
|
cookie::set("g3_albumpassword", $album_password);
|
||||||
message::success(t("Password Accepted."));
|
message::success(t("Password Accepted."));
|
||||||
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
|
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
|
||||||
|
@ -34,12 +34,32 @@ class item extends item_Core {
|
|||||||
$model->and_open()->join("albumpassword_idcaches", "items.id", "albumpassword_idcaches.item_id", "LEFT OUTER")
|
$model->and_open()->join("albumpassword_idcaches", "items.id", "albumpassword_idcaches.item_id", "LEFT OUTER")
|
||||||
->and_where("albumpassword_idcaches.item_id", "IS", NULL);
|
->and_where("albumpassword_idcaches.item_id", "IS", NULL);
|
||||||
|
|
||||||
|
// If in hide only mode, check and see if the current item is protected.
|
||||||
|
// If it is, log the user in with the password to view it.
|
||||||
|
if (module::get_var("albumpassword", "hideonly") == true) {
|
||||||
|
$existing_cacheditem = ORM::factory("albumpassword_idcache")->where("item_id", "=", $model->id)->order_by("cache_id")->find_all();
|
||||||
|
if (count($existing_cacheditem) > 0) {
|
||||||
|
$existing_cacheditem_password = ORM::factory("items_albumpassword")->where("id", "=", $existing_cacheditem[0]->password_id)->find_all();
|
||||||
|
if (cookie::get("g3_albumpassword") != $existing_cacheditem_password[0]->password) {
|
||||||
|
cookie::set("g3_albumpassword", $existing_cacheditem_password[0]->password);
|
||||||
|
cookie::set("g3_albumpassword_id", $existing_cacheditem_password[0]->id);
|
||||||
|
$model->or_where("albumpassword_idcaches.password_id", "=", $existing_cacheditem_password[0]->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ... Unless their password id corresponds with a valid password.
|
// ... Unless their password id corresponds with a valid password.
|
||||||
$existing_password = ORM::factory("items_albumpassword")->where("password", "=", cookie::get("g3_albumpassword"))->find_all();
|
$existing_password = ORM::factory("items_albumpassword")->where("password", "=", cookie::get("g3_albumpassword"))->find_all();
|
||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
foreach ($existing_password as $one_password) {
|
foreach ($existing_password as $one_password) {
|
||||||
|
if (cookie::get("g3_albumpassword_id") != "") {
|
||||||
|
if (cookie::get("g3_albumpassword_id") == $one_password->id) {
|
||||||
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$model->or_where("albumpassword_idcaches.password_id", "=", $one_password->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Or the current user is the owner of the item.
|
// Or the current user is the owner of the item.
|
||||||
|
@ -48,9 +48,17 @@ class albumpassword_event_Core {
|
|||||||
->css_id("g-album-password-logout")
|
->css_id("g-album-password-logout")
|
||||||
->url(url::site("albumpassword/logout"))
|
->url(url::site("albumpassword/logout"))
|
||||||
->label(t("Clear password")));
|
->label(t("Clear password")));
|
||||||
|
$existing_password = "";
|
||||||
|
if (cookie::get("g3_albumpassword_id") != "") {
|
||||||
|
$existing_password = ORM::factory("items_albumpassword")
|
||||||
|
->where("password", "=", cookie::get("g3_albumpassword"))
|
||||||
|
->where("id", "=", cookie::get("g3_albumpassword_id"))
|
||||||
|
->find_all();
|
||||||
|
} else {
|
||||||
$existing_password = ORM::factory("items_albumpassword")
|
$existing_password = ORM::factory("items_albumpassword")
|
||||||
->where("password", "=", cookie::get("g3_albumpassword"))
|
->where("password", "=", cookie::get("g3_albumpassword"))
|
||||||
->find_all();
|
->find_all();
|
||||||
|
}
|
||||||
if (count($existing_password) > 0) {
|
if (count($existing_password) > 0) {
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
while ($counter < count($existing_password)) {
|
while ($counter < count($existing_password)) {
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
<div class="g-block">
|
<div class="g-block">
|
||||||
<?= t("If this box is checked, protected albums will only be hidden. Anyone with the URL to either the album or it's contents will be able to access it without a password.") ?><br /><br />
|
|
||||||
<?= $albumpassword_form ?>
|
<?= $albumpassword_form ?>
|
||||||
|
<?= t("If this box is checked, accessing a protected album/photo/video will automatically log the visitor in with that items password.") ?><br /><br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +42,7 @@ class autorotate {
|
|||||||
}
|
}
|
||||||
if($degrees) {
|
if($degrees) {
|
||||||
$tmpfile = tempnam(TMPPATH, "rotate");
|
$tmpfile = tempnam(TMPPATH, "rotate");
|
||||||
gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees));
|
gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees), $item);
|
||||||
// Update EXIF info
|
// Update EXIF info
|
||||||
$data = new PelDataWindow(file_get_contents($tmpfile));
|
$data = new PelDataWindow(file_get_contents($tmpfile));
|
||||||
if (PelJpeg::isValid($data)) {
|
if (PelJpeg::isValid($data)) {
|
||||||
|
@ -25,42 +25,93 @@ class BatchTag_Controller extends Controller {
|
|||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
|
|
||||||
$input = Input::instance();
|
$input = Input::instance();
|
||||||
|
url::redirect(url::abs_site("batchtag/tagitems2?name={$input->post('name')}&item_id={$input->post('item_id')}&tag_subitems={$input->post('tag_subitems')}&csrf={$input->post('csrf')}"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tagitems2() {
|
||||||
|
// Tag all non-album items in the current album with the specified tags.
|
||||||
|
|
||||||
|
// Prevent Cross Site Request Forgery
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
$input = Input::instance();
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
if (($input->get("batchtag_max") == false) || ($input->get("batchtag_max") == "0")) {
|
||||||
|
$batchtag_max = "50";
|
||||||
|
} else {
|
||||||
|
$batchtag_max = $input->get("batchtag_max");
|
||||||
|
}
|
||||||
|
if ($input->get("batchtag_items_processed") == false) {
|
||||||
|
$batchtag_items_processed = "0";
|
||||||
|
} else {
|
||||||
|
$batchtag_items_processed = $input->get("batchtag_items_processed");
|
||||||
|
}
|
||||||
|
|
||||||
// Figure out if the contents of sub-albums should also be tagged
|
// Figure out if the contents of sub-albums should also be tagged
|
||||||
$str_tag_subitems = $input->post("tag_subitems");
|
$str_tag_subitems = $input->get("tag_subitems");
|
||||||
|
|
||||||
$children = "";
|
$children = "";
|
||||||
if ($str_tag_subitems == false) {
|
if ($str_tag_subitems == false) {
|
||||||
// Generate an array of all non-album items in the current album.
|
// Generate an array of all non-album items in the current album.
|
||||||
$children = ORM::factory("item")
|
$children = ORM::factory("item")
|
||||||
->where("parent_id", "=", $input->post("item_id"))
|
->where("parent_id", "=", $input->get("item_id"))
|
||||||
->where("type", "!=", "album")
|
->where("type", "!=", "album")
|
||||||
->find_all();
|
->find_all();
|
||||||
} else {
|
} else {
|
||||||
// Generate an array of all non-album items in the current album
|
// Generate an array of all non-album items in the current album
|
||||||
// and any sub albums.
|
// and any sub albums.
|
||||||
$item = ORM::factory("item", $input->post("item_id"));
|
$item = ORM::factory("item", $input->get("item_id"));
|
||||||
$children = $item->descendants();
|
$children = $item->descendants();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through each item in the album and make sure the user has
|
// Loop through each item in the album and make sure the user has
|
||||||
// access to view and edit it.
|
// access to view and edit it.
|
||||||
|
$children_count = "0";
|
||||||
|
$tag_count = "0";
|
||||||
|
|
||||||
|
//echo Kohana::debug($children);
|
||||||
|
|
||||||
|
echo '<style>.continue { margin: 5em auto; text-align: center; }</style>';
|
||||||
|
|
||||||
foreach ($children as $child) {
|
foreach ($children as $child) {
|
||||||
|
|
||||||
|
if ($tag_count < $batchtag_max) {
|
||||||
|
|
||||||
|
if ($children_count >= $batchtag_items_processed) {
|
||||||
if (access::can("view", $child) && access::can("edit", $child) && !$child->is_album()) {
|
if (access::can("view", $child) && access::can("edit", $child) && !$child->is_album()) {
|
||||||
|
|
||||||
// Assuming the user can view/edit the current item, loop
|
// Assuming the user can view/edit the current item, loop
|
||||||
// through each tag that was submitted and apply it to
|
// through each tag that was submitted and apply it to
|
||||||
// the current item.
|
// the current item.
|
||||||
foreach (explode(",", $input->post("name")) as $tag_name) {
|
foreach (explode(",", $input->get("name")) as $tag_name) {
|
||||||
$tag_name = trim($tag_name);
|
$tag_name = trim($tag_name);
|
||||||
if ($tag_name) {
|
if ($tag_name) {
|
||||||
tag::add($child, $tag_name);
|
tag::add($child, $tag_name);
|
||||||
}
|
}
|
||||||
|
// $tag_count should be inside the foreach loop as it is depending on the number of time tag:add is run
|
||||||
|
$tag_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo '<style>.c' . $children_count . ' { display:none; }</style>' . "\n";
|
||||||
|
$children_count++;
|
||||||
|
$batchtag_max_new = $tag_count;
|
||||||
|
echo '<div class="continue c' . $children_count . '"><a href="' . url::abs_site("batchtag/tagitems2?name={$input->get('name')}&item_id={$input->get('item_id')}&tag_subitems={$input->get('tag_subitems')}&batchtag_items_processed=$children_count&batchtag_max=$batchtag_max_new&csrf={$input->get('csrf')}") . '">Continue</a></div>';
|
||||||
|
} else { $children_count++; }
|
||||||
|
|
||||||
|
} else { break; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($tag_count < $batchtag_max) {
|
||||||
// Redirect back to the album.
|
// Redirect back to the album.
|
||||||
$item = ORM::factory("item", $input->post("item_id"));
|
$item = ORM::factory("item", $input->get("item_id"));
|
||||||
url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
|
url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
|
||||||
|
//echo url::abs_site("{$item->type}s/{$item->id}");
|
||||||
|
} else {
|
||||||
|
url::redirect(url::abs_site("batchtag/tagitems2?name={$input->get('name')}&item_id={$input->get('item_id')}&tag_subitems={$input->get('tag_subitems')}&batchtag_items_processed=$children_count&batchtag_max=$batchtag_max&csrf={$input->get('csrf')}"));
|
||||||
|
//echo url::abs_site("batchtag/tagitems2?name={$input->get('name')}&item_id={$input->get('item_id')}&tag_subitems={$input->get('tag_subitems')}&batchtag_items_processed=$children_count&batchtag_max=$batchtag_max&csrf={$input->get('csrf')}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,12 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class batchtag_event_Core {
|
class batchtag_event_Core {
|
||||||
|
static function pre_deactivate($data) {
|
||||||
|
if ($data->module == "tag") {
|
||||||
|
$data->messages["warn"][] = t("The BatchTag module requires the Tags module.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static function module_change($changes) {
|
static function module_change($changes) {
|
||||||
// See if the Tags module is installed,
|
// See if the Tags module is installed,
|
||||||
// tell the user to install it if it isn't.
|
// tell the user to install it if it isn't.
|
||||||
|
@ -24,10 +24,17 @@ class batchtag_installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function deactivate() {
|
static function deactivate() {
|
||||||
// Clear the require tags message when metadescription is deactivated.
|
|
||||||
site_status::clear("batchtag_needs_tag");
|
site_status::clear("batchtag_needs_tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function can_activate() {
|
||||||
|
$messages = array();
|
||||||
|
if (!module::is_active("tag")) {
|
||||||
|
$messages["warn"][] = t("The BatchTag module requires the Tags module.");
|
||||||
|
}
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
static function uninstall() {
|
static function uninstall() {
|
||||||
module::delete("batchtag");
|
module::delete("batchtag");
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,15 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#g-batch-tag-form").ready(function() {
|
||||||
|
var url = "<?= url::site("tags") ?>" + "/autocomplete";
|
||||||
|
$("#g-batch-tag-form input:text").autocomplete(
|
||||||
|
url, {
|
||||||
|
max: 30,
|
||||||
|
multiple: true,
|
||||||
|
multipleSeparator: ',',
|
||||||
|
cacheLength: 1
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?= $batch_tag_form ?>
|
<?= $batch_tag_form ?>
|
@ -1,12 +1,12 @@
|
|||||||
ABOUT:
|
ABOUT:
|
||||||
Shorten Gallery's album and item links using bit.ly's URL shortening service.
|
Shorten Gallery's album and item links using bit.ly's URL shortening service.
|
||||||
|
|
||||||
INSTALLATION AND CONFIGURATION INSTRUCTIONS:
|
INSTALLATION AND CONFIGURATION:
|
||||||
http://codex.gallery2.org/Gallery3:Modules:bitly
|
http://codex.gallery2.org/Gallery3:Modules:bitly
|
||||||
|
|
||||||
QUESTIONS, COMMENTS?
|
SUPPORT/BUG REPORTS:
|
||||||
http://2tbsp.com/content/bitly-module-gallery-3
|
http://gallery.menalto.com/node/100816
|
||||||
|
|
||||||
ROADMAP:
|
ROADMAP:
|
||||||
- Provide multi-user support.
|
* Provide multi-user support.
|
||||||
- Display shortened link statistics (clicks, etc.)
|
* Display shortened link statistics (clicks, etc.)
|
||||||
|
@ -32,7 +32,6 @@ class CalendarView_Controller extends Controller {
|
|||||||
|
|
||||||
// Draw the page.
|
// Draw the page.
|
||||||
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
||||||
$template->css("calendarview_calendar.css");
|
|
||||||
$template->set_global("calendar_user", $display_user);
|
$template->set_global("calendar_user", $display_user);
|
||||||
$template->page_title = t("Gallery :: Calendar");
|
$template->page_title = t("Gallery :: Calendar");
|
||||||
$template->content = new View("calendarview_year.html");
|
$template->content = new View("calendarview_year.html");
|
||||||
|
@ -26,6 +26,14 @@ class calendarview_installer {
|
|||||||
site_status::clear("calendarview_needs_exif");
|
site_status::clear("calendarview_needs_exif");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function can_activate() {
|
||||||
|
$messages = array();
|
||||||
|
if (!module::is_active("exif")) {
|
||||||
|
$messages["warn"][] = t("The CalendarView module requires the EXIF module.");
|
||||||
|
}
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
static function uninstall() {
|
static function uninstall() {
|
||||||
module::delete("calendarview");
|
module::delete("calendarview");
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
class calendarview_theme_Core {
|
class calendarview_theme_Core {
|
||||||
|
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
return $theme->css("calendarview_menu.css");
|
$theme->css("calendarview_menu.css");
|
||||||
|
return $theme->css("calendarview_calendar.css");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,170 +9,87 @@
|
|||||||
<br/><?= $calendar_user_year_form ?><br /><br />
|
<br/><?= $calendar_user_year_form ?><br /><br />
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
// Search the db for all photos that were taken during the selected year.
|
||||||
|
if ($calendar_user == "-1") {
|
||||||
|
$items_for_year = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", ">=", mktime(0, 0, 0, 1, 1, $calendar_year))
|
||||||
|
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||||
|
->order_by("captured")
|
||||||
|
->find_all();
|
||||||
|
} else {
|
||||||
|
$items_for_year = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("owner_id", "=", $calendar_user)
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", ">=", mktime(0, 0, 0, 1, 1, $calendar_year))
|
||||||
|
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||||
|
->order_by("captured")
|
||||||
|
->find_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up some initial variables.
|
||||||
$counter_months = 1;
|
$counter_months = 1;
|
||||||
// Loop through January to November in the current year.
|
$counter_days = 0;
|
||||||
while ($counter_months <12) {
|
$counter = 0;
|
||||||
print "<div id=\"g-calendar-grid\">";
|
|
||||||
|
|
||||||
// Figure out if any photos were taken for the current month.
|
// Set up the January Calendar.
|
||||||
if ($calendar_user == "-1") {
|
// Check and see if any photos were taken in January,
|
||||||
$month_count = ORM::factory("item")
|
// If so, make the month title into a clickable link.
|
||||||
->viewable()
|
print "<div id=\"g-calendar-grid\">";
|
||||||
->where("type", "!=", "album")
|
if (date("n", $items_for_year[$counter]->captured) == 1) {
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($month_count > 0) {
|
|
||||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||||
} else {
|
} else {
|
||||||
$month_url = "";
|
$month_url = "";
|
||||||
}
|
}
|
||||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
|
||||||
// If there are photos, loop through each day in the month and display links on the correct dates.
|
// Loop through each photo taken during this year, and see what month and day they were taken on.
|
||||||
if ($month_count > 0) {
|
// Make the corresponding dates on the calendars into clickable links.
|
||||||
$curr_day = 1;
|
while ($counter < (count($items_for_year))) {
|
||||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
|
||||||
while ($curr_day < $MAX_DAYS) {
|
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
|
||||||
}
|
|
||||||
$curr_day++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the last day of the month seperately, because the mktime code is different.
|
// Check and see if we've switched to a new month.
|
||||||
if ($calendar_user == "-1") {
|
// If so, render the current calendar and set up a new one.
|
||||||
$day_count = ORM::factory("item")
|
while (date("n", $items_for_year[$counter]->captured) > $counter_months) {
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<",mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo $calendar->render();
|
echo $calendar->render();
|
||||||
print "</div>";
|
print "</div>";
|
||||||
$counter_months++;
|
$counter_months++;
|
||||||
}
|
$counter_days = 0;
|
||||||
|
|
||||||
// Do December seperately, because the mktime code is different.
|
|
||||||
print "<div id=\"g-calendar-grid\">";
|
print "<div id=\"g-calendar-grid\">";
|
||||||
if ($calendar_user == "-1") {
|
if (date("n", $items_for_year[$counter]->captured) == $counter_months) {
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$month_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($month_count > 0) {
|
|
||||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||||
} else {
|
} else {
|
||||||
$month_url = "";
|
$month_url = "";
|
||||||
}
|
}
|
||||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
if ($month_count > 0) {
|
|
||||||
$curr_day = 1;
|
|
||||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
|
||||||
while ($curr_day < $MAX_DAYS) {
|
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
}
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
// If the day of the current photo is different then the day of the previous photo,
|
||||||
|
// then add a link to the calendar for this date and set the current day to this day.
|
||||||
|
if (date("j", $items_for_year[$counter]->captured) > $counter_days) {
|
||||||
|
$counter_days = date("j", $items_for_year[$counter]->captured);
|
||||||
|
$calendar->event($counter_days, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $counter_days));
|
||||||
}
|
}
|
||||||
$curr_day++;
|
|
||||||
|
// Move onto the next photo.
|
||||||
|
$counter++;
|
||||||
}
|
}
|
||||||
if ($calendar_user == "-1") {
|
|
||||||
$day_count = ORM::factory("item")
|
// Print out the last calendar to be generated.
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $calendar_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
if ($day_count > 0) {
|
|
||||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$counter_months++;
|
|
||||||
echo $calendar->render();
|
echo $calendar->render();
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
|
||||||
|
// If the calendar that was previously rendered was not December,
|
||||||
|
// then print out a few empty months for the rest of the year.
|
||||||
|
while ($counter_months < 13) {
|
||||||
|
print "<div id=\"g-calendar-grid\">";
|
||||||
|
$month_url = "";
|
||||||
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
echo $calendar->render();
|
||||||
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
<?= $theme->dynamic_bottom() ?>
|
||||||
|
@ -1,44 +1,33 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||||
|
<? $theme->start_combining("script,css") ?>
|
||||||
<title>
|
<title>
|
||||||
<? if ($page_title): ?>
|
<? if ($page_title): ?>
|
||||||
<?= $page_title ?>
|
<?= $page_title ?>
|
||||||
<? else: ?>
|
<? else: ?>
|
||||||
<? if ($theme->item()): ?>
|
<? if ($theme->item()): ?>
|
||||||
<? if ($theme->item()->is_album()): ?>
|
<?= $theme->item()->title ?>
|
||||||
<?= t("Browse Album :: %album_title", array("album_title" => $theme->item()->title)) ?>
|
|
||||||
<? elseif ($theme->item()->is_photo()): ?>
|
|
||||||
<?= t("Photo :: %photo_title", array("photo_title" => $theme->item()->title)) ?>
|
|
||||||
<? else: ?>
|
|
||||||
<?= t("Movie :: %movie_title", array("movie_title" => $theme->item()->title)) ?>
|
|
||||||
<? endif ?>
|
|
||||||
<? elseif ($theme->tag()): ?>
|
<? elseif ($theme->tag()): ?>
|
||||||
<?= t("Browse Tag :: %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
||||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||||
<?= t("Gallery") ?>
|
<?= item::root()->title ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
</title>
|
</title>
|
||||||
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
|
<link rel="shortcut icon"
|
||||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
|
||||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
type="image/x-icon" />
|
||||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
|
||||||
<?= $theme->css("gallery.common.css") ?>
|
|
||||||
<?= $theme->css("screen.css") ?>
|
|
||||||
<!--[if lt IE 8]>
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
|
||||||
media="screen,print,projection" />
|
|
||||||
<![endif]-->
|
|
||||||
<? if ($theme->page_type == "collection"): ?>
|
<? if ($theme->page_type == "collection"): ?>
|
||||||
<? if ($thumb_proportion != 1): ?>
|
<? if ($thumb_proportion != 1): ?>
|
||||||
<? $new_width = $thumb_proportion * 213 ?>
|
<? $new_width = round($thumb_proportion * 213) ?>
|
||||||
<? $new_height = $thumb_proportion * 240 ?>
|
<? $new_height = round($thumb_proportion * 240) ?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#g-content #g-album-grid .g-item {
|
.g-view #g-content #g-album-grid .g-item {
|
||||||
width: <?= $new_width ?>px;
|
width: <?= $new_width ?>px;
|
||||||
height: <?= $new_height ?>px;
|
height: <?= $new_height ?>px;
|
||||||
/* <?= $thumb_proportion ?> */
|
/* <?= $thumb_proportion ?> */
|
||||||
@ -46,6 +35,8 @@
|
|||||||
</style>
|
</style>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
|
||||||
|
<?= $theme->script("json2-min.js") ?>
|
||||||
<?= $theme->script("jquery.js") ?>
|
<?= $theme->script("jquery.js") ?>
|
||||||
<?= $theme->script("jquery.form.js") ?>
|
<?= $theme->script("jquery.form.js") ?>
|
||||||
<?= $theme->script("jquery-ui.js") ?>
|
<?= $theme->script("jquery-ui.js") ?>
|
||||||
@ -58,9 +49,8 @@
|
|||||||
<?= $theme->script("gallery.dialog.js") ?>
|
<?= $theme->script("gallery.dialog.js") ?>
|
||||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
<?= $theme->script("superfish/js/superfish.js") ?>
|
||||||
<?= $theme->script("jquery.localscroll.js") ?>
|
<?= $theme->script("jquery.localscroll.js") ?>
|
||||||
<?= $theme->script("ui.init.js") ?>
|
|
||||||
|
|
||||||
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
|
<? /* These are page specific but they get combined */ ?>
|
||||||
<? if ($theme->page_subtype == "photo"): ?>
|
<? if ($theme->page_subtype == "photo"): ?>
|
||||||
<?= $theme->script("jquery.scrollTo.js") ?>
|
<?= $theme->script("jquery.scrollTo.js") ?>
|
||||||
<?= $theme->script("gallery.show_full_size.js") ?>
|
<?= $theme->script("gallery.show_full_size.js") ?>
|
||||||
@ -69,6 +59,23 @@
|
|||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
|
||||||
<?= $theme->head() ?>
|
<?= $theme->head() ?>
|
||||||
|
|
||||||
|
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
|
||||||
|
<?= $theme->script("ui.init.js") ?>
|
||||||
|
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||||
|
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||||
|
<?= $theme->css("themeroller/ui.base.css") ?>
|
||||||
|
<?= $theme->css("screen.css") ?>
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
||||||
|
media="screen,print,projection" />
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
|
||||||
|
<?= $theme->get_combined("script") ?>
|
||||||
|
|
||||||
|
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
|
||||||
|
<?= $theme->get_combined("css") ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body <?= $theme->body_attributes() ?>>
|
<body <?= $theme->body_attributes() ?>>
|
||||||
@ -87,15 +94,16 @@
|
|||||||
<?= $theme->user_menu() ?>
|
<?= $theme->user_menu() ?>
|
||||||
<?= $theme->header_top() ?>
|
<?= $theme->header_top() ?>
|
||||||
|
|
||||||
<!-- hide the menu and make it visible after the page has loaded, to minimize menu flicker -->
|
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
|
||||||
<div id="g-site-menu" style="visibility: hidden">
|
<div id="g-site-menu" style="visibility: hidden">
|
||||||
<?= $theme->site_menu() ?>
|
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
||||||
|
|
||||||
<?= $theme->header_bottom() ?>
|
<?= $theme->header_bottom() ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<? // The following code was modifed to allow module-defined breadcrumbs.
|
<? // The following code was modifed to allow module-defined breadcrumbs.
|
||||||
// Everything else in this file is a copy of the default page.html.php file.
|
// Everything else in this file is a copy of the default page.html.php file.
|
||||||
?>
|
?>
|
||||||
@ -120,6 +128,8 @@
|
|||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? // End modified code ?>
|
<? // End modified code ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="bd">
|
<div id="bd">
|
||||||
<div id="yui-main">
|
<div id="yui-main">
|
||||||
|
@ -62,11 +62,11 @@ class Ecard_Controller extends Controller {
|
|||||||
$tmpfile = tempnam(TMPPATH, "clean");
|
$tmpfile = tempnam(TMPPATH, "clean");
|
||||||
if($form->send_ecard->send_thumbnail->checked == true) {
|
if($form->send_ecard->send_thumbnail->checked == true) {
|
||||||
$options = array("width" => module::get_var("gallery", "thumb_size"), "height" => module::get_var("gallery", "thumb_size"), "master" => Image::AUTO);
|
$options = array("width" => module::get_var("gallery", "thumb_size"), "height" => module::get_var("gallery", "thumb_size"), "master" => Image::AUTO);
|
||||||
gallery_graphics::resize($item->file_path(), $tmpfile, $options);
|
gallery_graphics::resize($item->file_path(), $tmpfile, $options, $item);
|
||||||
$mime->addHTMLImage($tmpfile,$item->mime_type,$item->name);
|
$mime->addHTMLImage($tmpfile,$item->mime_type,$item->name);
|
||||||
} else {
|
} else {
|
||||||
$options = array("width" => module::get_var("gallery", "resize_size"), "height" => module::get_var("gallery", "resize_size"), "master" => Image::AUTO);
|
$options = array("width" => module::get_var("gallery", "resize_size"), "height" => module::get_var("gallery", "resize_size"), "master" => Image::AUTO);
|
||||||
gallery_graphics::resize($item->file_path(), $tmpfile, $options);
|
gallery_graphics::resize($item->file_path(), $tmpfile, $options, $item);
|
||||||
$mime->addHTMLImage($tmpfile,$item->mime_type,$item->name);
|
$mime->addHTMLImage($tmpfile,$item->mime_type,$item->name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,7 +106,7 @@ class Embedded_videos_Controller extends Controller {
|
|||||||
$file = fopen($temp_filename, "wb");
|
$file = fopen($temp_filename, "wb");
|
||||||
fwrite($file, $content);
|
fwrite($file, $content);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
gallery_graphics::composite($temp_filename, $temp_filename, array("file" => "modules/embed_videos/images/embed_video_icon.png", "position" => "center", "transparency" => 95));
|
gallery_graphics::composite($temp_filename, $temp_filename, array("file" => "modules/embed_videos/images/embed_video_icon.png", "position" => "center", "transparency" => 95), $item);
|
||||||
$item->set_data_file($temp_filename);
|
$item->set_data_file($temp_filename);
|
||||||
$item->name = basename($itemname);
|
$item->name = basename($itemname);
|
||||||
$item->title = $title;
|
$item->title = $title;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class embed_videos_theme_Core {
|
class embed_videos_theme_Core {
|
||||||
static function head($theme) {
|
static function page_top($theme) {
|
||||||
$item = $theme->item();
|
$item = $theme->item();
|
||||||
if ($item && $item->is_photo()) {
|
if ($item && $item->is_photo()) {
|
||||||
$embedded_video = ORM::factory("embedded_video")
|
$embedded_video = ORM::factory("embedded_video")
|
||||||
|
@ -247,7 +247,7 @@ class Json_Album_Controller extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($degrees) {
|
if ($degrees) {
|
||||||
gallery_graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
|
gallery_graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees), $item);
|
||||||
|
|
||||||
list($item->width, $item->height) = getimagesize($item->file_path());
|
list($item->width, $item->height) = getimagesize($item->file_path());
|
||||||
$item->resize_dirty= 1;
|
$item->resize_dirty= 1;
|
||||||
|
@ -28,7 +28,8 @@ class max_size_event_Core {
|
|||||||
$tmpfile = $tempnam . "." . pathinfo($item->data_file, PATHINFO_EXTENSION);
|
$tmpfile = $tempnam . "." . pathinfo($item->data_file, PATHINFO_EXTENSION);
|
||||||
gallery_graphics::resize(
|
gallery_graphics::resize(
|
||||||
$item->data_file, $tmpfile,
|
$item->data_file, $tmpfile,
|
||||||
array("width" => $max_size, "height" => $max_size, "master" => Image::AUTO));
|
array("width" => $max_size, "height" => $max_size, "master" => Image::AUTO),
|
||||||
|
$item);
|
||||||
rename($tmpfile, $item->data_file);
|
rename($tmpfile, $item->data_file);
|
||||||
unlink($tempnam);
|
unlink($tempnam);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class rectangle_thumbs_graphics_Core {
|
|||||||
* @param string $output_file
|
* @param string $output_file
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
static function crop_to_aspect_ratio($input_file, $output_file, $options) {
|
static function crop_to_aspect_ratio($input_file, $output_file, $options, $item) {
|
||||||
graphics::init_toolkit();
|
graphics::init_toolkit();
|
||||||
|
|
||||||
if (@filesize($input_file) == 0) {
|
if (@filesize($input_file) == 0) {
|
||||||
|
@ -25,7 +25,7 @@ class square_thumbs_graphics_Core {
|
|||||||
* @param string $output_file
|
* @param string $output_file
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
static function crop_to_square($input_file, $output_file, $options) {
|
static function crop_to_square($input_file, $output_file, $options, $item) {
|
||||||
graphics::init_toolkit();
|
graphics::init_toolkit();
|
||||||
|
|
||||||
if (@filesize($input_file) == 0) {
|
if (@filesize($input_file) == 0) {
|
||||||
|
15
3.1/modules/twitter/README
Normal file
15
3.1/modules/twitter/README
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
ABOUT:
|
||||||
|
Share photos, movies, and albums on Twitter, directly from Gallery.
|
||||||
|
|
||||||
|
INSTALLATION AND CONFIGURATION:
|
||||||
|
http://codex.gallery2.org/Gallery3:Modules:twitter
|
||||||
|
|
||||||
|
SUPPORT/BUG REPORTS:
|
||||||
|
http://gallery.menalto.com/node/100791
|
||||||
|
|
||||||
|
ROADMAP:
|
||||||
|
* Provide a reset access token button on the user's profile.
|
||||||
|
* Display Twitter profile/follow links on Gallery user profile pages.
|
||||||
|
* Provide "Share on Twitter" for anonymous users.
|
||||||
|
* Display item (re)tweets.
|
||||||
|
* Twitter identity provider (log into Gallery with Twitter)
|
@ -60,6 +60,7 @@ class twitter_Core {
|
|||||||
* Get tweet form
|
* Get tweet form
|
||||||
* @param object $item
|
* @param object $item
|
||||||
* @return Forge
|
* @return Forge
|
||||||
|
* @todo Truncate the $tweet at 140 - strlen($url)
|
||||||
*/
|
*/
|
||||||
static function get_tweet_form($item) {
|
static function get_tweet_form($item) {
|
||||||
$long_url = url::abs_site($item->relative_url_cache);
|
$long_url = url::abs_site($item->relative_url_cache);
|
||||||
@ -81,7 +82,16 @@ class twitter_Core {
|
|||||||
} else {
|
} else {
|
||||||
$url = url::abs_site($item->relative_url_cache);
|
$url = url::abs_site($item->relative_url_cache);
|
||||||
}
|
}
|
||||||
$tweet = preg_replace("/%url/", $url, $tweet);
|
|
||||||
|
// Truncate the default tweet if it's too long
|
||||||
|
$url_length = strlen($url) + 1;
|
||||||
|
$tweet_length = strlen($tweet);
|
||||||
|
|
||||||
|
if (($tweet_length + $url_length) > self::$character_count) {
|
||||||
|
$trim_pos = 0 - (($tweet_length + $url_length) - 140);
|
||||||
|
$tweet = substr($tweet, 0, $trim_pos);
|
||||||
|
}
|
||||||
|
$tweet = $tweet . ' ' . $url;
|
||||||
|
|
||||||
$form = new Forge("twitter/tweet/$item->id", "", "post", array("id" => "g-twitter-tweet-form"));
|
$form = new Forge("twitter/tweet/$item->id", "", "post", array("id" => "g-twitter-tweet-form"));
|
||||||
$group = $form->group("twitter_message")->label(t("Compose Tweet"));
|
$group = $form->group("twitter_message")->label(t("Compose Tweet"));
|
||||||
@ -134,7 +144,7 @@ class twitter_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function reset_default_tweet() {
|
static function reset_default_tweet() {
|
||||||
return t("Check out this %type, '%title': %description %url");
|
return t("Check out this %type, '%title': %description");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ class twitter_event_Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function site_menu($menu, $theme) {
|
static function site_menu($menu, $theme) {
|
||||||
if ((identity::active_user()->id > 1) && twitter::is_registered()) {
|
|
||||||
$item = $theme->item();
|
$item = $theme->item();
|
||||||
|
if ($item && twitter::is_registered() && (identity::active_user()->id > 1)) {
|
||||||
$menu->get("options_menu")
|
$menu->get("options_menu")
|
||||||
->append(Menu::factory("dialog")
|
->append(Menu::factory("dialog")
|
||||||
->id("twitter")
|
->id("twitter")
|
||||||
|
Reference in New Issue
Block a user