public function install_market_item($params)
{
if (defined('MW_API_CALL')) {
$to_trash = true;
$adm = $this->app->user_manager->is_admin();
if ($adm == false) {
return array('error' => 'You must be admin to install from Marketplace!');
}
}
if (!ini_get('safe_mode')) {
if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'ini_set')) {
ini_set('memory_limit', '160M');
ini_set('set_time_limit', 0);
}
if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'set_time_limit')) {
set_time_limit(0);
}
}
$url = $this->remote_url . 'api/dl_file_api';
$dl_get = $this->call('get_market_dl_link', $params);
if (isset($params['market_key']) and trim($params['market_key']) != '') {
$lic = array();
$lic['local_key'] = $params['market_key'];
$lic['activate_on_save'] = 1;
$this->save_license($lic);
}
$res = array();
if ($dl_get != false and is_string($dl_get)) {
$dl_get = json_decode($dl_get, true);
if (isset($dl_get['url'])) {
$res = $this->install_from_market($dl_get);
}
} else {
if (isset($dl_get['url'])) {
$res = $this->install_from_market($dl_get);
}
}
$this->post_update();
return $res;
}