UPDATE v1.1 FERTIG / UPDATE v1.1 READY
Startpost
[/size]
Trotzdem, wer es braucht eine gute Idee
Danke dir
Ihr habt ja auch Recht, aber ich zwinge ja auch niemanden so etwas zu nutzen.
Für mich ist das reine Übung und wenn daraus fertige Modifikationen entstehen, biete ich diese einfach und sehr gerne an.
Hi!
Danke fürs Veröffentlichen!
Ich sehe es ähnlich wie @Jan-Lukas, vor allem aber die CSRF Einstellungen und die Möglichkeit es mit einen klick abzuschalten.
Ein unbedarfter User kann damit auf seinen Server eine potenzielle Sicherheitslücke öffnen, ich würde es mir an deiner stelle nochmal überlegen so eine Möglichkeit anzubieten,
vor allem wenn dann tatsächlich was passiert wie erklärst du das dann den betreffenden User?
mfg Andi
Mehr als ein Hinweis, welcher mit dem v1.1 Update jetzt dazu kam, kann ich nicht machen. Ich wollte einfach nur mal schauen ob man diese Funktionen schön und einfach über das ACP regeln kann.
Update v1.2
Neue Features
- User Begrüßung einschalten/ausschalten (
http://www.4homepages.de/forum/index.php?topic=26932.msg145954#msg145954)
- Neuesten Kategorien auf der Startseite ein/aus + Optionen (
http://www.4homepages.de/forum/index.php?topic=27253.msg148352#msg148352)
- Überschrift bei Kommentaren einschalten/ausschalten
- Anzahl der Punkte für die Bewertung erhöhen
- Bilderbeschreibung und Schlüsselwörter wahlweise als Pflichtfeld
Step #0
- Lade [MOD-UPDATE]Invisible_Settings_v1_2_build_163619112011.zip herunter
- Kopiere den Ordner "mods" in deinem Rootverzeichnis, dort wo auch die index.php und config.php liegt
- Kopiere die rate_form_disable.html in deinem templates/**TEMPLATE**/ Verzeichnis
- Führe die install_update.php aus
New Features
- User Welcome turn on / off (
http://www.4homepages.de/forum/index.php?topic=26932.msg145954#msg145954)
- New categories on home on/off + option (
http://www.4homepages.de/forum/index.php?topic=27253.msg148352#msg148352)
- Comment headline on/off
- Set more rating value
- image description and image_keywords as required field
Step #0
- Load [MOD UPDATE] Invisible_Settings_v1_2_build_163619112011.zip down
- Copy the folder "mods" in your root directory, where there is also the index.php and config.php
- Put the rate_form_disable.html in your templates/**TEMPLATE**/ folder
- Run the install_update.php
Step #1
Öffne / Open: includes/page_header.php
Suche / Search:
$site_template->register_vars("lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
Ersetze mit / Replace with:
if($config['user_gruss_onoff'] == 1) {
$site_template->register_vars( "lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", format_text($user_info['user_name'], 2), "<center>".$welcome."<br /><strong>". format_text($user_info['user_name'])."</strong></center>"));
}else{
$site_template->register_vars("lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
}
Suche / Search:
$user_box = $site_template->parse_template("user_loginform");Füge darüber ein / Add before:
$site_template->register_vars( "lang_loggedin_msg", "<center>".$welcome."<br><br><b>". $lang['userlevel_guest']."</b></center>");
Suche / Search:
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);Füge davor ein / Add before:
if($config['rating_button_disabled_after_vote_suffix'] == 1) {
$rate_suffix = "_".$user_info['user_id'];
} else {
$rate_suffix = "";
}Suche / Search:
if ($rating && $rating <= MAX_RATING && $id) {Ersetze mit / Replace with:
if ($rating && $rating <= $config['max_rating_number'] && $id) {Step #2
Öffne / Open: templates/**TEMPLATE**/user_loginform.html
Suche / Search:
<form action="{url_login}" method="post">
Davor einfügen / Add before:
{lang_loggedin_msg}
Step #3
Öffne / Open: templates/**TEMPLATE**/user_logininfo.html
Suche / Search:
{lang_loggedin_msg}<br /><br />
Ersetze mit / Replace with:
{lang_loggedin_msg}<br />
Step #4
Öffne / Open: index.php
Suche / Search:
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
Füge davor ein / Add before:
if($config['new_cat_on_home_onoff'] == 1) {
$num_new_cat = $config['new_cat_on_home_menge'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
GROUP BY i.cat_id DESC
ORDER BY i.cat_id DESC
LIMIT $num_new_cat";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$new_cat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$new_cat .= $lang['no_new_images'];
$new_cat .= "</td></tr></table>";
}
else {
$new_cat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$new_cat .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$new_cat .= "<td valign=\"top\">\n";
show_image($image_row);
$new_cat .= $site_template->parse_template("thumbnail_bit");
$new_cat .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$new_cat .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$new_cat .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$new_cat .= "</tr>\n";
}
}
$new_cat .= "</table>\n";
} // end else
$site_template->register_vars(array(
"new_cat_on_home" => ' <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="head1" valign="top">'.$lang['new_cat_on_home'].'</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="head1">'.$new_cat.'</td>
</tr>
</table>
<br />',
));
$site_template->register_vars("new_cat", $new_cat);
unset($new_cat);
}
Suche / Search:
$site_template->register_vars("new_images", $new_images);
unset($new_images);Füge danach ein / Add after:
if($config['cat_bycat_onoff'] == 1) {
//-----------------------------------------------------
//--- Show New Images By Category ---------------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$num_news_images_bycat = $config['cat_bycat_number'];
// Option Start
$bycat_in = array($config['cat_bycat']); // Change the Number in your category-id - ID ripping by commas
// Ändere die Nummer in deine Kategorie-ID - ID trennen durch Komma
// Option Ende
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").") AND i.cat_id IN (".implode(", ", $bycat_in).")
ORDER BY i.image_date DESC
LIMIT $num_news_images_bycat";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$news_images_bycat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$news_images_bycat .= $lang['no_news_images_bycat'];
$news_images_bycat .= "</td></tr></table>";
}
else {
$news_images_bycat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$news_images_bycat .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$news_images_bycat .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$news_images_bycat .= $site_template->parse_template("thumbnail_bit");
$news_images_bycat .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$news_images_bycat .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$news_images_bycat .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$news_images_bycat .= "</tr>\n";
}
}
$news_images_bycat .= "</table>\n";
} // end else
$site_template->register_vars("news_images_bycat", $news_images_bycat);
$site_template->register_vars(array(
"news_images_bycat_home" => ' <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="head1" valign="top">'.$config['news_images_bycat_name'].'</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="head1">'.$news_images_bycat.'</td>
</tr>
</table>
<br />',
));
unset($news_images_bycat);
}Step #5
Öffne / Open: includes/functions.php
Suche / Search:
$rate_form = "";
if (check_permission("auth_vote", $image_row['cat_id'])) {
$site_template->register_vars("rate", $lang['rate']);
$rate_form = $site_template->parse_template("rate_form");
}
$site_template->register_vars("rate_form", $rate_form);
$site_template->register_vars(array(
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
));
return true;
}
Ersetze mit / Replace with:
$rate_form = "";
if($config['rating_button_disabled_after_vote_onoff'] == 0) {
if($config['rating_disable_for_author'] == 1) {
if (check_permission("auth_vote", $image_row['cat_id'])) {
$site_template->register_vars("rate", $lang['rate']);
$rate_form = $site_template->parse_template("rate_form");
}
}else{
if (check_permission("auth_vote", $image_row['cat_id']) && $user_info['user_id'] != $image_row['user_id']) {
$site_template->register_vars("rate", $lang['rate']);
$rate_form = $site_template->parse_template("rate_form");
}
}
$site_template->register_vars("rate_form", $rate_form);
$site_template->register_vars(array(
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
));
} else {
if($config['rating_disable_for_author'] == 1) {
if (check_permission("auth_vote", $image_row['cat_id'])) {
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
}
}else{
if (check_permission("auth_vote", $image_row['cat_id']) && $user_info['user_id'] != $image_row['user_id']) {
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
}
}
$site_template->register_vars("rate_form", $rate_form);
$site_template->register_vars(array(
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
));
}
return true;
}
function rate_form($id, $rate_suffix = "", $rating = ""){
global $site_template, $session_info, $lang, $site_sess, $HTTP_COOKIE_VARS, $rate_suffix, $config;
$rate_show = $config['rating_button_disabled_after_vote_show_rate'];
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$split = explode(",", $key);
$cookie_rated[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$split_list = array();
foreach ($split_list_array as $key) {
$split = explode(",", $key);
$split_list[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$no_rateform = (in_array($id, $split_list) || in_array($id, $cookie_rated)) ? "disabled" : 0;
$rate_options = "<option value=\"\">--</option>\n";
for ($i = $config['max_rating_number']; $i; $i--){
$rate_options .= "<option value=\"".$i."\"".(($i == $rating && $rate_show) ? "selected" : "").">".$i."</option>\n";
}
$site_template->register_vars(array(
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? $lang['rating_finish'] : $lang['rate'],
"rate_options" => $rate_options,
"rate_button" => ($no_rateform) ? $no_rateform : ""
));
$rate_form = $site_template->parse_template("rate_form_disable");
return $rate_form;
}Suche / Search:
if (check_permission("auth_vote", $image_row['cat_id'])) {
$old_votes = $image_row['image_votes'];
$old_rating = $image_row['image_rating'];
$new_rating = (($old_rating * $old_votes) + $rating) / ($old_votes + 1);
$new_rating = sprintf("%.2f", $new_rating);
$sql = "UPDATE ".IMAGES_TABLE."
SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
WHERE image_id = $image_id";
$site_db->query($sql);
}
Ersetze mit / Replace with:
if($config['rating_disable_for_author'] == 1) {
if (check_permission("auth_vote", $image_row['cat_id'])) {
$old_votes = $image_row['image_votes'];
$old_rating = $image_row['image_rating'];
$new_rating = (($old_rating * $old_votes) + $rating) / ($old_votes + 1);
$new_rating = sprintf("%.2f", $new_rating);
$sql = "UPDATE ".IMAGES_TABLE."
SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
WHERE image_id = $image_id";
$site_db->query($sql);
}
}else{
if (check_permission("auth_vote", $image_row['cat_id']) && $user_info['user_id'] != $image_row['user_id']) {
$old_votes = $image_row['image_votes'];
$old_rating = $image_row['image_rating'];
$new_rating = (($old_rating * $old_votes) + $rating) / ($old_votes + 1);
$new_rating = sprintf("%.2f", $new_rating);
$sql = "UPDATE ".IMAGES_TABLE."
SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
WHERE image_id = $image_id";
$site_db->query($sql);
}
}
Step #6
Öffne / Open: details.php
Suche / Search:
if ($comment_headline == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
$error = 1;
}
Ersetze mit / Replace with:
if($config['comment_headline_onoff'] == 1) {
if ($comment_headline == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
$error = 1;
}
}
Step #7
Öffne / Open: postcards.php
Suche / Search 2x:
$expiry = time() - 60 * 60 * 24 * POSTCARD_EXPIRY;Ersetze mit / Replace with:
$expiry = time() - 60 * 60 * 24 * $config['days_postcards'];Step #8
Öffne / Open: includes/search_utils.php
Suche / Search 2x:
MIN_SEARCH_KEYWORD_LENGTH && $len <= MAX_SEARCH_KEYWORD_LENGTHErsetze mit / Replace with:
$config['MIN_SEARCH_KEYWORD_LENGTH'] && $len <= $config['MAX_SEARCH_KEYWORD_LENGTH']Step #9
Öffne / Open: member.php
Suche / Search:
if ($cat_id == 0) {Davor einfügen / Add before:
if($config['image_description_required'] == 1) {
if ($image_description == "") {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['image_description_required']), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
}
if($config['image_keywords_required'] == 1) {
if ($image_keywords == "") {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['image_keywords_required']), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
} Step #10
Öffne / Open: templates/**TEMPLATE**/home.html
Suche / Search:
{if msg}<b>{msg}</b><br /><br />{endif msg}
Davor einfügen / Add before:
{new_cat_on_home}
{news_images_bycat_home}