本文整理汇总了PHP中isInstalled函数的典型用法代码示例。如果您正苦于以下问题:PHP isInstalled函数的具体用法?PHP isInstalled怎么用?PHP isInstalled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isInstalled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* initialize
*
* @param Controller $controller
* @return void
* @access public
*/
function initialize(&$controller)
{
/* 未インストール・インストール中の場合はすぐリターン */
if (!isInstalled()) {
return;
}
$plugins = Configure::read('Baser.enablePlugins');
/* プラグインフックコンポーネントが実際に存在するかチェックしてふるいにかける */
$pluginHooks = array();
if ($plugins) {
foreach ($plugins as $plugin) {
$pluginName = Inflector::camelize($plugin);
if (App::import('Component', $pluginName . '.' . $pluginName . 'Hook')) {
$pluginHooks[] = $pluginName;
}
}
}
/* プラグインフックを初期化 */
foreach ($pluginHooks as $pluginName) {
$className = $pluginName . 'HookComponent';
$this->pluginHooks[$pluginName] =& new $className();
// 各プラグインの関数をフックに登録する
if (isset($this->pluginHooks[$pluginName]->registerHooks)) {
foreach ($this->pluginHooks[$pluginName]->registerHooks as $hookName) {
$this->registerHook($hookName, $pluginName);
}
}
}
/* initialize のフックを実行 */
$this->executeHook('initialize', $controller);
}
示例2: _check
function _check()
{
if (isInstalled()) {
$this->Session->setFlash(__('Already installed', true));
$this->redirect('/');
}
}
示例3: getModuleClasses
function getModuleClasses($module_dir = _PS_MODULE_DIR_, $sub = '/libs/classes')
{
$classes = array();
foreach (scandir($module_dir) as $file) {
if (!in_array($file, array('.', '..', 'index.php', '.htaccess', '.DS_Store'))) {
if ($sub == '/libs/classes' && @is_dir($module_dir . $file . $sub)) {
if (in_array($file, array('pst', 'pstmenumanager')) || isInstalled($file)) {
$classes = array_merge($classes, getModuleClasses($module_dir . $file . $sub));
}
} elseif (strpos($module_dir, '/libs/classes')) {
$path = $module_dir . '/' . $file;
if (is_dir($path)) {
$classes = array_merge($classes, getModuleClasses($path, ''));
} elseif (substr($file, -4) == '.php') {
$content = file_get_contents($path);
$pattern = '#\\W((abstract\\s+)?class|interface)\\s+(?P<classname>' . basename($file, '.php') . '(?:Core)?)' . '(?:\\s+extends\\s+[a-z][a-z0-9_]*)?(?:\\s+implements\\s+[a-z][a-z0-9_]*(?:\\s*,\\s*[a-z][a-z0-9_]*)*)?\\s*\\{#i';
if (preg_match($pattern, $content, $m)) {
$path = 'modules/' . str_replace(_PS_MODULE_DIR_, '', $module_dir) . '/';
$classes[$m['classname']] = array('path' => $path . $file, 'type' => trim($m[1]));
if (substr($m['classname'], -4) == 'Core') {
$classes[substr($m['classname'], 0, -4)] = array('path' => '', 'type' => $classes[$m['classname']]['type']);
}
}
}
}
}
}
return $classes;
}
示例4: __construct
/**
* コンストラクタ
*
* @return void
* @access public
*/
function __construct()
{
$this->_view =& ClassRegistry::getObject('view');
if (isInstalled()) {
if (ClassRegistry::isKeySet('Permission')) {
$this->Permission = ClassRegistry::getObject('Permission');
} else {
$this->Permission = ClassRegistry::init('Permission');
}
if (ClassRegistry::isKeySet('Page')) {
$this->Page = ClassRegistry::getObject('Page');
} else {
$this->Page = ClassRegistry::init('Page');
}
if (ClassRegistry::isKeySet('PageCategory')) {
$this->PageCategory = ClassRegistry::getObject('PageCategory');
} else {
$this->PageCategory = ClassRegistry::init('PageCategory');
}
if (isset($this->_view->viewVars['siteConfig'])) {
$this->siteConfig = $this->_view->viewVars['siteConfig'];
}
// プラグインのBaserヘルパを初期化
$this->_initPluginBasers();
}
}
示例5: isAdminGlobalmenuUsed
/**
* 管理システムグローバルメニューの利用可否確認
*
* @return boolean
* @access public
*/
function isAdminGlobalmenuUsed()
{
if (!isInstalled()) {
return false;
}
if (empty($this->params['admin']) && !empty($this->_view->viewVars['user'])) {
return false;
}
$UserGroup = ClassRegistry::getObject('UserGroup');
return $UserGroup->isAdminGlobalmenuUsed($this->_view->viewVars['user']['user_group_id']);
}
示例6: exec
public function exec()
{
try {
/* check installed module */
if (false === isInstalled($this->parm)) {
/* target module is already installed */
throw new \err\ComErr('specified module is not installed', 'please check \'spac mod list\'');
}
/* confirm */
echo 'Uninstall ' . $this->parm . ' module.' . PHP_EOL;
echo 'Are you sure ?(y,n):';
$line = rtrim(fgets(STDIN), "\n");
if (!(0 === strcmp($line, 'y') || 0 === strcmp($line, 'Y'))) {
exit;
}
/* delete module files */
if (true === isDirExists(__DIR__ . '/../../mod/' . $this->parm)) {
try {
delDir(__DIR__ . '/../../mod/' . $this->parm);
} catch (\Exception $e) {
throw new \err\ComErr('could not delete ' . __DIR__ . '/../../mod/' . $this->parm, 'please check directory');
}
}
/* edit module config */
$modcnf = yaml_parse_file(__DIR__ . '/../../../../conf/module.yml');
if (false === $modcnf) {
throw new \err\ComErr('could not read module config file', 'please check ' . __DIR__ . '/../../../../conf/module.yml');
}
$newcnf = array();
foreach ($modcnf as $elm) {
if (0 === strcmp($this->parm, $elm['name'])) {
continue;
}
$newcnf[] = $elm;
}
if (0 === count($newcnf)) {
$newcnf = null;
}
if (false === copy(__DIR__ . '/../../../../conf/module.yml', __DIR__ . '/../../../../conf/module.yml_')) {
throw new \err\ComErr('could not create backup of module config', 'please check ' . __DIR__ . '/../../../../conf');
}
if (false === file_put_contents(__DIR__ . '/../../../../conf/module.yml', yaml_emit($newcnf))) {
throw new \err\ComErr('could not edit module config file', 'please check ' . __DIR__ . '/../../../../conf/module.yml');
}
unlink(__DIR__ . '/../../../../conf/module.yml_');
echo 'Successful uninstall ' . $this->parm . ' module ' . PHP_EOL;
} catch (\Exception $e) {
throw $e;
}
}
示例7: isInstalledOnUsb
/**
* Test if a command is installed on usb
* @param String The command to check
* @return 2 if installed on usb | 1 if not on usb | 0 if not installed
*
*/
function isInstalledOnUsb($command)
{
if (isInstalled($command)) {
if (file_exists("/usb/usr/bin/{$command}")) {
return 2;
} else {
if (file_exists("/usr/bin/{$command}")) {
return 1;
}
}
} else {
return 0;
}
}
示例8: loadPlugins
function loadPlugins()
{
if (!isInstalled()) {
return;
}
$pluginsDir = "{$GLOBALS['PROGRAM_DIR']}/plugins";
$pluginList = getPluginList();
//
foreach ($pluginList as $filename => $pluginData) {
if ($pluginData['isActive']) {
$filepath = "{$pluginsDir}/{$filename}";
include $filepath;
}
}
}
示例9: beforeRender
/**
* beforeRender
*
* @return void
* @access public
*/
function beforeRender()
{
/* 未インストール・インストール中の場合はすぐリターン */
if (!isInstalled()) {
return;
}
$view = ClassRegistry::getObject('View');
$plugins = Configure::read('BcStatus.enablePlugins');
// 現在のテーマのフックも登録する(テーマフック)
// TODO プラグインではないので、プラグインフックというこの仕組の名称自体を検討する必要がある?
$plugins[] = Configure::read('BcSite.theme');
/* プラグインフックコンポーネントが実際に存在するかチェックしてふるいにかける */
$pluginHooks = array();
if ($plugins) {
foreach ($plugins as $plugin) {
$pluginName = Inflector::camelize($plugin);
if (App::import('Helper', $pluginName . '.' . $pluginName . 'Hook')) {
$pluginHooks[] = $pluginName;
}
}
}
/* プラグインフックを初期化 */
$vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin');
$c = count($vars);
foreach ($pluginHooks as $key => $pluginName) {
// 各プラグインのプラグインフックを初期化
$className = $pluginName . 'HookHelper';
$this->pluginHooks[$pluginName] =& new $className();
for ($j = 0; $j < $c; $j++) {
if (isset($view->{$vars[$j]})) {
$this->pluginHooks[$pluginName]->{$vars[$j]} = $view->{$vars[$j]};
}
}
// 各プラグインの関数をフックに登録する
if (isset($this->pluginHooks[$pluginName]->registerHooks)) {
foreach ($this->pluginHooks[$pluginName]->registerHooks as $hookName) {
$this->registerHook($hookName, $pluginName);
}
}
}
/* beforeRenderをフック */
$this->executeHook('beforeRender');
}
示例10: exec
public function exec()
{
try {
/* check specified directory */
chkRequireConts($this->getPrm());
$desc = yaml_parse_file($this->getPrm() . 'conf/desc.yml');
if (false === $desc) {
throw new \err\ComErr('could not read module description file', 'please check ' . $tgt . 'conf/desc.yml');
}
/* check installed module */
if (true === isInstalled($desc['name'])) {
/* target module is already installed */
throw new \err\ComErr('specified module is already installed', 'please check \'spac mod list\'');
}
/* copy module contents */
copyDir($this->getPrm(), __DIR__ . '/../../mod/' . $desc['name']);
/* add module name to module config file */
$modcnf = yaml_parse_file(__DIR__ . '/../../../../conf/module.yml');
$first = false;
if (null === $modcnf) {
$first = true;
$modcnf = array();
}
$add = array('name' => $desc['name'], 'select' => false);
if (true === $first) {
$add['select'] = true;
}
$modcnf[] = $add;
if (false === copy(__DIR__ . '/../../../../conf/module.yml', __DIR__ . '/../../../../conf/module.yml_')) {
throw new \err\ComErr('could not create backup of module config', 'please check ' . __DIR__ . '/../../../../conf');
}
if (false === file_put_contents(__DIR__ . '/../../../../conf/module.yml', yaml_emit($modcnf))) {
throw new \err\ComErr('could not edit module config file', 'please check ' . __DIR__ . '/../../../../conf/module.yml');
}
unlink(__DIR__ . '/../../../../conf/module.yml_');
echo 'Successful install ' . $desc['name'] . ' module' . PHP_EOL;
echo 'You can check installed module \'spac mod list\',' . PHP_EOL;
} catch (\Exception $e) {
throw $e;
}
}
示例11: exec
public function exec()
{
try {
if (false === isInstalled($this->parm)) {
/* target module is already installed */
throw new \err\ComErr('specified module is not installed', 'please check \'spac mod list\'');
}
$desc = yaml_parse_file(__DIR__ . '/../../mod/' . $this->getPrm() . '/conf/desc.yml');
if (false === $desc) {
throw new \err\ComErr('could not read module description file', 'please check ' . __DIR__ . '/../../mod/' . $this->getPrm() . '/conf/desc.yml');
}
$mcnf = yaml_parse_file(__DIR__ . '/../../../conf/module.yml');
if (false === $mcnf) {
throw new \err\ComErr('could not read module config', 'please check ' . __DIR__ . '/../../../conf/module.yml');
}
$select = '';
foreach ($mcnf as $elm) {
if (true !== $elm['select']) {
continue;
}
if (0 === strcmp($desc['name'], $elm['name'])) {
$select .= '(selected)';
break;
}
}
echo '<' . $desc['name'] . ' Module' . $select . '>' . PHP_EOL;
echo 'Version ' . $desc['version'];
echo ', Author ' . $desc['author'] . PHP_EOL;
echo 'URL : ';
if (true === isset($desc['url'])) {
echo $desc['url'];
}
echo PHP_EOL;
if (true === isset($desc['desc'])) {
echo $desc['desc'];
}
echo PHP_EOL;
} catch (\Exception $e) {
throw $e;
}
}
示例12: __loadDataToView
/**
* View用のデータを読み込む。
* beforeRenderで呼び出される
*
* @return void
* @access private
*/
function __loadDataToView()
{
$this->set('subMenuElements', $this->subMenuElements);
// サブメニューエレメント
$this->set('crumbs', $this->crumbs);
// パンくずなび
$this->set('search', $this->search);
$this->set('help', $this->help);
/* ログインユーザー */
if (isInstalled() && isset($_SESSION['Auth']['User']) && $this->name != 'Installations') {
$this->set('user', $_SESSION['Auth']['User']);
$this->set('favorites', $this->Favorite->find('all', array('conditions' => array('Favorite.user_id' => $_SESSION['Auth']['User']['id']), 'order' => 'Favorite.sort', 'recursive' => -1)));
}
/* 携帯用絵文字データの読込 */
// TODO 実装するかどうか検討する
/*if(isset($this->params['prefix']) && $this->params['prefix'] == 'mobile' && !empty($this->EmojiData)) {
$emojiData = $this->EmojiData->findAll();
$this->set('emoji',$this->Emoji->EmojiData($emojiData));
}*/
}
示例13: pageLogin
/**
* Display the login screen.
*
* This screen should also check if PivotX is set up correctly. If it isn't, the
* user will be redirected to the Troubleshooting or Setup screen.
*
*/
function pageLogin($template = "normal")
{
global $PIVOTX;
if (!isInstalled()) {
pageSetupUser();
die;
}
$PIVOTX['template']->assign('title', __("Login"));
$PIVOTX['template']->assign('heading', __("Login"));
$template = getDefault($_POST['template'], $template);
if (isMobile()) {
$template = "mobile";
}
$form = getLoginForm($template);
// If a 'return to' is set, pass it onto the template, but only the 'path' and 'query'
// part. This means that we do NOT allow redirects to another domain!!
$returnto = getDefault($_GET['returnto'], $_POST['returnto']);
if (!empty($returnto)) {
$returnto = parse_url($returnto);
$returnto_link = $returnto['path'];
if (!empty($returnto['query'])) {
$returnto_link .= '?' . $returnto['query'];
}
$form->setvalue('returnto', $returnto_link);
}
// Get the validation result
$result = $form->validate();
$extraval = array();
if ($result != FORM_OK) {
if (isset($_GET['resetpassword']) && isset($_GET['username']) && isset($_GET['id'])) {
$form->setvalue('username', $_GET['username']);
$user = $PIVOTX['users']->getUser($_GET['username']);
if ($user && !empty($user['reset_id']) && $_GET['id'] == $user['reset_id']) {
$extraval['pass1'] = randomString(8, true);
$extraval['reset_id'] = '';
$pass = "'<strong>" . $extraval['pass1'] . "</strong>'";
$message = "<p>" . __('Your new password is %pass%.') . "</p>";
$message = str_replace('%pass%', $pass, $message);
$PIVOTX['messages']->addMessage($message);
$html = $message;
$PIVOTX['users']->updateUser($user['username'], $extraval);
$PIVOTX['events']->add('password_reset', "", $user['username']);
} else {
$PIVOTX['messages']->addMessage(__('Oops') . ' - ' . __('Password reset request failed.'));
debug('Password reset request failed - wrong id.');
}
}
$PIVOTX['template']->assign("html", $html);
$PIVOTX['template']->assign("form", $form->fetch(true));
} else {
$val = $form->getvalues();
if ($val['resetpassword'] == 1) {
$can_send_mail = true;
$user = $PIVOTX['users']->getUser($val['username']);
if ($user) {
$extraval['reset_id'] = md5($PIVOTX['config']->get('server_spam_key') . $user['password']);
$PIVOTX['users']->updateUser($user['username'], $extraval);
$link = $PIVOTX['paths']['host'] . makeAdminPageLink('login') . '&resetpassword&username=' . urlencode($user['username']) . '&id=' . $extraval['reset_id'];
$can_send_mail = mailResetPasswordLink(array('name' => $user['username'], 'email' => $user['email'], 'reset_id' => $extraval['reset_id'], 'link' => $link));
}
if ($can_send_mail) {
// Posting this message even if an invalid username is given so
// crackers can't enumerate usernames.
$PIVOTX['messages']->addMessage(__('A link to reset your password was sent to your mailbox.'));
} else {
$PIVOTX['messages']->addMessage(__('PivotX was not able to send a mail with the reset link.'));
}
$PIVOTX['events']->add('request_password', "", $user['username']);
$PIVOTX['template']->assign("form", $form->fetch(true));
} elseif ($PIVOTX['session']->login($val['username'], $val['password'], $val['stayloggedin'])) {
// User successfully logged in... set language and go to Dashboard or 'returnto'
$currentuser = $PIVOTX['users']->getUser($PIVOTX['session']->currentUsername());
$PIVOTX['languages']->switchLanguage($currentuser['language']);
if (!empty($returnto_link)) {
header("Location: " . $returnto_link);
die;
} else {
if ($template == "normal") {
pageDashboard();
} else {
if ($template == "mobile") {
header('Location: index.php');
} else {
pageBookmarklet();
}
}
die;
}
} else {
// User couldn't be logged in
$PIVOTX['events']->add('failed_login', "", safeString($_POST['username']));
$PIVOTX['messages']->addMessage($PIVOTX['session']->getMessage());
$PIVOTX['template']->assign("form", $form->fetch(true));
//.........这里部分代码省略.........
示例14: displayLogoOnlyHeader
use SubjectsPlus\Control\Installer;
use SubjectsPlus\Control\Querier;
//set varirables needed in header
$subcat = "install";
$page_title = "Installation";
$sessionCheck = 'no';
$no_header = "yes";
$installCheck = 'no';
$updateCheck = 'no';
include "includes/header.php";
//logo only header
displayLogoOnlyHeader();
//find what step we are in
$lintStep = isset($_GET['step']) ? (int) $_GET['step'] : 0;
//if installed already, display message and discontinue
if (isInstalled()) {
?>
<div id="maincontent" style="max-width: 800px; margin-right: auto; margin-left: auto;">
<div class="box required_field">
<h2 class="bw_head"><?php
echo _("Already Installed");
?>
</h2>
<p><?php
echo _('There appears to already be an installation of SubjectsPlus. To reinstall please clear old database tables first.');
?>
</p>
<p><a href="login.php"><?php
echo _('Log In');
?>
示例15: __construct
/**
* コンストラクタ
*
* @return void
* @access private
*/
function __construct()
{
parent::__construct();
$base = baseUrl();
// サイト基本設定の読み込み
if (file_exists(CONFIGS . 'database.php')) {
$dbConfig = new DATABASE_CONFIG();
if ($dbConfig->baser['driver']) {
$SiteConfig = ClassRegistry::init('SiteConfig', 'Model');
$this->siteConfigs = $SiteConfig->findExpanded();
if (empty($this->siteConfigs['version'])) {
$this->siteConfigs['version'] = $this->getBaserVersion();
$SiteConfig->saveKeyValue($this->siteConfigs);
}
// テーマの設定
if ($base) {
$reg = '/^' . str_replace('/', '\\/', $base) . '(installations)/i';
} else {
$reg = '/^\\/(installations)/i';
}
if (!preg_match($reg, @$_SERVER['REQUEST_URI']) || isInstalled()) {
$this->theme = $this->siteConfigs['theme'];
// ===============================================================================
// テーマ内プラグインのテンプレートをテーマに梱包できるようにプラグインパスにテーマのパスを追加
// 実際には、プラグインの場合も下記パスがテンプレートの検索対象となっている為不要だが、
// ビューが存在しない場合に、プラグインテンプレートの正規のパスがエラーメッセージに
// 表示されてしまうので明示的に指定している。
// (例)
// [変更後] app/webroot/themed/demo/blog/news/index.ctp
// [正 規] app/plugins/blog/views/themed/demo/blog/news/index.ctp
// 但し、CakePHPの仕様としてはテーマ内にプラグインのテンプレートを梱包できる仕様となっていないので
// 将来的には、blog / mail / feed をプラグインではなくコアへのパッケージングを検討する必要あり。
// ※ AppView::_pathsも関連している
// ===============================================================================
$pluginThemePath = WWW_ROOT . 'themed' . DS . $this->theme . DS;
$pluginPaths = Configure::read('pluginPaths');
if (!in_array($pluginThemePath, $pluginPaths)) {
Configure::write('pluginPaths', am(array($pluginThemePath), $pluginPaths));
}
}
}
}
// TODO beforeFilterでも定義しているので整理する
if ($this->name == 'CakeError') {
// モバイルのエラー用
if (Configure::read('AgentPrefix.on')) {
$this->layoutPath = Configure::read('AgentPrefix.currentPrefix');
if (Configure::read('AgentPrefix.currentAgent') == 'mobile') {
$this->helpers[] = 'Mobile';
}
}
if ($base) {
$reg = '/^' . str_replace('/', '\\/', $base) . 'admin/i';
} else {
$reg = '/^\\/admin/i';
}
if (preg_match($reg, $_SERVER['REQUEST_URI'])) {
$this->layoutPath = 'admin';
$this->subDir = 'admin';
}
}
if (Configure::read('AgentPrefix.currentAgent') == 'mobile') {
if (!Configure::read('Baser.mobile')) {
$this->notFound();
}
}
if (Configure::read('AgentPrefix.currentAgent') == 'smartphone') {
if (!Configure::read('Baser.smartphone')) {
$this->notFound();
}
}
/* 携帯用絵文字のモデルとコンポーネントを設定 */
// TODO 携帯をコンポーネントなどで判別し、携帯からのアクセスのみ実行させるようにする
// ※ コンストラクト時点で、$this->params['prefix']を利用できない為。
// TODO 2008/10/08 egashira
// beforeFilterに移動してみた。実際に携帯を使うサイトで使えるかどうか確認する
//$this->uses[] = 'EmojiData';
//$this->components[] = 'Emoji';
}