protected function runManagerAction($action) { switch ($action) { case 'phpinfo': ob_start(); phpinfo(); $this->content .= ob_get_clean(); return true; case 'clear': if (is_null($dir = TIP::getGet('id', 'string'))) { TIP::warning("GET not found ({$id})"); TIP::notifyError('noparams'); return false; } $dir = TIP::buildDataPath(urldecode($dir)); TIP::removeDir($dir, false); TIP::notifyInfo('done'); return true; } return null; }
/** * Start the session */ public static function startSession() { require_once 'HTTP/Session2.php'; $user_id = TIP::getUserId(); if ($user_id) { // For a logged in user, use the special TIP container HTTP_Session2::useCookies(false); HTTP_Session2::setContainer('TIP'); HTTP_Session2::start('TIP_Session', $user_id); } else { // For anonymous users, cookie with an automatic session id is used HTTP_Session2::useCookies(true); HTTP_Session2::start('TIP_Session'); } HTTP_Session2::setExpire(time() + 3600 * 4); if (HTTP_Session2::isExpired()) { HTTP_Session2::destroy(); TIP::notifyInfo('session'); } }
public function _processRow($row) { // Processed row null by default $this->_row = null; // Check "on_process" callback validity if (is_null($this->on_process)) { return; } elseif (!is_callable($this->on_process)) { TIP::error("invalid on_process callback passed to TIP_Form ({$this->id})"); return; } if ($this->_transaction_protected) { if (is_null($engine =& $this->_data->getProperty('engine'))) { return; } } else { $engine = null; } if ($engine && !$engine->startTransaction()) { // This error must be caught here to avoid the rollback return; } // Apply the converters on every field of $row $done = true; foreach ($this->_converter as $field => $type) { if (!$this->{'_converter' . $type}($row, $field)) { $done = false; break; } } // Run the process callback $done = $done && call_user_func_array($this->on_process, array(&$row, $this->_defaults)); if ($done) { $this->notify_done && TIP::notifyInfo('done'); $this->_row =& $row; } else { TIP::notifyError($this->action_id); } $engine && $engine->endTransaction($done); }
protected function runManagerAction($action) { switch ($action) { case 'restore': if (is_null($user = $this->_getUser())) { return false; } if (!$this->data->deleteRows($this->filterOwnedBy($user))) { TIP::notifyError('delete'); $this->appendToPage('edit'); return false; } TIP::notifyInfo('done'); $this->appendToPage('edit'); return true; } return null; }