예제 #1
0
<?php

/**
 * Installs comments into modules
 *
 * @package Comments
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
require cot_incfile('comments', 'plug', 'enablement');
// Add options into module configs
foreach ($com_modules_list as $mod_name) {
    if (cot_extension_installed($mod_name) && !cot_config_implanted($mod_name, 'comments')) {
        cot_config_implant($mod_name, $com_options, false, 'comments');
    }
}
// Add options into module structure configs
foreach ($com_modules_struct_list as $mod_name) {
    if (cot_extension_installed($mod_name) && !cot_config_implanted($mod_name, 'comments')) {
        cot_config_implant($mod_name, $com_options, true, 'comments');
    }
}
예제 #2
0
<?php

/**
 * Installation handler
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
// Tags integration
if (cot_extension_installed('tags')) {
    require_once cot_incfile('tags', 'plug');
    global $db_tag_references;
    // Add tag_locale column
    $db->query("ALTER TABLE {$db_tag_references} ADD COLUMN `tag_locale` VARCHAR(8) NOT NULL DEFAULT ''");
    $db->query("ALTER TABLE {$db_tag_references} DROP PRIMARY KEY");
    $db->query("ALTER TABLE {$db_tag_references} ADD PRIMARY KEY (`tag`,`tag_area`,`tag_item`, `tag_locale`)");
}
예제 #3
0
/**
 * Checks if all dependencies for selected extension are satisfied. It means
 * that either all required modules and plugins are already installed or
 * selected for installation.
 *
 * Unsatisfied requirements messages are emitted with error & messaging API.
 *
 * @param string $name Extension code
 * @param bool $is_module TRUE for modules, FALSE for plugins
 * @param array $selected_modules A list of modules currently in selection
 * @param array $selected_plugins A list of plugins currently in selection
 * @return bool TRUE if all dependencies are satisfied, or FALSE otherwise
 */
function cot_extension_dependencies_statisfied($name, $is_module = false, $selected_modules = array(), $selected_plugins = array())
{
    global $cfg, $L;
    $path = $is_module ? $cfg['modules_dir'] . "/{$name}" : $cfg['plugins_dir'] . "/{$name}";
    $ret = true;
    // Get the dependency list
    $info = cot_infoget("{$path}/{$name}.setup.php", 'COT_EXT');
    $required_modules = empty($info['Requires_modules']) ? array() : explode(',', $info['Requires_modules']);
    $required_modules = array_map('trim', $required_modules);
    $required_plugins = empty($info['Requires_plugins']) ? array() : explode(',', $info['Requires_plugins']);
    $required_plugins = array_map('trim', $required_plugins);
    // Check each dependency
    foreach ($required_modules as $req_ext) {
        if (!empty($req_ext) && !in_array($req_ext, $selected_modules) && !cot_extension_installed($req_ext)) {
            cot_error(cot_rc('ext_dependency_error', array('name' => $name, 'type' => $is_module ? $L['Module'] : $L['Plugin'], 'dep_type' => $L['Module'], 'dep_name' => $req_ext)));
            $ret = false;
        }
    }
    foreach ($required_plugins as $req_ext) {
        if (!empty($req_ext) && !in_array($req_ext, $selected_plugins) && !cot_extension_installed($req_ext)) {
            cot_error(cot_rc('ext_dependency_error', array('name' => $name, 'type' => $is_module ? $L['Module'] : $L['Plugin'], 'dep_type' => $L['Plugin'], 'dep_name' => $req_ext)));
            $ret = false;
        }
    }
    return $ret;
}
예제 #4
0
 // Universal tags
 $t->assign(array('ADMIN_EXTENSIONS_NAME' => empty($L['info_name']) ? $info['Name'] : $L['info_name'], 'ADMIN_EXTENSIONS_TYPE' => $type == 'module' ? $L['Module'] : $L['Plugin'], 'ADMIN_EXTENSIONS_CODE' => $code, 'ADMIN_EXTENSIONS_ICO' => file_exists($icofile) ? $icofile : '', 'ADMIN_EXTENSIONS_DESCRIPTION' => empty($L['info_desc']) ? $info['Description'] : $L['info_desc'], 'ADMIN_EXTENSIONS_VERSION' => $info['Version'], 'ADMIN_EXTENSIONS_VERSION_INSTALLED' => $installed_ver, 'ADMIN_EXTENSIONS_VERSION_COMPARE' => version_compare($info['Version'], $installed_ver), 'ADMIN_EXTENSIONS_DATE' => $info['Date'], 'ADMIN_EXTENSIONS_CONFIG_URL' => cot_url('admin', "m=config&n=edit&o={$type}&p={$code}"), 'ADMIN_EXTENSIONS_JUMPTO_URL_TOOLS' => $tools, 'ADMIN_EXTENSIONS_JUMPTO_URL' => $standalone, 'ADMIN_EXTENSIONS_JUMPTO_URL_STRUCT' => $struct, 'ADMIN_EXTENSIONS_TOTALCONFIG' => $totalconfig, 'ADMIN_EXTENSIONS_INSTALL_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=install"), 'ADMIN_EXTENSIONS_UPDATE_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=update"), 'ADMIN_EXTENSIONS_UNINSTALL_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=uninstall"), 'ADMIN_EXTENSIONS_UNINSTALL_CONFIRM_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=uninstall&x={$sys['xk']}"), 'ADMIN_EXTENSIONS_PAUSE_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=pause"), 'ADMIN_EXTENSIONS_UNPAUSE_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}&b=unpause")));
 if ($exists) {
     // Tags for existing exts
     $t->assign(array('ADMIN_EXTENSIONS_RIGHTS' => $type == 'module' ? cot_url('admin', "m=rightsbyitem&ic={$code}&io=a") : cot_url('admin', "m=rightsbyitem&ic={$type}&io={$code}"), 'ADMIN_EXTENSIONS_ADMRIGHTS_AUTH_GUESTS' => cot_auth_getmask($info['Auth_guests']), 'ADMIN_EXTENSIONS_AUTH_GUESTS' => $info['Auth_guests'], 'ADMIN_EXTENSIONS_ADMRIGHTS_LOCK_GUESTS' => cot_auth_getmask($info['Lock_guests']), 'ADMIN_EXTENSIONS_LOCK_GUESTS' => $info['Lock_guests'], 'ADMIN_EXTENSIONS_ADMRIGHTS_AUTH_MEMBERS' => cot_auth_getmask($info['Auth_members']), 'ADMIN_EXTENSIONS_AUTH_MEMBERS' => $info['Auth_members'], 'ADMIN_EXTENSIONS_ADMRIGHTS_LOCK_MEMBERS' => cot_auth_getmask($info['Lock_members']), 'ADMIN_EXTENSIONS_LOCK_MEMBERS' => $info['Lock_members'], 'ADMIN_EXTENSIONS_AUTHOR' => $info['Author'], 'ADMIN_EXTENSIONS_COPYRIGHT' => $info['Copyright'], 'ADMIN_EXTENSIONS_NOTES' => empty($L['info_notes']) ? $info['Notes'] : $L['info_notes']));
     // Check and display dependencies
     $dependencies_satisfied = true;
     foreach (array('Requires_modules', 'Requires_plugins', 'Recommends_modules', 'Recommends_plugins') as $dep_type) {
         if (!empty($info[$dep_type])) {
             $dep_obligatory = strpos($dep_type, 'Requires') === 0;
             $dep_module = strpos($dep_type, 'modules') !== false;
             $arg = $dep_module ? 'mod' : 'pl';
             $dir = $dep_module ? $cfg['modules_dir'] : $cfg['plugins_dir'];
             foreach (explode(',', $info[$dep_type]) as $ext) {
                 $ext = trim($ext);
                 $dep_installed = cot_extension_installed($ext);
                 if ($dep_obligatory) {
                     $dep_class = $dep_installed ? 'highlight_green' : 'highlight_red';
                     $dependencies_satisfied &= $dep_installed;
                 } else {
                     $dep_class = '';
                 }
                 $dep_ext_info = $dir . '/' . $ext . '/' . $ext . '.setup.php';
                 if (file_exists($dep_ext_info)) {
                     $dep_info = cot_infoget($dep_ext_info, 'COT_EXT');
                     if (!$dep_info && cot_plugin_active('genoa')) {
                         // Try to load old format info
                         $dep_info = cot_infoget($dep_ext_info, 'SED_EXTPLUGIN');
                     }
                 } else {
                     $dep_info = array('Name' => $ext);
예제 #5
0
<?php

/**
 * Installs ratings into modules
 *
 * @package Ratings
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
require cot_incfile('ratings', 'plug', 'enablement');
// Add options into module configs
foreach ($rat_modules_list as $mod_name) {
    if (cot_extension_installed($mod_name) && !cot_config_implanted($mod_name, 'ratings')) {
        cot_config_implant($mod_name, $rat_options, false, 'ratings');
    }
}
// Add options into module structure configs
foreach ($rat_modules_struct_list as $mod_name) {
    if (cot_extension_installed($mod_name) && !cot_config_implanted($mod_name, 'ratings')) {
        cot_config_implant($mod_name, $rat_options, true, 'ratings');
    }
}