/albums.php Secret
Last active
June 18, 2018 21:39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package: RN Gallery | |
* @version: 1.3 | |
* @file: albums.php | |
* @copyright: (c) 2013 by neralex - http://www.media.soefm.de | |
* @license: http://opensource.org/licenses/gpl-license.php GNU Public License | |
*/ | |
if (!defined('MODULE_FILE')) die('You can\'t access this file directly...'); | |
if (!defined('PHP_EOL')) define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n"); | |
if ((is_user($user) && $rngalglobal->activatealbs == 1) || $rngalglobal->admin) { | |
switch($op) { | |
case 'albums': | |
albums($status, $orderby, $dir, $usr, $search, $offset, $go); | |
break; | |
case 'addalbum': | |
addalbum($offset, $go); | |
break; | |
case 'createtalbum': | |
csrf_check(); | |
createtalbum($title, $desc, $usr, $admin_approve, $gidsel, $add); | |
break; | |
case 'editalbum': | |
editalbum($albid, $status, $add, $offset, $go); | |
break; | |
case 'updatealbum': | |
csrf_check(); | |
updatealbum($albid, $title, $desc, $usr, $admin_approve, $gidsel, $add); | |
break; | |
case 'settitlepic': | |
csrf_check(); | |
settitlepic($albid, $gid, $remove); | |
break; | |
case 'deletealbum': | |
deletealbum($albid, $ok); | |
break; | |
} | |
} else { | |
Header('Location: modules.php?name=' . $module_name); exit; | |
} | |
function albums($status, $orderby, $dir, $usr, $search, $offset, $go) { | |
global $prefix, $db, $op, $module_name, $admin_file, $rngalconfig, $rngalglobal, $userinfo, $albid; | |
if ($rngalglobal->activatealbs == 0 && !$rngalglobal->admin) { | |
Header('Location: modules.php?name=' . $module_name); exit; | |
} elseif ($userinfo == false && !$rngalglobal->admin) { | |
Header('Location: modules.php?name=' . $module_name); exit; | |
} elseif (($userinfo != false && ($usr == '' || $usr != $userinfo['username'])) && !$rngalglobal->admin) { | |
Header('Location: modules.php?name=' . $module_name . '&op=' . $op . '&usr=' . $userinfo['username']); exit; | |
} | |
if (isset($status) && is_numeric($status)) { | |
$statusnumeric = $status; | |
} else { | |
$statusnumeric = ''; | |
} | |
$ordernumeric = ''; | |
if (is_numeric($orderby) && $orderby >= 0) { | |
$ordernumeric = $orderby; | |
} | |
$dirnumeric = ''; | |
if (is_numeric($dir) && $dir >= 0) { | |
$dirnumeric = $dir; | |
} | |
if ($statusnumeric == '1') { | |
$rngalstatus = '<div class="text-center thick">' . _RNGAL_SAVE . ': ' . _RNGAL_DONE . '!</div>' . PHP_EOL; | |
} elseif ($statusnumeric == '0') { | |
$rngalstatus = '<div class="text-center thick rngal_error">' . _RNGAL_SAVE . ': ' . _RNGAL_FAIL . '!</div>' . PHP_EOL; | |
} elseif ($statusnumeric == '3') { | |
$rngalstatus = '<div class="text-center thick">' . _RNGAL_DEL . ': ' . _RNGAL_DONE . '!</div>' . PHP_EOL; | |
} elseif ($statusnumeric == '2') { | |
$rngalstatus = '<div class="text-center thick rngal_error">' . _RNGAL_DEL . ': ' . _RNGAL_FAIL . '!</div>' . PHP_EOL; | |
} | |
function headfoot() { | |
echo '<tr>' , PHP_EOL | |
, '<td class="rngaltitle2">' , _RNGAL_TITLE , '</td>' , PHP_EOL | |
, '<td class="text-center">' , _RNGAL_ALBUM_TITLEPIC , '</td>' , PHP_EOL | |
, '<td class="text-center">' , _RNGAL_IMAGES , '</td>' , PHP_EOL | |
, '<td class="text-center">' , _RNGAL_USER , '</td>' , PHP_EOL | |
, '<td class="text-center">' , _RNGAL_APPROVED , '</td>' , PHP_EOL | |
, '</tr>' , PHP_EOL; | |
} | |
function hoveritems($editdel) { | |
echo '<div>' , PHP_EOL | |
, '<p>' , $editdel , '</p>' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
} | |
$path = 'modules.php?name=' . $module_name . '&op=' . $op; | |
if ($usr != '') { | |
$path .= '&usr=' . $usr; | |
} | |
if ($ordernumeric == 1) { | |
$order_by = 'a.`title`'; | |
} elseif ($ordernumeric == 2) { | |
$order_by = 'a.`approved`'; | |
} elseif ($ordernumeric == 3 && $rngalglobal->admin) { | |
$order_by = 'a.`user`'; | |
} else { | |
$order_by = 'a.`id`'; | |
} | |
if ($dirnumeric == 1) { | |
$direction = 'ASC'; | |
} else { | |
$direction = 'DESC'; | |
} | |
$where = ''; | |
if ($usr != '') { | |
$where = 'WHERE a.`user` = \'' . $db->sql_escape_string($usr) . '\''; | |
} | |
if ($search != '') { | |
$search_old = array('+',' '); | |
$search_new = array('%','%'); | |
$search = str_replace($search_old, $search_new, $search); | |
$search = '%' . $search . '%'; | |
if ($where != '') { | |
$where .= ' AND a.`title` LIKE \'' . $db->sql_escape_string(check_html($search,'nohtml')) . '\''; | |
} else { | |
$where = ' WHERE a.`title` LIKE \'' . $db->sql_escape_string(check_html($search,'nohtml')) . '\''; | |
} | |
preg_match('/%(.*)?%/i', $search, $search_in_url); | |
$search_url = str_replace('%','+',$search_in_url[1]); | |
$path .= '&search=' . rawurlencode($search_url); | |
} else { | |
$search = ''; | |
} | |
if ($ordernumeric != '') { | |
$path .= '&orderby=' . $ordernumeric; | |
} | |
if ($dirnumeric != '') { | |
$path .= '&dir=' . $dirnumeric; | |
} | |
$option = array(4, 20, 50, 100); | |
$default = 10; | |
$query = 'SELECT a.`id`, a.`image_id`, a.`user`, a.`title`, a.`desc`, a.`approved`, a.`savetime`, a.`changetime`, i.`file`, i.`filethumb`, i.`filepath`, i.`albid` FROM `' . $prefix . '_rngal_album` a LEFT JOIN `' . $prefix . '_rngal` i ON i.`id` = a.`image_id` ' . $where . ' ORDER BY ' . $order_by . ' ' . $direction . ''; | |
$opt_cnt = count($option); | |
if ($go == '' || !in_array($go, $option) || !is_numeric($go)) { | |
$go = $default; | |
} | |
$nol = $go; | |
$limit = '0, ' . $nol; | |
$count = 1; | |
$off_sql = $db->sql_query('' . $query . ''); | |
$off_pag = ceil($db->sql_numrows($off_sql)/$nol); | |
if ($offset != '') { | |
$off = $offset; | |
} else { | |
$off = ''; | |
} | |
if (!is_numeric($off) || $off < 1) { | |
$off = 1; | |
} | |
if ($off > $off_pag) { | |
$off = 1; | |
} | |
if ($off == '1') { | |
$limit = '0, ' . $nol; | |
} elseif ($off <> '') { | |
for ($i = 0; $i <= ($off - 1) * $nol; $i++) { | |
$limit = $i . ', ' . $nol; | |
$count = $i + 1; | |
} | |
} | |
$sqlqry = $db->sql_query('' . $query . ' LIMIT ' . $limit . ''); | |
$tooltip = tooltip_options($active=1, $fadeslow=0); | |
inline_js($confirm=0, $checksize=0, $checkall=1, $tooltip, $cboxrate=0, $cboxthumb=0, $zoom=0, $openclose=1, $socialshare=0, $slider=0); | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<div class="text-center">' , PHP_EOL; | |
if ($usr != '' && !$rngalglobal->admin) { | |
echo '<a class="thick" href="modules.php?name=' , $module_name , '&op=' , $op , '&usr=' , $usr , '">' , _RNGAL_MYALBUMS , '</a>' , PHP_EOL; | |
} else { | |
echo '<a class="thick" href="modules.php?name=' , $module_name , '&op=' , $op , '">' , _RNGAL_ALBUMS , '</a>' . ($usr != '' ? ' <- ADMIN' : '') , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL | |
, (isset($rngalstatus) ? $rngalstatus : ''); | |
if ($db->sql_numrows($sqlqry) > 0) { | |
headnavi($default, $path, $go); | |
echo '<div class="text-center thick">' , PHP_EOL | |
, '<form method="get" action="modules.php">' , PHP_EOL | |
, '<input type="hidden" name="name" value="' , $module_name , '" />' , PHP_EOL | |
, '<input type="hidden" name="op" value="' , $op , '" />' , PHP_EOL | |
, '<input type="text" name="search" /> ' , PHP_EOL | |
, '<input type="submit" value="' , _SEARCH , '" />' , PHP_EOL | |
, '</form>' , PHP_EOL | |
, '</div>' , PHP_EOL | |
, '<div align="center" class="rngalselect">' , PHP_EOL | |
, '<form method="get" action="modules.php">' , PHP_EOL | |
, '<input type="hidden" name="name" value="' , $module_name , '" />' , PHP_EOL | |
, '<input type="hidden" name="op" value="' , $op , '" />' , PHP_EOL; | |
if ($usr != '' && $rngalglobal->admin) { | |
$usrqry = $db->sql_query('SELECT `user` FROM `' . $prefix . '_rngal_album` GROUP BY `user` ORDER BY `user` ASC'); | |
if ($db->sql_numrows($usrqry) > 0) { | |
echo '<select size="1" name="usr" onchange="submit()">' , PHP_EOL; | |
while (list($usr_name) = $db->sql_fetchrow($usrqry)) { | |
echo ' <option value="' , $usr_name , '"' , ($usr == $usr_name ? ' selected="selected"' : '') , '>' , htmlspecialchars($usr_name, ENT_QUOTES, _CHARSET) , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL; | |
} | |
} elseif ($usr != '' && !$rngalglobal->admin) { | |
echo '<input type="hidden" name="usr" value="' , $usr , '" />' , PHP_EOL; | |
} | |
if ($search != '') { | |
echo '<input type="hidden" name="search" value="' , str_replace('+',' ',$search_url) , '" />' , PHP_EOL; | |
} | |
echo '<select size="1" name="orderby" onchange="submit()">' , PHP_EOL | |
, ' <option value="0">ID</option>' , PHP_EOL | |
, ' <option value="1"' , ($ordernumeric == 1 ? ' selected="selected"' : '') , '>' , _RNGAL_TITLE , '</option>' , PHP_EOL | |
, ' <option value="2"' , ($ordernumeric == 2 ? ' selected="selected"' : '') , '>' , _RNGAL_APPROVED , '</option>' , PHP_EOL; | |
if ($rngalglobal->admin) { | |
echo ' <option value="3"' , ($ordernumeric == 3 ? ' selected="selected"' : '') , '>' , _RNGAL_USER , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL | |
, '<select size="1" name="dir" onchange="submit()">' , PHP_EOL | |
, ' <option value="0">' , _RNGAL_DIRDESC , '</option>' , PHP_EOL | |
, ' <option value="1"' , ($dirnumeric == 1 ? ' selected="selected"' : '') , '>' , _RNGAL_DIRASC , '</option>' , PHP_EOL | |
, '</select>' , PHP_EOL; | |
if ($offset != '') { | |
echo '<input type="hidden" name="offset" value="' , $offset , '" />' , PHP_EOL; | |
} | |
if ($go != '' && $go != $default) { | |
echo '<input type="hidden" name="go" value="' , $go , '" />' , PHP_EOL; | |
} | |
echo '</form>' , PHP_EOL | |
, '</div>' , PHP_EOL | |
, '<br />' , PHP_EOL | |
, '<table border="0" cellpadding="0" cellspacing="0" class="rngallist rngal_fullwidth">' , PHP_EOL; | |
headfoot(); | |
while ($row = $db->sql_fetchrow($sqlqry)) { | |
$albid = $row['id']; | |
list($image_count) = $db->sql_fetchrow($db->sql_query('SELECT COUNT(`id`) FROM `' . $prefix . '_rngal` WHERE `albid` = \'' . $albid . '\''), SQL_NUM); | |
$approved = $row['approved']; | |
$timestamp1 = new DateTime($row['savetime']); | |
$timestamp2 = new DateTime($row['changetime']); | |
$savetime = $timestamp1->format($rngalglobal->datestring_module); | |
$changetime = $timestamp2->format($rngalglobal->datestring_module); | |
$title_shorted = 0; | |
if (strlen($row['title']) >= $rngalglobal->album_title_charlimit) { | |
$title = substr(trim($row['title']),0, $rngalglobal->album_title_charlimit) . '...'; | |
$title = htmlspecialchars($title, ENT_QUOTES, _CHARSET); | |
$title_shorted = 1; | |
} else { | |
$title = htmlspecialchars($row['title'], ENT_QUOTES, _CHARSET); | |
} | |
$desc = $row['desc']; | |
$image_file = $row['file']; | |
$image_filethumb = $row['filethumb']; | |
$image_filepath = $row['filepath']; | |
$image_id = $row['image_id']; | |
$alb_id = $row['albid']; | |
$row_user = $row['user']; | |
$alb_user = htmlspecialchars($row['user'], ENT_QUOTES, _CHARSET); | |
$image = provide_thumbnail($image_file, $image_calctype=1, $image_filethumb, $thumb_calctype=3, $image_filepath); | |
$editdel = '<a href="modules.php?name=' . $module_name . '&op=editalbum&albid=' . $albid . '">' . _EDIT . '</a>' | |
. '<a href="modules.php?name=' . $module_name . '&op=deletealbum&albid=' . $albid . '">' . _DELETE . '</a>'; | |
$titlelink = '<a href="modules.php?name=' . $module_name . '&op=editalbum&albid=' . $albid . '" class="rngal_tooltip-target" id="rngal_tooltip-target-' . $albid . '">' . $title . '</a>'; | |
if ($image['image_exist'] == 1) { | |
$tooltip_thumb = '<img src="' . $image['folder_path'] . ($image['thumb_exist'] == 1 ? $rngalglobal->userthumbs_folder . $image_filethumb : $image_file) . '" style="width:' . $image['width'] . 'px; height:' . $image['height'] . 'px;" alt="" />'; | |
} else { | |
$tooltip_thumb = '<img src="modules/' . $module_name . '/images/no-image.png" style="width:' . $rngalglobal->thumbwidth . 'px; height:' . $rngalglobal->thumbwidth . 'px;" alt="" />'; | |
} | |
$i_tooltip = '<div class="rngal_tooltip-content" id="rngal_tooltip-content-' . $albid . '">' . PHP_EOL | |
. '<div class="rngal_tooltiphead">' . htmlspecialchars($row['title'], ENT_QUOTES, _CHARSET) . '</div>' . PHP_EOL | |
. '<div class="rngal_tooltipbody">' . PHP_EOL | |
. '<div class="text-center">' . $tooltip_thumb . '</div>' . PHP_EOL | |
. ($rngalglobal->activatedesc == 1 && $desc != '' ? '<span class="thick">' . _RNGAL_DESC . '</span>:<br />' . $desc . PHP_EOL : '') | |
. '</div>' . PHP_EOL | |
. '</div>' . PHP_EOL; | |
echo '<tr class="rngalhover' , ($approved == 0 ? ' rngal_bg_marked' : '') . '">' , PHP_EOL | |
, '<td>' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL | |
, $titlelink , PHP_EOL; | |
hoveritems($editdel); | |
echo '</div>' , PHP_EOL | |
, $i_tooltip | |
, '</td>' , PHP_EOL | |
, '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , ($image_id != 0 ? _YES : _NO) , '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , $image_count , '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL | |
, '<a href="modules.php?name=' . $module_name , ($rngalglobal->admin ? '&op=' . $op : '') , '&usr=' , $row_user , '">' , $alb_user , '</a>' , PHP_EOL | |
, '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL; | |
if ($rngalglobal->admin) { | |
echo '<a class="rn_csrf" href="' , $admin_file , '.php?op=approvealbrngal&mod=1' , ($offset != '' ? '&offset=' . $offset : '') . ($go != $default ? '&go=' . $go : '') , ($usr != '' ? '&usr=' . $usr : '') , '&albid=' , $albid , '" title="' , ($approved == 1 ? _RNGAL_APPROVETITLE : _RNGAL_NOTAPPROVETITLE) , '">' , ($approved == 1 ? _YES : _NO) , '</a>' , PHP_EOL; | |
} else { | |
echo ($approved == 1 ? _YES : _NO) , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '</tr>' , PHP_EOL; | |
$count += 1; | |
} # end of while | |
headfoot(); | |
echo '</table>' , PHP_EOL; | |
footpager($path, $off, $off_pag, $go); | |
} else { | |
echo '<br /><div class="text-center">' , _RNGAL_NOTFOUND , '</div><br />' , PHP_EOL; | |
} | |
CloseTable(); | |
include_once 'footer.php'; | |
} | |
function addalbum() { | |
global $prefix, $op, $user_prefix, $db, $module_name, $rngalconfig, $rngalglobal, $userinfo; | |
inline_js($confirm=0, $checksize=0, $checkall=1, $tooltip=0, $cboxrate=0, $cboxthumb=0, $zoom=0, $openclose=1, $socialshare=0, $slider=0); | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<form method="post" action="modules.php">' , PHP_EOL | |
, '<div class="thick rngal_borderbottom rngal_paddingbottom5 rngal_marginbottom2">' , _RNGAL_ADDALBUM , '</div>' , PHP_EOL; | |
if ($rngalconfig->value('adminapprovealbs') == 1) { | |
echo '<div class="thick rngal_error">' , _RNGAL_NOTAPPROVEDFAQ , '</div>' , PHP_EOL; | |
} | |
echo '<br />' , PHP_EOL | |
, _RNGAL_ALBUM , '-' , _RNGAL_TITLE , ': <input type="text" name="title" size="30" maxlength="60" />' , PHP_EOL | |
, '<br /><br />' , PHP_EOL; | |
if ($rngalglobal->admin) { | |
echo '<div class="rngal_inlineblock rngal_padding6 rngal_border">' , PHP_EOL | |
, _RNGAL_ADMINFUNCTION , ':<br /><br />' , PHP_EOL | |
, _RNGAL_USER , ': ' , PHP_EOL | |
, '<select name="usr">' , PHP_EOL; | |
$usrresult = $db->sql_query('SELECT `username` FROM `' . $user_prefix . '_users` WHERE `user_level` != 0 AND `user_id` != 1 ORDER BY `username` ASC'); | |
while (list($nuke_user) = $db->sql_fetchrow($usrresult)) { | |
echo ' <option value="' , $nuke_user , '"' , ($nuke_user == $userinfo['username'] ? ' selected="selected"' : '') , '>' , htmlspecialchars($nuke_user, ENT_QUOTES, _CHARSET) , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL | |
, '<span class="rngal_paddingleft4">' , _RNGAL_APPROVED , '</span>: ' , PHP_EOL | |
, '<select name="admin_approve">' , PHP_EOL; | |
for($i=0; $i<=1; $i++) { | |
echo ' <option value="' , $i , '">' , ($i == 1 ? _YES : _NO) , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
} else { | |
echo '<input type="hidden" name="usr" value="' , $userinfo['username'] , '" />' , PHP_EOL; | |
} | |
echo '<br /><br />' , PHP_EOL; | |
if ($rngalglobal->activatedesc == 1) { | |
echo '<a class="rngal_openclose rngal_pointer">' , _RNGAL_DESC , ' (click)</a>:<br /><br />' , PHP_EOL | |
, '<div class="rngal_openclose_content display-none">' , PHP_EOL; | |
if ($rngalglobal->useck != 1) { | |
wysiwyg_textarea('desc','', ($rngalglobal->admin ? 'PHPNukeAdmin' : 'NukeUser'), 50, 10); | |
echo '<br />' , PHP_EOL; | |
} elseif ($rngalglobal->useck == 1) { | |
$text = wysiwyg_textarea_html('desc', '', ($rngalglobal->admin ? 'PHPNukeAdmin' : 'NukeUser'), '100%', '250px'); | |
echo '<div>' , $text , '</div><br />' , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL; | |
} | |
if ($rngalglobal->admin) { | |
echo '<div class="rngal_border rngal_border_marked rngal_padding4 rngal_margintop6 rngal_marginbottom6">' , PHP_EOL; | |
if ($userinfo != false) { | |
echo _RNGAL_ALBUM_ADDADMINUSRNOTE; | |
} else { | |
echo _RNGAL_ALBUM_ADDADMINNOTE; | |
} | |
echo '</div>' , PHP_EOL; | |
} | |
if ($userinfo != false) { | |
$path = 'modules.php?name=' . $module_name . '&op=' . $op; | |
$where = 'WHERE i.`albid` = 0 AND i.`user` = \'' . $db->sql_escape_string($userinfo['username']) . '\''; | |
albimglist($where, $path, $add=1); | |
} | |
echo '<input type="hidden" name="name" value="' , $module_name , '" />' , PHP_EOL | |
, '<input type="hidden" name="op" value="createtalbum" />' , PHP_EOL | |
, '<div class="text-center"><input type="submit" value="' , _ADD , '" /></div>' , PHP_EOL | |
, '<br />' , PHP_EOL | |
, '</form>' , PHP_EOL; | |
CloseTable(); | |
include_once 'footer.php'; | |
} | |
function createtalbum($title, $desc, $usr, $admin_approve, $gidsel, $add) { | |
global $prefix, $op, $db, $module_name, $rngalconfig, $rngalglobal, $userinfo; | |
if ($userinfo['username'] == $usr || $rngalglobal->admin) { | |
if ($title == '') { | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<div class="text-center">' , PHP_EOL | |
, '<span class="thick rngal_error">ERROR</span>' , PHP_EOL | |
, '<br />' , PHP_EOL | |
, _RNGAL_ADDNOTITLE , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, '[ <a href="javascript:history.go(-1)">' , _RNGAL_GOBACK , '</a> ]' , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
CloseTable(); | |
include_once 'footer.php'; | |
exit; | |
} | |
$savetime = date('Y-m-d H:i:s'); | |
$title_filter = $db->sql_escape_string(htmlspecialchars_decode(check_html($title, 'nohtml'), ENT_QUOTES)); | |
$usr_filter = $db->sql_escape_string(htmlspecialchars_decode(check_html($usr, 'nohtml'), ENT_QUOTES)); | |
if ($desc != '') { | |
$desc = $db->sql_escape_string(check_html($desc, '')); | |
} | |
if ($admin_approve == 1 && $rngalglobal->admin) { | |
$approved = 1; | |
} else { | |
$approved = 0; | |
} | |
$insert_album = $db->sql_query('INSERT INTO `' . $prefix . '_rngal_album` VALUES '."(NULL, 0, '$usr_filter', '$title_filter', '$desc', '$approved', '$savetime', 0)"); | |
list($calbid, $cuser) = $db->sql_fetchrow($db->sql_query('SELECT `id`, `user` FROM `' . $prefix . '_rngal_album` WHERE `user` = \'' . $db->sql_escape_string(check_html($usr, 'nohtml')) . '\' AND `title` = \'' . $db->sql_escape_string(check_html($title, 'nohtml')) . '\' AND `savetime` = \'' . $db->sql_escape_string($savetime) . '\'')); | |
if ($gidsel != '' && $calbid != '' && $cuser == $usr) { | |
$count_gidsel = count($gidsel); | |
if ($count_gidsel > 0) { | |
for ($i=0; $i < $count_gidsel; $i++) { | |
if (is_numeric($gidsel[$i])) { | |
list($cgid, $gusr) = $db->sql_fetchrow($db->sql_query('SELECT `id`, `user` FROM `' . $prefix . '_rngal` WHERE `id` = \'' . $gidsel[$i] . '\'')); | |
if ($cgid != '' && $cuser == $gusr) { | |
$update_images = $db->sql_query('UPDATE `' . $prefix . '_rngal` SET `albid` = \'' . $calbid . '\', `changetime` = NOW() WHERE `id` = \'' . $cgid . '\''); | |
} | |
} | |
} | |
} | |
} | |
if ($insert_album) { | |
$status = 1; | |
} else { | |
$status = 0; | |
} | |
Header('Location: modules.php?name=' . $module_name . '&op=albums' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} else { | |
$status = 0; | |
Header('Location: modules.php?name=' . $module_name . '&status=' . $status); exit; | |
} | |
} | |
function editalbum($albid, $status, $add, $offset, $go) { | |
global $prefix, $op, $user_prefix, $db, $module_name, $rngalconfig, $rngalglobal, $userinfo, $advanced_editor; | |
if (is_numeric($albid)) { | |
$result = $db->sql_query('SELECT `id`, `image_id`, `user`, `title`, `desc`, `approved`, `savetime`, `changetime` FROM `' . $prefix . '_rngal_album` WHERE `id` = \'' . $albid . '\''); | |
list($calbid, $image_id, $usr, $title, $desc, $approved, $savetime, $changetime) = $db->sql_fetchrow($result); | |
if ($calbid != '' && ($userinfo['username'] == $usr || $rngalglobal->admin)) { | |
$title = htmlspecialchars($title, ENT_QUOTES, _CHARSET); | |
$dirnumeric = ''; | |
if (isset($add) && !is_numeric($add) && $add != 1) { | |
$add = 0; | |
} | |
if (isset($status) && is_numeric($status)) { | |
$statusnumeric = $status; | |
} else { | |
$statusnumeric = ''; | |
} | |
if ($statusnumeric == '1') { | |
$rngalstatus = '<span class="thick">' . _RNGAL_SAVE . ': ' . _RNGAL_DONE . '!</span>' . PHP_EOL; | |
} elseif ($statusnumeric == '0') { | |
$rngalstatus = '<span class="thick rngal_error">' . _RNGAL_SAVE . ': ' . _RNGAL_FAIL . '!</span>' . PHP_EOL; | |
} | |
$tooltip = tooltip_options($active=1, $fadeslow=0); | |
inline_js($confirm=0, $checksize=0, $checkall=1, $tooltip, $cboxrate=0, $cboxthumb=0, $zoom=0, $openclose=1, $socialshare=0, $slider=0); | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<form method="post" action="modules.php">' , PHP_EOL | |
, '<div class="thick rngal_borderbottom rngal_paddingbottom5 rngal_marginbottom2">' , _RNGAL_CHANGEALBUM , ($statusnumeric != '' && isset($rngalstatus) ? ' - ' . $rngalstatus : '') , '</div>' , PHP_EOL | |
, ($approved == 0 ? '<span class="thick rngal_error">' . _RNGAL_ALBUM . ' ' . _RNGAL_NOTAPPROVED . '!</span> - ' . _RNGAL_NOTAPPROVEDFAQ . '<br />' . PHP_EOL : ''); | |
if ($approved == 1 && $image_id == 0) { | |
echo '<span class="thick rngal_error">' , _RNGAL_ALBUMLISNOTINSLIDER , '!</span>'; | |
} elseif ($approved == 1 && $image_id != 0) { | |
echo '<span class="thick">' , _RNGAL_ALBUMISINSLIDER , '!</span>'; | |
} | |
if ($approved == 1 && ($image_id == 0 || $image_id != 0)) { | |
echo ' - ' , _RNGAL_ALBUMLISTFAQ , '<br />' . PHP_EOL; | |
} | |
echo '<br />' , PHP_EOL | |
, ($image_id != 0 ? '<span class="larger">Link: <a href="modules.php?name=' . $module_name . '&alb=' . $calbid . '">' . $title . '</a></span><br />' . PHP_EOL : '') | |
, '<span class="larger">' , _RNGAL_UPLOADINSELECTEDALBUM , ': <a href="modules.php?name=' , $module_name , '&op=add&albid=' , $calbid , '">' , $title , '</a></span>' , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, _RNGAL_ALBUM , '-' , _RNGAL_TITLE , ': ' , PHP_EOL | |
, '<input type="text" name="title" value="' , $title , '" size="30" maxlength="60" />' , PHP_EOL | |
, '<br /><br />' , PHP_EOL; | |
if ($rngalglobal->admin) { | |
echo '<div class="rngal_inlineblock rngal_padding6 rngal_border">' , PHP_EOL | |
, _RNGAL_ADMINFUNCTION , ':<br /><br />' , PHP_EOL | |
, _RNGAL_USER , ': ' , PHP_EOL | |
, '<select name="usr">' , PHP_EOL; | |
$usrresult = $db->sql_query('SELECT `username`, `user_level` FROM `' . $user_prefix . '_users` WHERE `user_id` != 1 ORDER BY `username` ASC'); | |
while (list($nuke_user, $user_level) = $db->sql_fetchrow($usrresult)) { | |
echo ' <option value="' , $nuke_user , '"' , ($nuke_user == $usr ? ' selected="selected"' : '') , ($user_level == 0 ? ' class="line-through"' : '') , '>' , htmlspecialchars($nuke_user, ENT_QUOTES, _CHARSET) , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL | |
, '<span class="rngal_paddingleft4">' , _RNGAL_APPROVED , '</span>: ' , PHP_EOL | |
, '<select name="admin_approve">' , PHP_EOL; | |
for($i=0; $i<=1; $i++) { | |
echo ' <option value="' , $i , '"' , ($approved == $i ? ' selected="selected"' : '') , '>' , ($i == 1 ? _YES : _NO) , '</option>' , PHP_EOL; | |
} | |
echo '</select>' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
} else { | |
echo '<input type="hidden" name="usr" value="' , $usr , '" />' , PHP_EOL; | |
} | |
echo '<br /><br />' , PHP_EOL; | |
if ($rngalglobal->activatedesc == 1) { | |
if (!isset($advanced_editor) || $advanced_editor == 0) { | |
$desc = htmlspecialchars($desc, ENT_QUOTES, _CHARSET); | |
} | |
echo '<a class="rngal_openclose rngal_pointer">' , _RNGAL_DESC , ' (click)</a>:<br /><br />' , PHP_EOL | |
, '<div class="rngal_openclose_content display-none">' , PHP_EOL; | |
if ($rngalglobal->useck != 1) { | |
wysiwyg_textarea('desc', $desc, ($rngalglobal->admin ? 'PHPNukeAdmin' : 'NukeUser'), 50, 8); | |
echo '<br />' , PHP_EOL; | |
} elseif ($rngalglobal->useck == 1) { | |
$text = wysiwyg_textarea_html('desc', $desc, ($rngalglobal->admin ? 'PHPNukeAdmin' : 'NukeUser'), '100%', '150px'); | |
echo '<div>' , $text , '</div><br />' , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL; | |
} | |
$path = 'modules.php?name=' . $module_name . '&op=' . $op . '&albid=' . $calbid; | |
if ($add == 1) { | |
$where = 'WHERE i.`albid` = 0 AND i.`user` = \'' . $db->sql_escape_string($usr) . '\''; | |
echo '<input type="hidden" name="add" value="' , $add , '" />' , PHP_EOL; | |
} else { | |
$where = 'WHERE i.`albid` = \'' . $calbid . '\''; | |
} | |
albimglist($where, $path, $add); | |
echo '<input type="hidden" name="name" value="' , $module_name , '" />' , PHP_EOL | |
, '<br />' , PHP_EOL | |
, '<div class="text-center">' , PHP_EOL | |
, '<select name="op">' , PHP_EOL | |
, ' <option value="deletealbum">' , _RNGAL_DELALBUM , '</option>' , PHP_EOL | |
, ' <option value="updatealbum" selected="selected">' , _SAVECHANGES , '</option>' , PHP_EOL | |
, '</select>' , PHP_EOL | |
, '<input type="hidden" name="albid" value="' , $calbid , '" />' , PHP_EOL | |
, '<input type="submit" value="' , _OK , '" />' , PHP_EOL | |
, '</div>' , PHP_EOL | |
, '<br />' , PHP_EOL | |
, '</form>' , PHP_EOL; | |
CloseTable(); | |
include_once 'footer.php'; | |
} else { | |
Header('Location: modules.php?name=' . $module_name); exit; | |
} | |
} else { | |
Header('Location: modules.php?name=' . $module_name); exit; | |
} | |
} | |
function albimglist($where, $path, $add) { | |
global $prefix, $db, $op, $module_name, $admin_file, $rngalconfig, $rngalglobal, $userinfo, $albid, $offset, $go; | |
if ($userinfo != false || $rngalglobal->admin) { | |
function headfoot($add) { | |
global $op, $albid; | |
echo '<tr>' , PHP_EOL | |
, '<td class="rngaltitle2">' , _RNGAL_IMAGE , '</td>' , PHP_EOL; | |
if ($albid != '' && $add != 1) { | |
echo '<td class="text-center">' , _RNGAL_ALBUM_TITLEPIC , '</td>' , PHP_EOL; | |
} | |
echo '<td class="text-center">' , _RNGAL_APPROVED , '</td>' , PHP_EOL | |
, '<td class="text-center">' , ($add == 0 ? _DELETE : _ADD) , '</td>' , PHP_EOL | |
, '</tr>' , PHP_EOL; | |
} | |
function hoveritems($editdel) { | |
echo '<div>' , PHP_EOL | |
, '<p>' , $editdel , '</p>' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
} | |
$option = array(4, 20, 50, 100); | |
$default = 10; | |
$query = 'SELECT i.`id`, i.`catid`, i.`albid`, i.`file`, i.`user`, i.`title`, i.`desc`, i.`counter`, i.`approved`, i.`file`, i.`filethumb`, i.`filepath`, a.`image_id`, a.`id` as `albid` FROM `' . $prefix . '_rngal` i LEFT JOIN `' . $prefix . '_rngal_album` a ON i.`albid` = a.`id` ' . $where . ' ORDER BY `id` ASC'; | |
$opt_cnt = count($option); | |
if ($go == '' || !in_array($go, $option) || !is_numeric($go)) { | |
$go = $default; | |
} | |
$nol = $go; | |
$limit = '0, ' . $nol; | |
$count = 1; | |
$off_sql = $db->sql_query('' . $query . ''); | |
$off_pag = ceil($db->sql_numrows($off_sql)/$nol); | |
if ($offset != '') { | |
$off = $offset; | |
} else { | |
$off = ''; | |
} | |
if (!is_numeric($off) || $off < 1) { | |
$off = 1; | |
} | |
if ($off > $off_pag) { | |
$off = 1; | |
} | |
if ($off == '1') { | |
$limit = '0, ' . $nol; | |
} elseif ($off <> '') { | |
for ($i = 0; $i <= ($off - 1) * $nol; $i++) { | |
$limit = $i . ', ' . $nol; | |
$count = $i + 1; | |
} | |
} | |
$sqlqry = $db->sql_query('' . $query . ' LIMIT ' . $limit . ''); | |
echo '<div class="text-center">' , PHP_EOL; | |
if ($op == 'editalbum') { | |
if ($add != 1) { | |
echo '[ ' , _RNGAL_ALBUM_CURRENTIMAGES , ' ] ' , PHP_EOL; | |
} else { | |
echo '[ <a href="' , $path , '">' , _RNGAL_ALBUM_CURRENTIMAGES , '</a> ] ' , PHP_EOL; | |
} | |
} | |
echo '<span class="thick">' , _RNGAL_IMAGES , '</span>' , PHP_EOL; | |
if ($op == 'editalbum') { | |
if ($add == 1) { | |
echo ' [ ' , _RNGAL_ALBUM_ADDNEWIMAGES , ' ]' , PHP_EOL; | |
$path .= '&add=1'; | |
} else { | |
echo ' [ <a href="' , $path , '&add=1">' , _RNGAL_ALBUM_ADDNEWIMAGES , '</a> ]' , PHP_EOL; | |
#echo ' [ <a href="modules.php?name=' , $module_name , '&op=add&albid=' , $albid , '">' , _RNGAL_ALBUM_ADDNEWIMAGES , '</a> ]' , PHP_EOL; | |
} | |
} | |
echo '</div>' , PHP_EOL; | |
if ($db->sql_numrows($sqlqry) > 0) { | |
headnavi($default, $path, $go); | |
echo '<table border="0" cellpadding="0" cellspacing="0" class="rngallist rngal_fullwidth">' , PHP_EOL; | |
headfoot($add); | |
while ($row = $db->sql_fetchrow($sqlqry)) { | |
$gid = $row['id']; | |
$approved = $row['approved']; | |
$title_shorted = 0; | |
if (strlen($row['title']) >= $rngalglobal->album_title_charlimit) { | |
$title = substr(trim($row['title'], 'nohtml'),0, $rngalglobal->album_title_charlimit) . '...'; | |
$title = htmlspecialchars($title, ENT_QUOTES, _CHARSET); | |
$title_shorted = 1; | |
} else { | |
$title = htmlspecialchars($row['title'], ENT_QUOTES, _CHARSET); | |
} | |
$desc = $row['desc']; | |
$image_file = $row['file']; | |
$image_filethumb = $row['filethumb']; | |
$image_filepath = $row['filepath']; | |
$image_id = $row['image_id']; | |
$alb_id = $row['albid']; | |
$image = provide_thumbnail($image_file, $image_calctype=1, $image_filethumb, $thumb_calctype=3, $image_filepath); | |
$editdel = '<a href="modules.php?name=' . $module_name . '&op=edit&gid=' . $gid . '">' . _EDIT . '</a>' | |
. '<a href="modules.php?name=' . $module_name . '&op=delete&gid=' . $gid . '">' . _DELETE . '</a>'; | |
$titlelink = '<a href="modules.php?name=' . $module_name . '&op=detail&gid=' . $gid . '" class="rngal_tooltip-target" id="rngal_tooltip-target-' . $gid . '">' . $title . '</a>'; | |
if ($image['image_exist'] == 1) { | |
$tooltip_thumb = '<img src="' . $image['folder_path'] . ($image['thumb_exist'] == 1 ? $rngalglobal->userthumbs_folder . $image_filethumb : $image_file) . '" style="width:' . $image['width'] . 'px; height:' . $image['height'] . 'px;" alt="" />'; | |
} else { | |
$tooltip_thumb = '<img src="modules/' . $module_name . '/images/no-image.png" style="width:' . $rngalglobal->thumbwidth . 'px; height:' . $rngalglobal->thumbwidth . 'px;" alt="" />'; | |
} | |
$i_tooltip = '<div class="rngal_tooltip-content" id="rngal_tooltip-content-' . $gid . '">' . PHP_EOL | |
. '<div class="rngal_tooltiphead">' . htmlspecialchars($row['title'], ENT_QUOTES, _CHARSET) . '</div>' . PHP_EOL | |
. '<div class="rngal_tooltipbody">' . PHP_EOL | |
. '<div class="text-center">' . $tooltip_thumb . '</div>' . PHP_EOL | |
. ($rngalglobal->activatedesc == 1 && $desc != '' ? '<span class="thick">' . _RNGAL_DESC . '</span>:<br />' . $desc . PHP_EOL : '') | |
. '</div>' . PHP_EOL | |
. '</div>' . PHP_EOL; | |
echo '<tr class="rngalhover">' , PHP_EOL | |
, '<td>' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL | |
, $titlelink , PHP_EOL; | |
hoveritems($editdel); | |
echo '</div>' , PHP_EOL | |
, $i_tooltip | |
, '</td>' , PHP_EOL; | |
if ($albid != '' && $add != 1) { | |
echo '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL | |
, '<a class="rn_csrf" href="modules.php?name=' , $module_name , '&op=settitlepic' , ($image_id == $gid ? '&remove=1' : '') , '&albid=' , $albid , '&gid=' , $gid , '" title="' , ($image_id == $gid ? _RNGAL_ALBUM_DESELECTTITLEPIC : _RNGAL_ALBUM_SETTITLEPIC) , '">' , ($image_id == $gid ? _YES : _NO) , '</a>' , PHP_EOL | |
, '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL; | |
} | |
echo '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip">' , PHP_EOL; | |
if ($rngalglobal->admin) { | |
if ($op == 'editalbum' && $albid != '') { | |
$mod = 3; | |
} elseif ($op == 'editalbum') { | |
$mod = 4; | |
} elseif ($op == 'addalbum') { | |
$mod = 7; | |
} | |
echo '<a class="rn_csrf" href="' , $admin_file , '.php?op=approverngal&mod=' , $mod , '&albid=' , $albid , ($offset != '' ? '&offset=' . $offset : '') , ($go != $default ? '&go=' . $go : '') , '&gid=' , $gid , ($add == 1 ? '&add=1' : '') , '" title="' , ($approved == 1 ? _RNGAL_APPROVETITLE : _RNGAL_NOTAPPROVETITLE) , '">' , ($approved == 1 ? _YES : _NO) , '</a>' , PHP_EOL; | |
} else { | |
echo ($approved == 1 ? _YES : _NO) , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '<td class="text-center">' , PHP_EOL | |
, '<div class="tooltip rngal_reset_checkbox"><input id="gidsel_' , $gid , '" name="gidsel[]" type="checkbox" value="' , $gid , '" class="rngal_checkme" /></div>' , PHP_EOL | |
, '</td>' , PHP_EOL | |
, '</tr>' , PHP_EOL; | |
$count += 1; | |
} | |
headfoot($add); | |
echo '</table>' , PHP_EOL | |
, '<input type="hidden" name="name" value="' , $module_name , '" />' , PHP_EOL | |
, '<input type="hidden" name="op" value="delselrngal" />' , PHP_EOL | |
, '<br /><div class="text-center">' , PHP_EOL | |
, '<span>' , _RNGAL_SELECTALL , '</span> <input type="checkbox" class="rngal_valignmid" id="selectall" />' , PHP_EOL | |
, '</div>' , PHP_EOL; | |
footpager($path, $off, $off_pag, $go); | |
} else { | |
echo '<br /><div class="text-center">' , _RNGAL_NOTFOUND , '</div><br />' , PHP_EOL; | |
} | |
} | |
} | |
function settitlepic($albid, $gid, $remove) { | |
global $prefix, $db, $module_name, $userinfo, $rngalglobal; | |
if (is_numeric($albid) && is_numeric($gid)) { | |
list($calbid, $image_id, $cusr) = $db->sql_fetchrow($db->sql_query('SELECT `id`, `image_id`, `user` FROM `' . $prefix . '_rngal_album` WHERE `id` = \'' . $albid . '\'')); | |
if ($calbid != '' && ($userinfo['username'] == $cusr || $rngalglobal->admin)) { | |
list($cgid, $gusr) = $db->sql_fetchrow($db->sql_query('SELECT `id`, `user` FROM `' . $prefix . '_rngal` WHERE `id` = \'' . $gid . '\' AND `albid` = \'' . $calbid . '\'')); | |
if ($cgid != '' && $gusr == $cusr) { | |
if ($remove == 1 && $image_id != 0) { | |
$update_album = $db->sql_query('UPDATE `' . $prefix . '_rngal_album` SET `image_id` = 0, `changetime` = NOW() WHERE `id` = \'' . $calbid . '\''); | |
} else { | |
$update_album = $db->sql_query('UPDATE `' . $prefix . '_rngal_album` SET `image_id` = \'' . $cgid . '\', `changetime` = NOW() WHERE `id` = \'' . $calbid . '\''); | |
} | |
} | |
if (isset($update_album)) { | |
$status = 1; | |
} else { | |
$status = 0; | |
} | |
Header('Location: modules.php?name=' . $module_name . '&op=editalbum&albid=' . $calbid . '&status=' . $status); exit; | |
} else { | |
$status = 0; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} else { | |
$status = 0; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} | |
function updatealbum($albid, $title, $desc, $usr, $admin_approve, $gidsel, $add) { | |
global $prefix, $db, $module_name, $userinfo, $rngalglobal; | |
if (is_numeric($albid) && ($userinfo['username'] == $usr || $rngalglobal->admin)) { | |
if ($title == '') { | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<div class="text-center">' , PHP_EOL | |
, ' <span class="thick rngal_error">ERROR</span>' , PHP_EOL | |
, ' <br />' , PHP_EOL | |
, ' ' , _RNGAL_ADDNOTITLE , PHP_EOL | |
, ' <br /><br />' , PHP_EOL | |
, ' [ <a href="javascript:history.go(-1)">' , _RNGAL_GOBACK , '</a> ]' , PHP_EOL | |
, ' <br /><br />' , PHP_EOL | |
, ' </div>' , PHP_EOL; | |
CloseTable(); | |
include_once 'footer.php'; | |
exit; | |
} | |
list($calbid, $image_id, $cusr) = $db->sql_fetchrow($db->sql_query('SELECT `id`, `image_id`, `user` FROM `' . $prefix . '_rngal_album` WHERE `id` = \'' . $albid . '\'')); | |
if ($calbid != '' && ($userinfo['username'] == $cusr || $rngalglobal->admin)) { | |
$title = $db->sql_escape_string(htmlspecialchars_decode(check_html($title, 'nohtml'), ENT_QUOTES)); | |
$usr = $db->sql_escape_string(htmlspecialchars_decode(check_html($usr, 'nohtml'), ENT_QUOTES)); | |
if ($desc != '') { | |
$desc = $db->sql_escape_string(check_html($desc, '')); | |
$description = ', `desc` = \'' . $desc . '\''; | |
} else { | |
$description = ''; | |
} | |
if ($rngalglobal->admin && is_numeric($admin_approve)) { | |
$approved = ', `approved` = \'' . $admin_approve . '\''; | |
} else { | |
$approved = ''; | |
} | |
$update_album = $db->sql_query('UPDATE `' . $prefix . '_rngal_album` SET '."`title` = '$title', `user` = '$usr', `changetime` = NOW()" . $description . $approved . ' WHERE `id` = \'' . $calbid . '\''); | |
if ($gidsel != '') { | |
if ($add == 1) { | |
$alb_id = $calbid; | |
} else { | |
$alb_id = 0; | |
} | |
$count_gidsel = count($gidsel); | |
if ($count_gidsel > 0) { | |
for ($i=0; $i < $count_gidsel; $i++) { | |
if (is_numeric($gidsel[$i])) { | |
list($cgid) = $db->sql_fetchrow($db->sql_query('SELECT `id` FROM `' . $prefix . '_rngal` WHERE `id` = \'' . $gidsel[$i] . '\'')); | |
if ($cgid != '') { | |
if ($add != 1 && $image_id == $cgid) { | |
$update_alb_titlepic = $db->sql_query('UPDATE `' . $prefix . '_rngal_album` SET `image_id` = 0, `changetime` = NOW() WHERE `image_id` = \'' . $cgid . '\''); | |
} | |
$update_images = $db->sql_query('UPDATE `' . $prefix . '_rngal` SET `albid` = \'' . $alb_id . '\', `changetime` = NOW() WHERE `id` = \'' . $cgid . '\''); | |
} | |
} | |
} | |
} | |
} | |
if ($update_album) { | |
$status = 1; | |
} else { | |
$status = 0; | |
} | |
Header('Location: modules.php?name=' . $module_name . '&op=editalbum&albid=' . $calbid . '&status=' . $status); exit; | |
} else { | |
$status = 0; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} else { | |
$status = 0; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} | |
function deletealbum($albid, $ok=0) { | |
global $prefix, $db, $module_name, $rngalconfig, $rngalglobal, $userinfo, $op, $zoom; | |
if (is_numeric($albid)) { | |
$result = $db->sql_query('SELECT `id`, `title`, `image_id`, `user` FROM `' . $prefix . '_rngal_album` WHERE `id` = \'' . $albid . '\''); | |
list($calbid, $title, $image_id, $usr) = $db->sql_fetchrow($result); | |
if ($calbid != '' && ($userinfo['username'] == $usr || $rngalglobal->admin)) { | |
list($countgid) = $db->sql_fetchrow($db->sql_query('SELECT COUNT(`id`) FROM `' . $prefix . '_rngal` WHERE `albid` = \'' . $calbid . '\''), SQL_NUM); | |
$title = htmlspecialchars($title, ENT_QUOTES, _CHARSET); | |
if ($ok) { | |
csrf_check(); | |
$qry1 = $db->sql_query('DELETE FROM `' . $prefix . '_rngal_album` WHERE `id` = \'' . $calbid . '\''); | |
if ($countgid > 0) { | |
$qry2 = $db->sql_query('UPDATE `' . $prefix . '_rngal` SET `albid` = 0, `changetime` = NOW() WHERE `albid` = \'' . $calbid . '\''); | |
} | |
if ($qry1) { | |
$status = 3; | |
} else { | |
$status = 2; | |
} | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} else { | |
$gid_result = $db->sql_query('SELECT `id`, `file`, `filethumb`, `filepath`, `user` FROM `' . $prefix . '_rngal` WHERE `id` = \'' . $image_id . '\''); | |
list($gid, $image_file, $image_filethumb, $image_filepath) = $db->sql_fetchrow($gid_result); | |
$image = provide_thumbnail($image_file, $image_calctype=1, $image_filethumb, $thumb_calctype=3, $image_filepath); | |
if ($image['image_exist'] == 1 && ($image['full_width'] > $rngalglobal->cbox_max_value || $image['full_height'] > $rngalglobal->cbox_max_value)) { | |
$zoom_url = $image['folder_path'] . $image_file; | |
$zoom = zoom_options($active=1, $zoom_url, $cbox=1, $image['cbox_width'], $image['cbox_height'], $title, $zoom_url); | |
$cboxthumb = 0; | |
} else { | |
$zoom_url = 0; | |
$cboxthumb = 1; | |
} | |
inline_js($confirm=0, $checksize=0, $checkall=0, $tooltip=0, $cboxrate=0, $cboxthumb, $zoom, $openclose=0, $socialshare=0, $slider=0); | |
include_once 'header.php'; | |
rngal_titlepic(); | |
rngal_user_menue($userinfo['username']); | |
OpenTable(); | |
echo '<div class="text-center">' , PHP_EOL | |
, '<span class="thick">' , _RNGAL_DELALBUM , '?</span>' , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, _RNGAL_TITLE , ': <span class="thick">' , $title , '</span> - ' , _RNGAL_USER , ': <span class="thick">' , htmlspecialchars($usr, ENT_QUOTES, _CHARSET) , '</span>' , PHP_EOL | |
, '<br />' | |
, _RNGAL_IMAGESINALBUM , ' ' , $countgid , ' ' , ($countgid == 1 ? _RNGAL_SMALLIMAGE : _RNGAL_SMALLIMAGES) , '.' , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, '<div class="rngal_padding4 rngal_inlineblock rngal_valignmid rngal_border text-center">' , PHP_EOL; | |
if ($image['image_exist'] == 1) { | |
$image_link_class = 'rngal_inlineblock' . ($image['full_height'] > $rngalglobal->thumbwidth ? ' thumbcbox' : ''); | |
$image_link_style = 'width:' . $rngalglobal->thumbwidth . 'px; height:' . $rngalglobal->thumbwidth . 'px; overflow:hidden;'; | |
echo '<a class="' , $image_link_class , '" style="' , $image_link_style , '" href="' , $image['folder_path'] , $image_file , '" target="_blank" title="' , $title , '">' , PHP_EOL | |
, '<img src="' , $image['folder_path'] , ($image['thumb_exist'] == 1 ? $rngalglobal->userthumbs_folder . $image_filethumb : $image_file) , '" class="relative" style="top:' , floor(($rngalglobal->thumbwidth - $image['height'])/2) , 'px; width:' , $image['width'] , 'px; height:' , $image['height'] , 'px;" alt="" />' , PHP_EOL | |
, '</a>' , PHP_EOL; | |
} else { | |
echo '<img src="modules/' , $module_name , '/images/no-image.png" style="width:' , $rngalglobal->thumbwidth , 'px; height:' . $rngalglobal->thumbwidth . 'px;" alt="" /><br />' , PHP_EOL; | |
} | |
echo '</div>' , PHP_EOL | |
, '<br /><br />' , PHP_EOL | |
, '<span class="rngal_listbutton"><a href="javascript:history.go(-1)">' , _NO , '</a></span>' , PHP_EOL | |
, '<span class="rngal_listbutton rngal_marginleft4">' , PHP_EOL | |
, '<a class="rn_csrf" href="modules.php?name=' , $module_name , '&op=' , $op , '&albid=' , $calbid , '&ok=1">' , _YES , '</a>' , PHP_EOL | |
, '</span>' , PHP_EOL | |
, '</div><br />' , PHP_EOL; | |
CloseTable(); | |
include_once 'footer.php'; | |
} | |
} else { | |
$status = 2; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} else { | |
$status = 2; | |
Header('Location: modules.php?name=' . $module_name . '&albums&' . (!$rngalglobal->admin ? '&usr=' . $usr : '') . '&status=' . $status); exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment