function checkFileInTemplate($filename, $type = 'css') { $mainframe = RdbsFactory::getApplication(); $template = $mainframe->getTemplate(); $comp = $mainframe->scope; $path = 'templates' . DS . $template . DS . 'html' . DS . $comp . DS; $file = basename($filename); switch ($type) { case 'css': if (file_exists(SITEROOTDIR . DS . $path . 'css' . DS . $file)) { $filename = 'templates/' . $template . '/html/' . $comp . '/css/' . $file; } break; case 'php': $filename = false; $view = RdbsRequest::getVar('view', ''); if ($view != '') { if (file_exists(SITEROOTDIR . DS . $path . $view . DS . $file)) { $filename = true; } } break; } return $filename; }
/** * get a session value from request or context * allow masking for the request content * * @param $key * @param $default * @param $type * @param $mask * @return mixed */ function getUserStateFromRequest($key, $default = null, $type = 'none', $mask = 0) { $old_state = $this->app->getUserState($this->context . $key); $cur_state = !is_null($old_state) ? $old_state : $default; $new_state = RdbsRequest::getVar($key, null, 'default', $type, $mask); // Save the new value only if it was set in this request if ($new_state !== null) { $this->setUserState($key, $new_state); } else { $new_state = $cur_state; } return $new_state; }