示例#1
0
void template_preprocess_aggregator_feed_source(map <string, string> &variables) 
{
	map <string, string> feed = variables;
	  
	variables["source_icon"] = theme("feed_icon", feed);
	variables["source_image"] = feed["image"];
	variables["source_description"] = aggregator_filter_xss(feed["description"]);
	
	map <string, string> url_options;
	url_options["absolute"] = _TRUE;
	variables["source_url"] = check_url(url( feed["link"], &url_options ));

	if ( isset(feed["checked"]) ) {
		variables["last_checked"] = format_interval( time() - intval(feed["checked"]) ) + " ago";
	}
	else {
		variables["last_checked"] = "never";
	}

	if ( user_access("administer news feeds") ) {
		variables["last_checked"] = "<a href=\""+ url("admin/content/aggregator") +"\">"+ variables["last_checked"] + "</a>";
	}
}
示例#2
0
int
start_remote_job_p (int first_p)
{
  static int inited = 0;
  int status;
  int njobs;

  if (!inited)
    {
      /* Allow the user to turn off job exportation (useful while he is
         debugging Customs, for example).  */
      if (getenv ("GNU_MAKE_NO_CUSTOMS") != 0)
        {
          inited = -1;
          return 0;
        }

      /* For secure Customs, make is installed setuid root and
	 Customs requires a privileged source port be used.  */
      make_access ();

      if (ISDB (DB_JOBS))
        Rpc_Debug(1);

      /* Ping the daemon once to see if it is there.  */
      inited = Customs_Ping () == RPC_SUCCESS ? 1 : -1;

      /* Return to normal user access.  */
      user_access ();

      if (starting_directory == 0)
	/* main couldn't figure it out.  */
	inited = -1;
      else
	{
	  /* Normalize the current directory path name to something
	     that should work on all machines exported to.  */

	  normalized_cwd = xmalloc (GET_PATH_MAX);
	  strcpy (normalized_cwd, starting_directory);
	  if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0)
	    /* Path normalization failure means using Customs
	       won't work, but it's not really an error.  */
	    inited = -1;
	}
    }

  if (inited < 0)
    return 0;

  njobs = job_slots_used;
  if (!first_p)
    njobs -= 1;		/* correction for being called from reap_children() */

  /* the first job should run locally, or, if the -l flag is given, we use
     that as clue as to how many local jobs should be scheduled locally */
  if (max_load_average < 0 && njobs == 0 || njobs < max_load_average)
     return 0;

  status = Customs_Host (EXPORT_SAME, &permit);
  if (status != RPC_SUCCESS)
    {
      DB (DB_JOBS, (_("Customs won't export: %s\n"),
                    Rpc_ErrorMessage (status)));
      return 0;
    }

  return !CUSTOMS_FAIL (&permit.addr);
}