includes/plugins.php
changeset 869 58bc29c14a4d
parent 846 0d2d0dfbe443
child 893 b24601274cd2
equal deleted inserted replaced
868:75dcd8cf6232 869:58bc29c14a4d
   511     fclose($fh);
   511     fclose($fh);
   512     return md5($h);
   512     return md5($h);
   513   }
   513   }
   514   
   514   
   515   /**
   515   /**
       
   516    * Determines if a file is an authentication extension by looking at the file contents.
       
   517    * @param string Plugin filename
       
   518    * @return bool
       
   519    */
       
   520   
       
   521   function is_file_auth_plugin($filename)
       
   522   {
       
   523     $filename = ENANO_ROOT . '/plugins/' . $filename;
       
   524     if ( !file_exists($filename) )
       
   525       return false;
       
   526     
       
   527     $info = $this->get_plugin_info($filename);
       
   528     if ( isset($info['auth plugin']) )
       
   529       return true;
       
   530     
       
   531     $contents = @file_get_contents($filename);
       
   532     if ( strstr($contents, 'login_process_userdata_json') )
       
   533       return true;
       
   534     
       
   535     return false;
       
   536   }
       
   537   
       
   538   /**
   516    * Installs a plugin.
   539    * Installs a plugin.
   517    * @param string Filename of plugin.
   540    * @param string Filename of plugin.
   518    * @param array The list of plugins as output by pluginLoader::get_plugin_list(). If not passed, the function is called, possibly wasting time.
   541    * @param array The list of plugins as output by pluginLoader::get_plugin_list(). If not passed, the function is called, possibly wasting time.
   519    * @return array JSON-formatted but not encoded response
   542    * @return array JSON-formatted but not encoded response
   520    */
   543    */