/** * 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); }
function _check() { if (isInstalled()) { $this->Session->setFlash(__('Already installed', true)); $this->redirect('/'); } }
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; }
/** * コンストラクタ * * @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(); } }
/** * 管理システムグローバルメニューの利用可否確認 * * @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']); }
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; } }
/** * 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; } }
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; } } }
/** * 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'); }
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; } }
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; } }
/** * 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)); }*/ }
/** * 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 = "******" . $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='******'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)); } } // Check for warnings to display $PIVOTX['messages']->checkWarnings(); if ($template == "normal") { $templatename = "generic.tpl"; } else { if ($template == "mobile") { $templatename = "mobile/generic.tpl"; } else { $templatename = "bookmarklet_login.tpl"; } } renderTemplate($templatename); }
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'); ?>
/** * コンストラクタ * * @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'; }
/** * baserCMSのインストールが完了しているかチェックする */ public function testIsInstalled() { $installedPath = APP . 'Config' . DS . 'install.php'; // app/Config/installed.phpが存在しない場合 if (rename($installedPath, $installedPath . '_copy')) { $result = isInstalled(); $this->assertFalse($result, 'app/Config/installed.phpが存在していない場合にtrueが返ってきます'); } else { $this->markTestIncomplete('app/Config/installed.phpのファイル名変更に失敗したのでテストをスキップしました。'); } // app/Config/installed.phpが存在する場合 if (rename($installedPath . '_copy', $installedPath)) { $result = isInstalled(); $this->assertTrue($result, 'app/Config/installed.phpが存在している場合にfalseが返ってきます'); } else { $this->markTestIncomplete('app/Config/installed.phpのファイル名変更に失敗したのでテストをスキップしました。'); } }
// output("Checking for AWStats"); // $is_ok_awstats = isInstalled("[ -f /opt/local/www/awstats/cgi-bin/awstats.pl ] && echo 'exists' || echo 'Not found'", array("exists"), false); // output($is_ok_awstats ? "AWStats is OK" : "AWStats not found - installing now"); // if(!$is_ok_awstats) { // command("sudo port install awstats"); // } // check for imagick output("Checking for PHP imagick"); $is_ok_imagick = isInstalled("[ -f /opt/local/lib/php55/extensions/no-debug-non-zts-20121212/imagick.so ] && echo 'exists' || echo 'Not found'", array("exists"), false); output($is_ok_imagick ? "PHP imagick is OK" : "PHP imagick not found - installing now"); if (!$is_ok_imagick) { command("sudo port install php55-imagick"); } // check for imagick output("Checking for PHP memcached"); $is_ok_memcached = isInstalled("[ -f /opt/local/lib/php55/extensions/no-debug-non-zts-20121212/memcached.so ] && echo 'exists' || echo 'Not found'", array("exists"), false); output($is_ok_memcached ? "PHP memcached is OK" : "PHP memcached not found - installing now"); if (!$is_ok_memcached) { command("sudo port install php55-memcached"); } // is software available if (!$is_ok_xcode || !$is_ok_macports || !$is_ok_ffmpeg || !$is_ok_php || !$is_ok_imagick || !$is_ok_memcached) { goodbye("Update your software as specified above"); } // ensure sudo power before continuing enableSuperCow(); output("\nChecking paths"); // check if configuration files are available checkFile("_conf/httpd.conf", "Required file is missing from your configuration source"); checkFile("_conf/my.cnf", "Required file is missing from your configuration source"); checkFile("_conf/httpd-vhosts.conf", "Required file is missing from your configuration source");
function Languages($language = '') { global $l10n, $PIVOTX; if ($language == '') { if (!isInstalled()) { $language = $this->default; } elseif (defined('PIVOTX_INADMIN') || defined('PIVOTX_INEDITOR')) { $currentuser = $PIVOTX['users']->getUser($PIVOTX['session']->currentUsername()); $language = $currentuser['language']; } elseif (defined('PIVOTX_INWEBLOG')) { $language = $PIVOTX['weblogs']->get('', 'language'); } // Fallback - system default if ($language == '') { $language = $PIVOTX['config']->get('language'); } // Final fallback - English. if ($language == '') { $language = $this->default; } } // FIXME: Add check if language exists - fallback to English. $l10n['currlang'] = $language; $this->loadLanguage($language); $this->code = $language; $this->name = $this->codes[$language]; }
/** * コンストラクタ * * @param boolean $id * @param string $table * @param string $ds */ public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); if (isConsole() && !isInstalled()) { App::uses('PageCategory', 'Model'); $this->PageCategory = new PageCategory(null, null, $ds); } }
/** * find * * キャッシュビヘイビアが利用状態の場合、モデルデータキャッシュを読み込む * * 【AppModelではキャッシュを定義しない事】 * 自動的に生成されるクラス定義のない関連モデルの処理で勝手にキャッシュを利用されないようにする為 * (HABTMの更新がうまくいかなかったので) * * 【PHP5限定】 * PHP4では次のような処理ができない為 * Model ⇒ Behavior ⇒ call_user_func_array ⇒ Model ⇒ Behavior * ※ ビヘイビア内で自モデルのメソッドを呼び出しそのメソッド内でさらにビヘイビアを使う * * @param mixed... * @return type * @access public */ function find($conditions = null, $fields = array(), $order = null, $recursive = null) { $args = func_get_args(); $cache = true; if (isset($args[1]['cache']) && is_bool($args[1]['cache'])) { $cache = $args[1]['cache']; unset($args[1]['cache']); } if (PHP5 && isInstalled() && isset($this->Behaviors) && $this->Behaviors->attached('Cache') && $this->Behaviors->enabled('Cache') && Configure::read('debug') == 0) { if ($this->cacheEnabled()) { return $this->cacheMethod($cache, __FUNCTION__, $args); } } return parent::find($conditions, $fields, $order, $recursive); }
include "functions.php"; // start by requesting sudo power enableSuperCow(); // check software requirements output("Checking for Xcode"); $is_ok_xcode = isInstalled("xcodebuild -version", array("Xcode 4", "Xcode 5", "Xcode 6", "Xcode 7")); output($is_ok_xcode ? "Xcode is OK" : "Xcode check failed - update or install Xcode from AppStore"); output("Checking for Xcode command line tools"); $is_ok_xcode_cl = isInstalled("pkgutil --pkg-info=com.apple.pkg.CLTools_Executables", array("version: 6", "version: 7")); output($is_ok_xcode_cl ? "Xcode command line tools are OK" : "Xcode command line tools check failed - installing now"); if (!$is_ok_xcode_cl) { command("xcode-select --install"); goodbye("Run the setup command again when the command line tools are installed"); } output("Checking for Macports"); $is_ok_macports = isInstalled("port version", array("Version: 2")); output($is_ok_macports ? "Macports is OK" : "Macports check failed - update or install Macports from macports.org"); // is software available if (!$is_ok_xcode || !$is_ok_macports) { goodbye("Update your software as specified above"); } output("\nChecking paths"); // check if configuration files are available checkFile("_conf/httpd.conf", "Required file is missing from your configuration source"); checkFile("_conf/httpd-vhosts.conf", "Required file is missing from your configuration source"); checkFile("_conf/php.ini", "Required file is missing from your configuration source"); checkFile("_conf/my.cnf", "Required file is missing from your configuration source"); checkFile("_conf/apache.conf", "Required file is missing from your configuration source"); // TODO: create .bash_profile if it does not exist // Has not been tested checkFileOrCreate("~/.bash_profile", "_conf/bash_profile.start");
* @copyright Copyright 2008 - 2015, baserCMS Users Community * @link http://basercms.net baserCMS Project * @package Baser.Config * @since baserCMS v 0.1.0 * @license http://basercms.net/license/index.html */ /** * Include files */ require CORE_PATH . 'Baser' . DS . 'Config' . DS . 'paths.php'; require BASER . 'basics.php'; require BASER . 'Error' . DS . 'exceptions.php'; /** * インストール状態 */ define('BC_INSTALLED', isInstalled()); /** * Baserパス追加 */ App::build(array('Controller' => array_merge(App::path('Controller'), array(BASER_CONTROLLERS)), 'Model' => array_merge(App::path('Model'), array(BASER_MODELS)), 'Model/Behavior' => array_merge(App::path('Model/Behavior'), array(BASER_BEHAVIORS)), 'Model/Datasource' => array_merge(App::path('Model/Datasource'), array(BASER_DATASOURCE)), 'Model/Datasource/Database' => array_merge(App::path('Model/Datasource/Database'), array(BASER_DATABASE)), 'Controller/Component' => array_merge(App::path('Controller/Component'), array(BASER_COMPONENTS)), 'Controller/Component/Auth' => array_merge(App::path('Controller/Component/Auth'), array(BASER_COMPONENTS . 'Auth' . DS)), 'View' => array_merge(array(WWW_ROOT), App::path('View'), array(BASER_VIEWS)), 'View/Helper' => array_merge(App::path('View/Helper'), array(BASER_HELPERS)), 'Plugin' => array_merge(App::path('Plugin'), array(BASER_PLUGINS)), 'Vendor' => array_merge(App::path('Vendor'), array(BASER_VENDORS)), 'Locale' => array_merge(App::path('Locale'), array(BASER_LOCALES)), 'Lib' => array_merge(App::path('Lib'), array(BASER_LIBS)), 'Console' => array_merge(App::path('Console'), array(BASER_CONSOLES)), 'Console/Command' => array_merge(App::path('Console/Command'), array(BASER_CONSOLES . 'Command' . DS)), 'Routing/Filter' => array_merge(App::path('Routing/Filter'), array(BASER . 'Routing' . DS . 'Filter' . DS)))); App::build(array('Event' => array(APP . 'Event', BASER_EVENTS), 'Routing/Filter' => array(BASER . 'Routing' . DS . 'Filter' . DS), 'Configure' => array(BASER . 'Configure' . DS), 'TestSuite' => array(BASER_TEST_SUITE), 'TestSuite/Reporter' => array(BASER_TEST_SUITE . 'Reporter' . DS), 'TestSuite/Fixture' => array(BASER_TEST_SUITE . 'Fixture' . DS), 'Network' => array(BASER . 'Network' . DS)), App::REGISTER); /** * 配置パターン * Windows対策として、「\」を「/」へ変換してチェックする */ if (!defined('BC_DEPLOY_PATTERN')) { if (!preg_match('/' . preg_quote(str_replace('\\', '/', docRoot()), '/') . '/', str_replace('\\', '/', ROOT))) { // CakePHP標準の配置 define('BC_DEPLOY_PATTERN', 3); } elseif (ROOT . DS == WWW_ROOT) { // webrootをドキュメントルートにして、その中に app / baser / cake を配置
<?php require_once "reaver_functions.php"; if (isset($_GET['reaver'])) { if (isset($_GET['install'])) { $usb = isset($_GET['onusb']) ? true : false; echo install("reaver", $usb); } else { if (isInstalled("reaver")) { if (isset($_GET['refresh'])) { if (isVariableValable($_GET['bssid'])) { echo refreshLog($_GET['bssid']); } else { echo "No BSSID provided..."; } } else { if (isset($_GET['start'])) { // if (isRunning('reaver') == "1") // exec('killall reaver && wait 5'); $victime = $_GET['victime']; $int = $_GET['interface']; if ($victime != "" && $int != "") { $logFile = getConf('logPath') . 'reaver-' . $victime . '.log'; $options = ""; $cmd = "reaver -i {$int} -b {$victime} "; if (isset($_GET['c']) && $_GET['c'] == "true") { if (isset($_GET['ch']) && $_GET['ch'] != "") { $cmd .= " -f -c " . $_GET['ch']; $options .= "c"; } }
/** * Step 5: 設定ファイルの生成 * データベース設定ファイル[database.php] * インストールファイル[install.php] * * @return void * @access public */ function step5() { $this->pageTitle = 'baserCMSのインストール完了!'; $db = ConnectionManager::getInstance(); if ($db->config->baser['driver'] == '') { // データベース設定を書き込む $this->_writeDatabaseConfig($this->_readDbSettingFromSession()); // DB設定ファイルを再読み込みする為リダイレクトする $this->redirect('step5'); } elseif (isInstalled()) { return; } $message = ''; // インストールファイルを生成する if (!$this->_createInstallFile()) { if ($message) { $message .= '<br />'; } $message .= '/app/config/install.php インストール設定ファイルの設定ができませんでした。パーミションの確認をしてください。'; } // tmp フォルダを作成する checkTmpFolders(); // ブログの投稿日を更新 $this->_updateEntryDate(); // プラグインのステータスを更新 $this->_updatePluginStatus(); // ログイン $this->_login(); // テーマを配置する $this->BaserManager->deployTheme(); $this->BaserManager->deployTheme('skelton'); // pagesファイルを生成する $this->_createPages(); ClassRegistry::removeObject('View'); // デバッグモードを0に変更 $this->writeDebug(0); if ($message) { $this->setFlash($message); } }
<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap.min.css" type="text/css" /> <link rel="stylesheet" href="css/index.css" type="text/css"/> <link rel="stylesheet" href="vendor/slickgrid/slick.grid.css" type="text/css" /> <link rel="stylesheet" href="vendor/slickgrid/slick-default-theme.css" type="text/css" /> <link rel="stylesheet" href="vendor/slickgrid/css/smoothness/jquery-ui-1.8.16.custom.css" type="text/css" /> <link rel="stylesheet" href="vendor/slickgrid-enhancement-pager/libs/dropkick.css" type="text/css" /> <link rel="stylesheet" href="vendor/slickgrid-enhancement-pager/libs/enhancementpager.css" type="text/css" /> </head> <body class='container-fluid'> <?php // --------------- INSTALLATION --------------- if (isset($_GET['installation'])) { if (isInstalled($bdd) == true) { printError('OpenVPN-admin is already installed.'); exit - 1; } // If the user sent the installation form if (isset($_POST['admin_username'])) { $admin_username = $_POST['admin_username']; $admin_pass = $_POST['admin_pass']; $admin_repeat_pass = $_POST['repeat_admin_pass']; if ($admin_pass != $admin_repeat_pass) { printError('The passwords do not correspond.'); exit - 1; } // Create the tables or die $sql_file = dirname(__FILE__) . '/sql/import.sql'; try {
$lstrURL = getControlURL(); if ( strstr( $e->getMessage() , 'Could not choose database.' ) ) { header("location:{$lstrURL}includes/configErrorPage.php?error=database"); }else { header("location:{$lstrURL}includes/configErrorPage.php?error=connection"); } exit(); */ } //added in order to redirect to proper page if SubjectsPlus is not installed. Only check if $installCheck variable doesn't exists and says no if (!isset($installCheck) || $installCheck != 'no') { $isInstalled = isInstalled(); if (!$isInstalled) { $lstrURL = getControlURL(); header("location:{$lstrURL}install.php"); exit; } } //added in order to redirect to proper page if SubjectsPlus is not updated to 2.0. Only check if $updateCheck variable doesn't exists and says no if (!isset($updateCheck) || $updateCheck != 'no') { $isUpdated = isUpdated(); if (!$isUpdated) { $lstrURL = getControlURL(); header("location:{$lstrURL}update.php"); exit; } }
function installGarena() { global $config; if (isInstalled("garena")) { return; } chdir($config['root_path']); rexec("svn co http://gcb.googlecode.com/svn/trunk/bin gcb-bin"); mkdir($config['garena_path']); chmod($config['garena_path'], 0755); mkdir($config['garena_path'] . "lib"); chmod($config['garena_path'] . "lib", 0755); copy($config['root_path'] . "gcb-bin/gcb.jar", $config['garena_path'] . "gcb.jar"); copy($config['root_path'] . "gcb-bin/gcbrooms.txt", $config['garena_path'] . "gcbrooms.txt"); copy($config['root_path'] . "gcb-bin/gkey.pem", $config['garena_path'] . "gkey.pem"); copy($config['root_path'] . "gcb-bin/gcb.cfg", $config['garena_path'] . "gcb.cfg"); recursiveCopy($config['root_path'] . "gcb-bin/lib", $config['garena_path'] . "lib"); installFinish("garena"); }
function _init_loadSettings() { // get settings filenames and paths (either) list($hostnameWithoutPort) = explode(':', strtolower(@$_SERVER['HTTP_HOST'])); $hostnameWithoutPort = preg_replace('/[^\\w\\-\\.]/', '', $hostnameWithoutPort); // security: HTTP_HOST is user defined - remove non-filename chars to prevent ../ attacks $hostnameWithoutPort = preg_replace('/^www\\./i', '', $hostnameWithoutPort); // v2.50 - usability: don't require www. prefix so www.example.com and example.com both check for settings.example.com.php $settings_fileName = 'settings.' . preg_replace('/[^\\w\\-\\.]/', '', $hostnameWithoutPort) . '.php'; $settings_filePath = DATA_DIR . '/' . $settings_fileName; // supports host based settings files such as: /data/settings.localhost.php define('SETTINGS_DEV_FILENAME', $settings_fileName); define('SETTINGS_DEV_FILEPATH', DATA_DIR . '/' . SETTINGS_DEV_FILENAME); // set settings name and path for this server $useDev = is_file(SETTINGS_DEV_FILEPATH); define('SETTINGS_FILENAME', $useDev ? SETTINGS_DEV_FILENAME : 'settings.dat.php'); define('SETTINGS_FILEPATH', $useDev ? SETTINGS_DEV_FILEPATH : DATA_DIR . '/settings.dat.php'); // Require hostname-based settings files on development server domains (this section to be expanded) if (isInstalled() && isDevServer() && !is_file(SETTINGS_DEV_FILEPATH)) { header("Content-type: text/plain"); die("Development server requires custom settings files. Delete /data/isInstalled.php and re-install to create one."); } // load settings global $SETTINGS; if (!is_file(SETTINGS_FILEPATH)) { renameOrRemoveDefaultFiles(); } // rename settings.dat.php.default to settings.dat.php $SETTINGS = loadStructOrINI(SETTINGS_FILEPATH); // legacy support $SETTINGS['advanced']['encryptPasswords'] = 1; // added in 2.08, removed in 2.62 (force on for legacy support since encryption is always required now) ### set defaults (if not already defined in settings file - this happens when a user upgrades) // NOTE: Do this here for future instead of _upgradeSettings() $defaults = array('language' => '', 'adminEmail' => '', 'adminUrl' => '', 'cookiePrefix' => substr(md5(mt_rand()), 0, 5) . '_', 'activePlugins' => '', 'headerImageUrl' => '', 'footerHTML' => '', 'dateFormat' => '', 'cssTheme' => 'blue.css', 'webRootDir' => @$_SERVER['DOCUMENT_ROOT'], 'wysiwyg' => array(), 'advanced' => array(), 'bgtasks_lastRun' => '0', 'bgtasks_lastEmail' => '0', 'webPrefixUrl' => ''); $wysiwygDefaults = array('wysiwygLang' => 'en', 'includeDomainInLinks' => '0'); $advancedDefaults = array('imageResizeQuality' => 80, 'showExpandedMenu' => 0, 'disableFlashUploader' => 0, 'codeGeneratorExpertMode' => 0, 'hideLanguageSettings' => 0, 'session_cookie_domain' => '', 'session_save_path' => '', 'useDatepicker' => 0, 'requireHTTPS' => 0, 'httpProxyServer' => '', 'allowRelatedRecordsDragSorting' => 0, 'outgoingMail' => 'sendOnly', 'languageDeveloperMode' => 0, 'login_expiry_limit' => '30', 'login_expiry_unit' => 'minutes', 'restrictByIP' => 0, 'restrictByIP_allowed' => '', 'smtp_method' => 'php', 'smtp_hostname' => '', 'smtp_port' => '', 'smtp_username' => '', 'smtp_password' => '', 'phpHideErrors' => '0', 'phpEmailErrors' => '0', 'checkReferer' => '1', 'disableAutocomplete' => '0'); foreach ($defaults as $key => $value) { if (!array_key_exists($key, $SETTINGS)) { $SETTINGS[$key] = $value; } } foreach ($wysiwygDefaults as $key => $value) { if (!array_key_exists($key, $SETTINGS['wysiwyg'])) { $SETTINGS['wysiwyg'][$key] = $value; } } foreach ($advancedDefaults as $key => $value) { if (!array_key_exists($key, $SETTINGS['advanced'])) { $SETTINGS['advanced'][$key] = $value; } } ### custom defaults // adminUrl - update if url path has changed if (defined('IS_CMS_ADMIN')) { $hasAdminPathChanged = parse_url(thisPageUrl(), PHP_URL_PATH) != parse_url(@$SETTINGS['adminUrl'], PHP_URL_PATH); if ($hasAdminPathChanged) { // only update adminUrl when in the CMS admin $SETTINGS['adminUrl'] = @array_shift(explode('?', thisPageUrl())); // added in 2.12 - this must be set when admin.php is being access directly so we get the right URL saveSettings(); alert(sprintf(t("Updating Program Url to: %s") . "<br/>\n", $SETTINGS['adminUrl'])); } } // set default uploadDir and uploadUrl (do this here as above defaults code only runs when keys are undefined, not when they are blank) if (!$SETTINGS['uploadDir']) { $SETTINGS['uploadDir'] = 'uploads/'; // previously: /../uploads/ } if (!$SETTINGS['uploadUrl'] && !inCLI()) { // SCRIPT_NAME is set to filepath not web path when running in CLI, giving us incorrect values $SETTINGS['uploadUrl'] = dirname($_SERVER['SCRIPT_NAME']) . "/uploads/"; // previously: /../uploads/ $SETTINGS['uploadUrl'] = realUrl($SETTINGS['uploadUrl']); // remove ../ parent reference $SETTINGS['uploadUrl'] = parse_url($SETTINGS['uploadUrl'], PHP_URL_PATH); // remove scheme://hostname and leave /url/path } // remove old settings $removeKeys = array('vendorPoweredBy', 'timezoneOffsetAddMinus', 'timezoneOffsetHours', 'timezoneOffsetMinutes'); $removeCount = 0; foreach ($removeKeys as $key) { if (array_key_exists($key, $SETTINGS)) { unset($SETTINGS[$key]); $removeCount++; } } if ($removeCount) { saveSettings(); } // remove/convert old 'isInstalled' setting (from v2.09) if (array_key_exists('isInstalled', $SETTINGS)) { isInstalled(true); // set new installed status (semaphore file) unset($SETTINGS['isInstalled']); saveSettings(); } // Update PHP config with SMTP values from settings (only effects users who call mail() explicitly) if ($GLOBALS['SETTINGS']['advanced']['smtp_hostname']) { ini_set('SMTP', $GLOBALS['SETTINGS']['advanced']['smtp_hostname']); } if ($GLOBALS['SETTINGS']['advanced']['smtp_port']) { ini_set('smtp_port', $GLOBALS['SETTINGS']['advanced']['smtp_port']); } // Note: We don't need to return $SETTINGS because we're modifying the global. }
$route = ''; } parent::connect('/:locale', $default, array_merge(array('locale' => '[a-z]{3}'), $params)); } function plugins() { $pluginRoutes = Configure::read("Hook.routes"); if (!$pluginRoutes) { return; } $plugins = explode(',', $pluginRoutes); foreach ($plugins as $plugin) { if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'config' . DS . 'routes.php')) { require_once APP . 'plugins' . DS . $plugin . DS . 'config' . DS . 'routes.php'; } } } } SuperRouter::plugins(); if (!isInstalled()) { SuperRouter::connect('/', array('plugin' => 'install', 'controller' => 'wizard')); } // Basic SuperRouter::connect('/admin', array('admin' => true, 'controller' => 'dashboard')); // Pages SuperRouter::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); SuperRouter::connect('/pages/:slug', array('controller' => 'pages', 'action' => 'display')); // Users SuperRouter::connect('/register', array('controller' => 'users', 'action' => 'register')); SuperRouter::connect('/login', array('controller' => 'users', 'action' => 'login')); SuperRouter::connect('/recover', array('controller' => 'users', 'action' => 'recover'));
<p><a href="http://www.rezervi.com" target="_parent">http://www.rezervi.com</a></p> </body> </noframes> <?php } else { ?> <!DOCTYPE html> <html> <head> <title>Zimmerreservierungsplan Belegungsplan und Gästedatenbank Rezervi</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php //pruefen ob installation schon durchgeführt wurde: if (isInstalled($unterkunft_id)) { echo getUebersetzung("Es wurden noch keine Mietobjekte (z. B. Zimmer) eingegeben. Bitte rufen sie das Webinterface auf und geben sie ihre Mietobjekte ein.", $sprache, $link); ?> <a href="webinterface/index.php">--> Webinterface</a> <?php } else { ?> Please install Rezervi first! <br/> Bitte insallieren sie Rezervi zuerst! <br/> <a href="install/index.php">--> Install</a> <?php } ?> </body> <?php }