Example #1
0
     $AdminUI->title_titlearea = T_('Comment recycle bins');
     /*
      * Add sub menu entries:
      * We do this here instead of _header because we need to include all filter params into regenerate_url()
      */
     attach_browse_tabs(false);
     $AdminUI->set_path('collections', 'comments');
     $AdminUI->breadcrumbpath_add(T_('Comment recycle bins'), '?ctrl=comments&action=emptytrash');
     break;
 case 'elevate':
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('comment');
     $item_content = $edited_Comment->get_author_name() . ' ' . T_('wrote') . ': <blockquote>' . $edited_Comment->get_content() . '</blockquote>';
     $new_Item = new Item();
     $new_Item->set('status', 'draft');
     $new_Item->set_creator_by_login($current_User->login);
     $new_Item->set('main_cat_ID', $Blog->get_default_cat_ID());
     $new_Item->set('title', T_('Elevated from comment'));
     $new_Item->set('content', $item_content);
     if (!$new_Item->dbinsert()) {
         $Messages->add(T_('Unable to create the new post!'), 'error');
         break;
     }
     // Deprecate the comment after elevating
     $edited_Comment->set('status', 'deprecated');
     $edited_Comment->dbupdate();
     // Move all child comments to new created post
     move_child_comments_to_item($edited_Comment->ID, $new_Item->ID);
     header_redirect(url_add_param($admin_url, 'ctrl=items&blog=' . $blog . '&action=edit&p=' . $new_Item->ID, '&'));
     break;
 case 'list':