Subversion Repositories wimsdev

Rev

Rev 16696 | Rev 17457 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16696 Rev 16749
Line 116... Line 116...
116
    char sav;
116
    char sav;
117
 
117
 
118
    score_sheet=score_exo=score_isexam=score_ispublic=0; *score_class=0;
118
    score_sheet=score_exo=score_isexam=score_ispublic=0; *score_class=0;
119
    score_user[0]=0;
119
    score_user[0]=0;
120
    for(i=0;i<scorepname_no;i++) {
120
    for(i=0;i<scorepname_no;i++) {
121
     pf=p;
121
      pf=p;
122
     ahead:
122
      ahead:
123
     pn=strstr(pf,scorepname[i]); pf=pn+1;
123
      pn=strstr(pf,scorepname[i]); pf=pn+1;
124
     if(pn==NULL) continue;
124
      if(pn==NULL) continue;
125
     if(pn>p && !isspace(*(pn-1))) goto ahead;
125
      if(pn>p && !isspace(*(pn-1))) goto ahead;
126
     pe=find_word_start(pn+strlen(scorepname[i]));
126
      pe=find_word_start(pn+strlen(scorepname[i]));
127
     if(*pe!='=') goto ahead;
127
      if(*pe!='=') goto ahead;
128
     pd=find_word_start(pe+1);
128
      pd=find_word_start(pe+1);
129
     pf=find_word_end(pd);
129
      pf=find_word_end(pd);
130
     if(pf<=pd) continue;
130
      if(pf<=pd) continue;
131
     sav=*pf; *pf=0;
131
      sav=*pf; *pf=0;
132
     switch(i) {
132
      switch(i) {
133
         case 0: /* class */
133
        case 0: /* class */
134
           mystrncpy(score_class,pd,sizeof(score_class)); break;
134
          mystrncpy(score_class,pd,sizeof(score_class)); break;
135
         case 1: /* user */
135
        case 1: /* user */
136
           mystrncpy(score_user,pd,sizeof(score_user)); break;
136
          mystrncpy(score_user,pd,sizeof(score_user)); break;
137
         case 2: { /* sheet */
137
        case 2: { /* sheet */
138
          if(*pd=='P') {pd++; score_ispublic=1;}
138
          if(*pd=='P') {pd++; score_ispublic=1;}
139
          score_sheet=atoi(pd);
139
          score_sheet=atoi(pd);
140
          break;
140
          break;
141
         }
141
        }
142
         case 3: /* work=exo */
142
        case 3: /* work=exo */
143
           score_exo=atoi(pd); break;
143
          score_exo=atoi(pd); break;
144
         case 4: /* exam */
144
        case 4: /* exam */
145
           score_isexam=1; break;
145
          score_isexam=1; break;
146
     }
146
     }
147
     *pf=sav; ovlstrcpy(pn, pf);
147
     *pf=sav; ovlstrcpy(pn, pf);
148
    }
148
    }
149
    *p=0;
149
    *p=0;
150
  /* the commands are OK from a non trusted module if the user and the
150
    /* the commands are OK from a non trusted module if the user and the
151
  class are not precised, so it can be only the user in his class */
151
    class are not precised, so it can be only the user in his class */
152
    if((*score_class!=0 || score_user[0]!=0) && !trusted_module()) {
152
    if((*score_class!=0 || score_user[0]!=0) && !trusted_module()) {
153
     module_error("not_trusted"); return;
153
      module_error("not_trusted"); return;
154
    }
154
    }
155
    if(*score_class==0) {
155
    if(*score_class==0) {
156
     char *classe;
156
      char *classe;
157
     classe=getvar("wims_class");
157
      classe=getvar("wims_class");
158
     if(classe==NULL || *classe==0) return;
158
      if(classe==NULL || *classe==0) return;
159
     else mystrncpy(score_class,classe,sizeof(score_class));
159
      else mystrncpy(score_class,classe,sizeof(score_class));
160
    }
160
    }
161
    if(score_user[0]==0) {
161
    if(score_user[0]==0) {
162
     char *user;
162
     char *user;
163
     user=getvar("wims_user");
163
     user=getvar("wims_user");
164
     if(user!=NULL) mystrncpy(score_user,user,sizeof(score_user));
164
     if(user!=NULL) mystrncpy(score_user,user,sizeof(score_user));