/** * Handles Image bulk actions * @param $album */ function processImageBulkActions($album) { $action = sanitize($_POST['checkallaction']); $result = zp_apply_filter('processBulkImageSave', NULL, $action, $album); $ids = sanitize($_POST['ids']); $total = count($ids); if ($action != 'noaction') { if ($total > 0) { if ($action == 'addtags') { $tags = bulkTags(); } if ($action == 'moveimages' || $action == 'copyimages') { $dest = sanitize($_POST['massalbumselect']); $folder = sanitize($_POST['massfolder']); if (!$dest || $dest == $folder) { return "&mcrerr=2"; } } if ($action == 'changeowner') { $newowner = sanitize($_POST['massownerselect']); } $n = 0; foreach ($ids as $filename) { $n++; $imageobj = newImage($album, $filename); if (is_null($result)) { switch ($action) { case 'deleteall': $imageobj->remove(); break; case 'showall': $imageobj->setShow(1); break; case 'hideall': $imageobj->setShow(0); break; case 'commentson': $imageobj->set('commentson', 1); break; case 'commentsoff': $imageobj->set('commentson', 0); break; case 'resethitcounter': $imageobj->set('hitcounter', 0); break; case 'addtags': addTags($tags, $imageobj); break; case 'cleartags': $imageobj->setTags(array()); break; case 'copyimages': if ($e = $imageobj->copy($dest)) { return "&mcrerr=" . $e; } break; case 'moveimages': if ($e = $imageobj->move($dest)) { return "&mcrerr=" . $e; } break; case 'changeowner': $imageobj->setOwner($newowner); break; default: $action = call_user_func($action, $imageobj); break; } } else { $imageobj->set($action, $result); } $imageobj->save(); } return $action; } } return false; }
/** * Handles Image bulk actions * @param $album */ function processImageBulkActions($album) { $action = sanitize($_POST['checkallaction']); $ids = sanitize($_POST['ids']); $total = count($ids); if ($action != 'noaction') { if ($total > 0) { if ($action == 'addtags') { $tags = bulkTags(); } if ($action == 'moveimages' || $action == 'copyimages') { $dest = sanitize($_POST['massalbumselect']); $folder = sanitize($_POST['massfolder']); if (!$dest || $dest == $folder) { return "&mcrerr=2"; } } if ($action == 'changeowner') { $newowner = sanitize($_POST['massownerselect']); } $n = 0; foreach ($ids as $filename) { $n++; $imageobj = newImage($album, $filename); switch ($action) { case 'deleteall': $imageobj->remove(); SearchEngine::clearSearchCache(); break; case 'showall': $imageobj->set('show', 1); break; case 'hideall': $imageobj->set('show', 0); break; case 'commentson': $imageobj->set('commentson', 1); break; case 'commentsoff': $imageobj->set('commentson', 0); break; case 'resethitcounter': $imageobj->set('hitcounter', 0); break; case 'addtags': $mytags = array_unique(array_merge($tags, $imageobj->getTags())); $imageobj->setTags($mytags); break; case 'cleartags': $imageobj->setTags(array()); break; case 'copyimages': if ($e = $imageobj->copy($dest)) { return "&mcrerr=" . $e; } break; case 'moveimages': if ($e = $imageobj->move($dest)) { SearchEngine::clearSearchCache(); return "&mcrerr=" . $e; } break; case 'changeowner': $imageobj->setOwner($newowner); break; default: $action = call_user_func($action, $imageobj); break; } $imageobj->save(); } } return $action; } }
/** * Processes the check box bulk actions * */ function processZenpageBulkActions($type) { global $_zp_zenpage; $action = false; if (isset($_POST['ids'])) { //echo "action for checked items:". $_POST['checkallaction']; $action = sanitize($_POST['checkallaction']); $links = sanitize($_POST['ids']); $total = count($links); $message = NULL; $sql = ''; if ($action != 'noaction') { if ($total > 0) { if ($action == 'addtags' || $action == 'alltags') { $tags = bulkTags(); } if ($action == 'addcats') { foreach ($_POST as $key => $value) { $key = postIndexDecode($key); if (substr($key, 0, 3) == 'cat') { if ($value) { $cats[] = substr($key, 3); } } } $cats = sanitize($cats, 3); } $n = 0; foreach ($links as $titlelink) { $class = 'Zenpage' . $type; $obj = new $class($titlelink); switch ($action) { case 'deleteall': $obj->remove(); SearchEngine::clearSearchCache(); break; case 'addtags': $mytags = array_unique(array_merge($tags, $obj->getTags())); $obj->setTags($mytags); break; case 'cleartags': $obj->setTags(array()); break; case 'alltags': $allarticles = $obj->getArticles('', 'all', true); foreach ($allarticles as $article) { $newsobj = new ZenpageNews($article['titlelink']); $mytags = array_unique(array_merge($tags, $newsobj->getTags())); $newsobj->setTags($mytags); $newsobj->save(); } break; case 'clearalltags': $allarticles = $obj->getArticles('', 'all', true); foreach ($allarticles as $article) { $newsobj = new ZenpageNews($article['titlelink']); $newsobj->setTags(array()); $newsobj->save(); } break; case 'addcats': $catarray = array(); $allcats = $obj->getCategories(); foreach ($cats as $cat) { $catitem = $_zp_zenpage->getCategory($cat); $catarray[] = $catitem['titlelink']; //to use the setCategories method we need an array with just the titlelinks! } $allcatsarray = array(); foreach ($allcats as $allcat) { $allcatsarray[] = $allcat['titlelink']; //same here! } $mycats = array_unique(array_merge($catarray, $allcatsarray)); $obj->setCategories($mycats); break; case 'clearcats': $obj->setCategories(array()); break; case 'showall': $obj->set('show', 1); break; case 'hideall': $obj->set('show', 0); break; case 'commentson': $obj->set('commentson', 1); break; case 'commentsoff': $obj->set('commentson', 0); break; case 'resethitcounter': $obj->set('hitcounter', 0); break; } $obj->save(); } } } } return $action; }
/** * Processes the check box bulk actions * */ function processZenpageBulkActions($type) { global $_zp_CMS; $action = false; if (isset($_POST['ids'])) { //echo "action for checked items:". $_POST['checkallaction']; $action = sanitize($_POST['checkallaction']); switch ($type) { case 'Article': $table = 'news'; break; case 'Page': $table = 'pages'; break; case 'Category': $table = 'news_categories'; break; } $result = zp_apply_filter('processBulkCMSSave', NULL, $action, $table); $links = sanitize($_POST['ids']); $total = count($links); $message = NULL; $sql = ''; if ($action != 'noaction') { if ($total > 0) { if ($action == 'addtags' || $action == 'alltags') { $tags = bulkTags(); } if ($action == 'addcats') { if (isset($_POST['addcategories'])) { $cats = sanitize($_POST['addcategories']); } else { $cats = array(); } } $n = 0; foreach ($links as $titlelink) { $obj = new $type($titlelink); if (is_null($result)) { switch ($action) { case 'deleteall': $obj->remove(); break; case 'addtags': $mytags = array_unique(array_merge($tags, $obj->getTags(false))); $obj->setTags($mytags); break; case 'cleartags': $obj->setTags(array()); break; case 'alltags': $allarticles = $obj->getArticles('', 'all', true); foreach ($allarticles as $article) { $newsobj = newArticle($article['titlelink']); $mytags = array_unique(array_merge($tags, $newsobj->getTags(false))); $newsobj->setTags($mytags); $newsobj->save(); } break; case 'clearalltags': $allarticles = $obj->getArticles('', 'all', true); foreach ($allarticles as $article) { $newsobj = newArticle($article['titlelink']); $newsobj->setTags(array()); $newsobj->save(); } break; case 'addcats': $catarray = array(); $allcats = $obj->getCategories(); foreach ($cats as $cat) { $catitem = $_zp_CMS->getCategory($cat); $catarray[] = $catitem['titlelink']; //to use the setCategories method we need an array with just the titlelinks! } $allcatsarray = array(); foreach ($allcats as $allcat) { $allcatsarray[] = $allcat['titlelink']; //same here! } $mycats = array_unique(array_merge($catarray, $allcatsarray)); $obj->setCategories($mycats); break; case 'clearcats': $obj->setCategories(array()); break; case 'showall': $obj->setShow(1); break; case 'hideall': $obj->setShow(0); break; case 'commentson': $obj->setCommentsAllowed(1); break; case 'commentsoff': $obj->setCommentsAllowed(0); break; case 'resethitcounter': $obj->set('hitcounter', 0); break; } } else { $obj->set($action, $result); } $obj->save(); } } } } return $action; }