Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - CannabisCow

Pages: [1]
1
Feedback & Suggestions / Ist eine neue Version geplant ?
« on: February 25, 2003, 07:00:09 PM »
hi,

könnte mir einer von den entwicklern sagen, ob derzeit eine neue version in planung ist? bzw. ob in nächster zeit, eine geplant ist?

oder bastelt ihr an was ganz neuem?  :D

Gruss CCow

2
This little Mod, save all settings from 4images in a file.
Dieser kleine Hack, speichert alle Einstellungen von 4images in einer Datei.

###########################################################
## create a new file in ./includes called options.inc.php and CHMOD 0777
## erstelle eine neue Datei im Ordner ./includes namens options.inc.php und gebe ihr die rechte 0777 (CHMOD)
###########################################################

###########################################################
## ./global.php
###########################################################

///////////////////////////////////////////////////////////
// search // suche
///////////////////////////////////////////////////////////
Code: [Select]

//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
        FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
  echo $lang['no_settings'];
  exit;
}
while ($row = $site_db->fetch_array($result)) {
  $config[$row['setting_name']] = $row['setting_value'];
}
$site_db->free_result();


///////////////////////////////////////////////////////////
// replace with // ersetze mit
///////////////////////////////////////////////////////////
Code: [Select]

//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
if ( !file_exists(ROOT_PATH.'includes/options.inc.php') )
{
echo $lang['no_settings'];
exit();
}
else
{
require(ROOT_PATH.'includes/options.inc.php');
}


###########################################################
## ./admin/settings.php
###########################################################

///////////////////////////////////////////////////////////
// search // suche
///////////////////////////////////////////////////////////
Code: [Select]
if ($action == "updatesettings") {
  $setting_item = $HTTP_POST_VARS['setting_item'];
  foreach ($setting_item as $key => $val) {
    $val = un_htmlspecialchars(trim($val));
    $sql = "UPDATE ".SETTINGS_TABLE."
            SET setting_value = '$val'
            WHERE setting_name = '$key'";
    $site_db->query($sql);
  }

 
///////////////////////////////////////////////////////////
// add after // füge danach hinzu
///////////////////////////////////////////////////////////
Code: [Select]
create_optionsinc();


###########################################################
## ./includes/functions.php
###########################################################

///////////////////////////////////////////////////////////
// search // suche
///////////////////////////////////////////////////////////
Code: [Select]
?>
 
///////////////////////////////////////////////////////////
// add before // füge davor hinzu
///////////////////////////////////////////////////////////
Code: [Select]

function create_optionsinc(){
global $site_db;
$fp = fopen(ROOT_PATH.'includes/options.inc.php', 'w+');
fwrite($fp, "<?php\n\n\$config = array&#40;\n"&#41;;
  
$result $site_db->query&#40;"SELECT setting_name, setting_value FROM ".SETTINGS_TABLE.""&#41;;
while&#40;$row = $site_db->fetch_array&#40;$result&#41;&#41;
&#123;
fwrite&#40;$fp, "'".$row['setting_name'&#93;."' => '".str_replace&#40;"\"","\\\"",$row['setting_value'&#93;&#41;."',\n"&#41;;
&#125;

fwrite&#40;$fp, "&#41;;\n\n?>
");
fclose($fp);
}

 
after installation, have you a Query less
Should go
Nachdem Einbau, hast du nun einen Query weniger
Sollte gehen

Soory for my bad english :( ;)

3
###############################################################
##
## Dieser Hack erlaubt euch, die Kategorien beliebig zu ordnen.
##
##############################################################


===============================================================
== ./global.php
===============================================================
///////////////////////////////////////////
// search
///////////////////////////////////////////
Code: [Select]

  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
          FROM ".CATEGORIES_TABLE." c
          LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
          GROUP BY c.cat_id
          ORDER BY c.cat_order, c.cat_name ASC";


//////////////////////////////
// replace with
//////////////////////////////
Code: [Select]

  $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
          FROM ".CATEGORIES_TABLE." c
          LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
          GROUP BY c.cat_id
          ORDER BY ".$config['cat_order']."";



===============================================================
== ./lang/{lang}/admin.php
===============================================================
///////////////////////////////////////////
// search
///////////////////////////////////////////
Code: [Select]
/*-- Setting-Group 3 --*/


///////////////////////////////////////////
// add before
///////////////////////////////////////////
Code: [Select]
$setting['cat_order'] = "Nach welchem Prinzip, sollen die Kategorien bzw. Subkategorien geordnet werden";
$cat_order_array = array(
'c.cat_order' => 'Manuell',
'c.cat_name ASC' => 'Name Aufsteigend',
'c.cat_name DESC' => 'Name Absteigend'
);


===============================================================
== ./admin/settings.php
===============================================================
///////////////////////////////////////////
// search
///////////////////////////////////////////
 
Code: [Select]
show_setting_row("num_subcats");


///////////////////////////////////////////
// add after
///////////////////////////////////////////
 
Code: [Select]
show_setting_row("cat_order", "show_cat_order");
 
///////////////////////////////////////////
// search
///////////////////////////////////////////
Code: [Select]
function show_image_order_select($setting_name, $setting_value) {
  global $image_order_optionlist;
  echo "<select name=\"setting_item[".$setting_name."]\">";
  foreach ($image_order_optionlist as $key => $val) {
    echo "<option value=\"$key\"";
    if ($setting_value == $key) {
      echo " selected=\"selected\"";
    }
    echo ">".$val."</option>";
  }
  echo "</select>";
}

///////////////////////////////////////////
// add after
///////////////////////////////////////////
 
Code: [Select]
function show_cat_order($setting_name, $setting_value) {
global $cat_order_array;

  echo "<select name=\"setting_item[".$setting_name."]\">";
  foreach ($cat_order_array as $key => $val) {
    echo "<option value=\"$key\"";
    if ($setting_value == $key) {
      echo " selected=\"selected\"";
    }
    echo ">".$val."</option>";
  }
  echo "</select>";
}


===============================================================
== SQL (add this with phpmyadmin or run this installer --> installer (thx V@no for this installer)
===============================================================
Code: [Select]

INSERT INTO `4images_settings` ( `setting_name` , `setting_value` )
VALUES (
'cat_order', 'c.cat_name ASC'
);


PS: Viel Spass, hoffe hab nix vergessen  :wink:

Pages: [1]