<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[PunBB по-русски &mdash; [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
		<link>http://punbb.ru/topic1336-reliz-rasshireniya-anycode-tool-100-beta.html</link>
		<description><![CDATA[Недавние сообщения в теме «[релиз расширения] AnyCode Tool (1.0.0 Beta)».]]></description>
		<lastBuildDate>Wed, 18 Aug 2010 13:22:08 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27952.html#p27952</link>
			<description><![CDATA[<p><img src="http://punbb.ru/img/smilies/roll.png" width="15" height="15" alt="roll" /> а может просто как то оформить в расширение и добавить языки)))</p>]]></description>
			<author><![CDATA[dummy@example.com (flashcat)]]></author>
			<pubDate>Wed, 18 Aug 2010 13:22:08 +0000</pubDate>
			<guid>http://punbb.ru/post27952.html#p27952</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27942.html#p27942</link>
			<description><![CDATA[<p><strong>KANekT</strong>, Радует, что всего такой минус %)</p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Fri, 13 Aug 2010 15:20:49 +0000</pubDate>
			<guid>http://punbb.ru/post27942.html#p27942</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27941.html#p27941</link>
			<description><![CDATA[<p>один минус хука - только русский текст.</p>]]></description>
			<author><![CDATA[dummy@example.com (KANekT)]]></author>
			<pubDate>Fri, 13 Aug 2010 11:27:11 +0000</pubDate>
			<guid>http://punbb.ru/post27941.html#p27941</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27940.html#p27940</link>
			<description><![CDATA[<p>Задача <a href="http://punbb.ru/post27788.html#p27788">http://punbb.ru/post27788.html#p27788</a><br />Решение: <strong>rep_posts</strong><br />Хук №1: <strong>vt_row_pre_display</strong><br /></p><div class="codebox"><pre><code>if(count($r_t[&#039;post_id&#039;])&gt;0) {
$y = 0;
for($i=0;$i&lt;count($r_t[&#039;post_id&#039;]);$i++) {
if($r_t[&#039;post_id&#039;][$i] == $cur_post[&#039;id&#039;]) {
$y++;
if($y == 1) {
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &quot;&lt;br/&gt;&lt;span class=rep_plus&gt;Положительно оценили:&lt;br/&gt;&quot;;
}
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &#039;&lt;a href=&quot;profile.php?id=&#039;.$r_t[&#039;u_id&#039;][$i].&#039;&quot;&gt;&#039;.$r_t[&#039;u&#039;][$i].&#039;&lt;/a&gt; &#039;;
        }
if($i+1 == count($r_t[&#039;post_id&#039;]))
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &#039;&lt;/span&gt;&#039;;
    }
}

if(count(@$r_m[&#039;post_id&#039;])&gt;0) {
$y = 0;
for($i=0;$i&lt;count($r_m[&#039;post_id&#039;]);$i++) {
if($r_m[&#039;post_id&#039;][$i] == $cur_post[&#039;id&#039;]) {
$y++;
if($y == 1) {
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &quot;&lt;br/&gt;&lt;span class=rep_minus&gt;Отрицательно оценили:&lt;br/&gt;&quot;;
}
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &#039;&lt;a href=&quot;profile.php?id=&#039;.$r_m[&#039;u_id&#039;][$i].&#039;&quot;&gt;&#039;.$r_m[&#039;u&#039;][$i].&#039;&lt;/a&gt; &#039;;
        }
if($i+1 == count($r_m[&#039;post_id&#039;]))
$forum_page[&#039;message&#039;][&#039;signature&#039;] .= &#039;&lt;/span&gt;&#039;;
    }
}</code></pre></div><p>Хук №2: <strong>vt_qr_get_posts</strong><br /></p><div class="codebox"><pre><code>$start_from = $forum_page[&#039;start_from&#039;];
$result_for_rep = $forum_db-&gt;query(&#039;SELECT id FROM &#039;.$forum_db-&gt;prefix.&#039;posts WHERE topic_id=&#039;.$id.&#039; GROUP BY id ORDER BY id LIMIT &#039;.$start_from.&#039;,&#039;.$forum_user[&#039;disp_posts&#039;]) or error(&#039;Unable to fetch post info&#039;, __FILE__, __LINE__, $forum_db-&gt;error());
while($r = $forum_db-&gt;fetch_assoc($result_for_rep)) {
$rall[&#039;id&#039;][] = $r[&#039;id&#039;];
}

$result_rep_ths = $forum_db-&gt;query(&#039;SELECT r.post_id, u.username, r.from_user_id FROM &#039;.$forum_db-&gt;prefix.&#039;reputation AS r INNER JOIN &#039;.$forum_db-&gt;prefix.&#039;users AS u ON u.id = r.from_user_id WHERE r.topic_id = &#039;.$id.&#039; and r.rep_plus = 1&#039;) or error(&#039;Unable to fetch reputation post info&#039;, __FILE__, __LINE__, $forum_db-&gt;error());
while($r = $forum_db-&gt;fetch_assoc($result_rep_ths)) {
$r_t[&#039;post_id&#039;][] = $r[&#039;post_id&#039;];
$r_t[&#039;u&#039;][] = $r[&#039;username&#039;];
$r_t[&#039;u_id&#039;][] = $r[&#039;from_user_id&#039;];
}

$result_rep_noths = $forum_db-&gt;query(&#039;SELECT r.post_id, u.username, r.from_user_id FROM &#039;.$forum_db-&gt;prefix.&#039;reputation AS r INNER JOIN &#039;.$forum_db-&gt;prefix.&#039;users AS u ON u.id = r.from_user_id WHERE r.topic_id = &#039;.$id.&#039; and r.rep_minus = 1&#039;) or error(&#039;Unable to fetch reputation post info&#039;, __FILE__, __LINE__, $forum_db-&gt;error());
while($r = $forum_db-&gt;fetch_assoc($result_rep_noths)) {
$r_m[&#039;post_id&#039;][] = $r[&#039;post_id&#039;];
$r_m[&#039;u&#039;][] = $r[&#039;username&#039;];
$r_m[&#039;u_id&#039;][] = $r[&#039;from_user_id&#039;];
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Fri, 13 Aug 2010 09:42:20 +0000</pubDate>
			<guid>http://punbb.ru/post27940.html#p27940</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27939.html#p27939</link>
			<description><![CDATA[<p>Хуки переименовать нельзя - неудобно.&nbsp; <img src="http://punbb.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Fri, 13 Aug 2010 08:00:21 +0000</pubDate>
			<guid>http://punbb.ru/post27939.html#p27939</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27926.html#p27926</link>
			<description><![CDATA[<p>Да, это существенный недостаток отсутствия шаблонной системы.<br />В данном случае придется сделать ход конём как-то так:<br />в хуке <strong>po_pre_post_contents</strong> перехватить буфер вывода и добавить свою строку:<br /></p><div class="codebox"><pre><code>$tpl_temp = forum_trim(ob_get_contents());
$tpl_temp = str_replace(&#039;type=&quot;text&quot; name=&quot;req_subject&quot;&#039;, &#039;type=&quot;text&quot; name=&quot;req_subject&quot;  OnBlur=&quot;getMyHTML(\&#039;searchrelated.php?value=\&#039; + document.getElementById(\&#039;afocus\&#039;).req_subject.value,\&#039;ajaxwrapper\&#039;)&#039; , $tpl_temp);
$tpl_main = str_replace(&#039;&lt;!-- forum_main --&gt;&#039;, $tpl_temp.&#039;&lt;!-- forum_main --&gt;&#039;, $tpl_main);
ob_end_clean();
ob_start();</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (hcs)]]></author>
			<pubDate>Sun, 08 Aug 2010 14:58:17 +0000</pubDate>
			<guid>http://punbb.ru/post27926.html#p27926</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27925.html#p27925</link>
			<description><![CDATA[<p>Хуки конечно хорошо, но вот допустим ситуация из файла post.php поля для темы<br /></p><div class="codebox"><pre><code> &lt;input id=&quot;fld&lt;?php echo $forum_page[&#039;fld_count&#039;] ?&gt;&quot; type=&quot;text&quot; name=&quot;req_subject&quot; value=&quot;&lt;?php if (isset($_POST[&#039;req_subject&#039;])) echo forum_htmlencode($subject); ?&gt;&quot; size=&quot;70&quot; maxlength=&quot;70&quot; /&gt;</code></pre></div><p>а я хочу чтобы оно выглядело так:<br /></p><div class="codebox"><pre><code>&lt;input id=&quot;fld&lt;?php echo $forum_page[&#039;fld_count&#039;] ?&gt;&quot; type=&quot;text&quot; OnBlur=&quot;getMyHTML(&#039;searchrelated.php?value=&#039; + document.getElementById(&#039;afocus&#039;).req_subject.value,&#039;ajaxwrapper&#039;)&quot; name=&quot;req_subject&quot; value=&quot;&lt;?php if (isset($_POST[&#039;req_subject&#039;])) echo forum_htmlencode($subject); ?&gt;&quot; size=&quot;70&quot; maxlength=&quot;70&quot; /&gt;</code></pre></div><p>Так и не понял, как без ручной правки добавить туда свои параметры...</p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sun, 08 Aug 2010 14:36:38 +0000</pubDate>
			<guid>http://punbb.ru/post27925.html#p27925</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27924.html#p27924</link>
			<description><![CDATA[<p>По-моему код этого хука, если это не хтмл, должен быть в тегах &lt;?php&nbsp; код хука&nbsp; ?&gt;<br />Удали его и вставь с тегами.</p><p><span style="color: #808080"><em>Добавлено спустя 2 минуты 12 секунд: </em></span></p><p>а. все ясно, там в коде идет закрывающий тег для textarea, вот он и закрыл настоящий textarea... Нужно подумать</p>]]></description>
			<author><![CDATA[dummy@example.com (hcs)]]></author>
			<pubDate>Sun, 08 Aug 2010 11:19:46 +0000</pubDate>
			<guid>http://punbb.ru/post27924.html#p27924</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27923.html#p27923</link>
			<description><![CDATA[<p><span class="postimg"><a href="http://punbb.ru/extensions/hcs_image_uploader/uploads/20000/7500/27923/p1598luie51nuv4lo1kk61ht0gpf1.jpg" class="thumb" rel="gallery27923" ><img src="http://punbb.ru/extensions/hcs_image_uploader/uploads/20000/7500/27923/thumb/p1598luie51nuv4lo1kk61ht0gpf1.jpg" /></a></span><br />Ошибки в обработке, как таковых их не видно... Но ничего нажать нельзя, кроме того как видно выводится не весь хук...</p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sun, 08 Aug 2010 11:05:05 +0000</pubDate>
			<guid>http://punbb.ru/post27923.html#p27923</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27922.html#p27922</link>
			<description><![CDATA[<p>где именно ошибки, в чем ошибки-то?? что значит не могу отредактировать? что за ошибки?</p>]]></description>
			<author><![CDATA[dummy@example.com (hcs)]]></author>
			<pubDate>Sun, 08 Aug 2010 10:46:08 +0000</pubDate>
			<guid>http://punbb.ru/post27922.html#p27922</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27921.html#p27921</link>
			<description><![CDATA[<p><strong>hcs</strong>, Ну я к тому, что оформлено вроде всё правильно, естественно в базе я его отредактирую как надо... Вопрос в том, что почему при редактировании получаю ошибки...</p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sun, 08 Aug 2010 10:41:49 +0000</pubDate>
			<guid>http://punbb.ru/post27921.html#p27921</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27920.html#p27920</link>
			<description><![CDATA[<p>Это то что тебе надо исправить? Где он лежит и что надо добавить?</p>]]></description>
			<author><![CDATA[dummy@example.com (hcs)]]></author>
			<pubDate>Sun, 08 Aug 2010 09:36:55 +0000</pubDate>
			<guid>http://punbb.ru/post27920.html#p27920</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27919.html#p27919</link>
			<description><![CDATA[<p>Не могу отредактировать хук:<br /></p><div class="codebox"><pre><code>if ($forum_page[&#039;is_admmod&#039;])
{ 
?&gt;
&lt;div class=&quot;txt-set set2&quot;&gt;
&lt;div class=&quot;txt-box textarea required&quot;&gt;
&lt;label&gt;&lt;span&gt;Moderator: &lt;/span&gt;&lt;/label&gt;
&lt;div class=&quot;txt-input&quot;&gt;
&lt;span class=&quot;fld-input&quot;&gt; 
&lt;textarea name=&quot;req_mod_note&quot; rows=&quot;2&quot; cols=&quot;95&quot; tabindex=&quot;&quot;&gt;
&lt;?php
echo forum_htmlencode(isset($_POST[&#039;req_mod_note&#039;]) ? $mod_note : $cur_post[&#039;mod_note&#039;])
?&gt;
&lt;/textarea&gt;
&lt;/span&gt;
&lt;/div&gt;

&lt;/div&gt;&lt;/div&gt;
&lt;?php
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sun, 08 Aug 2010 09:10:19 +0000</pubDate>
			<guid>http://punbb.ru/post27919.html#p27919</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27912.html#p27912</link>
			<description><![CDATA[<p>вопрос снят, нашел в примерах тут <br /></p><div class="codebox"><pre><code>$query[&#039;SELECT&#039;] .=&#039;, t.subject&#039;;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sat, 07 Aug 2010 16:13:08 +0000</pubDate>
			<guid>http://punbb.ru/post27912.html#p27912</guid>
		</item>
		<item>
			<title><![CDATA[Re: [релиз расширения] AnyCode Tool (1.0.0 Beta)]]></title>
			<link>http://punbb.ru/post27910.html#p27910</link>
			<description><![CDATA[<p>Опять будем переделывать моды от 1.2 и дальше <img src="http://punbb.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />Задача при редактировании сообщений администратором/модераторам отослать пользователю сообщение в ПМ с ссылкой на сообщение и тему.<br />Необходимо иметь установленное расширение pun_pm<br />Решение: <strong>mod_edit_alert_pm</strong><br />Хук: <strong>ed_pre_redirect</strong><br />Код:<br /></p><div class="codebox"><pre><code> // MOD EDITALERT begin
require FORUM_ROOT.&#039;lang/Russian/editalert.php&#039;;
if ($forum_page[&#039;is_admmod&#039;] &amp;&amp; $cur_post[&#039;poster_id&#039;] != $forum_user[&#039;id&#039;]) {
$subject = $lang_editalert[&#039;Subj Edit Alert&#039;];
$body = $lang_editalert[&#039;Message Edit Alert beg&#039;].&#039; [url]&#039;.forum_link($forum_url[&#039;post&#039;], $id).&#039;[/url] &#039;.$lang_editalert[&#039;Message Edit Alert mid&#039;].&#039; &quot;&#039;.$cur_post[&#039;subject&#039;].&#039;&quot; &#039;.$lang_editalert[&#039;Message Edit Alert end&#039;].&#039; &#039;.$forum_user[&#039;username&#039;].&#039;.&#039;;

// Get pun_pm_new_messages
$result = $forum_db-&gt;query(&#039;SELECT username, pun_pm_new_messages FROM &#039;.$forum_db-&gt;prefix.&#039;users WHERE id !=1 AND id=&#039;.$cur_post[&#039;poster_id&#039;]) or error(&#039;Unable to get user id&#039;, __FILE__, __LINE__, $forum_db-&gt;error());

// Send message
if(list($usermame, $pun_pm_new_messages) = $forum_db-&gt;fetch_row($result)) {

if($pun_pm_new_messages == &#039;NULL&#039;)
    $pun_pm_new_messages = 1;
else
    $pun_pm_new_messages = $pun_pm_new_messages + 1;

$receiver_id = $cur_post[&#039;poster_id&#039;];
$now = time();

// Save to DB
$query = array(
        &#039;INSERT&#039;                =&gt; &#039;sender_id, receiver_id, status, lastedited_at, read_at, subject, body&#039;,
        &#039;INTO&#039;                  =&gt; &#039;pun_pm_messages&#039;,
        &#039;VALUES&#039;                =&gt; $forum_user[&#039;id&#039;].&#039;, &#039;.$receiver_id.&#039;, \&#039;sent\&#039;, &#039;.$now.&#039;, 0, \&#039;&#039;.$forum_db-&gt;escape($subject).&#039;\&#039;, \&#039;&#039;.$forum_db-&gt;escape($body).&#039;\&#039;&#039;
                );
    $forum_db-&gt;query_build($query) or error(__FILE__, __LINE__);


$query = array(
        &#039;UPDATE&#039;        =&gt; &#039;users&#039;,
        &#039;SET&#039;           =&gt; &#039;pun_pm_new_messages = &#039;.$pun_pm_new_messages,
        &#039;WHERE&#039;         =&gt; &#039;id = &#039;.$receiver_id,
        );
    $forum_db-&gt;query_build($query) or error(__FILE__, __LINE__);

                                                        }
                                                                }
// MOD EDITALERT end</code></pre></div><p><span style="color: #808080"><em>Добавлено спустя 50 минут 49 секунд: </em></span></p><p>Кстати, вопрос к примеру взять файл viewtopic.php строка 276, там где идёт sql-запрос сообщения.<br />Как в этот запрос добавить свой столбец в SELECT? Столбец в таблице posts.</p>]]></description>
			<author><![CDATA[dummy@example.com (kmbxxx)]]></author>
			<pubDate>Sat, 07 Aug 2010 14:24:02 +0000</pubDate>
			<guid>http://punbb.ru/post27910.html#p27910</guid>
		</item>
	</channel>
</rss>
