Файл: InstantSocial/uploud/admin/components/photoblog/backend.php
Строк: 165
<?php
if(!defined('VALID_CMS_ADMIN')) { die('ACCESS DENIED'); }
/*********************************************************************************************/
// //
// InstantCMS v1.0 (c) 2008 COMMERCIAL VERSION //
// Source code protected by copyright laws //
// //
// http://www.instantcms.ru/, info@instantcms.ru //
// //
// written by Vladimir E. Obukhov, 2007-2010 //
// //
/*********************************************************************************************/
if (isset($_REQUEST['opt'])) { $opt = $_REQUEST['opt']; } else { $opt = 'list'; }
//LOAD CURRENT CONFIG
$cfg = $inCore->loadComponentConfig('photoblog');
cpAddPathway('Фотоблоги', '?view=components&do=config&id='.$_REQUEST['id']);
if($opt=='save'){
$inDB = cmsDatabase::getInstance();
$cfg = array();
$cfg['height'] = $_REQUEST['height'];
$cfg['width'] = $_REQUEST['width'];
$cfg['premod'] = $_REQUEST['premod'];
$cfg['perpage'] = $_REQUEST['perpage'];
$cfg['maxup'] = $_REQUEST['maxup'];
$cfg['watermark'] = $_REQUEST['watermark'];
$inCore->saveComponentConfig('photoblog', $cfg);
$msg = 'Настройки сохранены';
$opt = 'config';
}
$toolmenu = array();
function getcount($id)
{
$inDB = cmsDatabase::getInstance();
$count = $inDB->rows_count('cms_phlog_photos', "phlog_id=$id");
return $count;
}
if($opt=='show_item'){
if (isset($_REQUEST['item_id'])){
dbShow('cms_phlog_item', $_REQUEST['item_id']);
echo '1'; exit;
} }
if($opt=='hide_item'){
if (isset($_REQUEST['item_id'])){
dbHide('cms_phlog_item', $_REQUEST['item_id']);
echo '1'; exit;
} }
if($opt=='list'){
cpAddPathway('Список фотоблогов', '?view=components&do=config&id='.$_REQUEST['id'].'&opt=list');
echo '<h3>Фотоблоги v1.0 by deltas</h3>';
$toolmenu[7]['icon'] = 'listforums.gif';
$toolmenu[7]['title'] = 'Список фотоблогов';
$toolmenu[7]['link'] = '?view=components&do=config&id='.$_REQUEST['id'].'&opt=list';
$toolmenu[13]['icon'] = 'config.gif';
$toolmenu[13]['title'] = 'Настройки';
$toolmenu[13]['link'] = '?view=components&do=config&id='.$_REQUEST['id'].'&opt=config';
cpToolMenu($toolmenu); $toolmenu = array();
$fields = array();
$fields[0]['title'] = '№'; $fields[0]['field'] = 'id'; $fields[0]['width'] = '20';
$fields[3]['title'] = 'Название'; $fields[3]['field'] = 'title'; $fields[3]['width'] = '';
$fields[3]['link'] = '/photoblog/%id%/edit.html';
$fields[4]['title'] = 'Описание'; $fields[4]['field'] = 'content'; $fields[4]['width'] = '';
$fields[5]['title'] = 'Фотографий'; $fields[5]['field'] = 'id'; $fields[5]['width'] = '75';
$fields[5]['prc'] = 'getcount';
$fields[6]['title'] = 'Просмотры'; $fields[6]['field'] = 'hits'; $fields[6]['width'] = '70';
$fields[7]['title'] = 'Показ'; $fields[7]['field'] = 'published'; $fields[7]['width'] = '40';
$fields[7]['do'] = 'opt'; $fields[7]['do_suffix'] = '_item';
$actions = array();
$actions[0]['title'] = 'Редактировать';
$actions[0]['icon'] = 'edit.gif';
$actions[0]['link'] = '/photoblog/%id%/edit.html';
$actions[1]['title'] = 'Удалить';
$actions[1]['icon'] = 'delete.gif';
$actions[1]['confirm'] = 'Удалить фотоблог?';
$actions[1]['link'] = '?view=components&do=config&id='.$_REQUEST['id'].'&opt=delete&item_id=%id%';
cpListTable('cms_phlog_item', $fields, $actions, '','id ASC');
}
if($opt == 'delete'){
if(isset($_REQUEST['item_id'])) {
$inCore->loadModel('photoblog');
$model = new cms_model_photoblog();
$id = $_REQUEST['item_id'];
$delele = $model->deletePhlog($id);
header('location:?view=components&do=config&id='.$_REQUEST['id'].'&opt=list');
}
}
if($opt=='config'){
cpAddPathway('Настройки', '?view=components&do=config&id='.$_REQUEST['id'].'&opt=config');
echo '<h3>Фотоблоги - Настройки</h3>';
if ($msg){
echo '<p style="color:green">'.$msg.'</p>';
}
$toolmenu = array();
$toolmenu[0]['icon'] = 'save.gif';
$toolmenu[0]['title'] = 'Сохранить';
$toolmenu[0]['link'] = 'javascript:document.optform.submit();';
$toolmenu[1]['icon'] = 'cancel.gif';
$toolmenu[1]['title'] = 'Отмена';
$toolmenu[1]['link'] = '?view=components&do=config&id='.$_REQUEST['id'].'&opt=list';
cpToolMenu($toolmenu); $toolmenu = array();
?>
<form action="index.php?view=components&do=config&id=<?php echo $_REQUEST['id'];?>" name="optform" method="post">
<table border="0" cellpadding="10" cellspacing="0" class="proptable">
<tr>
<td width="215"><strong>Максимальный размер загружаемых фотографий (px)</strong></td>
<td width="215"><input name="width" type="text" id="width" value="<?php echo @$cfg['width'];?>" /> ширина<br>
<input name="height" type="text" id="height" value="<?php echo @$cfg['height'];?>" /> высота</td>
</tr>
<tr>
<td> <strong>Добавление обьектов с премодерацией</strong> </td>
<td>
<select name="premod" id="premod">
<option value="1" <?php if ($cfg['premod']=="1") {echo 'selected="selected"';}?> >Да</option>
<option value="0" <?php if ($cfg['premod']!="1") {echo 'selected="selected"';}?> >Нет</option> </select>
</td>
</tr>
<tr>
<td width="215"><strong>Количество фотоблогов на странице</strong></td>
<td width="215"><input name="perpage" type="text" id="perpage" value="<?php echo @$cfg['perpage'];?>" /> шт.
</td>
</tr>
<tr>
<td> <strong>Наносить водяной знак на загружаемые фото</strong> </td>
<td>
<select name="watermark" id="watermark">
<option value="1" <?php if ($cfg['watermark']=="1") {echo 'selected="selected"';}?> >Да</option>
<option value="0" <?php if ($cfg['watermark']!="1") {echo 'selected="selected"';}?> >Нет</option> </select>
</td>
</tr>
<tr>
<td width="215"><strong>Максимальное количество загружаемых фотографий за один раз</strong></td>
<td width="215"><input name="maxup" type="text" id="maxup" value="<?php echo @$cfg['maxup'];?>" /> шт.
</td>
</tr>
<tr>
<td valign="top">
<p>
<input name="opt" type="hidden" id="do" value="save" />
<input name="save" type="submit" id="save" value="Сохранить" />
<input name="back" type="button" id="back" value="Отмена" onclick="window.location.href='index.php?view=components&do=config&id=<?php echo $_REQUEST['id'];?>&opt=list';"/>
</p>
</form>
</td></tr></table>
<?php
}
?>