[BETA] 4images Integration Mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
Locked
helium
Registered User
Posts: 11
Joined: Sat Jan 04, 2003 3:09 pm
Contact:

[BETA] 4images Integration Mod

Post by helium »

This mod integrates the users from phpbb so that they can be used across the 4images (http://www.4homepages.de/) gallery system. (don't worry about .de its in english). You dont actualy have to modify any phpbb files only files within the 4images system.

This is just a quick mod i put together, it probably has a few bugs butt here is what the mod can and cant do.

Can
[*] Uses the phpbb user system and sessions.
[*] Users can post comments on images.
[*] Upload Images
[*] Create/Delete/Use Lightboxes

Can't
[*] Does Not merge the users all users that are registered on the gallery will be lost (well not lost but not accessed in any way. I would sujest sending a mass email from the 4images admin pannel to inform users to re-register) or someone may make a tool to convert the users. (not me).
[*] Probably wont work with some mods for 4images particularly the SEO mods and anything that touches sessions.php. Most addon mods and mods that spruce stuff up (eg. ajax rating etc) should work. Will provide small amount of support, may make an SEO mod that is compatible too.
[*] Information about the user that uploaded an image will not work unless it was an admin acount that did it, will default to uploaded by guest.

demo: http://liveanime.org/gallery/ / http://liveanime.org/forums/

Download the zip


Installation Instructions

First extract the zip folder somewhere and copy the session.php and constants.php files from there to "/4images_directory/includes/" and replace the session.php and constants.php files in there.

Find in "includes/functions.php":

Code: Select all

    $user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $image_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$image_row['user_id'];
 
Replace with

Code: Select all

 $user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $image_row['user_id'], $url_show_profile) : FORUM_ROOT_PATH."memberlist.php?mode=viewprofile&u=".$image_row['user_id'];
 
Find:

Code: Select all

  if (SHOW_RANDOM_CAT_IMAGE) {
    $sql = "SELECT DISTINCT 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, 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 i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY RAND()";
 
Replace With:

Code: Select all

  if (SHOW_RANDOM_CAT_IMAGE) {
    $sql = "SELECT DISTINCT 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, c.cat_name, u.username_clean AS user_name
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY RAND()";
 
Find:

Code: Select all

    $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, 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 i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
 
Replace With:

Code: Select all

    $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, c.cat_name, u.username_clean AS user_name
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
 
Find in "includes/page_header.php"

Code: Select all

"url_register" => (!empty($url_register)) ? $site_sess->url($url_register) : $site_sess->url(ROOT_PATH."register.php"),
 
Replace With

Code: Select all

  "url_register" => (!empty($url_register)) ? $site_sess->url($url_register) : $site_sess->url(FORUM_ROOT_PATH."ucp.php?mode=register"),
 
Find

Code: Select all

"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(ROOT_PATH."member.php?action=editprofile"),
 
Replace With

Code: Select all

"url_control_panel" => (!empty($url_control_panel)) ? $site_sess->url($url_control_panel) : $site_sess->url(FORUM_ROOT_PATH."ucp.php"),
 
Find

Code: Select all

"url_logout" => (!empty($url_logout)) ? $site_sess->url($url_logout) : $site_sess->url(ROOT_PATH."logout.php"),
 
Replace

Code: Select all

 "url_logout" => (!empty($url_logout)) ? $site_sess->url($url_logout) : $site_sess->url(FORUM_ROOT_PATH."ucp.php?mode=logout&sid=".$user->data['session_id']),
 
OPEN "templates/your_template_dir/user_loginform.html" and replace it all with

Code: Select all

<form action="<?php echo FORUM_ROOT_PATH; ?>ucp.php" method="post">
<input type="hidden" name="mode" value="login" />
User Name:<input type="text"  name="username" />
Password:<input type="password" name="password" />
Hidden:<input type="checkbox" class="radio" name="viewonline" />
<input type="hidden" name="autologin" value="1" />
<input type="submit" value="Submit" name="login" />
</form>
Find in top.php

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_rating DESC, i.image_name ASC
        LIMIT 10";
 
Replace With

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name, u.username_clean AS user_name
        FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_rating DESC, i.image_name ASC
        LIMIT 10";
 
Find:

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_votes DESC, i.image_name ASC
        LIMIT 10";
 
Replace With

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name, u.username_clean AS user_name
        FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_votes DESC, i.image_name ASC
        LIMIT 10";
 
Find:

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 10";
 
Replace With

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, c.cat_name, u.username_clean AS user_name
        FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 10";
 
Find:

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_downloads, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_downloads DESC, i.image_name ASC
        LIMIT 10";

 
Replace With

Code: Select all

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_downloads, c.cat_name, u.username_clean AS user_name
        FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_downloads DESC, i.image_name ASC
        LIMIT 10";
 
Find in "search.php"

Code: Select all

  $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
          $sql_where_query
          AND c.cat_id = i.cat_id $cat_id_sql
          ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
          LIMIT $offset, $perpage";
 
Replace With

Code: Select all

  $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, u.username_clean AS user_name
          FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.image_active = 1
          $sql_where_query
          AND c.cat_id = i.cat_id $cat_id_sql
          ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
          LIMIT $offset, $perpage";
 

Find in "categories.php"

Code: Select all

$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 i.cat_id = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
        LIMIT $offset, $perpage";
 
Replace With:

Code: Select all

$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, u.username_clean AS user_name
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
        LIMIT $offset, $perpage";
 
Find in lightbox.php

Code: Select all

  $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 i.image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
          ORDER BY i.".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
          LIMIT $offset, $perpage";
 
Replace with:

Code: Select all

  $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, u.username_clean AS user_name
          FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.image_active = 1 AND i.image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
          ORDER BY i.".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
          LIMIT $offset, $perpage";
 
Find in "includes/constants.php" and Replace the "phpbb_" with whatever your phpbb3 table prefix is. AND change the "../forums/" to wherever your forums are RELATIVLY from your gallery folder.

Code: Select all

$table_prefix = "phpbb_";
define('FORUM_ROOT_PATH', '../forums/');
 

Find in "includes/db_mysql.php"

Code: Select all

} // end of class
?>
ADD BEFORE

Code: Select all

  /////////////////////////////////////////////////////////
  ///                                                    ///
  ///            phpbb3 Integration Mod                    ///
  ///            Created by helium                        ///
  ///            http://www.liveanime.org                ///
  ///                                                    ///
  /////////////////////////////////////////////////////////
  
  
  
  
   function _sql_validate_value($var)
    {
        if (is_null($var))
        {
            return 'NULL';
        }
        else if (is_string($var))
        {
            return "'" . $this->sql_escape($var) . "'";
        }
        else
        {
            return (is_bool($var)) ? intval($var) : $var;
        }
    }
  
  
  function sql_build_array($query, $assoc_ary = false)
    {
        if (!is_array($assoc_ary))
        {
            return false;
        }

        $fields = $values = array();

        if ($query == 'INSERT' || $query == 'INSERT_SELECT')
        {
            foreach ($assoc_ary as $key => $var)
            {
                $fields[] = $key;

                if (is_array($var) && is_string($var[0]))
                {
                    // This is used for INSERT_SELECT(s)
                    $values[] = $var[0];
                }
                else
                {
                    $values[] = $this->_sql_validate_value($var);
                }
            }

            $query = ($query == 'INSERT') ? ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')' : ' (' . implode(', ', $fields) . ') SELECT ' . implode(', ', $values) . ' ';
        }
        else if ($query == 'MULTI_INSERT')
        {
            $ary = array();
            foreach ($assoc_ary as $id => $sql_ary)
            {
                // If by accident the sql array is only one-dimensional we build a normal insert statement
                if (!is_array($sql_ary))
                {
                    return $this->sql_build_array('INSERT', $assoc_ary);
                }

                $values = array();
                foreach ($sql_ary as $key => $var)
                {
                    $values[] = $this->_sql_validate_value($var);
                }
                $ary[] = '(' . implode(', ', $values) . ')';
            }

            $query = ' (' . implode(', ', array_keys($assoc_ary[0])) . ') VALUES ' . implode(', ', $ary);
        }
        else if ($query == 'UPDATE' || $query == 'SELECT')
        {
            $values = array();
            foreach ($assoc_ary as $key => $var)
            {
                $values[] = "$key = " . $this->_sql_validate_value($var);
            }
            $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values);
        }

        return $query;
    }
  
  
  function sql_escape($msg)
    {
        if (!$this->db_connect_id)
        {
            return @mysql_real_escape_string($msg);
        }

        return @mysql_real_escape_string($msg, $this->db_connect_id);
    }
 
In "details.php" Find:

Code: Select all

$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").get_user_table_field(", u.", "user_email")."
        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_id = $image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
 
Replace With:

Code: Select all

$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, u.username_clean AS user_name ".get_user_table_field(", u.", "user_email")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_id = $image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
 
Find

Code: Select all

    $user_name_field = get_user_table_field("", "user_name");
    if (!empty($user_name_field)) {
      if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
        $error = 1;
      }
    }
 
Replace With

Code: Select all

    $user_name_field = 'username_clean';
    if (!empty($user_name_field)) {
      if ($site_db->not_empty("SELECT $user_name_field FROM ".pUSERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
        $error = 1;
      }
    }
 
Find:

Code: Select all

  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
 
Replace With:

Code: Select all

  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date, u.group_id AS user_level, u.username_clean AS user_name, u.user_email AS user_email, u.user_allow_viewemail AS user_showemail, u.user_allow_viewonline AS user_invisible, u.user_regdate AS user_joindate, u.user_lastvisit AS user_lastaction, u.user_posts AS user_comments, u.user_website AS user_homepage, u.user_icq
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".pUSERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
 
Find:

Code: Select all

        $comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
 
Replace:

Code: Select all

$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(FORUM_ROOT_PATH."memberlist.php?mode=viewprofile&u=".$comment_user_id);
 
Find:

Code: Select all

if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
          $comment_user_email = format_text($comment_row[$i][$user_table_fields['user_email']]);
          $comment_user_email_save = format_text(str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]));
          if (!empty($url_mailform)) {
            $comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
          }
          else {
            $comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&".URL_USER_ID."=".$comment_user_id);
          }
          $comment_user_email_button = "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
        }
 
and delete it.

Run this sql Statement
NOTE: change the "4images_" to whatever your table prefic for 4images is.
NOTE2: change the "user_id = 2" part to the userid of whatever user you want to have credit for uploading the images. Id 2 is the default admin user id for phpbb3.

Code: Select all

UPDATE `4images_images` SET `user_id` = '2';
matteo260
Registered User
Posts: 4
Joined: Thu Mar 06, 2008 7:21 pm

Re: [BETA] 4images Integration Mod

Post by matteo260 »

Hi,

the integration works fine, with a few problems for me.

I lock in via my forum board. When I go to the 4images gallery, I appear locked in with my name.

But if I try to lock in via the "control-Panel" indication I can`t lock in as an administrator. I only can look over the gallery like a guest can do.

If I try to open the ../admin/index.php a message appears in German that I`m not an administrator and that I have not locked in.

Any suggestions.

What about the "user levels" definitions in the constants.php? As there isn`t any part named "user_level" in the phpbb3_users any more, it doesn`t make sense.
When I change the guest level to my administration level (9) in the constants.php I am able to lock in as an Admin. But in this case everybody can lock in as Admin.

Regrets

Matthias Schäfer
helium
Registered User
Posts: 11
Joined: Sat Jan 04, 2003 3:09 pm
Contact:

Re: [BETA] 4images Integration Mod

Post by helium »

Have you replaced the constants.php with the one that is in the zip file? the admin level should be set to 6. If you have changed the group_id for admins in phpbb then you would have to change this to whatever you set it too.

Also are you logging in to the forum and using that user to do it??
matteo260
Registered User
Posts: 4
Joined: Thu Mar 06, 2008 7:21 pm

Re: [BETA] 4images Integration Mod

Post by matteo260 »

Hi helium,

thank you for the answer. Yes I took the constants from the zip File (level was set to 5 in there). I then tried out every level up to 9.

But your hint with the group-ID was correct. I checked it in the database and it is a 3-digit code :geek: :?: .
What can I tell you, once changed (I have to change the level of all the others too) its working as advertized.

Thanks again

Matthias
User avatar
flyalaska
Registered User
Posts: 63
Joined: Fri Apr 11, 2008 2:51 pm

Re: [BETA] 4images Integration Mod

Post by flyalaska »

Hello,
I did every as stated. I'm stuck on the last part. I am not that experienced in MYSQL, but I usually can figure things out. What does this mean

Code: Select all

UPDATE `4images_images` SET `user_id` = '2';
How do I run the sql statement?


Eddie
YourMamma
Registered User
Posts: 2
Joined: Tue Oct 24, 2006 11:49 am

Re: [BETA] 4images Integration Mod

Post by YourMamma »

I am having problems with this, tried to install twice with no success. Are you using 4images 1.7.6? If so can you paste your changed files as a contrib folder please?

I see on your gallery you get errors too, this is what showed up on mine and is on yours -

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.
YoyoS
Registered User
Posts: 4
Joined: Thu Sep 06, 2007 3:55 am

Re: [BETA] 4images Integration Mod

Post by YoyoS »

Hello, How can I let members post images with their phpbb account ?
ahmed_badawy
Registered User
Posts: 2
Joined: Sun Jun 28, 2009 9:30 am

Re: [BETA] 4images Integration Mod

Post by ahmed_badawy »

Code: Select all

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 1488

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 1488

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 1488

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 2565

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 2565

Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\4images\includes\db_mysql.php:192) in D:\AppServ\www\4images\includes\sessions.php on line 2565

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Fatal error: Call to a member function acl_get() on a non-object in D:\AppServ\www\4images\includes\sessions.php on line 2926
how i can fix this error

It is very important

thanx
ahmed_badawy
Registered User
Posts: 2
Joined: Sun Jun 28, 2009 9:30 am

Re: [BETA] 4images Integration Mod

Post by ahmed_badawy »

Please help, it is very important
Locked

Return to “[3.0.x] MODs in Development”