template; $keys = Pluf::factory('IDF_Key')->getList(array('view'=>'join_user')); $cmd = Pluf::f('idf_plugin_syncgit_path_gitserve', '/bin/false'); $authorized_keys = Pluf::f('idf_plugin_syncgit_path_authorized_keys', false); if (false == $authorized_keys) { throw new Pluf_Exception_SettingError('Setting git_path_authorized_keys not set.'); } if (!is_writable($authorized_keys)) { throw new Exception('Cannot create file: '.$authorized_keys); } $out = ''; foreach ($keys as $key) { if (strlen($key->content) > 40 // minimal check and preg_match('/^[a-zA-Z][a-zA-Z0-9_.-]*(@[a-zA-Z][a-zA-Z0-9.-]*)?$/', $key->login)) { $content = str_replace("\n", '', $key->content); $out .= sprintf($template, $cmd, $key->login, $content)."\n"; } } file_put_contents($authorized_keys, $out, LOCK_EX); } }