Hi!
THX an @mawenzi !
so zum mod selber:
Code Update: 14.06.2011 Schritt 10.) u. 11.)
- seiten navigation hinzugefügt.
oben in der "last_modified.php" könnt ihr die Zeilen pro Seite einstellen.
DEMO: Demo1.) erstellt ein neues feld in eurer datenbank:
(alternativ könnt ihr euch die "install_modifi.php" aus den anhang herrunter laden, in euer root verzeichniss laden und ausführen)
alter table `4images_images` ADD `image_update` INT(11) NOT NULL DEFAULT 0
2.) fügt folgende zeile in "includes/db_field_definition.php" ein:
//#################################### Start Mod Last Modifi #################################################
$additional_image_fields['image_update'] = array($lang['image_update'], "INT", 0);
//#################################### End Mod Last Modifi #################################################
3.)suche in lang/deutsch/main.php:
//-----------------------------------------------------
//--- Image Details -----------------------------------
//-----------------------------------------------------
füge danach ein:
//#################################### Start Mod Last Modifi #################################################
$lang['last_modified'] = "Letzte Bildbearbeitung";
$lang['last_modified_update'] = "Bilder die zuletzt Bearbeitet wurden";
$lang['last_image_ranking']= "Rang";
$lang['last_image_user']= "Benutzer";
$lang['image_update'] = "Letztes mal Bearbeitet:";
$lang['last_image_update'] = "Letztes mal Bearbeitet";
$lang['last_image_name']= "Bildname";
//#################################### End Mod Last Modifi #################################################
4.) suche in der member.php:
$sql = "UPDATE ".IMAGES_TABLE."
SET image_name = '$image_name', image_description = '$image_description', image_keywords = '$image_keywords'".$additional_sql."
WHERE image_id = $image_id";
und ersetze es mit:
//#################################### Start Mod Last Modifi #################################################
$update_time = time();
$sql = "UPDATE ".IMAGES_TABLE."
SET image_name = '$image_name', image_description = '$image_description', image_keywords = '$image_keywords',image_update = '$update_time'".$additional_sql."
WHERE image_id = $image_id";
//#################################### End Mod Last Modifi #################################################
5.) suche in der details.php:
"lang_keywords" => $lang['keywords'],
füge darunter ein:
//#################################### Start Mod Last Modifi ###############################################
"lang_image_update"=> $lang['image_update'],
"image_update" => ($image_row['image_update'] > '0') ? (format_date($config['date_format']." ".$config['time_format'], $image_row['image_update'])): "",
//#################################### End Mod Last Modifi #################################################
6.) suche in includes/pageheader.php:
"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),füge darüber ein:
//#################################### Start Last Modified #################################################
"url_last_modified" => $site_sess->url(ROOT_PATH."last_modified.php"),
//#################################### End Last Modified #################################################
suche:
"lang_new_images" => $lang['new_images'],
füge darüber ein:
//#################################### Start Last Modified #################################################
"lang_last_modified" => $lang['last_modified'],
//#################################### End Last Modified #################################################
7.) suche in teplates/euerTemplates/details.html:
<tr>
<td valign="top" class="row1"><b>{lang_date}</b></td>
<td valign="top" class="row1">{image_date}</td>
</tr>
und füge darunter ein:
{if image_update}
<tr>
<td valign="top" class="row1"><b>{lang_image_update}</b></td>
<td valign="top" class="row1">{image_update}</td>
</tr>
{endif image_update}
8.)suche in admin/images.php:
$sql = "UPDATE ".IMAGES_TABLE."
SET cat_id = $cat_id, user_id = $user_id, image_name = '$image_name', image_description = '$image_description', image_date = $image_date, image_keywords = '$image_keywords', image_active = $image_active, image_media_file = '$new_name', image_thumb_file = '$new_thumb_name', image_download_url = '$image_download_url', image_allow_comments = $image_allow_comments, image_downloads = $image_downloads, image_votes = $image_votes, image_rating = '$image_rating', image_hits = $image_hits ".$additional_sql."
WHERE image_id = $image_id";
$result = $site_db->query($sql);
füge darunter ein:
$update_time = time();
$sql = "UPDATE ".IMAGES_TABLE."
SET image_update = '$update_time'
WHERE image_id = $image_id ";
$res = $site_db->query($sql);
die folgenden schritte braucht ihr nur zu machen wenn ihr die "last_modified" als eigenes templates haben wollt.
9.) suche in templates/yourTemplates home.html:
<a href="{url_top_images}"><b>{lang_top_images}</b></a>
und füge darüber ein:
<a href="{url_last_modified}"><b>{lang_last_modified}</b></a>
10.) erstelle eine neue Datei mit den namen "last_modified.php" und kopier sie in 4images/root:
<?php
//error_reporting(E_ALL);
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: last_modified.php *
* Copyright: (C) 2002-2009 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.10 *
* File Version: 1.1 (by Rembrandt www.vienna-pictures.com) *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$main_template = 'last_modified';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
//############# Start Config ###############
//how many rows per page
$per_page = 7;
//############# End Config #################
$cache_id = create_cache_id(
'page.last_modified',
array(
$user_info[$user_table_fields['user_id']],
$cat_id,
$config['template_dir'],
$config['language_dir']
)
);
if (!$cache_page_top || !$content = get_cache_file($cache_id)) {
if ($cache_page_top) {
// Always append session id if cache is enabled
$old_session_mode = $site_sess->mode;
$site_sess->mode = 'get';
}
ob_start();
$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
$sql = "SELECT COUNT(image_update) AS num_updates
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql) AND image_update <> 0
";
$result = $site_db->query_firstrow($sql);
$num_updates = $result['num_updates'];
$site_db->free_result();
$num_rows_all = (isset($num_updates)) ? $num_updates : 0;
$link_arg = $site_sess->url(ROOT_PATH."last_modified.php");
include_once(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $per_page, $num_rows_all);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$sql = "SELECT i.image_id,i.cat_id,i.image_name, i.image_update, i.user_id, u.user_id,u.user_name,u.user_lastaction,c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".USERS_TABLE." u,".CATEGORIES_TABLE." c)
WHERE i.image_active = 1 AND i.user_id = u.user_id AND i.cat_id NOT IN ($cat_id_sql) AND image_update != 0 AND i.cat_id = c.cat_id
ORDER BY image_update DESC
LIMIT $offset, $per_page
";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$modified = "<table style=\"width:".$config['image_table_width'].";\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"0\"summary=\"comments\">";
$modified .= "<tr class=\"imagerow2\">\n";
$modified .= "<td class=\"head1\"style=\"width:5%;text-align:center; \"><b>".$lang['last_image_ranking']."</b></td>\n";
$modified .= "<td class=\"head1\"style=\"width:30%;text-align:center; \"><b>".$lang['last_image_name']."</b></td>\n";
$modified .= "<td class=\"head1\"style=\"width:20%;text-align:center; \"><b>".$lang['last_image_update']."</b></td>\n";
$modified .= "<td class=\"head1\"style=\"width:30%;text-align:center; \"><b>".$lang['last_image_user']."</b></td>\n";
$modified .= "</tr>\n";
$count = 0;
$bgcounter = 0;
$rank = $offset + 1;
while ($row = $site_db->fetch_array($result)){
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$modified .= "<tr class=\"imagerow".$row_bg_number."\">\n";
$modified .= "<td style=\"width:5%;text-align:center; \">".$rank++."</td>\n";
$modified .= (check_permission("auth_viewimage", $row['cat_id'])) ? "<td style=\"width:30%;text-align:center; \"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".format_text($row['image_name'])."</a></td>\n" : "<td style=\"width:28%;text-align:center; \">".format_text($row['image_name'])."</td>\n";
$modified .= "<td style=\"width:30%;text-align:center; \">".format_date($config['date_format']." ".$config['time_format'], $row['image_update'])."</td>\n";
if (isset($row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id'];
$modified .= "<td style=\"width:30%;text-align:center; \"><a href=\"".$site_sess->url($user_profile_link)."\">".format_text($row[$user_table_fields['user_name']])."</a></td>\n";
}
else {
$modified .= "<td style=\"width:20%;text-align:center; \">".$lang['userlevel_guest']."</td>\n";
}
$count++;
if ($count == $num_rows) {
$modified .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($num_rows - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$modified .= "<td style=\"width:".$imgtable_width."\">\n \n</td>\n";
}
$modified .= "</tr>\n";
}
}
$modified .= "</table>\n";
$site_template->register_vars("last_modified", $modified);
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($cat_id && isset($cat_cache[$cat_id])) {
$clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $lang['last_modified']."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream,
"last_modified_update" => $lang['last_modified_update'],
"lang_last_image_update" =>$lang['last_image_update'],
"lang_last_image_ranking" => $lang['last_image_ranking'],
"lang_last_image_user" => $lang['last_user'],
"lang_last_image_update" => $lang['last_image_update'],
"lang_last_image_name" => $lang['last_image_name'],
));
$site_template->print_template($site_template->parse_template($main_template));
$content = ob_get_contents();
ob_end_clean();
if ($cache_page_top) {
// Reset session mode
$site_sess->mode = $old_session_mode;
save_cache_file($cache_id, $content);
}
} // end if get_cache_file()
echo $content;
include(ROOT_PATH.'includes/page_footer.php');
?>
11.) erstelle eine neue datei mit dem namen last_modified.html und kopiere sie in templates/yourtemplates ordner.
{header}
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehead">
<tr>
<td width="100%" colspan="4"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="6"><img src="{template_url}/images/header_top_left.gif" width="6" height="6" alt="" /></td>
<td width="100%"><img src="{template_url}/images/header_top.gif" width="100%" height="6" alt="" /></td>
<td width="6"><img src="{template_url}/images/header_top_right.gif" width="6" height="6" alt="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
<td width="100%"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
<td width="225" align="right">
<form method="post" action="{url_search}">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<input type="text" name="search_keywords" size="15" class="searchinput" />
</td>
<td>
<input type="submit" value="{lang_search}" class="button" name="submit" />
</td>
</tr>
<tr valign="top">
<td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
</tr>
</table>
</form>
</td>
<td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bordercolor">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tablebgcolor">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="navbar" height="23">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
<td align="right">
<a href="{url_top_comments}"><b>{lang_last_modified}</b></a>
<a href="{url_top_images}"><b>{lang_top_images}</b></a>
<a href="{url_new_images}"><b>{lang_new_images}</b></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" class="row2" valign="top">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">{user_box}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{if random_image}
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">
<br />
{random_image}
<br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{endif random_image}
</td>
<td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
<td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>
<td width="100%" valign="top">
<br />
<span class="title">{last_modified_update}</span>
<hr size="1" />
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="bordercolor">
{last_modified}
</td>
</tr>
</table>
{paging}
<p> </p>
</td>
<td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
<tr>
<td width="6" nowrap><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
<td width="100%"></td>
<td width="6" nowrap><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
</tr>
</table>
</td>
</tr>
</table>
{footer}
mfg Andi