\n" . &ui_hidden("tipid", $tipid) . ($return_url ? &ui_hidden("return_url", $return_url) : "") . &ui_form_end([ $hide_button_text2 ? [ undef, $hide_button_text2, undef, undef, "onclick=\"window.open('$target_link','_blank');event.preventDefault();event.stopPropagation();\"", $hide_button_icon2, $btncls ] : undef, $hide_button_text3 ? [ 'remind', $hide_button_text3, undef, undef, undef, $hide_button_icon3 ] : undef, $hide_button_text ? [ undef, $hide_button_text, undef, undef, undef, $hide_button_icon ] : undef ], undef, 1); return &ui_alert_box($form, 'success', undef, undef, $alert_title, $alertcls); } # global_menu_link_pro_tip(global-links-hash-ref) # Modifies global links and returns grayed out Pro # links for GPL users for advertising purposes sub global_menu_link_pro_tip { my ($global_links_hash) = @_; foreach my $pro_demo_feature ( # Add demo Reseller Accounts link for GPL users { 'name' => 'newresels', 'title' => $text{'newresels_title'}, 'cat' => 'setting', 'url' => "$virtualmin_docs_pro/#newresels", }, # Add demo Cloud Mail Delivery Providers link for GPL users { 'name' => 'smtpclouds', 'title' => $text{'smtpclouds_title'}, 'cat' => 'email', 'url' => "$virtualmin_docs_pro/#smtpclouds", }, # Add demo Email Server Owners link for GPL users { 'name' => 'newnotify', 'title' => $text{'newnotify_title'}, 'cat' => 'email', 'url' => "$virtualmin_docs_pro/#newnotify", }, # Add demo Email Server Owners link for GPL users { 'name' => 'newretention', 'title' => $text{'newretention_title'}, 'cat' => 'email', 'url' => "$virtualmin_docs_pro/#newretention", }, # Add demo New Reseller Email link for GPL users { 'name' => 'newreseller', 'title' => $text{'newreseller_title'}, 'cat' => 'email', 'url' => "$virtualmin_docs_pro/#newreseller", }, # Add demo Custom Links link for GPL users { 'name' => 'newlinks', 'title' => $text{'newlinks_title'}, 'cat' => 'custom', 'url' => "$virtualmin_docs_pro/#newlinks", }, # Add demo Remote DNS { 'name' => 'remotedns', 'title' => $text{'remotedns_title'}, 'cat' => 'ip', 'url' => "$virtualmin_docs_pro/#remotedns", }, # Add demo SSL Providers { 'name' => 'newacmes', 'title' => $text{'newacmes_title'}, 'cat' => 'ip', 'url' => "$virtualmin_docs_pro/#newacmes", }, # Add demo Secondary Mail Servers link for GPL users { 'name' => 'newmxs', 'title' => $text{'newmxs_title'}, 'cat' => 'email', 'url' => "$virtualmin_docs_pro/#newmxs", }, # Add demo Disk Quota Monitoring link for GPL users { 'name' => 'newquotas', 'title' => $text{'newquotas_title'}, 'cat' => 'check', 'url' => "$virtualmin_docs_pro/#newquotas", 'skip' => !&has_home_quotas() }, # Add demo Batch Create Servers link for GPL users { 'name' => 'newcmass', 'title' => $text{'cmass_title'}, 'cat' => 'add', 'url' => "$virtualmin_docs_pro/#newcmass", }, # Add demo Backup Encryption Keys link for GPL users { 'name' => 'bkeys', 'title' => $text{'bkeys_title'}, 'cat' => 'backup', 'url' => "$virtualmin_docs_pro/#bkeys", }, # Add demo System Statistics link for GPL users { 'name' => 'history', 'icon' => 'graph', 'title' => $text{'edit_history'}, 'url' => "$virtualmin_docs_pro/#demo_history", }, ) { &menu_link_pro_tip($pro_demo_feature->{'name'}, $pro_demo_feature); delete($pro_demo_feature->{'name'}); push(@{$global_links_hash}, $pro_demo_feature) if (!$pro_demo_feature->{'skip'}); } } # menu_link_pro_tips(links-hash-ref, dom-hash-ref) # Modifies sub-menu links and returns grayed out # Pro links for GPL users for advertising purposes sub menu_link_pro_tips { my ($links_hash, $d) = @_; foreach my $pro_demo_feature ( # Add demo Edit Resource Limits link for GPL users { 'name' => 'edit_res', 'title' => $text{'edit_res'}, 'cat' => 'server', 'url' => "$virtualmin_docs_pro/#edit_res", 'skip' => !($d->{'unix'} && &can_edit_res($d)) }, # Add demo Search Mail Logs link for GPL users { 'name' => 'edit_maillog', 'title' => $text{'edit_maillog'}, 'cat' => 'logs', 'url' => "$virtualmin_docs_pro/#edit_maillog", 'skip' => !($config{'mail'} && $mail_system <= 1 && $d->{'mail'}), }, # Add demo Check Connectivity link for GPL users { 'name' => 'edit_connect', 'title' => $text{'edit_connect'}, 'cat' => 'logs', 'url' => "$virtualmin_docs_pro/#edit_connect", }, # Add demo Edit Web Pages link for GPL users { 'name' => 'edit_html', 'title' => $text{'edit_html'}, 'cat' => 'web', 'url' => "$virtualmin_docs_pro/#edit_html", 'skip' => !(&domain_has_website($d) && $d->{'dir'} && !$d->{'alias'} && !$d->{'proxy_pass_mode'} && &can_edit_html()), }, ) { &menu_link_pro_tip($pro_demo_feature->{'name'}, $pro_demo_feature); delete($pro_demo_feature->{'name'}); push(@{$links_hash}, $pro_demo_feature) if (!$pro_demo_feature->{'skip'}); } } # menu_link_pro_tip(demo-feature-name, link-hash-ref) # Modifies default menu link to advertise GPL user Pro features, if allowed sub menu_link_pro_tip { my ($demo_feature, $link_hash) = @_; if (should_show_pro_tip($demo_feature)) { delete($link_hash->{'page'}); $link_hash->{'inactive'} = 1; $link_hash->{'urlpro'} = $link_hash->{'url'}; $link_hash->{'title'} .= ( " " . "🔒 Pro" . "" . "" ); } elsif (!$virtualmin_pro) { $link_hash->{'skip'} = 1; } } # inline_html_pro_tip(html, name, always-show) # Modifies passed HTML element to advertise GPL user Pro features, if allowed sub inline_html_pro_tip { my ($h, $n, $a) = @_; my $f = sub { my ($h) = @_; map { $h =~ /]*?)\s?(name|value|id|size)=["'][^"']*["'](.*?>)/$1$3/ } (0..3); $h =~ s/(]*?)>/$1 disabled>/g; return $h; }; my $d = sub { my ($h, $n) = @_; return "$h"; }; if (!$virtualmin_pro) { if ($config{'hide_pro_tips'} != 1 || $a) { $h = &$d(&$f($h), "$n-elem"); $h .= &$d(" 🔒 ". "Pro", "$n-link"); return $h; } return undef; } return $h; } # build_pro_scripts_list_for_pro_tip() # Builds a list of Virtualmin Pro scripts for inclusion to GPL package sub build_pro_scripts_list_for_pro_tip { my @scripts_pro_list; my @scripts = map { &get_script($_) } &list_scripts(); @scripts = grep { $_->{'avail'} } @scripts; @scripts = sort { lc($a->{'desc'}) cmp lc($b->{'desc'}) } @scripts; foreach my $script (@scripts) { my @vers = grep { &can_script_version($script, $_) } @{$script->{'install_versions'}}; next if (!@vers); next if ($script->{'dir'} !~ /$scripts_directories[3]/ && !$script->{'migrated'}); push(@scripts_pro_list, { 'version' => 'latest', 'name' => $script->{'name'}, 'desc' => $script->{'desc'}, 'longdesc' => $script->{'longdesc'}, 'categories' => $script->{'categories'}, 'pro' => 1 }, ); } my $scripts_pro_file = "$scripts_directories[2]/scripts-pro.info"; my $fh = "SCRIPTS"; &open_tempfile($fh, ">$scripts_pro_file"); &print_tempfile($fh, &serialise_variable(\@scripts_pro_list)); &close_tempfile($fh); } # proshow() # Returns 1 or 0 depending on whether Pro features should be shown at all in GPL sub proshow { return 1 if ($virtualmin_pro); return ($config{'hide_pro_tips'} == 1 && !$virtualmin_pro) ? 0 : 1 } # procell([col-size], [tds-ref]) # Returns a reference to an array of table cells attributes sub procell { my ($colsize, @tds) = @_; $colsize ||= 1; @tds = (("") x $colsize) if (!@tds); @tds = map { "data-pro-disabled='cell' $_" } @tds; return $virtualmin_pro ? undef : \@tds; }; 1;