Скрытие блоков в TorrentPier

Begemot

Пользователь
#1
Подскажите по скрытию блоков на страницах.

надо скрыть с управлением через админ панель. В админке все работает, в tpl тоже все обернул, как подключить php?

Скажите, какой код скинуть, выложу.

Делал по чуйке по примеру новостей))
 

Begemot

Пользователь
#3
Собственно, делаю страницу помощи сайту, которую вырезали из движка. Вроде называлась donate.php
Вот запрос:

Код:
CREATE TABLE IF NOT EXISTS `bb_helpsite` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `item` varchar(15) NOT NULL,
  `howmany` varchar(15) NOT NULL,
  `price` varchar(150) NOT NULL,
  KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=117 ;

INSERT INTO `bb_helpsite` (`id`, `item`, `howmany`, `price`) VALUES
(1, 'wmr', '', 'мой wmr'),
(2, 'wmu', '', 'мой wmu'),
(3, 'wmz', '', 'мой wmz'),
(4, 'wme', '', 'мой wme'),
(5, 'yandexmoney', '', 'мой wmr'),
(6, 'wmid', '', 'мой wmr');
(7, 'sumw', '', 'сумма для webmoney'),
(8, 'sumy', '', 'сумма для яндекс денег'),
(9, 'show_w', '', '1'),
(10, 'show_y', '', '1');
Код php файла админки:

Код:
<?php
if (!empty($setmodules))
{
    $module['HELPSITE']['PURSES_PROJECT'] = basename(__FILE__);
    return;
}
require('./pagestart.php');
if (isset($_POST["wmr"]))
{
$wmr = request_var('wmr', '');
$wmu  = request_var('wmu', '');
$wmz  = request_var('wmz', '');
$wme  = request_var('wme', '');
$yandexmoney  = request_var('yandexmoney', '');
$wmid  = request_var('wmid', '');
$sumw  = request_var('sumw', '');
$sumy  = request_var('sumy', '');
$show_w  = request_var('show_w', '');
$show_y  = request_var('show_y', '');
    DB()->query("UPDATE bb_helpsite SET price = '$wmr' WHERE item = 'wmr'");
    DB()->query("UPDATE bb_helpsite SET price = '$wmu' WHERE item = 'wmu'");
    DB()->query("UPDATE bb_helpsite SET price = '$wmz' WHERE item = 'wmz'");
    DB()->query("UPDATE bb_helpsite SET price = '$wme' WHERE item = 'wme'");
    DB()->query("UPDATE bb_helpsite SET price = '$yandexmoney' WHERE item = 'yandexmoney'");
    DB()->query("UPDATE bb_helpsite SET price = '$wmid' WHERE item = 'wmid'");
    DB()->query("UPDATE bb_helpsite SET price = '$sumw' WHERE item = 'sumw'");
    DB()->query("UPDATE bb_helpsite SET price = '$sumy' WHERE item = 'sumy'");
    DB()->query("UPDATE bb_helpsite SET price = '$sumw' WHERE item = 'sumw'");
    DB()->query("UPDATE bb_helpsite SET price = '$sumy' WHERE item = 'sumy'");
    DB()->query("UPDATE bb_helpsite SET price = '$show_w' WHERE item = 'show_w'");
    DB()->query("UPDATE bb_helpsite SET price = '$show_y' WHERE item = 'show_y'");
    bb_die("<font color=\"green\"><b>Настройки сохранены</b></font>");
}
$wmr_data  = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmr'");
$wmu_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmu'");
$wmz_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmz'");
$wme_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wme'");
$yandexmoney_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='yandexmoney'");
$wmid_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmid'");
$sumw_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='sumw'");
$sumy_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='sumy'");
$show_w_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='show_w'");
$show_y_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='show_y'");
$template->assign_vars(array(
    'WMR'  => $wmr_data['price'],
    'WMU' => $wmu_data['price'],
    'WMZ' => $wmz_data['price'],
    'WME' => $wme_data['price'],
    'YANDEXMONEY' => $yandexmoney_data['price'],
    'WMID' => $wmid_data['price'],
    'SUMW' => $sumw_data['price'],
    'SUMY' => $sumy_data['price'],
    'SHOW_W' => $show_w_data['price'],
    'SHOW_Y' => $show_y_data['price'],
));
print_page('admin_helpsite.tpl', 'admin');
Код tpl файла админки:

Код:
<div align="center">
<h1>{L_PURSES_PROJECT}</h1>
<br />
<form action="{S_ACTION}" method="post">
<table width="571" height="400" border="0" background="/forum/i/forma3.png">
  <tbody>
<tr>
<td align="center">{L_VALUE}</td>
<td align="center"><table class="adn"><tr><td align="center" style="border: none; padding: 0">{L_DESCRIPTION}</td><td align="center" style="border: none; padding: 0"></td></tr></table></td>
</tr>
<tr>
    <td align="center"><input type=text value='{WMID}' name='wmid' ></td>
    <td align="center"><b>{L_WMID_SITE}</b></td>
</tr>
<tr>
    <td align="center"><input type=text value='{WMR}' name='wmr' ></td>
    <td align="center"><b>{L_PURSE_WMR}</b></td>
</tr>
<tr>
    <td align="center"><input type=text value='{WMU}' name='wmu' ></td>
    <td align="center"><b>{L_PURSE_WMU}</b></td>
</tr>
<tr>
    <td align="center"><input type=text value='{WMZ}' name='wmz' ></td>
    <td align="center"><b>{L_PURSE_WMZ}</b></td>
</tr>
<tr>
    <td align="center"><input type=text value='{WME}' name='wme' ></td>
    <td align="center"><b>{L_PURSE_WME}</b></td>
</tr>
<tr>
    <td align="center"><input type=text value='{YANDEXMONEY}' name='yandexmoney' ></td>
    <td align="center"><b>{L_PURSE_YANDEXMONEY}</b></td>
</tr>
<tr>
<tr>
    <td align="center"><input type=text value='{SUMW}' name='sumw' ></td>
    <td align="center"><b>{L_SUM_W}</b></td>
</tr>
<tr>
<tr>
    <td align="center"><input type=text value='{SUMY}' name='sumy' ></td>
    <td align="center"><b>{L_SUM_Y}</b></td>
</tr>
<tr>
    <td><h4>{L_SHOW_W}</h4></td>
    <td>
        <label><input type="radio" name="show_w" value="1" <!-- IF SHOW_W -->checked="checked"<!-- ENDIF --> />{L_ENABLED}</label>&nbsp;&nbsp;
        <label><input type="radio" name="show_w" value="0" <!-- IF not SHOW_W -->checked="checked"<!-- ENDIF --> />{L_DISABLED}</label>
    </td>
</tr>
<tr>
    <td><h4>{L_SHOW_Y}</h4></td>
    <td>
        <label><input type="radio" name="show_y" value="1" <!-- IF SHOW_Y -->checked="checked"<!-- ENDIF --> />{L_ENABLED}</label>&nbsp;&nbsp;
        <label><input type="radio" name="show_y" value="0" <!-- IF not SHOW_Y -->checked="checked"<!-- ENDIF --> />{L_DISABLED}</label>
    </td>
</tr>
<tr>
    <td class="catBottom" colspan="3">
        <input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;
        <input type="submit" name="submit" id="send" value="{L_SUBMIT}" class="mainoption" disabled="disabled" />&nbsp;&nbsp;
        <label for="confirm">{L_CONFIRM}&nbsp;<input onclick="toggle_disabled('send', this.checked)" id="confirm" type="checkbox" name="confirm" value="1" /></label>
    </td>
</tr>
  <tbody>
</table>
<br><br>
</form>
</div>

Код tpl для пользователей

Код:
<center>
<table width="500" border="0" height="205" background="/forum/i/formauser.png">
  <tbody>
    <tr>
      <td align="center" valign="top"><p>&nbsp;</p>
        <p>Бла-бла-бла</p>  
      </td>
    </tr>
  </tbody>
</table>
</center>
<!-- IF SHOW_Y -->
<!-- BEGIN y -->
<center>
<table width="500" border="0" height="400" background="/forum/i/formaya.png">
  <tbody>
    <tr>
      <td align="center" valign="bottom">
      <font color="#FF0000"><p><b>{L_SELECT_PURSE_YANDEXMONEY}</b></p></font>
<iframe frameborder="0" allowtransparency="true" scrolling="no" src="https://money.yandex.ru/embed/shop.xml?account={YANDEXMONEY}&quickpay=shop&payment-type-choice=on&writer=seller&targets=%D0%9F%D0%BE%D0%B4%D0%B4%D0%B5%D1%80%D0%B6%D0%BA%D0%B0+%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B0&targets-hint=&default-sum={SUMY}&button-text=03&successURL=" width="450" height="197"></iframe>
<br><br><br><br>
      </td>
    </tr>
  </tbody>
</table>
</center>
<!-- END y -->
<!-- ENDIF -->
<br><br>
<!-- IF SHOW_W -->
<!-- BEGIN w -->
<center>
<form action="https://merchant.webmoney.ru/lmi/payment.asp" method="POST">
<table width="500" border="0" background="/forum/i/forma2.png" height="350">
  <tbody>
      <td align="center" valign="bottom">
      <font color="#FF0000"><p><b>{L_SELECT_PURSE_WEBMONEY}</b></p></font><br>
 <input type="text" name="LMI_PAYMENT_AMOUNT" value="{SUMW}">
 <input type="hidden" name="LMI_PAYMENT_DESC_BASE64" value="0J/QvtC00LTQtdGA0LbQutCwINC/0YDQvtC10LrRgtCw"><br><br>
<p><input type="radio" checked="checked" id="{WMR}" name="LMI_PAYEE_PURSE" value="{WMR}"><label for="{WMR}">{WMR}</label></p>
<p><input type="radio" id="{WMU}" name="LMI_PAYEE_PURSE" value="{WMU}"><label for="{WMU}">{WMU}</label></p>
<p><input type="radio" id="{WMZ}" name="LMI_PAYEE_PURSE" value="{WMZ}"><label for="{WMZ}">{WMZ}</label></p>
<p><input type="radio" id="{WME}" name="LMI_PAYEE_PURSE" value="{WME}"><label for="{WME}">{WME}</label></p>
<input type="submit" class="wmbtn" style="font-famaly:Verdana, Helvetica, sans-serif!important;padding:0 10px;height:30px;font-size:12px!important;border:1px solid #538ec1!important;background:#a4cef4!important;color:#fff!important;" value="{L_TRANSFER}"><br><br><br>
      </td>
    </tr>
  </tbody>
</table>
</form>
<!-- END w -->
<!-- ENDIF -->
</center>
<center>
<table width="100%" border="0">
  <tbody>
    <tr>
      <td align="center"><a href="https://passport.webmoney.ru/asp/CertView.asp?wmid={WMID}" target="_blank"><img title="{L_CHECK_ATTESTAT}" src="/forum/i/88x31_wm_v_blue_on_transparent_ru.png"></a>
      <a href="http://www.megastock.ru/" target="_blank"><img title="{L_MEGASTOK}" src="/forum/i/88x31_wm_blue_on_transparent_ru.png"></a></td>
    </tr>
  </tbody>
</table>
</center>

Код php для пользователей:

Код:
<?php
define('BB_SCRIPT', 'helpsite');
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
$user->session_start();
    if (isset($_POST["wmr"]))
    {
    $wmr = request_var('wmr', '');
    $wmu  = request_var('wmu', '');
    $wmz  = request_var('wmz', '');
    $wme  = request_var('wme', '');
    $yandexmoney  = request_var('yandexmoney', '');
    $wmid  = request_var('wmid', '');
    $sumw  = request_var('sumw', '');
    $sumy  = request_var('sumy', '');
    }
$wmr_data  = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmr'");
$wmu_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmu'");
$wmz_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmz'");
$wme_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wme'");
$yandexmoney_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='yandexmoney'");
$wmid_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='wmid'");
$sumw_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='sumw'");
$sumy_data = DB()->fetch_row("SELECT price FROM bb_helpsite WHERE item='sumy'");
$template->assign_vars(array(
    'WMR'  => $wmr_data['price'],
    'WMU' => $wmu_data['price'],
    'WMZ' => $wmz_data['price'],
    'WME' => $wme_data['price'],
    'YANDEXMONEY' => $yandexmoney_data['price'],
    'WMID' => $wmid_data['price'],
    'SUMW' => $sumw_data['price'],
    'SUMY' => $sumy_data['price'],
));
print_page('helpsite.tpl');
Ну и ланги:

Код:
$lang['HELPSITE'] = 'Помощь сайту';
$lang['PURSES_PROJECT'] = 'Кошельки проекта';
$lang['PURSE_WMR'] = 'Кошелек WMR';
$lang['PURSE_WMU'] = 'Кошелек WMU';
$lang['PURSE_WMZ'] = 'Кошелек WMZ';
$lang['PURSE_WME'] = 'Кошелек WME';
$lang['SUM_W'] = 'Сумма по умолчанию для WebMoney';
$lang['SUM_Y'] = 'Сумма по умолчанию для Яндекс денег';
$lang['TRANSFER'] = 'Перевести';
$lang['SELECT_PURSE_WEBMONEY'] = 'Внимание! Выберите кошелек для перевода и сумму!';
$lang['SELECT_PURSE_YANDEXMONEY'] = 'Внимание! Выберите способ перевода и сумму!';
$lang['PURSE_YANDEXMONEY'] = 'Кошелек яндекс';
$lang['CHECK_ATTESTAT'] = 'Проверить аттестат';
$lang['MEGASTOK'] = 'Сайт зарегистрирован вкаталоге мегасток';
$lang['SHOW_W'] = 'Блок WebMoney';
$lang['SHOW_Y'] = 'Блок YandexMoney';

Не знаю, правильно ли оформил tpl, но с php вообще разобраться не могу
 
Сверху