示例#1
0
include_once ROOT_PATH . 'includes/template.inc.php';
include_once ROOT_PATH . 'classes/group.inc.php';
include_once ROOT_PATH . 'classes/album_content.inc.php';
include_once ROOT_PATH . 'classes/categorie.inc.php';
include_once ROOT_PATH . 'modules/authorisation/interface.inc.php';
define('CONTENT_IN_CAT_AMOUNT', 1);
define('CHILD_CONTENT_IN_CAT_AMOUNT', 2);
define('CHILD_COMMENTS_IN_CAT_AMOUNT', 3);
define('CONTENT_COMMENTS_AMOUNT', 4);
if (isset($HTTP_POST_VARS['do_correct'])) {
    if (is_array($HTTP_POST_VARS['correct'])) {
        foreach ($HTTP_POST_VARS['correct'] as $key => $value) {
            if ($HTTP_POST_VARS['type'][$key] == CONTENT_IN_CAT_AMOUNT) {
                $cat = new categorie();
                $cat->generate_from_id($HTTP_POST_VARS['id'][$key]);
                $cat->set_content_amount($cat->calc_content_amount());
                $cat->commit();
            } elseif ($HTTP_POST_VARS['type'][$key] == CHILD_CONTENT_IN_CAT_AMOUNT) {
                $cat = new categorie();
                $cat->generate_from_id($HTTP_POST_VARS['id'][$key]);
                $cat->set_child_content_amount($cat->calc_child_content_amount());
                $cat->commit();
            } elseif ($HTTP_POST_VARS['type'][$key] == CHILD_COMMENTS_IN_CAT_AMOUNT) {
                $cat = new categorie();
                $cat->generate_from_id($HTTP_POST_VARS['id'][$key]);
                $cat->set_child_comments_amount($cat->calc_child_comments_amount());
                $cat->commit();
            } elseif ($HTTP_POST_VARS['type'][$key] == CONTENT_COMMENTS_AMOUNT) {
                $content = get_content_object_from_id($HTTP_POST_VARS['id'][$key]);
                $content->set_comments_amount($content->calc_comments_amount());
                $content->commit();