Exemplo n.º 1
0
 /**
  * Return flag is core addon
  * @return bool
  */
 public function isCoreAddon()
 {
     $core_addons = Snapshot::getCoreAddons();
     return in_array($this->getId(), $core_addons);
 }
Exemplo n.º 2
0
/**
 * Initialize all enabled addons
 *
 * @return array INIT_STATUS_OK
 */
function fn_init_addons()
{
    Registry::registerCache('addons', array('addons', 'settings_objects', 'settings_vendor_values', 'settings_descriptions', 'settings_sections', 'settings_variants'), Registry::cacheLevel('static'));
    if (Registry::isExist('addons') == false) {
        $init_addons = Registry::get('settings.init_addons');
        $allowed_addons = null;
        if ($init_addons == 'none') {
            $allowed_addons = array();
        } elseif ($init_addons == 'core') {
            $allowed_addons = Snapshot::getCoreAddons();
        }
        $_addons = db_get_hash_array("SELECT addon, priority, status, unmanaged FROM ?:addons WHERE 1 ORDER BY priority", 'addon');
        foreach ($_addons as $k => $v) {
            $_addons[$k] = Settings::instance()->getValues($v['addon'], Settings::ADDON_SECTION, false);
            if (fn_check_addon_snapshot($k)) {
                $_addons[$k]['status'] = $v['status'];
            } else {
                $_addons[$k]['status'] = 'D';
            }
            if ($allowed_addons !== null && !in_array($v['addon'], $allowed_addons)) {
                $_addons[$k]['status'] = 'D';
            }
            $_addons[$k]['priority'] = $v['priority'];
            $_addons[$k]['unmanaged'] = $v['unmanaged'];
        }
        // Some addons could be disabled for vendors.
        if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) {
            Registry::set('addons', $_addons);
            // So, we have to parse it one more time
            foreach ($_addons as $k => $v) {
                // and check permissions schema.
                // We couldn't make it in the previous cycle because the fn_get_scheme func works only with full list of addons.
                if (!fn_check_addon_permission($k)) {
                    unset($_addons[$k]);
                }
            }
        }
        Registry::set('addons', $_addons);
    }
    foreach ((array) Registry::get('addons') as $addon_name => $data) {
        if (empty($data['status'])) {
            // FIX ME: Remove me
            error_log("ERROR: Addons initialization: Bad '{$addon_name}' addon data:" . serialize($data) . " Addons Registry:" . serialize(Registry::get('addons')));
        }
        if (!empty($data['status']) && $data['status'] == 'A') {
            fn_load_addon($addon_name);
        }
    }
    Registry::set('addons_initiated', true, true);
    return array(INIT_STATUS_OK);
}
Exemplo n.º 3
0
        $table_name = $_REQUEST['table'];
    } else {
        die;
    }
    $id_name = $_REQUEST['id_name'];
    $ids = explode(',', $_REQUEST['ids']);
    $positions = explode(',', $_REQUEST['positions']);
    foreach ($ids as $k => $id) {
        db_query("UPDATE ?:{$table_name} SET position = ?i WHERE ?w", $positions[$k], array($id_name => $id));
    }
    fn_set_notification('N', __('notice'), __('positions_updated'));
    exit;
} elseif ($mode == 'view_changes') {
    Tygh::$app['view']->assign(Snapshot::changes($_REQUEST));
} elseif ($mode == 'create_snapshot') {
    Snapshot::create(array('theme_rel_backend' => fn_get_theme_path('[relative]', 'A'), 'themes_frontend' => fn_get_theme_path('[themes]', 'C'), 'themes_repo' => fn_get_theme_path('[repo]', 'C')));
    return array(CONTROLLER_STATUS_OK, 'tools.view_changes');
} elseif ($mode == 'init_addons') {
    $init_addons = !empty($_REQUEST['init_addons']) ? $_REQUEST['init_addons'] : '';
    if (!($init_addons == 'none' || $init_addons == 'core')) {
        $init_addons = '';
    }
    Settings::instance()->updateValue('init_addons', $init_addons);
    fn_clear_cache();
    $return_url = !empty($_REQUEST['return_url']) ? $_REQUEST['return_url'] : 'tools.view_changes';
    return array(CONTROLLER_STATUS_OK, $return_url);
}
function fn_qm_parse_url($url)
{
    if (strpos($url, '?') !== false) {
        list(, $query_string) = explode('?', $url);