Author Topic: الصور الشخصية  (Read 14874 times)

0 Members and 1 Guest are viewing this topic.

Offline asms

  • Full Member
  • ***
  • Posts: 154
    • View Profile
الصور الشخصية
« on: November 15, 2007, 10:34:32 AM »
ملفات التي سنقوم بتعديل علية
***********************
/member.php
/details.php
/includes/upload.php
/includes/db_field_definitions.php
/admin/settings.php
/admin/admin_functions.php
/lang/<yourlanguage>/admin.php
/lang/<yourlanguage>/main.php
/templates/<yourtemplate>/member_profile.html
/templates/<yourtemplate>/member_editprofile.html
/templates/<yourtemplate>/comment_bit.html
****************************************
افتح ملف
member.php
ابحث عن
Quote
    $site_template->register_vars(array(
      "user_id" => $user_row['user_id'],
      "user_name" => (isset($user_row['user_name'])) ? htmlspecialchars($user_row['user_name']) : REPLACE_EMPTY,
      "user_email" => $user_email,
      "user_email_save" => $user_email_save,
      "user_mailform_link" => $user_mailform_link,
تبديل 
Quote
    $site_template->register_vars(array(
    "lang_avatar" => $lang['avatar'],
    "user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_row['user_avatar'] == "") ? "blank.gif" : $user_row['user_avatar'])."\" name=\"icons\" border=\"0\" alt=\"\">" : "",
      "user_id" => $user_row['user_id'],
      "user_name" => (isset($user_row['user_name'])) ? htmlspecialchars($user_row['user_name']) : REPLACE_EMPTY,
      "user_email" => $user_email,
      "user_email_save" => $user_email_save,
      "user_mailform_link" => $user_mailform_link,
بحث
Quote
   if (!$error) {
   $additional_sql = "";
    if (!empty($additional_user_fields)) {
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }

    $sql = "UPDATE ".USERS_TABLE."
            SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];
    $site_db->query($sql);
    $msg_color = 1;
    $msg .= $lang['update_profile_success'];
    if (!empty($new_email_msg)) {
      $msg .= "<br />".$new_email_msg;
    }
    $user_info = $site_sess->load_user_info($user_info['user_id']);
  }
  else {
    $update_process = 1;
  }
  $action = "editprofile";
}
اضاف اعلى
Quote
// Upload Avatar file
  if (!$error) {
     if (!empty($HTTP_POST_FILES['avatar_file']['tmp_name']) && $HTTP_POST_FILES['avatar_file']['tmp_name'] != "none") {
    include(ROOT_PATH.'includes/upload.php');
    $site_upload = new Upload();
    $new_name = $site_upload->upload_file("avatar_file", "avatar", $config['template_dir'], $user_info['user_id']);
     if (!$new_name) {
     $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name."</b><br />".$site_upload->get_upload_errors();
     $error = 1;
     }else{
    $HTTP_POST_VARS['user_avatar'] = "users/".$new_name;
    $avatars_dir = TEMPLATE_DIR."/".$config['template_dir']."/avatars/users/";
    $dir = opendir($avatars_dir);
    $contents = array();
    while ($contents[] = readdir($dir)){;}
    closedir($dir);
    foreach ($contents as $line){
      $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
      $extension = substr(strrchr($line,"."), 1);
      $filename2 = substr($new_name,0,(strlen($new_name)-strlen(strrchr($new_name,"."))));
      $extension2 = substr(strrchr($new_name,"."), 1);
      if ($filename == $filename2 && $extension != $extension2) {
      unlink($avatars_dir.$line);
      }
    }

     }
    }
  }
// End Avatar file
ابحث
Quote
    $user_icq = $user_info['user_icq'];
اضاف بعد ذلك
Quote
  $user_avatar = $user_info['user_avatar'];
ابحث
Quote
  $site_template->register_vars(array(
    "user_name" => htmlspecialchars(stripslashes($user_name)),
بدل
Quote
//-----------------------
//------ Avatar ---------
//-----------------------
  if ($config['avatar_use']){
   $images = "";
  $checked = ($user_avatar == "blank.gif" || $user_avatar == "") ? " selected" : "";
  $images .= "\n<option value=\"blank.gif\"$checked>none</option>\n";
  $dir = opendir(TEMPLATE_PATH."/avatars/users/");
  $contents = array();
  while ($contents[] = readdir($dir)){;}
  closedir($dir);
  natcasesort ($contents);
  foreach ($contents as $line){
   $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
   if ($filename == $user_info['user_id']) {
     $checked = (stristr($user_avatar, "users/")) ? " selected" : "";
     $images .= "\n<option value=\"users/$line\"$checked>".$lang['custom']."</option>\n";
   }
  }
   $dir = opendir(TEMPLATE_PATH."/avatars/");
   $contents = array();
   while ($contents[] = readdir($dir)){;}
   closedir($dir);
   natcasesort ($contents);
   $checked = "";
   foreach ($contents as $line){
      $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
      $extension = substr(strrchr($line,"."), 1);
      $checked = "";
      if ($line == $user_avatar) { $checked = " selected"; }
      if (strcasecmp($extension,"gif")==0 || strcasecmp($extension,"jpg")==0 || strcasecmp($extension,"jpeg")==0 || strcasecmp($extension,"png")==0 ){
         if ($line != "blank.gif") {
        $filename = str_replace("_", " ", $filename);
        $images .= "<option value=\"$line\"$checked>$filename</option>\n";
       }
      }
   }
  }
//----------------------
//----- End Avatar -----
//----------------------

  $site_template->register_vars(array(
   "lang_avatar" => $lang['avatar'],
   "lang_avatar_file" => $lang['avatar_file'],
   "lang_avatar_dim" => $lang['avatar_max_dim']." ".$config['avatar_width']."x".$config['avatar_height'].$lang['px'],
   "lang_avatar_select" => $lang['avatar_select'],
   "user_avatar_images" => $images,
   "user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_avatar == "") ? "blank.gif" : $user_avatar)."\" name=\"icons\" border=\"0\" alt=\"\">" : "",
   "lang_or" => $lang['or'],
   "user_avatar_file" => $config['avatar_user_custom'],
    "user_name" => htmlspecialchars(stripslashes($user_name)),
افتح ملف
details.php
ابحث
Quote
      $comment_user_id = $comment_row[$i]['user_id'];
اضاف بعد ذلك
Quote
    $user_row_comment = get_user_info($comment_user_id);
ابحث
Quote
        "comment_id" => $comment_row[$i]['comment_id'],
اضاف بعد ذلك
Quote
    "user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_row_comment['user_avatar'] == "") ? "blank.gif" : $user_row_comment['user_avatar'])."\" name=\"icons\" border=\"0\" hspace=\"15\" alt=\"\">" : "",
افتح ملف
/includes/upload.php
ابحث عن
Quote
    $this->max_height['media'] = $config['max_image_height'];

    $this->max_size['thumb'] = $config['max_thumb_size'] * 1024;
    $this->max_size['media'] = $config['max_media_size'] * 1024;
بدل
Quote
    $this->max_height['media'] = $config['max_image_height'];
  $this->max_width['avatar'] = $config['avatar_width'];
  $this->max_height['avatar'] = $config['avatar_height'];

    $this->max_size['thumb'] = $config['max_thumb_size'] * 1024;
    $this->max_size['media'] = $config['max_media_size'] * 1024;
    $this->max_size['avatar'] = 99999999999;
ابحث
Quote
  function copy_file() {
اضاف بعد ذلك
Quote
  if ($this->image_type == "avatar") {
    if (file_exists($this->upload_path[$this->image_type]."/".$this->file_name)) {
        @unlink($this->upload_path[$this->image_type]."/".$this->file_name);
      }
      $ok = move_uploaded_file($this->upload_file, $this->upload_path[$this->image_type]."/".$this->file_name);
  }else{
ابحث
Quote
    @chmod($this->upload_path[$this->image_type]."/".$this->file_name, CHMOD_FILES);
بدل
Quote
  }
    @chmod($this->upload_path[$this->image_type]."/".$this->file_name, CHMOD_FILES);
ابحث
Quote
    if ($cat_id) {
      $this->upload_path['thumb'] = THUMB_PATH."/".$cat_id;
      $this->upload_path['media'] = MEDIA_PATH."/".$cat_id;
    }
    else {
      $this->upload_path['thumb'] = THUMB_TEMP_PATH;
      $this->upload_path['media'] = MEDIA_TEMP_PATH;
    }

    if ($file_name != "") {
بدل
Quote
    if ($cat_id) {
      $this->upload_path['thumb'] = THUMB_PATH."/".$cat_id;
      $this->upload_path['media'] = MEDIA_PATH."/".$cat_id;
    $this->upload_path['avatar'] = TEMPLATE_DIR."/".$cat_id."/avatars/users";
    }
    else {
      $this->upload_path['thumb'] = THUMB_TEMP_PATH;
      $this->upload_path['media'] = MEDIA_TEMP_PATH;
    }

    if ($file_name != "" && $this->image_type != "avatar") {
بحث
Quote
    $this->mime_type = $this->HTTP_POST_FILES[$this->field_name]['type'];
بدل
Quote
if ($this->image_type == "avatar") {
    $this->file_name = $file_name.".".$this->extension;
  }

    $this->mime_type = $this->HTTP_POST_FILES[$this->field_name]['type'];
ابحث
Quote
    //Thumbnails
    $this->accepted_mime_types['thumb'] = array(
      "image/jpeg",
      "image/pjpeg",
      "image/gif",
      "image/x-png"
    );
    $this->accepted_extensions['thumb'] = array(
      "jpg",
      "jpeg",
      "gif",
      "png"
    );
اضافة في الاسفال
Quote
  //Avatar
    $this->accepted_mime_types['avatar'] = array(
      "image/jpeg",
      "image/pjpeg",
      "image/gif",
      "image/x-png"
    );
    $this->accepted_extensions['avatar'] = array(
      "jpg",
      "jpeg",
      "gif",
      "png"
    );
ابحث
Quote
      $error_msg .= "<b>".$this->file_name.":</b> ".$msg."<br />";
بدل
Quote
      $error_msg .= "<b>".(($this->image_type == "avatar") ? $this->HTTP_POST_FILES[$this->field_name]['name'] : $this->file_name).":</b> ".$msg."<br />";
افتح ملف
/includes/db_field_definitions.php
ضع في اخر السطر
Quote
$additional_user_fields['user_avatar'] = array($lang['avatar'], "avatar", 0);
افتح ملف
/admin/settings.php
ابحث
Quote
  show_setting_row("highlight_admin", "radio");
ضعة فوق الكود
Quote
  show_table_separator($setting_group[8], 2, "#setting_group_8");
  show_setting_row("avatar_use", "radio");
  show_setting_row("avatar_user_custom", "radio");
  show_setting_row("avatar_width");
  show_setting_row("avatar_height");

افتح
/admin/admin_functions.php
ابحث
Quote
      case "text":
      default:
        show_input_row($val[0], $field_name, $value);
   
      } // end switch
    }
  }
}
?>
بدلة
Quote
   case "avatar":
    show_avatar_row($val[0], $field_name, $value);
    break;
      case "text":
      default:
        show_input_row($val[0], $field_name, $value);
   
      } // end switch
    }
  }
}
//-----------------------
//------ Avatar ---------
//-----------------------
function show_avatar_row($title, $name, $value = "blank.gif"){
  global $config;
  if ($config['avatar_use']){
  $dir = opendir(TEMPLATE_PATH."/avatars/");
  $contents = array();
  while ($contents[] = readdir($dir)){;}
  closedir($dir);
  natcasesort ($contents);
  echo "<tr width=\"50%\"class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  echo "<td width=\"50%\" height=\"115\" valign=\"middle\">\n<table>\n<tr>\n<td>\n<SELECT name=\"$name\" size=\"6\" onkeypress=\"if(window.event.keyCode==13){this.form.submit();}\" onChange=\"document.form.icons_$name.src='".TEMPLATE_PATH."/avatars/'+document.form.$name.options[document.form.$name.selectedIndex].value;\">";
   if ($value == "blank.gif" || $value == "") {
   $checked = " selected";
   }else{
   $checked = "";
   }
   echo "<option value=\"blank.gif\"$checked>none</option>\n";
  foreach ($contents as $line){
     $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
     $extension = substr(strrchr($line,"."), 1);
     $checked = "";
     if ($line == $value) { $checked = " selected"; }
     if (strcasecmp($extension,"gif")==0 || strcasecmp($extension,"jpg")==0 || strcasecmp($extension,"jpeg")==0 || strcasecmp($extension,"png")==0 ){
      if ($line != "blank.gif") {
      $filename = str_replace("_", " ", $filename);
      echo "<option value=\"$line\"$checked>$filename</option>\n";
      }
     }
  }
  echo "</select>\n</td>\n<td valign='middle' align='left'>\n<img align='center' src=\"".TEMPLATE_PATH."/avatars/".(($value == "") ? "blank.gif" : $value)."\" name=\"icons_$name\" border=\"0\" alt=\"\">\n</td>\n</tr>\n</table>\n</td>\n";
  }
}
//----- End Avatar -----
?>
افتح ملف اللغة
lang/اللغة/admin.php
ضع الكود قبل
<?
Quote
/*-- Setting-Group 8 --*/
$setting_group[8]="الصور الشخصية";
$setting['avatar_use'] = "الصورة المستخدمة";
$setting['avatar_user_custom'] = ";كل المستخدمي يستطيعوم  ";
$setting['avatar_width'] = "Max. avatar width in pixel";
$setting['avatar_height'] = "Max. avatar height in pixel";
افتح ملف
/lang/اللغة/main.php
Quote
$lang['avatar'] = "الصور الشخصية: ";
$lang['avatar_file'] = "تحميل الصورة:";
$lang['avatar_max_dim'] = "Max. allowed";
$lang['avatar_select'] = "اختار الصورة الشخصية:";
$lang['custom'] = "اختار";
افتح الملف
/templates/اسم الثيم/member_profile.html
اضاف الكود
Quote
        {if user_avatar_current}
        <TR>
          <TD class="row2"><B>{lang_avatar}</B></TD>
          <TD class="row2">{user_avatar_current}</TD>
        </TR>
        {endif user_avatar_current}
افتح ملف
/templates/اسم الثيم/member_editprofile.html
اضاف الكود في الاعلى
Quote
<FORM method="post" action="{url_member}" name="creator" enctype="multipart/form-data">
  <TABLE width="100%" border="0" cellspacing="0" cellpadding="1">
    <TR>
      <TD valign="top" class="head1">
        <TABLE width="100%" border="0" cellpadding="4" cellspacing="0">
          <TR>
            <TD colspan="2" valign="top" class="head1">{lang_profile_of} {user_name}</TD>
          </TR>
          <TR>
            <TD class="row1"><B>{lang_email}</B></TD>
            <TD class="row1"><INPUT type="text" name="user_email"  size="30" value="{user_email}" class="input" /></TD>
          </TR>
          <TR>
            <TD class="row2"><B>{lang_email_confirm}</B></TD>
            <TD class="row2"><INPUT type="text" name="user_email2"  size="30" value="{user_email2}" class="input" /></TD>
          </TR>
          <TR>
            <TD class="row1"><B>{lang_show_email}</B></TD>
            <TD class="row1">
              <INPUT type="radio" name="user_showemail" value="1"{user_showemail_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <INPUT type="radio" name="user_showemail" value="0"{user_showemail_no} />
              {lang_no}</TD>
          </TR>
      <TR>
            <TD class="row2"><B>{lang_allow_emails}</B></TD>
            <TD class="row2">
              <INPUT type="radio" name="user_allowemails" value="1"{user_allowemails_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <INPUT type="radio" name="user_allowemails" value="0"{user_allowemails_no} />
              {lang_no}
      </TD>
          </TR>
          <TR>
            <TD class="row1"><B>{lang_invisible}</B></TD>
            <TD class="row1">
              <INPUT type="radio" name="user_invisible" value="1"{user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <INPUT type="radio" name="user_invisible" value="0"{user_invisible_no} />
              {lang_no}
      </TD>
          </TR>
          <TR>
            <TD colspan="2" class="head1">{lang_optional_infos}</TD>
          </TR>
          <TR>
            <TD class="row1"><B>{lang_homepage}</B></TD>
            <TD class="row1"><INPUT type="text" name="user_homepage"  size="30" value="{user_homepage}" class="input" /></TD>
          </TR>
          <TR>
            <TD class="row2"><B>{lang_icq}</B></TD>
            <TD class="row2"><INPUT type="text" name="user_icq"  size="30" value="{user_icq}" class="input" /></TD>
          </TR>
                   {if user_avatar_images}
          <TR>
            <TD colspan="2" class="head1">{lang_avatar}</TD>
          </TR>

          <TR>
            <TD class="row2" valign="top">
            {if user_avatar_file}
              <B>{lang_avatar_file}</B><BR />
              <SPAN class="smalltext">
              <B>{lang_avatar_dim}</B>
              </SPAN>
              <BR>
              <b>{lang_or}</b><BR>
              {endif user_avatar_file}
              <B>
              {lang_avatar_select}
              </B>
            </TD>
            <TD class="row2">
            {if user_avatar_file}
              {lang_upload}
              <INPUT type="file" name="avatar_file"  size="30" class="input" />
              <BR />
              <BR />
              {endif user_avatar_file}
              <SELECT name="user_avatar" size="6" onkeypress="if(window.event.keyCode==13){ this.form.submit(); }" onChange="document.images.icons.src='{template_url}/avatars/'+document.creator.user_avatar.options[document.creator.user_avatar.selectedIndex].value;">{user_avatar_images}</SELECT>
              <TABLE width="100%" height="100" border="0">
                <TR>
                  <TD align="center">
                    {user_avatar_current}
                  </TD>
                </TR>
              </TABLE>
            </TD>
          </TR>
          {endif user_avatar_images}
        </TABLE>
      </TD>
    </TR>
  </TABLE>
  <INPUT type="hidden" name="action" value="updateprofile" />
  <P align="center">
    <INPUT type="submit" value="{lang_save}" class="button" />
    <INPUT type="reset" value="{lang_reset}" class="button" />
  </P>
</FORM>
افتح ملف
/templates/اسم الثيم/comment_bit.html
اضاف الكود في الملف
Quote
{if user_avatar_current}
  {user_avatar_current}
  {endif user_avatar_current}
حمل الملف الذي في المرفقات
ارسال ملف
install_avatar.php
في المجلد للمواقع
اضاف مجلد
باسم avatars
في مجلد الثيم
مثال
/templates/اسم الثيم/avatars/users/
اضاف صورة
باسم
blank.gif
في مجلد
/templates/<yourtemplate>/avatars
ارسال ملف
avatar.sql
الي المجلد الرائيسي

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: الصور الشخصية
« Reply #1 on: December 08, 2007, 01:36:28 PM »
الله يعطيك العافية


اتمنى انك تحدد هل هو متوافق مع جميع الاصدارات ام لا

^_*
English Please :@

Offline sysay.com

  • Newbie
  • *
  • Posts: 11
  • لا إله إلا الله .. محمد رسول الله
    • View Profile
    • شبكة أون لاين
Re: الصور الشخصية
« Reply #2 on: December 10, 2007, 09:24:04 AM »
جزاك الله كل خير على هذا الشرح الجميل

جاري التطبيق ...

وننتظر المزيد من الشروحات الجميلة

بالتوفيق ..
منتدى الدعم العربي للفور إيمجز

http://www.4homepages.de/forum/index.php?board=27.0

http://www.sysay.com

Offline arabcine

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: الصور الشخصية
« Reply #3 on: September 21, 2009, 06:51:11 AM »
كل شي اوكي بس لمن دشيت على لوحة تحكم وابي اضيف صورة طلع لي هالارر

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/arabcine/public_html/test-bi5/includes/upload. php on line 335


شنو الحل

Offline pito

  • Pre-Newbie
  • Posts: 3
    • View Profile
thank you
« Reply #4 on: July 05, 2014, 04:59:07 AM »
AA one billion thanks O Kpeyeaier on this explanation hard hard you needy harbored harbored ........ remain Habibi Aktar Laughing so hard if I got to explain how to put pictures or participations in User profile Ptall rather than put it in the file search so - --->
(search.php? search_user = (user name
I beg of you ......... Mestany annotation Big O Ahan I am weak in programming but Xue savvier in html hehehehe
 :D :D :D :D :D :D :D :D :D :D
« Last Edit: July 05, 2014, 09:32:54 PM by pito »