Помогите с фотогалереей!
Но сама svadebsk.ru/photos уже несколько месяцев не работает...
В админке не показывает никакие альбомы. В общем еле живая сейчас на сайте...
И второе, есть ли резон попытаться на 1.9 переехать?
Как восстановить?
Всё-таки мне кажется это тпл… Потому что сам сайт работает, а галерея нет, значит шаблон не повреждён...
Насчёт резона миграции. Снимите резервные копии БД и файловой системы и попробуйте мигрировать. Возможно всё разрешиться, вам останется только адаптировать шаблон.
буду на 1.9 переезжать
В любом случаи скиньте код этого файла посмотреть.
<?php /******************************************************************************/ // // // InstantCMS v1.8 // // http://instantcms.ru/ // // // // written by InstantCMS Team, 2007-2010 // // produced by InstantSoft, (www.instantsoft.ru) // // // // LICENSED BY GNU/GPL v2 // // // /******************************************************************************/ class cms_model_photos{ function __construct(){ $this->inDB = cmsDatabase::getInstance(); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function install(){ return true; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function getCommentTarget($target, $target_id) { switch($target){ case 'palbum': $album = $this->inDB->get_fields('cms_photo_albums', "id='{$target_id}'", 'title'); if (!$album) { return false; } $result['link'] = '/photos/'.$target_id; $result['title'] = $album['title']; break; case 'photo': $photo = $this->inDB->get_fields('cms_photo_files', "id='{$target_id}'", 'title'); if (!$photo) { return false; } $result['link'] = '/photos/photo'.$target_id.'.html'; $result['title'] = $photo['title']; break; } return ($result ? $result : false); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function deletePhoto($id, $file=''){ $inCore = cmsCore::getInstance(); $inCore->loadLib('tags'); cmsCore::callEvent('DELETE_PHOTO', $id); if (!$file){ $file = $this->inDB->get_field('cms_photo_files', "id='{$id}'", 'file'); } if (!$file){ return false; } $this->deletePhotoFile($file, PATH.'/images/photos/'); $inCore->deleteComments('photo', $id); $inCore->deleteRatings('photo', $id); cmsActions::removeObjectLog('add_photo', $id); $sql = "DELETE FROM cms_photo_files WHERE id = '$id'"; $this->inDB->query($sql) ; cmsClearTags('photo', $id); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function deletePhotos($id_list){ cmsCore::callEvent('DELETE_PHOTOS', $id_list); foreach($id_list as $key=>$id){ $this->deletePhoto($id); } return true; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function updatePhoto($id, $photo){ $inCore = cmsCore::getInstance(); $inUser = cmsUser::getInstance(); $photo = cmsCore::callEvent('UPDATE_PHOTO', $photo); $sql = "UPDATE cms_photo_files SET album_id = '{$photo['album_id']}', title='{$photo['title']}', file='{$photo['filename']}', description='{$photo['description']}', published='{$photo['published']}', showdate='{$photo['showdate']}' WHERE id = '$id' LIMIT 1"; $this->inDB->query($sql); cmsInsertTags($photo['tags'], 'photo', $id); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function addPhoto($photo, $differ = '', $user_id = false){ $inCore = cmsCore::getInstance(); $inUser = cmsUser::getInstance(); $photo = cmsCore::callEvent('ADD_PHOTO', $photo); $user_id = $user_id ? $user_id : $inUser->id; if (!$user_id) { return false; } $sql = "INSERT INTO cms_photo_files (album_id, title, description, pubdate, file, published, showdate, comments, user_id, owner) VALUES ('{$photo['album_id']}', '{$photo['title']}', '{$photo['description']}', NOW(), '{$photo['filename']}', '{$photo['published']}', '{$photo['showdate']}', 1, '{$user_id}', '{$differ}')"; $this->inDB->query($sql); $photo_id = $this->inDB->get_last_id('cms_photo_files'); cmsInsertTags($photo['tags'], 'photo', $photo_id); cmsUser::checkAwards($user_id); $album_title = $this->inDB->get_field('cms_photo_albums', "id='{$photo['album_id']}'", 'title'); if ($photo['published']) { $description = $photo['is_hidden'] ? '' : '<a href="/photos/photo'.$photo_id.'.html" class="act_photo"><img border="0" src="/images/photos/small/'.$photo['filename'].'" /></a>'; 'object' => $photo['title'], 'object_url' => '/photos/photo'.$photo_id.'.html', 'object_id' => $photo_id, 'target' => $album_title, 'target_url' => '/photos/'.$photo['album_id'], 'description' => $description )); } return $photo_id; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function randPhoto($album_id, $is_sub=false){ $catsql = 'AND f.album_id = '.$album_id; if ($is_sub && $album_id != '0') { $rootcat = $this->inDB->get_fields('cms_photo_albums', 'id='.$album_id, 'NSLeft, NSRight, NSDiffer'
С вашим файлом и у меня не работает отображение. Код пока глянуть не могу диплом пишу. Попробуйте пока так.
<?php /******************************************************************************/ // // // InstantCMS v1.9 // // http://instantcms.ru/ // // // // written by InstantCMS Team, 2007-2011 // // produced by InstantSoft, (www.instantsoft.ru) // // // // LICENSED BY GNU/GPL v2 // // // /******************************************************************************/ class cms_model_photos{ function __construct(){ $this->inDB = cmsDatabase::getInstance(); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function install(){ return true; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function getCommentTarget($target, $target_id) { switch($target){ case 'palbum': $album = $this->inDB->get_fields('cms_photo_albums', "id='{$target_id}'", 'title'); if (!$album) { return false; } $result['link'] = '/photos/'.$target_id; $result['title'] = $album['title']; break; case 'photo': $photo = $this->inDB->get_fields('cms_photo_files', "id='{$target_id}'", 'title'); if (!$photo) { return false; } $result['link'] = '/photos/photo'.$target_id.'.html'; $result['title'] = $photo['title']; break; } return ($result ? $result : false); } /* ==================================================================================================== */ /* ==================================================================================================== */ // // этот метод вызывается компонентом comments при создании нового комментария // // метод должен вернуть 0 или 1 // public function getVisibility($target, $target_id) { $is_hidden = 0; switch($target){ case 'photo': $photo = $this->getPhoto($target_id); $album = $this->getAlbum($photo['album_id']); $clubtype = $this->inDB->get_field('cms_clubs', "id='{$album['user_id']}'", 'clubtype'); if($clubtype == 'private') { $is_hidden = 1; } } break; } return $is_hidden; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function deletePhoto($id, $file=''){ $inCore = cmsCore::getInstance(); $inCore->loadLib('tags'); cmsCore::callEvent('DELETE_PHOTO', $id); if (!$file){ $file = $this->inDB->get_field('cms_photo_files', "id='{$id}'", 'file'); } if (!$file){ return false; } $this->deletePhotoFile($file, PATH.'/images/photos/'); $inCore->deleteComments('photo', $id); $inCore->deleteRatings('photo', $id); cmsActions::removeObjectLog('add_photo', $id); $sql = "DELETE FROM cms_photo_files WHERE id = '$id'"; $this->inDB->query($sql) ; cmsClearTags('photo', $id); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function deletePhotos($id_list){ cmsCore::callEvent('DELETE_PHOTOS', $id_list); foreach($id_list as $key=>$id){ $this->deletePhoto($id); } return true; } /* ==================================================================================================== */ /* ==================================================================================================== */ public function updatePhoto($id, $photo){ $inCore = cmsCore::getInstance(); $inUser = cmsUser::getInstance(); $photo = cmsCore::callEvent('UPDATE_PHOTO', $photo); $sql = "UPDATE cms_photo_files SET album_id = '{$photo['album_id']}', title='{$photo['title']}', file='{$photo['filename']}', description='{$photo['description']}', published='{$photo['published']}', showdate='{$photo['showdate']}' WHERE id = '$id' LIMIT 1"; $this->inDB->query($sql); cmsInsertTags($photo['tags'], 'photo', $id); } /* ==================================================================================================== */ /* ==================================================================================================== */ public function addPhoto($photo, $differ = '', $user_id = false){ $inCore = cmsCore::getInstance(); $inUser = cmsUser::getInstance(); $photo = cmsCore::callEvent('ADD_PHOTO', $photo); $user_id = $user_id ? $user_id : $inUser->id; if (!$user_id) { return false; } $sql = "INSERT INTO cms_photo_files (album_id, title, description, pubdate, file, published, showdate, comments, user_id, owner) VALUES ('{$photo['album_id']}', '{$photo['title']}', '{$photo['description']}', NOW(), '{$photo['filename']}', '{$photo['published']}', '{$photo['showdate']}', 1, '{$user_id}', '{$differ}')"; $this->inDB->query($sql); $photo_id = $this->inDB->get_last_id('cms_photo_files'); cmsInsertTags($photo['tags'], 'photo', $photo_id); cmsUser::checkAwards($user_id); $album_title = $this->inDB->get_field('cms_photo_albums', "id='{$photo['album_id']}'", 'title'); if ($photo['published']) { $description = $photo['is_hidden'] ? '' : '<a href="/photos/photo'.$photo_id.'.html" c
В принципе вы можете попробовать, нечего страшного случиться не должно. Если не подойдёт всегда можно назад код поменять. Но можете подождать, но честно не знаю когда я смогу посмотреть код. Только после написания диплома. Если не срочно можете подождать.
Вот если не поможет тогда или ждать или пробовать тот код.
Пробовал код изначально чистой рабочей системы из дистрибутива вставить, ноль реакции…