PonyGallery -> DatsoGallery Datso gallery 1.6**
* LAST UPDATED 05.10.2008-21:34 MSK
***************************************************/
defined ( '_VALID_MOS' ) or defined ( '_JEXEC' ) or die ( 'Direct Access to this location is not allowed.' );
$tgver = "2.0.2.0011 Beta";
if (! defined ( 'DS' )) {
define ( 'DS', DIRECTORY_SEPARATOR );
}
$path = str_replace ( 'administrator' . DS, '', dirname ( __FILE__ ) );
//подключаем прослойку для 1.5
require_once ($path . DS . 'true.legacy.php');
require_once (TRUE_LEGACY . DS . 'connector.php');
JTConnector::connect ( TRUE_LEGACY );
require_once (TRUE_ADMIN . 'class.true.php');
require_once (TRUE_ADMIN . 'globals.true.php');
require_once (TRUE_ADMIN . 'images.true.php');
require_once (TRUE_ADMIN . 'admin.true.html.php');
require_once (TRUE_ADMIN . 'nav.php');
$option = JTInput::getParam ( $_REQUEST, 'option' );
$task = JTInput::getParam ( $_REQUEST, 'task' );
$act = JTInput::getParam ( $_REQUEST, 'act' );
//mosCommonHTML::loadOverlib();
JTLibConnect::overLibConnect ();
switch ($act) {
case "showcatg" :
$task = "showcatg";
break;
case "upload" :
$task = "upload";
break;
case "batchupload" :
$task = "batchupload";
break;
case "batchimport" :
$task = "batchimport";
break;
case "settings" :
$task = "settings";
break;
case "resetvotes" :
$task = "resetvotes";
break;
case "rebuild" :
$task = "rebuild";
break;
}
switch ($task) {
case "publish" :
publishPicture ( $id, 1, $option );
break;
case "unpublish" :
publishPicture ( $id, 0, $option );
break;
case 'movepic' :
movePic ( $id );
break;
case 'movepicres' :
movePicResult ( $id );
break;
case "new" :
showUpload ( $option );
break;
case "edit" :
editPicture ( $option, $id [0] );
break;
case "remove" :
removePicture ( $id, $option );
break;
case "save" :
savePicture ( $option );
break;
case "upload" :
showUpload ( $option );
break;
case "batchupload" :
showBatchUpload ( $option );
break;
case "batchimport" :
showBatchImport ( $option );
break;
case "resetvotes" :
showVotes ( $option );
break;
case "reset" :
resetVotes ( $option );
break;
case "rebuild" :
showDGrebuild ( $option );
break;
case "startdgrebuild" :
startDGrebuild ( $option );
break;
case 'uploadhandler' :
require_once (TRUE_ADMIN . 'config.true.php');
///
$ad_paththumbs = $ad_path.'/thumbs';
$ad_pathimages = $ad_path.'/pictures';
$ad_pathoriginals = $ad_path.'/originals';
////
$imagetype = array (1 => 'GIF', 2 => 'JPG', 3 => 'PNG' );
$imginfo = getimagesize ( $org_screenshot );
if ($imginfo [0] = 0) {
JTRedirect::_ ( TRUE_INDEX2.'&act=upload', _DG_FILENAME_BAD_UPLOAD );
exit ();
}
$imginfo [2] = $imagetype [$imginfo [2]];
if ($imginfo [2] != 'GIF' && $imginfo [2] != 'JPG' && $imginfo [2] != 'PNG') {
JTRedirect::_ ( TRUE_INDEX2.'&act=upload', _DG_FILENAME_BAD );
exit ();
}
$org_screenshot_name = dgImgId ( $catid, $imginfo [2] );
if ($org_screenshot)
if ($ad_orgresize) {
if (strlen ( $org_screenshot_name ) > 0 and $org_screenshot_name != "none") {
$img_info = getimagesize ( $org_screenshot );
if ($img_info [0] > $ad_orgwidth or $img_info [1] > $ad_orgheight) {
dgImageCreate ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$org_screenshot_name", $ad_orgwidth, $ad_orgheight, $ad_thumbquality, "1" );
} else {
copy ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$org_screenshot_name" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals.'/'.$catid.'/'.$org_screenshot_name, 0644);
}
}
}
if (! $ad_orgresize) {
if (strlen ( $org_screenshot ) > 0 and $org_screenshot != "none") {
copy ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$org_screenshot_name" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals.'/'.$catid.'/'.$org_screenshot_name, 0644);
}
}
//средний эскиз
if ($imginfo [0] > $ad_maxwidth or $imginfo [1] > $ad_maxheight) {
dgImageCreate ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . "/$catid/$org_screenshot_name", $ad_maxwidth, $ad_maxheight, $ad_thumbquality, "1" );
} else {
copy ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . "/$catid/$org_screenshot_name" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages.'/'.$catid.'/'.$org_screenshot_name, 0644);
}
//превьюшки
if ($thumbcreation)
dgImageCreate ( $org_screenshot, $mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . "/$catid/$org_screenshot_name", $ad_thumbwidth, $ad_thumbheight, $ad_thumbquality, $ad_crsc );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . '/'.$catid.'/'.$org_screenshot_name, 0644);
$db = & JTDB::getDBO ();
$imgdate = mktime ();
$db->setQuery ( "SELECT ordering FROM #__true WHERE catid=$catid ORDER BY ordering DESC LIMIT 1" );
$ordering1 = $db->loadResult ();
$ordering = $ordering1 + 1;
$db->setQuery ( "INSERT INTO #__true(id, catid, imgtitle, imgauthor, imgtext, imgdate, ordering, imgvotes, imgvotesum,
published, imgfilename, imgthumbname, imgoriginalname, checked_out, owner, approved,
field1, field2, field3, field4, field5, metadesc, metakey, tags)
VALUES (NULL, '$catid', '$imgtitle', '$imgauthor', '$imgtext', '$imgdate', '$ordering', '0', '0', '1',
'$org_screenshot_name', '$org_screenshot_name', '$org_screenshot_name', '0', '$my->id', 1,
'$field1', '$field2', '$field3', '$field4', '$field5', '', '', '$tags')" );
if (! $db->query ()) {
echo "\n";
exit ();
}
//пишем в счетчик
$last_id = $db->insertid ();
$db->setQuery ( "INSERT INTO #__true_count(id, imgid, count) VALUES (NULL, '$last_id', '0')" );
$db->query ();
///
JTRedirect::_ ( TRUE_INDEX2.'&act=pictures' );
break;
case "batchuploadhandler" :
$temp_dir = 'media';
require_once (TRUE_ADMIN . "config.true.php");
///
$ad_paththumbs = $ad_path.'/thumbs';
$ad_pathimages = $ad_path.'/pictures';
$ad_pathoriginals = $ad_path.'/originals';
////
require_once ($mainframe->getCfg ( 'absolute_path' ) . "/administrator/includes/pcl/pclzip.lib.php");
//if ($zippack_type !== 'application/zip'){
//JTRedirect::_( "TRUE_INDEX2.'&act=pictures", "FILE IS NOT A ZIP PACKAGE" );
//} else {
$zipfile = new PclZip ( $_FILES ['zippack'] ['tmp_name'] );
$ziplist = $zipfile->listContent ();
$zipfile->extract ( $p_path = $mainframe->getCfg ( 'absolute_path' ) . '/' . $temp_dir );
for($i = 0; $i < sizeof ( $ziplist ); $i ++) {
$origfilename = $ziplist [$i] ['filename'];
$imagetype = array (1 => 'GIF', 2 => 'JPG', 3 => 'PNG' );
$imginfo = getimagesize ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename" );
if ($imginfo [0] = 0) {
JTRedirect::_ ( TRUE_INDEX2.'&act=upload', _DG_FILENAME_BAD_UPLOAD );
exit ();
}
$imginfo [2] = $imagetype [$imginfo [2]];
$compacttitle = strtolower ( str_replace ( ' ', '', $gentitle ) );
$newfilename = dgImgId ( $catid, $imginfo [2] );
if ($ad_orgresize) {
$img_info = getimagesize ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename" );
if ($img_info [0] > $ad_orgwidth || $img_info [1] > $origfilename) {
dgImageCreate ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename", $ad_orgwidth, $ad_orgheight, $ad_thumbquality, "1" );
} else {
copy ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . '/'.$catid.'/'.$newfilename, 0644);
}
}
if (! $ad_orgresize) {
copy ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . '/'.$catid.'/'.$newfilename, 0644);
}
dgImageCreate ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . "/$catid/$newfilename", $ad_maxwidth, $ad_maxheight, $ad_thumbquality, "1" );
dgImageCreate ( $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . "/$catid/$newfilename", $ad_thumbwidth, $ad_thumbheight, $ad_thumbquality, $ad_crsc );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . '/'.$catid.'/'.$newfilename, 0644);
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . '/'.$catid.'/'.$newfilename, 0644);
unlink ( $p_path = $mainframe->getCfg ( 'absolute_path' ) . "/$temp_dir/$origfilename" );
$db = & JTDB::getDBO ();
$batchtime = mktime ();
$db->setQuery ( "select ordering from #__true where catid=$catid order by ordering desc limit 1" );
$ordering1 = $db->loadResult ();
$ordering = $ordering1 + 1;
$db->setQuery ( "INSERT INTO #__true(id, catid, imgtitle, imgauthor, imgtext, imgdate, ordering, imgvotes, imgvotesum,
published, imgfilename, imgthumbname, imgoriginalname, checked_out, owner, approved, field1,
field2, field3, field4, field5, metadesc, metakey, tags)
VALUES (NULL, '$catid', '$gentitle $i', '$photocred', '$gendesc', '$batchtime', '$ordering', '0', '0', '1',
'$newfilename', '$newfilename', '$newfilename', '0', '$my->id', 1, '$field1', '$field2', '$field3',
'$field4', '$field5', '', '', '$tags')" );
if (! $db->query ()) {
echo "\n";
exit ();
}
//пишем в счетчик
$last_id = $db->insertid ();
$db->setQuery ( "INSERT INTO #__true_count(id, imgid, count) VALUES (NULL, '$last_id', '0')" );
$db->query ();
}
$picsadded = count ( $ziplist );
JTRedirect::_ ( TRUE_INDEX2.'&act=pictures', JText::_ ( 'TG_ADDED_IMAGES' ) . $picsadded );
//}
break;
case "batchimporthandler" :
$dir = $mainframe->getCfg ( 'absolute_path' ) . '/media';
$filelist = array ();
require_once (TRUE_ADMIN . "config.true.php");
///
$ad_paththumbs = $ad_path.'/thumbs';
$ad_pathimages = $ad_path.'/pictures';
$ad_pathoriginals = $ad_path.'/originals';
////
require_once ($mainframe->getCfg ( 'absolute_path' ) . "/administrator/includes/pcl/pclzip.lib.php");
if (class_exists ( "PclZip" )) {
$directory_zip = opendir ( $dir );
while ( $file_name = readdir ( $directory_zip ) ) {
$ext = strtolower ( substr ( $file_name, - 4 ) );
if ($ext == ".zip") {
$archive = new PclZip ( $dir . "/$file_name" );
if (@$archive->extract ( PCLZIP_OPT_PATH, $dir ) == true) {
unlink ( $dir . "/$file_name" );
}
}
}
closedir ( $directory_zip );
}
$compacttitle = strtolower ( str_replace ( ' ', '', $gentitle ) );
if ($directory_zip = opendir ( $dir )) {
$i = 0;
while ( $file = readdir ( $directory_zip ) ) {
if ($file != "." && $file != ".." && (strcasecmp ( $file, "index.html" ) != 0)) {
$i ++;
$origfilename = $file;
$imagetype = array (1 => 'GIF', 2 => 'JPG', 3 => 'PNG' );
$imginfo = getimagesize ( $dir . "/$origfilename" );
if ($imginfo [0] = 0) {
JTRedirect::_ ( TRUE_INDEX2.'&act=upload', _DG_FILENAME_BAD_UPLOAD );
exit ();
}
$imginfo [2] = $imagetype [$imginfo [2]];
$newfilename = dgImgId ( $catid, $imginfo [2] );
if ($ad_orgresize) {
$img_info = getimagesize ( $dir . "/$origfilename" );
if ($img_info [0] > $ad_orgwidth or $img_info [1] > $origfilename) {
dgImageCreate ( $dir . "/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename", $ad_orgwidth, $ad_orgheight, $ad_thumbquality, "1" );
} else {
copy ( $dir . "/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename" );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . '/'.$catid.'/'.$newfilename, 0644);
}
}
if (! $ad_orgresize) {
copy ( $dir . "/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . "/$catid/$newfilename" );
}
dgImageCreate ( $dir . "/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . "/$catid/$newfilename", $ad_maxwidth, $ad_maxheight, $ad_thumbquality, "1" );
dgImageCreate ( $dir . "/$origfilename", $mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . "/$catid/$newfilename", $ad_thumbwidth, $ad_thumbheight, $ad_thumbquality, $ad_crsc );
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . '/'.$catid.'/'.$newfilename, 0644);
chmod($mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . '/'.$catid.'/'.$newfilename, 0644);
unlink ( $dir . "/$origfilename" );
$db = & JTDB::getDBO ();
$batchtime = mktime ();
$db->setQuery ( "SELECT ordering FROM #__true WHERE catid=$catid ORDER BY ordering DESC LIMIT 1" );
$ordering1 = $db->loadResult ();
$ordering = $ordering1 + 1;
$db->setQuery ( "INSERT INTO #__true(id, catid, imgtitle, imgauthor, imgtext, imgdate, ordering, imgvotes, imgvotesum,
published, imgfilename, imgthumbname, imgoriginalname, checked_out, owner, approved, field1,
field2, field3, field4, field5, metadesc, metakey, tags)
VALUES (NULL, '$catid', '$gentitle $i', '$photocred', '$gendesc', '$batchtime', '$ordering', '0', '0', '1',
'$newfilename', '$newfilename', '$newfilename', '0', '$my->id', 1, '$field1', '$field2', '$field3',
'$field4', '$field5', '', '', '$tags')" );
if (! $db->query ()) {
echo "\n";
exit ();
}
//пишем в счетчик
$last_id = $db->insertid ();
$db->setQuery ( "INSERT INTO #__true_count(id, imgid, count) VALUES (NULL, '$last_id', '0')" );
$db->query ();
}
}
}
closedir ( $directory_zip );
JTRedirect::_ ( TRUE_INDEX2.'&act=pictures' );
break;
case "settings" :
showConfig ( $option );
break;
case "savesettings" :
saveConfig ( $option, $ad_path, $ad_protect, $ad_thumbwidth, $ad_thumbheight,
$ad_thumbquality, $ad_showdetail, $ad_showrating, $ad_showcomment, $ad_comtitle, $ad_showpanel, $ad_userpannel,
$ad_special, $ad_crsc, $ad_rating, $ad_lastadd, $ad_owners, $ad_lastcomment, $ad_search, $ad_showsend2friend,
$ad_picincat, $ad_showwatermark, $ad_catsperpage, $ad_showdownload, $ad_downpub, $ad_perpage, $ad_sortby,
$ad_toplist, $ad_js_effect, $ad_lightbox_fa, $ad_showinformer, $ad_periods, $ad_approve, $ad_pathway,
$ad_powered, $ad_maxuserimage, $ad_maxfilesize, $ad_maxwidth, $ad_maxheight, $ad_category, $ad_imgstyle,
$ad_ncsc, $ad_showimgtext, $ad_showfimgdate, $ad_showimgcounter, $ad_showfrating, $ad_showres,
$ad_showfimgsize, $ad_showimgauthor, $ad_cp, $ad_lightbox, $ad_orgresize, $ad_orgwidth, $ad_orgheight,
$ad_cat_desc, $ad_field1, $ad_field2, $ad_field3, $ad_field4, $ad_field5, $ad_mini_to_js, $ad_status1,
$ad_status2, $ad_status3, $ad_status4, $ad_status5, $ad_cat_img_detail, $ad_carusel, $ad_bbhtml, $ad_toggle );
break;
case "newcatg" :
editCatg ( 0, $option );
break;
case "editcatg" :
editCatg ( $cid [0], $option, $catid );
break;
case "showcatg" :
viewCatg ( $option );
break;
case "savecatg" :
saveCatg ( $option, $task );
break;
case "removecatg" :
removeCatg ( $cid, $option );
break;
case "publishcatg" :
publishCatg ( $cid, 1, $option );
break;
case "unpublishcatg" :
publishCatg ( $cid, 0, $option );
break;
case "approvepic" :
approvePicture ( $id, 1, $option );
break;
case "rejectpic" :
approvePicture ( $id, 0, $option );
break;
case "orderup" :
orderPic ( $id [0], 1, $option );
break;
case "orderdown" :
orderPic ( $id [0], - 1, $option );
break;
case "saveorder" :
saveOrder ( $id );
break;
case "cancelcatg" :
cancelCatg ( $option );
break;
case "orderupcatg" :
orderCatg ( $cid [0], - 1, $option );
break;
case "orderdowncatg" :
orderCatg ( $cid [0], 1, $option );
break;
case "cancel" :
JTRedirect::_ ( 'index2.php?option='.$option );
break;
default :
showPictures ( $option );
break;
}
// Функция показа картинок
function showPictures($option)
{
global $mainframe, $group;
$db = & JTDB::getDBO ();
$catid = $mainframe->getUserStateFromRequest ( "catid{$option}", 'catid', 0 );
$search = $mainframe->getUserStateFromRequest ( "search{$option}", 'search', '' );
$search = $db->getEscaped ( trim ( strtolower ( $search ) ) );
$sort = $mainframe->getUserStateFromRequest ( "sort{$option}", 'sort', 0 );
$sorder = $mainframe->getUserStateFromRequest ( "sorder{$option}", 'sorder', 0 );
$limit = $mainframe->getUserStateFromRequest ( 'viewlistlimit', 'limit', 10 );
$limitstart = $mainframe->getUserStateFromRequest ( "view{$option}limitstart", 'limitstart', 0 );
$where = array ();
if ($catid > 0) {
$where [] = "catid='$catid'";
}
if ($sort == 1) {
$where [] = "approved = 0";
}
if ($sort == 2) {
$where [] = "approved = 1";
}
if ($sort == 3) {
$where [] = "useruploaded = 1";
}
if ($sort == 4) {
$where [] = "useruploaded = 0";
}
if ($sorder == 0) {
$sortorder = "a.catid asc, a.ordering desc, imgdate desc, imgtitle asc";
}
if ($sorder == 1) {
$sortorder = "a.catid asc, a.ordering asc, imgdate desc, imgtitle asc";
}
if ($search) {
$where [] = "LOWER(imgtitle) LIKE '%$search%' OR lower(imgtext) LIKE '%$search%'";
$group = "GROUP BY id";
}
$db->setQuery ( "SELECT count(*) FROM #__true AS a " . (count ( $where ) ? ' WHERE ' . implode ( ' AND ', $where ) : '') );
$total = $db->loadResult ();
echo $db->getErrorMsg ();
if ($limit > $total) {
$limitstart = 0;
}
$where [] = 'a.catid = cc.cid';
$picincat = count ( $where ) ? ' where ' . implode ( ' and ', $where ) : '';
$db->setQuery ( "SELECT a.*, cc.name AS category, tc.count AS imgcounter, u.username AS owner
FROM #__true AS a, #__true_count AS tc, #__true_catg AS cc, #__users AS u $picincat
AND a.id = tc.imgid AND a.owner = u.id $group
ORDER BY $sortorder limit $limitstart, $limit" );
$rows = $db->loadObjectList ();
if ($db->getErrorNum ()) {
echo $db->stderr ();
return false;
}
$clist = ShowDropDownCategoryList ( $catid, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit();"' );
$s_options [] = mosHTML::makeOption ( JText::_ ( 'TG_SHOW_ALL_PICT' ), 0 );
$s_options [] = mosHTML::makeOption ( "1", JText::_ ( 'TG_NOT_APPROVED' ) );
$s_options [] = mosHTML::makeOption ( "2", JText::_ ( 'TG_APPROVED' ) );
$s_options [] = mosHTML::makeOption ( "3", JText::_ ( 'TG_USER_UPLOAD_PIC' ) );
$s_options [] = mosHTML::makeOption ( "4", JText::_ ( 'TG_ADMIN_UPLOAD_PIC' ) );
$slist = mosHTML::selectList ( $s_options, 'sort', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $sort );
require_once ($mainframe->getCfg ( 'absolute_path' ) . "/administrator/includes/pageNavigation.php");
$pageNav = new mosPageNav ( $total, $limitstart, $limit );
HTML_true::showPictures ( $option, $rows, $clist, $slist, $search, $pageNav );
}
// порядок картинок
function orderPic($uid, $inc, $option)
{
$db = & JTDB::getDBO ();
$db->setQuery ( "SELECT catid FROM #__true WHERE id=$uid" );
$piccatid = $db->loadResult ();
$db->setQuery ( "SELECT ordering, id FROM #__true WHERE id=$uid" );
$result = $db->query ();
$id1 = mysql_result ( $result, 0, 'id' );
$ordering1 = mysql_result ( $result, 0, 'ordering' );
if ($inc == 1) {
$db->setQuery ( "SELECT ordering, id FROM #__true WHERE catid=$piccatid and ordering > $ordering1 ORDER BY ordering LIMIT 1" );
} else {
$db->setQuery ( "SELECT ordering, id FROM #__true WHERE catid=$piccatid and ordering < $ordering1 ORDER BY ordering DESC LIMIT 1" );
}
$result = $db->query ();
$ordering2 = mysql_result ( $result, 0, 'ordering' );
$id2 = mysql_result ( $result, 0, 'id' );
$db->setQuery ( "UPDATE #__true SET ordering=$ordering1 WHERE id=$id2" );
$result = $db->query ();
$db->setQuery ( "UPDATE #__true SET ordering=$ordering2 WHERE id=$id1" );
$result = $db->query ();
JTRedirect::_ ( TRUE_INDEX2 );
}
// Функция сохранения порядка картинок
function saveOrder(&$cid)
{
$db = & JTDB::getDBO ();
$total = count ( $cid );
$order = josGetArrayInts ( 'order' );
for($i = 0; $i < $total; $i ++) {
$query = "UPDATE #__true SET ordering = " . ( int ) $order [$i] . " WHERE id = " . ( int ) $cid [$i];
$db->setQuery ( $query );
if (! $db->query ()) {
echo "\n";
exit ();
}
$row = new mostrue ( $db );
$row->load ( $cid [$i] );
$row->updateOrder ( ' ' );
}
JTRedirect::_ ( TRUE_INDEX2, JText::_ ( 'TG_ORDERING_OK' ) );
}
//Функция удаления картинок
function removePicture($cid, $option)
{
global $mainframe, $ad_path;
require_once (TRUE_ADMIN . "config.true.php");
$db = & JTDB::getDBO ();
if (! is_array ( $cid ) || count ( $cid ) < 1) {
echo "\n";
exit ();
}
if (count ( $cid )) {
for($i = 0; $i < count ( $cid ); $i ++) {
$db->setQuery ( "SELECT id, imgfilename, imgthumbname, imgoriginalname, catid FROM #__true WHERE id = $cid[$i]" );
if ($db->query ()) {
$rows = $db->loadObjectList ();
$row = $rows [0];
$catid = $row->catid;
$ad_paththumbs = $ad_path.'/thumbs/';
$ad_pathimages = $ad_path.'/pictures/';
$ad_pathoriginals = $ad_path.'/originals/';
if (removeFile ( $row->imgfilename, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages, $catid )) {
if (removeFile ( $row->imgthumbname, $mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs, $catid )) {
if (! removeFile ( $row->imgoriginalname, $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals, $catid )) {
}
} else {
//die(JText::_('TG_NOT_DELETE_THMB_IMAGE_FILE);
}
} else {
//die(JText::_('TG_FFFFFFF);
}
} else {
echo "\n";
}
}
$cids = implode ( ',', $cid );
$db->setQuery ( "DELETE from #__true where id IN ($cids)" );
if (! $db->query ()) {
echo "\n";
}
$db->setQuery ( "DELETE from #__true_count where imgid IN ($cids)" );
if (! $db->query ()) {
echo "\n";
}
}
$txtmsg = 'good';
JTRedirect::_ ( "index2.php?option=$option", $ad_path );
}
//Функция публикации картинок
function publishPicture($cid = null, $publish = 1, $option)
{
$db = & JTDB::getDBO ();
if (! is_array ( $cid ) || count ( $cid ) < 1) {
$action = $publish ? 'publish' : 'unpublish';
echo "\n";
exit ();
}
$cids = implode ( ',', $cid );
$db->setQuery ( "UPDATE #__true SET published='$publish' WHERE id IN ($cids)" );
if (! $db->query ()) {
echo "\n";
exit ();
}
JTRedirect::_ ( "index2.php?option=$option" );
}
// Утверждение картинок
function approvePicture($cid = null, $approve = 1, $option)
{
$db = & JTDB::getDBO ();
if (! is_array ( $cid ) || count ( $cid ) < 1) {
$action = $approve ? 'approve' : 'reject';
echo "\n";
exit ();
}
$cids = implode ( ',', $cid );
$db->setQuery ( "UPDATE #__true SET approved='$approve' WHERE id IN ($cids)" );
if (! $db->query ()) {
echo "\n";
exit ();
}
JTRedirect::_ ( "index2.php?option=$option" );
}
//Редактирование картинок
function editPicture($option, $uid)
{
global $mainframe, $ad_thumbwidth, $ad_thumbheight, $ad_imgstyle, $ad_path;
$db = & JTDB::getDBO ();
$ad_paththumbs = $ad_path.'/thumbs';
$ad_pathimages = $ad_path.'/pictures';
$ad_pathoriginals = $ad_path.'/originals';
$abspath = $mainframe->getCfg( 'absolute_path' );
require_once (TRUE_ADMIN . "config.true.php");
$row = new mostrue ( $db );
$row->load ( $uid );
$clist = ShowDropDownCategoryListImg ( $row->catid, "catid", ' size="1"' );
$imgFiles = mosReadDirectory ( "$abspath.$ad_pathimages" );
$images = array (mosHTML::makeOption ( '', JText::_ ( 'TG_SELECT_MED_PIC' ) ) );
foreach ( $imgFiles as $file ) {
if (eregi ( "jpeg|gif|jpg|png", $file )) {
$images [] = mosHTML::makeOption ( $file );
}
}
$imagelist = mosHTML::selectList ( $images, 'imgfilename', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].imgfilename.options[selectedIndex].value!='') {document.imagelib3.src='..$ad_pathimages/' + document.forms[0].imgfilename.options[selectedIndex].value} else {document.imagelib3.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->imgfilename );
$thuFiles = mosReadDirectory ( "$abspath.$ad_paththumbs" );
$thumbs = array (mosHTML::makeOption ( '', JText::_ ( 'TG_SELECT_THUMB_PIC' ) ) );
foreach ( $thuFiles as $tfile ) {
if (eregi ( "jpeg|gif|jpg|png", $tfile )) {
$thumbs [] = mosHTML::makeOption ( $tfile );
}
}
$thumblist = mosHTML::selectList ( $thumbs, 'imgthumbname', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].imgthumbname.options[selectedIndex].value!='') {document.imagelib2.src='..$ad_paththumbs/' + document.forms[0].imgthumbname.options[selectedIndex].value} else {document.imagelib2.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->imgthumbname );
$orgFiles = mosReadDirectory ( "$abspath.$ad_pathoriginals" );
$originals = array (mosHTML::makeOption ( '', JText::_ ( 'TG_SELECT_ORG_PIC' ) ) );
foreach ( $orgFiles as $ofile ) {
if (eregi ( "jpeg|gif|jpg|png", $ofile )) {
$originals [] = mosHTML::makeOption ( $ofile );
}
}
$originallist = mosHTML::selectList ( $originals, 'imgoriginalname', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].imgoriginalname.options[selectedIndex].value!='') {document.imagelib.src='..$ad_pathoriginals/' + document.forms[0].imgoriginalname.options[selectedIndex].value} else {document.imagelib.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->imgoriginalname );
if (! $uid)
$row->published = 0;
HTML_true::editPicture ( $option, $row, $clist, $originallist, $imagelist, $thumblist,
$ad_pathoriginals, $ad_pathimages, $ad_paththumbs, $ad_path, $ad_thumbwidth, $ad_thumbheight, $ad_imgstyle );
}
//Сохранение картинок
function savePicture($option)
{
global $catid, $mainframe;
$db = & JTDB::getDBO ();
require_once (TRUE_ADMIN . "config.true.php");
$row = new mostrue ( $db );
if (! $row->bind ( $_POST )) {
echo "\n";
exit ();
}
$row->imgdate = mktime ();
$db->setQuery ( "SELECT ordering FROM #__true WHERE catid=$catid ORDER BY ordering DESC LIMIT 1" );
$ordering1 = $db->loadResult ();
$row->ordering = $ordering1 + 1;
if (! $row->store ()) {
echo "\n";
exit ();
}
//перемещаем физически файлы
$oldcatid = $_POST ['oldcatid'];
$paththumbs = $ad_path.'/thumbs';
$pathimages = $ad_path.'/pictures';
$pathoriginals = $ad_path.'/originals';
$orgimg1 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$pathoriginals.'/' . $oldcatid . "/" . $row->imgthumbname;
$newimg1 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$pathoriginals.'/' . $catid . "/" . $row->imgthumbname;
$orgimg2 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$pathimages.'/' . $oldcatid . "/" . $row->imgthumbname;
$newimg2 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$pathimages.'/' . $catid . "/" . $row->imgthumbname;
$orgimg3 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$ad_paththumbs.'/' . $oldcatid . "/" . $row->imgthumbname;
$newimg3 = $mainframe->getCfg ( 'absolute_path' ) . '/'.$ad_paththumbs.'/'. $catid."/" . $row->imgthumbname;
rename ( $orgimg1, $newimg1 );
rename ( $orgimg2, $newimg2 );
rename ( $orgimg3, $newimg3 );
//
$msg = 'good';
JTRedirect::_ ( 'index2.php?option=' . $option . '&mosmsg=' . $msg );
}
//Функция показа нормальной загрузки
function showUpload($option)
{
global $my, $mainframe;
$db = & JTDB::getDBO ();
require_once (TRUE_ADMIN . "config.true.php");
$clist = ShowDropDownCategoryList ( 0, 'catid', ' class="inputbox" size="1" style="width:228;"' );
echo "\n";
echo "\n";
echo "
\n";
echo "" . JText::_ ( 'TG_NORMAL_UPLOAD_TITLE' ) . " | \n";
echo "
\n";
$imgauthor = $imgtext = $imgtitle = '';
global $mainframe;
?>
";
echo "\n";
}
// Показ пакетной загрузки
function showBatchUpload($option)
{
global $mainframe;
$db = & JTDB::getDBO ();
require_once (TRUE_ADMIN . "config.true.php");
?>
\n";
echo "function BatchFormCheck(theForm) {\n";
echo "if (theForm.zippack.value == '') {\n";
echo "alert('" . JText::_ ( 'TG_ZIP_NOT_SELECTED' ) . "');\n";
echo "return false;\n";
echo "} else if (theForm.catid.value == '0') {\n";
echo "alert('" . JText::_ ( 'TG_ONE_ERR' ) . "');\n";
echo "return false;\n";
echo "} else if (theForm.gentitle.value == '') {\n";
echo "alert('" . JText::_ ( 'TG_TWO_ERR' ) . "');\n";
echo "return false;\n";
echo "} else {dgLoading();}}\n";
echo "\n";
echo "\n";
echo "" . JText::_ ( 'TG_BATCH_UPLOAD_TITLE' ) . " |
\n";
echo '";
}
// Показ пакетного импорта
function showBatchImport($option)
{
global $mainframe;
$db = & JTDB::getDBO ();
require_once (TRUE_ADMIN . "config.true.php");
echo "\n";
echo "\n";
echo "\n";
echo "" . JText::_ ( 'TG_INSTALL_BI' ) . " |
\n";
echo "\n";
echo "\n";
}
// Функция созоанения натсроек
function saveConfig($option, $ad_path, $ad_protect, $ad_thumbwidth, $ad_thumbheight,
$ad_thumbquality, $ad_showdetail, $ad_showrating, $ad_showcomment, $ad_comtitle, $ad_showpanel,
$ad_userpannel, $ad_special, $ad_crsc, $ad_rating, $ad_lastadd, $ad_owners, $ad_lastcomment, $ad_search,
$ad_showsend2friend, $ad_picincat, $ad_showwatermark, $ad_catsperpage, $ad_showdownload, $ad_downpub, $ad_perpage,
$ad_sortby, $ad_toplist, $ad_js_effect, $ad_lightbox_fa, $ad_showinformer, $ad_periods, $ad_approve, $ad_pathway,
$ad_powered, $ad_maxuserimage, $ad_maxfilesize, $ad_maxwidth, $ad_maxheight, $ad_category, $ad_imgstyle, $ad_ncsc,
$ad_showimgtext, $ad_showfimgdate, $ad_showimgcounter, $ad_showfrating, $ad_showres, $ad_showfimgsize, $ad_showimgauthor,
$ad_cp, $ad_lightbox, $ad_orgresize, $ad_orgwidth, $ad_orgheight, $ad_cat_desc, $ad_field1, $ad_field2, $ad_field3,
$ad_field4, $ad_field5, $ad_mini_to_js, $ad_status1, $ad_status2, $ad_status3, $ad_status4, $ad_status5, $ad_cat_img_detail,
$ad_carusel, $ad_bbhtml, $ad_toggle)
{
global $tgver, $mainframe;
$configfile = "components/com_true/config.true.php";
@chmod ( $configfile, 0766 );
$permission = is_writable ( $configfile );
if (! $permission) {
$mosmsg = JText::_ ( 'TG_CONFIG_NO_WRITE' );
JTRedirect::_ ( "index2.php?option=$option&act=config", $mosmsg );
break;
}
$ad_category2 = implode ( ",", $ad_category );
//временный параметр для LANG
$ad_lang = '';
$config = "";
if ($fp = fopen ( "$configfile", "w" )) {
fputs ( $fp, $config, strlen ( $config ) );
fclose ( $fp );
}
//пишем конфиг в базу
$db = & JTDB::getDBO ();
//переименовываем корневую директорию, если админ изменил название
$db->setQuery ("SELECT ad_path FROM #__true_config ");
$old_ad_path = $db->loadResult();
if ($old_ad_path != $ad_path) {
rename($mainframe->getCfg('absolute_path').$old_ad_path, $mainframe->getCfg('absolute_path').$ad_path);
} else {}
$db->setQuery ( "UPDATE #__true_config SET
ad_path = '$ad_path',
ad_protect = '$ad_protect',
ad_orgresize = '$ad_orgresize',
ad_orgwidth = '$ad_orgwidth',
ad_orgheight = '$ad_orgheight',
ad_thumbwidth = '$ad_thumbwidth',
ad_thumbheight = '$ad_thumbheight',
ad_crsc = '$ad_crsc',
ad_thumbquality = '$ad_thumbquality',
ad_showdetail = '$ad_showdetail',
ad_showrating = '$ad_showrating',
ad_showcomment = '$ad_showcomment',
ad_pathway = '$ad_pathway',
ad_showpanel = '$ad_showpanel',
ad_userpannel = '$ad_userpannel',
ad_special = '$ad_special',
ad_rating = '$ad_rating',
ad_lastadd = '$ad_lastadd',
ad_owners = '$ad_owners',
ad_lastcomment = '$ad_lastcomment',
ad_showinformer = '$ad_showinformer',
ad_periods = '$ad_periods',
ad_search = '$ad_search',
ad_comtitle = '$ad_comtitle',
ad_showsend2friend = '$ad_showsend2friend',
ad_picincat = '$ad_picincat',
ad_powered = '$ad_powered',
ad_showwatermark = '$ad_showwatermark',
ad_showdownload = '$ad_showdownload',
ad_downpub = '$ad_downpub',
ad_perpage = '$ad_perpage',
ad_catsperpage = '$ad_catsperpage',
ad_sortby = '$ad_sortby',
ad_toplist = '$ad_toplist',
ad_approve = '$ad_approve',
ad_maxuserimage = '$ad_maxuserimage',
ad_maxfilesize = '$ad_maxfilesize',
ad_maxwidth = '$ad_maxwidth',
ad_maxheight = '$ad_maxheight',
ad_category = '$ad_category2',
ad_imgstyle = '$ad_imgstyle',
ad_ncsc = '$ad_ncsc',
ad_showimgtext = '$ad_showimgtext',
ad_showfimgdate = '$ad_showfimgdate',
ad_showimgcounter = '$ad_showimgcounter',
ad_showfrating = '$ad_showfrating',
ad_showres = '$ad_showres',
ad_showfimgsize = '$ad_showfimgsize',
ad_showimgauthor = '$ad_showimgauthor',
ad_cp = '$ad_cp',
ad_lightbox = '$ad_lightbox',
ad_lightbox_fa = '$ad_lightbox_fa',
ad_js_effect = '$ad_js_effect',
ad_cat_desc = '$ad_cat_desc',
ad_field1 = '$ad_field1',
ad_field2 = '$ad_field2',
ad_field3 = '$ad_field3',
ad_field4 = '$ad_field4',
ad_field5 = '$ad_field5',
ad_mini_to_js = '$ad_mini_to_js',
ad_status1 = '$ad_status1',
ad_status2 = '$ad_status2',
ad_status3 = '$ad_status3',
ad_status4 = '$ad_status4',
ad_status5 = '$ad_status5',
ad_cat_img_detail = '$ad_cat_img_detail',
ad_carusel = '$ad_carusel',
ad_bbhtml = '$ad_bbhtml',
ad_toggle = '$ad_toggle'
" );
$db->query ();
JTRedirect::_ ( "index2.php?option=$option&task=settings", JText::_ ( 'TG_SETT_SAVED') );
}
//Показ категорий
function viewCatg($option)
{
global $mainframe;
$db = & JTDB::getDBO ();
// узнаем "стартовую" категорию для показа
$catid = $mainframe->getUserStateFromRequest ( "rcid{$option}", 'rcid', 0 );
$limit = $mainframe->getUserStateFromRequest ( "viewlistlimit", 'limit', 10 );
$limitstart = $mainframe->getUserStateFromRequest ( "view{$option}limitstart", 'limitstart', 0 );
$search = $mainframe->getUserStateFromRequest ( "search{$option}", 'search', '' );
$search = $db->getEscaped ( trim ( strtolower ( $search ) ) );
$where = "";
if ($search) {
$where = " WHERE a.name LIKE '%$search%' OR a.description LIKE '%$search%'";
}
// прописываем ее в условие для отбора
if ($catid > 0)
$where ? $where .= "cid='$catid'" : $where = " WHERE cid=$catid";
$query = "SELECT count(*) FROM #__true_catg AS a $where ";
$db->setQuery ( $query );
$total = $db->loadResult ();
$lists ['cats'] = ShowDropDownCategoryList ( $catid, 'rcid', 'class="inputbox" size="1" onchange="document.adminForm.submit();"' );
require_once ($mainframe->getCfg ( 'absolute_path' ) . "/administrator/includes/pageNavigation.php");
$pageNav = new mosPageNav ( $total, $limitstart, $limit );
HTML_true::showCatOverview ( $option, $total, $catid, $lists, $pageNav, $search );
}
//Редактирование категорий
function editCatg($uid, $option)
{
global $my;
$db = & JTDB::getDBO ();
//$cat = $uid;
$row = new mosCatgs ( $db );
$row->load ( $uid );
$orders = mosGetOrderingList ( "SELECT ordering AS value, name AS text FROM #__true_catg ORDER BY ordering DESC" );
$orderlist = mosHTML::selectList ( $orders, 'ordering', 'class="inputbox"', 'value', 'text', intval ( $row->ordering ) );
if ($uid == 0) {
$row->menulink = 0;
}
$menulink = mosHTML::yesnoRadioList('menulink','class="inputbox"', $row->menulink);
if ($uid == 0) {
$row->published = 1;
}
$publist = mosHTML::yesnoRadioList ( 'published', 'class="inputbox"', $row->published );
$db->setQuery ( "SELECT id AS value, name AS text FROM #__groups ORDER BY id" );
$groups = $db->loadObjectList ();
$glist = mosHTML::selectList ( $groups, 'access', 'class="inputbox"', 'value', 'text', intval ( $row->access ) );
//листинг типов меню
$query = "SELECT params FROM #__modules WHERE module = 'mod_mainmenu'";
$db->setQuery( $query );
$menus = $db->loadObjectList();
$total = count( $menus );
$menuselect = array();
for( $i = 0; $i < $total; $i++ ) {
$params = mosParseParams( $menus[$i]->params );
$menuselect[$i]->value = $params->menutype;
$menuselect[$i]->text = $params->menutype;
}
// sort array of objects
SortArrayObjects( $menuselect, 'text', 1 );
$mgroups = mosHTML::selectList( $menuselect, 'menuselecttype', 'class="inputbox" size="1" ', 'value', 'text', $row->menuselecttype );
//список родительских\дочерних категорий
$Lists ["catgs"] = ShowDropDownCategoryList ( $row->parent, "parent", "dests" );
HTML_true::editCatg ( $row, $publist, $menulink, $option, $glist, $Lists, $mgroups, $orderlist );
}
//Сохранений категорий
function saveCatg($option, $task)
{
global $my, $mainframe;
$db = & JTDB::getDBO ();
$row = new mosCatgs ( $db );
if (! $row->bind ( $_POST )) {
echo "\n";
exit ();
}
mosMakeHtmlSafe ( $row->name );
if ($row->parent == $row->cid) {
JTRedirect::_ ( "index2.php?option=$option&task=showcatg", JText::_ ( 'TG_SUBCAT_SELECT_ERROR' ) );
}
if (! $row->check ()) {
echo "\n";
exit ();
}
if (! $row->store ()) {
echo "\n";
exit ();
}
$row->checkin ();
$row->updateOrder ( "" );
//создаем дополнительные подкаталоги с именем ID категории
require_once (TRUE_ADMIN . "config.true.php");
$ad_paththumbs = $ad_path.'/thumbs';
$ad_pathimages = $ad_path.'/pictures';
$ad_pathoriginals = $ad_path.'/originals';
@mkdir ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_pathoriginals . '/' . $row->cid, 0755 );
if (! chmod ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_pathoriginals . '/' . $row->cid, 0755 ) ) {
echo "\n";
exit ();
}
@mkdir ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_pathimages . '/' . $row->cid, 0755 );
if (! chmod ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_pathimages . '/' . $row->cid, 0755 ) ) {
echo "\n";
exit ();
}
@mkdir ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_paththumbs . '/' . $row->cid, 0755 );
if (! chmod ( $mainframe->getCfg ( 'absolute_path' ) . '/' . $ad_paththumbs . '/' . $row->cid, 0755 )) {
echo "\n";
exit ();
}
//
$menu_link_item = 'index.php?option=com_true&func=viewcategory&catid='.$row->cid.'';
$db->setQuery("SELECT link FROM #__menu WHERE link ='$menu_link_item'");
$current_menu_link = $db->loadResult();
if ($current_menu_link!=$menu_link_item && $row->menulink == '1') {
$db->setQuery("INSERT INTO #__menu (id, menutype, name, link, type, published, parent, componentid, sublevel, ordering,
checked_out, checked_out_time, pollid, browserNav, access, utaccess, params )
VALUES (NULL, '$row->menuselecttype', '$row->name', '$menu_link_item', 'components', '1', '0', '45', '0', '', '0',
'0000-00-00 00:00:00', '0', '0', '0', '0', '' )");
$db->query ();
} else if ($current_menu_link==$menu_link_item && $row->menulink == '0') {
$db->setQuery("DELETE FROM #__menu WHERE link ='$menu_link_item'");
$db->query ();
$db->setQuery("UPDATE #__true_catg SET menuselect = '' WHERE cid = '$row->cid'");
$db->query ();
} else {}
JTRedirect::_ ( "index2.php?option=$option&task=showcatg" );
}
//Публикация категорий
function publishCatg($cid = null, $publish = 1, $option)
{
global $my;
$db = & JTDB::getDBO ();
if (! is_array ( $cid ) || count ( $cid ) < 1) {
$action = $publish ? 'publish' : 'unpublish';
echo "\n";
exit ();
}
$cids = implode ( ',', $cid );
$db->setQuery ( "UPDATE #__true_catg SET published='$publish' WHERE cid IN ($cids)" );
if (! $db->query ()) {
echo "\n";
exit ();
}
if (count ( $cid ) == 1) {
$row = new mosCatgs ( $db );
$row->checkin ( $cid [0] );
}
JTRedirect::_ ( "index2.php?option=$option&task=showcatg" );
}
//Удаление категорий
function removeCatg($cid, $option)
{
global $mainframe;
$db = & JTDB::getDBO ();
if (count ( $cid )) {
$cids = implode ( ',', $cid );
foreach ( $cid as $cc ) {
$db->setQuery ( "DELETE FROM #__true_catg WHERE cid=$cc" );
$db->query ();
echo $db->getErrorMsg ();
//удаляем наш подкаталог
require_once (TRUE_ADMIN . "config.true.php");
$ad_paththumbs = $ad_path.'/thumbs/';
$ad_pathimages = $ad_path.'/pictures/';
$ad_pathoriginals = $ad_path.'/originals/';
$rmcat1 = $mainframe->getCfg ( 'absolute_path' ) . $ad_pathoriginals . $cc;
$rmcat2 = $mainframe->getCfg ( 'absolute_path' ) . $ad_pathimages . $cc;
$rmcat3 = $mainframe->getCfg ( 'absolute_path' ) . $ad_paththumbs . $cc;
rmdir ( $rmcat1 );
rmdir ( $rmcat2 );
rmdir ( $rmcat3 );
}
}
JTRedirect::_ ( "index2.php?option=$option&task=showcatg", $error );
}
//Отмена категорий (не ясно)
function cancelCatg($option)
{
$db = & JTDB::getDBO ();
$row = new mosCatgs ( $db );
$row->bind ( $_POST );
$row->checkin ();
JTRedirect::_ ( TRUE_INDEX2 . '&task=showcatg' );
}
//Путь к катеогрии (бред какой-то)
// boston тут приложился
function ShowCategoryPath($cat)
{
global $gid, $tgurl;
$db = & JTDB::getDBO ();
$cat = intval ( $cat );
if ($cat < 1)
return;
$parent = 100;
while ( $parent ) {
$db->setQuery ( "SELECT * FROM #__true_catg WHERE cid='$cat'" );
$row = $db->loadAssocList ();
//print_r($row);
$parent = $row [0] ['parent'];
$name = $row [0] ['name'];
if (empty ( $path )) {
$path = $name;
} else {
$path = $name . ' » ' . $path;
}
$cat = $parent;
}
return $path . " ";
}
//Выпадающий список катеогрий
function ShowDropDownCategoryList($cat, $cname = "cat", $extra = null, $flag = 0)
{
$db = & JTDB::getDBO ();
//$cat = '10';
$category = "