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 [2] 3 4 5 6 7
16
This is fix for user joindate field for now time and no 2003 time -

In data/default/mysql/mysql_default.sql file,

find:

Code: [Select]
INSERT INTO 4images_users VALUES (1, 9, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 1, 1, 0, 1016023608, '1e3457c0b2052a9633b886fd75ef91e0', 1016023608, '', 0, 0, '', '');

replace:

Code: [Select]
INSERT INTO 4images_users VALUES (1, 9, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 1, 1, 0, now(), '1e3457c0b2052a9633b886fd75ef91e0', now(), '', 0, 0, '', '');

17
Plugins / [MOD-Ajax-Plugin] - SQL Fields Diagnostic
« on: December 18, 2007, 07:57:40 PM »
This is MOD for diagnostic SQL Fields structure in ACP with single click - (Ajax)  8)
- Is easy for support in forum after create fields in phpmyadmin or SQL Patches MOD. -

I post 2 screenshot with instruction for see test for proof of work.

// Step 1

In admin/plugins folder - create file: sql_fields_diagnostic.php .

Add:

Code: [Select]
<?php // PLUGIN_TITLE: SQL Fields Diagnostic

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

show_admin_header();

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

if (
$action == "main_menu") {
    
    
$tables_info = array();
    
$db = (get_mysql_version() >= 32306)  ? "`$db_name`" $db_name;
    
$result $site_db->query("SHOW tables");    
    if (
$result) {
        
?>

        <form>
        <?php echo $lang['sql_fields_diagnostic_select_table']; ?>
        <select name="users" onchange="showTables(this.value)" class="select" />        
        <option>---</option>                    
        <?php        
        
while ($row $site_db->fetch_array($result)) {            
            if (
preg_match("/^".$table_prefix."/i"$row[0])) {
                
?>

                <option value="<?php echo $row[0]; ?>"><?php echo format_text(trim($row[0]), 2); ?></option>            
                <?php
            
}
        }
        
$site_db->free_result($result);
        
?>

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

if (
$action == "get_sql_table") {
    
    if (isset(
$HTTP_GET_VARS['table_name'])) {
        
$table_name = (isset($HTTP_GET_VARS['table_name'])) ? un_htmlspecialchars(trim((string)$HTTP_GET_VARS['table_name'])) : "";
    } else {
        
$table_name "";
    }
    
    if (isset(
$table_name) && $table_name == "---") {
        exit;
    }
    
    
$result $site_db->query("SHOW FIELDS FROM " $table_name);
    if (isset(
$result) && $result) {
        
$counter 0;
        while (
$row $site_db->fetch_array($result)) {
            
$counter++;
            
?>

            <table border="0" width="100%" cellpadding="0" cellspacing="0">
            <tr>
            <td width="100%" class="tableheader">&nbsp;<?php echo str_replace(array("{counter}""{field_name}"), array($counterformat_text(trim($row['Field']), 2)), $lang['sql_fields_diagnostic_results']); ?></td>
            </tr>
            </table>
            <table border="0" width="100%" cellpadding="0" cellspacing="0">            
            <tr>
            <td width="100%" align="center" class="tablerow">
            <?php
            
if (isset($row['Key']) && $row['Key'] == "PRI") {
                
?>

                <br /><li><?php echo $lang['sql_fields_diagnostic_primary_key']; ?></li>
                <?php
            
}            
            if (isset(
$row['Key']) && $row['Key'] == "MUL") {
                
?>

                <br /><li><?php echo $lang['sql_fields_diagnostic_multiple_key']; ?></li>
                <?php
            
}
            if (isset(
$row['Default']) && !empty($row['Default']) && is_string($row['Default']) || is_numeric($row['Default'])) {
                
?>

                <br /><li><?php echo str_replace("{default_value}"format_text(trim($row['Default']), 2), $lang['sql_fields_diagnostic_default_value']); ?></li>
                <?php
            
} elseif (isset($row['Default']) && empty($row['Default']) && is_string($row['Default'])) {
                
?>

                <br /><li><?php echo str_replace("{default_value}"$lang['sql_fields_diagnostic_empty'], $lang['sql_fields_diagnostic_default_value']); ?></li>
                <?php
            
}            
            if (isset(
$row['Extra']) && !empty($row['Extra'])) {                
                
?>

                <br /><li><?php echo $lang['sql_fields_diagnostic_auto_increment']; ?></li>
                <?php
            
}            
            if (isset(
$row['Type']) && !empty($row['Type'])) {                
                
?>

                <br /><li><?php echo str_replace("{type}"format_text(trim($row['Type']), 2), $lang['sql_fields_diagnostic_type']); ?></li>
                <?php
            
}
            if (isset(
$row['Null']) && is_null($row['Null'])) {
                
?>

                <br /><li><?php echo str_replace("{null}""<font color=\"red\">" $lang['sql_fields_diagnostic_yes'] . "</font>"$lang['sql_fields_diagnostic_null']); ?></li>
                <?php
            
} elseif (isset($row['Null']) && !is_null($row['Null'])) {
                
?>

                <br /><li><?php echo str_replace("{null}""<font color=\"green\">" $lang['sql_fields_diagnostic_no'] . "</font>"$lang['sql_fields_diagnostic_null']); ?></li>
                <?php
            
}
            
?>

            </td>
            </tr>
            </table>
            <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;</td>            
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
        <td width="100%" align="center" class="tablerow"><br /><span class=\"smalltext\">SQL Fields Diagnostic MOD - created by <a href="http://www.4homepages.de/forum/index.php?topic=19856.0" target="_blank" />Thunderstrike</a> - 2007-2008<br />Version 1.0</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
    
}
}
show_admin_footer();
?>


// Step 2

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: SQL Fields Diagnostic
    
if (preg_match("/sql_fields_diagnostic.php/"$self_url)) {
        
?>

        <script src="<?php echo ROOT_PATH?>admin/sql_fields_diagnostic.js"></script>
        <?php
    
// End of MOD: SQL Fields Diagnostic    
    
}
    
?>


// Step 3

In admin folder, create file: sql_fields_diagnostic.js .

Add:

Code: [Select]
var xmlHttp

function showTables(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./../../admin/plugins/sql_fields_diagnostic.php"
url=url+"?action=get_sql_table&table_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("txtHint").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 4

In lang/english/admin.php file,

Find:

Code: [Select]
//-----------------------------------------------------
//--- Settings ----------------------------------------
//-----------------------------------------------------
$lang['save_settings_success'] = "Settings saved";

add after:

Code: [Select]
//-----------------------------------------------------
//--- SQL Fields Diagnostic ---------------------------
//-----------------------------------------------------
$lang['sql_fields_diagnostic_title'] = "SQL Fields Diagnostic";
$lang['sql_fields_diagnostic_select_table'] = "Select a table: ";
$lang['sql_fields_diagnostic_results'] = "Field {counter}: {field_name}";
$lang['sql_fields_diagnostic_primary_key'] = "Primary key: <font color=\"green\">Found !</font>";
$lang['sql_fields_diagnostic_multiple_key'] = "Multiple key: <font color=\"green\">Found !</font>";
$lang['sql_fields_diagnostic_default_value'] = "Default value: {default_value}";
$lang['sql_fields_diagnostic_auto_increment'] = "Auto increment: <font color=\"green\">Found !</font>";
$lang['sql_fields_diagnostic_found'] = "<font color=\"green\">Found !</font>";
$lang['sql_fields_diagnostic_empty'] = "Empty";
$lang['sql_fields_diagnostic_yes'] = "Yes !";
$lang['sql_fields_diagnostic_no'] = "No !";
$lang['sql_fields_diagnostic_type'] = "Type: {type}";
$lang['sql_fields_diagnostic_null'] = "Null: {null}";

Finish.

18
I search in forum for user search for this - is BIG.  8O :)

- Check for active / no active MOD - include .
- Check for rate same user (is ignore) - include .
- Check for vote user before (1 vote only) - include .
- Only register user is vote - include .
- Use define rank value (e.g: x/10) - include .
- Use define number format value - include
- Additional user fields - include
- User delete vote can in private page - include
- User is see who vote - include
- User is see value post for post - include
- User is see total with mark value in private page - include
- Userpic - possible
- Avatar - possible
- PM Link - possible
- Test 4images v1.74 - is test
- Paging - No include

So here -

// Step 1

In member.php file,

find:

Code: [Select]
else {
      $user_email = REPLACE_EMPTY;
      $user_email_save = REPLACE_EMPTY;
      $user_mailform_link = REPLACE_EMPTY;
      $user_email_button = REPLACE_EMPTY;
    }

add after:

Code: [Select]
if (defined('MEMBER_RATING_ACTIVE') && MEMBER_RATING_ACTIVE == 1) {       
        if (function_exists('member_rating_check_user') && member_rating_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level'])) {
            $already_rated = member_rating_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level']);
   
        } elseif (function_exists('member_rating_check_user') && !member_rating_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level'])) {
            $rating_content = "";
            for ($i = MEMBER_RATING_MARK_VALUE; $i > 0; $i--) {
                $site_template->register_vars("i", $i);
                $rating_content .= $site_template->parse_template("member_rating_dropdown");           
            }
        }
    }

Find:

Code: [Select]
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------

add before:

Code: [Select]
//-----------------------------------------------------
//--- Rate user ---------------------------------------
//-----------------------------------------------------
if ($action == "rate_user") {
   
    if (isset($HTTP_POST_VARS[URL_USER_ID])) {
        $user_id = (isset($HTTP_POST_VARS[URL_USER_ID])) ? intval(trim($HTTP_POST_VARS[URL_USER_ID])) : 0;
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
    } else {
        $user_id = 0;
    }
   
    if (isset($HTTP_POST_VARS['rate_user'])) {
        $rate_user = (isset($HTTP_POST_VARS['rate_user'])) ? intval(trim($HTTP_POST_VARS['rate_user'])) : 0;
        $rate_user = preg_replace("/[^0-9]+/i", "", $rate_user);
    } else {
        $rate_user = 0;
    }
   
    if (empty($user_id) || empty($rate_user)) {
        redirect($url);
    }
   
    if (isset($user_id) && !empty($user_id) && $rate_user == "---") {
        redirect("member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id);
    }
   
    if (isset($user_id) && !empty($user_id) && isset($rate_user) && !empty($rate_user)) {
        if (function_exists('member_rating_insert_rates')) {
            member_rating_insert_rates($user_info['user_id'], $user_id, $user_info['user_level'], $rate_user);           
            redirect("member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id);           
        }
    } elseif (isset($user_id) && !empty($user_id)) {
        redirect("member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id);
   
    } else {
        redirect($url);
    }
}

find:

Code: [Select]
"lang_profile_of" => $lang['profile_of'],

add after:

Code: [Select]
"lang_member_rating_user_rate" => $lang['member_rating_user_rate'],
"already_rated" => (isset($already_rated)) ? trim($already_rated) : "",
"rating_content" => (isset($rating_content) && $user_info['user_id'] != $user_row[$user_table_fields['user_id']]) ? trim($rating_content) : "",

// Step 2

In global.php file,

find:

Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name);

add after:

Code: [Select]
//-----------------------------------------------------
//--- Creates member rating table ---------------------
//-----------------------------------------------------
if (function_exists('member_rating_check_table')) {
    member_rating_check_table();
}

// Step 3

In includes/page_header.php file,

find:

Code: [Select]
"url_lost_password" => (!empty($url_lost_password)) ? $site_sess->url($url_lost_password) : $site_sess->url(ROOT_PATH."member.php?action=lostpassword"),
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),

add after:

Code: [Select]
"url_member_rating" => $site_sess->url(ROOT_PATH . "member_rating.php"),

find:

Code: [Select]
"lang_last_upload_images" => $lang['last_upload_images'],

add after:

Code: [Select]
"lang_member_rating_title" => $lang['member_rating_title'],

// Step 4

In includes/constants.php file,

add in top ?>:

Code: [Select]
define('MEMBER_RATING_ACTIVE', 1); // Set for active (1) - set for no active (0) for value.
define('MEMBER_RATING_MARK_VALUE', 10); // Set on what value is set (e.g: x/10). '10' is mark value.
define('MEMBER_RATING_DECIMAL_VALUE', 2); // Set decimal after answer value for vote (e.g: 9,67/10). ',67' is 2 after value.

Note: This first after install MOD (and no edit mark value after user start rate) :!:

// Step 5

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('member_rating_check_table')) {
    function member_rating_check_table() {
        global $site_db, $table_prefix;
       
        if (defined('MEMBER_RATING_ACTIVE') && MEMBER_RATING_ACTIVE == 0) {
            return;
        }
       
        if (!defined('USERS_RATING_TABLE')) {
            define('USERS_RATING_TABLE', $table_prefix . 'users_rating');
        }
       
        $sql = "
       
        CREATE TABLE IF NOT EXISTS " . USERS_RATING_TABLE . " (
        field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
        user_id int(11) NOT NULL DEFAULT '0',
        other_user_id int(11) NOT NULL DEFAULT '0',
        rating_date int(11) NOT NULL DEFAULT '0',       
        rating_value int(2) NOT NULL DEFAULT '0',
        rating_count int(11) NOT NULL DEFAULT '0',
        PRIMARY KEY(field_id)
        ) TYPE=MyISAM;
       
        ";
           
        $result = $site_db->query($sql);
    }
}

if (!function_exists('member_rating_check_user')) {
    function member_rating_check_user($user_id = 0, $other_user_id = 0, $user_level = GUEST) {
        global $site_db, $table_prefix;
       
        if (defined('MEMBER_RATING_ACTIVE') && MEMBER_RATING_ACTIVE == 0) {
            return;
        }
       
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
        $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
        $user_level = preg_replace("/[^0-9]+/i", "", $user_level);
       
        if (empty($user_id) || empty($other_user_id) || $user_level == GUEST || $user_level == USER_AWAITING) {           
            return;
        }
       
        if (!defined('USERS_RATING_TABLE')) {
            define('USERS_RATING_TABLE', $table_prefix . 'users_rating');
        }
       
        $sql = "
       
        SELECT SUM(ur.rating_value) AS total_rates
        FROM " . USERS_RATING_TABLE . " ur
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = ur.user_id)
        WHERE " . get_user_table_field("u.", "user_id") . " = ur.user_id AND ur.user_id = " . $user_id . " AND ur.other_user_id = " . $other_user_id . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
       
        ";
       
        $row = $site_db->query_firstrow($sql);
        $total_rates = (isset($row['total_rates'])) ? number_format($row['total_rates'], MEMBER_RATING_DECIMAL_VALUE) : 0;
       
        if (isset($total_rates) && $total_rates > 0) {
           
            $sql = "
           
            SELECT ur.rating_value
            FROM " . USERS_RATING_TABLE . " ur
            LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = ur.other_user_id)
            WHERE " . get_user_table_field("u.", "user_id") . " = " . $other_user_id . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
       
            ";
       
            $result = $site_db->query($sql);
            $num_rows = $site_db->get_numrows($result);
           
            if (isset($num_rows) && $num_rows > 0) {
                $rating_value = "";
                while ($rate_row = $site_db->fetch_array($result)) {
                    $rating_value += $rate_row['rating_value'];                   
                }               
                           
                $calc_total_rates = ($rating_value / $num_rows);
                $answer_total_rates = (isset($calc_total_rates)) ? number_format($calc_total_rates, MEMBER_RATING_DECIMAL_VALUE) : "";
               
                return $answer_total_rates . "/" . MEMBER_RATING_MARK_VALUE;
               
            } else {
                return false;
            }
        }
    }
}

if (!function_exists('member_rating_insert_rates')) {
    function member_rating_insert_rates($user_id = 0, $other_user_id = 0, $user_level = GUEST, $user_rates = 0) {
        global $site_db, $table_prefix;
       
        if (defined('MEMBER_RATING_ACTIVE') && MEMBER_RATING_ACTIVE == 0) {
            return;
        }
       
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
        $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
        $user_level = preg_replace("/[^0-9]+/i", "", $user_level);
        $user_rates = preg_replace("/[^0-9]+/i", "", $user_rates);
       
        if (empty($user_id) || empty($other_user_id) || $user_level == GUEST || $user_level == USER_AWAITING || empty($user_rates)) {
            return;
        }
       
        if (!defined('USERS_RATING_TABLE')) {
            define('USERS_RATING_TABLE', $table_prefix . 'users_rating');
        }
       
        $sql = "
       
        INSERT INTO " . USERS_RATING_TABLE . "
        (field_id, user_id, other_user_id, rating_date, rating_value, rating_count)
        VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '" . $user_rates . "', '1')
       
        ";
       
        if ($site_db->query($sql)) {
            return true;
       
        } else {
            return false;
        }
    }
}

// Step 6

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['member_rating_user_rate'] = "User rate: ";
$lang['member_rating_no_content'] = "No one rated over your account yet.";
$lang['member_rating_title'] = "Who voted for me ?";
$lang['member_rating_user_name'] = "User name";
$lang['member_rating_date'] = "Date";
$lang['member_rating_value'] = "Gave you";
$lang['member_rating_total_rates_title'] = "Total rates";
$lang['member_rating_rated_value'] = "You have: <b>{answer_total_rates}</b>";
$lang['member_rating_delete'] = "Delete";

// Step 7

In ROOT_PATH - create file: member_rating.php .

Add:

Code: [Select]
<?php

$main_template 
"member_rating";

define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
@include_once(
ROOT_PATH 'includes/page_header.php');

if (
$user_info['user_level'] < USER) {
    
redirect($url);
}

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

if (
$action == "delete_rate") {
    if (isset(
$HTTP_POST_VARS['delete_rate'])) {
        
$delete_rate = (isset($HTTP_POST_VARS['delete_rate'])) ? $HTTP_POST_VARS['delete_rate'] : $HTTP_GET_VARS['delete_rate'];
    } else {
        
$delete_rate "";
    }
    
    if (empty(
$delete_rate)) {
        
redirect("member_rating.php");
    }
    
    if (isset(
$delete_rate) && is_array($delete_rate) && !empty($delete_rate)) {        
        
$field_id_implode implode(", "$delete_rate);        
        
        if (!
defined('USERS_RATING_TABLE')) {
            
define('USERS_RATING_TABLE'$table_prefix 'users_rating');
        }        
        
$result $site_db->query("DELETE FROM " USERS_RATING_TABLE " WHERE field_id IN (" $field_id_implode ")");
               
        if (isset(
$result) && $result) {
            
redirect("member_rating.php");
        }
    } else {
        
redirect("member_rating.php");
    }
}

if (
$action == "viewrating") {
    
    if (!
defined('USERS_RATING_TABLE')) {
        
define('USERS_RATING_TABLE'$table_prefix 'users_rating');
    }
    
    if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
        
$additional_sql "";
        foreach (
$additional_user_fields as $key => $val) {
            
$additional_sql .= ", u." $key;
        }
    }
    
    
$sql "
    
    SELECT ur.field_id, ur.user_id, ur.rating_date, ur.rating_value" 
get_user_table_field(", u.""user_name") . $additional_sql "    
    FROM " 
USERS_RATING_TABLE " ur
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = ur.user_id)
    WHERE ur.other_user_id = " 
$user_info['user_id'] . " AND " get_user_table_field("u.""user_level") . " >= '" USER "'    
    ORDER BY ur.rating_date DESC
    
    "
;
    
    
$result $site_db->query($sql);
    
$num_rows $site_db->get_numrows($result);
    
    if (isset(
$num_rows) && $num_rows <= 0) {
        
$msg $lang['member_rating_no_content'];
        
    } elseif (isset(
$num_rows) && $num_rows 0) {
        
$member_rating_content "";        
        
$calc_rating_value "";
        
$bgcounter 0;
        while (
$rate_row $site_db->fetch_array($result)) {
            
$row_bg_number = ($bgcounter++ % == 0) ? 2;

            
$field_id $rate_row['field_id'];
            
$user_id $rate_row['user_id'];
            
$user_name format_text(trim($rate_row[$user_table_fields['user_name']]), 2);
            
$user_url $site_sess->url(ROOT_PATH "member.php?action=showprofile&" URL_USER_ID "=" $user_id);
            
$rating_date format_date($config['date_format'] . ", " $config['time_format'], $rate_row['rating_date']);
            
$rating_value $rate_row['rating_value'];            
            
$calc_rating_value += $rate_row['rating_value']; 
            
            
$site_template->register_vars(array(
            
"field_id" => $field_id,
            
"user_id" => $user_id,
            
"user_name" => $user_name,
            
"user_url" => $user_url,
            
"rating_date" => $rating_date,
            
"rating_value" => $rating_value,
            
"counter" => $row_bg_number            
            
));
            if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
                
$additional_field_array = array();
                foreach (
$additional_user_fields as $key => $val) {
                    
$additional_field_array[$key] = (!empty($rate_row[$key])) ? format_text($rate_row[$key], 1) : REPLACE_EMPTY;
                    
$additional_field_array['lang_'.$key] = $val[0];
                }
                if (!empty(
$additional_field_array)) {
                    
$site_template->register_vars($additional_field_array);
                }
            }
            
$member_rating_content .= $site_template->parse_template("member_rating_content");
        }
        
$calc_total_rates = (isset($calc_rating_value) && !empty($calc_rating_value)) ? ($calc_rating_value $num_rows) : "";
        
$answer_total_rates = (isset($calc_total_rates)) ? number_format($calc_total_ratesMEMBER_RATING_DECIMAL_VALUE) : "";                        
    }
}               

$clickstream "<a href=\"" $site_sess->url(ROOT_PATH "index.php") . "\">" $lang['home'] . "</a>" $config['category_separator'] . $lang['member_rating_title'];

$lang['delete'] = str_replace("["""$lang['delete']);
$lang['delete'] = str_replace("]"""$lang['delete']);

$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"msg" => trim($msg),
"lang_member_rating_title" => $lang['member_rating_title'],
"lang_member_rating_user_name" => $lang['member_rating_user_name'],
"lang_member_rating_date" => $lang['member_rating_date'],
"lang_member_rating_value" => $lang['member_rating_value'],
"lang_member_rating_total_rates" => $lang['member_rating_total_rates_title'],
"lang_member_rating_delete" => $lang['member_rating_delete'],
"lang_delete" => $lang['delete'],
"member_rating_content" => (isset($member_rating_content)) ? trim($member_rating_content) : "",
"rated_value" => (isset($answer_total_rates) && $answer_total_rates && defined('MEMBER_RATING_MARK_VALUE')) ? preg_replace("/" $site_template->start "answer_total_rates" $site_template->end "/siU"$answer_total_rates "/" MEMBER_RATING_MARK_VALUE$lang['member_rating_rated_value']) : ""
));
$site_template->print_template($site_template->parse_template($main_template));

@include_once(
ROOT_PATH 'includes/page_footer.php');    
?>


// Step 8

In templates/your_template/member_profile.html file,

find:

Code: [Select]
<tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>

add after:

Code: [Select]
{if user_loggedin}{if already_rated}
<tr>
          <td class="row1"><b>{lang_member_rating_user_rate}</b></td>
          <td class="row1">{already_rated}</td>
        </tr>
{endif already_rated}
{if rating_content}
<tr>
          <td class="row1"><b>{lang_member_rating_user_rate}</b></td>
          <td class="row1"><form name="jumpbox" action="{url_member}" method="post" /><input type="hidden" name="action" value="rate_user"><input type="hidden" name="user_id" value="{user_id}"><select name="rate_user" onchange="if (this.options[this.selectedIndex].value != 0) { forms['jumpbox'].submit() }" class="select" /><option value="---">---</option>{rating_content}</select></form></td>
        </tr>
{endif rating_content}{endif user_loggedin}

// Step 9

In templates/your_template - create new file: member_rating.html .

Add:
(Note: I use ULM).

Code: [Select]
{header}
{ste_layout_top}
{ste_layout_left}
                 
  {if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
  {if msg}{ifno member_rating_content}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="head1" valign="top">{lang_member_rating_title}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="row2" align="center" /><br /><b>{msg}</b><br /><br /></td>
                    </tr>
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="head2">&nbsp;</td>
                    </tr>
                  </table>
  <br />
  {endifno member_rating_content}{endif msg}
  {if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
 
  {if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
  {ifno msg}{if member_rating_content}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="100%" class="head1" valign="top">{lang_member_rating_title}</td>
                          </tr>
                        </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
                            <td width="100%" class="head1" valign="top">{lang_member_rating_total_rates}</td>
                          </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="100%" class="row2" valign="top" align="center" />{if rated_value}<br />{rated_value}{endif rated_value}</td>
                          </tr>
                        </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="head1">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="25%" class="head1" align="center" valign="top">{lang_member_rating_user_name}</td>
                            <td width="25%" class="head1" align="center" valign="top">{lang_member_rating_date}</td>
                            <td width="25%" class="head1" align="center" valign="top">{lang_member_rating_value}</td>
                            <td width="25%" class="head1" align="center" valign="top">{lang_member_rating_delete}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
    </table>
  <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tablebottom">
  <form action="{url_member_rating}" method="post" />
  <input type="hidden" name="action" value="delete_rate">
    {member_rating_content}  
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="25%" class="row2" valign="top" align="center" />&nbsp;</td>
                      <td width="25%" class="row2" valign="top" align="center" />&nbsp;</td>
                      <td width="25%" class="row2" valign="top" align="center" />&nbsp;</td>
                      <td width="25%" class="row2" valign="top" align="center" /><input type="submit" name="submit" value="{lang_delete}" class="button" /></form></td>
                    </tr>
                  </table>  
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="row2">&nbsp;</td>
                    </tr>
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="head2">&nbsp;</td>
                    </tr>
                  </table>
  <br />
  {endif member_rating_content}{endifno msg}
  {if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
                 
{ste_layout_below}
{footer}

// Step 10

In templates/your_template - create new file: member_rating_content.html .

Add:

Code: [Select]
<tr>
<td width="25%" class="row{counter}" align="center"><a href="{user_url}" class="link" />{user_name}</a></td>
<td width="25%" class="row{counter}" align="center">{rating_date}</td>
<td width="25%" class="row{counter}" align="center">{rating_value}</td>
<td width="25%" class="row{counter}" align="center"><input type="checkbox" name="delete_rate[]" value="{field_id}"></td>
</tr>

// Step 11

In templates/your_template/user_logininfo.html file,

find:

Code: [Select]
&raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />

add after:

Code: [Select]
&raquo; <a href="{url_member_rating}">{lang_member_rating_title}</a><br />

// Step 12

In templates/your_template - create file: member_rating_dropdown.html .

Add:

Code: [Select]
<option value="{i}">{i}</option>

Finish. ;)

19
Mods & Plugins (Releases & Support) / [MOD] - Who viewed my profile (free)
« on: November 24, 2007, 10:29:40 PM »
I code MOD: Who viewed my profile (free). Each user see result in uniq page.

- Additional user fields in uniq page - include.
- Paging in uniq page - include (need: Universal Paging class from V@no).
- Total visit count in uniq page - include.
- Total visit in member profile - include.
- Function check for insert / update - each user - include.
- If want add userpic - possible.
- If want add avatar - possible.
- Test - 4images v1.74 - is test.

// Step 1

In ROOT_PATH , create file: member_viewprofile.php .

Add:

Code: [Select]
<?php

$main_template 
"member_viewprofile";

define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
@include_once(
ROOT_PATH 'includes/page_header.php');

if (
$user_info['user_level'] < USER) {
    
redirect($url);
}

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

if (
$action == "viewprofile") {
    
    
$sql "
    
    SELECT SUM(uvp.view_count) AS total_visits
    FROM " 
USERS_VIEWPROFILE_TABLE " uvp
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = uvp.user_id)
    WHERE uvp.other_user_id = " 
$user_info['user_id'] . " AND " get_user_table_field("u.""user_level") . " >= '" USER "'        
    ORDER BY uvp.view_date DESC
    
    "
;
    
    
$row $site_db->query_firstrow($sql);
    
$total_visits = (isset($row['total_visits'])) ? (int)$row['total_visits'] : 0;
    
    
$sql "
    
    SELECT SUM(uvp.user_id) AS total_rows
    FROM " 
USERS_VIEWPROFILE_TABLE " uvp
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = uvp.user_id)
    WHERE uvp.other_user_id = " 
$user_info['user_id'] . " AND " get_user_table_field("u.""user_level") . " >= '" USER "'        
    ORDER BY uvp.view_date DESC
    
    "
;
    
    
$row $site_db->query_firstrow($sql);
    
$member_viewprofile_num_all = (isset($row['total_rows'])) ? (int)$row['total_rows'] : 0;
    
    if (
defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1) {
        
        @include_once(
ROOT_PATH.'includes/paging.php');
        
$member_viewprofile_perpage = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE 0) ? intval(trim(MEMBER_VIEWPROFILE_SET_PERPAGE)) : 0;
        
$link_arg $site_sess->url(ROOT_PATH."member_viewprofile.php?action=viewprofile&".URL_USER_ID."=".intval(trim($user_info['user_id'])));

        
$text preg_replace("/".$site_template->start."total_member_viewprofile_posts".$site_template->end."/siU""{total_cat_images}"$lang['member_viewprofile_total_paging_result']);

        
$form false;
        
$getpaging = new Paging($page$member_viewprofile_perpage$member_viewprofile_num_all$link_arg$text''''''''$form);
        
$offset = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE 0) ? $getpaging->get_offset() : "";
        
$site_template->register_vars(array(
            
"member_viewprofile_paging" => (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE 0) ? $getpaging->get_paging() : "",
            
"member_viewprofile_paging_stats" => (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE 0) ? $getpaging->get_paging_stats() : ""
        
));

        
$condition = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE 0) ? "LIMIT ".$offset.", ".$member_viewprofile_perpage "";

    } else {
        
$no_paging_activated $lang['member_viewprofile_total_paging_no_result'];
        
$site_template->register_vars("no_paging_activated"trim($no_paging_activated));        
    }
    
    if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
        
$additional_sql "";
        foreach (
$additional_user_fields as $key => $val) {
            
$additional_sql .= ", u." $key;
        }
    }            
    
    
$sql "
    
    SELECT uvp.user_id, uvp.view_date, uvp.view_count" 
get_user_table_field(", u.""user_name") . $additional_sql "
    FROM " 
USERS_VIEWPROFILE_TABLE " uvp
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = uvp.user_id)
    WHERE uvp.other_user_id = " 
$user_info['user_id'] . " AND " get_user_table_field("u.""user_level") . " >= '" USER "'        
    ORDER BY uvp.view_date DESC
    " 
. ((isset($condition) && !empty($condition)) ? $condition "");
    
    
$result $site_db->query($sql);
    
$num_rows $site_db->get_numrows($result);
    
    if (isset(
$num_rows) && $num_rows <= 0) {
        
$msg preg_replace("/" $site_template->start "user_name" $site_template->end "/siU"format_text(trim($user_info['user_name']), 2), $lang['member_viewprofile_no_content']);
        
    } elseif (isset(
$num_rows) && $num_rows 0) {
        
        
$viewprofile_content "";
        while (
$view_row $site_db->fetch_array($result)) {            
            
$user_id $view_row['user_id'];
            
$user_name format_text(trim($view_row[$user_table_fields['user_name']]), 2);                        
            
$view_date format_date($config['date_format'] . ", " $config['time_format'], $view_row['view_date']);
            
$view_count $view_row['view_count'];
            
            
$site_template->register_vars(array(
            
"user_id" => (isset($user_id)) ? $user_id "",
            
"user_name" => (isset($user_name)) ? $user_name "",
            
"user_url" => (isset($user_id)) ? $site_sess->url(ROOT_PATH "member.php?action=showprofile&" URL_USER_ID "=" $user_id) : "",
            
"view_date" => (isset($view_date)) ? $view_date "",            
            
"view_count" => (isset($view_count)) ? $view_count ""
            
));            
            
            if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
                
$additional_field_array = array();
                foreach (
$additional_user_fields as $key => $val) {
                    
$additional_field_array[$key] = (!empty($view_row[$key])) ? format_text($view_row[$key], 1) : REPLACE_EMPTY;
                    
$additional_field_array['lang_'.$key] = $val[0];
                }
                if (!empty(
$additional_field_array)) {
                    
$site_template->register_vars($additional_field_array);
                }
            }
            
$viewprofile_content .= $site_template->parse_template("member_viewprofile_content");
        }        
    }    
}

$clickstream "<a href=\"" $site_sess->url(ROOT_PATH "index.php") . "\">" $lang['home'] . "</a>" $config['category_separator'] . $lang['member_viewprofile_title'];

$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"msg" => trim($msg),
"lang_member_viewprofile_title" => $lang['member_viewprofile_title'],
"lang_member_viewprofile_user_name" => $lang['member_viewprofile_user_name'],
"lang_member_viewprofile_view_date" => $lang['member_viewprofile_view_date'],
"lang_member_viewprofile_view_count" => $lang['member_viewprofile_view_count'],
"lang_member_viewprofile_total_visits" => $lang['member_viewprofile_total_visits_title'],
"lang_member_viewprofile_paging_stats_title" => $lang['member_viewprofile_paging_stats_title'],
"viewprofile_content" => (isset($viewprofile_content)) ? trim($viewprofile_content) : "",
"total_visits" => (isset($total_visits)) ? preg_replace("/" $site_template->start "total_visits" $site_template->end "/siU"$total_visits$lang['member_viewprofile_total_visits']) : ""
));
$site_template->print_template($site_template->parse_template($main_template));

@include_once(
ROOT_PATH 'includes/page_footer.php');    
?>


// Step 2

In member.php file,

find:

Code: [Select]
if ($user_row = get_user_info($user_id)) {

add after:

Code: [Select]
if (function_exists('member_viewprofile_check_user')) {
    member_viewprofile_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level']);
}

find:

Code: [Select]
else {
      $user_email = REPLACE_EMPTY;
      $user_email_save = REPLACE_EMPTY;
      $user_mailform_link = REPLACE_EMPTY;
      $user_email_button = REPLACE_EMPTY;
    }

add after:

Code: [Select]
$sql = "
   
    SELECT COUNT(uvp.view_count) AS total_rows
    FROM " . USERS_VIEWPROFILE_TABLE . " uvp
    LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
    WHERE uvp.other_user_id = " . $user_id;
   
    $row = $site_db->query_firstrow($sql);
    $total_views = (isset($row['total_rows'])) ? (int)$row['total_rows'] : 0;

find:

Code: [Select]
"user_comments" => (isset($user_row['user_comments'])) ? $user_row['user_comments'] : REPLACE_EMPTY,

add after:

Code: [Select]
"lang_member_viewprofile_from_profile" => $lang['member_viewprofile_from_profile'],
"member_viewprofile_from_profile_total_views" => (isset($total_views)) ? (int)$total_views : "",

// Step 3

In includes/constants.php file,

add in top ?>:

Code: [Select]
define('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION', 1); // Active: 1 - Inactive: 0.
define('MEMBER_VIEWPROFILE_SET_PERPAGE', 10); // Rows value per page.

find:

Code: [Select]
define('USERS_TABLE', $table_prefix.'users');

add after:

Code: [Select]
define('USERS_VIEWPROFILE_TABLE', $table_prefix . 'users_viewprofile');

// Step 4

In global.php file,

find:

Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name);

add after:

Code: [Select]
//-----------------------------------------------------
//--- Creates ignore users table ----------------------
//-----------------------------------------------------
if (function_exists('member_viewprofile_check_table')) {
    member_viewprofile_check_table();
}

// Step 5

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['member_viewprofile_title'] = "Who viewed my profile";
$lang['member_viewprofile_no_content'] = "Sorry <b>{user_name}</b>, no users viewed your profile yet.";
$lang['member_viewprofile_user_name'] = "<b>Username</b>";
$lang['member_viewprofile_view_date'] = "<b>Date</b>";
$lang['member_viewprofile_view_count'] = "<b>Count</b>";
$lang['member_viewprofile_total_visits'] = "Total visits on your profile: {total_visits}";
$lang['member_viewprofile_total_visits_title'] = "Total visits";
$lang['member_viewprofile_paging_stats_title'] = "Statistics for this profile";
$lang['member_viewprofile_total_paging_result'] = "Found: {total_member_viewprofile_posts} visits on {total_pages} page(s).";
$lang['member_viewprofile_from_profile'] = "Total users who viewed my profile:";

// Step 6

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('member_viewprofile_check_table')) {
    function member_viewprofile_check_table() {
        global $site_db, $table_prefix;
       
        if (!defined('USERS_VIEWPROFILE_TABLE')) {
            define('USERS_VIEWPROFILE_TABLE', $table_prefix . 'users_viewprofile');
        }
       
        $sql = "
       
        CREATE TABLE IF NOT EXISTS " . USERS_VIEWPROFILE_TABLE . " (
        field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
        user_id int(11) NOT NULL DEFAULT '0',
        other_user_id int(11) NOT NULL DEFAULT '0',
        view_date int(11) NOT NULL DEFAULT '0',       
        view_count int(11) NOT NULL DEFAULT '0',
        PRIMARY KEY(field_id)
        ) TYPE=MyISAM;
       
        ";
           
        $result = $site_db->query($sql);
    }
}

if (!function_exists('member_viewprofile_check_user')) {
    function member_viewprofile_check_user($user_id = 0, $other_user_id = 0, $user_level = GUEST) {
        global $site_db;
       
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
        $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
        $user_level = preg_replace("/[^0-9]+/i", "", $user_level);
       
        if (empty($user_id) || empty($other_user_id) || $user_level == GUEST || $user_level == USER_AWAITING) {           
            return;
        }
       
        if ($user_id == $other_user_id) {           
            return;
        }
       
        $sql = "
       
        SELECT uvp.user_id, uvp.other_user_id
        FROM " . USERS_VIEWPROFILE_TABLE . " uvp
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
        WHERE uvp.user_id = " . $user_id . " AND uvp.other_user_id = " . $other_user_id . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
       
        ";
       
        $get_info = $site_db->query_firstrow($sql);
       
        if (isset($get_info['user_id']) && $user_id == $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id == $get_info['other_user_id']) {
            $site_db->query("UPDATE " . USERS_VIEWPROFILE_TABLE . " SET view_count = view_count + 1, view_date = '" . time() . "' WHERE user_id = " . $user_id . " AND other_user_id = " . $other_user_id);           
                       
            return $user_id;
            return $other_user_id;
            return $user_level;
       
        } elseif (isset($get_info['user_id']) && $user_id != $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id != $get_info['other_user_id']) {
           
            $sql = "
           
            INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
            (field_id, user_id, other_user_id, view_date, view_count)
            VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
           
            ";
           
            $result = $site_db->query($sql);                       
           
            return $user_id;
            return $other_user_id;
            return $user_level;           
       
        } elseif (!$site_db->not_empty($sql)) {
           
            $sql = "
           
            INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
            (field_id, user_id, other_user_id, view_date, view_count)
            VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
           
            ";
           
            $result = $site_db->query($sql);                       
           
            return $user_id;
            return $other_user_id;
            return $user_level;
        }
    }
}

// Step 7

In templates/your_template - create file: member_viewprofile.html .
(Note: I use ULM)

Add:

Code: [Select]
{header}
{ste_layout_top}
{ste_layout_left}
                 
  {if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
  {if msg}{ifno viewprofile_content}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="head1" valign="top">{lang_member_viewprofile_title}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="row2" align="center" /><br /><b>{msg}</b><br /><br /></td>
                    </tr>
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="head2">&nbsp;</td>
                    </tr>
                  </table>
  <br />
  {endifno viewprofile_content}{endif msg}
  {if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
 
  {if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
  {ifno msg}{if viewprofile_content}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="100%" class="head1" valign="top">{lang_member_viewprofile_title}</td>
                          </tr>
                        </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
                            <td width="100%" class="head1" valign="top">{lang_member_viewprofile_total_visits}</td>
                          </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="100%" class="row2" valign="top" align="center" />{if total_visits}<br />{total_visits}{endif total_visits}</td>
                          </tr>
                        </table>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                           <td width="100%" class="head1" valign="top">{lang_member_viewprofile_paging_stats_title}</td>
                         </tr>
                       </table>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2" align="center" /><br />{member_viewprofile_paging_stats}<br /></td>
                         </tr>
                       </table>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                   <tr>
                          <td class="head2">&nbsp;</td>
                         </tr>
                        </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2">&nbsp;</td>
                         </tr>
                       </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                          <td width="100%" class="row2" align="right" />{member_viewprofile_paging}</td>
                         </tr>
                       </table>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_user_name}</td>
                            <td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_view_date}</td>
                            <td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_view_count}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
    </table>
  <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tablebottom">
    {viewprofile_content}
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="row2">&nbsp;</td>
                    </tr>
                  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
                      <td class="head2">&nbsp;</td>
                    </tr>
                  </table>
  <br />
  {endif viewprofile_content}{endifno msg}
  {if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
                 
{ste_layout_below}
{footer}

// Step 8

In templates/your_template - create file: member_viewprofile_content.html .
(Note: I use ULM)

Add:

Code: [Select]
<tr>
<td width="33%" class="row2" align="center"><a href="{user_url}" class="link" />{user_name}</a></td>
<td width="33%" class="row2" align="center">{view_date}</td>
<td width="33%" class="row2" align="center">{view_count}</td>
</tr>

// Step 9

In templates/your_template/member_profile.html file,

find:

Code: [Select]
<tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>

add after:

Code: [Select]
{if member_viewprofile_from_profile_total_views}
<tr>
          <td class="row1"><b>{lang_member_viewprofile_from_profile}</b></td>
          <td class="row1">{member_viewprofile_from_profile_total_views}</td>
        </tr>
{endif member_viewprofile_from_profile_total_views}

// Step 10

In includes/page_header.php file,

find:

Code: [Select]
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),

add after:

Code: [Select]
"url_member_viewprofile" => $site_sess->url(ROOT_PATH . "member_viewprofile.php"),

find:

Code: [Select]
"lang_images_per_page" => $lang['images_per_page'],

add after:

Code: [Select]
"lang_member_viewprofile_title" => $lang['member_viewprofile_title'],

// Step 11

In templates/your_template/user_logininfo.html file,

find:

Code: [Select]
&raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />

add after:

Code: [Select]
&raquo; <a href="{url_member_viewprofile}">{lang_member_viewprofile_title}</a><br />

Finish.

20
This is MOD for welcome PM after user register (show 1 time for new user).

// Step 1

In register.php file,

find:

Code: [Select]
$sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
            VALUES
            ($user_id, $user_level, '$user_name', '".md5($user_password)."', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";

replace:

Code: [Select]
$sql = "INSERT INTO ".USERS_TABLE."
            (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq"). ", welcome_pm_status" . $additional_field_sql.")
            VALUES
            ($user_id, $user_level, '$user_name', '".md5($user_password)."', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', '1'".$additional_value_sql.")";

// Step 2

In includes/sessions.php file,

find:

Code: [Select]
$this->set_cookie_data("userid", $this->user_info['user_id']);

add after:

Code: [Select]
$sql = "
   
    SELECT welcome_pm_status
    FROM " . USERS_TABLE . "
    WHERE " . get_user_table_field("", "user_id") . " = " . $this->user_info['user_id'] . " AND welcome_pm_status = 1";
   
    if ($site_db->not_empty($sql)) {
        if (function_exists('welcome_pm_random_key') && $key = welcome_pm_random_key()) {
            redirect("pm_welcome.php?key=" . $key);
            unset ($key);
        }
    }

// Step 3

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['welcome_pm_mod_title'] = "Welcome message";
$lang['welcome_pm_mod_text'] = "Welcome to <b>{site_name}</b> gallery <b>{user_name}</b>";

// Step 4

In ROOT_PATH, create file: pm_welcome.php .

Add:

Code: [Select]
<?php

$main_template 
"pm_welcome";

define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
@include_once(
ROOT_PATH 'includes/page_header.php');

if (
$user_info['user_level'] < USER) {
    
redirect($url);
}
    
if (!isset(
$HTTP_GET_VARS['key'])) {
    
redirect($url);
}
$site_db->query("UPDATE " USERS_TABLE " SET welcome_pm_status = 0 WHERE " get_user_table_field("""user_id") . " = " $user_info['user_id']);            

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$clickstream "<a href=\"" $site_sess->url(ROOT_PATH "index.php") . "\">" $lang['home'] . "</a>" $config['category_separator'] . $lang['welcome_pm_mod_title'];

$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"lang_welcome_pm_mod_title" => $lang['welcome_pm_mod_title'],
"lang_welcome_pm_mod_text" => preg_replace("/" $site_template->start "user_name" $site_template->end "/siU"format_text(trim($user_info['user_name']), 2), $lang['welcome_pm_mod_text'])
));
$site_template->print_template($site_template->parse_template($main_template));
unset (
$HTTP_GET_VARS['key']);

@include_once(
ROOT_PATH 'includes/page_footer.php');    
?>


// Step 5

In templates/your_template - create file: pm_welcome.html .
(Note: I use ULM) .

Add:

Code: [Select]
{header}
{ste_layout_top}
{ste_layout_left}

<span class="title">{site_name}</span>
<br /><br />

{if lang_welcome_pm_title}
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="head1">{lang_welcome_pm_mod_title}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="row2">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="row2" align="center" />{lang_welcome_pm_mod_text}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="row2">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="head1">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
{endif lang_welcome_pm_title}

{ste_layout_below}
{footer}

// Step 6

In admin/users.php file,

find:

Code: [Select]
      $sql = "INSERT INTO ".USERS_TABLE."
              (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq").$additional_field_sql.")
              VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq'".$additional_value_sql.")";

replace:

Code: [Select]
      $sql = "INSERT INTO ".USERS_TABLE."
              (".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_showemail").get_user_table_field(", ", "user_allowemails").get_user_table_field(", ", "user_invisible").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_lastaction").get_user_table_field(", ", "user_lastvisit").get_user_table_field(", ", "user_comments").get_user_table_field(", ", "user_homepage").get_user_table_field(", ", "user_icq"). ", welcome_pm_status" . $additional_field_sql.")
              VALUES
              ($user_id, $user_level, '$user_name', '$user_password', '$user_email', $user_showemail, $user_allowemails, $user_invisible, $current_time, '$activationkey', $current_time, $current_time, 0, '$user_homepage', '$user_icq', '1'".$additional_value_sql.")";

/ Step 7

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('welcome_pm_random_key')) {
    function welcome_pm_random_key() {
       
        mt_srand((double) microtime() * 1000000);
        $puddle = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
        $random_key = "";
        for ($i = 0; $i < 8; $i++) {
            $random_key .= substr($puddle, (mt_rand()%(strlen($puddle))), 1);
        }
        return $random_key;                   
    }
}

// Step 8

Use in ACP - > SQL Patches (expert mode) -

Code: [Select]
ALTER TABLE `4images_users` ADD welcome_pm_status int(1) NOT NULL DEFAULT '0';

Finish.

21
Hi, in trez site - is ask money. I create this one free. ;)

- Function is check for ignore user (member profile e.g) in IGNORE_USERS_TABLE . If find, you use function and say action you like. ;)
- Create auto SQL table for name (no need for use phpmyadmin or SQL patches MOD for this) - I code.

// Step 1

In member.php file,

find:

Code: [Select]
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------

add before:

Code: [Select]
if ($action == "exec_ignore_users_profile") {
    if (isset($HTTP_POST_VARS[URL_USER_ID])) {
        $user_id = (isset($HTTP_POST_VARS[URL_USER_ID])) ? intval(trim($HTTP_POST_VARS[URL_USER_ID])) : GUEST;
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
    } else {
        $user_id = GUEST;
    }
   
    if (isset($HTTP_POST_VARS['user_status'])) {
        $user_status = (isset($HTTP_POST_VARS['user_status'])) ? intval(trim($HTTP_POST_VARS['user_status'])) : 0;
        $user_status = preg_replace("/[^0-9]+/i", "", $user_status);
    } else {
        $user_status = 0;
    }
   
    if (!isset($user_id) || $user_id == GUEST || !isset($user_status) || empty($user_status)) {
        redirect($url);
   
    } elseif (function_exists('exec_ignore_user_account')) {
         exec_ignore_user_account($user_info[$user_table_fields['user_id']], $user_id, $user_info[$user_table_fields['user_level']], $user_status);
         redirect ("member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id);
    }
}

Find:

Code: [Select]
if ($user_row = get_user_info($user_id)) {

add after:

Code: [Select]
if (function_exists('select_ignore_user_account') && select_ignore_user_account($user_info[$user_table_fields['user_id']], $user_row[$user_table_fields['user_id']], 1)) {
... action ...         
}

Note: Change ... action ... for action you like for refuse user. ;)

Find:

Code: [Select]
"user_comments" => (isset($user_row['user_comments'])) ? $user_row['user_comments'] : REPLACE_EMPTY,

add after:

Code: [Select]
"select_ignore_user_account_1" => (function_exists('select_ignore_user_account_dropdown') && select_ignore_user_account_dropdown($user_info[$user_table_fields['user_id']], $user_row[$user_table_fields['user_id']], 1)) ? true : false,     
      "select_ignore_user_account_2" => (function_exists('select_ignore_user_account_dropdown') && select_ignore_user_account_dropdown($user_info[$user_table_fields['user_id']], $user_row[$user_table_fields['user_id']], 2)) ? true : false,     
      "select_ignore_user_no_same_user_or_user_to_admin" =>  (($user_info[$user_table_fields['user_id']] == ($user_row[$user_table_fields['user_id']]) || $user_info[$user_table_fields['user_level']] == USER && $user_row[$user_table_fields['user_level']] == ADMIN)) ? false : true,
      "lang_ignore_user_account_title" => $lang['ignore_user_account_title'],
      "lang_ignore_user_account_no_option" => $lang['ignore_user_account_no_option'],
      "lang_ignore_user_account_yes_option" => $lang['ignore_user_account_yes_option'],
      "lang_ignore_user_account_submit" => $lang['ignore_user_account_submit'],
      "has_ignore_users_profile" => true,

// Step 2

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('create_ignore_user_account_table')) {
    function create_ignore_user_account_table() {
        global $site_db, $table_prefix;
       
        if (!defined('IGNORE_USERS_TABLE')) {
            define('IGNORE_USERS_TABLE', $table_prefix . 'users_ignore');
        }
       
        $sql = "
       
        CREATE TABLE IF NOT EXISTS " . IGNORE_USERS_TABLE . " (
        field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
        user_id int(11) NOT NULL DEFAULT '0',
        other_user_id int(11) NOT NULL DEFAULT '0',
        ignore_date varchar(32) NOT NULL DEFAULT '0000-00-00',
        user_status int(1) NOT NULL DEFAULT '1',       
        PRIMARY KEY(field_id)
        ) TYPE=MyISAM;
       
        ";
           
        $result = $site_db->query($sql);       
    }
}

if (!function_exists('exec_ignore_user_account')) {
    function exec_ignore_user_account($user_id = 0, $other_user_id = 0, $user_level = GUEST, $user_status = 0) {       
       
        if (!isset($user_id) || empty($user_id) || !isset($other_user_id) || empty($other_user_id) || !isset($user_level) || empty($user_level) || !isset($user_status) || empty($user_status) || $user_level < USER) {
            return;
        }
       
        if ($user_level >= USER) {           
            global $site_db, $table_prefix, $config;
           
            $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
            $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
            $user_status = preg_replace("/[^0-9]+/i", "", $user_status);
           
            if (!defined('IGNORE_USERS_TABLE')) {
                define('IGNORE_USERS_TABLE', $table_prefix . 'users_ignore');
            }
           
            $date = date($config['date_format']);
           
            $sql = "
           
            SELECT user_id
            FROM " . IGNORE_USERS_TABLE . "
            WHERE user_id = " . $user_id . " AND other_user_id = " . $other_user_id;
           
            if (!$site_db->not_empty($sql)) {
               
                $sql = "
               
                INSERT INTO " . IGNORE_USERS_TABLE . "
                (field_id, user_id, other_user_id, ignore_date, user_status)
                VALUES (NULL, '" . $user_id . "', '" . $other_user_id . "', '" . $date . "', '" . $user_status . "')
               
                ";
               
                $result = $site_db->query($sql);
           
            } else {
               
                $sql = "
               
                UPDATE " . IGNORE_USERS_TABLE . "
                SET user_status = " . $user_status . ", ignore_date = '" . $date . "'
                WHERE user_id = " . $user_id . " AND other_user_id = " . $other_user_id;
               
                $result = $site_db->query($sql);               
            }
           
            if (isset($result) && $result) {
                return $user_id;
                return $other_user_id;
                return $user_level;
           
            } else {
                return;
            }
        }       
    }
}

if (!function_exists('select_ignore_user_account')) {
    function select_ignore_user_account($user_id = 0, $other_user_id = 0, $switch = 0) {
        global $site_db, $table_prefix, $lang;
       
        if (!isset($user_id) || !isset($other_user_id)) {
            return;
        }
       
        if (!defined('IGNORE_USERS_TABLE')) {
            define('IGNORE_USERS_TABLE', $table_prefix . 'users_ignore');
        }
       
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
        $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
       
        $sql = "
       
        SELECT ig.user_status
        FROM " . IGNORE_USERS_TABLE . " ig       
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = ig.user_id)
        WHERE ig.user_id = " . $other_user_id . " AND ig.other_user_id = " . $user_id;
       
        $get_info = $site_db->query_firstrow($sql);
       
        switch ($switch) {           
            case 2 :
           
            if ($get_info['user_status'] == 2) {
                return $get_info['user_status'];
            }
            break;
           
            case 1 :
           
            if ($get_info['user_status'] == 1) {
                return $get_info['user_status'];
            }
            break;
        }
    }
}

if (!function_exists('select_ignore_user_account_dropdown')) {
    function select_ignore_user_account_dropdown($user_id = 0, $other_user_id = 0, $switch = 0) {
        global $site_db, $table_prefix, $lang;
       
        if (!isset($user_id) || !isset($other_user_id)) {
            return;
        }
       
        if (!defined('IGNORE_USERS_TABLE')) {
            define('IGNORE_USERS_TABLE', $table_prefix . 'users_ignore');
        }
       
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);
        $other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
       
        $sql = "
       
        SELECT ig.user_status
        FROM " . IGNORE_USERS_TABLE . " ig       
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = ig.user_id)
        WHERE ig.user_id = " . $user_id . " AND ig.other_user_id = " . $other_user_id;
       
        $get_info = $site_db->query_firstrow($sql);
       
        switch ($switch) {           
            case 2 :
           
            if ($get_info['user_status'] == 2) {
                return $get_info['user_status'];
            }
            break;
           
            case 1 :
           
            if ($get_info['user_status'] == 1) {
                return $get_info['user_status'];
            }
            break;
        }
    }
}

// Step 3

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['ignore_user_account_title'] = "<b>Ignore user:</b>";
$lang['ignore_user_account_no_option'] = "No";
$lang['ignore_user_account_yes_option'] = "Yes";
$lang['ignore_user_account_submit'] = "Submit";

// Step 4

In includes/page_header.php file,

find:

Code: [Select]
"has_rss" => false,

add after:

Code: [Select]
"has_ignore_users_profile" => false,

// Step 5

In templates/your_template/member_profile.html file,

add:

Code: [Select]
{if user_loggedin}{if select_ignore_user_no_same_user_or_user_to_admin}
        {if select_ignore_user_account_1}
<tr>
          <td class="row1">{lang_ignore_user_account_title}</td>
          <td class="row1"><br /><form action="{url_member}" method="post" /><input type="hidden" name="action" value="exec_ignore_users_profile"><input type="hidden" name="user_id" value="{user_id}"><select name="user_status" class="select" /><option value="{select_ignore_user_account_1}" selected>{lang_ignore_user_account_yes_option}</option><option value="2">{lang_ignore_user_account_no_option}</option></select>&nbsp;&nbsp;<input type="submit" name="submit" value="{lang_ignore_user_account_submit}" class="button"></form></td>
        </tr>
        {endif select_ignore_user_account_1}
{if select_ignore_user_account_2}
        <tr>
          <td class="row1">{lang_ignore_user_account_title}</td>
          <td class="row1"><br /><form action="{url_member}" method="post" /><input type="hidden" name="action" value="exec_ignore_users_profile"><input type="hidden" name="user_id" value="{user_id}"><select name="user_status" class="select" /><option value="{select_ignore_user_account_1}" selected>{lang_ignore_user_account_no_option}</option><option value="{select_ignore_user_account_2}">{lang_ignore_user_account_yes_option}</option></select>&nbsp;&nbsp;<input type="submit" name="submit" value="{lang_ignore_user_account_submit}" class="button"></form></td>
        </tr>
        {endif select_ignore_user_account_2}
{ifno select_ignore_user_account_1}{ifno select_ignore_user_account_2}
        <tr>
          <td class="row1">{lang_ignore_user_account_title}</td>
          <td class="row1"><br /><form action="{url_member}" method="post" /><input type="hidden" name="action" value="exec_ignore_users_profile"><input type="hidden" name="user_id" value="{user_id}"><select name="user_status" class="select" /><option value="1">{lang_ignore_user_account_no_option}</option><option value="2">{lang_ignore_user_account_yes_option}</option></select>&nbsp;&nbsp;<input type="submit" name="submit" value="{lang_ignore_user_account_submit}" class="button"></form></td>
        </tr>
        {endifno select_ignore_user_account_2}{endifno select_ignore_user_account_1}
{endif select_ignore_user_no_same_user_or_user_to_admin}{endif user_loggedin}

(place you want)

// Step 6

In global.php file,

find:

Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name);

add after:

Code: [Select]
//-----------------------------------------------------
//--- Creates ignore users table ----------------------
//-----------------------------------------------------
if (function_exists('create_ignore_user_account_table')) {
    create_ignore_user_account_table();
}

Finish ...

22
I no post here all time but I look for memberlist HTML template ... is possible for post suggest for new template you like ? :|
I no good with template create and I need suggest for show in gallery (graphic). If create one for you in custom template, is possible for post URL ?

23
I search in forum for calendar. User request for see detail image with calendar date. I code with Ajax - I like. :)
Note: I no help for ajax code.

- New image for each date: Check !
- All lang: Check !
- Group with image date for each date: Check !
- Template for detail calendar: Check !
- Use thumbnail_bit: Check !
- Screenshot: Check !
- If date change in ACP - > Images - > Edit Images + use query for calendar - page is no redirect (No change date :!:)
- Test - Y-m-d date format.
- Test - 4images v1.74 (Firefox) - Check !
- Test - 4images v1.74 (IE 7) - Is work (redirect loop)
- Template for core calendar: No check ! (PHP skill need for edit table and DIV template in ajax_calendar.php) .
- Use paging: No check ! (I add later)

// Step 1

In root folder, create file: ajax_calendar.php .

Add:

Code: [Select]
<?php

define
('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
$user_access get_permission();

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

if (
$action == "show_calendar") {

if (isset(
$HTTP_GET_VARS['month'])) {
    
$month = (isset($HTTP_GET_VARS['month'])) ? intval(trim($HTTP_GET_VARS['month'])) : intval(trim($HTTP_POST_VARS['month']));
} else {
    
$month "";
}
if (isset(
$HTTP_GET_VARS['year'])) {
    
$year = (isset($HTTP_GET_VARS['year'])) ? intval(trim($HTTP_GET_VARS['year'])) : intval(trim($HTTP_POST_VARS['year']));
} else {
    
$year "";
}

if (
$month == '' && $year == '') { 
$time time();
$month date('n',$time);
    
$year date('Y',$time);
}

$date getdate(mktime(000$month1$year));
$today getdate();
$hours $today['hours'];
$mins $today['minutes'];
$secs $today['seconds'];

if (
strlen($hours) < 2$hours "0" $hours;
if (
strlen($mins) < 2$mins "0" $mins;
if (
strlen($secs) < 2$secs "0" $secs;

$days date("t"mktime(000$month1$year));
$start $date['wday'] + 1;
$name $date['month'];
$year2 $date['year'];
$offset $days $start 1;
 
if (
$month == 12) { 
$next 1
$nexty $year 1
} else { 
$next $month 1
$nexty $year
}

if (
$month == 1) { 
$prev 12
$prevy $year 1
} else { 
$prev $month 1
$prevy $year
}

if (
$offset <= 28$weeks 28
elseif (
$offset 35$weeks 42
else 
$weeks 35;

$output '';

$output .= "
<table class='cal' cellspacing='1'>
<tr>
<td colspan='7'>
<table class='calhead'>
<tr>
<td>
<a href='javascript:navigate(
$prev,$prevy)'><img src=\"" get_gallery_image("calLeft.gif") . "\"></a> <a href='javascript:navigate(\"\",\"\")'><img src=\"" get_gallery_image("calCenter.gif") . "\"></a> <a href='javascript:navigate($next,$nexty)'><img src=\"" get_gallery_image("calRight.gif") . "\"></a>
</td>
<td align='right'>
<div>" 
$name $year2 "</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class='dayhead'>
<td>" 
$lang['ajax_calendar_sun'] . "</td>
<td>" 
$lang['ajax_calendar_mon'] . "</td>
<td>" 
$lang['ajax_calendar_tue'] . "</td>
<td>" 
$lang['ajax_calendar_wed'] . "</td>
<td>" 
$lang['ajax_calendar_thu'] . "</td>
<td>" 
$lang['ajax_calendar_fri'] . "</td>
<td>" 
$lang['ajax_calendar_sat'] . "</td>
</tr>"
;

$col 1;
$cur 1;
$next 0;

$sql "

SELECT i.image_id, i.image_date
FROM (" 
IMAGES_TABLE " i, " CATEGORIES_TABLE " c)
LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = c.cat_id  AND (i.cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))

"
;

$result $site_db->query($sql);

$image_row = array();
while (
$row $site_db->fetch_array($result)) {
    
$image_row[] = $row;
}

$new_cutoff time() - 60 60 24 $config['new_cutoff'];

$sql "

SELECT image_date
FROM " 
IMAGES_TABLE "
WHERE image_active = 1 AND image_date >= " 
$new_cutoff;

$result $site_db->query($sql);

$new_image_row = array();
while (
$row $site_db->fetch_array($result)) {
    
$new_image_row[] = $row;
}
$site_db->free_result();

$num_image_row sizeof($image_row);
$num_new_image_row sizeof($new_image_row);

$date_flag false;
$new_image_flag false;
for (
$i 1$i <= $weeks$i++) {
if ($next == 3$next 0;
if ($col == 1$output .= "<tr class='dayrow'>";
    
    
$output .= "<td valign='top' onMouseOver=\"this.className='dayover'\" onMouseOut=\"this.className='dayout'\">";     

if ($i <= ($days+($start-1)) && $i >= $start) {
        
        for (
$k 0$k $num_new_image_row$k++) {
            
$new_image_date format_date($config['date_format'], $new_image_row[$k]['image_date']);
            if (
preg_match("/(.+)\-(.+)\-(.+)/"$new_image_date$new_date_content)) {
                
$new_month_date_content $new_date_content[2];
                
$new_day_date_content $new_date_content[3];
                
                if (
$cur == $new_day_date_content && $month == $new_month_date_content) {
                    
$new_image_flag true;
                }                    
            }
        }
        
        
$output .= "<div class='calendar_day'>";

if (($cur == $today[mday]) && ($name == $today[month])) $output .= " <b style='color:#C00'>";
        
$date_flag false;
        
        for (
$j 0$j $num_image_row$j++) {
            
$image_id $image_row[$j]['image_id'];
            
$image_date format_date($config['date_format'], $image_row[$j]['image_date']);
            
            if (
preg_match("/(.+)\-(.+)\-(.+)/"$image_date$date_content)) {                
                
$image_month_date $date_content[2];
                
$image_day_date $date_content[3];
            }
            if (
$cur == $image_day_date && $month == $image_month_date) {
                
$output .= "<a href=\"" $site_sess->url(ROOT_PATH "details_calendar.php?action=show_details_calendar&image_date=" $image_date) . "";
                
$date_flag true;            
            }
        }
        
        if (isset(
$date_flag) && $date_flag == true) {
            
$output .= "\">" $cur "</b></a>" . ((isset($new_image_flag) && $new_image_flag == true) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<sup class=\"new\">" $lang['new'] : "") . "</sup></div></td>";
        
        } else {
            
$output .= $cur "</b></div></td>";        
        }

$cur++; 
$col++; 

} else { 
$output .= "&nbsp;</td>"
$col++; 
}  
    
    if (
$col == 8) { 
    $output .= "</tr>"
    $col 1
    }
}

$output .= "</table>";
  
echo 
$output;
unset (
$output);
}

?>


// Step 2

In root folder, create file: details_calendar.php .

Add:

Code: [Select]
<?php

$main_template 
"details_calendar";

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH 'includes/page_header.php');

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

$cache_id create_cache_id(
  
'page.index',
  array(
    
$user_info[$user_table_fields['user_id']],
    isset(
$user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 08) : 0,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

if (!
$cache_page_index || !$content get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_index) {
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'get';
}

ob_start();

if (
$action == "show_details_calendar") {
    
    if (isset(
$HTTP_GET_VARS['image_date'])) {
        
$image_date = (isset($HTTP_GET_VARS['image_date'])) ? un_htmlspecialchars(trim(intval($HTTP_GET_VARS['image_date']))) : 0;
        
$image_date preg_replace("/[^0-9-]+/i"""$image_date);
    } else {
        
$image_date "";
    }
    
//-----------------------------------------------------
//--- Details Calendar --------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"has_rss"   => true,
  
"rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':'''$lang['details_calendar']).")",
  
"rss_url"   => $script_url."/rss.php?action=images"
));

$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
    foreach (
$additional_user_fields as $key => $val) {
        
$additional_sql .= ", u." $key;
    }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND (i.cat_id NOT IN ("
.get_auth_cat_sql("auth_viewcat""NOTIN")."))
        ORDER BY i.image_date DESC
        
        "
;
        
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$details_calendar "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$details_calendar .= $lang['no_details_calendar'];
  
$details_calendar .= "</td></tr></table>";
}
else  {
  
$details_calendar "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {      
      if (
format_date($config['date_format'], $image_row['image_date']) == $image_date) {
          if (
$count == 0) {
              
$row_bg_number = ($bgcounter++ % == 0) ? 2;
              
$details_calendar .= "<tr class=\"imagerow".$row_bg_number."\">\n";
          }
          
$details_calendar .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
          
show_image($image_row);
          
$details_calendar .= $site_template->parse_template("thumbnail_bit");
          
$details_calendar .= "\n</td>\n";
          
$count++;
          if (
$count == $config['image_cells']) {
              
$details_calendar .= "</tr>\n";
              
$count 0;
          }
      }
  } 
// end while
  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover >= 1) {
      for (
$f 0$f $leftover$f++) {
        
$details_calendar .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$details_calendar .= "</tr>\n";
    }
  }
  
$details_calendar .= "</table>\n";  
// end else

$site_template->register_vars("details_calendar"$details_calendar);
unset(
$details_calendar);
    
}

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$clickstream "<a href=\"" $site_sess->url(ROOT_PATH "index.php") . "\">" $lang['home'] . "</a>" $config['category_separator'] . $lang['details_calendar'];
$site_template->register_vars("clickstream"$clickstream);
$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

if (
$cache_page_index) {
  
// Reset session mode
  
$site_sess->mode $old_session_mode;

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

include(
ROOT_PATH 'includes/page_footer.php');
?>


// Step 3

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['ajax_calendar_sun'] = "Sun";
$lang['ajax_calendar_mon'] = "Mon";
$lang['ajax_calendar_tue'] = "Tue";
$lang['ajax_calendar_wed'] = "Wed";
$lang['ajax_calendar_thu'] = "Thu";
$lang['ajax_calendar_fri'] = "Fri";
$lang['ajax_calendar_sat'] = "Sat";
$lang['no_details_calendar'] = "No images found.";
$lang['show_details_calendar'] = "Details calendar";
$lang['details_calendar'] = "Details calendar";

// Step 4

In includes/page_header.php file,

find:

Code: [Select]
"lang_images_per_page" => $lang['images_per_page'],

add after:

Code: [Select]
"lang_show_details_calendar" => $lang['show_details_calendar'],

// Step 5

In templates/your_template - create file: ajax_calendar.js .

Add:

Code: [Select]
var req;

function navigate(month,year) {

        var url = "ajax_calendar.php?action=show_calendar&month="+month+"&year="+year;

        if(window.XMLHttpRequest) {

                req = new XMLHttpRequest();

        } else if(window.ActiveXObject) {

                req = new ActiveXObject("Microsoft.XMLHTTP");

        }

        req.open("GET", url, true);

        req.onreadystatechange = callback;

        req.send(null);

}

function callback() {        

        obj = document.getElementById("calendar");

        setFade(0);

        

if(req.readyState == 4) {

                if(req.status == 200) {

                        response = req.responseText;

                        obj.innerHTML = response;

                        fade(0);

                } else {

                        alert("There was a problem retrieving the data:\n" + req.statusText);

                }

        }

}

function fade(amt) {

if(amt <= 100) {

setFade(amt);

amt += 10;

setTimeout("fade("+amt+")", 5);

    }

}

function setFade(amt) {

obj = document.getElementById("calendar");



amt = (amt == 100)?99.999:amt;

  

// IE

obj.style.filter = "alpha(opacity:"+amt+")";

  

// Safari<1.2, Konqueror

obj.style.KHTMLOpacity = amt/100;

  

// Mozilla and Firefox

obj.style.MozOpacity = amt/100;

  

// Safari 1.2, newer Firefox and Mozilla, CSS3

obj.style.opacity = amt/100;

}

// Step 6

In templates/your_template - create file: details_calendar.html .

Add:

Code: [Select]
{header}
{ste_layout_top}
{ste_layout_left}                  
 <br />
                  {if msg}<b>{msg}</b><br /><br />{endif msg}
 <br />
 
                  {if msg}<b>{msg}</b><br /><br />{endif msg}
 
 {if is_admin}<! -- Details calendar -- >{endif is_admin}  
 <table width="450" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_last_viewed_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
   <tr>
                      <td class="head1">{details_calendar}</td>
                    </tr>
                  </table>          
 <br />
 {if is_admin}<! -- End of Details calendar -- >{endif is_admin}
                  
{ste_layout_below}
{footer}

(Note: This template use Universal layout MOD).

// Step 7

In templates/your_template/header.html (or templates/your_template/layout/header.html if use ULM) -

find:

Code: [Select]
{if has_rss}
<link rel="alternate" type="application/rss+xml" title="{rss_title}" href="{rss_url}" />
{endif has_rss}

add after:

Code: [Select]
<script type='text/javascript' src="{template_url}/ajax_calendar.js"></script>

find:

Code: [Select]
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">

replace:

Code: [Select]
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475" onLoad='navigate("", "")'>

// Step 8

In templates/your_template folder - all file include: {header} and {footer} (or if use ULM: templates/your_template/layout/ste_layout_left.html file) -

use:

Code: [Select]
<table width="150" border="0" cellspacing="0" cellpadding="0" id="calback">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_show_details_calendar}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row2" id="calendar">&nbsp;</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  <br />

// Step 9

In templates/your_template/style.css file -

add:

Code: [Select]
calendar_td {
font-family: "Trebuchet MS", Arial, Veranda, sans-serif;
padding: 3px;
}

#calback {
background: #FFF url('calWaiting.gif') no-repeat 50% 100px;
margin: 0 auto;
width: 350px;
}

#calendar {
width: 100%;
height: 100%;
}

.cal {
background: #000;
width: 100%;
}

.calhead {
width: 100%;
font-weight: bold;
color: #FFF;
font-size: 20px;      
}

.calhead img {
border: none;
}

.dayhead {
height: 25px;
background: #EEE;
}

.dayhead td {
text-align: center;
color: #000;
}

.dayrow {
background: #FFF;
height: 40px;
}

.dayrow td {
width: 50px;
color: #000;
font-size: .7em;
}

.day {
float: right;
}

.dayover {
background: #EEE;
}

.dayout {
background: #FFF;
}

// Step 10

I post attach file for upload image (gif) in templates/your_template/images folder.

Demo here:

http://www.bmgadg.com/ajax_calendar.php

Finish :!:

24
Is my 1st Ajax code. Is for suggest username to user for register new name in gallery.

1 - Is check for exist username.
2 - Is check for filter username.
3 - Is check for exist index name (all lang is use. ;)).

1 - If username exist - message is show (red) - say is no possible for use (exist in DB).
2 - If name find in filter (you add) - is no possible for use (reset form).
3 - If enter suggest name in lang array, is show to user for name of use (check with exist name in DB. ;)).

This MOD is work with page header - is no problem. Is use only for register form (test in: 4images v1.74).

// Step 1

In register.php file,

find:

Code: [Select]
if ($user_info['user_level'] != GUEST && $action != "activate") {
  show_error_page($lang['already_registered']);
}
$content = "";

add after:

Code: [Select]
if ($action == "register_suggest") {
    
    if (isset($HTTP_GET_VARS['q']) || isset($HTTP_POST_VARS['q'])) {
        $q = (isset($HTTP_GET_VARS['q'])) ? un_htmlspecialchars(trim((string)$HTTP_GET_VARS['q'])) : un_htmlspecialchars(trim((string)$HTTP_POST_VARS['q']));
        $q = preg_replace("/[^a-z0-9_-]+/i", "", $q);
    } else {
        $q = "";
    }
    
    if (isset($q) && !empty($q)) {
    
    $q = (isset($q)) ? strip_tags(trim($q)) : "";
    
    $sql = "
    
    SELECT " . get_user_table_field("", "user_name") . "
    FROM " . USERS_TABLE . "
    WHERE " . get_user_table_field("", "user_name") . " LIKE '" . $q . "'
    
    ";
    
    $same_user = $site_db->query_firstrow($sql);
    $user_name = format_text(trim($same_user[$user_table_fields['user_name']]), 2);
    
    if (strlen($q) > 0) {
        $q = strtolower(trim($q));
        
        $hint = "";        
        for ($i = 0; $i < count($index_name); $i++) {
            if ($q == strtolower(substr($index_name[$i], 0, strlen($q)))) {
                if ($hint == "") {
                    $hint = $index_name[$i];
                    
                } else {
                    $hint = $hint." , ".$index_name[$i];                    
                }
            }
        }
    }
    
    if (isset($additional_index_name_filter_check) && is_array($additional_index_name_filter_check) && !empty($additional_index_name_filter_check)) {
        $index_flag_for_no = false;
        $index_flag_for_yes = false;
        foreach ($additional_index_name_filter_check as $key => $val) {
            if (!preg_match("/$val/i", $q)) {
                $index_flag_for_no .= true;
            } elseif (preg_match("/$val/i", $q)) {
                $index_flag_for_yes .= true;
            }
        }
    }                

    if ($hint == "" && !preg_match("/$user_name/i", $q) && isset($index_flag_for_no) && $index_flag_for_no == true) {
        $response = $lang['register_suggest_available'];        
        
    } elseif (isset($index_flag_for_yes) && $index_flag_for_yes == true) {
        $response = $lang['register_suggest_cannot_key_names'];        
    
    } elseif (preg_match("/[a-z0-9_-]/i", $user_name) && $user_name == $q) {
        mt_srand((double) microtime() * 1000000);
        $puddle = '0123456789';
        $user_password = "";
        $check_user_name = "";        
        for ($i = 0; $i < 5; $i++) {            
            $user_name = preg_replace("/[0-9]+/i", "", $user_name);
            $user_password .= substr($puddle, (mt_rand()%(strlen($puddle))), 1);            
        }              
        $check_user_name .= $user_name. $user_password . "<br />";
        $response = preg_replace("/" . $site_template->start . "check_user_name" . $site_template->end . "/siU", format_text(trim($check_user_name), 1), $lang['register_suggest_already_exists']);
        
    } elseif ($hint != "" && $q != $user_name) {
        $response = $hint;
    }
    
    echo $response;
    exit;
    }
}

Find:

Code: [Select]
if (isset($HTTP_POST_VARS['user_name'])) {

add after:

Code: [Select]
if (isset($additional_index_name_filter_check) && is_array($additional_index_name_filter_check) && !empty($additional_index_name_filter_check)) {        
          foreach ($additional_index_name_filter_check as $key => $val) {
              if (preg_match("/$val/i", $user_name)) {
                  unset ($user_name);
                  $msg .= (($msg != "") ? "<br />" : "").$field_error = $lang['register_suggest_cannot_key_names'];
                  $error = 1;
                  break;
              }
          }
      }

Find:

Code: [Select]
"lang_captcha_desc" => $lang['captcha_desc'],

add after:

Code: [Select]
"lang_register_suggest_text" => $lang['register_suggest_text'],      
"register_suggest" => true,      

// Step 2

In includes/db_field_definitions.php file,

add in top ?>:

Code: [Select]
$additional_index_name_filter_check = array("sex", "test", "webm", "adm", "await", "user", "guest", "password", "email");

This is filter for bad word if type username in register form.

// Step 3

In includes/page_header.php file,

find:

Code: [Select]
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),

add after:

Code: [Select]
"register_suggest" => false,

// Step 4

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['register_suggest_available'] = "<font color=\"green\">Available !</font>";
$lang['register_suggest_cannot_key_names'] = "<font color=\"red\">You cannot use this username.</font>";
$lang['register_suggest_already_exists'] = "<font color=\"red\">This user already exists in the database.</font><br /><br />Try with:<br /><b>{check_user_name}</b>";
$lang['register_suggest_text'] = "Suggestions: ";
$index_name = array("Anna", "Brittany", "Cinderella", "Diana", "Eva", "Fiona", "Gunda", "Hege", "Inga", "Johanna", "Kitty", "Linda", "Nina", "Ophelia", "Petunia", "Amanda", "Raquel", "Cindy", "Doris", "Eve", "Evita", "Sunniva", "Tove", "Unni", "Violet", "Liza", "Elisabeth", "Ellen", "Wenche", "Vicky");

// Step 5

In templates/your_template/register_form.html file,

find:

Code: [Select]
<input type="text" name="user_name" size="30" value="{user_name}" class="input" />

replace:

Code: [Select]
<input type="text" name="user_name" size="30" value="{user_name}" id="txt1" onkeyup="showHint(this.value)" class="input" />
              <br />
              {lang_register_suggest_text}<span id="txtHint"></span>

// Step 6

In templates/your_template, create file: clienthint.js .

Add:

Code: [Select]
var xmlHttp

function showHint(str)
{
if (str.length==0)
  {
  document.getElementById("txtHint").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
var url="register.php"
url=url+"?action=register_suggest&q="+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("txtHint").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 7

In templates/your_template/header.html file (templates/your_template/layout/header.html for user use universal layout TWEAK) -

find:

Code: [Select]
{if has_rss}
<link rel="alternate" type="application/rss+xml" title="{rss_title}" href="{rss_url}" />
{endif has_rss}

add after:

Code: [Select]
{if register_suggest}
<script src="{template_url}/clienthint.js"></script>
{endif register_suggest}

I think is all ... I no support AJAX JS file - I no edit other of URL .
If work, please say ... ;)

25
This show link in editprofile user for all upload image of her / him.

// Step 1

In member.php file,

find:

Quote
if ($action == "editprofile") {
  $txt_clickstream = $lang['control_panel'];

add before:

Code: [Select]
//-----------------------------------------------------
//--- Show uploaded images from edit profile ----------
//-----------------------------------------------------
if ($action == "show_uploaded_images") {
       
$sql1 = "

SELECT i.image_id, i.image_name, i.image_thumb_file, i.image_media_file, i.cat_id" . get_user_table_field(", u.", "user_name") . "
FROM (" . IMAGES_TABLE . " i, " . CATEGORIES_TABLE . " c)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = c.cat_id AND " . get_user_table_field("u.", "user_id") . " = i.user_id AND i.user_id = " . $user_info['user_id'] . " AND (i.cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
ORDER BY i.image_date DESC

";

$result = $site_db->query($sql1);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $uploaded_images_from_edit_profile = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $uploaded_images_from_edit_profile .= $lang['no_new_images'];
  $uploaded_images_from_edit_profile .= "</td></tr></table>";
}
else  {
  $uploaded_images_from_edit_profile = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($uploaded_images_from_edit_profile_row = $site_db->fetch_array($result)) {
      $user_name = format_text(trim(ucfirst($uploaded_images_from_edit_profile_row[$user_table_fields['user_name']]), 2));
     
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $uploaded_images_from_edit_profile .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $uploaded_images_from_edit_profile .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($uploaded_images_from_edit_profile_row);
    $uploaded_images_from_edit_profile .= $site_template->parse_template("thumbnail_bit");
    $uploaded_images_from_edit_profile .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $uploaded_images_from_edit_profile .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $uploaded_images_from_edit_profile .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $uploaded_images_from_edit_profile .= "</tr>\n";
    }
  }
  $uploaded_images_from_edit_profile .= "</table>\n";
} // end else


$site_template->register_vars("lang_uploaded_images_from_edit_profile", $lang['uploaded_images_from_edit_profile']);
$site_template->register_vars("uploaded_images_from_edit_profile", $uploaded_images_from_edit_profile);
$site_template->register_vars("lang_uploaded_images_go_back", $lang['uploaded_images_go_back']);
$content = $site_template->parse_template("member_editprofile");
$txt_clickstream = $lang['show_uploaded_images'];

unset($uploaded_images_from_edit_profile);
}

// Step 1.1

(same file) - find:

Quote
"lang_edit_profile_msg" => $edit_profile_msg,

add after:

Code: [Select]
"lang_show_uploaded_images" => $lang['show_uploaded_images'],

// Step 2

In lang/english/main.php file,

Add top of ?>:

Code: [Select]
$lang['show_uploaded_images'] = "Show uploaded images";
$lang['uploaded_images_from_edit_profile'] = "Uploaded images from you";
$lang['uploaded_images_go_back'] = "<span class=\"smalltext\">[ Go back ]</span>";

// Step 3

In templates/your_template/member_editprofile.html file ... well - I post in attach of post so integrate for way you want (and use IF and ENDIF tags I use in template file).

Finish.

26
This is MOD for see in details page - all relate upload image of each uploader (relate image of upload).

// Step 1

In details.php file,

find:

Code: [Select]
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name = format_text($image_row['image_name'], 2);
show_image($image_row, $mode, 0, 1);

add after:

Code: [Select]
//-----------------------------------------------------
//--- Show All Related Images By Uploader -------------
//-----------------------------------------------------
$sql1 = "

SELECT i.image_id, i.image_name, i.image_thumb_file, i.image_media_file, i.cat_id" . get_user_table_field(", u.", "user_name") . "
FROM (" . IMAGES_TABLE . " i, " . CATEGORIES_TABLE . " c)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = c.cat_id AND i.image_id != " . $image_id . " AND (i.cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))

";

$result = $site_db->query($sql1);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $uploader_related_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $uploader_related_images .= $lang['no_new_images'];
  $uploader_related_images .= "</td></tr></table>";
}
else  {
  $uploader_related_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($uploader_related_images_row = $site_db->fetch_array($result)) {
      $user_name = format_text(trim(ucfirst($uploader_related_images_row[$user_table_fields['user_name']]), 2));
     
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $uploader_related_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $uploader_related_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($uploader_related_images_row);
    $uploader_related_images .= $site_template->parse_template("thumbnail_bit");
    $uploader_related_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $uploader_related_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $uploader_related_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $uploader_related_images .= "</tr>\n";
    }
  }
  $uploader_related_images .= "</table>\n";
} // end else

$site_template->register_vars("lang_uploader_related_images", preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", $user_name, $lang['uploader_related_images']));
$site_template->register_vars("uploader_related_images", $uploader_related_images);
unset($uploader_related_images);

// Step 2

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['uploader_related_images'] = "See other images uploaded by {user_name}";

// Step 3

In templates/your_template/details.html file,

find:

Code: [Select]
{admin_links}<br />
                    {endif admin_links}<br />
                    {lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}
</div>
                  <br />

add after:

Code: [Select]
{if uploader_related_images}
  <table width="450" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_uploader_related_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{uploader_related_images}</td>
                    </tr>                       
                  </table>
  <br />
  {endif uploader_related_images}

Finish.

27
Ok, in english - is how -

// Step 1

In details.php file,

find:

Quote
$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

add after:

Code: [Select]
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
   foreach ($additional_user_fields as $key => $val) {
      $additional_sql .= ", u." . $key;
   }
}

// Step 2

In includes/functions.php file,

find:

Quote
$additional_image_fields,

add after (same line) :

Code: [Select]
$additional_user_fields,

find:

Quote
if (!empty($additional_image_fields)) {
    $additional_field_array = array();
    foreach ($additional_image_fields as $key => $val) {
      $additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
      $additional_field_array['lang_'.$key] = $val[0];
    }
    if (!empty($additional_field_array)) {
      $site_template->register_vars($additional_field_array);
    }
  }

add after:

Code: [Select]
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
      $additional_field_array = array();
      foreach ($additional_user_fields as $key => $val) {
        $additional_field_array[$key] = (isset($image_row[$key]) && !empty($image_row[$key])) ? format_text(trim($image_row[$key]), 1) : REPLACE_EMPTY;
        $additional_field_array['lang_'.$key] = $val[0];
      }
      if (isset($additional_field_array) && is_array($additional_field_array) && !empty($additional_field_array)) {
        $site_template->register_vars($additional_field_array);
      }
}

Now - you set additional user fields for details page (lang tag include).

28
Feedback & Suggestions / [FIX] - global.php file - PHP v5.2+
« on: November 04, 2007, 01:42:05 AM »
This fix for slashes check (is work for PHP 4.x too).

Find:

Quote
function addslashes_array($array) {
  foreach ($array as $key => $val) {
    $array[$key] = (is_array($val)) ? addslashes_array($val) : addslashes($val);
  }
  return $array;
}

replace:

Code: [Select]
function addslashes_array($array) {
  foreach ($array as $key => $val) {
    $array[$key] = (is_array($val)) ? array_map('addslashes_array', $val) : addslashes($val);
  }
  return $array;
}

29
Feedback & Suggestions / [FIX] - details.php file (for comments post)
« on: November 03, 2007, 09:16:01 PM »
This check for valid post comment chars after submit.

In details.php file,

find:

Quote
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
    $msg = $lang['comments_deactivated'];  
  }  
  else {
    $user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

replace:

Code: [Select]
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
    $msg = $lang['comments_deactivated'];
  
  } elseif (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['comment_headline']) || !check_post_comment_valid_chars($HTTP_POST_VARS['comment_text'])) {
      redirect("details.php?image_id=" . $id);  
  }  
  else {
    $user_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_text']));

In member.php file,

find:

Quote
if ($action == "uploadimage") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }

add after:

Code: [Select]
if (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['image_name']) || !check_post_comment_valid_chars($HTTP_POST_VARS['image_description'])) {
      redirect("categories.php?cat_id=" . $cat_id);
  }

In includes/functions.php file,

add before ?> :

Code: [Select]
if (!function_exists('check_post_comment_valid_chars')) {
   function check_post_comment_valid_chars($text) {
      return preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $text);
   }
}

If fail, is redirect to details page (with same image ID and for member - with same category id).

30
Chit Chat / Re: MODS sticked
« on: November 02, 2007, 01:05:12 PM »
Quote
like all others..

If so, why I see no sticky for this ?

http://www.4homepages.de/forum/index.php?topic=18522.0
http://www.4homepages.de/forum/index.php?topic=18185.0
http://www.4homepages.de/forum/index.php?topic=18744.0
http://www.4homepages.de/forum/index.php?topic=18677.0
http://www.4homepages.de/forum/index.php?topic=18745.0
http://www.4homepages.de/forum/index.php?topic=18573.0
http://www.4homepages.de/forum/index.php?topic=18747.0
http://www.4homepages.de/forum/index.php?topic=18928.0
http://www.4homepages.de/forum/index.php?topic=18572.0
http://www.4homepages.de/forum/index.php?topic=19254.0
http://www.4homepages.de/forum/index.php?topic=19564.0
http://www.4homepages.de/forum/index.php?topic=19490.0
http://www.4homepages.de/forum/index.php?topic=19462.0
http://www.4homepages.de/forum/index.php?topic=19327.0
http://www.4homepages.de/forum/index.php?topic=19568.0
http://www.4homepages.de/forum/index.php?topic=19586.0
http://www.4homepages.de/forum/index.php?topic=19353.0
http://www.4homepages.de/forum/index.php?topic=19856.0
http://www.4homepages.de/forum/index.php?topic=20168.0
http://www.4homepages.de/forum/index.php?topic=20160.0
http://www.4homepages.de/forum/index.php?topic=20234.0
http://www.4homepages.de/forum/index.php?topic=20245.0
http://www.4homepages.de/forum/index.php?topic=20248.0
http://www.4homepages.de/forum/index.php?topic=20544.0
http://www.4homepages.de/forum/index.php?topic=20548.0
http://www.4homepages.de/forum/index.php?topic=20657.0
http://www.4homepages.de/forum/index.php?topic=18193.0
http://www.4homepages.de/forum/index.php?topic=20692.0
is all I post free man. :?

Pages: 1 [2] 3 4 5 6 7