Example #1
1
 public function upgrade()
 {
     if (php_sapi_name() == "cli") {
         // @todo this may screw up some module installers, but we don't have a better answer at
         // this time.
         $_SERVER["HTTP_HOST"] = "example.com";
     } else {
         if (!user::active()->admin && !Session::instance()->get("can_upgrade", false)) {
             access::forbidden();
         }
     }
     // Upgrade gallery and user first
     module::install("gallery");
     module::install("user");
     // Then upgrade the rest
     foreach (module::available() as $id => $module) {
         if ($id == "gallery") {
             continue;
         }
         if ($module->active && $module->code_version != $module->version) {
             module::install($id);
         }
     }
     if (php_sapi_name() == "cli") {
         print "Upgrade complete\n";
     } else {
         url::redirect("upgrader?done=1");
     }
 }
Example #2
0
 public function save()
 {
     access::verify_csrf();
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         $desired = $this->input->post($module_name) == 1;
         if ($info->active && !$desired && module::is_active($module_name)) {
             $changes->deactivate[] = $module_name;
             $deactivated_names[] = $info->name;
             module::deactivate($module_name);
         } else {
             if (!$info->active && $desired && !module::is_active($module_name)) {
                 $changes->activate[] = $module_name;
                 $activated_names[] = $info->name;
                 module::install($module_name);
                 module::activate($module_name);
             }
         }
     }
     module::event("module_change", $changes);
     // @todo this type of collation is questionable from a i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
     url::redirect("admin/modules");
 }
Example #3
0
 public function change()
 {
     access::verify_csrf();
     $active_provider = module::get_var("gallery", "identity_provider", "user");
     $providers = identity::providers();
     $new_provider = Input::instance()->post("provider");
     if ($new_provider != $active_provider) {
         module::deactivate($active_provider);
         // Switch authentication
         identity::reset();
         module::set_var("gallery", "identity_provider", $new_provider);
         module::install($new_provider);
         module::activate($new_provider);
         module::event("identity_provider_changed", $active_provider, $new_provider);
         module::uninstall($active_provider);
         message::success(t("Changed to %description", array("description" => $providers->{$new_provider})));
         try {
             Session::instance()->destroy();
         } catch (Exception $e) {
             // We don't care if there was a problem destroying the session.
         }
         url::redirect(item::root()->abs_url());
     }
     message::info(t("The selected provider \"%description\" is already active.", array("description" => $providers->{$new_provider})));
     url::redirect("admin/identity");
 }
Example #4
0
 private function _reset()
 {
     $db = Database::instance();
     // Drop all tables
     foreach ($db->list_tables() as $table) {
         $db->query("DROP TABLE IF EXISTS `{$table}`");
     }
     // Clean out data
     dir::unlink(VARPATH . "uploads");
     dir::unlink(VARPATH . "albums");
     dir::unlink(VARPATH . "resizes");
     dir::unlink(VARPATH . "thumbs");
     dir::unlink(VARPATH . "modules");
     dir::unlink(VARPATH . "tmp");
     $db->clear_cache();
     module::$modules = array();
     module::$active = array();
     // Use a known random seed so that subsequent packaging runs will reuse the same random
     // numbers, keeping our install.sql file more stable.
     srand(0);
     gallery_installer::install(true);
     module::load_modules();
     foreach (array("user", "comment", "organize", "info", "rss", "search", "slideshow", "tag") as $module_name) {
         module::install($module_name);
         module::activate($module_name);
     }
 }
 static function upgrade()
 {
     if (module::get_version("register") < 1) {
         module::install("register");
     }
     if (is_null(module::get_var("registration", "admin_notify")) || is_null(module::get_var("registration", "subject_prefix")) || module::get_version("register") < 2) {
         module::set_var("registration", "admin_notify", false);
         module::set_var("registration", "subject_prefix", "");
         $db = Database::instance();
         $db->query("ALTER TABLE {pending_users} ADD `locale` varchar(32) default NULL;");
     }
     module::set_version("register", 2);
 }
    public function install()
    {
        if (!parent::install() or !$this->registerHook('actionProductAdd') or !$this->registerHook('actionProductDelete') or !$this->registerHook('actionProductSave') or !$this->registerHook('actionProductUpdate') or !$this->registerHook('displayRightColumnProduct') or !$this->registerHook('displayFooter') or !$this->registerHook('displayBackOfficeHeader')) {
            return false;
        }
        if (!Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'supramulticurrency_product` (  
												`id_product` int(11) unsigned NOT NULL,  
												`id_currency` int(11) NOT NULL,  
												`product_price` decimal(10,2) NOT NULL,  
												`product_sale_price` decimal(10,2) NOT NULL,  
												`product_detail_prices` TEXT NULL,  
												PRIMARY KEY (`id_product`)) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8')) {
            return false;
        }
        return true;
        return true;
    }
Example #7
0
 public function save()
 {
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         $desired = $this->input->post($module_name) == 1;
         if ($info->installed && !$desired) {
             module::uninstall($module_name);
             message::success(t("Uninstalled %module_name module", array("module_name" => $info->name)));
         } else {
             if (!$info->installed && $desired) {
                 module::install($module_name);
                 message::success(t("Installed %module_name module", array("module_name" => $info->name)));
             }
         }
     }
     url::redirect("admin/modules");
 }
Example #8
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/calendar")) {
         mkdir(ROOT . "./cms/calendar", 0777);
     }
     parent::install();
 }
Example #9
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     parent::install();
 }
Example #10
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     if (!Is_Dir(ROOT . "./settings")) {
         mkdir(ROOT . "./settings", 0777);
     }
     parent::install($parent_name);
 }
Example #11
0
 function Index()
 {
     if (!TEST_MODE) {
         print Kohana::show_404();
     }
     // Jump through some hoops to satisfy the way that we check for the site_domain in
     // config.php.  We structure this such that the code in config will leave us with a
     // site_domain of "." (for historical reasons)
     // @todo: for tests, we should force the site_domain to something like example.com
     $_SERVER["SCRIPT_FILENAME"] = "index.php";
     $_SERVER["SCRIPT_NAME"] = "./index.php";
     $original_config = DOCROOT . "var/database.php";
     $test_config = VARPATH . "database.php";
     if (!file_exists($original_config)) {
         print "Please copy kohana/config/database.php to {$original_config}.\n";
         return;
     } else {
         copy($original_config, $test_config);
         $db_config = Kohana::config('database');
         if (empty($db_config['unit_test'])) {
             $default = $db_config['default'];
             $conn = $default['connection'];
             Kohana::config_set('database.unit_test.benchmark', $default['benchmark']);
             Kohana::config_set('database.unit_test.persistent', $default['persistent']);
             Kohana::config_set('database.unit_test.connection.type', $conn['type']);
             Kohana::config_set('database.unit_test.connection.user', $conn['user']);
             Kohana::config_set('database.unit_test.connection.pass', $conn['pass']);
             Kohana::config_set('database.unit_test.connection.host', $conn['host']);
             Kohana::config_set('database.unit_test.connection.port', $conn['port']);
             Kohana::config_set('database.unit_test.connection.socket', $conn['socket']);
             Kohana::config_set('database.unit_test.connection.database', "{$conn['database']}_test");
             Kohana::config_set('database.unit_test.character_set', $default['character_set']);
             Kohana::config_set('database.unit_test.table_prefix', $default['table_prefix']);
             Kohana::config_set('database.unit_test.object', $default['object']);
             Kohana::config_set('database.unit_test.cache', $default['cache']);
             Kohana::config_set('database.unit_test.escape', $default['escape']);
             $db_config = Kohana::config('database');
         }
         if ($db_config['default']['connection']['database'] == $db_config['unit_test']['connection']['database']) {
             print "Don't use the default database for your unit tests or you'll lose all your data.\n";
             return;
         }
         try {
             $db = Database::instance('unit_test');
             $db->connect();
             // Make this the default database for the rest of this run
             Database::$instances = array('default' => $db);
         } catch (Exception $e) {
             print "{$e->getMessage()}\n";
             return;
         }
     }
     try {
         // Find all tests, excluding sample tests that come with the unit_test module.
         foreach (glob(MODPATH . "*/tests") as $path) {
             if ($path != MODPATH . "unit_test/tests") {
                 $paths[] = $path;
             }
         }
         Kohana::config_set('unit_test.paths', $paths);
         // Clean out the database
         if ($tables = $db->list_tables()) {
             foreach ($db->list_tables() as $table) {
                 $db->query("DROP TABLE {$table}");
             }
         }
         // Clean out the filesystem
         @system("rm -rf test/var");
         @mkdir('test/var/logs', 0777, true);
         // Reset our caches
         module::$modules = array();
         module::$active = array();
         module::$var_cache = array();
         $db->clear_cache();
         // Rest the cascading class path
         Kohana::config_set("core", Kohana::config_load("core"));
         // Install all modules
         // Force gallery and user to be installed first to resolve dependencies.
         gallery_installer::install(true);
         module::load_modules();
         module::install("user");
         module::activate("user");
         $modules = array();
         foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) {
             $module_name = basename(dirname(dirname($file)));
             if (in_array($module_name, array("gallery", "user"))) {
                 continue;
             }
             module::install($module_name);
             module::activate($module_name);
         }
         // Trigger late-binding install actions (defined in gallery_event::user_login)
         graphics::choose_default_toolkit();
         $filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null;
         print new Unit_Test($modules, $filter);
     } catch (Exception $e) {
         print "Exception: {$e->getMessage()}\n";
         print $e->getTraceAsString() . "\n";
     }
 }
Example #12
0
 function index()
 {
     if (!TEST_MODE) {
         throw new Kohana_404_Exception();
     }
     // Force strict behavior to flush out bugs early
     ini_set("display_errors", true);
     error_reporting(-1);
     // Jump through some hoops to satisfy the way that we check for the site_domain in
     // config.php.  We structure this such that the code in config will leave us with a
     // site_domain of "." (for historical reasons)
     // @todo: for tests, we should force the site_domain to something like example.com
     $_SERVER["SCRIPT_FILENAME"] = "index.php";
     $_SERVER["SCRIPT_NAME"] = "./index.php";
     $config = Kohana_Config::instance();
     $original_config = DOCROOT . "var/database.php";
     $test_config = VARPATH . "database.php";
     if (!file_exists($original_config)) {
         print "Please copy kohana/config/database.php to {$original_config}.\n";
         return;
     } else {
         copy($original_config, $test_config);
         $db_config = Kohana::config('database');
         if (empty($db_config['unit_test'])) {
             $default = $db_config['default'];
             $conn = $default['connection'];
             $config->set('database.unit_test.benchmark', $default['benchmark']);
             $config->set('database.unit_test.persistent', $default['persistent']);
             $config->set('database.unit_test.connection.type', $conn['type']);
             $config->set('database.unit_test.connection.user', $conn['user']);
             $config->set('database.unit_test.connection.pass', $conn['pass']);
             $config->set('database.unit_test.connection.host', $conn['host']);
             $config->set('database.unit_test.connection.port', $conn['port']);
             $config->set('database.unit_test.connection.socket', $conn['socket']);
             $config->set('database.unit_test.connection.database', "{$conn['database']}_test");
             $config->set('database.unit_test.character_set', $default['character_set']);
             $config->set('database.unit_test.table_prefix', $default['table_prefix']);
             $config->set('database.unit_test.object', $default['object']);
             $config->set('database.unit_test.cache', $default['cache']);
             $config->set('database.unit_test.escape', $default['escape']);
             $db_config = Kohana::config('database');
         }
         if ($db_config['default']['connection']['database'] == $db_config['unit_test']['connection']['database']) {
             print "Don't use the default database for your unit tests or you'll lose all your data.\n";
             return;
         }
         try {
             $db = Database::instance('unit_test');
             $db->connect();
             // Make this the default database for the rest of this run
             Database::set_default_instance($db);
         } catch (Exception $e) {
             print "{$e->getMessage()}\n";
             return;
         }
     }
     try {
         // Clean out the database
         if ($tables = $db->list_tables()) {
             foreach ($db->list_tables() as $table) {
                 $db->query("DROP TABLE {{$table}}");
             }
         }
         // Clean out the filesystem.  Note that this cleans out test/var/database.php, but that's ok
         // because we technically don't need it anymore.  If this is confusing, we could always
         // arrange to preserve that one file.
         @system("rm -rf test/var");
         @mkdir('test/var/logs', 0777, true);
         $active_modules = module::$active;
         // Reset our caches
         module::$modules = array();
         module::$active = array();
         module::$var_cache = array();
         $db->clear_cache();
         // Rest the cascading class path
         $config->set("core", $config->load("core"));
         // Install the active modules
         // Force gallery and user to be installed first to resolve dependencies.
         gallery_installer::install(true);
         module::load_modules();
         module::install("user");
         module::activate("user");
         $modules = $paths = array();
         foreach (module::available() as $module_name => $unused) {
             if (in_array($module_name, array("gallery", "user"))) {
                 $paths[] = MODPATH . "{$module_name}/tests";
                 continue;
             }
             if (file_exists($path = MODPATH . "{$module_name}/tests")) {
                 $paths[] = $path;
                 module::install($module_name);
                 module::activate($module_name);
             }
         }
         $config->set('unit_test.paths', $paths);
         // Trigger late-binding install actions (defined in gallery_event::user_login)
         graphics::choose_default_toolkit();
         $filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null;
         print new Unit_Test($modules, $filter);
     } catch (ORM_Validation_Exception $e) {
         print "Validation Exception: {$e->getMessage()}\n";
         print $e->getTraceAsString() . "\n";
         foreach ($e->validation->errors() as $field => $msg) {
             print "{$field}: {$msg}\n";
         }
     } catch (Exception $e) {
         print "Exception: {$e->getMessage()}\n";
         print $e->getTraceAsString() . "\n";
     }
 }
 function install($data = '')
 {
     parent::install();
     subscribeToEvent($this->name, 'SAY');
     addClass('IRCBots');
     addClassProperty('IRCBots', 'message', 5);
     addClassProperty('IRCBots', 'pushMessage');
     //addClassProperty('IRCBots', 'alive');
     addClassProperty('IRCBots', 'updated');
     addClassProperty('IRCBots', 'updatedTime');
     addClassMethod('IRCBots', 'onNewMessage', '$this->setProperty("updated", time());' . "\n" . '$this->setProperty("updatedTime", date("H:i"));' . "\n" . '$this->setProperty("message", $params["message"]);');
     addClassObject('IRCBots', 'IRCBot1');
 }
Example #14
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./sounds")) {
         mkdir(ROOT . "./sounds", 0777);
     }
     parent::install();
 }
 function install()
 {
     //$className = 'Push';
     //$objectName = 'PushBullet';
     //$propertis = array('API_KEY1', 'Device1');
     $rec = SQLSelectOne("SELECT ID FROM classes WHERE TITLE LIKE '" . DBSafe($className) . "'");
     if (!$rec['ID']) {
         $rec = array();
         $rec['TITLE'] = $className;
         //$rec['PARENT_LIST']='0';
         $rec['DESCRIPTION'] = 'Push-notes';
         $rec['ID'] = SQLInsert('classes', $rec);
     }
     $obj_rec = SQLSelectOne("SELECT ID FROM objects WHERE CLASS_ID='" . $rec['ID'] . "' AND TITLE LIKE '" . DBSafe($objectName) . "'");
     if (!$obj_rec['ID']) {
         $obj_rec = array();
         $obj_rec['CLASS_ID'] = $rec['ID'];
         $obj_rec['TITLE'] = $objectName;
         $obj_rec['DESCRIPTION'] = 'Настройки';
         $obj_rec['ID'] = SQLInsert('objects', $obj_rec);
     }
     for ($i = 0; $i < count($propertis); $i++) {
         $prop_rec = SQLSelectOne("SELECT ID FROM properties WHERE OBJECT_ID='" . $obj_rec['ID'] . "' AND TITLE LIKE '" . DBSafe($propertis[$i]) . "'");
         if (!$prop_rec['ID']) {
             $prop_rec = array();
             $prop_rec['TITLE'] = $propertis[$i];
             $prop_rec['OBJECT_ID'] = $obj_rec['ID'];
             $prop_rec['ID'] = SQLInsert('properties', $prop_rec);
         }
     }
     parent::install();
 }
 static function upgrade()
 {
     if (is_null(module::get_var("tag_cloud_html5", "options_sidebar")) || is_null(module::get_var("tag_cloud_html5", "options_wholecloud")) || module::get_version("tag_cloud_html5") < 1) {
         module::install("tag_cloud_html5");
     }
     if (module::get_version("tag_cloud_html5") < 2) {
         // added wheelZoom, which is not accessible from admin menu
         $options = json_decode(module::get_var("tag_cloud_html5", "options_sidebar"), true);
         $options["wheelZoom"] = false;
         module::set_var("tag_cloud_html5", "options_sidebar", json_encode($options));
         $options = json_decode(module::get_var("tag_cloud_html5", "options_wholecloud"), true);
         $options["wheelZoom"] = false;
         module::set_var("tag_cloud_html5", "options_wholecloud", json_encode($options));
     }
     if (module::get_version("tag_cloud_html5") < 3) {
         // added deadZone, initial, and initialDecel
         module::set_var("tag_cloud_html5", "show_add_tag_form", true);
         $options = json_decode(module::get_var("tag_cloud_html5", "options_sidebar"), true);
         $options["deadZone"] = 0.25;
         $options["initial"] = array(0.8, -0.3);
         $options["initialDecel"] = true;
         module::set_var("tag_cloud_html5", "options_sidebar", json_encode($options));
         $options = json_decode(module::get_var("tag_cloud_html5", "options_wholecloud"), true);
         $options["deadZone"] = 0.25;
         $options["initial"] = array(0.8, -0.3);
         $options["initialDecel"] = true;
         module::set_var("tag_cloud_html5", "options_wholecloud", json_encode($options));
     }
     if (module::get_version("tag_cloud_html5") < 4) {
         // added height_sidebar, then scaled back zoom and textHeight for consistency
         module::set_var("tag_cloud_html5", "height_sidebar", 0.8);
         $options = json_decode(module::get_var("tag_cloud_html5", "options_sidebar"), true);
         $options["zoom"] = $options["zoom"] / 0.8;
         $options["textHeight"] = $options["textHeight"] * 0.8;
         module::set_var("tag_cloud_html5", "options_sidebar", json_encode($options));
     }
     if (module::get_version("tag_cloud_html5") < 5) {
         // added lots of options that are on admin menu
         // added physModel, lock, and initialDecel as options not on admin menu
         // (previously initialDecel was on menu, so reset here)
         module::set_var("tag_cloud_html5", "width_sidebar", 1.0);
         module::set_var("tag_cloud_html5", "width_wholecloud", 0.95);
         module::set_var("tag_cloud_html5", "height_wholecloud", 0.75);
         $options = json_decode(module::get_var("tag_cloud_html5", "options_sidebar"), true);
         $options["deadZone"] = $options["deadZone"];
         $options["shape"] = "sphere";
         $options["lock"] = "";
         $options["stretchX"] = 1.0;
         $options["stretchY"] = 1.0;
         $options["decel"] = 0.92;
         $options["physModel"] = true;
         $options["maxInputZone"] = 0.25;
         $options["minSpeed"] = 0.002;
         $options["initialDecel"] = true;
         module::set_var("tag_cloud_html5", "options_sidebar", json_encode($options));
         $options = json_decode(module::get_var("tag_cloud_html5", "options_wholecloud"), true);
         $options["deadZone"] = $options["deadZone"];
         $options["shape"] = "sphere";
         $options["lock"] = "";
         $options["stretchX"] = 1.0;
         $options["stretchY"] = 1.0;
         $options["decel"] = 0.92;
         $options["physModel"] = true;
         $options["maxInputZone"] = 0.15;
         $options["minSpeed"] = 0.002;
         $options["initialDecel"] = true;
         module::set_var("tag_cloud_html5", "options_wholecloud", json_encode($options));
     }
     // note: there are no variable changes for v6 and v7 upgrades
     module::set_version("tag_cloud_html5", 7);
 }
Example #17
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     parent::install();
     SQLExec("UPDATE project_modules SET HIDDEN=1 WHERE NAME LIKE 'blockly_code'");
 }
Example #18
0
 function Index()
 {
     if (!TEST_MODE) {
         print Kohana::show_404();
     }
     $original_config = DOCROOT . "var/database.php";
     $test_config = VARPATH . "database.php";
     if (!file_exists($original_config)) {
         print "Please copy kohana/config/database.php to {$original_config}.\n";
         return;
     } else {
         copy($original_config, $test_config);
         $db_config = Kohana::config('database');
         if (empty($db_config['unit_test'])) {
             $default = $db_config['default'];
             $conn = $default['connection'];
             Kohana::config_set('database.unit_test.benchmark', $default['benchmark']);
             Kohana::config_set('database.unit_test.persistent', $default['persistent']);
             Kohana::config_set('database.unit_test.connection.type', $conn['type']);
             Kohana::config_set('database.unit_test.connection.user', $conn['user']);
             Kohana::config_set('database.unit_test.connection.pass', $conn['pass']);
             Kohana::config_set('database.unit_test.connection.host', $conn['host']);
             Kohana::config_set('database.unit_test.connection.port', $conn['port']);
             Kohana::config_set('database.unit_test.connection.socket', $conn['socket']);
             Kohana::config_set('database.unit_test.connection.database', "{$conn['database']}_test");
             Kohana::config_set('database.unit_test.character_set', $default['character_set']);
             Kohana::config_set('database.unit_test.table_prefix', $default['table_prefix']);
             Kohana::config_set('database.unit_test.object', $default['object']);
             Kohana::config_set('database.unit_test.cache', $default['cache']);
             Kohana::config_set('database.unit_test.escape', $default['escape']);
             $db_config = Kohana::config('database');
         }
         if ($db_config['default']['connection']['database'] == $db_config['unit_test']['connection']['database']) {
             print "Don't use the default database for your unit tests or you'll lose all your data.\n";
             return;
         }
         try {
             $db = Database::instance('unit_test');
             $db->connect();
             // Make this the default database for the rest of this run
             Database::$instances = array('default' => $db);
         } catch (Exception $e) {
             print "{$e->getMessage()}\n";
             return;
         }
     }
     // Find all tests, excluding sample tests that come with the unit_test module.
     foreach (glob(MODPATH . "*/tests") as $path) {
         if ($path != MODPATH . "unit_test/tests") {
             $paths[] = $path;
         }
     }
     Kohana::config_set('unit_test.paths', $paths);
     // Clean out the database
     if ($tables = $db->list_tables()) {
         foreach ($db->list_tables() as $table) {
             $db->query("DROP TABLE {$table}");
         }
     }
     // Clean out the filesystem
     @system("rm -rf test/var");
     @mkdir('test/var/logs', 0777, true);
     // Reset our caches
     module::$modules = array();
     module::$active = array();
     module::$var_cache = array();
     $db->clear_cache();
     // Install all modules
     // Force gallery and user to be installed first to resolve dependencies.
     gallery_installer::install(true);
     module::load_modules();
     module::install("user");
     module::activate("user");
     $modules = array();
     foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) {
         $module_name = basename(dirname(dirname($file)));
         if (in_array($module_name, array("gallery", "user"))) {
             continue;
         }
         module::install($module_name);
         module::activate($module_name);
     }
     $filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null;
     print new Unit_Test($modules, $filter);
 }
Example #19
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     if (!Is_Dir(ROOT . "./saverestore")) {
         mkdir(ROOT . "./saverestore", 0777);
     }
     parent::install($parent_name);
 }
 function install($parent_name = "")
 {
     parent::install($parent_name);
     $this->getModulesList();
     $lst = $this->modules;
     $code = "";
     for ($i = 0; $i < count($lst); $i++) {
         if (file_exists(DIR_MODULES . $lst[$i]['FILENAME'] . "/" . $lst[$i]['FILENAME'] . ".class.php")) {
             if ($lst[$i]['FILENAME'] == 'control_modules') {
                 continue;
             }
             @unlink(DIR_MODULES . $lst[$i]['FILENAME'] . "/installed");
             include_once DIR_MODULES . $lst[$i]['FILENAME'] . "/" . $lst[$i]['FILENAME'] . ".class.php";
             $obj = "\$object{$i}";
             $code .= "{$obj}=new " . $lst[$i]['FILENAME'] . ";\n";
         }
     }
     @eval("{$code}");
 }
Example #21
0
/**
* Install
*
* Module installation routine
*
* @access private
*/
 function install() {
  parent::install();
 }
Example #22
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     parent::install($parent_name);
 }
Example #23
0
 public function package()
 {
     $this->auto_render = false;
     $db = Database::instance();
     // Drop all tables
     foreach ($db->list_tables() as $table) {
         $db->query("DROP TABLE IF EXISTS `{$table}`");
     }
     // Clean out data
     dir::unlink(VARPATH . "uploads");
     dir::unlink(VARPATH . "albums");
     dir::unlink(VARPATH . "resizes");
     dir::unlink(VARPATH . "thumbs");
     dir::unlink(VARPATH . "modules");
     dir::unlink(VARPATH . "tmp");
     $db->clear_cache();
     module::$modules = array();
     module::$active = array();
     // Use a known random seed so that subsequent packaging runs will reuse the same random
     // numbers, keeping our install.sql file more stable.
     srand(0);
     try {
         gallery_installer::install(true);
         module::load_modules();
         foreach (array("user", "comment", "organize", "info", "rss", "search", "slideshow", "tag") as $module_name) {
             module::install($module_name);
             module::activate($module_name);
         }
     } catch (Exception $e) {
         Kohana::log("error", $e->getTraceAsString());
         print $e->getTrace();
         throw $e;
     }
     url::redirect("scaffold/dump_database");
 }
Example #24
0
    }
    echo 'Your PHP installation does not support MySQLi, or pgSQL.';
    $failed = true;
}
if ($failed) {
    echo "<br /><br /><strong>To run Sandbox and other advanced PHP software, the above error(s) must be fixed by you or your web host.</strong>";
    exit;
}
if ($mysqli) {
    $mysqli_client = '<li>MySQLi Client: (' . mysqli_get_client_info() . ')</li><hr />';
} else {
    $mysqli_client = '';
}
if ($pgsql) {
    $pgsql_client = '<li>pgSQL Client: Available</li><hr />';
} else {
    $pgsql_client = '';
}
echo "<!DOCTYPE html>\n<html lang=\"en-US\">\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <title>Sandbox Installer</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"../skins/Default/styles.css\" />\n</head>\n\n<body>\n <div id='container'>\n  <div id='header'>\n   <div id='company'>\n    <div class='logo'></div>\n    <div class='title'><h1>Sandbox Installer {$sandbox->version}</h1></div>\n   </div>\n  </div>\n\n  <div id='blocks'>\n   <div class='block'>\n    <ul>\n     <li>PHP Version: {$php_version}</li><hr />\n     <li>Operating System: {$os}</li><hr />\n     <li>Safe mode: {$safe_mode}</li><hr />\n     <li>Register globals: {$register_globals}</li><hr />\n     <li>Server Software: {$server}</li><hr />\n     {$mysqli_client}\n     {$pgsql_client}\n    </ul>\n   </div>\n  </div>\n\n  <div id='main'>";
switch ($mode) {
    default:
        include "choose_install.php";
        break;
    case 'new_install':
        $sandbox->install($step, $mysqli, $pgsql);
        break;
    case 'upgrade':
        $sandbox->upgrade_site($step);
        break;
}
echo "   <div id='bottom'>&nbsp;</div>\n  </div>\n  <div id='footer'>\n   <a href='http://www.iguanadons.net/'>Sandbox</a> {$sandbox->version} &copy; 2006-2015 Sam O'Connor [<a href='http://www.kiasyn.com'>Kiasyn</a>] and Roger Libiez [<a href='http://www.iguanadons.net'>Samson</a>]\n  </div>\n </body>\n</html>";
 function install($parent_name = "")
 {
     parent::install($parent_name);
     $this->getModulesList();
     $lst = $this->modules;
     $lstCnt = count($lst);
     $code = "";
     for ($i = 0; $i < $lstCnt; $i++) {
         if (file_exists(DIR_MODULES . $lst[$i]['FILENAME'] . "/" . $lst[$i]['FILENAME'] . ".class.php")) {
             if ($lst[$i]['FILENAME'] == 'control_modules') {
                 continue;
             }
             $installedFile = DIR_MODULES . $lst[$i]['FILENAME'] . "/installed";
             if (file_exists($installedFile)) {
                 unlink($installedFile);
             }
             include_once DIR_MODULES . $lst[$i]['FILENAME'] . "/" . $lst[$i]['FILENAME'] . ".class.php";
             $obj = "\$object{$i}";
             $code .= "{$obj}=new " . $lst[$i]['FILENAME'] . ";\n";
         }
     }
     @eval("{$code}");
     SQLExec("UPDATE project_modules SET HIDDEN=0 WHERE NAME LIKE '" . $this->name . "'");
 }
Example #26
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/scenes")) {
         mkdir(ROOT . "./cms/scenes", 0777);
     }
     if (!Is_Dir(ROOT . "./cms/scenes/elements")) {
         mkdir(ROOT . "./cms/scenes/elements", 0777);
     }
     if (!Is_Dir(ROOT . "./cms/scenes/backgrounds")) {
         mkdir(ROOT . "./cms/scenes/backgrounds", 0777);
     }
     parent::install();
 }
Example #27
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($parent_name = "")
 {
     parent::install($parent_name);
     SQLExec("UPDATE project_modules SET HIDDEN=1 WHERE NAME LIKE '" . $this->name . "'");
 }
Example #28
0
 private function _do_save()
 {
     $changes = new stdClass();
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         try {
             $desired = Input::instance()->post($module_name) == 1;
             if ($info->active && !$desired && module::is_active($module_name)) {
                 module::deactivate($module_name);
                 $changes->deactivate[] = $module_name;
                 $deactivated_names[] = t($info->name);
             } else {
                 if (!$info->active && $desired && !module::is_active($module_name)) {
                     if (module::is_installed($module_name)) {
                         module::upgrade($module_name);
                     } else {
                         module::install($module_name);
                     }
                     module::activate($module_name);
                     $changes->activate[] = $module_name;
                     $activated_names[] = t($info->name);
                 }
             }
         } catch (Exception $e) {
             message::warning(t("An error occurred while installing the <b>%module_name</b> module", array("module_name" => $info->name)));
             Kohana_Log::add("error", (string) $e);
         }
     }
     module::event("module_change", $changes);
     // @todo this type of collation is questionable from an i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
 }
Example #29
0
 /**
 * Install
 *
 * Module installation routine
 *
 * @access private
 */
 function install($data = '')
 {
     @umask(0);
     if (!Is_Dir(ROOT . "./cms/products/")) {
         mkdir(ROOT . "./cms/products/", 0777);
     }
     parent::install();
 }
/**
* Install
*
* Module installation routine
*
* @access private
*/
 function install() {
  if (!Is_Dir(ROOT."./saverestore")) {
   mkdir(ROOT."./saverestore", 0777);
  }
  parent::install();
 }