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 - V@no

Pages: 1 ... 6 7 8 9 [10] 11 12 13 14
136
Chit Chat / An "Eastern Egg" from Jan? :D
« on: May 12, 2003, 12:37:46 PM »
I was messing with top.php today and found very nice "not published" feature. we can show top images not fof all images, but for a specific category, by adding cat_id=XX in the address, like this: top.php?cat_id=XX where XX is nuber of category.

137
Many people asked about a MOD, that would let limit number of categories per page.

Installation:

Step 1.
Open /function.php
Find:
Code: [Select]
global $site_template, $site_db, $site_sess, $config, $lang;Replace with:
Code: [Select]
global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
Step 1.2. (updated 05-27-03)
Find:
Code: [Select]
  $total = sizeof($visible_cat_cache);Add after:
Code: [Select]
//Begin configuration:

$perpage = 10; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists("Paging")) {
  include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH.($cat_id ? "categories.php?".URL_CAT_ID."=".$cat_id : "index.php"));
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
  "cat_paging" => $getpaging->get_paging(),
  "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($visible_cat_cache as $key => $category_id) {
  if ($i >= $offset && $i <= $limit) {
    $cache[] = $category_id;
    $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
  }
  $i++;
}
$total = count($cache);
You can change some setting at the beginning of inserted code ;)

Step 1.3.
Find:
Code: [Select]
foreach ($visible_cat_cache as $key => $category_id) {Replace with:
Code: [Select]
foreach ($cache as $category_id){

Step 2. (updated 05-27-03)
If u have not updated your /includes/paging.php file, then download it from Universal Paging Class


Step 3.
Add in /templates/<yourtemplate>/categories.html and in /templates/<yourtemplate>/home.html
those tags:
{cat_paging} and if u want {cat_paging_stats}


Step 4 (added 07-06-2006)
This step needed only for these who is using 4images v1.7 with [MOD] Cache System for 4images v1.7 or 4images v1.7.1, v1.7.2 with activated cache system.
In index.php and categories.php find:
Code: [Select]
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above:
Code: [Select]
    isset($HTTP_GET_VARS['cat_page']) ? intval($HTTP_GET_VARS['cat_page']) : 0,

138
Chit Chat / sessionid in the address
« on: May 05, 2003, 03:08:02 AM »
Just wondering, under what kind of conditions "sessionid=" shows in the address?
I noticed that on some sites it shows all the time, on my site "normaly" it shows only after u open site first time and click on any links, but next click will be without it...
but, in my logs I can see that some visitors have "sessionid=" all the time.

also, on some sites if u delete "sessionid=" from the address become logged out...

so, how does it work?

139
------------------------------------------------
This MOD originaly was created by Cr@zy Sash, but after I tryed to troubleshooting it, I got an idea how to make it more advanced and using only one entry in the database for each message instead of doublicating for each folder.
Still 51% of credit goes to Cr@zy Sash ;) :D
------------------------------------------------

-----------| Overview |-----------------------
With this MOD members will be able send private messages to other members.
Each member has 3 folders:
- Inbox
- Sentbox
- Outbox

Q: Whats the difference betwen Sentbox and Outbox?
A: In Sentbox stores messages that have been received (the recipient read them). In Outbox stores messages that have not been received (the recipient has not read them yet).
Advantage of having Outbox is that u can edit messages from that folder (only).
---- Updated 5-03-2003 2pm (EST) ----
Now also, members can set to receive email notify or open popup window when received new message.


-----------| Changed Files |--------------------
/member.php
/details.php
/includes/constants.php
/includes/page_header.php
/lang/<yourlanguage>/main.php
<templates of your chose>

---- Updated 5-03-2003 2pm (EST) ----
/includes/db_field_definitions.php
/templates/<yourtemplate>/member_editprofile.html
/templates/<yourtemplate>/header.html



-----------| New file |---------------------------
pms.php

-----------| New templates |--------------------
pms.html
pms_folder.html
pms_view.html
pms_new.html
pms_delete.html
pms_perpage_dropdown_form.html

---- new added 5-03-2003 2pm (EST) ----
pms_notify.html

-----------| New images |----------------------
asc_order.png
desc_order.png


-----------| Installation |-----------------------

Step 1. Updated 5-03-2003 2pm (EST)
Download "PMS" package.
Extract files acording this:
/pms.php
/pms_install.php
/templates/<yourtemplate>/pms.html
/templates/<yourtemplate>/pms_delete.html
/templates/<yourtemplate>/pms_folder.html
/templates/<yourtemplate>/pms_new.html
/templates/<yourtemplate>/pms_view.html
/templates/<yourtemplate>/pms_perpage_dropdown_form.html
/templates/<yourtemplate>/images/asc_order.png
/templates/<yourtemplate>/images/desc_order.png

---- new added 5-03-2003 2pm (EST) ----
/lang/<yourlanguage>/email/notify.html


Step 2.
Open /includes/constants.php
At the end of the file, just before closing ?> add this:
Code: [Select]
//PMS
define('PMS_TABLE', $table_prefix.'pms');
define('PMS_RDLT', 0); //Recipient deleted message (message only in: Sender's Setbox)
define('PMS_SDLT', 1); //Sender deleted message (message only in: Recipient's Inbox)
define('PMS_SENT', 2); //Recipient read message (message in: Sender's Sentbox and Recipient's Inbox)
define('PMS_UNREAD', 3); //Recipient not read message (message in: Sender's Outbox and Recipient's Inbox - New Message)


Step 3. Updated 5-03-2003 2pm (EST)
Open /lang/<yourlanguage>/main.php
At the end of the file, just before closing ?> add this:
Code: [Select]
//--- PMS ----
$lang['pms_inbox'] = "Inbox";
$lang['pms_outbox'] = "Outbox";
$lang['pms_sentbox'] = "Sentbox";
$lang['pms_link'] = "&nbsp;&nbsp;&nbsp;You have<br />&raquo&nbsp;<b>{msg_new_count}</b> new message(s)<br />&nbsp;&nbsp;&nbsp;in your <b>{inbox}</b>.";
$lang['pms'] = "Private Messaging";
$lang['pms_short'] = "PMS";
$lang['pms_error'] = "Error";
$lang['pms_error_to'] = "You must select a recipient.";
$lang['pms_error_subject'] = "You must enter a subject.";
$lang['pms_error_message'] = "You must enter a message.";
$lang['pms_error_folder'] = "No folder selected.";
$lang['pms_error_id'] = "Nothing to show.";
$lang['pms_error_delete'] = "Nothing to delete.";
$lang['pms_compose'] = "Compose";
$lang['pms_delete'] = "Delete";
$lang['pms_delete_selected'] = "Delete selected";
$lang['pms_delete_all'] = "Delete all";
$lang['pms_delete_success'] = "The messages where deleted successfuly";
$lang['pms_delete_confirm'] = "Are you sure you want to delete that message from <b>".$lang['pms_'.$mode]."</b>?";
$lang['pms_delete_confirm_select'] = "Are you sure you want to delete selected messages from <b>".$lang['pms_'.$mode]."</b>?";
$lang['pms_delete_confirm_all'] = "Are you sure you want to delete ALL messages from <b>".$lang['pms_'.$mode]."</b>?";
$lang['pms_new'] = "New message";
$lang['pms_select_user'] = "Select a user";
$lang['pms_sent_success'] = "The message was send successfully";
$lang['pms_redirect'] = "Please wait a moment";
$lang['pms_empty'] = "No messages in this folder";
$lang['pms_reply'] = "Reply";
$lang['pms_view'] = "View message";
$lang['pms_mark'] = "Mark";
$lang['pms_edit'] = "Edit";
$lang['pms_subject'] = "Subject";
$lang['pms_message'] = "Message";
$lang['pms_to'] = "Recipient";
$lang['pms_date'] = "Date";
$lang['pms_send'] = "Send";
$lang['pms_preview'] = "Preview";
$lang['pms_status'] = "Status";
$lang['pms_from'] = "Sender";
$lang['pms_html'] = "Anable HTML in this message";
$lang['pms_bbcode'] = "Anable BBCode in this message";
$lang['pms_perpage'] = "Messages per page";
$lang['pms_user_pm'] = "PM";
$lang['pms_user_pm_alt'] = "PM to this user";
$lang['pms_total'] = "Total messages";
$lang['pms_received'] = "Received";
$lang['pms_quote'] = "Quote";
$lang['pms_error_save'] = "Error saving message. (the message could has been received)";
$lang['pms_error_notfound'] = "Can't find message.";
$lang['pms_paging_stats'] = "You have {total_cat_images} message(s) {new} on {total_pages} page(s) in your {box}.<br />Displayed: massage {first_page} to {last_page}.";
$lang['pms_email'] = "Notify by email on new Private Message";
$lang['pms_popup'] = "Pop up window on new Private Message";
$lang['pms_popup_confirm'] = "You have a new private message. Click OK to view it, or cancel to hide this prompt.";
$lang['pms_popup_newwindow'] = "Open in new window?\\n\\n(Press cancel to open your Inbox in the current window.)";
$lang['pms_email_new'] = "New private message";


Step 4.
In your browser start pms_install.php
* in address bar type something like this: http://YOURSITE/4images/pms_install.php
Finish the installation.

After this step the main installation is complete. :wink: :D
U can check it by going to: http://YOURSITE/4images/pms.php


Step 5. Updated 5-03-2003 2pm (EST)
Open /includes/page_header.php
Find:
Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,
Replace with:
Code: [Select]
//-----------------------------------------------------
//--- PMS ---------------------------------------------
//-----------------------------------------------------
$sql = "SELECT COUNT(pms_id) AS total
FROM ".PMS_TABLE."
WHERE pms_to = ".$user_info['user_id']." AND (pms_type = ".PMS_SENT." OR pms_type = ".PMS_SDLT." OR pms_type = ".PMS_UNREAD.")";
$result = $site_db->query_firstrow($sql);
$pms_inbox = $result['total'];
$sql = "SELECT COUNT(pms_id) AS total
FROM ".PMS_TABLE."
WHERE pms_from = ".$user_info['user_id']." AND pms_type = ".PMS_UNREAD;
$result = $site_db->query_firstrow($sql);
$pms_outbox = $result['total'];
$sql = "SELECT COUNT(pms_id) AS total
FROM ".PMS_TABLE."
WHERE pms_from = ".$user_info['user_id']." AND (pms_type = ".PMS_SENT." OR pms_type = ".PMS_RDLT.")";
$result = $site_db->query_firstrow($sql);
$pms_sentbox = $result['total'];
$sql = "SELECT COUNT(pms_id) AS new
FROM ".PMS_TABLE."
WHERE pms_to = ".$user_info['user_id']." AND pms_type = ".PMS_UNREAD;
$result = $site_db->query_firstrow($sql);
$pms_new = "<a href=\"".$site_sess->url(ROOT_PATH."pms.php")."\">".(($result['new']) ? "<blink>".$result['new']."</blink>" : 0)."</a>";
$pms = preg_replace("/".$site_template->start."msg_new_count".$site_template->end."/siU", $pms_new, $lang['pms_link']);
$pms = preg_replace("/".$site_template->start."inbox".$site_template->end."/siU", "<a href=\"".$site_sess->url(ROOT_PATH."pms.php")."\">".$lang['pms_inbox']."</a>", $pms);
// PMS Boxes
$blink = "<script language=\"JavaScript\">\n<!--\nvar flg=0;\nfunction blink(){\nvar myElement=document.getElementById('blnk');\nflg^=1;\nif(flg==1){\nmyElement.style.visibility='hidden';\n}\nelse{\nmyElement.style.visibility='visible';\n}\ntimerID = setTimeout( 'blink()' , 500 );\n}\n//-->\n</script>\n";
$show_inbox = ($result['new']) ? $blink."<span id=\"blnk\">".$lang['pms_inbox']."</span><script language=\"JavaScript\">blink();</script>" : $lang['pms_inbox'];
$inbox = "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=inbox")."\" title=\"".$lang['pms_total']." (".$pms_inbox.")\">".$show_inbox."</a>";
$sentbox = "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=sentbox")."\" title=\"".$lang['pms_total']." (".$pms_sentbox.")\">".$lang['pms_sentbox']."</a>";
$outbox = "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=outbox")."\" title=\"".$lang['pms_total']." (".$pms_outbox.")\">".$lang['pms_outbox']."</a>";
$newpms = "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=new")."\">".$lang['pms_new']."</a>";

$sql = "SELECT pms_date
FROM ".PMS_TABLE."
WHERE pms_to = ".$user_info['user_id']." AND pms_type = ".PMS_UNREAD."
ORDER BY pms_date DESC";
$result = $site_db->query_firstrow($sql);
$pms_popup_script = "";
$pms_popup_header = "";
if ($result && $user_info['user_pms_popup'] && !ereg("pms.php", $self_url)) {
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_pmsnewpopup = isset($HTTP_COOKIE_VARS[$cookie_name.'pmsnewpopup']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'pmsnewpopup'])) : 0;
$pmsnewpopup = (isset($session_info['pmsnewpopup'])) ? $session_info['pmsnewpopup'] : $cookie_pmsnewpopup;
if ($pmsnewpopup < $result['pms_date']) {
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'pmsnewpopup', serialize($result['pms_date']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
$site_sess->set_session_var("pmsnewpopup", $result['pms_date']);
$pms_popup_script = "<script language=\"JavaScript\">
<!--
function confirm_newpm() {
input_box=confirm('".$lang['pms_popup_confirm']."');
if (input_box==true) { // Output when OK is clicked
second_box=confirm('".$lang['pms_popup_newwindow']."');
if (second_box==true) {
window.open('".$site_sess->url(ROOT_PATH."pms.php")."','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
} else {
window.location='".$site_sess->url(ROOT_PATH."pms.php")."';
}
} else {
// Output when Cancel is clicked
}
}
// -->
</script>";
$pms_popup_header = "onload=\"Javascript:confirm_newpm()\"";
}
}

$site_template->register_vars(array(
"pms_boxes" => ($user_info['user_level'] < USER) ? "" : $inbox."&nbsp;&nbsp;|&nbsp;&nbsp;".$sentbox."&nbsp;&nbsp;|&nbsp;&nbsp;".$outbox."&nbsp;&nbsp;|&nbsp;&nbsp;".$newpms,
"pms_popup_script" => $pms_popup_script,
"pms_popup_header" => $pms_popup_header,
  "media_url" => MEDIA_PATH,


Step 6.
Edit templates where u want to show folders links.
Use those tags:
{pms_boxes}  - this will show folders
{pms} - this will show "You have 2  new images in Inbox"


Step 7.
Open /member.php
Find:
Code: [Select]
   $site_template->register_vars(array(
      "user_id" => $user_row['user_id'],
      "user_name" => (isset($user_row['user_name'])) ? htmlspecialchars($user_row['user_name']) : REPLACE_EMPTY,
Add after:
Code: [Select]
    "lang_pm" => ($user_info['user_id'] != $user_row['user_id']) ? "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=reply&user_id=".$user_row['user_id'])."\" alt=\"".$lang['pms_user_pm_alt']."\">".$lang['pms_user_pm']."</a>" : "",

Step 8. Updated 05-21-03
Open /details.php
Find:
Code: [Select]
       "comment_id" => $comment_row[$i]['comment_id'],Add after:
Code: [Select]
"lang_pm" => ($user_info['user_id'] != $comment_row[$i]['user_id'] && $user_info['user_level'] >= USER && $comment_row[$i]['user_id'] >= USER) ? "<a href=\"".$site_sess->url(ROOT_PATH."pms.php?action=reply&user_id=".$comment_row[$i]['user_id'])."\" alt=\"".$lang['pms_user_pm_alt']."\">".$lang['pms_user_pm']."</a>" : "",

Step 9.
Open:
/templates/<yourtemplate>/member_profile.html
/templates/<yourtemplate>/comment_bit.html

Use this tag to show link to PM the user:
{lang_pm}


Step 10. new added  05-03-2003 2pm (EST)
Open /includes/db_field_definitions.php
At the end of the file, just before closing ?> add this:
Code: [Select]
$additional_user_fields['user_pms_email'] = array($lang['pms_email'], "radio", 0);
$additional_user_fields['user_pms_popup'] = array($lang['pms_popup'], "radio", 0);


Step 11. new added  05-03-2003 2pm (EST)
Open /templates/<yourtemplate>/member_editprofile.html
Add this:
Code: [Select]
         <tr>
            <td class="row2"><b>{lang_user_pms_email}</b></td>
            <td class="row2">
              <input type="radio" name="user_pms_email" value="1"{user_pms_email_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_pms_email" value="0"{user_pms_email_no} />
              {lang_no}
            </td>
          </tr>
          <tr>
            <td class="row1"><b>{lang_user_pms_popup}</b></td>
            <td class="row1">
              <input type="radio" name="user_pms_popup" value="1"{user_pms_popup_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_pms_popup" value="0"{user_pms_popup_no} />
              {lang_no}
            </td>
          </tr>


Step 12. new added  05-03-2003 2pm (EST)
Open /templates/<yourtemplate>/header.html
1. in between <head> and </head> add this:
{pms_popup_script}

2. inside <body> tag add {pms_popup_header}
Should looks like this: <body {pms_popup_header}



-----------| Note |-----------------------------

All templates where created for my site design, and just little bit adopted for default teplate. Because of that some colors ar missing - that's your work now ;).

Also, I didnt remove one, might be useful, feature - different color for "success" messages and "warning/error".

If u wish use it, here what u need to do:
create two new classes in style.css for examle:
Quote
.msg0 {
  background-color: #FFCECE;
  color: #2F6B9D;
}
.msg1 {
  background-color: #CEFFDD;
  color: #2F6B9D;
}
then use something like this in the pms.html template:
class="msg{msg_color}"

140
This little "fix" will do exactly what 4images has by default -> add/remove images to/from lightbox, BUT without whole page refresh.

Demo (you can login with any username/password you want)

Anyone who installed this mod before 2009-07-29 and having problem, please reinstall it, it was updated.

Step 1.
Open /includes/functions.php
Find:
Code: [Select]
     $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";Replace with:
Code: [Select]
     $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; return false;\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

Step 1.2.
Few lines down, find:
Code: [Select]
     $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";Replace with:
Code: [Select]
     $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; return false;\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";

Step 2.
Create new file: lightboxaction.php
with this code:
Code: [Select]
<?php
define
('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$error 0;
if (isset(
$HTTP_GET_VARS['ilu']) || isset($HTTP_POST_VARS['ilu']))
{
  
$ilu = (isset($HTTP_POST_VARS['ilu'])) ? trim($HTTP_POST_VARS['ilu']) : trim($HTTP_GET_VARS['ilu']);
}
else
{
  
$ilu "";
}
if (
$id && $user_info['user_level'] >= USER)
{
  if (
check_lightbox($id))
  {
    
$ilu = (remove_from_lightbox($id)) ? get_gallery_image("lightbox_no.gif") : get_gallery_image("lightbox_yes.gif");
  }
  else
  {
    
$ilu = (add_to_lightbox($id)) ? get_gallery_image("lightbox_yes.gif") : get_gallery_image("lightbox_no.gif");
  }
}
else
{
  
$error 1;
}
if (
$error)
{
  die(
"Security violation");
}
header("Content-type: image/gif");
header("Location: ".$ilu);
?>
Upload it to your 4images root dir.

The only little "draw-back" in this method, that cursor will stay as default on non IE or NS6 browsers, when u put it over the lightbox image, because I had to remove "link" from that button.

P.S. if u installed "Lightbox for guests" MOD, then u should remove && $user_info['user_level'] >= USER from Step 2.

141
THIS MOD NOT IS SUPPORTED BY THE AUTHOR ANYMORE, BECAUSE THE WAY ITS DONE, IT HAS NO POTENTIAL FUTURE TO EXPAND.
IF U HAVEN'T INSTALL THIS MOD, PLEASE DON'T. IF VERSION 2 EVER COMES OUT, AND U INSTALLED THIS VERSION, U'LL HAVE TO REMOVE THIS VERSION PRIOR INSTALLING NEXT VERSION.
SAVE YOURSELF FROM TROUBLE AND WAIT TILL NEXT VERSION.
SORRY.


NOTE: MPC = Members Personal Category

--- Overview --------
With this MOD members will be able have their own one personal (private) category, with almost full admin control.
As usual, u can see it in action here

--- Features ---------
- Members can make their category for: public, only members or private.
When category set to private, the owner can chose wich members will have access to the category.

- Control from AdminControlPanel:
    Anable/disable this mod
    Anable/disable activating new categories. This means that for members who previously activated their MPC, it wont affect, but who hasnt - they wont be able have MPC. (this works same as "disable new account signup").
    Chose "parent" category where new MPC will be created
    Chose what permissions owners of MPC will be able to change.
    Disable single member MPC (u can use this to panish abusing member)[/list:u]
    --- Warning ------------
    If u have to use this:
http://4homepages.de/forum/viewtopic.php?t=3383
This MOD probably not for u, your members wont be very hapy :(

--- Changed Files -----

/member.php
/details.php
/admin/settings.php
/admin/users.php
/includes/db_field_definitions.php
/lang/<yourlanguage>/main.php
/lang/<yourlanguage>/admin.php
/templates/<yourtemplate>/member_editprofile.html


New templates:
member_cat_edit.html
member_cat_edit_bit.html
member_cat_terms.html


--- Installation ---------

Step 1.
Open /member.php
Find
Code: [Select]
if ($action == "deletecomment") {
  if (!$comment_id || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN)) {
    show_error_page($lang['no_permission']);
    exit;
  }
  
  $sql = "SELECT c.comment_id, c.user_id AS comment_user_id, i.image_id, i.cat_id, i.user_id, i.image_name
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "deletecomment") {
  if (!$comment_id) {
    show_error_page($lang['no_permission']);
    exit;
  }

  $sql = "SELECT c.comment_id, c.user_id AS comment_user_id, i.image_id, i.cat_id, i.user_id, i.image_name
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
//  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id']&& $user_info['user_id'] != $comment_row['comment_user_id'])) {
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id'])) {
Step 1.2.
Find:
Code: [Select]
if ($action == "removecomment") {
  if (!$comment_id || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN)) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

  $sql = "SELECT c.comment_id, c.image_id, c.user_id AS comment_user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "removecomment") {
  if (!$comment_id) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

  $sql = "SELECT c.comment_id, c.image_id, c.user_id AS comment_user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
//  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id']&& $user_info['user_id'] != $comment_row['comment_user_id'])) {
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_delete_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_id'] != $comment_row['comment_user_id'])) {

Step 1.3.
Find:
Code: [Select]
if ($action == "updatecomment") {
  if (!$comment_id || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN)) {
    show_error_page($lang['no_permission']);
    exit;
  }
  $sql = "SELECT c.comment_id, c.image_id, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "updatecomment") {
  if (!$comment_id) {
    show_error_page($lang['no_permission']);
    exit;
  }
  $sql = "SELECT c.comment_id, c.image_id, c.user_id AS comment_user_id, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
//  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id']&& $user_info['user_id'] != $comment_row['comment_user_id'])) {
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id'])) {

Step 1.4.
Find:
Code: [Select]
if ($action == "editcomment") {
  if (!$comment_id || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN)) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

  $sql = "SELECT c.comment_id, c.image_id, c.user_id AS comment_user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "editcomment") {
  if (!$comment_id) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

  $sql = "SELECT c.comment_id, c.image_id, c.user_id AS comment_user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, i.image_name, i.cat_id, i.user_id".get_user_table_field(", u.", "user_name")."
          FROM ".COMMENTS_TABLE." c, ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_id AND i.image_id = c.image_id";
  $comment_row = $site_db->query_firstrow($sql);
//  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id']&& $user_info['user_id'] != $comment_row['comment_user_id'])) {
  if (!$comment_row || $comment_row['user_id'] <= USER_AWAITING || ($config['user_edit_comments'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $comment_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $comment_row['cat_id'])) {

Step 1.5.
Find:
Code: [Select]
if ($action == "deleteimage") {
  if (!$image_id || ($config['user_delete_image'] != 1 && $user_info['user_level'] != ADMIN)) {
    show_error_page($lang['no_permission']);
    exit;
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name, image_media_file, image_thumb_file
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "deleteimage") {
  if (!$image_id) {
    show_error_page($lang['no_permission']);
    exit;
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name, image_media_file, image_thumb_file
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id'])) {

Step 1.6.
Find:
Code: [Select]
if ($action == "removeimage") {
  if (!$image_id || ($config['user_delete_image'] != 1 && $user_info['user_level'] != ADMIN)) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "removeimage") {
  if (!$image_id) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_id || ($config['user_delete_image'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id'])) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id'])) {

Step 1.7.
Find:
Code: [Select]
if ($action == "updateimage") {
  if (!$image_id || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN)) {
    show_error_page($lang['no_permission']);
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "updateimage") {
  if (!$image_id) {
    show_error_page($lang['no_permission']);
  }  $sql = "SELECT image_id, cat_id, user_id, image_name
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id'])) {

Step 1.8.
Find:
Code: [Select]
if ($action == "editimage") {
  if (!$image_id || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN)) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

  $additional_sql = "";
  if (!empty($additional_image_fields)) {
    foreach ($additional_image_fields as $key => $val) {
      $additional_sql .= ", ".$key;
    }
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name, image_description, image_keywords, image_allow_comments".$additional_sql."
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
Replace with:
Code: [Select]
if ($action == "editimage") {
  if (!$image_id) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  $additional_sql = "";
  if (!empty($additional_image_fields)) {
    foreach ($additional_image_fields as $key => $val) {
      $additional_sql .= ", ".$key;
    }
  }
  $sql = "SELECT image_id, cat_id, user_id, image_name, image_description, image_keywords, image_allow_comments".$additional_sql."
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $image_row = $site_db->query_firstrow($sql);
  if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id']) || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN && $user_info['user_cat'] != $image_row['cat_id'])) {


Step 1.9.
Find:
Code: [Select]
 if (!$error) {
    $additional_sql = "";
    if (!empty($additional_user_fields)) {
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }

    $sql = "UPDATE ".USERS_TABLE."
Replace with:
Code: [Select]
 if (!$error) {
    $additional_sql = "";
    if (!empty($additional_user_fields)) {
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
if (isset($HTTP_POST_VARS['user_cat_active']) && isset($table_fields['user_cat_active'])) {
user_cat_create();
}else{
       $additional_sql .= ", user_cat_active = 0";
      }
    }

    $sql = "UPDATE ".USERS_TABLE."


Step 1.10.
Find:
Code: [Select]
   "user_name" => htmlspecialchars(stripslashes($user_name)),Add before (obove it):
Code: [Select]
"lang_activate" => ($config['user_cat'] && $user_info['user_cat_active_admin'] && ($config['user_cat_new'] || $user_info['user_cat'])) ? $lang['user_cat_activate'] : "",
"user_cat_edit" => ($user_info['user_cat_active']) ? $site_sess->url(ROOT_PATH."member.php?action=usercatpermedit") : "",
"lang_edit" => $lang['edit'],

Step 1.11.
Find:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
Add before (above it):
Code: [Select]
//-------------------------
//---- User Create Cat ----
//-------------------------
function user_cat_create(){
global $user_info, $cat_cache, $config;
  if ($user_info['user_cat'] == 0 || !$cat_cache[$user_info['user_cat']]) {
    if (!$cat_id = create_user_cat($user_info['user_id'], $user_info['user_name'])) {
$msg .= "Error creating category";
}
}
}
//-----------------------------
//---- User Cat Permissions----
//-----------------------------
if ($action == "usercatpermedit") {
  if ((!user_cat_check() || !$user_info['user_cat_active']) && $user_info['user_level'] != ADMIN) {
    show_error_page($lang['no_permission']);
    exit;
  }
  $error = 0;
  $user_cat_terms = 0;
  if ($user_info['user_level'] != ADMIN && !$user_info['user_cat_active_admin']) {
    $msg = $lang['user_cat_deactive_admin'];
$error = 1;
  }
  if ($user_info['user_level'] != ADMIN && !$user_info['user_cat_terms']) {
if (isset($HTTP_POST_VARS['user_cat_accept']) && $HTTP_POST_VARS['user_cat_accept']) {
 $sql = "UPDATE ".USERS_TABLE."
         SET user_cat_terms = 1
         WHERE user_id = ".$user_info['user_id'];
 $site_db->query($sql);
}else{
  $user_cat_terms = 1;
}
  }
if (!$error) {
if ($user_cat_terms) {
 $site_template->register_vars(array(
  "lang_user_cat_terms" => $lang['user_cat_terms'],
"lang_agreement_terms" => $lang['user_cat_terms_text'],
"lang_agree" => $lang['agree'],
"lang_agree_not" => $lang['agree_not']
 ));
 $content .= $site_template->parse_template("member_cat_terms");
}else{
$auth_show = "";
$user_list_added = "";
$user_list_rmvd = "";
$user_list_added_count = 0;
$user_list_rmvd_count = 0;
$auth_array = get_auth_array(($user_info['user_level'] == ADMIN) ? "1,1,1,1,1,1,1,1,1" : "");
if (isset($HTTP_POST_VARS['auth']) || isset($HTTP_GET_VARS['auth'])) {
 $auth_check = ($HTTP_POST_VARS['auth'] ) ? $HTTP_POST_VARS['auth'] : $HTTP_GET_VARS['auth'];
if (in_array("auth_".$auth_check, $auth_array)){
$auth_show = "auth_".$auth_check;
if (isset($HTTP_POST_VARS[$auth_check.'_1']) || isset($HTTP_GET_VARS[$auth_check.'_1'])) {
 $auth_list_no = ($HTTP_POST_VARS[$auth_check.'_1'] ) ? $HTTP_POST_VARS[$auth_check.'_1'] : $HTTP_GET_VARS[$auth_check.'_1'];
foreach ($auth_list_no as $key){
if ($key != 0) {
$user_list = get_user_info($key);
$user_list_added .= $user_list['user_name']."<br />";
$user_list_added_count++;
$user_perm = user_cat_perm_cur($key);
$user_perm_cur = array();
foreach ($auth_array as $val) {
$user_perm_cur[$val] = (($val == $auth_show) ? 1 : (($user_perm[$val]) ? $user_perm[$val] : 0));
}
update_user_group($key, $admin_cat_id, $user_perm_cur);
}
}
}
if (isset($HTTP_POST_VARS[$auth_check.'_2']) || isset($HTTP_GET_VARS[$auth_check.'_2'])) {
$auth_list_yes = ($HTTP_POST_VARS[$auth_check.'_2'] ) ? $HTTP_POST_VARS[$auth_check.'_2'] : $HTTP_GET_VARS[$auth_check.'_2'];
foreach ($auth_list_yes as $key){
if ($key != 0) {
$user_list = get_user_info($key);
$user_list_rmvd .= $user_list['user_name']."<br />";
$user_list_rmvd_count++;
$user_perm = user_cat_perm_cur($key);
$user_perm_cur = array();
foreach ($auth_array as $val) {
$user_perm_cur[$val] = (($val == $auth_show) ? 0 : (($user_perm[$val]) ? $user_perm[$val] : 0));
}
update_user_group($key, $admin_cat_id, $user_perm_cur);
}
}
}
if (isset($HTTP_POST_VARS['auth_type']) || isset($HTTP_GET_VARS['auth_type'])) {
$auth_type = ($HTTP_POST_VARS['auth_type'] ) ? $HTTP_POST_VARS['auth_type'] : $HTTP_GET_VARS['auth_type'];
$auth_type = ($auth_type) ? $auth_type : 0;
if ($cat_cache[$admin_cat_id][$auth_show] != $auth_type) {
 $sql = "UPDATE ".CATEGORIES_TABLE."
         SET ".$auth_show." = ".$auth_type."
         WHERE cat_id = ".$admin_cat_id;
 $site_db->query($sql);
 $cat_cache[$admin_cat_id][$auth_show] = $auth_type;
}
}
}
}
 $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email")."
         FROM ".USERS_TABLE."
         WHERE ".get_user_table_field("", "user_level")." > ".USER_AWAITING." AND ".get_user_table_field("", "user_id")." <> ".$user_info['user_id']." AND ".get_user_table_field("", "user_level")." != ".ADMIN."
         ORDER BY ".get_user_table_field("", "user_name")." ASC";
 $result = $site_db->query($sql);
 $user_list = "";
 while ($user_cache = $site_db->fetch_array($result)) {
$user_list .= $user_cache['user_id'].",".addslashes($user_cache['user_name']).",";
}
$auth_list = "";
$auth_edit_js = "";
foreach ($auth_array as $auth_item) {
$auth_type = "";
$auth_edit = 0;
$auth_edit_prv = 0;
$user_cat_note_warning = "";
$user_cat_help = "";
if ($auth_show == $auth_item) {
if ($cat_cache[$admin_cat_id][$auth_item] == AUTH_ACL){
$users = user_cat_perm($auth_show);
foreach ($users as $key => $val) {
$auth_list .= $key.",";
}
$auth_edit_js = 1;
$auth_edit = 1;
$user_cat_help = $lang['user_cat_help'];
}
$auth_type = "<select name=\"auth_type\">\n";
foreach ($user_cat_auth_type as $key => $val) {
$auth_type .= "<option value=\"".$key."\"";
if ($cat_cache[$admin_cat_id][$auth_item] == $key){
$auth_type .= " style=\"color: #FF5353\" selected=\"selected\"";
$auth_cur = $key;
}
$auth_type .= ">".$val."</option>\n";
}
$auth_type .= "</select>&nbsp;**\n";
$auth_edit_prv = 1;
if ($auth_show != "auth_viewcat" && $cat_cache[$admin_cat_id]['auth_viewcat'] == AUTH_ACL) {
$user_cat_note_warning = "<br /><br />".$lang['auth_warning'];
}
}
 $site_template->register_vars(array(
  "user_list_added" => $user_list_added,
  "user_list_rmvd" => $user_list_rmvd,
  "lang_added" => $lang['added']." (".$user_list_added_count.")",
  "lang_rmvd" => $lang['removed']." (".$user_list_rmvd_count.")",
  "auth_type" => $auth_type,
  "auth_cur" => $user_cat_auth_type[$cat_cache[$admin_cat_id][$auth_item]],
  "admin_cat" => ($user_info['user_level'] == ADMIN) ? "<input type=\"hidden\" name=\"user_id\" value=\"".$admin_cat_owner['user_id']."\" />" : "",
"usercat_auth" => $auth_check,
"usercat_auth_show" => $lang[$auth_item],
"auth_edit" => $auth_edit,
"user_cat_note" => $lang['user_cat_note'].$user_cat_note_warning,
"auth_edit_prv" => $auth_edit_prv,
"auth_edit_link" => ($auth_edit_prv) ? "" : $site_sess->url(ROOT_PATH."member.php?action=usercatpermedit&auth=".str_replace("auth_", "", $auth_item).(($user_info['user_level'] == ADMIN) ? "&user_id=".$admin_cat_owner['user_id'] : "")),
"lang_save" => $lang['save'],
"lang_edit" => $lang['edit'],
"lang_cancel" => $lang['cancel'],
"lang_not_in_list" => $lang['not_in_list'],
"lang_in_list" => $lang['in_list'],
"user_cat_help" => $user_cat_help
 ));
 $auth_bit .= $site_template->parse_template("member_cat_edit_bit");
}
 $site_template->register_vars(array(
  "auth_edit_js" => $auth_edit_js,
  "admin_cat_owner" => $admin_cat_owner['user_id'],
  "user_cat_owner" => $admin_cat_owner['user_name'],
"user_list" => trim($user_list, ","),
"usercat_auth" => $auth_check,
"auth_list" => trim($auth_list, ","),
"auth_bit" => $auth_bit,
"lang_auth" => $lang['user_cat_for']." <a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$admin_cat_id)."\">".$admin_cat_owner['user_name']."</a>"
 ));
 $content .= $site_template->parse_template("member_cat_edit");
}
}

$txt_clickstream = $lang['user_cat'];
}

function user_cat_perm_cur($user_id){
global $site_db, $user_info, $admin_cat_id;
$auth_array = get_auth_array();
    $sql = "SELECT g.group_id, g.group_name
            FROM ".GROUPS_TABLE." g, ".GROUP_MATCH_TABLE." gm
            WHERE gm.user_id = $user_id AND g.group_id = gm.group_id";
    $row = $site_db->query_firstrow($sql);
    if (!$row) {
      $row = update_single_usergroup($user_id);
    }
    $group_id = $row['group_id'];
    $group_name = $row['group_name'];
    $sql = "SELECT *
            FROM ".GROUP_ACCESS_TABLE."
            WHERE group_id = $group_id AND cat_id = ".$admin_cat_id;
    $result = $site_db->query_firstrow($sql);
return $result;

}

function user_cat_perm($field = ""){
global $site_db, $user_info, $admin_cat_id;
$sql = "SELECT group_id
          FROM ".GROUP_ACCESS_TABLE."
          WHERE cat_id = ".$admin_cat_id.(($field) ? " AND $field = 1" : "");
$result = $site_db->query($sql);

$group_ids = array();
while ($row = $site_db->fetch_array($result)) {
   $group_ids[] = $row['group_id'];
}
if ($group_ids){
$sql = "SELECT u.*
            FROM ".GROUP_MATCH_TABLE." gm, ".USERS_TABLE." u
            WHERE u.user_id = gm.user_id AND gm.group_id IN (".implode(",", $group_ids).") AND u.user_id <> ".$user_info['user_id'];
$result = $site_db->query($sql);

$users = array();
while ($row = $site_db->fetch_array($result)) {
   $users[$row['user_id']] = $row;
}
return $users;
}
return array();
}

function user_cat_check(){
global $config, $user_info, $cat_cache, $HTTP_POST_VARS, $HTTP_GET_VARS, $admin_cat_id, $site_db, $admin_cat_owner;
if (!$config['user_cat'] && $user_info['user_level'] != ADMIN && $user_info['user_level'] == GUEST) {
return false;
}
if ($user_info['user_level'] == ADMIN) {
if (isset($HTTP_POST_VARS['user_id']) || isset($HTTP_GET_VARS['user_id'])) {
  $admin_user_id = (intval($HTTP_POST_VARS['user_id'])) ? intval($HTTP_POST_VARS['user_id']) : intval($HTTP_GET_VARS['user_id']);
}
if (empty($admin_user_id)) {
return false;
}
}
$admin_user_id = (isset($admin_user_id)) ? $admin_user_id : $user_info['user_id'];
  $sql = "SELECT user_id, user_name, user_cat
          FROM ".USERS_TABLE."
          WHERE user_id = ".$admin_user_id;
  $result = $site_db->query_firstrow($sql);
  $admin_cat_owner = array();
  $admin_cat_owner['user_id'] = $result['user_id'];
  $admin_cat_owner['user_name'] = $result['user_name'];
  $admin_cat_id = $result['user_cat'];
  if ($admin_cat_id == 0 || !$cat_cache[$admin_cat_id]) {
return false;
  }
  return true;
}

function create_user_cat($user_id, $cat_name){
global $site_db, $user_info, $config, $admin_cat_id, $cat_cache;
$sql = "SELECT cat_order
       FROM ".CATEGORIES_TABLE."
       WHERE cat_parent_id = 0
       ORDER BY cat_order DESC
       LIMIT 1";
$catorder = $site_db->query_firstrow($sql);
$cat_order = $catorder['cat_order'] + 10;

$sql = "INSERT INTO ".CATEGORIES_TABLE."
       (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
       VALUES
       ('$cat_name', '', ".$config['user_cat_parent'].", $cat_order, 3, 3, 3, 3, 0, 3, 3, 3, 3)";
$result = $site_db->query($sql);
$cat_id = $site_db->get_insert_id();
  $sql = "UPDATE ".USERS_TABLE."
          SET user_cat = ".$cat_id.", user_cat_active = 1
          WHERE user_id = ".$user_id;
  $site_db->query($sql);
$user_info['user_cat'] = $cat_id;
$admin_cat_id = $cat_id;
$cat_cache[$cat_id] = 1;
$auth = array(
"auth_viewcat" => 1,
"auth_viewimage" => 1,
"auth_download" => 1,
"auth_upload" => 1,
"auth_vote" => 1,
"auth_sendpostcard" => 1,
"auth_readcomment" => 1,
"auth_postcomment" => 1
);
if ($result && $cat_id) {
update_user_group($user_id, $cat_id, $auth);
 if (create_cat_folder(MEDIA_PATH."/".$cat_id, CHMOD_DIRS) && create_cat_folder(THUMB_PATH."/".$cat_id, CHMOD_DIRS)){
  return true;
 }else{
  return false;
 }
}else{
return false;
}
}

function update_user_group($user_id, $cat_id, $auth) {
global $site_db;
$auth_field = "";
$auth_value = "";
foreach($auth as $key => $val){
$auth_field .= $key.", ";
$auth_value .= $val.", ";
}
$auth_field = trim($auth_field, ", ");
$auth_value = trim($auth_value, ", ");
  $sql = "SELECT g.group_id, g.group_name
          FROM ".GROUPS_TABLE." g, ".GROUP_MATCH_TABLE." gm
          WHERE gm.user_id = $user_id AND g.group_id = gm.group_id";
  $row = $site_db->query_firstrow($sql);
  if (!$row) {
    $row = update_single_usergroup($user_id);
  }
  $group_id = $row['group_id'];
  $group_name = $row['group_name'];

  $sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
          WHERE cat_id = $cat_id AND group_id = $group_id";
  $site_db->query($sql);
  $sql = "INSERT INTO ".GROUP_ACCESS_TABLE."
          (group_id, cat_id, $auth_field)
        VALUES
          ($group_id, $cat_id, $auth_value)";
  $site_db->query($sql);
}

function update_single_usergroup($user_id) {
  global $site_db, $user_table_fields;
  $sql = "SELECT ".get_user_table_field("", "user_name")."
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "user_id")." = $user_id";
  $row = $site_db->query_firstrow($sql);
  if (!$row) {
    return false;
  }
  else {
    $group_name = $row[$user_table_fields['user_name']];
    unset($row);
  }
  $sql = "SELECT group_id
          FROM ".GROUPS_TABLE."
          WHERE group_name = '".addslashes($group_name)."' AND group_type = ".GROUPTYPE_SINGLE;
  $row = $site_db->query_firstrow($sql);
  if (!$row) {
    $sql = "INSERT INTO ".GROUPS_TABLE."
            (group_name, group_type)
            VALUES
            ('".addslashes($group_name)."', ".GROUPTYPE_SINGLE.")";
    $site_db->query($sql);
    $group_id = $site_db->get_insert_id();
  }
  else {
    $group_id = $row['group_id'];
  }
  $sql = "SELECT group_id
          FROM ".GROUP_MATCH_TABLE."
          WHERE group_id = $group_id AND user_id = $user_id";
  if ($site_db->is_empty($sql)) {
    $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
            (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
            VALUES
            ($group_id, $user_id, 0, 0)";
    $site_db->query($sql);
  }
  return array("group_id" => $group_id, "group_name" => $group_name);
}

function create_cat_folder($path, $mode) {
  if (@is_dir($path)) {
    @chmod($path, $mode);
    return true;
  }
  else {
    $oldumask = umask(0);
    $result = mkdir($path, $mode);
    umask($oldumask);
    if (!@is_dir($path) || !$result) {
      $result = mkdir($path, 0755);
      @chmod($path, $mode);
    }
    return $result;
  }
}

function get_auth_array($admin = ""){
global $config;
$auth_conf = explode(",", ($admin) ? $admin : $config['user_cat_auth_array']);
$auth_array = array(
"auth_viewcat",
"auth_viewimage",
"auth_download",
"auth_upload",
"auth_directupload",
"auth_vote",
"auth_sendpostcard",
"auth_readcomment",
"auth_postcomment"
);
$auth = array();
for ($i = 0; $i < count($auth_array); $i++) {
if ($auth_conf[$i]){
$auth[] = $auth_array[$i];
   }
  }
  return $auth;
}

//---- End User Cat -----------

Done with /member.php :D


Step 2.
Open /details.php
Find:
Code: [Select]
     $comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";Replace with:
Code: [Select]
     $comment_user_ip = ($user_info['user_level'] == ADMIN || $user_info['user_cat'] == $cat_id) ? $comment_row[$i]['comment_ip'] : "";
Step 2.2.
Find:
Code: [Select]
     elseif ($is_image_owner) {
        $admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
Replace with:
Code: [Select]
//      elseif ($is_image_owner || $comment_user_id == $user_info['user_id'] && $user_info['user_level'] != GUEST || $user_info['user_cat'] == $cat_id) {
      elseif ($is_image_owner || $user_info['user_cat'] == $cat_id) {
        $admin_links .= ($config['user_edit_comments'] != 1 && $user_info['user_cat'] != $cat_id) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_comments'] != 1 && $user_info['user_cat'] != $cat_id) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";

Step 2.3.
Find:
Code: [Select]
elseif ($is_image_owner) {
  $admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
  $admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
Replace with:
Code: [Select]
     elseif ($is_image_owner || $user_info['user_cat'] == $cat_id) {
  $admin_links .= ($config['user_edit_image'] != 1 && $user_info['user_cat'] != $cat_id) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
  $admin_links .= ($config['user_delete_image'] != 1 && $user_info['user_cat'] != $cat_id) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";

Done with /details.php


Step 3.
Open /admin/settings.php
Find:
Code: [Select]
// end of functions

show_admin_header();

if ($action == "updatesettings") {
  $setting_item = $HTTP_POST_VARS['setting_item'];
Replace with:
Code: [Select]
function show_categories_list($setting_name, $value_option = ""){
global $cat_parent_cache, $drop_down_cat_cache, $lang, $config;
$category = "\n<select name=\"setting_item[".$setting_name."]\" class=\"categoryselect\">\n";
  $category .= "<option value=\"0\">".$lang['main_category']."</option>\n";
  $category .= "<option value=\"0\">--------------</option>\n";
  $drop_down_cat_cache = array();
  $drop_down_cat_cache = $cat_parent_cache;
  $category .= get_category_dropdown_bits($value_option);
  $category .= "</select>\n";
echo $category;

}

function show_user_cat_perm_array($setting_name, $setting_value) {
global $config, $lang, $auth_array;
$auth_conf = explode(",", $config['user_cat_auth_array']);
$auth = array();
for ($i = 0; $i < count($auth_array); $i++) {
    echo "<input type=\"checkbox\" name=\"user_cat_".$auth_array[$i]."\" value=\"1\"".(($auth_conf[$i]) ? " checked=\"checked\"" : "").">".$lang[$auth_array[$i]]."<br>\n";
  }
  return $auth;
}
// end of functions

show_admin_header();

if ($action == "updatesettings") {
  $setting_item = $HTTP_POST_VARS['setting_item'];
$setting_item['user_cat_auth_array'] = "";
  foreach ($auth_array as $key) {
   $setting_item['user_cat_auth_array'] .= (($HTTP_POST_VARS['user_cat_'.$key]) ? 1 : 0).",";
}
$setting_item['user_cat_auth_array'] = trim($setting_item['user_cat_auth_array'], ",");

Step 3.2.
Find:
Code: [Select]
 show_form_footer($lang['save_changes'], "", 2);Add before (above it):
Code: [Select]
 show_table_separator($setting_group[10], 2, "#setting_group_10");
  show_setting_row("user_cat", "radio");
  show_setting_row("user_cat_new", "radio");
  show_setting_row("user_cat_parent", "show_categories_list");
show_setting_row("user_cat_auth_array", "show_user_cat_perm_array");

NOTE: change $setting_group[10], 2, "#setting_group_10" to whatever number is goin next, just scroll little bit up to find it out. REMEMBER THE NUMBER YOU ADDED, YOU WILL NEED IT IN Step 7.

Done with /admin/settings.php


Step 4.
Open /admin/users.php
Find:
Code: [Select]
 show_additional_fields("user", $user_row, USERS_TABLE);Add before (above it):
Code: [Select]
$additional_user_fields['user_cat'][0] = "<a href=\"".ROOT_PATH."categories.php?cat_id=".$user_row['user_cat']."\" target=\"_blank\" />".$lang['user_cat']."</a>";
Done with /admin/users.php


Step 5.
Open /includes/db_field_definitions.php
At the end of the file, just before closing ?> add this:
Code: [Select]
$additional_user_fields['user_cat'] = array($lang['user_cat'], "text", 0);
$additional_user_fields['user_cat_active'] = array($lang['user_cat_active'], "radio", 0);
$additional_user_fields['user_cat_active_admin'] = array($lang['user_cat_active_admin'], "radio", 0);
$additional_user_fields['user_cat_terms'] = array($lang['user_cat_terms'], "radio", 0);

Done with /includes/db_field_definitions.php


Step 6.
Open /lang/<yourlanguage>/main.php
At the end of the file, just before closing ?> add this:
Code: [Select]
//----- User Cat -----
$lang['cancel'] = "Cancel";
$lang['not_in_list'] = "Dont have access";
$lang['in_list'] = "Have access";
$lang['auth_viewcat'] = "View Category";
$lang['auth_viewimage'] = "View Image";
$lang['auth_download'] = "Download";
$lang['auth_upload'] = "Upload";
$lang['auth_directupload'] = "Direct Upload";
$lang['auth_vote'] = "Vote";
$lang['auth_sendpostcard'] = "Send eCard";
$lang['auth_readcomment'] = "Read Comments";
$lang['auth_postcomment'] = "Post Comment";
$lang['added'] = "Added";
$lang['removed'] = "Removed";
$lang['user_cat'] = "Personal Category";
$lang['user_cat_for'] = "Personal Category Permissions for";
$lang['user_cat_active'] = "Activate Personal Category";
$lang['user_cat_active_admin'] = "Permit Personal Category";
$lang['user_cat_terms'] = "Members Personal Category Terms and Conditions";
$lang['permis'] = "Permissions";
$lang['user_cat_note'] = "**&nbsp;<b>All</b> - Everyone including guests (public).<br /><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registered Users</b> - guests not allowed.<br /><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private</b> - only selected members will have access.";
$lang['auth_warning'] = "NOTE: This will affect only selected in &quot;".$lang['auth_viewcat']."&quot; members.";
$lang['user_cat_help'] = "*&nbsp;&nbsp;&nbsp;Select from <b>left</b> side members who you want <b>add</b> to access list<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and from <b>right</b> side to <b>delete</b> members from access list.";
$lang['user_cat_terms_text'] = "Blah Blah Blah<br />Just accept it.";
$lang['user_cat_terms_must'] = "You must accept terms and conditions";
$lang['user_cat_activate_not'] = "Your ".$lang['user_cat']." is not activated";
$lang['user_cat_activate'] = "Activate";
$lang['user_cat_deactive_admin'] = "Your ".$lang['user_cat']." was terminated by administrator";

$user_cat_auth_type = array(
AUTH_ALL => "All",
AUTH_USER => "Registered Users",
AUTH_ACL => "Private"
);
//--- End User Cat ---

Done with /lang/<yourlanguage>/main.php


Step 7.
Open /lang/<yourlanguage>/admin.php
At the end of the file, just before closing ?> add this:
Code: [Select]
/*-- Setting-Group 10 --*/
$setting_group[10]="Member Personal Category";
$setting['user_cat'] = "Activate Member Personal Category";
$setting['user_cat_new'] = "Allow Create New Member Personal Categories";
$setting['user_cat_parent'] = "Parent Category";
$setting['user_cat_auth_array'] = "Allowed Change Permissions";
$auth_array = array(
"auth_viewcat",
"auth_viewimage",
"auth_download",
"auth_upload",
"auth_directupload",
"auth_vote",
"auth_sendpostcard",
"auth_readcomment",
"auth_postcomment"
);

NOTE: change $setting_group[10] to whatever u changed in Step 3.2.

Done with /lang/<yourlanguage>/admin.php


Step 8.
Open /templates/<yourtemplate>/member_editprofile.html
Add this:
Code: [Select]
{if lang_activate}
          <tr>
            <td colspan="2" valign="top" class="head1">{lang_user_cat}&nbsp;<sup class="new">{lang_new}</sup></td>
          </tr>
          <tr>
            <td class="row1" colspan="2">
              <input type="checkbox" name="user_cat_active" value="1"{user_cat_active_yes} /><b>&nbsp;{lang_activate}</b>
            </td>
          </tr>
{if user_cat_edit}
          <tr>
            <td class="row1" colspan="2">
<a href="{user_cat_edit}">{lang_edit}</a>
            </td>
          </tr>
{endif user_cat_edit}
{endif lang_activate}

Done with /templates/<yourtemplate>/member_editprofile.html


Next 3 steps u will need create new templates and then upload them to /templates/<yourtemplate>/ dir.
Step 9.
Create member_cat_edit.html with this code:
Code: [Select]
{if auth_edit_js}
<script language="JavaScript">
   var user_list="{user_list}";
   var list=user_list.split(",");
   var user_list = new Array();
   var user_list_id = new Array();
   var ii=0;
   for (var i=0; i < (list.length/2); i++){
      user_list[i] = list[ii+1];
      user_list_id[i] = list[ii];
      ii=ii+2;
   }
   var list = "{auth_list}";
   var name = "{usercat_auth}";
   var list = list.split(",");
   var owner = {admin_cat_owner};
   var owner_mark = "";
   function print_list(type){
      result="<select name='"+name+"_"+type+"[]' size='15' style='width:200;' multiple='multiple'>\n";
      result +="<option value='0' selected='selected'></option>\n";
      for (var i=0; i<user_list_id.length; i++){
         if (owner == user_list_id[i]) {
            owner_mark = " style='background-color: #FFCECE;'";
         }else{
            owner_mark = "";
         }
         if (type == 1){
            if (!searchArray(user_list_id[i], list)) {
               result +="<option value='"+user_list_id[i]+"'"+owner_mark+">&raquo; "+user_list[i]+"</option>\n";
            }
         }else{
            if (searchArray(user_list_id[i], list)) {
               result +="<option value='"+user_list_id[i]+"'"+owner_mark+"'>&raquo; "+user_list[i]+"</option>\n";
            }
         }
      }
      result +="</select>\n";
      return result;
   }
   function searchArray(key, arr){
      for (var i=0;i<arr.length;i++){
         if (key==arr[i]) return true;
      }
      return false;
   }
</script>
{endif auth_edit_js}
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bordercolor">
  <tr>
    <td valign="top">
      <table width="100%" border="0" cellpadding="3" cellspacing="1">
        <tr>
          <td valign="top" class="head1" colspan="4">{lang_auth}</td>
            </tr>
            {auth_bit}
         </table>
    </td>
  </tr>
</table>

142
Chit Chat / several Apache/PHP versions on same computer?
« on: April 05, 2003, 07:11:00 PM »
I would like for test purpose install Apache2 with PHP v4.3.1 on same box with Apache 1.6 with PHP v4.2.3
I can start it, but the only problem is that PHP looking for php.ini file in only one dir: c:\windows\ (on my WinXP system)
so I was wandering, how can I make PHP use php.ini file not from c:\windows\ folder, but from somewhere else?
I'm using PHP as a module in Apache, that means it using .dll instead of .exe
hope someone know the answer ;)
thx

143
Chit Chat / buttons style on IE5.5 and older or AOL 7
« on: March 31, 2003, 02:36:47 AM »
Just wondering, why border width doesnt work on IE5.5 (look at login button on left):


I checked on all others browsers/os through http://www.browsercam.com
and it seems only AOL7 and IE5.5- are having this problem...

In the class I have:

Code: [Select]
.button {
  font-family:  Tahoma,Verdana,Arial, Helvetica, sans-serif;
background-color: #D9DDE1;
border: 1px
color: Black;
font-size : 10px;
font-weight : bold;
}

another thing, how come when I add semicolon border: 1px; then it quit showing any borders on any browsers...
do I do something wrong here?

144
This MOD will let you/your visitors send a postcard (eCard) to multyple email addresses (recipients) at ones.
The email addresses must be separated by coma ( , ) or semicolon ( ; )
i.e. someone@domain.com, someoneelse@domain.com;dog@cat.com
To each recipient, 4images will  send individual postcard, with unique ID using " TO: " instead of " BCC: " as in ACP, so, if u installed "Notify sender on received postcard" it wont affect anything.
(@Chris: if u still need the changes in admin "send email to users", I think it will be 10 min work ;))
- If one or more recipient email addresses are in wrong format it will show witch address should be corrected.
- It checks if in the recipients email addresses list has doublicate adresses and doesnt send more then one email for each unique email address.

The only draw-back right now, is that the "Recipient name" will be used for each recipient...:x. At the begining I was thinking to force sender to enter name for each email address, separated by coma or semicolon...but then, it will be too confusing.
While I was typing this, I got another idea: using ONE text_area to enter username and email address for each recipient (one recipient per line). Well, will need some feedback from u guys, with more ideas ;)

Example

And finaly after all that boring overview here what u need to do:
1.
Open /postcards.php
Find:
Code: [Select]
 $back_url = (!empty($HTTP_POST_VARS['back_url'])) ? stripslashes(trim($HTTP_POST_VARS['back_url'])) : $site_sess->url(ROOT_PATH."index.php", "&");

  $postcard_id = get_random_key(POSTCARDS_TABLE, "postcard_id");
  $current_time = time();

  $sql = "INSERT INTO ".POSTCARDS_TABLE."
          (postcard_id, image_id, postcard_date, postcard_bg_color, postcard_border_color, postcard_font_color, postcard_font_face, postcard_sender_name, postcard_sender_email, postcard_recipient_name, postcard_recipient_email, postcard_headline, postcard_message)
          VALUES
          ('$postcard_id', $image_id, $current_time, '$bg_color', '$border_color', '$font_color', '$font_face', '$sender_name', '$sender_email', '$recipient_name', '$recipient_email', '$headline', '$message')";
  $result = $site_db->query($sql);

  if ($result) {
    $postcard_url = $script_url."/postcards.php?".URL_POSTCARD_ID."=".$postcard_id;

    include(ROOT_PATH.'includes/email.php');
    $site_email = new Email();
    $site_email->set_to(stripslashes($recipient_email));
    $site_email->set_from(stripslashes($sender_email), stripslashes($sender_name));
    $site_email->set_subject($lang['send_postcard_emailsubject']);
    $site_email->register_vars(array(
      "sender_name" => stripslashes($sender_name),
      "sender_email" => stripslashes($sender_email),
      "recipient_name" => stripslashes($recipient_name),
      "postcard_url" => stripslashes($postcard_url),
      "postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
      "site_name" => $config['site_name']
    ));
    $site_email->set_body("postcard_message", $config['language_dir']);
    $site_email->send_email();

    $msg .= $lang['send_postcard_success'];
    $msg .= "<br /><a href=\"".$back_url."\">".$lang['back_to_gallery']."</a>";
    $action = "showcard";
  }
  else {
    $msg = $lang['general_error'];
    $action = "previewcard";
    $main_template = "postcard_preview";
  }
}

if ($action == "showcard") {
Replace with:
Code: [Select]
   $back_url = (!empty($HTTP_POST_VARS['back_url'])) ? stripslashes(trim($HTTP_POST_VARS['back_url'])) : $site_sess->url(ROOT_PATH."index.php", "&");

  include(ROOT_PATH.'includes/email.php');
$recipient_email_temp = $recipient_email;
$recipient_email_temp = str_replace(" ", "", $recipient_email_temp);
$recipient_email_temp = str_replace(";", ",", $recipient_email_temp);
  $recipient_email_array = explode(",", $recipient_email_temp);
$recipient_email_cache = array();
  foreach ($recipient_email_array as $key) {
if (!in_array($key, $recipient_email_cache)) {
 $recipient_email_cache[] = $key;
 $postcard_id = get_random_key(POSTCARDS_TABLE, "postcard_id");
 $current_time = time();

 $sql = "INSERT INTO ".POSTCARDS_TABLE."
         (postcard_id, image_id, postcard_date, postcard_bg_color, postcard_border_color, postcard_font_color, postcard_font_face, postcard_sender_name, postcard_sender_email, postcard_recipient_name, postcard_recipient_email, postcard_headline, postcard_message)
         VALUES
         ('$postcard_id', $image_id, $current_time, '$bg_color', '$border_color', '$font_color', '$font_face', '$sender_name', '$sender_email', '$recipient_name', '$key', '$headline', '$message')";
 $result = $site_db->query($sql);

 if ($result) {
   $postcard_url = $script_url."/postcards.php?".URL_POSTCARD_ID."=".$postcard_id;

   $site_email = new Email();
   $site_email->set_to(stripslashes($key));
   $site_email->set_from(stripslashes($sender_email), stripslashes($sender_name));
   $site_email->set_subject($lang['send_postcard_emailsubject']);
   $site_email->register_vars(array(
     "sender_name" => stripslashes($sender_name),
     "sender_email" => stripslashes($sender_email),
     "recipient_name" => stripslashes($recipient_name),
     "postcard_url" => stripslashes($postcard_url),
     "postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
     "site_name" => $config['site_name']
   ));
   $site_email->set_body("postcard_message", $config['language_dir']);
   $site_email->send_email();

 }
 else {
   $msg = $lang['general_error'];
   $action = "previewcard";
   $main_template = "postcard_preview";
   exit;
 }
}
}
   $msg .= $lang['send_postcard_success']."<br />( ".$recipient_email_temp." )";
$msg_color = 1;
$msg .= "<br /><a href=\"".$back_url."\">".$lang['back_to_gallery']."</a>";
$action = "showcard";
}

if ($action == "showcard") {

1.2.
Find:
Code: [Select]
 if (($sender_email != "" && !check_email($sender_email)) || ($recipient_email != "" && !check_email($recipient_email))) {
    $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format'];
    $error = 1;
  }
Replace with:
Code: [Select]
 if ($sender_email != "" && !check_email($sender_email)) {
    $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format'];
    $error = 1;
  }
if ($recipient_email != "") {
$recipient_email_temp = $recipient_email;
$recipient_email_temp = str_replace(" ", "", $recipient_email_temp);
$recipient_email_temp = str_replace(";", ",", $recipient_email_temp);
 $recipient_email_array = explode(",", $recipient_email_temp);
  $recipient_email_temp = $recipient_email;
 $error_email = "";
 foreach ($recipient_email_array as $key) {
        if (check_email(trim($key))) {
         $recipient_email_temp .= $key.", ";
        }else{
           $recipient_email_temp .= "<font style=\"background-color:red;\">".$key."</font>, ";
           $error_email = 1;
}
      }
      if ($error_email) {
       $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format']." ( ".trim($recipient_email_temp,", ")." )";
       $error = 1;
 }
}else{
    $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format'];
    $error = 1;
  }

P.S. I'll move this thread to the MODs forum if we deside how "recipient name" should be handle, or if it's ok as it is now...;)

145
Chit Chat / different encoding on same page?
« on: March 27, 2003, 08:36:38 PM »
Hi!
is there a way to have different encoding on same page?
for example, I need show russian text in KOI8-r and Windows-1251 encodings on the same page.
is that possible using PHP or HTML?
thx.

146
Mods & Plugins (Releases & Support) / [MOD] Lightbox for GUESTs v1.2
« on: March 27, 2003, 01:44:45 PM »
-------- Overview -----------------
This MOD will let guests add picture to their lightbox, based on sessions + cookies.
u can see it an action here

-------- Known issue -------------
"GUESTs" lightbox is separate from "USERs", that means, that if u add some images to the lightbox, while u are not logged in and then do login, u wont have those images in the lightbox, untill u logged out.

-------- Installation ---------------

1.
Open /includes/functions.php
Find:
Code: [Select]
  if ($user_info['user_level'] != GUEST) {Replace with:
Code: [Select]
  if ($user_info['user_level'] >= GUEST) {
1.2.
Find next:
Code: [Select]
function add_to_lightbox($id) {
  global $user_info, $site_db;
  $id = intval($id);
  if (!$id) {
    return false;
  }
  $lightbox_ids = $user_info['lightbox_image_ids'];
  $lightbox_array = explode(" ", $lightbox_ids);
  if (!in_array($id, $lightbox_array)) {
    $lightbox_ids .= " ".$id;
  }
  $user_info['lightbox_image_ids'] = trim($lightbox_ids);
  $user_info['lightbox_lastaction'] = time();
Replace with:
Code: [Select]
function add_to_lightbox($id) {
  global $user_info, $site_db, $site_sess;
  $id = intval($id);
  if (!$id) {
    return false;
  }
  if ($user_info['user_level'] == GUEST) {
    $lightbox = $site_sess->get_session_var('lightbox');
    $user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
  }
  $lightbox_ids = $user_info['lightbox_image_ids'];
  $lightbox_array = explode(" ", $lightbox_ids);
  if (!in_array($id, $lightbox_array)) {
    $lightbox_ids .= " ".$id;
  }
  $user_info['lightbox_image_ids'] = trim($lightbox_ids);
  $user_info['lightbox_lastaction'] = time();
  if ($user_info['user_level'] == GUEST) {
    $site_sess->set_cookie_data("lightbox", $user_info['lightbox_image_ids'], 1);
    $site_sess->set_cookie_data("lightbox_lastaction", $user_info['lightbox_lastaction'], 1);
    $site_sess->set_session_var("lightbox", $user_info['lightbox_image_ids']);
    $site_sess->set_session_var("lightbox_lastaction", $user_info['lightbox_lastaction']);
    return 1;
  }

1.3.
Find next:
Code: [Select]
function remove_from_lightbox($id) {
  global $user_info, $site_db;
  $lightbox_array = explode(" ",$user_info['lightbox_image_ids']);
  foreach ($lightbox_array as $key => $val) {
    if ($val == $id) {
      unset($lightbox_array[$key]);
    }
  }
  $user_info['lightbox_image_ids'] = trim(implode(" ", $lightbox_array));
  $user_info['lightbox_lastaction'] = time();
Replace with:
Code: [Select]
function remove_from_lightbox($id) {
  global $user_info, $site_db, $site_sess;
  if ($user_info['user_level'] == GUEST) {
    $lightbox = $site_sess->get_session_var('lightbox');
    $user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
  }
  $lightbox_array = explode(" ",$user_info['lightbox_image_ids']);
  foreach ($lightbox_array as $key => $val) {
    if ($val == $id) {
      unset($lightbox_array[$key]);
    }
  }
  $user_info['lightbox_image_ids'] = trim(implode(" ", $lightbox_array));
  $user_info['lightbox_lastaction'] = time();
  if ($user_info['user_level'] == GUEST) {
    $site_sess->set_cookie_data("lightbox", $user_info['lightbox_image_ids'], 1);
    $site_sess->set_cookie_data("lightbox_lastaction", $user_info['lightbox_lastaction'], 1);
    $site_sess->set_session_var("lightbox", $user_info['lightbox_image_ids']);
    $site_sess->set_session_var("lightbox_lastaction", $user_info['lightbox_lastaction']);
    return 1;
  }

1.4.
Find next:
Code: [Select]
function clear_lightbox() {
  global $user_info, $site_db;
  $current_time = time();
Replace with:
Code: [Select]
function clear_lightbox() {
  global $user_info, $site_db, $site_sess;
  $current_time = time();
  if ($user_info['user_level'] == GUEST) {
    $user_info['lightbox_image_ids'] = "";
    $user_info['lightbox_lastaction'] = $current_time;
    $site_sess->set_cookie_data("lightbox", "");
    $site_sess->drop_session_var("lightbox");
    $site_sess->set_cookie_data("lightbox_lastaction", $current_time, 1);
    $site_sess->set_session_var("lightbox_lastaction", $current_time);
    return true;
  }

1.5.
Find next:
Code: [Select]
function check_lightbox($id) {
  global $user_info;
Replace with:
Code: [Select]
function check_lightbox($id) {
  global $user_info, $site_sess;
  if ($user_info['user_level'] == GUEST) {
    $lightbox = $site_sess->get_session_var('lightbox');
    $user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
  }


2.
Open /lightbox.php
Find and remove (or comment):
Code: [Select]
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {
  show_error_page($lang['lightbox_register']);
}

2.1.
Find next:
Code: [Select]
if (!empty($user_info['lightbox_image_ids']))  {Add before:
Code: [Select]
if ($user_info['user_level'] == GUEST) {
    $lightbox = $site_sess->get_session_var('lightbox');
    $user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
    $lightbox = $site_sess->get_session_var('lightbox_lastaction');
    $user_info['lightbox_lastaction'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox_lastaction");
}

2.2a. (4images v1.7 - 1.7.3)
Find next:
Code: [Select]
  if (!empty($user_info['lightbox_image_ids'])) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
  if (!empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";

2.2b. (4images v1.7.4 and newer)
Find:
Code: [Select]
  if ($download_allowed && !empty($user_info['lightbox_image_ids'])) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
  if ($download_allowed && !empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";

3.
Open /templates/<yourtemplate>/user_loginform.html
Insert:
Code: [Select]
<a href="{url_lightbox}">{lang_lightbox}</a>
4. * Fix
Open /includes/page_header.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
  if ($user_info['user_level'] >= USER) {
    $msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}
if ($action == "removefromlightbox" && $id) {
  if ($user_info['user_level'] >= USER) {
    $msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}
if ($action == "clearlightbox") {
  if ($user_info['user_level'] >= USER) {
    $msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}
Replace with:
Code: [Select]
//-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
  if ($user_info['user_level'] >= GUEST) {
    $msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}
if ($action == "removefromlightbox" && $id) {
  if ($user_info['user_level'] >= GUEST) {
    $msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}
if ($action == "clearlightbox") {
  if ($user_info['user_level'] >= GUEST) {
    $msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
  }
  else {
    $msg = $lang['lightbox_register'];
  }
}


5. Added 9-23-2003 *optional, only if u want let your guests download the lightbox
Open download.php
Find:
Code: [Select]
if ($action == "lightbox") {

Add after:
Code: [Select]
  if ($user_info['user_level'] == GUEST) {
    $lightbox = $site_sess->get_session_var('lightbox');
    $user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
  }

147
This is an enhanced version of "Check new images" feature in ACP (Admin Control Panel)



--------- [ Features ] -----------------

  • check in all categories at once
  • check in a category including its subcategories
  • auto resize
  • auto create thumbnails
  • auto insert IPTC info of name, description, keywords and date
  • if no thumbnails found, creates temp thumbnails in preview list
  • allow set max dimention for image preview in detailed view
  • support for [Mod] Image Annotation (Watermark) by SLL
  • support for [Mod] Show original image in new window by clicking on image
  • backup original images somewhere else on the server (usefull if watermark used for both original (in "big" folder) and resized image)
  • filter filenames - replaces all non-english letters with underline ( _ )
  • rescan after adding one portion of images

Legend:
  • - features configurable from the web page
  • - features configurable from the web page but have some hidden options the require edit checkimages.php file
  • - features not configurable from the web page, they require edit checkimages.php file
--------- [ Installation ] -----------------

1) Backup /admin/checkimages.php file.
2) Download "Check for new images in ALL categories[/url]" file (See attachment)
3) unzip it and upload it in /admin/ folder


--------- [ How to use ] ------------------

Login into Admin Control Panel (ACP) and click on "Check new images" on left side.


--------- [ Version history ] ------------------

v2.11 (22-04-2006)
    - added separate settings for auto insert IPTC values for name, description, keywords and date
    - all main screen and half of the log messages were moved into $lang array for easier translation into other languages
    - no more fatal error if no annotation mod installed and in the setting selected "Add annotation"
    - fixed an issue with thumbnails preview when 4images setup to use gzip compression
    - fixed a bug that would not show buttons in details view to insert name, description, keywords and date from IPTC when available
v2.10.5
    - fixed few very minor warning messages
v2.10.4
    - fixed a bug which wouldnt rename file when a file with the same name already exists
v2.10.3
    - fixed misteriously missing option from v2.6.0 (rescan is optional)
v2.10.2
    - very minor bug fixed
v2.10.1
    - minor fix for media icons - now they being resized as well
v2.10.0
    - added preview-auto-thumbnails
v2.9.0
    - added search in subcategories
    - fixed minor "check all" bug, witch was affecting auto thumbnail and auto resize options.
v2.8.0
    - added filter for filenames. files with not-standart characters will be renamed
    - added "backup" feature for images only. It will copy the original image into backup directory u specifyed IF the image needed to be changed (resize or/and add watermark).
v2.7.0
    - Added watermark support
v2.6.3
    - fixed default settings didnt work
v2.6.2
    - fixed image name was taken from previous added images after rescan.
v2.6.1
    - fixed user id wasnt inserted into database with detailed view mode.
v2.6.0
    - "rescan after add images" now is optional.
    - now all options shows after scanning, no more need to hit "check" button when any options were changed
    - fixed minor bug
v2.5.3
    - Added 'big' folder default setting
v2.5.2
    - Fixed default settings
v2.5.1
    - Fixed a bug that no metter witch category was selected it searched in all categories
    - Added option to use date from IPTC
v2.5.0
    - Default values for resizing now taken from 4images settings
    - Settings for default values and also for check marks can be customized. (edit the file, its on top of it)
v2.4.2
    - Fixed auto inserting IPTC info without "detailed" mode.
v2.4.1
    - Fixed inserting IPTC info into caption field
v2.4.0
    - Added auto inserting information from IPTC fields for keywords, description, name and date.
v2.3.0
    - Tumbnails preview now resized proportionaly.
    - After images added it returns to the main screen with log on top, instead of just showing log
v2.2.0
    - Added resize image on screen in "details" view (usefull when u have small screen resolution and large images)
v2.1.2
    - Tumbnails preview now resized proportionaly.
    - After images added it returns to the main screen with log on top, instead of just showing log
    - Image max width/height for "Detailed version" now can be set from the main screen.
v2.1.1
    - Added image max width/height for "Detailed version" view (usefull when u have small screen resolution and large images)
     Edit the file, u'll find new variable at the top ( $max_dimension = 600; ), set desired max size.
v2.1.0
    - Added user selector to the main screen
v2.0.0
    - First release

148
Mods & Plugins (Releases & Support) / [MOD] Language select
« on: March 21, 2003, 11:14:14 PM »
*Works with all 4images versions*

This MOD was created by Jan, but never "officialy" was published:
http://www.4homepages.de/forum/index.php?topic=3351.0
(and I'm getting PMs very often with questions how did I do that.)

------ Overview -------------------
With this MOD your site visitors will be able chose language for the interface.

There are two versions of this MOD:

A: Using dropdown menu
B: Using images/text as links


----- Installation -------------------
Step 1.

--- Version A ---

Open /includes/page_header.php
Find:
Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,
  "thumb_url" => THUMB_PATH,
Add before:
Code: [Select]
$query_string = '';
if (!empty($HTTP_GET_VARS)) {
  foreach ($HTTP_GET_VARS as $key => $val) {
    if ($key != "l") {
      $query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
    }
  }
}
// We add the session id with "&" not "&amp;"
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');

// Now we can better remove the "l" parameter
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);

// We replace "&" with "&amp;" to make it valid XHTML
$lang_url = str_replace("&", "&amp;", $lang_url);

$lang_select  = "<form action=\"".$lang_url."\" method=\"post\">\n";
$lang_select .= "<select class=\"select\" name=\"l\" onChange=\"submit()\">\n";

// Now we open the "lang" folder, read out all available languages
// and add it as options to the dropdown.
$handle = opendir(ROOT_PATH."lang");

while ($folder = @readdir($handle)) {

  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {

    $lang_select .= "<option value=\"".$folder."\"";

    // If the folder name matches the current language,
    // show the option as selected
    if ($folder == $config['language_dir']) {
      $lang_select .= " selected=\"selected\"";
    }

    $lang_select .= ">".$folder."</option>\n";
  }
}

$lang_select .= "</select>\n</form>";

// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);


--- Version B ---

Open /includes/page_header.php
Find:Find:
Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,
  "thumb_url" => THUMB_PATH,
Add before:
Code: [Select]
$query_string = '';
if (!empty($HTTP_GET_VARS)) {
  foreach ($HTTP_GET_VARS as $key => $val) {
    if ($key != "l") {
      $query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
    }
  }
}
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');
$lang_url = preg_replace("'&(amp|#38);'i", "&", $lang_url);
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);
$lang_url = str_replace("&", "&amp;", $lang_url);
$handle = opendir(ROOT_PATH."lang");
$lang_select = "";
while ($folder = @readdir($handle)) {
  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
    if ($folder != $config['language_dir']) {
      $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";
    }else{
    $lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\">&nbsp;";
    }
  }
}
// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);


Step 2. (for both versions)

Open a temlate where u want your language selector be showed (i.e. /templates/<yourtemplate>/home.html) and add this tag:
{lang_select}



------- Final -----------------------
This script scans /lang/ folder and if it finds any folders inside it, it will add them in the selection.


------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language


This version is based on sessions, that means as soon as browser is closed, the language sellection will be lost.
If u wish have cookies based version, so it would "remmember" the last selected language, then u will need apply these changes:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555

149
Plugins / [PLUGIN] Batch Import From ZIP Files
« on: March 16, 2003, 12:51:09 AM »
Since only one person has problem with this PLUGIN, and it works for many others, I moved this PLUGIN as FINAL version in MODs forum :D (no changes has been made though)

[OVERVIEW]
-----------------------------------------------
This is an addon for Admin Control Panel (Plugin) that works 98% as "Batch Import" Plugin: http://4homepages.de/forum/viewtopic.php?t=2164
The difference is that this plugin looking for .zip file in sertain folder, then unzip it and import files into 4images. Also, this plugin has all necesery settings that can be changed through web interface, no need modify ANY files.

This plugin uses PclZip library.
----------------------

-----------------------------------------------
I dont know how it will behave on *nix servers or on Windows + IIS
Also, with this plugin u can not import images into already existing category :(
----------------------

[INSTALATION]
-----------------------------------------------
Download attached file.

Create following folder:
/admin/plugins/batch_zip_import/zip/
extract files from downloaded batch_zip_import.zip
upload them into /admin/plugins/
after that u should have this tree of files on your server:

/admin/plugins/batch_zip_import.php
/admin/plugins/batch_zip_import/pclzip.lib.php
/admin/plugins/batch_zip_import/zip/


IMPORTANT:
CHMOD 777 /admin/plugins/batch_zip_import/zip/
----------------------

[HOW TO USE]
-----------------------------------------------
1. Create a folder, with name as u want your new category named (e.i. nature).
2. Copy your pictures in that folder.
If u want import thumbnails at ones, create subfolder with name thumbnails (i.e. /nature/thumbnails/ ). Copy your thumbnails in it.
3. Create a zip archive from main folder (in my example "nature").
4. Upload it into /admin/plugins/batch_zip_import/zip/ folder.
5. Go to Admin Control Panel, on left-bottom u should see new link "Batch ZIP Import"
----------------------

[KNOWN BUGS]
-----------------------------------------------
U can not have ANY files in the root of your .zip archive
All importing files MUST be located inside a folder in the .zip file.
e.i.
This archive tree is wrong:

/summer.jpg
/winter.jpg
/thumbnails/summer.jpg
/thumbnails/winter.jpg


This archive tree is correct:

/seasons/summer.jpg
/seasons/winter.jpg
/seasons/thumbnails/summer.jpg
/seasons/thumbnails/winter.jpg


Please let me know if it works or not, so I can move this thread in MODs forum.

150
Chit Chat / SAFE MODE collection
« on: March 08, 2003, 01:25:52 PM »
I feel like people started teasing everbody with "SAFE MODE" problem...:evil::!:


http://4homepages.de/forum/viewtopic.php?t=6437
http://4homepages.de/forum/viewtopic.php?t=6149
http://4homepages.de/forum/viewtopic.php?t=6136
http://4homepages.de/forum/viewtopic.php?t=6029
http://4homepages.de/forum/viewtopic.php?t=5974
http://4homepages.de/forum/viewtopic.php?t=5885
http://4homepages.de/forum/viewtopic.php?t=5918
http://4homepages.de/forum/viewtopic.php?t=5817
http://4homepages.de/forum/viewtopic.php?t=5592
http://4homepages.de/forum/viewtopic.php?t=5505
http://4homepages.de/forum/viewtopic.php?t=5470
http://4homepages.de/forum/viewtopic.php?t=5444
http://4homepages.de/forum/viewtopic.php?t=5354
http://4homepages.de/forum/viewtopic.php?t=5174
http://4homepages.de/forum/viewtopic.php?t=5122
http://4homepages.de/forum/viewtopic.php?t=5021
http://4homepages.de/forum/viewtopic.php?t=5037
http://4homepages.de/forum/viewtopic.php?t=5023
http://4homepages.de/forum/viewtopic.php?t=4846
http://4homepages.de/forum/viewtopic.php?t=4815
http://4homepages.de/forum/viewtopic.php?t=4811
http://4homepages.de/forum/viewtopic.php?t=4720
http://4homepages.de/forum/viewtopic.php?t=4718
http://4homepages.de/forum/viewtopic.php?t=4627
http://4homepages.de/forum/viewtopic.php?t=4614
http://4homepages.de/forum/viewtopic.php?t=4576
http://4homepages.de/forum/viewtopic.php?t=4534
http://4homepages.de/forum/viewtopic.php?p=18867
http://4homepages.de/forum/viewtopic.php?p=18177
http://4homepages.de/forum/viewtopic.php?t=4314&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=4308&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=4298&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=4299&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=4142&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=4014&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3890&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?highlight=safe+mode&p=16034#16034
http://4homepages.de/forum/viewtopic.php?t=3892&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2793&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3704&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3575&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3641&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?highlight=safe+mode&p=14899#14899
http://4homepages.de/forum/viewtopic.php?t=3608&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3556&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3530&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3484&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3429&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?highlight=safe+mode&p=13276#13276
http://4homepages.de/forum/viewtopic.php?t=3180&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=3168&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2095&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2815&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2819&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2717&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2731&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2623&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2657&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2643&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2574&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2575&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2569&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2499&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2238&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2206&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2087&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=2022&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1983&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1823&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1114&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1689&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1586&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1512&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1487&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1290&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1141&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1111&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=1002&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=300&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=937&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=924&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=862&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=846&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=734&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=708&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=469&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=355&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=304&highlight=safe+mode
http://4homepages.de/forum/viewtopic.php?t=67&highlight=safe+mode

Pages: 1 ... 6 7 8 9 [10] 11 12 13 14