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 - thunderstrike

Pages: 1 ... 3 4 5 6 [7]
91
Hi,

first time I post here. Is possible to draw me a button for delete lightbox ? No exper in draw ...
For default tpl is good. Is for decrease trafic for 4images user.
If no one, is ok. ;)

92
Feedback & Suggestions / [FIX] - lightbox.php - delete link
« on: August 14, 2007, 02:30:01 PM »
In lightbox.php file,

find:

Quote
"lang_delete_lightbox" => $lang['delete_lightbox'],
"url_delete_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox"),

replace:

Quote
"url_delete_lightbox" => (isset($num_rows) && $num_rows > 0) ? $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox") : 0,
"num_rows" => (isset($num_rows) && $num_rows > 0) ? (int)$num_rows : 0,

In includes/page_header.php file,

find:

Quote
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];

replace:

Quote
$msg = (isset($HTTP_POST_VARS['num_rows']) && $HTTP_POST_VARS['num_rows'] > 0 && clear_lightbox()) ? $lang['lightbox_delete_success'] : redirect($url);

In templates/your_template/lightbox.html file,

find:

Quote
<script language="JavaScript">
                    function clearlightbox() {
                        if (confirm('{lang_delete_lightbox_confirm}')) {
                         location.href = "{url_delete_lightbox}";
                        }
                       }
                    </script>
                        <a href="javascript:clearlightbox()"><b>{lang_delete_lightbox}</b></a>

replace:

Quote
{if num_rows}
                        <script language="JavaScript">
                    function clearlightbox() {
                        if (confirm('{lang_delete_lightbox_confirm}')) {
                         location.href = "{url_delete_lightbox}";
                        }
                       }
                    </script>
                        <form method="post" action="{url_delete_lightbox}">
                        <input type="hidden" name="action" value="clearlightbox">
                        <input type="hidden" name="num_rows" value="{num_rows}">
                        <input type="image" src="{template_image_url}/delete_lightbox.gif" onClick="javascript:clearlightbox()" />
                        </form>
                        {endif num_rows}

Thank to Mawenzi for draw button:

http://www.4homepages.de/forum/index.php?topic=18408.msg98456#msg98456

No show delete lightbox button if quant is 0 + chek for user try to use URL for delete. If num_rows no find, redirect to index.php file. ;)

93
Feedback & Suggestions / [FIX] - includes/template.php file.
« on: August 11, 2007, 11:35:21 PM »
In includes/template.php file,

find:

Quote
// Replace <?xml by printing them via php to avoid error messages when short_open_tags is on
    $template = preg_replace('/<\?xml/i', "<?php echo '<?xml'; ?>", $template);

replace:

Quote
/* Replace <?xml by printing them via php to avoid error messages when short_open_tags is on*/
    $template = preg_replace('/<\?xml/i', "<?php echo '<?xml'; ?>", $template);

94
Plugins / [Plugin] - MOD Compare
« on: August 07, 2007, 07:41:23 PM »
Hi,

past days, I create a MOD called: MOD Compare - for surprise. Allow for MOD builder troubleshoot users - install their MOD. Two click need to see result. Hope you like - long time waited for all ... think ... ;)

[Upgrade - 16-02-2008] - I create v2.0. Please see upgrade for new version (need install v1.0 if no have).
- Specs:

- AJAX select file.
- Upgrade tag remove (no need).
- Good detect of constants.
- URL of forum author topic add with BLANK target.
- SQL storage (tmp table) and order value by asc for line text value and delete fields after file is select.

NO KAI - NO DEMO KAI :!:

[Version v1.0]

// Step 1

In admin/plugins, create file: mod_compare.php .

Copy content:

Quote
<?php // PLUGIN_TITLE: MOD Compare
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: batch_import.php                                     *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.4                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
require(ROOT_PATH.'admin/admin_global.php');

show_admin_header();

if ($action == "") {
    $action = "select_mod_files";
}

if ($action == "select_mod_files") {        
        
    echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
    echo "<tr>";      
    echo "<td width=\"100%\">\n";    
    echo "<form method=\"post\" action=\"" . $site_sess->url(get_basefile(stripslashes($HTTP_SERVER_VARS['PHP_SELF']))). "\">\n";
    echo "<input type=\"hidden\" name=\"action\" value=\"show_mod_files\">\n";
    echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";    
    echo "<tr>\n";
    echo "<td width=\"100%\" class=\"tableseparator\" align=\"center\">" . $lang['mod_compare_choose_file']. "</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td width=\"100%\" class=\"tablerow\">\n";
    echo "<center><select name=\"select_mod_file\">\n";    
    
    if ($handle = @opendir(ROOT_PATH . MODS_INSTALL_DIR)) {
        while (false !== ($file = @readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "<option value=\"" . $file . "\">" . $file . "</option>";
            }
        }    
    }
    echo "</select>";
    echo "<br /><br /><input type=\"submit\" name=\"submit\" value=\"" . $lang['submit'] . "\" class=\"button\" />";
    echo "</form></center></td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td width=\"100%\" class=\"tableseparator\">&nbsp;</td>";
    echo "</tr>";
    echo "</table>";
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    @closedir($handle);
}


if ($action == "show_mod_files") {
    
    if (isset($HTTP_POST_VARS['select_mod_file'])) {
        $select_mod_file = (isset($HTTP_POST_VARS['select_mod_file'])) ? get_basefile(stripslashes($HTTP_POST_VARS['select_mod_file'])) : "";
    }
    
    if (isset($select_mod_file) && empty($select_mod_file)) {
        echo $lang['mod_compare_if_empty_file'];
    }
    
    $file = stripslashes(ROOT_PATH . MODS_INSTALL_DIR . "/" . $select_mod_file);
    $lines = file($file);        
    
    if (isset($file) && !empty($file) && isset($lines) && !empty($lines)) {
        
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";
        echo "<td width=\"100%\">";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";        
        echo "<td width=\"100%\" class=\"tablerow\"><a href=\"" . $site_sess->url(get_basefile(stripslashes($HTTP_SERVER_VARS['PHP_SELF']))) . "\">" . $lang['mod_compare_go_back'] . "</a></td>";
        echo "</tr>";        
        echo "</table>";
        echo "<form method=\"post\" action=\"" . $site_sess->url(get_basefile(stripslashes($HTTP_SERVER_VARS['PHP_SELF']))). "\">\n";        
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";        
        echo "<td width=\"100%\" class=\"tableseparator\" align=\"center\">" . $lang['mod_compare_file_name_title'] . get_basefile(stripslashes($file)) . "</td>";
        echo "</tr>";        
        echo "</table>";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">";
        echo "<center><textarea name=\"compare_files\" cols=\"180\" rows=\"20\">\n";
        
        $begin_mod_constant_line = array();
        $end_mod_constant_line = array();
        $begin_update_constant_line = array();
        $end_update_constant_line = array();
        $author_constant_line = array();
        $name_constant_line = array();
        $release_constant_line = array();
        $support_constant_line = array();
        $description_constant_line = array();
        $begin_assistance_constant_line = array();
        $end_assistance_constant_line = array();
        $constant_key_lines = array();
        $forimages_core_version = array();        
        
        while (list($key, $val) = each($lines)) {
            $key = $key + 1;
            
            if (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ MOD/", $val)) {
                $constant_key_lines[] = $key;                
                $begin_mod_constant_line[] = format_text(stripslashes($val), 2);
                echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ End of MOD/", $val)) {
                $constant_key_lines[] = $key;                
                $end_mod_constant_line[] = format_text(stripslashes($val), 2);                
                echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Update/", $val)) {
                $constant_key_lines[] = $key;                
                $begin_update_constant_line[] = format_text(stripslashes($val), 2);
                echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ End of Update/", $val)) {
                $constant_key_lines[] = $key;
                $end_update_constant_line[] = format_text(stripslashes($val), 2);
                echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Assistance/", $val)) {
                $constant_key_lines[] = $key;                
                $begin_assistance_constant_line[] = format_text(stripslashes($val), 2);
                echo format_text(stripslashes($val), 2);                
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ End of Assistance/", $val)) {
                $constant_key_lines[] = $key;                
                $end_assistance_constant_line[] = format_text(stripslashes($val), 2);
                echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Author/", $val)) {
                $author_constant_line[] = format_text(stripslashes($val), 2);
                //echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Name/", $val)) {
                $name_constant_line[] = format_text(stripslashes($val), 2);
                //echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Release/", $val)) {
                $release_constant_line[] = format_text(stripslashes($val), 2);
                //echo format_text(stripslashes($val), 2);            
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/\/\/ Support/", $val) && preg_match('@^(?:http://)?([^/]+)@i', $val)) {
                $support_constant_line[] = "<a href=\"" . $val . "\" target=\"_blank\">" . format_text(stripslashes($val), 2) . "</a>";
                //echo format_text(stripslashes($val), 2);            
            } elseif (preg_match("/\/\/ Description/", $val) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $val)) {
                $description_constant_line[] = format_text(stripslashes($val), 2);
                //echo format_text(stripslashes($val), 2);
            } elseif (preg_match("/[\$A-Za-z0-9\-\_]/", $val) && preg_match("/Scriptversion/", $val)) {
                $forimages_core_version[] = format_text(stripslashes($val), 2);
            } else {
                echo format_text(stripslashes($val), 2);
            }
        }        
        echo "</textarea></form></center></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
        echo "</tr>";
        echo "</table>";
        
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";        
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tableseparator\" align=\"center\">" . $lang['mod_compare_diagnostic_title'] . "</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
        echo "</tr>";
        echo "</table>";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\" align=\"center\">";        
        
        if (defined('SCRIPT_VERSION') && isset($forimages_core_version) && is_array($forimages_core_version) && !empty($forimages_core_version)) {
            while (list(, $val) = each($forimages_core_version)) {                    
                $val = str_replace("*", "", $val);
                $val = preg_replace("/[^0-9\.]+/i", "", $val);
                if ($val == SCRIPT_VERSION) {
                    echo $lang['mod_compare_match_script_version_text'] . "<b>v" . $val . "</b> - <font color=\"green\">" . $lang['mod_compare_found_entry_text'] . "</font>";
                } else {
                    echo $lang['mod_compare_no_match_script_version_text'];
                }              
            }
            echo "<br />";
        }
        
        if (function_exists('phpversion')) {
            echo $lang['mod_compare_php_version_text'] . "<b>v" . phpversion() . "</b> - <font color=\"green\">" . $lang['mod_compare_found_entry_text'] . "</font>";
            echo "<br />";
        }
        
        if (function_exists('get_mysql_version')) {
            echo $lang['mod_compare_mysql_version_text'] . "<b>v" . get_mysql_version() . "</b> - <font color=\"green\">" . $lang['mod_compare_found_entry_text'] . "</font>";
            echo "<br />";
        }
        
        echo "</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
        echo "</tr>";
        echo "</table>";
        
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";        
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tableseparator\" align=\"center\">Description</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>";
        echo "</tr>";
        echo "</table>";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
        echo "<tr>";
        echo "<td width=\"100%\" class=\"tablerow\" align=\"center\">";
        
        if (isset($author_constant_line) && is_array($author_constant_line) && !empty($author_constant_line)) {
            echo $lang['mod_compare_author_title'];
            while (list(, $val) = each($author_constant_line)) {                
                $val = str_replace("// Author:", "", $val);
                echo "<b>" . $val . "</b>";
            }
            echo "<br />";
        }
        
        if (isset($name_constant_line) && is_array($name_constant_line) && !empty($name_constant_line)) {
            echo $lang['mod_compare_name_title'];
            while (list(, $val) = each($name_constant_line)) {
                $val = str_replace("// Name:", "", $val);
                echo "<b>" . $val . "</b>";
            }
            echo "<br />";
        }
        
        if (isset($release_constant_line) && is_array($release_constant_line) && !empty($release_constant_line)) {
            echo $lang['mod_compare_release_title'];
            while (list(, $val) = each($release_constant_line)) {
                $val = str_replace("// Release:", "", $val);
                echo "<b>" . $val . "</b>";
            }
            echo "<br />";
        }        
        
            echo $lang['mod_compare_forimages_copyright_title'];
            echo "<br />";
        
        if (isset($support_constant_line) && is_array($support_constant_line) && !empty($support_constant_line)) {
            echo $lang['mod_compare_support_title'];
            while (list(, $val) = each($support_constant_line)) {
                $val = str_replace("// Support:", "", $val);
                echo "<b>" . stripslashes($val) . "</b>";
            }
            echo "<br />";
        }
        
        if (isset($description_constant_line) && is_array($description_constant_line) && !empty($description_constant_line)) {            
            echo "<br />";
            echo $lang['mod_compare_description_title'];            
            while (list(, $val) = each($description_constant_line)) {                
                $val = str_replace("// Description:", "", $val);
                echo "<b>" . $val . "</b>";
            }
            echo "<br />";
        }
        
        echo "</td>\n";
        echo "</tr>\n";
        echo "<tr>\n";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>\n";
        echo "</tr>\n";
        echo "</table>\n";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";        
        echo "<tr>\n";
        echo "<td width=\"100%\" class=\"tableseparator\" align=\"center\">" . $lang['mod_compare_begin_end_title'] . "</td>\n";        
        echo "</tr>\n";        
        echo "</table>\n";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
        echo "<tr>\n";
        echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>\n";
        echo "</tr>\n";
        echo "</table>\n";
        echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";        
        echo "<tr>\n";
        echo "<td width=\"50%\" class=\"tablerow\" align=\"center\">\n";
            
                if (isset($begin_mod_constant_line) && isset($constant_key_lines) && is_array($begin_mod_constant_line) && !empty($begin_mod_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {                                        
                    while (list(, $val) = each($begin_mod_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    echo "<br />";
                }
                
                if (isset($end_mod_constant_line) && isset($constant_key_lines) && is_array($end_mod_constant_line) && !empty($end_mod_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {
                    while (list(, $val) = each($end_mod_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    echo "<br />";                    
                }
                
        echo "&nbsp;</td></tr><tr><td width=\"50%\" class=\"tablerow\" align=\"center\">";
                
                if (isset($begin_update_constant_line) && isset($constant_key_lines) && is_array($begin_update_constant_line) && !empty($begin_update_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {
                    while (list(, $val) = each($begin_update_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    echo "<br />";                        
                }
                
                if (isset($end_update_constant_line) && isset($constant_key_lines) && is_array($end_update_constant_line) && !empty($end_update_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {
                    while (list(, $val) = each($end_update_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    echo "<br />";
                }
                
        echo "</td>\n";
        echo "</tr>\n";
        echo "</table>";
        
        if (isset($begin_assistance_constant_line) && is_array($begin_assistance_constant_line) && !empty($begin_assistance_constant_line) && isset($end_assistance_constant_line) && is_array($end_assistance_constant_line) && !empty($end_assistance_constant_line)) {
            
            echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
            echo "<tr>\n";
            echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>\n";
            echo "</tr>\n";
            echo "</table>\n";
            echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
            echo "<tr>\n";
            echo "<td width=\"50%\" class=\"tablerow\" align=\"center\">";
        
                if (isset($begin_assistance_constant_line) && isset($constant_key_lines) && is_array($begin_assistance_constant_line) && !empty($begin_assistance_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {
                    while (list(, $val) = each($begin_assistance_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    //echo "<br />";                    
                }
                
            echo "&nbsp;</td></tr><tr><td width=\"50%\" class=\"tablerow\" align=\"center\">";
        
                if (isset($end_assistance_constant_line) && isset($constant_key_lines) && is_array($end_assistance_constant_line) && !empty($end_assistance_constant_line) && is_array($constant_key_lines) && !empty($constant_key_lines)) {
                    while (list(, $val) = each($end_assistance_constant_line)) {
                        while (list(, $val1) = each($constant_key_lines)) {                        
                            echo $lang['mod_compare_line_title'] . "<b>" . $val1 . "</b>: " . $val;
                            break;
                        }
                    }
                    echo "<br />";                    
                }
        
            echo "</td>";
            echo "</tr>";
            echo "</table>\n";
            
        }
            echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
            echo "<tr>\n";
            echo "<td width=\"100%\" class=\"tablerow\">&nbsp;</td>\n";
            echo "</tr>\n";
            echo "<tr>\n";
            echo "<td width=\"100%\" class=\"tableseparator\">&nbsp;</td>\n";
            echo "</tr>\n";
            echo "</table>\n";
            echo "</td>\n";
            echo "</tr>\n";
            echo "</table>\n";
    }        
}

show_admin_footer();
?>

// Step 2

In includes/constants.php file

add top of ?>:

Quote
define('MODS_INSTALL_DIR', 'mods_install'); // Change folder name.

Warn: Change 'mods_install' for your personal folder MOD install.

// Step 3

Create (on ROOT_PATH) the folder name you type on step 2 (read warn).

// Step 4

In lang/english/admin.php file:

After:

Quote
$lang['save_settings_success'] = "Settings saved";

add:

Quote
//-----------------------------------------------------
//--- MOD Compare -------------------------------------
//-----------------------------------------------------
$lang['mod_compare_choose_file'] = "Choose file";
$lang['mod_compare_if_empty_file'] = "Please choose file from your MOD install folder.";
$lang['mod_compare_go_back'] = "[ Go back ]";
$lang['mod_compare_file_name_title'] = "Filename: ";
$lang['mod_compare_diagnostic_title'] = "Diagnostic";
$lang['mod_compare_match_script_version_text'] = "Match version (core and this file): ";
$lang['mod_compare_found_entry_text'] = "found !";
$lang['mod_compare_no_match_version_text'] = "No identical version. <b>Upgrade to last !</b>";
$lang['mod_compare_php_version_text'] = "PHP Version: ";
$lang['mod_compare_mysql_version_text'] = "mySQL Version: ";
$lang['mod_compare_author_title'] = "Author: ";
$lang['mod_compare_name_title'] = "Name: ";
$lang['mod_compare_release_title'] = "Release: ";
$lang['mod_compare_forimages_copyright_title'] = "4images Copyright: <b>Jan Sorgalla</b>";
$lang['mod_compare_support_title'] = "Support: ";
$lang['mod_compare_description_title'] = "Description: ";
$lang['mod_compare_begin_end_title'] = "Begin / End MOD line";
$lang['mod_compare_line_title'] = "Line: ";

// Here how works

4images coder codes new MOD - must respect 5 constant:

1st step (top file)

Quote

// Author: Coder name.
 // Name: MOD name.
 // Release: version number + date (examp: v1.0 - August 7 2007 - good for upgrade too)
 // Support: http://www.4homepages.de/forum
 // Description: MOD description (what is do).


Then, if modify core file and need addon -

Quote
// MOD: Your MOD
// End of MOD: Your MOD

For upgrade:

Quote
// Upgrade: Your MOD (+ new date release).
// End of Upgrade: Your MOD

(Both can use). ;)

If new file / new upgrade file, sure to put the 5 constant + beginning of title + end. ;)

Warn: Constant no optional - MUST be used this way.

Examp:

Quote
// MOD: << No matter after >>

// MOD: is static (same for update).

Forgot say:

Quote
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: mod_compare.php                                     *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.4                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

This block must stay in PHP file (core / new no matter) on top (<?php - > block).

All lines identify when choose file (begin of each constant + end of each constant). Diagnostic include.

2nd step:

- new constant add - (optional)

Optional:

Quote
// Assistance: your keyword
// End of Assistance: your keyword

[Version v2.0]

// Step 1

In admin/plugins - replace full code of mod_compare.php file with this:

Code: [Select]
<?php // PLUGIN_TITLE: MOD Compare
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: mod_compare.php                                     *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fweitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
 
 // Author: Coder name.
 // Name: MOD name.
 // Release: version number + date (e.g: v2.0 - February 16 - good for upgrade too)
 // Support: http://www.4homepages.de/forum
 // Description: MOD description (what is do).
 
// MOD: MOD Compare

$nozip 1;
define('IN_CP'1);
define('ROOT_PATH'"./../../");
require(
ROOT_PATH.'admin/admin_global.php');
define('MOD_COMPARE_TABLE'$table_prefix 'mod_compare');
$substr_self_url str_replace("plugins/"""$self_url);

show_admin_header();

if (
$action == "") {
    
$action "show_mod_compare";
}


if (
$action == "show_mod_compare") {
    
?>

    
    <form>
    <?php echo $lang['mod_compare_select_file']; ?>
    <select name="mod_compare" onchange="showFileName(this.value)" class="select" />        
    <option>---</option>
    <?php
    
if (is_dir(ROOT_PATH MODS_INSTALL_DIR)) {
        
$handle = @opendir(ROOT_PATH MODS_INSTALL_DIR);
        while (
false !== ($file = @readdir($handle))) {
            if (
$file != ".." && $file != "." && preg_match("/[a-z0-9_]/"$file) && preg_match("/\.php$/"$file) && preg_match("/\<?php/"$file$regs) && $file != $substr_self_url) {
                
?>

                <option value="<?php echo get_basefile(stripslashes(trim($file))); ?>"><?php echo get_basefile(stripslashes(trim($file))); ?></option>
                <?php
            
}
        }
        @
closedir($handle);
    }
    
?>

    </select>
    </form>      
        
    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tableborder" />
    <tr class="tableseparator">
    <td width="100%" class="tableheader">&nbsp;<?php echo $lang['mod_compare_title']; ?></td>
    </tr>
    <tr class="tableseparator">
    <td width="100%" class="tablerow">&nbsp;</td>
    </tr>
    <tr class="tableseparator">
    <td width="100%"><div id="mcint">&nbsp;</div></td>
    </tr>        
    </table>    
    <?php        
}

if (
$action == "exec_mod_compare") {
    if (isset(
$HTTP_GET_VARS['file_name'])) {
        
$file_name = (isset($HTTP_GET_VARS['file_name'])) ? format_text(trim($HTTP_GET_VARS['file_name']), 2) : "";
    } else {
        
$file_name "---";
    }
    
    if (empty(
$file_name)) {
        
$file_name "---";
    }
    
    if (
$file_name == "---") {
        exit;    
        
    } else {        
        
    
$lines = @file(ROOT_PATH MOD_COMPARE_DIR "/" $file_name);
    
    
$sql "
    
    CREATE TABLE IF NOT EXISTS " 
MOD_COMPARE_TABLE " (
    field_id INT(11) NOT NULL AUTO_INCREMENT,    
    constant_id INT(11) NOT NULL DEFAULT '0',
    constant_name VARCHAR(255) NOT NULL DEFAULT '',
    field_date INT(11) NOT NULL DEFAULT '0',
    PRIMARY KEY(field_id)
    ) TYPE=MyISAM
    
    "
;
    
    
$result $site_db->query($sql);   
    
    
?>
   
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tableheader">&nbsp;<?php echo $lang['mod_compare_author_specs']; ?></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tablerow">&nbsp;</td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tableborder" />    
    <?php
    
    
// Defines author.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ Author\:/"$line)) {
            if (
preg_match("/(.+)\:(.+)/"$line$regs)) {
                
$regs[1] = str_replace("//"""$regs[1]);
                
?>

                <tr class="tableseparator">
                <td width="100%" class="tablerow" align="center"><b><?php echo format_text(trim($regs[1]), 2); ?></b>: <?php echo format_text(trim($regs[2]), 2); ?><br /><?php echo "\n"?></td>
                </tr>
                <?php                
            
}
        }        
    }
    
    
// Defines name.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ Name\:/"$line)) {
            if (
preg_match("/(.+)\:(.+)/"$line$regs)) {
                
$regs[1] = str_replace("//"""$regs[1]);
                
?>

                <tr class="tableseparator">
                <td width="100%" class="tablerow" align="center"><b><?php echo format_text(trim($regs[1]), 2); ?></b>: <?php echo format_text(trim($regs[2]), 2); ?><br /><?php echo "\n"?></td>
                </tr>
                <?php                
            
}
        }
    }
    
    
// Defines release.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ Release\:/"$line)) {
            if (
preg_match("/(.+)\:(.+)/"$line$regs)) {
                
$regs[1] = str_replace("//"""$regs[1]);
                
?>

                <tr class="tableseparator">
                <td width="100%" class="tablerow" align="center"><b><?php echo format_text(trim($regs[1]), 2); ?></b>: <?php echo format_text(trim($regs[2]), 2); ?><br /><?php echo "\n"?></td>
                </tr>
                <?php
            
}
        }        
    }
    
    
// Defines support    
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("//\/\ Support\:/"$line)) {
            if (
preg_match("/(.+)\:(.+)\:(.+)/"$line$regs)) {
                
$regs[1] = str_replace("//"""$regs[1]);
                
$protocol $regs[2];
                
$domain $regs[3];
                
?>

                <tr class="tableseparator">
                <td width="100%" class="tablerow" align="center"><b><?php echo format_text(trim($regs[1]), 2); ?></b>: <a href="<?php echo $protocol ":" $domain?>" target="_blank"><?php echo $protocol ":" $domain?></a><br /><?php echo "\n"?></td>
                </tr>
                <?php
            
}
        }               
    }
    
?>

    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tablerow">&nbsp;</td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tableheader">&nbsp;<?php echo $lang['mod_compare_description_title']; ?></td>
    </tr>
    </table>    
    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tableborder" />
    <?php    
    
    
// Defines description
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ Description\:/"$line)) {
            if (
preg_match("/(.+)\:(.+)/"$line$regs)) {
                
$regs[1] = str_replace("//"""$regs[1]);
                
?>

                <tr class="tableseparator">
                <td width="100%" class="tablerow"><p align="justify"><br />&nbsp;<?php echo format_text(trim($regs[2]), 2); ?><br /><br /><?php echo "\n"?></p></td>
                </tr>
                <?php
            
}
        }                
    }
    
?>

    </table>    
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tablerow">&nbsp;</td>
    </tr>
    </table>        
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tableheader">&nbsp;<?php echo $file_name?></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" class="tablerow">&nbsp;</td>
    </tr>
    </table>    
    <?php   
    $sort_list 
= array();    
    
$sort_text = array();    
    
    
// Defines Begin MOD.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ MOD\:/"$line)) {            
            
$sort_list[] = "{$line_num} => ";
            
$sort_text[] = format_text(trim($line), 2);
        }        
    }
    
// Defines End MOD.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ End of MOD\:/"$line)) {            
            
$sort_list[] = "{$line_num} => ";
            
$sort_text[] = format_text(trim($line), 2);
        }        
    }
    
// Defines Begin Assistance.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ Assistance\:/"$line)) {            
            
$sort_list[] = "{$line_num} => ";
            
$sort_text[] = format_text(trim($line), 2);
        }        
    }
    
// Defines End Assistance.
    
foreach ($lines as $line_num => $line) {
        
$line_num $line_num 1;
        if (
preg_match("/\/\/ End of assistance\:/"$line)) {            
            
$sort_list[] = "{$line_num} => ";
            
$sort_text[] = format_text(trim($line), 2);
        }        
    }   
    
    
$num_sort_list sizeof($sort_list);
    
$num_sort_text sizeof($sort_text);    
    
    
$valid false;
    for (
$i 0$i $num_sort_list$i++) {            
        for (
$j 0$j $num_sort_text$j++) {
            
$site_db->query("INSERT INTO " MOD_COMPARE_TABLE " (field_id, constant_id, constant_name, field_date) VALUES (NULL, '"  $sort_list[$j] . "', '" $sort_text[$j] . "', '" time() . "')");            
            
$valid true;                
        }
        break;
    }
    unset (
$sort_list);
    unset (
$sort_text);
    
    if (
$valid == true) {        
        
        
$sql "
        
        SELECT constant_id, constant_name, field_date
        FROM " 
MOD_COMPARE_TABLE "        
        ORDER BY constant_id ASC        
        
        "
;
        
        
$result $site_db->query($sql);       
        
        
$counter 0;       
        while (
$line_row $site_db->fetch_array($result)) {
            
$constant_id $line_row['constant_id'];
            
$constant_name format_text(trim($line_row['constant_name']), 2);
            
$field_date = (function_exists('get_universal_field_date')) ? get_universal_field_date($line_row['field_date']) : format_date($config['date_format'], $line_row['field_date']);            
            
            
?>
         
            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tableborder" />
            <tr class="tableseparator">
            <?php
            
if (preg_match("/\/\/ MOD\:/"$constant_name)) {
            
?>

                <td width="50%" class="tablerow" align="center"><?php echo $lang['mod_compare_begin_line'] . $constant_id?><br /><?php echo $constant_name?></td>                
            <?php            
            
} elseif (preg_match("/\/\/ End of MOD\:/"$constant_name)) {
            
?>
               
                <td width="50%" class="tablerow" align="center"><br /><?php echo $lang['mod_compare_end_line'] . $constant_id?><br /><?php echo $constant_name?><hr /></td>
            <?php
            
}
            
?>

            </tr>
            </table>            
            
            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tableborder" />
            <tr class="tableseparator">
            <?php
            
if (preg_match("/\/\/ Assistance\:/"$constant_name)) {                
            
?>

                <td width="50%" class="tablerow" align="center"><?php echo $lang['mod_compare_begin_line'] . $constant_id?><br /><?php echo $constant_name?></td>                
            <?php            
            
} elseif (preg_match("/\/\/ End of assistance\:/"$constant_name)) {                                
            
?>

                <td width="50%" class="tablerow" align="center"><br /><?php echo $lang['mod_compare_end_line'] . $constant_id?><br /><?php echo $constant_name?><hr /></td>                
            <?php
            
}
            
?>

            </tr>
            </table>
            <?php            
            $counter
++;            
            if (
$counter == 0) {
            
?>
 
                <table border="0" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                <td width="100%" class="tablerow">&nbsp;</td>
                </tr>
                </table>                
            <?php
            
}
        }            
        
?>

        <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
        <td width="100%" class="tableheader">&nbsp;<?php echo $lang['mod_compare_author_bibliography']; ?></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
        <td width="100%" align="center" class="tablerow"><br /><span class=\"smalltext\"><b>MOD Compare</b> - created by <a href="http://www.4homepages.de/forum/index.php?topic=19856.0" target="_blank" />Thunderstrike</a> - 2007-2008<br />Version 2.0<br />(Test with <b>4images v1.76 - PHP v5.2.5 - mySQL v5.0.45</b>)</span><br /><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
        <td width="100%" class="tableheader">&nbsp;</td>
        </tr>
        </table>
        <?php
        $site_db
->query("DELETE FROM " MOD_COMPARE_TABLE);
        
    } else {
        echo 
"Error";
    }
    
?>
   
    </td>
    </tr>
    </table>    
    <?php
    
}
}
    
show_admin_footer();

// End of MOD: MOD Compare
?>


// Step 2

In lang/english/admin.php file,

replace full lang block code (MOD Compare) with this:

Code: [Select]
//-----------------------------------------------------
//--- MOD Compare -------------------------------------
//-----------------------------------------------------
$lang['mod_compare_title'] = "MOD Compare";
$lang['mod_compare_author_specs'] = "Author Specs";
$lang['mod_compare_select_file'] = "Select file: ";
$lang['mod_compare_description_title'] = "Description";
$lang['mod_compare_begin_line'] = "Begin line: ";
$lang['mod_compare_end_line'] = "End line: ";
$lang['mod_compare_author_bibliography'] = "Bibliography";

// Step 3

In admin/admin_functions.php file,

find:

Code: [Select]
<script type="text/javascript" language="javascript" src="<?php echo ROOT_PATH?>admin/calendar.js"></script>

add after:

Code: [Select]
<?php
// MOD: MOD Compare
    
if (preg_match("/mod_compare.php/"$self_url)) {
        
?>

        <script src="<?php echo ROOT_PATH?>admin/mod_compare.js"></script>
        <?php
    
}
    
// End of MOD: MOD Compare
?>


// Step 4

In admin, create file: mod_compare.js .

Add:

Code: [Select]
var xmlHttp

function showFileName(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./../../admin/plugins/mod_compare.php"
url=url+"?action=exec_mod_compare&file_name="+str
//url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 document.getElementById("mcint").innerHTML=xmlHttp.responseText
 }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

// Step 5

Set CHMOD 755 to MODS_INSTALL_DIR (no need for full write now).

// Is work

ACP - > Plugins - > MOD Compare . After you upload target file of MOD coder in MODS_INSTALL_DIR, select file in form and file is load. ;)

This give better forum support to user have problem find content.

E.g: http://www.4homepages.de/forum/index.php?topic=18296.0

Easy trace. ;)

Hope you like. Rate for it. :D

95
Chit Chat / PM V3
« on: August 05, 2007, 02:12:55 PM »
This is topic for vote - have new version of PM V3. Topic active - 14 days (2 weak). Result show once expire - anyone. 1 vote max for anyone. We see which most. Twist finger (note: Exclud me for vote - no in - no worry). :)

96
Mods & Plugins (Releases & Support) / [MOD] - Profile invisible.
« on: July 28, 2007, 12:08:46 AM »
Hi, I would like to share my MOD to see if anyone would be interested. It allows users to put their profile invisible.

1 - When profile is invisible and another user try to view it, it will re-forward the request towards another user account.
2 - If all users account are invisible, it will re-forward to the index page (except for admins).

- Step 1.

In member.php file,

Find:

Quote
if ($user_row = get_user_info($user_id)) {
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;

replace with:

Quote
if ($user_row = get_user_info($user_id)) {
// Profile invisible.
      if ($user_row['user_id'] != $user_info['user_id'] && $user_info['user_level'] != ADMIN && defined('PROFILE_INVISIBLE') && PROFILE_INVISIBLE == 1 && $user_row['profile_invisible'] == 1) {         
          if (function_exists('get_profile_visible') && $visible_row = get_profile_visible($user_id)) {
              redirect("member.php?action=showprofile&" . URL_USER_ID . "=" . $visible_row['user_id']);                   
          } else {
              redirect($url);
          }
          unset ($user_id);
      }
      // End of profile invisible.
     
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;

- Step 2.

In includes/functions.php file,

add above ?> tag:

Quote
function get_profile_visible($user_id = 0) {
    global $site_db, $user_table_fields, $user_row;
    $user_info = 0;
    if ($user_id != 0 && $user_id != GUEST) {
       
        if (isset($user_row[$user_id]) && !isset($user_row['profile_invisible'])) {
           
            $sql_alter = "ALTER TABLE " . USERS_TABLE . " ADD profile_invisible TINYINT(1) DEFAULT 0 NOT NULL";
            $result = $site_db->query($sql_alter);
           
            if (isset($result) && isset($user_row['profile_invisible'])) {
                if (is_object($site_email) && !empty($site_email)) {
                    unset ($site_email);
                }
               
                if (defined('PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT') && PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT == 1) {
                    @include_once(ROOT_PATH.'includes/email.php');
                    $site_email = new Email();
                   
                    $sql_email_all_wanted_email_users = "
                   
                    SELECT " . get_user_table_field("", "user_name"). get_user_table_field(", ", "user_email") . "
                    FROM " . USERS_TABLE . "
                    WHERE " . get_user_table_field("", "user_level") . " >= " . USER . " AND " . get_user_table_field("", "user_allowemails") . " = 1

                    ";
                   
                    $result1 = $site_db->query($sql_email_all_wanted_email_users);
                   
                    if (isset($result1) && $site_db->get_numrows($result1) > 0) {
                        while ($user_email_info = $site_db->fetch_array($result1)) {
                            $user_name = $user_email_info[$user_table_fields['user_name']];
                            $user_email = $user_email_info[$user_table_fields['user_email']];                           
                        }
                       
                        if (isset($user_name) && isset($user_email)) {
                            $site_email->set_to(stripslashes($user_email));
                            $site_email->set_from(stripslashes($config['site_email'])); // Change this line with the email address of your choice IF ONLY it does not work from your admin settings (make sure to change BEFORE executing this MOD for the first time and to set the activation value from your constant file).
                            $site_email->set_subject($lang['profile_invisible_email_subject']);
                           
                            $site_email->register_vars(array(
                            "user_name" => trim($user_name),
                            "site_name" => trim($config['site_name']),
                            "site_email" => trim($config['site_email']),
                            "site_url" => format_url($script_url . "/index.php")
                            ));
                           
                            $site_email->set_body("profile_invisible_announcement", $config['language_dir_default']);
                            $site_email->send_email();
                        }
                    }
                }
            }
        }
           
        $sql = "
       
        SELECT DISTINCT " . get_user_table_field("", "user_id") . "
        FROM " . USERS_TABLE . "       
        WHERE " . get_user_table_field("", "user_level") . " >= " . USER . " AND profile_invisible = 0
        ORDER BY rand()
        LIMIT 1
       
        ";
       
        if ($user_info = $site_db->query_firstrow($sql)) {
            foreach ($user_table_fields as $key => $val) {
                if (isset($user_info[$val])) {
                    $user_info[$key] = $user_info[$val];
                }
                elseif (!isset($user_info[$key])) {
                    $user_info[$key] = "";
                }
            }
        }
    }
  return $user_info;
}               

- Step 3.

In includes/db_field_definitions.php file,

add above the ?> tag:

Quote
$additional_user_fields['profile_invisible'] = array($lang['profile_invisible'], "radio", 1);

- Step 4.

In includes/constants.php file,

add above the ?> tag:

Quote
// Profile invisible.
define('PROFILE_INVISIBLE', 1); // 0 to deactivate and 1 to activate.
define('PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT', 1); // 0 to deactivate and 1 to activate the email announcement for this feature to ALL users who has set their emails for allowance (once per install only).

For the PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT, this is for sending an automated email message (once) to all your users (must accept emails from your gallery). If this is set to '0', your users will not receive the email message.

- Step 5.

In lang/english/main.php file,

add above the ?> tag:

Quote
//-----------------------------------------------------
//--- Profile invisible -------------------------------
//-----------------------------------------------------
$lang['profile_invisible'] = "Make my profile invisible to others:<br /><span class=\"smalltext\"><b>(Note: This option disregards the administrators.)</span>";
$lang['profile_invisible_email_subject'] = "Profile invisible feature - added on your profile.";

- Step 6.

In lang/english/email folder, create file called: profile_invisible_announcement.html and place content inside:

Quote
Dear {user_name},

{site_name} gallery has intergrated a new feature called:

- Profile invisible.

This will allow you to hide your profile from other users.
Note: This feature disregards the ADMIN level since they
can still see your profile even when restricted.

Now, other users who will try to see your profile will
be forwarded 'randomly' to other accounts where other
users will NOT consider this new option.

Visit our URL: {site_url} and modify your profile setting
if needed.

If you have any questions regarding this feature, please
send an email to us at: {site_email} .
Your suggestions are important to us. We will reply as
soon as possible.

Regards.

{site_name} .

Remember, constant file must be configured when consider this file.

- Step 7.

In templates/your_template/member_editprofile.html file,

find:

Quote
<tr>
            <td class="row1"><b>{lang_invisible}</b></td>
            <td class="row1">
              <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
              {lang_no}
         </td>
          </tr>         

add below:

Quote
<tr>
            <td class="row2"><b>{lang_profile_invisible}</b></td>
            <td class="row2">
              <input type="radio" name="profile_invisible" value="1"{profile_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="profile_invisible" value="0"{profile_invisible_no} />
              {lang_no}
         </td>
          </tr> 

- [2007-10-04 - Step 8]

With this MOD: http://www.4homepages.de/forum/index.php?topic=19254.0) -

add this (expert mode):

Code: [Select]
ALTER TABLE 4images_users ADD profile_invisible tinyint(1) NOT NULL default '0';

Hope you like it. :)

Cheers.

Pages: 1 ... 3 4 5 6 [7]