public function delete() { global $db, $history; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id=' . $this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#" . $this->params['tab']; } redirect_to($lastUrl); }
/** * method to redirect to a login if needed */ public static function loginredirect() { global $user; global $router; ob_start(); if ($user->isLoggedIn()) { header('Location: ' . expSession::get('redirecturl')); } else { //expSession::set('redirecturl', expHistory::getLastNotEditable()); expSession::set('redirecturl', expHistory::getLast()); expSession::set('redirecturl_error', makeLink(array('controller' => 'login', 'action' => 'loginredirect'))); // expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION); expHistory::set('viewable', $router->params); } redirect_to(array('controller' => 'login', 'action' => 'showlogin')); }
function controlToHTML($name) { if ($this->submit . $this->reset . $this->cancel == "") { return ""; } if (empty($this->id)) { $this->id = $name; } $html = ""; if ($this->submit != "") { $html .= '<button type="submit" id="' . $this->id . 'Submit" class="submit button awesome ' . BTN_SIZE . ' ' . BTN_COLOR; if ($this->disabled) { $html .= " disabled"; } $html .= '" type="submit" value="' . $this->submit . '"'; if ($this->disabled) { $html .= " disabled"; } $html .= ' onclick="if (checkRequired(this.form)'; if (isset($this->onclick)) { $html .= ' ' . $this->onclick; } $html .= ') '; if ($this->validateJS != "") { $html .= '{ if (' . $this->validateJS . ') { return true; } else { return false; } }'; } else { $html .= '{ return true; }'; } $html .= ' else { return false; }"'; $html .= ' />'; $html .= $this->submit; $html .= ' </button>'; } //if ($this->reset != "") $html .= '<input class="button" type="reset" value="' . $this->reset . '"' . ($this->disabled?" disabled":"") . ' />'; if ($this->cancel != "") { if ($this->returntype == "") { $html .= '<button type="cancel" class="cancel button awesome ' . BTN_SIZE . ' ' . BTN_COLOR . '" onclick="document.location.href=\'' . expHistory::getLastNotEditable() . '\'; return false;"'; } else { $html .= '<button type="cancel" class="cancel button awesome ' . BTN_SIZE . ' ' . BTN_COLOR . '" onclick="document.location.href=\'' . expHistory::getLast($this->returntype) . '\'; return false;"'; } $html .= '>'; $html .= $this->cancel; $html .= '</button>'; } expCSS::pushToHead(array("unique" => "button", "corecss" => "button")); return $html; }
$control_type = get_class($ctl); $name = $c->name; $fields[$name] = call_user_func(array($control_type, 'templateFormat'), $data->{$name}, $ctl); $captions[$name] = $c->caption; } $captions['ip'] = gt('IP Address'); $captions['timestamp'] = gt('Timestamp'); $captions['user_id'] = gt('Username'); $fields['ip'] = $data->ip; $locUser = user::getUserById($data->user_id); $fields['user_id'] = isset($locUser->username) ? $locUser->username : ''; $fields['timestamp'] = strftime(DISPLAY_DATETIME_FORMAT, $data->timestamp); if ($rpt->text == '') { $template = new template('formbuilder', '_default_report'); } else { $template = new template('formbuilder', '_custom_report'); $template->assign('template', $rpt->text); } $template->assign('title', $rpt->name); $template->assign('fields', $fields); $template->assign('captions', $captions); // $template->assign('backlink',expHistory::getLastNotEditable()); $template->assign('backlink', expHistory::getLast('editable')); $template->assign('is_email', 0); $template->output(); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML; }