<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум АлаичЪ'а о SEO - 4images ЧПУ настройка]]></title>
	<link rel="self" href="https://talk.alaev.info/feed/atom/topic/1078/" />
	<updated>2014-02-01T10:06:09Z</updated>
	<generator>PunBB</generator>
	<id>https://talk.alaev.info/topic/1078/</id>
		<entry>
			<title type="html"><![CDATA[Re: 4images ЧПУ настройка]]></title>
			<link rel="alternate" href="https://talk.alaev.info/post/7785/#p7785" />
			<content type="html"><![CDATA[<p>У меня негативный опыт работы с 4images. Даже вспоминать страшно. Могу только посочувствовать <img src="https://talk.alaev.info/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[DVE]]></name>
				<uri>https://talk.alaev.info/user/56/</uri>
			</author>
			<updated>2014-02-01T10:06:09Z</updated>
			<id>https://talk.alaev.info/post/7785/#p7785</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[4images ЧПУ настройка]]></title>
			<link rel="alternate" href="https://talk.alaev.info/post/7781/#p7781" />
			<content type="html"><![CDATA[<p>Нужен помощь по настройке чпу на 4images gallery. <br />По поиску много решении 4-5.<br />Самый нормальный этот.</p><p>.htaccess<br /></p><div class="codebox"><pre><code>RewriteEngine On 
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&amp;%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&amp;%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&amp;%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&amp;%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&amp;%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&amp;%{QUERY_STRING}</code></pre></div><p>.sessions</p><div class="codebox"><pre><code>/* ORIGINAL CODE
  function url($url, $amp = &quot;&amp;amp;&quot;) {
    global $l;
    $dummy_array = explode(&quot;#&quot;, $url);
    $url = $dummy_array[0];

    if ($this-&gt;mode == &quot;get&quot; &amp;&amp; !preg_match(&quot;/&quot;.SESSION_NAME.&quot;=/i&quot;, $url)) {
      $url .= preg_match(&quot;/\?/&quot;, $url) ? &quot;$amp&quot; : &quot;?&quot;;
      $url .= SESSION_NAME.&quot;=&quot;.$this-&gt;session_id;
    }

    if (!empty($l)) {
      $url .= preg_match(&quot;/\?/&quot;, $url) ? &quot;$amp&quot; : &quot;?&quot;;
      $url .= &quot;l=&quot;.$l;
    }

    $url .= (isset($dummy_array[1])) ? &quot;#&quot;.$dummy_array[1] : &quot;&quot;;
    return $url;
  }
*/
  function url($url, $amp = &quot;&amp;amp;&quot;) {
    global $l, $user_info;
    $dummy_array = explode(&quot;#&quot;, $url);
    $url = $dummy_array[0];
    $url = str_replace(&#039;&amp;amp;&#039;, &#039;&amp;&#039;, $url);
    if (!defined(&#039;IN_CP&#039;)) {
      if (strstr($url, &#039;index.php&#039;)) {
        $url = str_replace(&#039;index.php&#039;, &#039;&#039;, $url);
      }
      elseif (strstr($url, &#039;search.php&#039;)) {
        if (strstr($url, &#039;page=&#039;)) {
          preg_match(&#039;#page=([0-9]+)&amp;?#&#039;, $url, $matches);
          if (isset($matches[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace(&#039;search.php&#039;, &#039;search.&#039;.$matches[1].&#039;.htm&#039;, $url);
            $query = str_replace(&#039;page=&#039;.$matches[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;page=&#039;.$matches[1], &#039;&#039;, $query);
            $query = str_replace(&#039;page=&#039;.$matches[1], &#039;&#039;, $query);
            if (!empty($query)) {
              $url .= &#039;?&#039; . $query;
            }
          }
        }
        else {
          $url = str_replace(&#039;search.php&#039;, &#039;search.htm&#039;, $url);
        }
      }
      elseif (strstr($url, &#039;lightbox.php&#039;)) {
        if (strstr($url, &#039;page=&#039;)) {
          preg_match(&#039;#page=([0-9]+)&amp;?#&#039;, $url, $matches);
          if (isset($matches[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace(&#039;lightbox.php&#039;, &#039;lightbox.&#039;.$matches[1].&#039;.htm&#039;, $url);
            $query = str_replace(&#039;page=&#039;.$matches[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;page=&#039;.$matches[1], &#039;&#039;, $query);
            $query = str_replace(&#039;page=&#039;.$matches[1], &#039;&#039;, $query);
            if (!empty($query)) {
                $url .= &#039;?&#039; . $query;
            }
          }
        }
        else {
          $url = str_replace(&#039;lightbox.php&#039;, &#039;lightbox.htm&#039;, $url);
        }
      }
      elseif (strstr($url, &#039;categories.php&#039;)) {
        if (strstr($url, &#039;cat_id=&#039;) &amp;&amp; strstr($url, &#039;page=&#039;)) {
          preg_match(&#039;#cat_id=([0-9]+)&amp;?#&#039;, $url, $matches1);
          preg_match(&#039;#page=([0-9]+)&amp;?#&#039;, $url, $matches2);
          if (isset($matches1[1]) &amp;&amp; isset($matches2[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace(&#039;categories.php&#039;, &#039;cat&#039;.$matches1[1].&#039;.&#039;.$matches2[1].&#039;.htm&#039;, $url);
            $query = str_replace(&#039;cat_id=&#039;.$matches1[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;cat_id=&#039;.$matches1[1], &#039;&#039;, $query);
            $query = str_replace(&#039;cat_id=&#039;.$matches1[1], &#039;&#039;, $query);
            $query = str_replace(&#039;page=&#039;.$matches2[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;page=&#039;.$matches2[1], &#039;&#039;, $query);
            $query = str_replace(&#039;page=&#039;.$matches2[1], &#039;&#039;, $query);
            if (!empty($query)) {
              $url .= &#039;?&#039; . $query;
            }
          }
        }
        elseif (strstr($url, &#039;cat_id=&#039;)) {
          preg_match(&#039;#cat_id=([0-9]+)&amp;?#&#039;, $url, $matches);
          if (isset($matches[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $cat_url = get_category_url($matches[1]);
            $url   = str_replace(&#039;categories.php&#039;, &#039;cat&#039;.$cat_url.&#039;.htm&#039;, $url);
            $query = str_replace(&#039;cat_id=&#039;.$matches[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;cat_id=&#039;.$matches[1], &#039;&#039;, $query);
            $query = str_replace(&#039;cat_id=&#039;.$matches[1], &#039;&#039;, $query);
            if (!empty($query)) {
              $url .= &#039;?&#039; . $query;
            }
          }
        }
        else {
          $url = str_replace(&#039;categories.php&#039;, &#039;cat.htm&#039;, $url);
        }
      }
      elseif (strstr($url, &#039;details.php?image_id=&#039;)) {
        if (strstr($url, &#039;image_id=&#039;) &amp;&amp; strstr($url, &#039;mode=&#039;)) {
          preg_match(&#039;#image_id=([0-9]+)&amp;?#&#039;, $url, $matches1);
          preg_match(&#039;#mode=([a-zA-Z0-9]+)&amp;?#&#039;, $url, $matches2);
          if (isset($matches1[1]) &amp;&amp; isset($matches2[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace(&#039;details.php&#039;, &#039;img&#039;.$matches1[1].&#039;.&#039;.$matches2[1].&#039;.htm&#039;, $url);
            $query = str_replace(&#039;image_id=&#039;.$matches1[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;image_id=&#039;.$matches1[1], &#039;&#039;, $query);
            $query = str_replace(&#039;image_id=&#039;.$matches1[1], &#039;&#039;, $query);
            $query = str_replace(&#039;mode=&#039;.$matches2[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;mode=&#039;.$matches2[1], &#039;&#039;, $query);
            $query = str_replace(&#039;mode=&#039;.$matches2[1], &#039;&#039;, $query);
            if (!empty($query)) {
              $url .= &#039;?&#039; . $query;
            }
          }
        }
        else {
          preg_match(&#039;#image_id=([0-9]+)&amp;?#&#039;, $url, $matches);
          if (isset($matches[1])) {
            $split = explode(&#039;?&#039;, $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace(&#039;details.php&#039;, &#039;img&#039;.get_image_url($matches[1]).&#039;.htm&#039;, $url);
            $query = str_replace(&#039;image_id=&#039;.$matches[1].&#039;&amp;&#039;, &#039;&#039;, $query);
            $query = str_replace(&#039;&amp;image_id=&#039;.$matches[1], &#039;&#039;, $query);
            $query = str_replace(&#039;image_id=&#039;.$matches[1], &#039;&#039;, $query);
            if (!empty($query)) {
              $url .= &#039;?&#039; . $query;
            }
          }
        }
      }
      elseif (strstr($url, &#039;postcards.php?image_id=&#039;)) {
        preg_match(&#039;#image_id=([0-9]+)&amp;?#&#039;, $url, $matches);
        if (isset($matches[1])) {
          $split = explode(&#039;?&#039;, $url);
          $url = $split[0];
          $query = @$split[1];
          $url   = str_replace(&#039;postcards.php&#039;, &#039;postcard.img&#039;.$matches[1].&#039;.htm&#039;, $url);
          $query = str_replace(&#039;image_id=&#039;.$matches[1].&#039;&amp;&#039;, &#039;&#039;, $query);
          $query = str_replace(&#039;&amp;image_id=&#039;.$matches[1], &#039;&#039;, $query);
          $query = str_replace(&#039;image_id=&#039;.$matches[1], &#039;&#039;, $query);
          if (!empty($query)) {
            $url .= &#039;?&#039; . $query;
          }
        }
      }
    }
    if ($this-&gt;mode == &quot;get&quot; &amp;&amp; strstr($url, $this-&gt;session_id)) {
      $url .= strpos($url, &#039;?&#039;) !== false ? &#039;&amp;&#039; : &#039;?&#039;;
      $url .= SESSION_NAME.&quot;=&quot;.$this-&gt;session_id;
    }
    if (!empty($l)) {
      $url .= strpos($url, &#039;?&#039;) ? &#039;&amp;&#039; : &#039;?&#039;;
      $url .= &quot;l=&quot;.$l;
    }
    $url = str_replace(&#039;&amp;&#039;, $amp, $url);
    $url .= isset($dummy_array[1]) ? &quot;#&quot;.$dummy_array[1] : &quot;&quot;;
    return $url;
  }</code></pre></div><p>Last line&nbsp; ?&gt;</p><div class="codebox"><pre><code>function fixname($text)
{
  return strtolower(strtr(
    $text,
     array(
      &quot;é&quot; =&gt; &quot;e&quot;,
      &quot;è&quot; =&gt; &quot;e&quot;,
      &quot;ê&quot; =&gt; &quot;e&quot;,
      &quot;à&quot; =&gt; &quot;a&quot;,
      &quot;ë&quot; =&gt; &quot;e&quot;,
      &quot;â&quot; =&gt; &quot;a&quot;,
      &quot;ú&quot; =&gt; &quot;a&quot;,
      &quot;ó&quot; =&gt; &quot;o&quot;,
      &quot;í&quot; =&gt; &quot;i&quot;,
      &quot;á&quot; =&gt; &quot;a&quot;,

      //russian UTF8 encoded alphabet (lower and upper cases)
      &quot;&amp;#1040;&quot; =&gt; &quot;a&quot;,
      &quot;&amp;#1072;&quot; =&gt; &quot;a&quot;,
      &quot;&amp;#1041;&quot; =&gt; &quot;b&quot;,
      &quot;&amp;#1073;&quot; =&gt; &quot;b&quot;,
      &quot;&amp;#1042;&quot; =&gt; &quot;v&quot;,
      &quot;&amp;#1074;&quot; =&gt; &quot;v&quot;,
      &quot;&amp;#1043;&quot; =&gt; &quot;g&quot;,
      &quot;&amp;#1075;&quot; =&gt; &quot;g&quot;,
      &quot;&amp;#1044;&quot; =&gt; &quot;d&quot;,
      &quot;&amp;#1076;&quot; =&gt; &quot;d&quot;,
      &quot;&amp;#1045;&quot; =&gt; &quot;e&quot;,
      &quot;&amp;#1077;&quot; =&gt; &quot;e&quot;,
      &quot;&amp;#1025;&quot; =&gt; &quot;yo&quot;,
      &quot;&amp;#1105;&quot; =&gt; &quot;yo&quot;,
      &quot;&amp;#1046;&quot; =&gt; &quot;zh&quot;,
      &quot;&amp;#1078;&quot; =&gt; &quot;zh&quot;,
      &quot;&amp;#1047;&quot; =&gt; &quot;z&quot;,
      &quot;&amp;#1079;&quot; =&gt; &quot;z&quot;,
      &quot;&amp;#1048;&quot; =&gt; &quot;i&quot;,
      &quot;&amp;#1080;&quot; =&gt; &quot;i&quot;,
      &quot;&amp;#1049;&quot; =&gt; &quot;j&quot;,
      &quot;&amp;#1081;&quot; =&gt; &quot;j&quot;,
      &quot;&amp;#1050;&quot; =&gt; &quot;k&quot;,
      &quot;&amp;#1082;&quot; =&gt; &quot;k&quot;,
      &quot;&amp;#1051;&quot; =&gt; &quot;l&quot;,
      &quot;&amp;#1083;&quot; =&gt; &quot;l&quot;,
      &quot;&amp;#1052;&quot; =&gt; &quot;m&quot;,
      &quot;&amp;#1084;&quot; =&gt; &quot;m&quot;,
      &quot;&amp;#1053;&quot; =&gt; &quot;n&quot;,
      &quot;&amp;#1085;&quot; =&gt; &quot;n&quot;,
      &quot;&amp;#1054;&quot; =&gt; &quot;o&quot;,
      &quot;&amp;#1086;&quot; =&gt; &quot;o&quot;,
      &quot;&amp;#1055;&quot; =&gt; &quot;p&quot;,
      &quot;&amp;#1087;&quot; =&gt; &quot;p&quot;,
      &quot;&amp;#1056;&quot; =&gt; &quot;r&quot;,
      &quot;&amp;#1088;&quot; =&gt; &quot;r&quot;,
      &quot;&amp;#1057;&quot; =&gt; &quot;s&quot;,
      &quot;&amp;#1089;&quot; =&gt; &quot;s&quot;,
      &quot;&amp;#1058;&quot; =&gt; &quot;t&quot;,
      &quot;&amp;#1090;&quot; =&gt; &quot;t&quot;,
      &quot;&amp;#1059;&quot; =&gt; &quot;u&quot;,
      &quot;&amp;#1091;&quot; =&gt; &quot;u&quot;,
      &quot;&amp;#1060;&quot; =&gt; &quot;f&quot;,
      &quot;&amp;#1092;&quot; =&gt; &quot;f&quot;,
      &quot;&amp;#1061;&quot; =&gt; &quot;h&quot;,
      &quot;&amp;#1093;&quot; =&gt; &quot;h&quot;,
      &quot;&amp;#1062;&quot; =&gt; &quot;c&quot;,
      &quot;&amp;#1094;&quot; =&gt; &quot;c&quot;,
      &quot;&amp;#1063;&quot; =&gt; &quot;ch&quot;,
      &quot;&amp;#1095;&quot; =&gt; &quot;ch&quot;,
      &quot;&amp;#1064;&quot; =&gt; &quot;sh&quot;,
      &quot;&amp;#1096;&quot; =&gt; &quot;sh&quot;,
      &quot;&amp;#1065;&quot; =&gt; &quot;sch&quot;,
      &quot;&amp;#1097;&quot; =&gt; &quot;sch&quot;,
      &quot;&amp;#1066;&quot; =&gt; &quot;&quot;,
      &quot;&amp;#1098;&quot; =&gt; &quot;&quot;,
      &quot;&amp;#1067;&quot; =&gt; &quot;i&quot;,
      &quot;&amp;#1099;&quot; =&gt; &quot;i&quot;,
      &quot;&amp;#1068;&quot; =&gt; &quot;&#039;&quot;,
      &quot;&amp;#1100;&quot; =&gt; &quot;&#039;&quot;,
      &quot;&amp;#1069;&quot; =&gt; &quot;e&quot;,
      &quot;&amp;#1101;&quot; =&gt; &quot;e&quot;,
      &quot;&amp;#1070;&quot; =&gt; &quot;yu&quot;,
      &quot;&amp;#1102;&quot; =&gt; &quot;yu&quot;,
      &quot;&amp;#1071;&quot; =&gt; &quot;ya&quot;,
      &quot;&amp;#1103;&quot; =&gt; &quot;ya&quot;,
  )));
}
function get_category_url($cat_id,$cat_url = &#039;&#039;)
{
  global $site_db, $cat_cache;
  static $urlname = array(); //cache names in this array
  if (isset($urlname[$cat_id]))
    return $urlname[$cat_id];
  if (!empty($cat_cache))
  {
    $row[&#039;cat_name&#039;] = @$cat_cache[$cat_id][&#039;cat_name&#039;];
    $row[&#039;cat_parent_id&#039;] = @$cat_cache[$cat_id][&#039;cat_parent_id&#039;];
  }
  else
  {
    $sql = &quot;SELECT cat_name,cat_parent_id FROM &quot;.CATEGORIES_TABLE.&quot; WHERE cat_id = &#039;&quot;.$cat_id.&quot;&#039;&quot;;
    $row = $site_db-&gt;query_firstrow($sql);
  }
  $row[&#039;cat_name&#039;] = fixname($row[&#039;cat_name&#039;]);
  $cat_url  = &#039;-&#039;.str_replace(&#039;+&#039;,&#039;-&#039;,urlencode($row[&#039;cat_name&#039;])).&#039;-&#039;.$cat_id.$cat_url;
  // if you want full path of category in url, put next line in comment
  $row[&#039;cat_parent_id&#039;] = 0;
  if($row[&#039;cat_parent_id&#039;] != 0)
  {
    $urlname[$cat_id] = get_category_url($row[&#039;cat_parent_id&#039;],$cat_url); 
  }
  else
  {
    $urlname[$cat_id] = $cat_url;
  }
  return $urlname[$cat_id];
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
  global $site_db;
  static $urlname = array(); //cache names in this array
  if (isset($urlname[$image_id]))
    return $urlname[$image_id];
  
  $sql = &quot;SELECT cat_id,image_name FROM &quot;.IMAGES_TABLE.&quot; WHERE image_id = &#039;&quot;.$image_id.&quot;&#039;&quot;;
  $row = $site_db-&gt;query_firstrow($sql);
  $row[&#039;image_name&#039;] = fixname($row[&#039;image_name&#039;]);
  // if you want comlpete path to image in url, remove comment from following line
  //$urlname[$image_id] = get_category_url($row[&#039;cat_id&#039;]).&#039;-&#039;.str_replace(&#039;+&#039;,&#039;-&#039;,urlencode($row[&#039;image_name&#039;])).&#039;-&#039;.$image_id;  
  $urlname[$image_id] = &#039;-&#039;.str_replace(&#039;+&#039;,&#039;-&#039;,urlencode($row[&#039;image_name&#039;])).&#039;-&#039;.$image_id;
  return $urlname[$image_id];
}</code></pre></div><br /><p>Категория:<br />_http://site.ru/cat-test-1.htm</p><p>Изображения:<br />1: _http://site.ru/img-ft-1.htm<br />2: _http://site.ru/img-test-1-ft-1.htm</p><p>Устраиваемый вид:</p><p>Категория:<br />_http://site.ru/test/</p><p>Изображения:<br />2: _http://site.ru/test/1.htm</p>]]></content>
			<author>
				<name><![CDATA[TITAN-UZ]]></name>
				<uri>https://talk.alaev.info/user/44/</uri>
			</author>
			<updated>2014-01-31T23:16:58Z</updated>
			<id>https://talk.alaev.info/post/7781/#p7781</id>
		</entry>
</feed>
