public function delete($id = null)
 {
     $account = $this->load_account($id);
     $account->destroy();
     Site::flash("notice", "The account has been deleted");
     Redirect("admin/twitter/accounts");
 }
Example #2
0
 public function Comment()
 {
     $Session = Gdn::Session();
     $this->Form->SetModel($this->ActivityModel);
     $NewActivityID = 0;
     if ($this->Form->AuthenticatedPostBack()) {
         $Body = $this->Form->GetValue('Body', '');
         $ActivityID = $this->Form->GetValue('ActivityID', '');
         if ($Body != '' && is_numeric($ActivityID) && $ActivityID > 0) {
             $NewActivityID = $this->ActivityModel->Add($Session->UserID, 'ActivityComment', $Body, '', $ActivityID, '', TRUE);
         }
     }
     // Redirect back to the sending location if this isn't an ajax request
     if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         Redirect($this->Form->GetValue('Return', Gdn_Url::WebRoot()));
     } else {
         // Load the newly added comment
         $this->Comment = $this->ActivityModel->GetID($NewActivityID);
         $this->Comment->ActivityType .= ' Hidden';
         // Hide it so jquery can reveal it
         // Set it in the appropriate view
         $this->View = 'comment';
         // And render
         $this->Render();
     }
 }
 /**
  * Allows the setting of data into one of two serialized data columns on the
  * user table: Preferences and Attributes. The method expects "Name" &
  * "Value" to be in the $_POST collection. This method always saves to the
  * row of the user id performing this action (ie. $Session->UserID). The
  * type of property column being saved should be specified in the url:
  *  ie. /dashboard/utility/set/preference/name/value/transientKey
  *  or /dashboard/utility/set/attribute/name/value/transientKey
  *
  * @param string The type of value being saved: preference or attribute.
  * @param string The name of the property being saved.
  * @param string The value of the property being saved.
  * @param string A unique transient key to authenticate that the user intended to perform this action.
  */
 public function Set($UserPropertyColumn = '', $Name = '', $Value = '', $TransientKey = '') {
    $this->_DeliveryType = DELIVERY_TYPE_BOOL;
    $Session = Gdn::Session();
    $Success = FALSE;
    if (
       in_array($UserPropertyColumn, array('preference', 'attribute'))
       && $Name != ''
       && $Value != ''
       && $Session->UserID > 0
       && $Session->ValidateTransientKey($TransientKey)
    ) {
       $UserModel = Gdn::Factory("UserModel");
       $Method = $UserPropertyColumn == 'preference' ? 'SavePreference' : 'SaveAttribute';
       $Success = $UserModel->$Method($Session->UserID, $Name, $Value) ? 'TRUE' : 'FALSE';
    }
    
    if (!$Success)
       $this->Form->AddError('ErrorBool');
    
    // Redirect back where the user came from if necessary
    if ($this->_DeliveryType == DELIVERY_TYPE_ALL)
       Redirect($_SERVER['HTTP_REFERER']);
    else
       $this->Render();
 }
Example #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['soal' => 'required|min:5', 'opsiA' => 'required|different:opsiB,opsiC,opsiD', 'opsiB' => 'required|different:opsiA,opsiC,opsiD', 'opsiC' => 'required|different:opsiA,opsiB,opsiD', 'opsiD' => 'required|different:opsiA,opsiB,opsiC', 'opsiBenar' => 'required', 'kuis_id' => 'required|integer']);
     $kuis = Kuis::find($request->kuis_id);
     Soal::create($request->all());
     return Redirect('kuis/' . $request->kuis_id)->with('successMessage', " Berhasil menambahkan soal pada {$kuis->title}");
 }
 function AccountRoleForm(&$Context, &$UserManager, $User)
 {
     $this->Name = 'AccountRoleForm';
     $this->ValidActions = array('ApproveUser', 'DeclineUser', 'Role', 'ProcessRole');
     $this->Constructor($Context);
     if ($this->IsPostBack) {
         $this->User =& $User;
         $Redirect = 0;
         if ($this->PostBackAction == 'ProcessRole' && $this->IsValidFormPostBack() && $this->Context->Session->UserID != $User->UserID && $this->Context->Session->User->Permission('PERMISSION_CHANGE_USER_ROLE')) {
             $urh = $this->Context->ObjectFactory->NewObject($this->Context, 'UserRoleHistory');
             $urh->GetPropertiesFromForm();
             if ($UserManager->AssignRole($urh)) {
                 $Redirect = 1;
             }
         }
         if ($Redirect) {
             $Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', 'u', $User->UserID);
             Redirect($Url);
         } else {
             $this->PostBackAction = str_replace('Process', '', $this->PostBackAction);
         }
         if ($this->PostBackAction == 'Role') {
             $RoleManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'RoleManager');
             $RoleData = $RoleManager->GetRoles();
             $this->RoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
             $this->RoleSelect->Name = 'RoleID';
             $this->RoleSelect->CssClass = 'PanelInput';
             $this->RoleSelect->AddOptionsFromDataSet($this->Context->Database, $RoleData, 'RoleID', 'Name');
             $this->RoleSelect->SelectedValue = $this->User->RoleID;
             $this->RoleSelect->Attributes = ' id="ddRoleID"';
         }
     }
     $this->CallDelegate('Constructor');
 }
 public function save(Request $request)
 {
     //dd($request);
     $this->validate($request, ['Name' => 'required|max:100', 'Email' => 'required|email', 'Password' => 'required|min:6', 'Role' => 'required']);
     Users::create(['Name' => $request['Name'], 'Email' => $request['Email'], 'Role_Id' => $request['Role'], 'Password' => Hash::make($request['Password'])]);
     return Redirect('users');
 }
 public function PluginController_ThankFor_Create($Sender)
 {
     $Session = $this->Session;
     if (!$Session->IsValid()) {
         return;
     }
     //$Sender->Permission('Plugins.ThankfulPeople.Thank'); // TODO: PERMISSION THANK FOR CATEGORY
     $ThanksLogModel = new ThanksLogModel();
     $Type = GetValue(0, $Sender->RequestArgs);
     $ObjectID = GetValue(1, $Sender->RequestArgs);
     $Field = $ThanksLogModel->GetPrimaryKeyField($Type);
     $UserID = $ThanksLogModel->GetObjectInserUserID($Type, $ObjectID);
     if ($UserID == False) {
         throw new Exception('Object has no owner.');
     }
     if ($UserID == $Session->UserID) {
         throw new Exception('You cannot thank yourself.');
     }
     if (!self::IsThankable($Type)) {
         throw new Exception("Not thankable ({$Type}).");
     }
     // Make sure that user is not trying to say thanks twice.
     $Count = $ThanksLogModel->GetCount(array($Field => $ObjectID, 'InsertUserID' => $Session->User->UserID));
     if ($Count < 1) {
         $ThanksLogModel->PutThank($Type, $ObjectID, $UserID);
     }
     if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
         $Target = GetIncomingValue('Target', 'discussions');
         Redirect($Target);
     }
     $ThankfulPeopleDataSet = $ThanksLogModel->GetThankfulPeople($Type, $ObjectID);
     $Sender->SetData('NewThankedByBox', self::ThankedByBox($ThankfulPeopleDataSet->Result(), False));
     $Sender->Render();
 }
 public function SettingsController_ToggleVoting_Create($Sender) {
    $Sender->Permission('Garden.Settings.Manage');
    if (Gdn::Session()->ValidateTransientKey(GetValue(0, $Sender->RequestArgs)))
       SaveToConfig('Plugins.Voting.Enabled', C('Plugins.Voting.Enabled') ? FALSE : TRUE);
       
    Redirect('settings/voting');
 }
 public function delete($id = null)
 {
     $slideshow = self::load_slideshow($id);
     $slideshow->destroy();
     Site::flash("notice", "The slide has been deleted");
     Redirect("admin/slideshow");
 }
 public function contact()
 {
     $content = Content::find_by_permalink("contact");
     $this->assign("content", $content);
     $contact = new Contact();
     if ($this->post) {
         $contact->name = $_POST['name'];
         $contact->emailaddress = $_POST['emailaddress'];
         $contact->subject = $_POST['subject'];
         $contact->message = $_POST['message'];
         $contact->ip = Site::RemoteIP();
         if ($this->csrf) {
             $sent = $contact->send();
             if ($sent) {
                 Site::flash("notice", "The email has been sent");
                 Redirect("contact");
             }
         } else {
             global $site;
             $site['flash']['error'] = "Invalid form submission";
         }
     }
     $this->assign("contact", $contact);
     $this->title = "Contact Us";
     $this->render("contact/contact.tpl");
 }
Example #11
0
 public function init($formID)
 {
     switch ($formID) {
         case 'vote':
             $key = key($_POST[$formID]);
             $id = $_POST[$formID][$key];
             if (check_in_ses('vote_set', $id)) {
             }
             Redirect($base . '#review-' . $id);
             exit;
             break;
         case 'review':
             $validation = crud_validation($reviews->form_map(), 'review');
             $data = $reviews->post = $validation['post'];
             if ($validation['error']) {
                 foreach ($validation['error'] as $e => $v) {
                     $reviews->map[$e]['error'] = $v;
                 }
             } else {
                 $crud->insert(REVIEWS_TABLE, $data);
                 $rating = $reviews->get_rating($data['productID']);
                 $customers_rating = round($rating['avg'] * 2) / 2;
                 $crud->update(PRODUCTS_TABLE, array('customers_rating' => number_format($customers_rating, 2, '.', ''), 'customer_votes' => (int) $rating['amt']), 'productID=' . $productID);
             }
             Redirect($base . '#review-' . $id);
             exit;
             break;
     }
 }
Example #12
0
 public function delete(Request $request, $id)
 {
     $b = Usersgroup::find($id);
     $b->name = $request->input('name');
     $b->delete();
     return Redirect('usersgroup');
 }
 public function delete($permalink = null)
 {
     $news = self::load_news($permalink, false);
     $news->destroy();
     Site::flash("notice", "The news has been deleted");
     Redirect("admin/news");
 }
 public function Index()
 {
     $mute = $this->input->get('mute');
     if ($this->input->get('mute') == 1) {
         $mute_time = time() + 600;
         setcookie('mute', $mute_time, $mute_time, '/');
         Redirect();
     }
     if ($this->input->get('mute') == -1) {
         setcookie('mute', 0, time() - 1, '/');
         Redirect();
     }
     $data['muted'] = $this->input->cookie('mute');
     $data['filter'] = '';
     if (isset($_GET['filter'])) {
         $data['filter'] = $_GET['filter'];
     }
     $this->load->helper('date');
     $servers = $this->config->item('supervisor_servers');
     if (empty($servers)) {
         $data['list'] = array();
     } else {
         foreach ($servers as $name => $config) {
             $data['list'][$name] = array('server' => $config, 'processes' => $this->_request($name, 'getAllProcessInfo'));
         }
     }
     $data['cfg'] = $servers;
     $this->load->view('welcome', $data);
 }
Example #15
0
function HandleThumbShoePostRename($pagename, $auth = 'edit')
{
    global $WikiLibDirs;
    global $ThumbShoePageSep;
    global $HandleAuth, $UploadFileFmt, $LastModFile, $TimeFmt;
    $newname = $_REQUEST['newname'];
    if ($newname == '') {
        Abort("?no new image name");
    }
    $newname = str_replace('.', '_', $newname);
    $newpage = $_REQUEST['newpage'];
    if ($newpage == '') {
        Abort("?no new image page");
    }
    $newimgpage = $newpage . $ThumbShoePageSep . $newname;
    $tsdir = '';
    foreach ((array) $WikiLibDirs as $dir) {
        if ($dir->exists($pagename) and $dir->iswrite) {
            $tsdir = $dir;
            break;
        }
    }
    if (!$tsdir) {
        Abort("Cannot rename {$pagename} to {$newimgpage}; cannot find page");
        return;
    }
    ## check authorization
    if (!RetrieveAuthPage($newimgpage, $auth, TRUE, READPAGE_CURRENT)) {
        Abort("?cannot rename image page from {$pagename} to {$newimgpage}");
    }
    $newnewpage = @$tsdir->rename($pagename, $newimgpage);
    if ($newnewpage) {
        Redirect($newnewpage);
    }
}
Example #16
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (date('Y-m-d') < date('Y-m-20')) {
         return Redirect('/input');
     }
     return $next($request);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CreateCategoryRequest $request, $category)
 {
     $data = $request->input();
     $category->fill($data);
     $category->save();
     return Redirect()->route('categories');
 }
 public function edit()
 {
     $gateway = $this->getByID('PaymentGateway');
     $settings = $gateway->getSettings();
     $code = $this->getData('code');
     if (!isset($settings[$code])) {
         throw new Error404('Unable to find setting with the code supplied');
     }
     $setting = $settings[$code];
     if ($this->post) {
         $value = $this->postData('value');
         if (!$setting->obj) {
             $setting->obj = new PaymentGatewaySetting();
             $setting->obj->paymentgateway = $gateway;
             $setting->obj->paymentgateway_id = $gateway->id;
             $setting->obj->code = $setting->code;
         }
         $setting->obj->value = $this->postData('value');
         $setting->value = $setting->obj->value;
         if ($this->csrf && $setting->obj->save()) {
             Site::Flash('notice', 'The payment gateway setting has been updated');
             Redirect("admin/payments/gateways/{$gateway->id}");
         } elseif (!$this->csrf) {
             Site::Flash('error', 'Invalid form submission');
         }
     }
     $this->assign('gateway', $gateway);
     $this->assign('setting', $setting);
     $this->title = "Payment Gateways :: {$gateway->name} :: Settings :: {$setting->name}";
     $this->render('paymentgatewaysetting/edit.tpl');
 }
 public function getEdit($id)
 {
     Allow::permission($this->module['group'], 'groups');
     if ($id == 1 && !Allow::superuser()) {
         Redirect(link::auth($this->module['rest']));
     }
     $groups = Group::all();
     $group = Group::find($id);
     $mod_actions = Config::get('mod_actions');
     $mod_info = Config::get('mod_info');
     #Helper::dd($mod_actions);
     #Helper::dd($mod_info);
     $group_actions = Action::where('group_id', $group->id)->get();
     #$actions = $group->actions();
     $actions = array();
     foreach ($group_actions as $action) {
         #Helper::d($action->status);
         #continue;
         if ($action->status) {
             $actions[$action->module][$action->action] = $action->status;
         }
     }
     #Helper::dd($actions);
     $group_actions = $actions;
     return View::make($this->module['tpl'] . 'edit', compact('groups', 'group', 'mod_actions', 'mod_info', 'group_actions'));
 }
Example #20
0
function logout()
 {
   $this->session->unset_userdata('loggedd');
   session_destroy();
 
   Redirect('login', 'Refresh');
 }	
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->session()->has('loggeduser')) {
         return Redirect('/login')->with('message', 'Silakan login terlebih dahulu');
     }
     return $next($request);
 }
Example #22
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:kelas,name,' . $id . '']);
     $kelas = Kelas::whereId($id)->first();
     $kelas->fill($request->input())->save();
     return Redirect('kelas')->with('successMessage', "Berhasil merubah kelas");
 }
Example #23
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->user()->id != 1) {
         return Redirect()->to('admin');
     }
     return $next($request);
 }
Example #24
0
 function initializeCheckout($iPendingId, $aCartInfo, $bRecurring = false, $iRecurringDays = 0)
 {
     $iMode = (int) $this->getOption('mode');
     $sActionURL = $iMode == PP_MODE_LIVE ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     if ($bRecurring) {
         $aFormData = array('cmd' => '_xclick-subscriptions', 'a3' => sprintf("%.2f", (double) $aCartInfo['items_price']), 'p3' => $iRecurringDays, 't3' => 'D', 'src' => '1', 'sra' => '1');
     } else {
         $aFormData = array('cmd' => '_xclick', 'amount' => sprintf("%.2f", (double) $aCartInfo['items_price']));
     }
     $aFormData = array_merge($aFormData, array('business' => $iMode == PP_MODE_LIVE ? $this->getOption('business') : $this->getOption('sandbox'), 'bn' => 'Boonex_SP', 'item_name' => _t('_payment_txt_payment_to', $aCartInfo['vendor_username']), 'item_number' => $iPendingId, 'currency_code' => $aCartInfo['vendor_currency_code'], 'no_note' => '1', 'no_shipping' => '1', 'custom' => md5($aCartInfo['vendor_id'] . $iPendingId)));
     $iIndex = 1;
     foreach ($aCartInfo['items'] as $aItem) {
         $aFormData['item_name'] .= ' ' . $iIndex++ . '. ' . $aItem['title'];
     }
     switch ($this->getOption('prc_type')) {
         case PP_PRC_TYPE_PDT:
         case PP_PRC_TYPE_DIRECT:
             $aFormData = array_merge($aFormData, array('return' => $this->_sDataReturnUrl . $aCartInfo['vendor_id'], 'rm' => '2'));
             break;
         case PP_PRC_TYPE_IPN:
             $aFormData = array_merge($aFormData, array('return' => $this->_oConfig->getReturnUrl(), 'notify_url' => $this->_sDataReturnUrl . $aCartInfo['vendor_id'], 'rm' => '1'));
             break;
     }
     Redirect($sActionURL, $aFormData, 'post', $this->_sCaption);
     exit;
 }
 public function refresh($id = null)
 {
     $server = self::load_gameserver($id);
     $server->update_stats();
     Site::flash("notice", "The game server has been refreshed");
     Redirect("admin/servers");
 }
 public function delete($id = null)
 {
     $discount = $this->load_discount($id);
     $discount->destroy();
     Site::flash("notice", "The discount code has been deleted");
     Redirect("admin/discounts");
 }
Example #27
0
 protected function processForm($mode, $category_id, $id = null)
 {
     $input = array_filter(Input::all());
     $rules = ['category_id' => 'required', 'title' => 'required|unique:categories', 'user_id' => 'required'];
     if ($this->user_id == Input::get('user_id')) {
         if ($id) {
             $subcategory = Subcategories::find($id);
             $messages = $this->validateCategory($input, $rules);
             if ($messages->isEmpty()) {
                 $subcategory = $subcategory->update($input);
             }
         } else {
             $messages = $this->validateCategory($input, $rules);
             if ($messages->isEmpty()) {
                 $subcategory = $this->create($input);
                 $subcategory = Subcategory::create($input);
             }
         }
         if ($messages->isEmpty()) {
             return Redirect()->to('user/download/subcategories')->withSuccess(trans('validation.success'));
         }
         return Redirect()->back()->withInput()->withErrors($messages);
     } else {
         return Redirect()->back()->withInput()->withErrors(trans('validation.userid-problem'));
     }
 }
 public function actualiza(Request $request, $id)
 {
     $cantdb = \DB::table('productos')->select('CantExistente')->where('ID', $id)->first();
     $cantinput = $request->input('cantidads');
     $resul = $cantdb->CantExistente - intval($cantinput);
     \DB::table('productos')->where('ID', $id)->update(['CantExistente' => $resul]);
     $productoid = \DB::table('productos')->select('ID')->where('ID', $id)->first();
     $cantinput = $request->input('cantidads');
     $nombreus = $request->input('usuarios');
     $nombreus2 = \DB::table('usuarios')->select('Nombre')->where('ID', $nombreus)->first();
     $nombrpr = \DB::table('productos')->select('Nombre')->where('ID', $id)->first();
     $salida = new salidasModelo();
     $salida->Producto_ID = $productoid->ID;
     $salida->Nombre_Producto = $nombrpr->Nombre;
     $salida->Cantidad = intval($cantinput);
     $salida->Usuario_ID = intval($nombreus);
     $salida->Nombre_salida = $nombreus2->Nombre;
     $salida->save();
     /*  $salida=salidasModelo::getInfoSalida($id);
         dd($salida);
         $vista = view('generapdf', compact($salida));
         $dompdf = \App::make('dompdf.wrapper');
         $dompdf->loadHTML($vista);
         return $dompdf->stream();*/
     return Redirect()->back();
     //    return view('generapdf');
 }
Example #29
0
function edit_user()
{
    if (!is_logged_in() || !is_post_parameter_complete(array('salutation', 'gender', 'firstname', 'lastname', 'birthyear', 'birthmonth', 'birthday', 'password', 'aboutme'))) {
        Redirect('../edit_user.php');
    }
    $userDetails['salutation'] = $_POST['salutation'];
    $userDetails['firstname'] = $_POST['firstname'];
    $userDetails['lastname'] = $_POST['lastname'];
    $userDetails['gender'] = $_POST['gender'];
    $userDetails['birthdate'] = "{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}";
    $userDetails['username'] = $_SESSION['user']['username'];
    $userDetails['password'] = $_POST['password'];
    $userDetails['aboutme'] = $_POST['aboutme'];
    if (is_admin()) {
        if (is_post_parameter_complete(array('accesslevel'))) {
            $userDetails['accesslevel'] = $_POST['accesslevel'];
        } else {
            Redirect('../edit_user.php');
        }
    } else {
        $userDetails['accesslevel'] = 'User';
    }
    if (EditUser($userDetails)) {
        if ($_SESSION['user']['accesslevel'] == $userDetails['accesslevel']) {
            $_SESSION['user'] = SelectUser($userDetails['username']);
            Redirect('../index.php');
        } else {
            Redirect('../landing.php/logout');
        }
    } else {
        Error('Edit Failed');
    }
}
Example #30
0
 public function __construct($set, $map, $data)
 {
     parent::__construct();
     parent::rqst();
     $this->set = $set;
     $this->map = $map;
     $this->data = $data[0];
     if (isset($_POST['crud'])) {
         $validation = crud_validation($this->map);
         $post = $validation['post'];
         $error = $validation['error'];
         $this->data = array_merge($this->data, $post);
         if ($error) {
             foreach ($error as $e => $v) {
                 $this->map[$e]['error'] = $v;
             }
         } else {
             switch ($post['method']) {
                 case 'edit':
                     $data = array_intersect_key($post, array_flip($this->set['cols']));
                     $this->update($this->set['tbl'], $data, $this->set['actionID'] . '=' . $post[$this->set['actionID']]);
                     break;
                     //                    case 'add':
                     //                        $this->update(REVIEWS_TABLE, $data, 'id=' . $data['id']);
                     //                        break;
             }
             $hook = $this->set['hook'];
             if ($hook) {
                 call_user_func($hook['func'], $this->data[$hook['param']]);
             }
             Redirect($this->build_url('delete'));
         }
     }
 }