本文整理汇总了PHP中GO::router方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::router方法的具体用法?PHP GO::router怎么用?PHP GO::router使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::router方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public static function save(&$file)
{
try {
if (\GO::router()->getController() && \GO::router()->getController()->getRoute() != 'maintenance') {
Model\Filesearch::model()->createFromFile($file, !empty(\GO::config()->filesearch_direct_index));
}
} catch (\Exception $e) {
\GO::debug((string) $e);
}
}
示例2: defaultAttributes
public function defaultAttributes()
{
$attr = parent::defaultAttributes();
if (PHP_SAPI == 'cli') {
$attr['user_agent'] = 'cli';
} else {
$attr['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown';
}
$attr['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$attr['controller_route'] = \GO::router()->getControllerRoute();
$attr['username'] = \GO::user() ? \GO::user()->username : 'notloggedin';
return $attr;
}
示例3: getCacheAttributes
protected function getCacheAttributes()
{
// Otherwise it would break 3.7 to 4.X upgrade
if (\GO::router()->getControllerRoute() == 'maintenance/upgrade') {
return false;
}
$path = $this->path;
//Don't cache tickets files because there are permissions issues. Everyone has read access to the types but may not see other peoples files.
if (strpos($path, 'tickets/') === 0) {
return false;
}
return array('name' => $this->name, 'description' => $path);
}
示例4: dirname
$root = dirname(__FILE__) . '/';
//chdir($root);
//on the command line you can pass -c=/path/to/config.php to set the config file.
require_once $root . 'go/base/util/Cli.php';
$args = \GO\Base\Util\Cli::parseArgs();
if (isset($args['c'])) {
define("GO_CONFIG_FILE", $args['c']);
}
//initialize autoloading of library
require_once $root . 'go/GO.php';
\GO::init();
if (!isset($args['q'])) {
echo "\nGroup-Office CLI - Copyright Intermesh BV.\n\n";
}
if (PHP_SAPI != 'cli') {
exit("ERROR: This script must be run on the command line\n\n");
}
if (empty($args['r'])) {
echo "ERROR: You must pass a controller route to use the command line script.\n" . "eg.:\n\n" . "sudo -u www-data php index.php -c=/path/to/config.php -r=maintenance/upgrade --param=value\n\n";
exit;
} elseif (isset($args['u'])) {
$password = isset($args['p']) ? $args['p'] : \GO\Base\Util\Cli::passwordPrompt("Enter password for user " . $args['u'] . ":");
$user = \GO::session()->login($args['u'], $password);
if (!$user) {
echo "Login failed for user " . $args['u'] . "\n";
exit(1);
}
unset($args['u']);
}
\GO::router()->runController($args);
示例5: actionBuildSearchCache
/**
* Calls buildSearchIndex on each Module class.
* @return array
*/
protected function actionBuildSearchCache($params)
{
if (!$this->isCli() && !\GO::modules()->tools && \GO::router()->getControllerAction() != 'upgrade') {
throw new \GO\Base\Exception\AccessDenied();
}
GO::setIgnoreAclPermissions(true);
$this->lockAction();
if (!$this->isCli()) {
echo '<pre>';
}
\GO::session()->closeWriting();
//close writing otherwise concurrent requests are blocked.
$response = array();
// if(empty($params['keepexisting']))
// \GO::getDbConnection()->query('TRUNCATE TABLE go_search_cache');
//
//inserting is much faster without full text index. It's faster to add it again afterwards.
// echo "Dropping full text search index\n";
// try{
// \GO::getDbConnection()->query("ALTER TABLE go_search_cache DROP INDEX ft_keywords");
// }catch(\Exception $e){
// echo $e->getMessage()."\n";
// }
if (!empty($params['modelName'])) {
$modelName = $params['modelName'];
if (empty($params['keepexisting'])) {
$query = 'DELETE FROM go_search_cache WHERE model_name=' . \GO::getDbConnection()->quote($modelName);
\GO::getDbConnection()->query($query);
}
$models = array(new ReflectionClass($modelName));
} else {
if (empty($params['keepexisting'])) {
\GO::getDbConnection()->query('TRUNCATE TABLE go_search_cache');
}
$models = \GO::findClasses('model');
}
foreach ($models as $model) {
if ($model->isSubclassOf("GO\\Base\\Db\\ActiveRecord") && !$model->isAbstract()) {
echo "Processing " . $model->getName() . "\n";
flush();
$stmt = \GO::getModel($model->getName())->rebuildSearchCache();
}
}
if (empty($params['modelName'])) {
\GO::modules()->callModuleMethod('buildSearchCache', array(&$response));
}
// echo "Adding full text search index\n";
// \GO::getDbConnection()->query("ALTER TABLE `go_search_cache` ADD FULLTEXT ft_keywords(`name` ,`keywords`);");
echo "\n\nAll done!\n\n";
if (!$this->isCli()) {
echo '</pre>';
}
}
示例6:
<?php
$favicon = !empty(\GO::config()->favicon) ? \GO::config()->favicon : \GO::view()->getTheme()->getUrl() . "images/groupoffice.ico?";
?>
<link href="<?php
echo $favicon;
?>
" rel="shortcut icon" type="image/x-icon">
<title><?php
echo \GO::config()->title;
?>
</title>
<?php
\GO::view()->addStylesheet(\GO::view()->getPath() . 'ext/resources/css/ext-all.css', \GO::view()->getUrl() . 'ext/resources/css/');
\GO::view()->addStylesheet(\GO::view()->getPath() . 'themes/Group-Office/xtheme-groupoffice.css', \GO::view()->getUrl() . 'themes/Group-Office/');
\GO::view()->addStylesheet(\GO::view()->getPath() . 'themes/Group-Office/style.css', \GO::view()->getUrl() . 'themes/Group-Office/');
\GO::view()->loadModuleStylesheets();
?>
<link href="<?php
echo \GO::view()->getCachedStylesheet();
?>
" type="text/css" rel="stylesheet" />
<?php
if (!empty(\GO::config()->custom_css_url)) {
echo '<link href="' . \GO::config()->custom_css_url . '" type="text/css" rel="stylesheet" />';
}
//$this is \GO\Core\Controller\Auth
GO::router()->getController()->fireEvent('head');
?>
</head>
<body>
示例7: array
$url = \GO::url("core/compress", array('file' => $filename, 'mtime' => filemtime($path)));
echo '<script type="text/javascript" src="' . $url . '"></script>' . "\n";
}
}
?>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '<?php
echo \GO::config()->host;
?>
views/Extjs3/ext/resources/images/default/s.gif';
Ext.state.Manager.setProvider(new GO.state.HttpProvider());
<?php
if (isset(\GO::session()->values['security_token'])) {
echo 'Ext.Ajax.extraParams={security_token:"' . \GO::session()->values['security_token'] . '"};';
}
GO::router()->getController()->fireEvent('inlinescripts');
?>
</script>
<?php
if (file_exists(\GO::view()->getTheme()->getPath() . 'MainLayout.js')) {
echo '<script src="' . \GO::view()->getTheme()->getUrl() . 'MainLayout.js" type="text/javascript"></script>';
echo "\n";
}
?>
<script type="text/javascript">
<?php
//these parameter are passed by dialog.php. These are used to directly link to
//a dialog.
if (isset($_REQUEST['f'])) {
if (substr($_REQUEST['f'], 0, 9) == '{GOCRYPT}') {
$fp = \GO\Base\Util\Crypt::decrypt($_REQUEST['f']);
示例8: unset
//check if GO is installed
if (empty($_REQUEST['r']) && PHP_SAPI != 'cli') {
if (\GO::user() && isset($_SESSION['GO_SESSION']['after_login_url'])) {
$url = \GO::session()->values['after_login_url'];
unset(\GO::session()->values['after_login_url']);
header('Location: ' . $url);
exit;
}
$installed = true;
if (!\GO::config()->get_config_file() || empty(\GO::config()->db_user)) {
$installed = false;
} else {
$stmt = \GO::getDbConnection()->query("SHOW TABLES");
if (!$stmt->rowCount()) {
$installed = false;
}
}
if (!$installed) {
header('Location: ' . \GO::config()->host . 'install/');
exit;
}
//check for database upgrades
$mtime = \GO::config()->get_setting('upgrade_mtime');
if ($mtime != \GO::config()->mtime) {
\GO::infolog("Running system update");
header('Location: ' . \GO::url('maintenance/upgrade'));
exit;
}
}
\GO::router()->runController();
示例9: _checkExistingModelFolder
private function _checkExistingModelFolder($model, $folder, $mustExist = false)
{
\GO::debug("Check existing model folder " . $model->className() . "(ID:" . $model->id . " Folder ID: " . $folder->id . " ACL ID: " . $model->findAclId() . ")");
if (!$folder->fsFolder->exists()) {
//throw new \Exception("Fs folder doesn't exist! ".$folder->fsFolder->path());
\GO::debug("Deleting it because filesystem folder doesn't exist");
$folder->readonly = 1;
//makes sure acl is not deleted
$folder->delete(true);
if ($mustExist) {
return $this->_createNewModelFolder($model);
} else {
return 0;
}
}
//todo test this:
// if(!isset($model->acl_id) && empty($params['mustExist'])){
// //if this model is not a container like an addressbook but a contact
// //then delete the folder if it's empty.
// $ls = $folder->fsFolder->ls();
// if(!count($ls) && $folder->fsFolder->mtime()<time()-60){
// $folder->delete();
// $response['files_folder_id']=$model->files_folder_id=0;
// $model->save();
// return $response['files_folder_id'];
// }
// }
$currentPath = $folder->path;
$newPath = $model->buildFilesPath();
if (!$newPath) {
return false;
}
if (\GO::router()->getControllerAction() == 'checkdatabase') {
//Always ensure folder exists on check database
$destinationFolder = \GO\Files\Model\Folder::model()->findByPath(dirname($newPath), true, array('acl_id' => $model->findAclId(), 'readonly' => 1));
}
if ($currentPath != $newPath) {
\GO::debug("Moving folder " . $currentPath . " to " . $newPath);
//model has a new path. We must move the current folder
$destinationFolder = \GO\Files\Model\Folder::model()->findByPath(dirname($newPath), true, array('acl_id' => $model->findAclId(), 'readonly' => 1));
//sometimes the folder must be moved into a folder with the same. name
//for example:
//projects/Name must be moved into projects/Name/Name
//then we temporarily move it to a temp name
if ($destinationFolder->id == $folder->id || $destinationFolder->fsFolder->isSubFolderOf($folder->fsFolder)) {
\GO::debug("Destination folder is the same!");
$folder->name = uniqid();
$folder->systemSave = true;
$folder->save(true);
\GO::debug("Moved folder to temp:" . $folder->fsFolder->path());
\GO::modelCache()->remove("GO\\Files\\Model\\Folder");
$destinationFolder = \GO\Files\Model\Folder::model()->findByPath(dirname($newPath), true);
\GO::debug("Now moving to:" . $destinationFolder->fsFolder->path());
}
if ($destinationFolder->id == $folder->id) {
throw new \Exception("Same ID's!");
}
$fsFolder = new \GO\Base\Fs\Folder($newPath);
// $fsFolder->appendNumberToNameIfExists();
if ($existingFolder = $destinationFolder->hasFolder($fsFolder->name())) {
\GO::debug("Merging into existing folder." . $folder->path . ' (' . $folder->id . ') -> ' . $existingFolder->path . ' (' . $existingFolder->id . ')');
//if (!empty($model->acl_id))
$existingFolder->acl_id = $model->findAclId();
$existingFolder->visible = 0;
$existingFolder->readonly = 1;
$existingFolder->save(true);
$folder->systemSave = true;
$existingFolder->moveContentsFrom($folder, true);
//delete empty folder.
$folder->readonly = 1;
//makes sure acl is not deleted
$folder->delete(true);
return $existingFolder->id;
} else {
// if ($model->acl_id>0)
// $folder->acl_id = $model->acl_id;
// else
// $folder->acl_id=0;
$folder->acl_id = $model->findAclId();
$folder->name = $fsFolder->name();
$folder->parent_id = $destinationFolder->id;
$folder->systemSave = true;
$folder->visible = 0;
$folder->readonly = 1;
if ($folder->isModified()) {
if (!$folder->save(true)) {
throw new \Exception(var_export($folder->getValidationErrors(), true));
}
}
}
} else {
\GO::debug("No change needed");
// if ($model->acl_id>0)
// $folder->acl_id = $model->acl_id;
// else
// $folder->acl_id=0;
$folder->acl_id = $model->findAclId();
$folder->systemSave = true;
$folder->visible = 0;
$folder->readonly = 1;
//.........这里部分代码省略.........
示例10:
<?php
GO::router()->getController()->fireEvent('footer');
?>
</body>
</html>