Beispiel #1
0
         }
     }
     header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $qs_albumsuffix . $notify . $pg . $returntab);
     exitZP();
     break;
     /** DELETION ***************************************************************** */
     /*		 * ************************************************************************** */
 /** DELETION ***************************************************************** */
 /*		 * ************************************************************************** */
 case "deletealbum":
     XSRFdefender('delete');
     if ($folder) {
         $album = newAlbum($folder);
         if ($album->remove()) {
             $nd = 3;
             SearchEngine::clearSearchCache();
         } else {
             $nd = 4;
         }
         if (isset($_GET['return'])) {
             $albumdir = sanitize($_GET['return'], 3);
         } else {
             $albumdir = dirname($folder);
         }
         if ($albumdir != '/' && $albumdir != '.') {
             $albumdir = "&album=" . pathurlencode($albumdir);
         } else {
             $albumdir = '';
         }
     } else {
         $albumdir = '';
/**
 * 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;
}
Beispiel #3
0
     }
     break;
     /** clear the HTMLcache ****************************************************** */
 /** clear the HTMLcache ****************************************************** */
 case 'clear_html_cache':
     XSRFdefender('ClearHTMLCache');
     require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/static_html_cache.php';
     static_html_cache::clearHTMLCache();
     $class = 'messagebox';
     $msg = gettext('HTML cache cleared.');
     break;
     /** clear the search cache ****************************************************** */
 /** clear the search cache ****************************************************** */
 case 'clear_search_cache':
     XSRFdefender('ClearSearchCache');
     SearchEngine::clearSearchCache(NULL);
     $class = 'messagebox';
     $msg = gettext('Search cache cleared.');
     break;
     /** restore the setup files ************************************************** */
 /** restore the setup files ************************************************** */
 case 'restore_setup':
     XSRFdefender('restore_setup');
     list($diff, $needs) = checkSignature(2);
     if (empty($needs)) {
         $class = 'messagebox';
         $msg = gettext('Setup files restored.');
     } else {
         zp_apply_filter('log_setup', false, 'restore', implode(', ', $needs));
         $class = 'errorbox';
         $msg = gettext('Setup files restore failed.');
/**
 * 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;
    }
}
Beispiel #5
0
 function move($new_unique_set)
 {
     if (class_exists('SearchEngine')) {
         SearchEngine::clearSearchCache($this);
     }
     return parent::move($new_unique_set);
 }