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
46
This show [edit] and [delete] in new images table of index page for details image (same in details for admin).

In index.php file,

find:

Quote
while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

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

replace:

Code: [Select]
while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";     
    }
   
    $is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 1 : 0;
    if ($user_info['user_level'] == ADMIN) {
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&image_id=".$image_row['image_id']))."\" target=\"_blank\">".$lang['delete']."</a>";       
    } elseif ($is_image_owner) {
        $admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\">".$lang['delete']."</a>";
        unset ($is_image_owner);
    }  
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">" . ((isset($admin_links)) ? $admin_links  : "") . "\n";

    show_image($image_row);   

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

47
Feedback & Suggestions / [FIX] - index.php - new images
« on: October 03, 2007, 02:47:16 AM »
This is fix HTML design for new images.

Find:

Quote
for ($f = 0; $f < $leftover; $f++) {         

add before:

Code: [Select]
$new_images .= "<tr>\n";

48
This is for use top, left, right (if have for right) and below layout for HTML template tags. So, no more need for re-copy in all HTML files from {header} to {footer} for same HTML table code. Is now in one single file with load all same design with 4 tags command in HTML template. ;)

// Step 1

In includes/template.php file,

find:

Quote
if ($name == 'header' || $name == 'footer') {

replace:

Code: [Select]
if ($name == 'header' || $name == 'ste_layout_top' || $name == 'ste_layout_left' || $name == 'ste_layout_right' || $name == 'ste_layout_below' || $name == 'footer') {

Find:

Quote
if (strpos($template, $this->start.'header'.$this->end) !== false) {
      $header = $this->parse_template("header");
      $template = str_replace($this->start.'header'.$this->end, $header, $template);
}

if (strpos($template, $this->start.'footer'.$this->end) !== false) {
      $footer = $this->parse_template("footer");
      $template = str_replace($this->start.'footer'.$this->end, $footer, $template);
}

replace:

Code: [Select]
if (strpos($template, $this->start.'header'.$this->end) !== false) {
      $header = $this->parse_template("layout/header");
      $template = str_replace($this->start.'header'.$this->end, $header, $template);
    }
   
    if (strpos($template, $this->start.'ste_layout_top'.$this->end) !== false) {
      $header = $this->parse_template("layout/ste_layout_top");
      $template = str_replace($this->start.'ste_layout_top'.$this->end, $header, $template);
    }
   
    if (strpos($template, $this->start.'ste_layout_left'.$this->end) !== false) {
      $header = $this->parse_template("layout/ste_layout_left");
      $template = str_replace($this->start.'ste_layout_left'.$this->end, $header, $template);
    }
   
    if (strpos($template, $this->start.'ste_layout_right'.$this->end) !== false) {
      $header = $this->parse_template("layout/ste_layout_right");
      $template = str_replace($this->start.'ste_layout_right'.$this->end, $header, $template);
    }

    if (strpos($template, $this->start.'ste_layout_below'.$this->end) !== false) {
      $footer = $this->parse_template("layout/ste_layout_below");
      $template = str_replace($this->start.'ste_layout_below'.$this->end, $footer, $template);
    }
   
    if (strpos($template, $this->start.'footer'.$this->end) !== false) {
      $footer = $this->parse_template("layout/footer");
      $template = str_replace($this->start.'footer'.$this->end, $footer, $template);
    }

// Step 2

Ok now is very important. Before test in live gallery. Install fresh 4images copy (with fresh DB name for safety). My instruction is from default template of 4images. After, you can test on live custom template.

In templates/default folder, create folder: layout. Inside, create: ste_layout_top.html - ste_layout_top.html - ste_layout_right.html - ste_layout_below.html file.

// Step 3

Ok so one example I do. You get the rest - is very easy. ;)

In templates/default/home.html file,

find:

Quote
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td colspan="4"><img src="{template_url}/images/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="640" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="638" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="636" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
                  <a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
                  <a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
                 </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>

Cut paragraph (keep in new notepad for copy) and in HTML replace:

Code: [Select]
{ste_layout_top}

(for top side)

(Note: ste = Site in word).

Find:

Quote
<table width="638" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</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="row1">{user_box}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
              {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</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="row1">
                   <br />
                        {random_image}
                  <br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
              {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>

Same thing for notepad and in HTML replace:

Code: [Select]
{ste_layout_left}

(for left side)

Ok, for the right side, is option so if have right side (I no have) so cut paragraph and paste in new notepad and on HTML file - replace:

Code: [Select]
{ste_layout_right}

(for right side)

Ok - last one - find:

Quote
<p>&nbsp;</p>
                </td>
                <td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6"><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Same thing for new notepad and replace in HTML:

Code: [Select]
{ste_layout_below}

(for below side)

// Step 4

Ok, good step.

In templates/default/layout/ste_layout_top.html file,

paste:

Code: [Select]
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td colspan="4"><img src="{template_url}/images/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="640" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="638" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="636" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
  </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>

In templates/default/layout/ste_layout_left.html file,

paste:

Code: [Select]
<table width="638" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</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="row1">{user_box}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
  {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</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="row1">
    <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
  {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>

In templates/default/layout/ste_layout_right.html file (if have), paste your right content in that file.

In templates/default/layout/ste_layout_below.html file,

paste:

Code: [Select]
<p>&nbsp;</p>
                </td>
                <td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6"><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>

// Stats - filesize home.html file.

Ok so if I filesize home.html file,

original: 7.364 bytes
my copy is now: 3.056 bytes for same thing (and faster load foreach HTML template files). ;).

All done  :!:  8)
Do same for all HTML files - have {header} to {footer}. Is all same. ;)

// Move header.html and footer.html file to layout folder too.

@Kai:

For next version of 4images ?

49
Feedback & Suggestions / [TWEAK] - Lightbox setting
« on: September 27, 2007, 12:33:32 AM »
Here is tweak for setting lightbox (no more template edit for HTML designer):

http://www.4homepages.de/forum/index.php?topic=18835.msg101341#msg101341

50
Feedback & Suggestions / [FIX] - Euro character
« on: September 23, 2007, 05:47:17 PM »
For Euro populate, 4images no see Euro sign for people create / use cart MODs.

In includes/functions.php file,

find:

Quote
$text = str_replace("\\'", "'", $text);

add after:

Code: [Select]
$text = str_replace("€", "&euro;", $text);

51
Templates & Styles (Requests & Discussions) / [REQ] - Add to cart button
« on: September 22, 2007, 07:48:31 PM »
Hi Mawenzi,

is possible create a button name: Add to cart (on and off) ?  8)

52
Feedback & Suggestions / [FIX] - includes/sessions.php
« on: September 17, 2007, 02:54:58 PM »
Apply this NOW !!

Find:

Quote
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
    global $site_db, $user_table_fields;

    if (empty($user_name) || empty($user_password)) {       
      return false;
    }
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
    $row = $site_db->query_firstrow($sql);

    $user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;   
    $user_password = md5($user_password);
    if ($user_id != GUEST) {                       
      if ($row[$user_table_fields['user_password']] == $user_password) {
        $sql = "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = $user_id
                WHERE session_id = '".addslashes($this->session_id)."'";
        $site_db->query($sql);
        if ($set_auto_login) {
          $this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
        }
        $this->start_session($user_id, 1);
        return true;
      }
    }
    return false;
  }

replace:

Code: [Select]
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
    global $site_db, $user_table_fields;

    if (empty($user_name) || empty($user_password)) {       
      return false;
    }   
    if (!empty($user_name)) {
        $user_name = preg_replace("/[^a-z0-9_-]+/i", "", $user_name);
        $user_name = format_text(trim($user_name), 2);
    }
    if (!empty($user_password)) {
        $user_password = preg_replace("/[^A-Za-z0-9_-]+/i", "", $user_password);
        $user_password = format_text(trim($user_password), 2);
    }
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
    $row = $site_db->query_firstrow($sql);

    $user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;   
    $user_password = md5($user_password);
    if ($user_id != GUEST) {
      if ($row[$user_table_fields['user_password']] == $user_password) {
        $sql = "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = $user_id
                WHERE session_id = '".addslashes($this->session_id)."'";
        $site_db->query($sql);
        if ($set_auto_login) {
          $this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
        }
        $this->start_session($user_id, 1);
        return true;
      }
    }
    return false;
  }

53
Feedback & Suggestions / [FIX] - member.php editcomment
« on: September 17, 2007, 02:40:37 AM »
Find:

Quote
header("Location: ".$site_sess->url($url, "&"));

replace:

Code: [Select]
redirect($url);

54
Detail: This MOD like http://www.4homepages.de/forum/index.php?topic=15095.0 but better. No system command use (linux) and cron work on user visit (guest include) for 4images. 50% Jan module for DB utils and 50% use for new ZIP module improve. You can choose (1 day minumum) for how day wait for backup process and send email message for say is backup on server in BACKUP_DIR folder. All admin receive email (allow email use or no work for them) for time you set.

Require:

- GZip, ZIP or BZip enable from host or no work.
- ZIP improve: http://www.4homepages.de/forum/index.php?topic=18745.0
- HTML Email: http://www.4homepages.de/forum/index.php?topic=18744.0

// Step 1

In includes/functions.php file,

add top ?>:

Code: [Select]
function backup_site_operation() {
    global $user_info, $site_db, $lang, $config, $site_template, $url, $db_name, $default_backup_tables;
   
  if (!isset($config['backup_site_next_time'])) {
      $site_db->query("INSERT INTO " . SETTINGS_TABLE . " (setting_name, setting_value) VALUES ('backup_site_next_time', '" . time() . "')");
  }
   
  $check_next_time = time() - 60 * 60 * 24 * BACKUP_SITE_DAYS_DELAY; 
  $backup_archive_name = ROOT_PATH . BACKUP_DIR . "/backup.zip";
  $debug_id = (defined('BACKUP_SITE_DEBUG_ID') && $user_info['user_level'] == ADMIN && $user_info['user_id'] == BACKUP_SITE_DEBUG_ID) ? true : false;
   
if ($check_next_time >= $config['backup_site_next_time'] || !@file_exists($backup_archive_name) || (isset($debug_id) && $debug_id) && $user_info['user_id'] == $debug_id) {
   
  @include_once(ROOT_PATH . "includes/db_utils.php");

  $crlf = (get_user_os() == "WIN") ? "\r\n" : ((get_user_os() == "MAC") ? "\r" : "\n");

  $tables_info = array();
  $db = (get_mysql_version() >= 32306)  ? "`$db_name`" : $db_name;
  $result = $site_db->query("SHOW TABLE STATUS FROM $db");
  if ($result) {
    while ($row = $site_db->fetch_array($result)) {
      $tables_info[$row['Name']] = ((isset($row['Type'])) ? $row['Type'] : $row['Engine']);
    }
    $site_db->free_result($result);
  }

  ob_start();
  @ob_implicit_flush(0);

  echo "#----------------------------------------------------------".$crlf;
  echo "# Database Backup for ".format_text($config['site_name'], 2).$crlf;
  echo "# ".date("Y-m-d H:i").$crlf;
  echo "#----------------------------------------------------------".$crlf;
  foreach ($default_backup_tables as $table) {
    @set_time_limit(1200);
    echo $crlf."#".$crlf."# Structure for Table ".$table.$crlf."#".$crlf;
    get_table_def_mysql($table, $crlf);
    get_table_content_mysql($table, $crlf);
  }

  $contents = ob_get_contents();
  ob_end_clean();

  @umask(0111);
  if ($config['gz_compress'] == 1 && extension_loaded("zlib")) {
    $file_name = "backup".time().".sql.gz";
    $fp = @gzopen(ROOT_PATH.DATABASE_DIR."/".$file_name, "w9");
    $ok = @gzwrite($fp, $contents);
    gzclose($fp);
  }
  else {
    $file_name = "backup".date("YmdHi").".sql";
    $fp = @fopen(ROOT_PATH.DATABASE_DIR."/".$file_name, "w");
    $ok = @fwrite($fp, $contents);
    fclose($fp);
  } 
 
  include(ROOT_PATH . "includes/archive.php");
  $backup_operation = new zip_file($backup_archive_name);
  $backup_operation->set_options(array('inmemory' => 0, 'recurse' => 1, 'storepaths' => 1, 'overwrite' => 1));
  $backup_operation->add_files(ROOT_PATH);
  $backup_operation->exclude_files(ROOT_PATH . "data/backup");
  $backup_operation->exclude_files(ROOT_PATH . "data/database/default");
 
  $backup_operation->create_archive();
  $backup_operation->download_file();
  if (count($backup_operation->errors) <= 0) {
      if ($user_info['user_level'] == ADMIN) {
          echo $lang['backup_site_create_success'] . "<br />";   
      }
    @unlink(ROOT_PATH.DATABASE_DIR."/".$file_name);
   
    @include_once(ROOT_PATH . 'includes/html_email/MAIL.php');
   
    // get ID value (random) for the embed image
    $id = MIME::unique();
   
    $site_email = new MAIL;
   
    $sql1 = "
   
    SELECT " . get_user_table_field("", "user_name") . get_user_table_field(", ", "user_email") . "
    FROM " . USERS_TABLE . "
    WHERE " . get_user_table_field("", "user_level") . " >= '" . ADMIN . "' AND " . get_user_table_field("", "user_allowemails") . " = 1 AND " . get_user_table_field("", "user_id") . " != " . $user_info['user_id'];
   
    $result1 = $site_db->query($sql1);       
   
    $site_email->From(stripslashes($config['site_email']), format_text($config['site_name'], 2));   
    if ($user_info['user_level'] == ADMIN && isset($user_info['user_email'])) {
        $site_email->AddTo(stripslashes($user_info['user_email']), format_text(trim($user_info['user_name']), 2));
    } else {
        $site_email->AddTo(stripslashes($config['site_email']), format_text($config['site_name'], 2));
    }

    $email_row = array();
    while ($row = $site_db->fetch_array($result1)) {
        $email_row[] = $row;
    }
    $site_db->free_result($result1);
    $num_email = sizeof($email_row);   
   
    $user_name = "";
    $user_email = "";
    for ($i = 0; $i < $num_email; $i++) {
        if ((function_exists('mailchek') && mailchek($email_row[$i][$user_table_fields['user_email']], 2)) || (FUNC::is_mail($email_row[$i][$user_table_fields['user_email']], true)) && !preg_match("/([\msn|yahoo|caramail|incredimail]+[\.]+[\com|net|ca|org|de|ru|sh|se|fr|au]+)/i", $email_row[$i][$user_table_fields['user_email']])) {

            $user_name = $email_row[$i][$user_table_fields['user_name']];
            $user_email = $email_row[$i][$user_table_fields['user_email']];
           
            if (isset($user_name) && !empty($user_name) && isset($user_email) && !empty($user_email) && !isset($user_info['user_name'])) {               
                $site_email->Text(str_replace(array("{site_name}", "{ftp_location}", "{user_name}", "{delay_time}"), array(format_text($config['site_name'], 2), format_text(stripslashes(trim($backup_archive_name)), 2), format_text(trim($user_name), 2), (int)BACKUP_SITE_DAYS_DELAY), $lang['backup_site_notify_text_message']));
               
                $site_email->Cc[] = array(
                'address'  => stripslashes($user_email), // required
                'name'     => format_text(trim($user_name), 2), // optional
                'charset'  => $lang['charset'], // optional
                'encoding' => 'base64' // optional
                );
            }
        }
    }
    $site_email->Subject(preg_replace("/" . $site_template->start . "site_name" . $site_template->end . "/siU", format_text($config['site_name'], 2), $lang['backup_site_notify_subject_title']));
   
    if ($user_info['user_name']) {
        $site_email->Text(str_replace(array("{site_name}", "{ftp_location}", "{user_name}", "{delay_time}"), array(format_text($config['site_name'], 2), format_text(stripslashes(trim($backup_archive_name)), 2), format_text(trim($user_info['user_name']), 2), BACKUP_SITE_DAYS_DELAY), $lang['backup_site_notify_text_message']));
    }
    if ($user_info['user_level'] == ADMIN) {
        echo $site_email->Send('client') ? preg_replace("/" . $site_template->start . "delay_time" . $site_template->end . "/siU", (int)BACKUP_SITE_DAYS_DELAY, $lang['backup_site_mail_sent']) : $lang['backup_site_mail_error'];
    }
    $site_email->Delto();
    $site_email->Delcc();
    $site_email->DelAttach();
    $site_email->Disconnect();
    unset ($email_row);
    unset ($user_name);
    unset ($user_email);
   
    $site_db->query("UPDATE " . SETTINGS_TABLE . " SET setting_value = '" . time() . "' WHERE setting_name = 'backup_site_next_time'");
       
  } elseif (count($backup_operation->errors) > 0) {
      echo $lang['backup_site_create_fail'];
  }
 
}

} // End function.

In includes/constants.php file,

find:

Quote
define('DATABASE_DIR', 'data/database');

add after:

Code: [Select]
define('BACKUP_DIR', 'data/backup'); // Change folder name !!! (backup to something else)

Change folder name ! (FTP / File manager and define). After, set CHMOD 777 to folder.

Add top ?>:

Code: [Select]
define('BACKUP_SITE_DAYS_DELAY', 1); // Set to 1 day.
//define('BACKUP_SITE_DEBUG_ID', 1); // Debug Admin ID

Is here you can set BACKUP_SITE_DAYS_DELAY (is 1 for now for 1 day). If want more (ex: 3 day - remove 1 and set 3). 3 days, ZIP file will create. ;)
BACKUP_SITE_DEBUG_ID is for debug. 1 is user ID. If need, remove // and replace for done.

// Step 3

In includes/page_header.php file,

find:

Quote
//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------

add before:

Code: [Select]
//-----------------------------------------------------
//--- Backup site -------------------------------------
//-----------------------------------------------------

if (function_exists('backup_site_operation')) {
    backup_site_operation();   
}

// Step 4

In lang/english/main.php file,

add top ?>:

Code: [Select]
$lang['backup_site_create_success'] = "<span class=\"smalltext\"><font color=\"green\">Done !</font></span>";
$lang['backup_site_create_fail'] = "<span class=\"smalltext\"><font color=\"red\">Fail !</font></span>";
$lang['backup_site_notify_subject_title'] = "Backup site for: {site_name}";
$lang['backup_site_notify_text_message'] = "Dear {user_name}, \n\n{site_name} has just performed a backup operation of the entire 4images folder on a ZIP file.\nThe File is located in: {ftp_location} (SQL file included).\n\nThis message will appear every {delay_time} day(s).\n\nRegards.\n{site_name}";
$lang['backup_site_list_title'] = "Backup Gallery List";
$lang['backup_site_list_do_backup'] = "Gallery Backup";
$lang['backup_site_list_backup_success'] = "Gallery backed up.";
$lang['backup_site_list_backup_error'] = "<span class=\"smalltext\"><font color=\"red\">Gallery not backed up.</font></span>";
$lang['backup_site_mail_sent'] = "Email sent !<br />Next backup in: <b>{delay_time}</b> day(s).<br />";
$lang['backup_site_mail_error'] = "Error while sending email. Please check mail / web logs (cPanel access) and post in 4homepages.de forum - official topic - if need help.";

// Step 5

Download backup.zip file attachment. Replace admin/backup.php file (or compare if use other MOD on forum - I give no support for compare).

// Step 6

Go to ACP -> Backup database. Should see new window.

// Step 7 (09/19/2007)

In includes/db_field_definitions.php file,

Code: [Select]
$default_backup_tables = array(
table1,
table2
);

Replace: table1, table2 with all define table you have (only define name) from includes/constants.php file.

Should work (use ACP - > setting for email address too). ;)

55
Mods & Plugins (Releases & Support) / [MOD] - Improve ZIP file class
« on: September 15, 2007, 08:50:28 PM »
Detail: This can ZIP file better for 4images.

Download ZIP attach file. Upload archive.php file to includes.
This use for other MODs.

56
Mods & Plugins (Releases & Support) / [MOD] - HTML Email
« on: September 15, 2007, 08:46:33 PM »
Detail: This send HTML email to users. This topic is use with other MOD I post (no work with MSN).

Use ZIP file attachment. Upload content to includes/html_email (create folder).

Here is test PHP script for 4images. Is send 3 last upload image of gallery and to all admin (allow email accept - if no -  no send).

// Step 1

In ROOT_PATH, create file: mail-client.php file.

Add:

Code: [Select]
<?php

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'] == ADMIN) {
    
    
$sql "
    
    SELECT image_id, image_name, cat_id, image_media_file
    FROM " 
IMAGES_TABLE "
    WHERE image_active = 1 AND (cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))
    ORDER BY image_date DESC
    LIMIT 2
    
    "
;
    
    
$result $site_db->query($sql);
    
    @include_once(
ROOT_PATH 'includes/html_email/MAIL.php');
    
    
// get ID value (random) for the embed image
    
$id MIME::unique();
    
    
$site_email = new MAIL;
    
    
$image_url "";
    while (
$image_row $site_db->fetch_array($result)) {
        
$image_url .= preg_replace("/" $site_template->start "image_url" $site_template->end "/siU"format_url($script_url '/details.php?image_id=' . (int)$image_row['image_id']), $lang['latest_image_by_email_message_url']);
        
        
$f ROOT_PATH 'data/media/' $image_row['cat_id'] . '/' $image_row['image_media_file'];
        
$site_email->Attach(file_get_contents($f), FUNC::mime_type($f), nullnullnull'inline'$id);
    }
    
    
$sql1 "
    
    SELECT " 
get_user_table_field("""user_name") . get_user_table_field(", ""user_email") . "
    FROM " 
USERS_TABLE "
    WHERE " 
get_user_table_field("""user_level") . " >= '" ADMIN "' AND " get_user_table_field("""user_allowemails") . " = 1 AND " get_user_table_field("""user_id") . " != 1";
    
    
$result1 $site_db->query($sql1);   
    
    
$site_email->From($config['site_email'], format_text($config['site_name'], 2));
    
$site_email->AddTo($user_info['user_email'], format_text(trim($user_info['user_name']), 2));

    
$email_row = array();
    while (
$row $site_db->fetch_array($result1)) {
        
$email_row[] = $row;
    }
    
$site_db->free_result($result1);
    
$num_email sizeof($email_row);    
    
    
$user_email "";
    
$user_name "";
    for (
$i 0$i $num_email$i++) {
        if (
FUNC::is_mail($email_row[$i][$user_table_fields['user_email']], true) && !preg_match("/[\msn]/i"$email_row[$i][$user_table_fields['user_email']])) {            
            
$user_email .= $email_row[$i][$user_table_fields['user_email']] . ", ";
            
$user_name .= $email_row[$i][$user_table_fields['user_name']] . ", ";
        }
    }
    if (isset(
$user_name) && !empty($user_name) && isset($user_email) && !empty($user_email)) {
        
$user_name_sub substr($user_name0strlen($user_name) -2);
        
$user_email_sub substr($user_email0strlen($user_email) -2);    
    
    
$site_email->Cc[] = array(
            
'address'  => stripslashes($user_email_sub), // required
            
'name'     => format_text(trim($user_name_sub), 2), // optional
            
'charset'  => $lang['charset'], // optional
            
'encoding' => 'base64' // optional
    
);
    
$site_email->Subject('Latest image');
    }

@include_once(
ROOT_PATH 'lang/' $config['language_dir'] . '/html_email/my_template.php');
$site_email->Html($email_template);
echo 
$site_email->Send('client') ? $lang['latest_image_by_email_sent'] : $lang['latest_image_by_email_error'];
$site_email->Delto();
$site_email->Delcc();
$site_email->DelAttach();
$site_email->Disconnect();
unset (
$email_row);
unset (
$image_url);
unset (
$user_name);
unset (
$user_email);

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


// Step 2

In lang/english folder, create folder: html_email . Create file: my_template.php (yes, is true filename for test - no replace to real template name).

Add:

Code: [Select]
<?php

if (!defined('ROOT_PATH')) {
    die (
'Security violation.');
}

$email_template stripslashes('

<html>
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
<br />
      <table width="640" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td colspan="4"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr> 
          <td width="6"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">&nbsp;</td>
          <td align="right" width="6"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>          
      <table width="640" border="1" cellspacing="1" cellpadding="0">
      <tr>           
      <td width="450" align="center"><font color="green"><br />Dear ' 
format_text(trim($user_info['user_name']), 2) . ',<br /><br />
      We now present you the latest upload image in gallery: <b>' 
format_text($image_info['image_name'], 2) . '</b><br /><br />
      ' 
$image_url '<br /><br /></font></td>
      </tr>
      </table>
      <table width="640" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="6"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="' 
$script_url '/' TEMPLATE_PATH '/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
      
      <p id="copyright" align="center">
      Powered by <b>4images</b> v1.7.4
      <br />
      Copyright &copy; 2002-2007 <a href="http://www.4homepages.de" target="_blank">4homepages.de</a>
      </p>
</body>
</html>

'
);
?>


// Step 3

In lang/english/main.php file,

add top ?>:

Code: [Select]
$lang['latest_image_by_email_message_url'] = "Go see <a href=\"{image_url}\">here</a><br />";
$lang['latest_image_by_email_sent'] = "Email sent !";
$lang['latest_image_by_email_error'] = "Error while sending email. Please check mail / web logs (cPanel access) and post in 4homepages.de forum - official topic - if need help.";

Should work. ;)

57
Feedback & Suggestions / [FIX] - admin/backup.php file
« on: September 14, 2007, 04:28:16 AM »
Detail: Fix extension check of SQL.

Find:

Quote
if (is_file(ROOT_PATH.DATABASE_DIR."/".$file) && $file != "." && $file != ".." && eregi("\.sql",$file)) {

replace:

Code: [Select]
if (@file_exists(ROOT_PATH.DATABASE_DIR."/".$file) && $file != "." && $file != ".." && preg_match("/\.sql/", $file)) {

58
Feedback & Suggestions / [FIX] - Download.php file
« on: September 12, 2007, 03:34:57 AM »
Detail: Fix for get_basefile in download.

Find:

Quote
$file_name = get_basefile($image_row['image_media_file']);

replace:

Code: [Select]
$file_name = get_basefile(stripslashes($image_row['image_media_file']));

find (2 time):

Quote
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);

replace:

Code: [Select]
preg_match("/(.+)\.(.+)/", get_basefile(stripslashes($image_row['image_media_file'])), $regs);

59
Plugins / [ACP - PLUGIN] - Cat hits all in 1
« on: September 10, 2007, 02:28:29 AM »
Detail: This show cat hits in one page in ACP - > plugins - v2.0.

[02-28-2008] - Update

- Admin paging add.
- Add this: http://www.4homepages.de/forum/index.php?topic=6926.msg112721#msg112721
- Add define constant (step 3).

[02-28-2008] - End Update

// Step 1

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

Add:

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

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

show_admin_header();

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

if (
$action == "show_cat_visits") {
    
    
$sql1 "
    
    SELECT COUNT(cat_id) AS total_hits
    FROM " 
CATEGORIES_TABLE 
    WHERE (cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))
    
    "
;
    
    
$row $site_db->query_firstrow($sql1);
    
$total_hits = (isset($row['total_hits'])) ? $row['total_hits'] : 0;
    
    
$condition "";
    
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
    
    include(
ROOT_PATH.'admin/includes/admin_paging.php');
    
$cat_hits_perpage = (defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) ? intval(trim(CAT_HITS_SET_PERPAGE)) : 0;
    
$link_arg $site_sess->url("cat_visits.php?action=show_cat_visits");

    
$text str_replace(array("{total_cat_images}"), array($total_hits), $lang['cat_hits_description']);

    
$getpaging = new Paging($page$cat_hits_perpage$total_hits$link_arg$text''''''''false);
    
$offset = (defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) ? $getpaging->get_offset() : "";
        
    
$paging_split_valid false;
    
$paging_stats_valid false;    
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
        
$paging_split_valid true;        
    }
        
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
        
$paging_stats_valid true;                
    }
    
    
$condition "LIMIT ".$offset.", ".$cat_hits_perpage;
    }
    
    
$sql "
    
    SELECT cat_id, cat_name, cat_hits
    FROM " 
CATEGORIES_TABLE "
    WHERE (cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))    
    ORDER BY cat_hits DESC
    " 
$condition;
    
    unset (
$condition);
    
    
$result $site_db->query($sql);
    
$num_rows $site_db->get_numrows($result);
    
?>

    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tableheader" /><?php echo $lang['cat_hits_stats']; ?></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">   
    </table>   
    <?php    
    
if (isset($num_rows) && $num_rows <= 0) {
        
?>

        <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tablebottom" />   
        <tr>   
        <td width="100%" align="center" class="tablerow" /><br /><?php echo $lang['cat_hits_no_content']; ?></td>
        </tr>
        </table>
        <?php          
    
} elseif (isset($num_rows) && $num_rows 0) {
        
        
?>

        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="100%" align="center" class="tablerow" /><br /><?php echo (($paging_stats_valid) ? $getpaging->get_paging_stats() : (($total_hits 0) ? str_replace(array("{total_cat_images}"), array($total_hits), $lang['cat_hits_description']) : $lang['cat_hits_no_content'])); ?><br /><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="100%" align="right" class="tablerow" /><br /><?php echo (($paging_split_valid) ? $getpaging->get_paging() : ""); ?><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="50%" align="center" class="tableheader" /><?php echo $lang['cat_hits_cat_name']; ?></td>       
        <td width="50%" align="center" class="tableheader" /><?php echo $lang['cat_hits_title']; ?></td>
        </tr>
        <?php
        
while ($stats_row $site_db->fetch_array($result)) {
            
$cat_id $stats_row['cat_id'];
            
$cat_name format_text(trim($stats_row['cat_name']), 2);            
            
$cat_hits $stats_row['cat_hits'];
        
?>

        <tr>
        <td width="50%" align="center" class="tablerow" /><a href="<?php echo $site_sess->url(ROOT_PATH "categories.php?cat_id=" $cat_id); ?>" class="link" target="_blank" /><?php echo $cat_name?></a>       
        <td width="50%" align="center" class="tablerow" /><?php echo $cat_hits?></td>
        </tr>
        <?php
        
}                
    }
    
?>
   
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tablerow" />&nbsp;</td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" 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">Created by <a href="http://www.4homepages.de/forum/index.php?action=profile;u=20285" class="link" target="_blank" />Thunderstrike</a> . 2007-2008</span><br />
<span class="smalltext"><a href="http://www.4homepages.de/forum/index.php?topic=18686" class="link" target="_blank" />Support topic</a> .</span><br />
<br /></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tableheader" />&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <?php              


show_admin_footer(); 
?>


// Step 2

In lang/english/admin.php file,

find:

Quote
$lang['resizing_image_error'] = "Error converting image file!";

add after:

Code: [Select]
//-----------------------------------------------------
//--- Categories hits stats ---------------------------
//-----------------------------------------------------
$lang['cat_hits_stats'] = "Category hits stats";
$lang['cat_hits_description'] = "Check for cat hits for each categories: {total_cat_images} cats.";
$lang['cat_hits_no_content'] = "No content";
$lang['cat_hits_cat_name'] = "Category name";
$lang['cat_hits_title'] = "Category hits";

// Step 3

In includes/constants.php file,

add in top ?>:

Code: [Select]
// Cat hits plugin.
define('CAT_HITS_PERPAGE_ACTIVATION', 1); // 1 for active. 0 for disable.
define('CAT_HITS_SET_PERPAGE', 10); // Add result per page.

60
Plugins / [ACP - PLUGIN] - Image hits all in 1
« on: September 10, 2007, 01:27:21 AM »
Detail: This show image hits in one page in ACP - > plugins.

// Step 1

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

Add:

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

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

show_admin_header();

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

if (
$action == "show_image_visits") {
    
    
$additional_sql "";    
    if (isset(
$additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
        foreach (
$additional_image_fields as $key => $val) {
            
$additional_sql .= ", " $key;            
        }
    }
    
    
$sql "
    
    SELECT image_id, image_name, image_date, image_hits" 
$additional_sql "
    FROM " 
IMAGES_TABLE "
    WHERE image_active = 1 AND (cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))
    ORDER BY image_date, image_hits DESC
    
    "
;
    
    
$result $site_db->query($sql);
    
$num_rows $site_db->get_numrows($result);
    
?>

    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tableheader" /><?php echo $lang['image_hits_stats']; ?></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">   
    </table>   
    <?php    
    
if (isset($num_rows) && $num_rows <= 0) {
        
?>

        <table border="0" width="100%" cellpadding="0" cellspacing="0" class="tablebottom" />   
        <tr>   
        <td width="100%" align="center" class="tablerow" /><br /><?php echo $lang['image_hits_no_content']; ?></td>
        </tr>
        </table>
        <?php          
    
} elseif (isset($num_rows) && $num_rows 0) {
        
        
$sql1 "SELECT COUNT(image_id) AS total_hits FROM " IMAGES_TABLE " WHERE image_active = 1 AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))";
        
$row $site_db->query_firstrow($sql1);
        
$total_hits = (isset($row['total_hits'])) ? $row['total_hits'] : 0;
        
?>

        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="100%" align="center" class="tablerow" /><br /><?php echo $lang['image_hits_description']; ?> (Total: <b><?php echo $total_hits?></b>).<br /><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_image_name']; ?></td>
        <td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_added_on']; ?></td>
        <td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_title']; ?></td>
        </tr>
        <?php
        
while ($stats_row $site_db->fetch_array($result)) {
            
$image_id $stats_row['image_id'];
            
$image_name format_text(stripslashes($stats_row['image_name']), 2);
            
$image_date format_date($config['date_format'] . " " $config['format_time'], $stats_row['image_date']);
            
$image_hits $stats_row['image_hits'];
        
?>

        <tr>
        <td width="33%" align="center" class="tablerow" /><a href="<?php echo $site_sess->url(ROOT_PATH "details.php?image_id=" $image_id); ?>" class="link" target="_blank" /><?php echo $image_name?></a>
        <td width="33%" align="center" class="tablerow" /><?php echo $image_date?></td>
        <td width="33%" align="center" class="tablerow" /><?php echo $image_hits?></td>
        </tr>
        <?php
        
}                
    }
    
?>
   
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tablerow" />&nbsp;</td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" 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">Created by <a href="http://www.4homepages.de/forum/index.php?action=profile;u=20285" class="link" target="_blank" />Thunderstrike</a> . 2007-2008</span><br />
<span class="smalltext"><a href="http://www.4homepages.de/forum/index.php?topic=18685" class="link" target="_blank" />Support topic</a> .</span><br />
<br /></td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tableheader" />&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <?php              


show_admin_footer(); 
?>


// Step 2

In lang/english/admin.php file,

find:

Quote
$lang['resizing_image_error'] = "Error converting image file!";

add after:

Code: [Select]
//-----------------------------------------------------
//--- Images hits stats -------------------------------
//-----------------------------------------------------
$lang['image_hits_stats'] = "Image hits stats";
$lang['image_hits_description'] = "Check for image hits for each images";
$lang['image_hits_no_content'] = "No content";
$lang['image_hits_image_name'] = "Image name";
$lang['image_hits_added_on'] = "Added on";
$lang['image_hits_title'] = "Image hits";

Pages: 1 2 3 [4] 5 6 7