Author Topic: How to put "images_awaiting_validation" into the user_logininfo.html ?  (Read 17158 times)

0 Members and 1 Guest are viewing this topic.

Offline komsho25

  • Newbie
  • *
  • Posts: 37
    • View Profile
Hi ppl.. i need your help...

How to put "images_awaiting_validation" into the user_logininfo.html ?

I tried some solutions but nothing...

I set a Admin Control panel link on menu links.. but i need and images_awaiting_validation ...


Thank you


p.s. sorry on my bad english...

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Hi,

here a small mod.
With this mod, a loggedin user have a new link: "My awaiting images".
He can see the thumbs with imagename, catname and uploaddate

Not working at the moment: count the images and paging the images

1:
in search.php
search:
Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
before add:
Code: [Select]
//-----------------------------------------------------
// -- Start MOD "My awaiting images" ------------------
//-----------------------------------------------------
if ($action == "my_awaiting_images")  {
  $link_arg = $site_sess->url(ROOT_PATH."search.php?action=my_awaiting_images");
  include(ROOT_PATH.'includes/paging.php');
  $getpaging = new Paging($page, $perpage, $num_rows_all, $link_arg);
  $offset = $getpaging->get_offset();
  $site_template->register_vars(array(
    "paging" => $getpaging->get_paging(),
    "paging_stats" => $getpaging->get_paging_stats()
  ));

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

  $logged_in_id = trim($user_info['user_id']);
  $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_media_file, i.image_thumb_file, c.cat_name".get_user_table_field(", u.", "user_name")."
          FROM (".IMAGES_TEMP_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.user_id = $logged_in_id
          ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
          LIMIT $offset, $perpage";
  $result = $site_db->query($sql);
  $thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)) {
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
    show_image_awaiting($image_row, "search");
    $thumbnails .= $site_template->parse_template("thumbnail_bit_awaiting");
    $thumbnails .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $thumbnails .= "</tr>\n";
      $count = 0;
    }
  } // end while
  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($i = 0; $i < $leftover; $i++) {
        $thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $thumbnails .= "</tr>\n";
    }
  }
  $thumbnails .= "</table>\n";
  $content = $thumbnails;
  unset($thumbnails);
} // end if
else {
  $site_template->register_vars(array(
    "search_keywords" => format_text(stripslashes($org_search_keywords), 2),
    "search_user" => format_text(stripslashes($org_search_user), 2),
    "lang_search_by_keyword" => $lang['search_by_keyword'],
    "lang_search_by_username" => $lang['search_by_username'],
    "lang_new_images_only" => $lang['new_images_only'],
    "lang_search_terms" => $lang['search_terms'],
    "lang_or" => $lang['or'],
    "lang_and" => $lang['and'],
    "lang_category" => $lang['category'],
    "lang_search_fields" => $lang['search_fields'],
    "lang_all_fields" => $lang['all_fields'],
    "lang_name_only" => $lang['name_only'],
    "lang_description_only" => $lang['description_only'],
    "lang_keywords_only" => $lang['keywords_only'],
    "category_dropdown" => get_category_dropdown($cat_id)
  ));

  if (!empty($additional_image_fields)) {
    $additional_field_array = array();
    foreach ($additional_image_fields as $key => $val) {
      if (isset($lang[$key.'_only'])) {
        $additional_field_array['lang_'.$key.'_only'] = $lang[$key.'_only'];
      }
    }
    if (!empty($additional_field_array)) {
      $site_template->register_vars($additional_field_array);
    }
  }
  $content = $site_template->parse_template("search_form");
}
//-----------------------------------------------------
// --- END MOD "My awaiting images"--------------------
//-----------------------------------------------------

2:
in includes/functions.php
search:
Code: [Select]
function get_thumbnail_codebefore add:
Code: [Select]
// -----------------------------------------------
// --- Start Mod "my awaiting images" ------------
//------------------------------------------------

function show_image_awaiting($image_row, $mode = "", $show_link = 0, $detailed_view = 0) {
  global $self_url, $site_template, $site_sess, $user_info, $config, $cat_cache, $lang, $additional_image_fields, $user_table_fields, $url_show_profile;

  if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    $show_link = 0;
  }

  if (isset($image_row[$user_table_fields['user_name']]) && $image_row['user_id'] != GUEST) {
    $user_name = format_text($image_row[$user_table_fields['user_name']], 2);

    $user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $image_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$image_row['user_id'];
    $user_name_link = "<a href=\"".$site_sess->url($user_profile_link)."\">".$user_name."</a>";
  }
  else {
    $user_name = format_text($lang['userlevel_guest'], 2);
    $user_name_link = $user_name;
  }

  $site_template->register_vars(array(
    "image_id" => $image_row['image_id'],
    "user_id" => $image_row['user_id'],
    "image_date" => format_date($config['date_format']." ".$config['time_format'], $image_row['image_date']),
    "user_name" => $user_name,
    "user_name_link" => $user_name_link,
    "image_name" => format_text($image_row['image_name'], 2),
    "image_url" => ($show_link) ? $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'].((!empty($mode)) ? "&amp;mode=".$mode : "")) : "",
    "image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
    "thumbnail" => get_thumbnail_code_awaiting($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['image_name'], $mode, $show_link),
    "thumbnail_openwindow" => get_thumbnail_code_awaiting($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['image_name'], $mode, $show_link, 1),
    "image_file_name" => $image_row['image_media_file'],
    "thumbnail_file_name" => $image_row['image_thumb_file']
  ));

  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);
    }
  }
  return true;
}



function get_thumbnail_code_awaiting($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 0, $open_window = 0) {
  global $site_sess, $config;

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"data/tmp_thumbnails/".$thumb_file_name."\" border=\"0\"".$width_height." alt=\"\" />";
    }
    else {
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"data/tmp_thumbnails/".$thumb_file_name."\" border=\"".$config['image_border']."\"".$width_height." alt=\"\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = $thumb;
    }
    else {
      $thumb = $thumb;
    }
  }
  return $thumb;
}
// -----------------------------------------------
// --- End Mod "my awaiting images" --------------
//------------------------------------------------

3:
in templates/default/
make a copy from:
thumbnail_bit.html
and save the new file as:
thumbnail_bit_awaiting.html

Here the new code for thumbnail_bit_awaiting.html:
Code: [Select]
<center>{thumbnail}<br />
<b>{image_name}</b><br />
<a href="{cat_url}">{cat_name}</a><br />
<!-- ({user_name_link})<br /> -->
Upload: {image_date}
</center>

4:
The link to the awaiting images for the user_logininfo.html:
Code: [Select]
       &raquo; <a href="./search.php?action=my_awaiting_images">My awaiting images</a><br />



Kurt


Offline komsho25

  • Newbie
  • *
  • Posts: 37
    • View Profile
I need mod to have this:





...in my user_logininfo.html but only when i like administrator log in, not normal user.


Thanks.

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
I need mod ...

hey komsho25 ...  :?
... it is your style ... ?
... I think first of all you should say thanks to Kurt for his MOD-code ... !
... it is the first part of code you need for your second request ... !
...
... and then we can post for you the second part for your request ... the number of images awaiting validation only for admins ... !
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline † manurom

  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • manurom's 4images templates
Hi all;
I feel like Mawenzi does.
It seems that "respect" and "patience" are obsolete or forgotten words in our modern world, and that's a pity.

Anyway, many thanks to KurtW. I learn each day thanks to members like you. Thank you all for that.


Offline komsho25

  • Newbie
  • *
  • Posts: 37
    • View Profile
OK! Sorry...


KurtW thank you for code... realy... you are a only who reply here with code.... thank you...

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Hi,

here the code for a adminlink in the logininfo table:

1:
in includes/page_header.php
search:
Code: [Select]
} else {
  $data = unserialize($data);

  $total_images = $data['total_images'];
  $total_categories = $data['total_categories'];
  $auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  $auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}
after add:
Code: [Select]
//-----------------------------------------------------
//--- Start Mod: Awaiting images ----------------------
//-----------------------------------------------------
if ($user_info['user_level'] == ADMIN){

$sql = "SELECT COUNT(*) AS total_awaiting_images
          FROM ".IMAGES_TEMP_TABLE."";
$row = $site_db->query_firstrow($sql);
//$total_awaiting_images = $row['total_awaiting_images'];
$total_awaiting_images = (isset($row['total_awaiting_images'])) ? $row['total_awaiting_images'] : 0;

if (!$total_awaiting_images){
     $awaiting_link = "";
 }
 else {
  $awaiting_link = "&raquo; <a href=\"./admin/validateimages.php?action=validateimages\" target=\"_blank\">";
  $awaiting_link .= "<script language=\"JavaScript\">\n<!--\nvar flg=0;\nfunction blink(){\nvar myElement=document.getElementById('blnk');\nflg^=1;\nif(flg==1){\nmyElement.style.visibility='hidden';\n}\nelse{\nmyElement.style.visibility='visible';\n}\ntimerID = setTimeout( 'blink()' , 500 );\n}\n//-->\n</script>\n";
  $awaiting_link .= "<span id=\"blnk\"><b>".$total_awaiting_images."</b> ".$lang['awaiting_images']."</span><script language=\"JavaScript\">blink();</script>";
 }
}
else {
     $awaiting_link = "";
}
//-----------------------------------------------------
//--- END Mod: Awaiting images ------------------------
//-----------------------------------------------------

search:
Code: [Select]
  "rss_url" => "",after add:
Code: [Select]
  "awaiting_link" => $awaiting_link,
in lang/your language/main.php
search:
Code: [Select]
?>before add:
Code: [Select]
//-----------------------------------------------------
//--- Mod: Awaiting images ----------------------------
//-----------------------------------------------------
$lang['awaiting_images'] = "image(s) awaiting validation:";

in templates/default/user_logininfo.html
search:
Code: [Select]
       &raquo; <a href="{url_logout}">{lang_logout}</a>after add:
Code: [Select]
      {if is_admin}
      <br /><br />
      {awaiting_link}
      {endif is_admin}



Kurt
PS: in the next days i combinate the two codes for a seperate new mod
« Last Edit: May 16, 2008, 06:05:55 AM by KurtW »

Offline komsho25

  • Newbie
  • *
  • Posts: 37
    • View Profile
Kurt you are a KING... thank you very much..

Offline † manurom

  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • manurom's 4images templates
     Call him from now KoenigW! :mrgreen:

Offline mstgokcen

  • Newbie
  • *
  • Posts: 44
    • View Profile
tnx for the mod but i need a small extra feature.

It is possible to list the awaiting images but not able to edit or delete. I want to give the ability of editing or deleting the user's own awaiting images. User should have the capability of editing /deleting before admin approval.

Is is easy to do?

How can i do this?

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to put "images_awaiting_validation" into the user_logininfo.html ?
« Reply #10 on: April 07, 2010, 02:25:03 PM »
Great MOD, THANKS!

One question. Why it show me 2 thumbnails for 1 image and with size 90px x 90px???

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to put "images_awaiting_validation" into the user_logininfo.html ?
« Reply #11 on: April 21, 2010, 12:27:37 PM »
Anyone may help me?