/**
  * Cheking if file exists in module
  * @param string $module module name
  * @param string $filePath file within module
  * @return boolean 
  */
 function moduleFileExists($module, $filePath)
 {
     if (!moduleExists($module)) {
         return false;
     }
     return file_exists(getModulePath($module), ltrim($filePath, '/'));
 }
Beispiel #2
0
 public function loadModule($module)
 {
     if (moduleExists($module)) {
         require MODULE_DIR . $module . '/' . $module . '.php';
         $this->module = new $module();
         if ($this->module->hasOwnMenu()) {
             $this->assign('items', $this->module->getData());
         }
     } else {
         require MODULE_DIR . 'Error/Error.php';
         $this->module = new Error();
         $this->module->loadData($module);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $container = new ContainerBuilder();
     // Register plugin managers used by Rules, but mock some unwanted
     // dependencies requiring more stuff to loaded.
     $this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
     // Set all the modules as being existent.
     $this->enabledModules = new \ArrayObject();
     $this->enabledModules['rules'] = TRUE;
     $this->enabledModules['rules_test'] = TRUE;
     $enabledModules = $this->enabledModules;
     $this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabledModules) {
         return [$arguments[0], $enabledModules[$arguments[0]]];
     });
     // Wed don't care about alter() calls on the module handler.
     $this->moduleHandler->alter(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn(NULL);
     $this->cacheBackend = new NullBackend('rules');
     $rules_directory = __DIR__ . '/../../..';
     $this->namespaces = new \ArrayObject(['Drupal\\rules' => $rules_directory . '/src', 'Drupal\\rules_test' => $rules_directory . '/tests/modules/rules_test/src', 'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData', 'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation']);
     $this->actionManager = new RulesActionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
     $this->conditionManager = new ConditionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
     $this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal());
     $this->classResolver = $this->prophesize(ClassResolverInterface::class);
     $this->typedDataManager = new TypedDataManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->classResolver->reveal());
     $this->rulesDataProcessorManager = new DataProcessorManager($this->namespaces, $this->moduleHandler->reveal());
     $this->aliasManager = $this->prophesize(AliasManagerInterface::class);
     $this->entityManager = $this->prophesize(EntityManagerInterface::class);
     $this->entityManager->getDefinitions()->willReturn([]);
     $container->set('entity.manager', $this->entityManager->reveal());
     $container->set('path.alias_manager', $this->aliasManager->reveal());
     $container->set('plugin.manager.rules_action', $this->actionManager);
     $container->set('plugin.manager.condition', $this->conditionManager);
     $container->set('plugin.manager.rules_expression', $this->rulesExpressionManager);
     $container->set('plugin.manager.rules_data_processor', $this->rulesDataProcessorManager);
     $container->set('typed_data_manager', $this->typedDataManager);
     $container->set('string_translation', $this->getStringTranslationStub());
     \Drupal::setContainer($container);
     $this->container = $container;
 }
Beispiel #4
0
			<p class="mono important">*&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;
			cd <?php 
echo $currentpath;
?>
; php -f cron.php > /dev/null 2>&amp;1 </p>
		</fieldset>
		<fieldset>
			<legend>Scheduled Job</legend>

			<p><?php 
$theform->showField("name");
?>
</p>

			<?php 
if (moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)) {
    ?>
				<p><?php 
    $theform->showField("scripttype");
    ?>
</p>
				<p id="pushrecordidp">
						<?php 
    $theform->showField("pushrecordid");
    ?>
				</p>
			<?php 
}
//end if
?>
	
 private function make_install()
 {
     $this->load->helper('file');
     $this->load->helper('url');
     $db_server = $this->input->post('db_host');
     $db_user = $this->input->post('db_user');
     $db_pass = $this->input->post('db_pass');
     $db_name = $this->input->post('db_name');
     $link = mysql_connect($db_server, $db_user, $db_pass);
     $db_sel = mysql_select_db($db_name);
     // Drop all tables in DB
     $tables = array();
     $sql = "SHOW TABLES FROM {$db_name}";
     if ($result = mysql_query($sql, $link)) {
         while ($row = mysql_fetch_row($result)) {
             $tables[] = $row[0];
         }
     }
     if (count($tables) > 0) {
         foreach ($tables as $t) {
             $sql = "DROP TABLE {$db_name}.{$t}";
             if (!mysql_query($sql, $link)) {
                 die("MySQL error. Can\\'t delete {$db_name}.{$t}");
             }
         }
     }
     mysql_query('SET NAMES `utf8`;', $link);
     $sqlFileData = read_file(dirname(__FILE__) . '/' . $this->useSqlFile);
     $queries = explode(";\n", $sqlFileData);
     foreach ($queries as $q) {
         $q = trim($q);
         if ($q != '') {
             mysql_query($q . ';', $link);
         }
     }
     // Update site title
     mysql_query('UPDATE `settings_i18n` SET `name`=\'' . mysql_real_escape_string($this->input->post('site_title')) . '\' ', $link);
     mysql_query('UPDATE `settings_i18n` SET `short_name`=\'' . mysql_real_escape_string($this->input->post('site_title')) . '\' ', $link);
     mysql_query('UPDATE `settings` SET `lang_sel`=\'' . mysql_real_escape_string($this->input->post('lang_sel')) . '\' ', $link);
     // TRUNCATE if user want (product_samples not chacked)
     if ($this->input->post('product_samples') != "on") {
         mysql_query('TRUNCATE `category`;', $link);
         mysql_query('INSERT INTO `category` (`id`, `name`, `url`, `per_page`, `order_by`) VALUES (\'1\', \'test\', \'test\', \'1\', \'publish_date\');', $link);
         mysql_query('UPDATE `settings` SET `main_type`=\'category\', `main_page_cat`=\'1\';', $link);
         mysql_query('TRUNCATE `comments`;', $link);
         mysql_query('TRUNCATE `content`;', $link);
         mysql_query('TRUNCATE `content_fields`;', $link);
         mysql_query('TRUNCATE `content_fields_data`;', $link);
         mysql_query('TRUNCATE `content_fields_groups_relations`;', $link);
         mysql_query('TRUNCATE `content_field_groups`;', $link);
         mysql_query('TRUNCATE `gallery_albums`;', $link);
         mysql_query('TRUNCATE `gallery_category`;', $link);
         mysql_query('TRUNCATE `gallery_images`;', $link);
         mysql_query('TRUNCATE `menus`;', $link);
         mysql_query('TRUNCATE `menus_data`;', $link);
         mysql_query('TRUNCATE `support_comments`;', $link);
         mysql_query('TRUNCATE `support_departments`;', $link);
         mysql_query('TRUNCATE `support_tickets`;', $link);
         mysql_query('TRUNCATE `tags`;', $link);
         mysql_query('TRUNCATE `content_permissions`;', $link);
         mysql_query('TRUNCATE `content_tags`;', $link);
         mysql_query('TRUNCATE `logs`;', $link);
         $this->load->helper("file");
         if (moduleExists('shop')) {
             delete_files('./uploads/shop', TRUE);
             mysql_query('UPDATE `settings` SET `main_type`=\'module\', `main_page_module`=\'shop\';', $link);
             mysql_query('TRUNCATE `shop_category`;', $link);
             mysql_query('TRUNCATE `shop_category_i18n`;', $link);
             mysql_query('TRUNCATE `shop_comulativ_discount`;', $link);
             mysql_query('TRUNCATE `shop_discounts`;', $link);
             mysql_query('TRUNCATE `shop_gifts`;', $link);
             mysql_query('TRUNCATE `shop_kit`;', $link);
             mysql_query('TRUNCATE `shop_kit_product`;', $link);
             mysql_query('TRUNCATE `shop_notifications`;', $link);
             mysql_query('TRUNCATE `shop_notification_statuses`;', $link);
             mysql_query('TRUNCATE `shop_notification_statuses_i18n`;', $link);
             mysql_query('TRUNCATE `shop_orders`;', $link);
             mysql_query('TRUNCATE `shop_orders_products`;', $link);
             mysql_query('TRUNCATE `shop_orders_status_history`;', $link);
             mysql_query('TRUNCATE `shop_products`;', $link);
             mysql_query('TRUNCATE `shop_products_i18n`;', $link);
             mysql_query('TRUNCATE `shop_product_categories`;', $link);
             mysql_query('TRUNCATE `shop_product_images`;', $link);
             mysql_query('TRUNCATE `shop_product_properties`;', $link);
             mysql_query('TRUNCATE `shop_product_properties`;', $link);
             mysql_query('TRUNCATE `shop_product_properties_categories`;', $link);
             mysql_query('TRUNCATE `shop_product_properties_data`;', $link);
             mysql_query('TRUNCATE `shop_product_properties_data_i18n`;', $link);
             mysql_query('TRUNCATE `shop_product_properties_i18n`;', $link);
             mysql_query('TRUNCATE `shop_product_variants`;', $link);
             mysql_query('TRUNCATE `shop_product_variants_i18n`;', $link);
             mysql_query('TRUNCATE `shop_banners`;', $link);
             mysql_query('TRUNCATE `shop_banners_i18n`;', $link);
             mysql_query('TRUNCATE `shop_brands`;', $link);
             mysql_query('TRUNCATE `shop_brands_i18n`;', $link);
             mysql_query('TRUNCATE `shop_spy`;', $link);
             mysql_query('TRUNCATE `shop_warehouse`;', $link);
             mysql_query('TRUNCATE `shop_warehouse_data`;', $link);
         }
         delete_files('./uploads/gallery', TRUE);
         delete_files('./uploads/images', TRUE);
     }
     $this->writeDatabaseConfig(['hostname' => $this->input->post('db_host'), 'username' => $this->input->post('db_user'), 'password' => $this->input->post('db_pass'), 'database' => $this->input->post('db_name')]);
     $this->writeCmsConfig(['is_installed' => 'TRUE']);
     $this->load->database();
     // Create admin account
     $this->load->helper('cookie');
     delete_cookie('autologin');
     $this->load->library('DX_Auth');
     $admin_pass = crypt($this->dx_auth->_encode($this->input->post('admin_pass')));
     $admin_login = $this->input->post('admin_login');
     $admin_mail = $this->input->post('admin_mail');
     $admin_created = date('Y-m-d H:i:s', time());
     $sql = "INSERT INTO `users` (`id`, `role_id`, `username`, `password`, `email`, `banned`, `ban_reason`, `newpass`, `newpass_key`, `newpass_time`, `last_ip`, `last_login`, `created`, `modified`)\n                        VALUES (1, 1, 'Administrator', '{$admin_pass}', '{$admin_mail}', 0, NULL, NULL, NULL, NULL, '127.0.0.1', '0000-00-00 00:00:00', '{$admin_created}', '0000-00-00 00:00:00'); ";
     mysql_query($sql, $link);
     $this->cache->delete_all();
     $this->writeDatabaseConfig(['hostname' => $this->input->post('db_host'), 'username' => $this->input->post('db_user'), 'password' => $this->input->post('db_pass'), 'database' => $this->input->post('db_name')]);
     // login admin
     $this->dx_auth->login($this->input->post('admin_login'), $this->input->post('admin_pass'), true);
     //redirect('install/done','refresh');
     header("Location: " . $this->host . "/install/done");
 }
 /**
  * Check is module exixts
  * @param string $module_name module name
  * @return boolean
  */
 function module_exists($module_name)
 {
     return moduleExists($module_name);
 }
 /**
  * Get domain type name
  * @param string $domain - domain name
  * @return string
  */
 public function getDomainType($domain)
 {
     if (moduleExists($domain)) {
         return 'modules';
     }
     if (is_dir(self::TEMPLATES_PATH . $domain)) {
         return 'templates';
     }
     return 'main';
 }
 function getPoFileAttributes($domain)
 {
     if ($domain) {
         $CI =& get_instance();
         if (strstr($_SERVER['HTTP_REFERER'], 'admin')) {
             $langs = $CI->config->item('languages');
             $language = $CI->config->item('language');
             $locale = $language;
         } else {
             $currentLocale = MY_Controller::getCurrentLocale();
             $language = $CI->db->where('identif', $currentLocale)->get('languages');
             $language = $language->row_array();
             $locale = $language['locale'];
         }
         if ($locale) {
             $attributes = array();
             switch ($domain) {
                 case 'main':
                     $attributes = array('name' => 'main', 'type' => 'main', 'lang' => $locale);
                     break;
                 default:
                     if (moduleExists($domain)) {
                         $attributes = array('name' => $domain, 'type' => 'modules', 'lang' => $locale);
                     } elseif (file_exists('./templates/' . $domain)) {
                         $attributes = array('name' => $domain, 'type' => 'templates', 'lang' => $locale);
                     }
                     break;
             }
             return $attributes;
         }
     }
     return FALSE;
 }
Beispiel #9
0
$therecord = $thetable->processAddEditPage();
if (isset($therecord["phpbmsStatus"])) {
    $statusmessage = $therecord["phpbmsStatus"];
}
$pageTitle = ucwords($therecord["type"]);
if ($therecord["inactive"]) {
    $pageTitle = "Inactive " . $pageTitle;
}
$phpbms->cssIncludes[] = "pages/client.css";
$phpbms->jsIncludes[] = "modules/bms/javascript/client.js";
//Form Elements
//==============================================================
$theform = new phpbmsForm();
$theinput = new inputCheckbox("inactive", $therecord["inactive"]);
$theform->addField($theinput);
if (moduleExists("mod:58c60122-9d08-af17-e95b-765d74c7c422", $phpbms->modules)) {
    $name = "subscribed to mailchimp";
}
$theinput = new inputCheckbox("canemail", $therecord["canemail"], "can email");
$theform->addField($theinput);
$theinput = new inputBasicList("type", $therecord["type"], array("prospect" => "prospect", "client" => "client"), "type");
$theinput->setAttribute("class", "important");
$theinput->setAttribute("onchange", "changeClientType(this)");
$disabled = false;
if ($therecord["type"] == "client" && $therecord["id"]) {
    $disabled = $thetable->checkForInvoices($therecord["id"]);
    if ($disabled) {
        $theinput->setAttribute("disabled", "disabled");
    }
}
//endif
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $container = new ContainerBuilder();
     // Register plugin managers used by Rules, but mock some unwanted
     // dependencies requiring more stuff to loaded.
     $this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
     // Set all the modules as being existent.
     $this->enabledModules = new \ArrayObject();
     $this->enabledModules['rules'] = TRUE;
     $this->enabledModules['rules_test'] = TRUE;
     $enabled_modules = $this->enabledModules;
     $this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabled_modules) {
         return [$arguments[0], $enabled_modules[$arguments[0]]];
     });
     // Wed don't care about alter() calls on the module handler.
     $this->moduleHandler->alter(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn(NULL);
     $this->cacheBackend = new NullBackend('rules');
     $rules_directory = __DIR__ . '/../../..';
     $this->namespaces = new \ArrayObject(['Drupal\\rules' => $rules_directory . '/src', 'Drupal\\rules_test' => $rules_directory . '/tests/modules/rules_test/src', 'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData', 'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation']);
     $this->actionManager = new RulesActionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
     $this->conditionManager = new ConditionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
     $uuid_service = new Php();
     $this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal(), $uuid_service);
     $this->classResolver = $this->prophesize(ClassResolverInterface::class);
     $this->typedDataManager = new TypedDataManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->classResolver->reveal());
     $this->rulesDataProcessorManager = new DataProcessorManager($this->namespaces, $this->moduleHandler->reveal());
     $this->aliasManager = $this->prophesize(AliasManagerInterface::class);
     // Keep the deprecated entity manager around because it is still used in a
     // few places.
     $this->entityManager = $this->prophesize(EntityManagerInterface::class);
     $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
     $this->entityTypeManager->getDefinitions()->willReturn([]);
     // Setup a rules_component storage mock which returns nothing by default.
     $storage = $this->prophesize(ConfigEntityStorageInterface::class);
     $storage->loadMultiple(NULL)->willReturn([]);
     $this->entityTypeManager->getStorage('rules_component')->willReturn($storage->reveal());
     $this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
     $this->entityFieldManager->getBaseFieldDefinitions()->willReturn([]);
     $this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
     $this->entityTypeBundleInfo->getBundleInfo()->willReturn([]);
     $this->dataFetcher = new DataFetcher();
     $this->dataFilterManager = new DataFilterManager($this->namespaces, $this->moduleHandler->reveal());
     $this->placeholderResolver = new PlaceholderResolver($this->dataFetcher, $this->dataFilterManager);
     $container->set('entity.manager', $this->entityManager->reveal());
     $container->set('entity_type.manager', $this->entityTypeManager->reveal());
     $container->set('entity_field.manager', $this->entityFieldManager->reveal());
     $container->set('entity_type.bundle.info', $this->entityTypeBundleInfo->reveal());
     $container->set('context.repository', new LazyContextRepository($container, []));
     $container->set('path.alias_manager', $this->aliasManager->reveal());
     $container->set('plugin.manager.rules_action', $this->actionManager);
     $container->set('plugin.manager.condition', $this->conditionManager);
     $container->set('plugin.manager.rules_expression', $this->rulesExpressionManager);
     $container->set('plugin.manager.rules_data_processor', $this->rulesDataProcessorManager);
     $container->set('typed_data_manager', $this->typedDataManager);
     $container->set('string_translation', $this->getStringTranslationStub());
     $container->set('uuid', $uuid_service);
     $container->set('typed_data.data_fetcher', $this->dataFetcher);
     $container->set('typed_data.placeholder_resolver', $this->placeholderResolver);
     \Drupal::setContainer($container);
     $this->container = $container;
 }