<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Статьи о программировании, все о программировании, исходники программ &#187; Excalibur</title>
	<atom:link href="http://statprog.ru/tag/excalibur/feed" rel="self" type="application/rss+xml" />
	<link>http://statprog.ru</link>
	<description>Авторские статьи, исходники программ.</description>
	<lastBuildDate>Mon, 23 Jan 2012 08:02:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Копирование музыки у друзей в SocialEngine Excalibur (Часть 2)</title>
		<link>http://statprog.ru/2009/09/13/kopirovanie-muzyki-u-druzej-v-socialengine-excalibur-chast-2</link>
		<comments>http://statprog.ru/2009/09/13/kopirovanie-muzyki-u-druzej-v-socialengine-excalibur-chast-2#comments</comments>
		<pubDate>Sun, 13 Sep 2009 15:30:58 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=356</guid>
		<description><![CDATA[Продолжаем говорить о моде “Копирование музыки у друзей”. В предыдущей статье я рассказал, как сделать эту возможность, но недавно обнаружена недоработка в этом моде, при удалении музыки владельцем удалялась она и у всех скопировавших эту музыку. Сейчас я расскажу, как сделать, чтобы при удалении музыки владельцем права и сама музыка копировались одному из его друзей, [...]]]></description>
			<content:encoded><![CDATA[<p>Продолжаем говорить о моде “<strong>Копирование музыки у друзей</strong>”. В предыдущей статье я рассказал, как сделать эту возможность, но недавно обнаружена недоработка в этом моде, при удалении музыки владельцем удалялась она и у всех скопировавших эту музыку.</p>
<p>Сейчас я расскажу, как сделать, чтобы при удалении музыки владельцем права и сама музыка копировались одному из его друзей, которые скопировали его музыку.</p>
<p>Здесь все просто, необходимо произвести изменения всего в одном файле.<span id="more-356"></span></p>
<p><strong>Открыть: class_music.</strong><strong>php</strong><strong></strong></p>
<p><strong>Подсказка:</strong> Данный файл находится в папке include.</p>
<p><strong>Найти</strong></p>
<pre class="brush: php; title: ; notranslate">music_delete($music_id)</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Полностью заменить функцию music_delete() начиная с function music_delete($music_id) и заканчивая return TRUE; }</p>
<pre class="brush: php; title: ; notranslate">function music_delete($music_id)
{
	global $database, $url, $user, $admin;
	if( $this-&gt;user_id )
	{
		$music = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT * FROM se_music WHERE music_user_id='{$this-&gt;user_id}' &amp;&amp; music_id='{$music_id}'&quot;));
	}

	elseif( $admin &amp;&amp; $admin-&gt;admin_exists )
	{
		$music = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT * FROM se_music WHERE music_id='{$music_id}'&quot;));
	}

	if( empty($music) )
		return FALSE;

	$music_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1&quot;));
	$owner_user_id = $music_tb[owner_user_id];

	if( strlen($owner_user_id) &gt; 0 )
	{
		if(strrchr($owner_user_id, ','))
		{
			$owner_user_id_text = explode(',', $owner_user_id);
			$owner_user_id_db = &quot;&quot;;
			$new_user_music = &quot;&quot;;
			foreach($owner_user_id_text as $owner_user_id)
			{
				if($new_user_music == &quot;&quot;)
					$new_user_music = $owner_user_id;

				if($owner_user_id != $new_user_music)
					$owner_user_id_db = $owner_user_id_db . &quot;&quot; . $owner_user_id . &quot;,&quot;;
			}
			$owner_user_id_db = trim(substr_replace($owner_user_id_db, &quot;&quot;, strlen($owner_user_id_db) - 1));
		}
		else
		{
			$new_user_music = $owner_user_id;
			$owner_user_id_db = '';
		}
		$userdir_old = $url-&gt;url_userdir($music['music_user_id']);
		$music_file_old = &quot;{$userdir_old}{$music['music_id']}.{$music['music_ext']}&quot;;
		$userdir_new = $url-&gt;url_userdir($new_user_music);
		$music_file_new = &quot;{$userdir_new}{$music['music_id']}.{$music['music_ext']}&quot;;

		if( file_exists($music_file_old) )
		{
			copy($music_file_old, $music_file_new);
			unlink($music_file_old);
		}
		$database-&gt;database_query(&quot;UPDATE `se_music` SET `music_user_id` = '{$new_user_music}', `owner_user_id` = '{$owner_user_id_db}' WHERE `music_id` = '{$music_id}' LIMIT 1&quot;);
	}
	else
	{
		$userdir = $url-&gt;url_userdir($music['music_user_id']);
		$music_file = &quot;{$userdir}{$music['music_id']}.{$music['music_ext']}&quot;;
		$database-&gt;database_query(&quot;DELETE FROM se_music WHERE music_id='{$music_id}' LIMIT 1&quot;);
		if( file_exists($music_file) )
			unlink($music_file);
	}
	return TRUE;
}</pre>
<blockquote><p>Данную статью Вы также можете скачать в формате doc:<br />
<a href="http://statprog.ru/wp-content/copy_music_SocialEngine_Excalibur_2.rar">скачать</a></p></blockquote>
<blockquote><p><strong>Автор:<em> Евтеев Евгений Александрович</em></strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/09/13/kopirovanie-muzyki-u-druzej-v-socialengine-excalibur-chast-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Плагин музыка &#8212; копирование музыки у друзей в SocialEngine Excalibur</title>
		<link>http://statprog.ru/2009/08/30/plagin-muzyka-kopirovanie-muzyki-u-druzej-v-socialengine-excalibur</link>
		<comments>http://statprog.ru/2009/08/30/plagin-muzyka-kopirovanie-muzyki-u-druzej-v-socialengine-excalibur#comments</comments>
		<pubDate>Sun, 30 Aug 2009 04:37:40 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=349</guid>
		<description><![CDATA[В этой статье поговорим о плагине “Музыка”, а именно о копировании музыки у друзей. А что тут говорить, такой возможности в плагине “Музыка” нет, так вот я покажу, как в несколько шагов реализовать такую возможность. Так сказать модифицируем плагин Музыка такие образом, чтобы он поддерживал возможность &#171;Копирование музыки у друзей&#171;. Копирование музыки у друзей Сначала [...]]]></description>
			<content:encoded><![CDATA[<p>В этой статье поговорим о плагине “<strong>Музыка</strong>”, а именно о копировании музыки у друзей. А что тут говорить, такой возможности в плагине “Музыка” нет, так вот я покажу, как в несколько шагов реализовать такую возможность. Так сказать модифицируем плагин Музыка такие образом, чтобы он поддерживал возможность &#171;<strong>Копирование музыки у друзей</strong>&#171;.<span id="more-349"></span></p>
<h2>Копирование музыки у друзей</h2>
<p>Сначала необходимо добавить еще одно поле в таблицу «se_music», где хранятся записи о добавленным песнях. Выполним sql-запрос:</p>
<pre class="brush: sql; title: ; notranslate">ALTER TABLE `se_music` ADD `owner_user_id` text AFTER `music_user_id`</pre>
<p>Для работы функции «is_already_music()», которая возвращает логическую ложь в том случае, если у участника нет данной песни в его коллекции, пропишем ее в класс «user».</p>
<ol>
<li><strong>Открыть: class_user.php</strong><br />
<strong>Подсказка:</strong> Данный файл находится в папке include.<br />
<strong>Найти</strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть. Данная часть кода находится внутри функции user_message_view ().</p>
<pre class="brush: php; title: ; notranslate">return array
    (
      'collaborators' =&gt; &amp;$collaborators,
      'pms'           =&gt; &amp;$pms
    );
  }
</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">function is_already_music($music_id)
{
	global $database;

	$music_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1&quot;));
	$owner_user_id = $music_tb[owner_user_id];

	if(substr_count($owner_user_id, $this-&gt;user_info['user_id']) == 0)
		return 0;
	else
		return 1;
	return 1;
}
</pre>
<p>Далее уже будем работать с файлами, отвечающими за вывод и добавление музыки.</li>
<li><strong>Открыть</strong>: <strong>class_music.php</strong><br />
<strong>Найти</strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть. Данная часть кода находится внутри функции music_list ().</p>
<pre class="brush: php; title: ; notranslate">if( $this-&gt;user_id ) $sql .= &quot;
      WHERE
        se_music.music_user_id='{$this-&gt;user_id}'
    &quot;;
</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">if( $this-&gt;user_id ) $sql .= &quot;
      WHERE
        se_music.music_user_id='{$this-&gt;user_id}' OR FIND_IN_SET('{$this-&gt;user_id}', owner_user_id)&quot;;</pre>
</li>
<li><strong>Открыть</strong><strong>: browse_music.php</strong><br />
<strong>Найти </strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">$music_object = new se_music();</pre>
<p><strong>Добавить</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке перед ранее найденными строками.</p>
<pre class="brush: php; title: ; notranslate">$music_id = $_GET['music_id'];
if( $_GET['task'] == &quot;copy&quot; &amp;&amp; $music_id &gt; 0)
{
	ob_end_clean();

	$music_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1&quot;));
	$owner_user_id = trim($music_tb[owner_user_id]);

	if(strrchr($owner_user_id, ','))
	{
		$owner_user_id_text = explode(',', $owner_user_id);
		$owner_user_id_update = &quot;&quot;;
		foreach($owner_user_id_text as $owner_user_id)
		{
			if($owner_user_id != $user-&gt;user_info['user_id'])
				$owner_user_id_update = $owner_user_id_update . &quot;&quot; . $owner_user_id . &quot;,&quot;;
		}
		$owner_user_id_update = $owner_user_id_update . &quot;&quot; . $user-&gt;user_info['user_id'];
	}
	else
	{
		if($owner_user_id == $user-&gt;user_info['user_id'] || strlen($owner_user_id) == 0)
			$owner_user_id_update = $user-&gt;user_info['user_id'];
		if( strlen($owner_user_id) &gt; 0 )
			$owner_user_id_update = $owner_user_id . &quot;,&quot; . $user-&gt;user_info['user_id'];
	}
	$database-&gt;database_query(&quot;UPDATE `se_music` SET `owner_user_id` = '{$owner_user_id_update}' WHERE `music_id` = '{$music_id}' LIMIT 1&quot;);
}</pre>
</li>
<li><strong>Открыть</strong><strong>: user_music.php</strong><br />
<strong>Найти </strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">$musiclist = $music-&gt;music_list();</pre>
<p><strong>Добавить</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке перед ранее найденными строками.</p>
<pre class="brush: php; title: ; notranslate">if( $task == &quot;removesong&quot; &amp;&amp; $music_id &gt; 0)
{
	ob_end_clean();

	$music_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1&quot;));
	$owner_user_id = $music_tb[owner_user_id];

	if(strrchr($owner_user_id, ','))
	{
		$owner_user_id_text = explode(',', $owner_user_id);
		$owner_user_id_db = &quot;&quot;;
		foreach($owner_user_id_text as $owner_user_id)
		{
			if($owner_user_id != $user-&gt;user_info['user_id'])
				$owner_user_id_db = $owner_user_id_db . &quot;&quot; . $owner_user_id . &quot;,&quot;;
		}
		$owner_user_id_db = trim(substr_replace($owner_user_id_db, &quot;&quot;, strlen($owner_user_id_db) - 1));
	}
	else
	{
		if($owner_user_id == $user-&gt;user_info['user_id'])
			$owner_user_id_text = '';
	}
	$database-&gt;database_query(&quot;UPDATE `se_music` SET `owner_user_id` = '{$owner_user_id_db}' WHERE `music_id` = '{$music_id}' LIMIT 1&quot;);
}
</pre>
</li>
<li><strong>Открыть</strong><strong>: <span>browse_music.tpl</span></strong><br />
<strong>Найти </strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">{if $user-&gt;user_exists &amp;&amp; $user-&gt;level_info.level_music_allow_downloads}&lt;/pre&gt;
&lt;div style=&quot;margin-top: 4px;&quot;&gt;&lt;a type=&quot;application/force-download&quot; href=&quot;{$media_path}&quot;&gt;{lang_print id=4000095}&lt;/a&gt;&lt;/div&gt;
&lt;pre&gt;
        {/if}
</pre>
<p><strong>Добавить после</strong><br />
 <strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">
{if $user-&gt;user_friended($browse_music_list[browse_music_list_loop].user_id, 1) &amp;&amp; $user-&gt;is_already_music($browse_music_list[browse_music_list_loop].music_id) == 0}&lt;/pre&gt;
&lt;div style=&quot;font-weight: bold; font-size: 8pt; text-align: right;&quot;&gt;&lt;a title=&quot;Скопировать музыку к себе&quot; href=&quot;browse_music.php?task=copy&amp;music_id={$browse_music_list[browse_music_list_loop].music_id}&quot;&gt;Копировать&lt;/a&gt;&lt;/div&gt;
&lt;pre&gt;
 {/if}
</pre>
</li>
<li><strong>Открыть</strong><strong>: user_music.tpl</strong><br />
<strong>Найти </strong><br />
<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">{assign var='media_dir' value=$url-&gt;url_userdir($user-&gt;user_info.user_id)}
{section name=music_loop loop=$musiclist}
</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">{section name=music_loop loop=$musiclist}
      {assign var='media_dir' value=$url-&gt;url_userdir($musiclist[music_loop].music_user_id)}
</pre>
<p><strong>Найти </strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">&lt;input type=&quot;checkbox&quot; name=&quot;delete_music_{$musiclist[music_loop].music_id}&quot; value=&quot;1&quot; /&gt;</pre>
<p><strong>Заменить</strong><strong> </strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">{if $musiclist[music_loop].music_user_id == $user-&gt;user_info.user_id}&lt;input type=&quot;checkbox&quot; name=&quot;delete_music_{$musiclist[music_loop].music_id}&quot; value=&quot;1&quot; /&gt;{/if}</pre>
<p><strong>Найти </strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">&lt;span class=&quot;seMusicTitleEdit&quot;&gt; (&lt;a onclick=&quot;SocialEngine.Music.editMusicTitle({$musiclist[music_loop].music_id});&quot; href=&quot;javascript:void(0);&quot;&gt;{lang_print id=187}&lt;/a&gt;)&lt;/span&gt;</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">{if $musiclist[music_loop].music_user_id == $user-&gt;user_info.user_id}&lt;span class=&quot;seMusicTitleEdit&quot;&gt; (&lt;a onclick=&quot;SocialEngine.Music.editMusicTitle({$musiclist[music_loop].music_id});&quot; href=&quot;javascript:void(0);&quot;&gt;{lang_print id=187}&lt;/a&gt;)&lt;/span&gt;{/if}</pre>
<p>&nbsp;</p>
<p><strong>Найти </strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">&lt;span class=&quot;seMusicDelete&quot;&gt;&lt;a onclick=&quot;SocialEngine.Music.deleteMusic({$musiclist[music_loop].music_id});&quot; href=&quot;javascript:void(0);&quot;&gt;{lang_print id=155}&lt;/a&gt; &lt;/span&gt;</pre>
<p><strong>Заменить</strong><strong> </strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">{if $musiclist[music_loop].music_user_id == $user-&gt;user_info.user_id}
&lt;span class=&quot;seMusicDelete&quot;&gt;&lt;a onclick=&quot;SocialEngine.Music.deleteMusic({$musiclist[music_loop].music_id});&quot; href=&quot;javascript:void(0);&quot;&gt;{lang_print id=155}&lt;/a&gt; &lt;/span&gt;
{else}
&lt;span class=&quot;seMusicDelete&quot;&gt;&lt;a href=&quot; user_music.php?task=removesong&amp;music_id={$musiclist[music_loop].music_id}&quot;&gt;{lang_print id=155}&lt;/a&gt; &lt;/span&gt;
{/if}
</pre>
</li>
</ol>
<p>Готово! Теперь на странице «browse_music.php» напротив музыки будет показана ссылка «Копировать» в том случае, если ее нет у участника. На странице «user_music.php» можно будет удалить музыку, которую скопировали от друзей.</p>
<blockquote><p>Если удобнее читать данную статью в программе Word, можно скачать по ссылке <a title="Плагин музыка – копирование музыки у друзей в SocialEngine Excalibur" href="http://statprog.ru/wp-content/kopirovanie-muzyki.rar" target="_blank">Плагин музыка – копирование музыки у друзей в SocialEngine Excalibur</a></p></blockquote>
<blockquote><p><strong>Автор:<em> Евтеев Евгений Александрович</em></strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/08/30/plagin-muzyka-kopirovanie-muzyki-u-druzej-v-socialengine-excalibur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Добавление фотографии к участникам в блоке &#8216;Сейчас на сайте&#8217; в SocialEngine Excalibur</title>
		<link>http://statprog.ru/2009/08/21/dobavlenie-fotografii-k-uchastnikam-v-bloke-sejchas-na-sajte-v-socialengine-excalibur</link>
		<comments>http://statprog.ru/2009/08/21/dobavlenie-fotografii-k-uchastnikam-v-bloke-sejchas-na-sajte-v-socialengine-excalibur#comments</comments>
		<pubDate>Fri, 21 Aug 2009 17:11:32 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=340</guid>
		<description><![CDATA[В движке SocialEngine в блоке &#8216;Сейчас на сайте&#8216; отображаются имя и фамилия участников, которые в данный момент находятся на сайте. Отображение только этих данных как-то ухудшают видимость этого блока, с помощью внедрения в код нескольких строчек и в этом блоке будет отображаться и фотография участника наряду с именем и фамилией. Что для этого нужно сделать? [...]]]></description>
			<content:encoded><![CDATA[<p>В движке <strong>SocialEngine</strong> в блоке &#8216;<strong>Сейчас на сайте</strong>&#8216; отображаются имя и фамилия участников, которые в данный момент находятся на сайте. Отображение только этих данных как-то ухудшают видимость этого блока, с помощью внедрения в код нескольких строчек и в этом блоке будет отображаться и фотография участника наряду с именем и фамилией.</p>
<p>Что для этого нужно сделать?<span id="more-340"></span></p>
<ol>
<li><strong>Открыть: functions_general.php</strong>
<p><strong>Подсказка:</strong> Данный файл находится в папке include.</p>
<p><strong>Найти</strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть. Данная строка находится внутри функции online_users().</p>
<pre class="brush: php; title: ; notranslate">$online_user-&gt;user_info['user_displayname'] = $online_user_info['user_displayname'];</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">$view_user_photo = $database-&gt;database_query(&quot;SELECT user_id, user_photo FROM se_users WHERE user_id='&quot; . $online_user_info['user_id'] . &quot;' LIMIT 1&quot;);

$views_user_photo = $database-&gt;database_fetch_assoc($view_user_photo);

$online_user-&gt;user_info['user_photo'] = $views_user_photo['user_photo'];</pre>
</li>
<li><strong>Открыть:</strong> <strong>user_home.tpl</strong>
<p>	<strong>Найти</strong></p>
<pre class="brush: php; title: ; notranslate">&lt;a href='{$url-&gt;url_create(&quot;profile&quot;, $online_users[0][online_loop]-&gt;user_info.user_username)}'&gt;{$online_users[0][online_loop]-&gt;user_displayname}&lt;/a&gt;</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">&lt;center&gt;&lt;img class='reflect' src='{$online_users[0][online_loop]-&gt;user_photo(&quot;./images/nophoto.gif&quot;)}' border='0'&gt;&lt;br&gt; &lt;a href='{$url-&gt;url_create(&quot;profile&quot;, $online_users[0][online_loop]-&gt;user_info.user_username)}'&gt;{$online_users[0][online_loop]-&gt;user_displayname}&lt;/a&gt;&lt;/center&gt;</pre>
</li>
</ol>
<blockquote><p><strong>Автор:<em> Евтеев Евгений Александрович</em></strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/08/21/dobavlenie-fotografii-k-uchastnikam-v-bloke-sejchas-na-sajte-v-socialengine-excalibur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Улучшенный поиск по группам в SocialEngine Excalibur</title>
		<link>http://statprog.ru/2009/08/15/uluchshennyj-poisk-po-gruppam-v-socialengine-excalibur</link>
		<comments>http://statprog.ru/2009/08/15/uluchshennyj-poisk-po-gruppam-v-socialengine-excalibur#comments</comments>
		<pubDate>Sat, 15 Aug 2009 14:54:44 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=338</guid>
		<description><![CDATA[В этой статье я расскажу, как сделать поиск по группам с такими параметрами как точный и приблизительный поиск с поиском по названию, описанию и лидеру группы. Сделать это очень просто: несколько строчек кода на php, пару sql-запросов и несколько полей в html. Выполним пару действий шаг за шагом: Открыть: browse_groups.php Найти Подсказка: Возможно, здесь приведена [...]]]></description>
			<content:encoded><![CDATA[<p>В этой статье я расскажу, как сделать поиск по группам с такими параметрами как точный и приблизительный <strong>поиск</strong> с поиском по названию, описанию и лидеру <strong>группы</strong>. Сделать это очень просто: несколько строчек кода на <strong>php</strong>, пару <strong>sql-запросов</strong> и несколько полей в <strong>html</strong>.<span id="more-338"></span></p>
<p>Выполним пару действий шаг за шагом:</p>
<ol>
<li><strong>Открыть: browse_groups.</strong><strong>php</strong><br />
	<strong>Найти</strong><br />
	<strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">
		else
		{
			$where .= &quot; AND se_groups.group_groupcat_id='{$groupcat['groupcat_id']}'&quot;;
			$groupsubcat = $groupcat;
			$groupcat = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT groupcat_id, groupcat_title FROM se_groupcats WHERE groupcat_id='{$groupcat['groupcat_dependency']}' LIMIT 1&quot;));
		}
	}
}</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">//GROUPS SEARCH
if(isset($_POST['submit']) &amp;&amp; $_POST['field_search'] != '')
{
	if($_POST['type_search2'] == 0)
		$search_f = &quot;group_title&quot;;
	elseif($_POST['type_search2'] == 1)
		$search_f = &quot;group_desc&quot;;
	else
	{
		$user_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT user_id FROM se_users WHERE user_fname LIKE '%&quot; . $_POST['field_search'] . &quot;%' LIMIT 1&quot;));
		$_POST['field_search'] = $user_tb[user_id];
		$search_f = &quot;group_user_id&quot;;
	}

	if($_POST['type_search'] == 1)
		$search_f2 = &quot;= '&quot; . $_POST['field_search'] . &quot;'&quot;;
	else
		$search_f2 = &quot;LIKE '%&quot; . $_POST['field_search'] . &quot;%'&quot;;

	$where .= &quot; AND se_groups.{$search_f} {$search_f2}&quot;;
}

//END GROUPS SEARCH</pre>
</li>
<li><strong>Открыть: browse_groups.tpl</strong><strong>Найти</strong>
<pre class="brush: php; title: ; notranslate">&lt;div style='text-align: center; line-height: 12pt; margin-top: 5px;'&gt;
{lang_print}&amp;nbsp;
&lt;select class='group_small' name='s' onchange=&quot;window.location.href='browse_groups.php?v={$v}&amp;s='+this.options[this.selectedIndex].value;&quot;&gt;
&lt;option value='group_totalmembers DESC'{if $s == &quot;group_totalmembers DESC&quot;} SELECTED{/if}&gt;{lang_print}&lt;/option&gt;
&lt;option value='group_datecreated DESC'{if $s == &quot;group_datecreated DESC&quot;} SELECTED{/if}&gt;{lang_print id=2000130}&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: xml; title: ; notranslate">&lt;form action='browse_groups.php' method='post'&gt;
&lt;div style='margin-top: 10px; padding: 10px; background: #F2F2F2; border: 1px solid #BBBBBB; font-weight: bold;'&gt;
&lt;div style='text-align: center; line-height: 12pt;'&gt;Поиск групп:&lt;/div&gt;
&lt;div style='text-align: left; line-height: 12pt; margin-top: 5px; border: 1px solid #BBBBBB;'&gt;
&lt;input type='radio' name='type_search' value='1' CHECKED&gt;Точный поиск
&lt;br&gt;
&lt;input type='radio' name='type_search' value='0'&gt;Приблизительный
&lt;/div&gt;
&lt;div style='text-align: left; line-height: 12pt; margin-top: 5px; border: 1px solid #BBBBBB;'&gt;
&lt;input type='radio' name='type_search2' value='0' CHECKED&gt;По названию
&lt;br&gt;
&lt;input type='radio' name='type_search2' value='1'&gt;По описанию
&lt;br&gt;
&lt;input type='radio' name='type_search2' value='2'&gt;По лидеру
&lt;/div&gt;
&lt;div style='text-align: center; line-height: 12pt; margin-top: 5px; '&gt;
&lt;input type='input' name='field_search' value='' style='width: 180px;'&gt;
&lt;br&gt;&lt;br&gt;
&lt;input type='submit' name='submit' value='Выполнить поиск'&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/form&gt;</pre>
</li>
</ol>
<p>После выполнения этих простых действий на странице обзора групп появятся новые поля для лучшего поиска групп по различным критериям.</p>
<blockquote><p><strong>Автор:<em> Евтеев Евгений Александрович</em></strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/08/15/uluchshennyj-poisk-po-gruppam-v-socialengine-excalibur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Добавление полей страна, регион и город в расширенный поиск в SocialEngine Excalibur</title>
		<link>http://statprog.ru/2009/08/15/dobavlenie-polej-strana-region-i-gorod-v-rasshirennyj-poisk-v-socialengine-excalibur</link>
		<comments>http://statprog.ru/2009/08/15/dobavlenie-polej-strana-region-i-gorod-v-rasshirennyj-poisk-v-socialengine-excalibur#comments</comments>
		<pubDate>Sat, 15 Aug 2009 09:56:37 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=332</guid>
		<description><![CDATA[В прошлой статье я рассказал Вам о решении проблемы с добавлением полей страна, регион и город в профиль в движок SocialEngine Excalibur, сегодня мы добавим эти поля в расширенный поиск – это тоже немало важный апгрейд. Написание этой статьи меня подтолкнул вопрос, зачем нужны поля страна, регион и город в профиле участника, если нет возможности [...]]]></description>
			<content:encoded><![CDATA[<p>В прошлой статье я рассказал Вам о решении проблемы с добавлением полей <strong>страна</strong>, <strong>регион</strong> и <strong>город</strong> в профиль в <strong>движок</strong> <strong>SocialEngine Excalibur</strong>, сегодня мы добавим эти поля в <strong>расширенный поиск</strong> – это тоже немало важный апгрейд. Написание этой статьи меня подтолкнул вопрос, зачем нужны поля <strong>страна</strong>, <strong>регион</strong> и <strong>город</strong> в профиле участника, если нет возможности найти участников, используя данные поля?<span id="more-332"></span></p>
<p>Для добавления данных полей необходимо выполнить пару шагов:</p>
<ol>
<li>
<strong>Открыть: search_advanced.php</strong></p>
<p><strong>Найти</strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">$search_query = &quot;SELECT se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname, se_users.user_photo
FROM se_profilevalues LEFT JOIN se_users ON se_profilevalues.profilevalue_user_id=se_users.user_id
LEFT JOIN se_levels ON se_levels.level_id=se_users.user_level_id
WHERE se_users.user_profilecat_id='{$cat_selected}' AND se_users.user_verified='1' AND se_users.user_enabled='1' AND (se_users.user_search='1' OR se_levels.level_profile_search='0')&quot;;

if($user_online == 1) {
	$search_query .= &quot; AND user_lastactive&gt;'&quot;.(time()-10*60).&quot;' AND user_invisible=0&quot;;
}

if($user_withphoto == 1) {
	$search_query .= &quot; AND user_photo &lt;&gt; ''&quot;;
}

if($field-&gt;field_query != &quot;&quot;) {
	$search_query .= &quot; AND &quot;.$field-&gt;field_query;
}</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">$search_query = &quot;SELECT se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname, se_users.user_photo
FROM se_profilevalues LEFT JOIN se_users ON se_profilevalues.profilevalue_user_id=se_users.user_id
LEFT JOIN se_levels ON se_levels.level_id=se_users.user_level_id
LEFT JOIN cites_profilevalues ON se_profilevalues.profilevalue_user_id=cites_profilevalues.profilevalue_id
WHERE se_users.user_profilecat_id='{$cat_selected}' AND se_users.user_verified='1' AND se_users.user_enabled='1' AND (se_users.user_search='1' OR se_levels.level_profile_search='0')&quot;;

if($user_online == 1) {
	$search_query .= &quot; AND user_lastactive&gt;'&quot;.(time()-10*60).&quot;' AND user_invisible=0&quot;;
}

if($user_withphoto == 1)
	$search_query .= &quot; AND user_photo &lt;&gt; ''&quot;;

if($field-&gt;field_query != &quot;&quot;)
	$search_query .= &quot; AND se_profilevalues.&quot;.$field-&gt;field_query;

if(isset($_POST['dhtmlgoodies_country']) &amp;&amp; $_POST['dhtmlgoodies_country'] &gt; 0)
	$search_query .= &quot; AND cites_profilevalues.profilevalue_7 = '&quot; . $_POST['dhtmlgoodies_country'] . &quot;'&quot;;

if(isset($_POST['dhtmlgoodies_region']) &amp;&amp; $_POST['dhtmlgoodies_region'] &gt; 0)
	$search_query .= &quot; AND cites_profilevalues.profilevalue_8 = '&quot; . $_POST['dhtmlgoodies_region'] . &quot;'&quot;;

if(isset($_POST['dhtmlgoodies_city']) &amp;&amp; $_POST['dhtmlgoodies_city'] &gt; 0)
	$search_query .= &quot; AND cites_profilevalues.profilevalue_9 = '&quot; . $_POST['dhtmlgoodies_city'] . &quot;'&quot;;</pre>
<p><strong>Найти</strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: php; title: ; notranslate">	// SET GLOBAL PAGE TITLE
	$global_page_title[0] = 926;
	$global_page_description[0] = 1088;
}</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">// GET COUNTRY, REGION AND CITY
$sql = $database-&gt;database_query (&quot;SELECT * FROM country&quot;);
while ($country_bd = $database-&gt;database_fetch_assoc ($sql))
{
	if(isset($_POST['dhtmlgoodies_country']) &amp;&amp; $country_bd[country_id] == $_POST['dhtmlgoodies_country'])
		$country_sel = &quot; SELECTED&quot;;
	else
		$country_sel = &quot;&quot;;

	$country .= &quot;&lt;option value='&quot; . $country_bd[country_id] . &quot;'&quot; . $country_sel . &quot;'&quot; . $country_bd[name] . &quot;&lt;/option&gt;\n&quot;;
}

if(isset($_POST['dhtmlgoodies_region']))
{
	$region_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(«SELECT region_id, name FROM region WHERE region_id=’».$_POST['dhtmlgoodies_region'].»‘ LIMIT 1?));
	if(strlen($region_tb[name]) &gt; 1)
		$region .= &quot;&lt;option value='&quot; . $region_tb[region_id] . &quot;' SELECTED'&quot; . $region_tb[name] . &quot;&lt;/option&gt;\n&quot;;
}

if(isset($_POST['dhtmlgoodies_city']))
{
	$city_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT city_id, name FROM city WHERE city_id='&quot;.$_POST['dhtmlgoodies_city'].&quot;' LIMIT 1&quot;));
	if(strlen($city_tb[name]) &gt; 1)
		$city .= &quot;&lt;option value='&quot; . $city_tb[city_id] . &quot;' SELECTED&gt;» . $city_tb[name] . &quot;&lt;/option&gt;\n&quot;;
}

$smarty-&gt;assign('country', $country);
$smarty-&gt;assign('region', $region);
$smarty-&gt;assign('city', $city);
// END GET COUNTRY, REGION AND CITY</pre>
</li>
<li><strong>Открыть: search_advanced.tpl</strong>
<p><strong>Найти</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;/div&gt;
{/section}
{/section}
{/section}</pre>
<p><strong>Добавить после</strong><br />
<strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: xml; title: ; notranslate">&lt;table cellpadding='0' cellspacing='0' style='padding-top: 5px;'&gt;
&lt;tr&gt;&lt;td&gt;
&lt;div style='font-weight: bold; margin-top: 5px;'&gt;Страна проживания&lt;/div&gt;
&lt;select name='dhtmlgoodies_country' id='dhtmlgoodies_country' onchange=&quot;getRegionList(this.value);&quot;&gt;
&lt;option id='op' value='-1'&gt;[ Страна ]&lt;/option&gt;
{$country}&lt;/select&gt;
&lt;/div&gt;
&lt;div style='font-weight: bold; margin-top: 5px;'&gt;Регион проживания&lt;/div&gt;
&lt;select name='dhtmlgoodies_region' id='dhtmlgoodies_region' onchange=&quot;getCityList(this.value);&quot;&gt;
&lt;option id='op' value='-1'&gt;[ Регион ]&lt;/option&gt;
{$region}&lt;/select&gt;
&lt;/div&gt;
&lt;div style='font-weight: bold; margin-top: 5px;'&gt;Город проживания&lt;/div&gt;
&lt;select name='dhtmlgoodies_city' id='dhtmlgoodies_city'&gt;
&lt;option id='op' value='-1'&gt;[ Город ]&lt;/option&gt;
{$city}&lt;/select&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</pre>
</li>
</ol>
<p>Все! Найти участников теперь можно по стране, региону и городу проживания.</p>
<p><a href="http://statprog.ru/wp-content/dobavlenie-polyei-strana-region-i-gorod-v-rasshirennyi-poisk-v-SocialEngine-Ekskalibur.rar">Скачать статью в формате word (.doc)</a></p>
<p>Вы ожидали больше шагов? Извините, что все так просто. Если у Вас возникнут вопросы, пишите, разберемся.</p>
<blockquote><p><strong>Автор: <em>Евтеев Евгений Александрович</em></strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/08/15/dobavlenie-polej-strana-region-i-gorod-v-rasshirennyj-poisk-v-socialengine-excalibur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Добавление полей страна, регион и город в SocialEngine Excalibur</title>
		<link>http://statprog.ru/2009/08/12/dobavlenie-stran-regionov-i-gorodov-v-socialengine-excalibur</link>
		<comments>http://statprog.ru/2009/08/12/dobavlenie-stran-regionov-i-gorodov-v-socialengine-excalibur#comments</comments>
		<pubDate>Wed, 12 Aug 2009 10:50:32 +0000</pubDate>
		<dc:creator>evteev</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Excalibur]]></category>
		<category><![CDATA[SocialEngine]]></category>

		<guid isPermaLink="false">http://statprog.ru/?p=321</guid>
		<description><![CDATA[Мне и моему другу захотелось создать свою социальную сеть, перебрали множество движков и остановились на SocialEngine Excalibur 3.15. По нашему мнению, SocialEngine Excalibur &#8212; это отличный движок для создания своей социальной сети, множество настроек, плагинов, но самое главное &#8212; серьезно мощный и простой в понимании код скриптов. Если имеются знания в таких языках как html, [...]]]></description>
			<content:encoded><![CDATA[<p>Мне и моему другу захотелось создать свою социальную сеть, перебрали множество движков и остановились на <strong>SocialEngine Excalibur 3.15</strong>. По нашему мнению, <strong>SocialEngine Excalibur</strong> &#8212; это отличный движок для создания своей социальной сети, множество настроек, плагинов, но самое главное &#8212; серьезно мощный и простой в понимании код скриптов. Если имеются знания в таких языках как html, php и JavaScript, можно с легкостью переписать код скриптов <strong>SocialEngine</strong> под свои нужды.<span id="more-321"></span></p>
<p>У нас возникла проблема, когда необходимо было добавить новые поля в профиль участника: <strong>страну</strong>, <strong>регион</strong> и <strong>город</strong>. В скрипте <strong>SocialEngine Excalibur</strong>, который имеется у нас, была база с этими данными, в файлах присутствовал код, ответственен за работу с данными полями. Но возник вопрос, почему при редактировании профиля не было этих полей?</p>
<p>Сначала искали ответ на этот вопрос на форуме <strong>SocialEngine Excalibur</strong>, даже создали свою тему, но ответа так и не получили. Я решил, что ответ мы не получим и если получим, то не скоро. Было принято решение сделать все своими руками, применив знания программирования.</p>
<h3>SocialEngine Excalibur</h3>
<p>Для того чтобы поля «<strong>Страна</strong>», «<strong>Регион</strong>» и «<strong>Город</strong>» появились в <strong>SocialEngine Excalibur</strong> в разделе «<strong>Редактировать профиль</strong>» необходимо:</p>
<ol>
<li>Импортировать данные из файла <a href="http://statprog.ru/wp-content/cities.rar" target="_blank">cities.sql</a> в Вашу базу данных, выполнив <strong>запрос SQL</strong> или импорт файла целиком в <strong>phpmyadmin</strong>.</li>
<li><strong>Открыть: user_editprofile.tpl</strong>
<p><strong>Найти</strong></p>
<p><strong>Подсказка:</strong> Возможно, здесь приведена не вся строка, а лишь ее часть.</p>
<pre class="brush: xml; title: ; notranslate">&lt;div class='form_desc'&gt;
  {lang_print id=$fields[field_loop].field_desc}
&lt;/div&gt;

{capture assign='current_subnet'}
  {lang_print id=$user-&gt;subnet_info.subnet_name}
{/capture}

{if $fields[field_loop].field_id == $setting.setting_subnet_field1_id || $fields[field_loop].field_id == $setting.setting_subnet_field2_id}
  {lang_sprintf id=766 1=$current_subnet}
{/if}

{capture assign='field_error'}
  {lang_print id=$fields[field_loop].field_error}
{/capture}

{if $field_error != ''}
  &lt;div class='form_error'&gt;&lt;img src='./images/icons/error16.gif' border='0' class='icon'&gt; {$field_error}&lt;/div&gt;
{/if}
&lt;/td&gt;
&lt;/tr&gt;
{/section}</pre>
<p><strong>Добавить после</strong></p>
<p><strong>Подсказка:</strong> Добавьте эти строки на новой строке после ранее найденных строк.</p>
<pre class="brush: xml; title: ; notranslate">{if $cat_id == 3}
&lt;tr&gt;
&lt;td class='form1' width='150'&gt;Страна&lt;/td&gt;
&lt;td class='form2'&gt;
  &lt;div&gt;
    &lt;select name='dhtmlgoodies_country' id='dhtmlgoodies_country' onchange='getRegionList(this.value);'&gt;
      &lt;option id='op' value='-1'&gt;&lt;/option&gt;
      {$country}
    &lt;/select&gt;
  &lt;/div&gt;
  &lt;div id='dhtmlgoodies_country'&gt;
    Страна, в которой Вы в текущий момент проживаете.
  &lt;/div&gt;

  &lt;div class='form_desc'&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class='form1' width='150'&gt;Регион&lt;/td&gt;
  &lt;td class='form2'&gt;
    &lt;div&gt;
      &lt;select name='dhtmlgoodies_region' id='dhtmlgoodies_region' onchange='getCityList(this.value);'&gt;
        &lt;option id='op' value='-1'&gt;&lt;/option&gt;
        {$region}
      &lt;/select&gt;

    &lt;/div&gt;
    &lt;div id='dhtmlgoodies_region'&gt;
      Регион, в котором Вы в текущий момент проживаете.
    &lt;/div&gt;

    &lt;div class='form_desc'&gt;&lt;/div&gt;
  &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class='form1' width='150'&gt;Город&lt;/td&gt;
  &lt;td class='form2'&gt;
  &lt;div&gt;
    &lt;select name='dhtmlgoodies_city' id='dhtmlgoodies_city'&gt;
      &lt;option id='op' value='-1'&gt;&lt;/option&gt;
      {$city}
    &lt;/select&gt;
  &lt;/div&gt;
  &lt;div id='dhtmlgoodies_city'&gt;
    Город, в котором Вы в текущий момент проживаете.
  &lt;/div&gt;

  &lt;div class='form_desc'&gt;&lt;/div&gt;
  &lt;/td&gt;
&lt;/tr&gt;
{/if}</pre>
<p>Условие {if $cat_id == 3} отвечает за отображение полей только в подкатегории «Персональная информация», это нужно если Вы собираетесь создавать дополнительные подкатегории, как, например, у нас создана {$country}, {$region} и {$city} &#8212; данные, которые формируются php-скриптом в файле user_editprofile.php</li>
<li><strong>Открыть: header_global.tpl</strong>
<p><strong>Найти</strong></p>
<pre class="brush: jscript; title: ; notranslate">var countryCode = sel.options[sel.selectedIndex].value;</pre>
<p><strong>Заменить</strong><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: jscript; title: ; notranslate">var countryCode = sel;</pre>
<p><strong>Найти</strong></p>
<pre class="brush: jscript; title: ; notranslate">var regionCode = sel.options[sel.selectedIndex].value;</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: jscript; title: ; notranslate">var regionCode = sel;</pre>
</li>
</ol>
<p><strong>Открыть: user_editprofile.</strong><strong>php</strong></p>
<p><strong>Найти</strong></p>
<pre class="brush: php; title: ; notranslate">if( isset($_POST['dhtmlgoodies_country']) ) {

  $country = $_POST['dhtmlgoodies_country'];
  $sql = &quot;SELECT profilevalue_7 FROM cites_profilevalues WHERE profilevalue_id=$id_ex LIMIT 1&quot;;
  if( !$database-&gt;database_query($sql) ) {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_7) VALUES ($id_ex, '$country')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_7 = '$country' WHERE cites_profilevalues.profilevalue_id = $id_ex&quot;;
    $database-&gt;database_query($query);
  }
}

if( isset($_POST['dhtmlgoodies_region']) ) {
  $region = $_POST['dhtmlgoodies_region'];

  $sql = &quot;SELECT profilevalue_8 FROM cites_profilevalues WHERE profilevalue_id=$id_ex LIMIT 1&quot;;
  if( !$database-&gt;database_query($sql) ) {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_8) VALUES ($id_ex, '$region')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_8 = '$region' WHERE cites_profilevalues.profilevalue_id = $id_ex&quot;;
    $database-&gt;database_query($query);
  }
}

if( isset($_POST['dhtmlgoodies_city']) ) {
  $city = $_POST['dhtmlgoodies_city'];

  $sql = &quot;SELECT profilevalue_9 FROM cites_profilevalues WHERE profilevalue_id = $id_ex LIMIT 1&quot;;
  if( !$database-&gt;database_query($sql) ) {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_9) VALUES ($id_ex, '$city')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_9 = '$city' WHERE cites_profilevalues.profilevalue_id = $id_ex&quot;;
    $database-&gt;database_query($query);
  }
}</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">if( isset($_POST['dhtmlgoodies_country']) ) {

  $country = $_POST['dhtmlgoodies_country'];

  $country_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_id FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1&quot;));

  $country_id = $country_tb[profilevalue_id];

  if($country_id &lt;= 0) {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_7) VALUES ($id_ex, '$country')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_7 = '$country' WHERE cites_profilevalues.profilevalue_id = '&quot; . $user-&gt;user_info['user_id'] . &quot;'&quot;;
    $database-&gt;database_query($query);
  }
}

if( isset($_POST['dhtmlgoodies_region']) ) {
  $region = $_POST['dhtmlgoodies_region'];
  $region_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_id FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1&quot;));
  $region_id = $region_tb[profilevalue_id];

  if($region_id &lt;= 0)  {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_8) VALUES ($id_ex, '$region')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_8 = '$region' WHERE cites_profilevalues.profilevalue_id = '&quot; . $user-&gt;user_info['user_id'] . &quot;'&quot;;
    $database-&gt;database_query($query);
  }
}

if( isset($_POST['dhtmlgoodies_city']) ) {
  $city = $_POST['dhtmlgoodies_city'];
  $city_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_id FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1&quot;));
  $city_id = $city_tb[profilevalue_id];

  if($city_id &lt;= 0) {
    $query = &quot;INSERT INTO cites_profilevalues (profilevalue_id, profilevalue_9) VALUES ($id_ex, '$city')&quot;;
    $database-&gt;database_query($query);
  }
  else {
    $query = &quot;UPDATE cites_profilevalues SET profilevalue_9 = '$city' WHERE cites_profilevalues.profilevalue_id = '&quot; . $user-&gt;user_info['user_id'] . &quot;'&quot;;
    $database-&gt;database_query($query);
  }
}</pre>
<p><strong>Найти</strong></p>
<pre class="brush: php; title: ; notranslate">$sql = $database-&gt;database_query (&quot;SELECT * FROM country&quot;);
$countries = array();

while ($country = $database-&gt;database_fetch_assoc ($sql)) {
  $countries[] = $country;
}

$smarty-&gt;assign('countries', $countries);</pre>
<p><strong>Заменить</strong></p>
<p><strong>Подсказка</strong><strong>:</strong> Произведите замену ранее найденных строк.</p>
<pre class="brush: php; title: ; notranslate">$country_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_7 FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1&quot;));
$country_id = $country_tb[profilevalue_7];

$sql = $database-&gt;database_query (&quot;SELECT * FROM country&quot;);
while ($country_bd = $database-&gt;database_fetch_assoc ($sql)) {

	if($country_id == $country_bd[country_id])
		$country_sel = ' SELECTED';
	else
		$country_sel = '';

	$country .= &quot;&lt;option value='&quot; . $country_bd[country_id] . &quot;'&quot; . $country_sel . &quot;&gt;&quot; . $country_bd[name] . &quot;&lt;/option&gt;\n&quot;;

}

$region_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_8 FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1?));
$region_id = $region_tb[profilevalue_8];

if($region_id &gt; 0) {
	$region_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT region_id, name FROM region WHERE region_id='&quot; . $region_id . &quot;' LIMIT 1&quot;));
	$region .= &quot;&lt;option value='&quot; . $region_tb[region_id] . &quot;' SELECTED&gt;&quot; . $region_tb[name] . &quot;&lt;/option&gt;\n&quot;;
}
else {
	$sql = $database-&gt;database_query (&quot;SELECT * FROM region&quot;);
	while ($region_bd = $database-&gt;database_fetch_assoc ($sql)) {

		if($region_id == $region_bd[region_id])
			$region_sel = ' SELECTED';
		else
			$region_sel = '';

		$region .= &quot;&lt;option value='&quot; . $region_bd[region_id] . &quot;'&quot; . $region_sel . &quot;&gt;&quot; . $region_bd[name] . &quot;&lt;/option&gt;\n&quot;;
	}
}

$city_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT profilevalue_9 FROM cites_profilevalues WHERE profilevalue_id='&quot; . $user-&gt;user_info['user_id'] . &quot;' LIMIT 1&quot;));
$city_id = $city_tb[profilevalue_9];
if($city_id &gt; 0) {
	$city_tb = $database-&gt;database_fetch_assoc($database-&gt;database_query(&quot;SELECT city_id, name FROM city WHERE city_id='&quot; . $city_id . &quot;' LIMIT 1&quot;));
	$city .= &quot;&lt;option value='&quot; . $city_tb[city_id] . &quot;' SELECTED&gt;&quot; . $city_tb[name] . &quot;&lt;/option&gt;\n&quot;;
}

else {
	$sql = $database-&gt;database_query (&quot;SELECT * FROM city ORDER BY name ASC&quot;);
	while ($city_bd = $database-&gt;database_fetch_assoc($sql)) {

		if($city_id == $city_bd[city_id])
			$city_sel = ' SELECTED';
		else
			$city_sel = '';

		$city .= &quot;&lt;option value='&quot; . $city_bd[city_id] . &quot;'&quot; . $city_sel . &quot;&gt;&quot; . $city_bd[name] . &quot;&lt;/option&gt;\n&quot;;
	}
}

$smarty-&gt;assign('country', $country);
$smarty-&gt;assign('region', $region);
$smarty-&gt;assign('city', $city);</pre>
<p>Если Вы выполнили все действия правильно, то теперь участники Вашей социальной сети <strong>SocialEngine Excalibur</strong> могут указать в профиле страну, регион и город проживания.</p>
<p>Также данную статью можно <a href="http://statprog.ru/wp-content/add_country_region_city_se.rar" target="_blank">скачать</a> в формате doc.</p>
<p><strong>Автор:<em> Евтеев Евгений Александрович</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://statprog.ru/2009/08/12/dobavlenie-stran-regionov-i-gorodov-v-socialengine-excalibur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

