Diff
Not logged in

Differences From Artifact [5e373d6c0f]:

To Artifact [115469633a]:


268
269
270
271
272
273
274

















275
276
277
278
279
280
281
282
283
284
285

286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
301
302
303
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301

302



303


304





305
306
307
308
309
310
311







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+










-
+
-
-
-

-
-
+
-
-
-
-
-








/*
** Return the default restriction GLOB
*/
const char *robot_restrict_default(void){
  return "timelineX,diff,annotate,zip,fileage,file";
}

/*
** Return true if zTag matches one of the tags in the robot-restrict
** setting.
*/
int robot_restrict_has_tag(const char *zTag){
  static const char *zGlob = 0;
  if( zGlob==0 ){
    zGlob = db_get("robot-restrict",robot_restrict_default());
    if( zGlob==0 ) zGlob = "";
  }
  if( zGlob[0]==0 || fossil_strcmp(zGlob, "off")==0 ){
    return 0;
  }
  return glob_multi_match(zGlob,zTag);
}

/*
** Check to see if the page named in the argument is on the
** robot-restrict list.  If it is on the list and if the user
** is "nobody" then bring up a captcha to test to make sure that
** client is not a robot.
**
** This routine returns true if a captcha was rendered and if subsequent
** page generation should be aborted.  It returns false if the page
** should not be restricted and should be rendered normally.
*/
int robot_restrict(const char *zPage){
int robot_restrict(const char *zTag){
  const char *zGlob;
  static int bKnownPass = 0;

  if( robot.resultCache==KNOWN_NOT_ROBOT ) return 0;
  if( bKnownPass ) return 0;
  zGlob = db_get("robot-restrict",robot_restrict_default());
  if( !robot_restrict_has_tag(zTag) ) return 0;
  if( zGlob==0 || zGlob[0]==0 || fossil_strcmp(zGlob, "off")==0 ){
    bKnownPass = 1;
    return 0;   /* Robot restriction is turned off */
  }
  if( !glob_multi_match(zGlob, zPage) ) return 0;
  if( !client_might_be_a_robot() ) return 0;

  /* Generate the proof-of-work captcha */   
  ask_for_proof_that_client_is_not_robot();
  return 1;
}