Server IP : 103.119.228.120 / Your IP : 13.58.201.240 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/zsh/5.0.2/functions/ |
Upload File : |
# Function to find a web browser to run on a URL or file. # Can also be run as a script. It is suitable for use as # a suffix alias: # alias -s html=pick-web-browser # # The single argument is the URL or file name which may be of any type. # The only processing which occurs is that if the argument is a file, # it is converted into a URL. As the function takes account of # any necessary conversions to the file name (for example, if it # contains spaces), it is generally preferable to pass in raw file # names rather than convert them to URLs elsewhere. # # The function takes account of the fact that many X Windows browsers # which are already running on the current display can take a command # to pass the URL to that process for handling. A typical sign # that this has happened is that apparently nothing happens --- you # need to check the browser window. # # If no $DISPLAY is set, the function tries to start a terminal-based # browser instead. emulate -L zsh setopt extendedglob cbases nonomatch warncreateglobal zmodload -i zsh/zutil local -a xbrowsers ttybrowsers # X Windows browsers which might be running and can accept # a remote URL. zstyle -a :mime: x-browsers xbrowsers || xbrowsers=(firefox mozilla netscape opera konqueror) # Preferred command line browsers. zstyle -a :mime: tty-browsers ttybrowsers || ttybrowsers=(elinks links lynx) # Characters in addition to alphanumerics which can appear literally # in a URL. `-' should be the first if it appears, so append others # to the end. local litc="-_./" local -a windows remoteargs match mbegin mend local url browser command url=$1 if [[ -f $url ]]; then if [[ $url = *[^-_[:alnum:]]* ]]; then # Convert special characters into hex escapes. local sofar while [[ $url = (#b)([${litc}[:alnum:]]#)([^${litc}[:alnum:]])(*) ]] do sofar+="$match[1]%${$(( [#16] ##$match[2] ))##0x}" url=$match[3] done url="$sofar$url" fi # Turn this into a local URL if [[ $url = /* ]]; then url=file://$url else url=file://$PWD/$url fi fi local bstyle local -a bstyles zstyle -a :mime: browser-styles bstyles || bstyles=(running x tty) for bstyle in $bstyles; do case $bstyle in (running) [[ -z $DISPLAY ]] && continue # X Windows running # Get the name of all windows running; use the internal name, not # the friendly name, which is less useful. windows=(${(ou)${(M)${(f)"$(xwininfo -root -all)"}:#*\"*\"\:[[:space:]]\(\"*}/(#b)*\"*\"\:[[:space:]]\(\"(*)\"[[:space:]]\"*\"\)*/$match[1]}) #windows=(${(f)"$(xwininfo -root -all | # perl -ne '/.*"(.*)": \("(.*)" "(.*)"\).*/ and $w{$2} = 1; # END { print join("\n", keys %w), "\n" }')"}) # Is any browser we've heard of running? for browser in $xbrowsers; do # Some browser executables call themselves <browser>-bin if [[ $windows[(I)(#i)$browser(|[.-]bin)] -ne 0 ]]; then if zstyle -s ":mime:browser:running:${browser}:" command command; then # The (q)'s here and below are pure paranoia: no browser # name is going to include metacharacters, and we already # converted difficult characters in the URL to hex. zformat -f command $command b:${(q)browser} u:${(q)url} eval $command else case $browser in (konqueror) # kfmclient is less hairy and better supported than direct # use of dcop. Run kfmclient --commands # for more information. Note that as konqueror is a fully # featured file manager, this will actually do complete # MIME handling, not just web pages. kfmclient openURL $url || dcop $(dcop|grep konqueror) default openBrowserWindow $url ;; (firefox) # open in new tab $browser -new-tab $url ;; (opera) $browser -newpage $url ;; (*) # Mozilla bells and whistles are described at: # http://www.mozilla.org/unix/remote.html $browser -remote "openURL($url)" ;; esac fi return fi done ;; (x) [[ -z $DISPLAY ]] && continue # Start our preferred X Windows browser in the background. for browser in $xbrowsers; do if eval "[[ =$browser != \\=$browser ]]"; then if zstyle -s ":mime:browser:new:${browser}:" command command; then zformat -f command $command b:${(q)browser} u:${(q)url} eval $command "&" else # The following is to make the job text more readable. eval ${(q)browser} ${(q)url} "&" fi return fi done ;; (tty) # Start up dumb terminal browser. for browser in $ttybrowsers; do if eval "[[ =$browser != \\=$browser ]]"; then if zstyle -s ":mime:browser:new:${browser}" command command; then zformat -f command $command b:${(q)browser} u:${(q)url} eval $command else $browser $url fi return fi done ;; esac done # No eligible browser. return 255