Back to index

wims  3.65+svn20090927
Functions
pedia.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void exec_href (char *p)
void pedia (char *p)

Function Documentation

void exec_href ( char *  p)

Definition at line 724 of file exec.c.

{
    char *s, st[128], sti[128], stc[128], *p1, *p2, *p3, *wn="";
    char *U="<u><font color=\"#A0A0C0\">%s</font></u>";
    char b1[MAX_LINELEN+1], b2[MAX_LINELEN+1];
    int new=0;
    if(!outputing) return;
    href_find_target(p);
    p1=find_word_start(p);
    p2=find_word_end(p1); if(*p2) *(p2++)=0;
    mystrncpy(b1,p1,sizeof(b1));
    mystrncpy(b2,find_word_start(p2),sizeof(b2));
    substit(b1); substit(b2);
       /* standard reference */
    if(*b2==0 && strchr(b1,'=')==NULL) {
       char b[MAX_LINELEN+1], *ll;
       p1=find_word_start(b1); *find_word_end(p1)=0;
       if(*p1==0 || strlen(p1)>64) return;
       ll=getvar("module_language"); 
       if(ll==NULL || *ll==0 || *(ll+1)==0 || *(ll+2)!=0) ll=lang;
       accessfile(b,"r","html/href.%s",ll);
       memmove(p1+1,p1,64); *p1='\n'; strcat(p1,"       ");
       p2=strstr(b,p1); if(p2==NULL) return;
       p1=find_word_start(p2+strlen(p1)); p2=find_word_end(p1);
       if(*p2) *(p2++)=0;
       p3=strchr(p2,'\n'); if(p3!=NULL) *p3=0;
       mystrncpy(b1,p1,sizeof(b1));
       mystrncpy(b2,find_word_start(p2),sizeof(b2));
       substit(b1); substit(b2);
    }
       /* for robots: only references without defining cmd. */
    if(robot_access && strstr(b1,"cmd=")!=NULL &&
       strstr(b1,"module=adm/doc")==NULL) {
       _output_(b2); return;
    }
    if(robot_access && strstr(aliased_cgi,"yes")!=NULL) {
       char mbuf[256], lbuf[16];
       _href_getdef(b1,"module",mbuf,sizeof(mbuf));
       if(mbuf[0]==0) mystrncpy(mbuf,home_module,sizeof(mbuf));
       _href_getdef(b1,"lang",lbuf,sizeof(lbuf));
       if(strlen(lbuf)!=2) {mystrncpy(lbuf,lang,4);lbuf[2]=0;}
       if(strncmp(mbuf,"adm/doc",strlen("adm/doc"))==0) {
           char dbuf[256], bbuf[256];
           _href_getdef(b1,"doc",dbuf,sizeof(dbuf));
           _href_getdef(b1,"block",bbuf,sizeof(bbuf));
           if(!myisdigit(dbuf[0])) dbuf[0]=0;
           if(dbuf[0]!=0 && bbuf[0]==0) snprintf(bbuf,sizeof(bbuf),"main");
           if(dbuf[0]==0)
             output("<a href=\"%s%s_doc~.html\">%s</a>", ref_base,lbuf,b2);
           else
             output("<a href=\"%s%s_doc~%s~%s.html\">%s</a>",
                   ref_base,lbuf,dbuf,bbuf,b2);
       }
       else {
           for(s=strchr(mbuf,'/'); s!=NULL; s=strchr(s+1,'/')) *s='~';
           output("<a href=\"%s%s_%s.html\">%s</a>", ref_base,lbuf,mbuf,b2);
       }
       return;
    }
    s=getvar("wims_ref_id");
    if(s!=NULL && *s!=0 && !isspace(*s)) {
       snprintf(sti,sizeof(sti)," id=\"%s\"",s);
    }
    else sti[0]=0;
    
    s=getvar("wims_ref_class");
    if(s!=NULL && *s!=0 && !isspace(*s)) {
       snprintf(stc,sizeof(stc)," class=\"%s\"",s);
    }
    else stc[0]=0;
    
    s=getvar("wims_ref_target");
    if(href_target[0]!=0) s=href_target;
    if(s!=NULL && *s!=0 && !isspace(*s)) {
       snprintf(st,sizeof(st)," target=\"%s\"",s);
       if(strcmp(s,"_parent")!=0) {
           new=1; wn="wims_window=new&";
       }
    }
    else st[0]=0;
    _httpfollow(b1,wn,new);
    tohttpquery(b1);
    if(strstr(session_prefix,"_check")!=NULL) {
       if(*b2) output(U,b2);
       else _output_("<a name=\"0\">");
       return;
    }
    if(jsbuf[0]==0 && st[0]==0 && strstr(session_prefix,"_exam")!=NULL) {
       p1=strstr(b1,"cmd="); if(p1!=NULL) {
           p1+=strlen("cmd=");
           if(strncmp(p1,"new",3)==0 || strncmp(p1,"renew",5)==0 ||
              strncmp(p1,"intro",5)==0) {
              if(*b2) output(U,b2);
              else _output_("<a name=\"#\">");
              return;
           }
       }
    }
    if(*b2)
      output("<a href=\"%s?%s\"%s%s %s %s>%s</a>",
            ref_name, b1, st, jsbuf,sti,stc, b2);
    else
      output("<a href=\"%s?%s\"%s%s %s %s>",ref_name, b1, st, jsbuf,sti,stc);
    setvar("wims_ref_id"," ");
    setvar("wims_ref_class"," ");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pedia ( char *  p)

Definition at line 51 of file pedia.c.

{

    if(*find_word_start(p)==0) return;
    force_setvar("wims_pedia_parm",p);
    phtml_put_base("pedia.phtml",1);
    *p=0;
    
}

Here is the call graph for this function: