Esempio n. 1
0
 /**
  * Confirm a critical change. This can be the deletion of a user for instance.
  *
  * @param string $action
  * @param int $user_id
  */
 public function confirm($action = NULL, $user_id = NULL)
 {
     // Check if the user is valid
     if (empty($action) || empty($user_id) || !is_valid_number($user_id) || !is_valid_action($action) || $this->user_model->get_user($user_id) === NULL) {
         $this->session->set_flashdata('notice', 'Invalid Request');
         redirect('admin/users/index');
     }
     $data['question'] = 'Are you sure you want to delete the following user?';
     $data['user'] = $this->user_model->get_user($user_id);
     $data['action'] = $action;
     $this->session->set_userdata(array('confirmation' => TRUE));
     // ------------------------------------------------------------------------
     // Breadcrums
     // ------------------------------------------------------------------------
     $_seg_title = ucfirst($action) . ' User#' . $user_id . ': Confirmation';
     $_seg_url = 'admin/users/confirm/' . $action . '/' . $user_id;
     $breadcrumbs = $this->azbraz->new_segment($_seg_title, $_seg_url);
     $data['breadcrumbs'] = $this->azbraz->generate();
     // ------------------------------------------------------------------------
     $data['view_file'] = 'admin/users/confirm';
     $this->load->view($this->main_admin_view, $data);
 }
Esempio n. 2
0
 /**
  * Confirm a critical change. The can be the deletion of a post for instance.
  *
  * @param string $action : the "critical change"
  * @param int $post_id
  */
 public function confirm($action = NULL, $post_id = NULL)
 {
     // Check if the post id is valid
     if (empty($action) || empty($post_id) || !is_valid_number($post_id) || !is_valid_action($action) || $this->post_model->get_post($post_id, 'all') === NULL) {
         $this->session->set_flashdata('notice', 'Invalid Request');
         redirect('admin/posts');
     }
     $data['question'] = 'Are you sure you want to ' . $action . ' the following post?';
     $data['post'] = $this->post_model->get_post($post_id, 'all');
     $data['action'] = $action;
     $this->session->set_userdata(array('confirmation' => TRUE));
     // ------------------------------------------------------------------------
     // Breadcrumbs
     // ------------------------------------------------------------------------
     $_seg_title = ucfirst($action) . ' Post#' . $post_id . ': Confirmation';
     $_seg_url = 'admin/posts/confirm/' . $action . '/' . $post_id;
     $breadcrumbs = $this->azbraz->new_segment($_seg_title, $_seg_url);
     $data['breadcrumbs'] = $this->azbraz->generate($breadcrumbs);
     // ------------------------------------------------------------------------
     $data['view_file'] = 'admin/posts/confirm';
     $this->load->view($this->main_admin_view, $data);
 }
Esempio n. 3
0
 public function confirm($action = NULL, $comment_id = NULL)
 {
     if (empty($action) || empty($comment_id) || !is_valid_number($comment_id) || !is_valid_action($action) || $this->comment_model->get_comment($comment_id) === NULL) {
         $this->session->set_flashdata('notice', 'Invalid Request');
         redirect('admin/comments');
     }
     $data['view_file'] = 'admin/comments/confirm';
     $data['question'] = 'Are you sure you want to delete the following comment?';
     $data['comment'] = $this->comment_model->get_comment($comment_id);
     $this->load->view('admin/main', $data);
 }
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
include 'include/common.inc.php';
include 'include/AL.php';
include_once __DIR__ . '/class/base/actionfactory.class.php';
$formdata =& xoonips_getutility('formdata');
$op = $formdata->getValue('get', 'action', 's', false);
if (is_null($op)) {
    header('Location: ' . XOOPS_URL . '/modules/xoonips/import.php?action=default');
    exit;
}
xoonips_validate_request(is_valid_action($op));
$factory =& XooNIpsActionFactory::getInstance();
$action =& $factory->create('import_' . $op);
if (!$action) {
    header('Location: ' . XOOPS_URL . '/');
}
$action->action();
exit;
function is_valid_action($action)
{
    return in_array($action, array('default', 'upload', 'import', 'import_index_tree', 'resolve_conflict'));
}
Esempio n. 5
0
        $action_response = do_auth_action();
        $history["session"]["authenticated"] = true;
        $history["session"]["access_key"] = $action_response["access_key"];
        $history["session"]["access_token"] = $action_response["access_token"];
    } catch (Exception $e) {
        $history = array();
        $history["session"]["authenticated"] = false;
        write_history();
        raise_exception($e);
    }
} elseif ($is_authenticated !== TRUE) {
    echo "FATAL: Autentication required prior to action calls\n";
    exit(1);
} elseif (is_supplement_action($action)) {
    $action_response = do_supplement_action();
} elseif (is_valid_action($action)) {
    try {
        $action_response = do_other_action();
    } catch (Exception $e) {
        write_history();
        raise_exception($e);
    }
} else {
    echo "ERROR: Invalid action\n";
    exit(3);
}
if ($action == "begin" or $action == "open") {
    if (is_array($action_response)) {
        $active_project = $action_response["id"];
    } else {
        $active_project = $action_response;