$onerow->file = $this->CreateLink($id, 'editgallery', $returnid, $gallery['fileid'] == 1 ? 'Gallery/' : $gallery['filename'], array('gid' => $gallery['fileid'], 'mode' => "edit")); $onerow->dirtag = '{Gallery' . ($gallery['fileid'] == 1 ? '}' : ' dir=\'' . substr($gallery['filepath'] . $gallery['filename'], 0, -1) . '\'}'); if ($gallery['active']) { $activeimage = $themeObject->DisplayImage('icons/system/true.gif', $this->Lang('setfalse'), '', '', 'systemicon'); } else { $activeimage = $themeObject->DisplayImage('icons/system/false.gif', $this->Lang('settrue'), '', '', 'systemicon'); } $onerow->activelink = $this->CreateLink($id, 'multiaction', $returnid, $activeimage, array('multiaction' => 'switchactive', 'gid' => $gallery['galleryid'], 'fid' => $gallery['fileid'], 'origaction' => 'defaultadmin')); $onerow->editlink = $this->CreateLink($id, 'editgallery', $returnid, $themeObject->DisplayImage('icons/system/edit.gif', $this->Lang('editgallery'), '', '', 'systemicon'), array('gid' => $gallery['fileid'], 'mode' => "edit")); $onerow->deletelink = $this->CheckPermission('Gallery - Edit all galleries') ? $this->CreateLink($id, 'multiaction', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'), '', '', 'systemicon'), array('multiaction' => 'delete', 'gid' => $gallery['galleryid'], 'fid' => $gallery['fileid'], 'origaction' => 'defaultadmin'), $this->Lang('areyousure')) : ''; $onerow->imgselect = $this->CreateInputCheckbox($id, 'imgselect[' . $gallery['fileid'] . ']', 1); if (is_dir('../' . DEFAULT_GALLERY_PATH . $gallery['filepath'] . $gallery['filename']) || $gallery['fileid'] == 1) { array_push($showgalleries, $onerow); } else { // delete directory and all of its contents from the database Gallery_utils::DeleteGalleryDB($gallery['filepath'] . $gallery['filename'], $gallery['fileid']); } } } $smarty->assign_by_ref('items', $showgalleries); $smarty->assign('itemcount', count($showgalleries)); $smarty->assign('formstart', $this->CreateFormStart($id, 'multiaction', $returnid, 'post', '', false, '', array('origaction' => 'defaultadmin', 'gid' => 1))); $smarty->assign('formend', $this->CreateFormEnd()); $multiactionlist = array($this->Lang('delete') => 'delete', $this->Lang('active') => 'active', $this->Lang('inactive') => 'inactive'); $smarty->assign('prompt_multiaction', $this->CheckPermission('Gallery - Edit all galleries') ? $this->Lang('withselected') : ''); $smarty->assign('multiaction', $this->CheckPermission('Gallery - Edit all galleries') ? $this->CreateInputDropdown($id, 'multiaction', $multiactionlist, -1) . ' ' . $this->CreateInputSubmit($id, 'multiactionsubmit', $this->Lang('apply'), '', '', $this->Lang('areyousuremulti')) : ''); $smarty->assign('gallerypath', $this->Lang('gallerypath')); $smarty->assign('dirtag', $this->Lang('dirtag')); $smarty->assign('active', $this->Lang('active')); $smarty->assign('addgallery', $this->CheckPermission('Gallery - Edit all galleries') && $this->CheckPermission('Gallery - Add subgalleries') ? $this->CreateLink($id, 'editgallery', $returnid, $themeObject->DisplayImage('icons/system/newfolder.gif', $this->Lang('addsubgallery'), '', '', 'systemicon'), array('gid' => -1, 'mode' => 'add')) . ' ' . $this->CreateLink($id, 'editgallery', $returnid, $this->Lang('addsubgallery'), array('gid' => -1, 'mode' => 'add')) : ''); // Display the populated template
$nopermission++; } } } $fids = trim($fids, ','); switch ($params['multiaction']) { case 'delete': if ($permission_to_edit == 'all') { foreach ($fid_array as $fid) { $fileinfo = Gallery_utils::Getgalleryinfobyid($fid); if (strpos($fileinfo['filename'], "/") === FALSE) { // delete only one file Gallery_utils::DeleteGalleryDB('do_not_delete_directory', $fid); } else { // delete directory and files Gallery_utils::DeleteGalleryDB($fileinfo['filepath'] . $fileinfo['filename'], $fid); } } $gid = empty($params['gid']) ? $fileinfo['galleryid'] : $params['gid']; } else { $nopermission += count($fid_array); } break; case 'rotateclockwise': case 'rotateanticlockwise': if ($permission_to_edit == 'all' || $permission_to_edit == 'this') { foreach ($fid_array as $fid) { $fileinfo = Gallery_utils::Getgalleryinfobyid($fid); $image = '../' . DEFAULT_GALLERY_PATH . $fileinfo['filepath'] . $fileinfo['filename']; $degrees = $params['multiaction'] == 'rotateclockwise' ? 270 : 90; Gallery_utils::RotateImage($image, $degrees);