gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/cronjobs/cvs-cron default_page.php, NONE, 1.1 us


From: tperdue
Subject: [Gforge-commits] gforge/cronjobs/cvs-cron default_page.php, NONE, 1.1 usergroup.php, 1.10, 1.11
Date: Mon, 19 Apr 2004 14:57:42 -0500

Update of /cvsroot/gforge/gforge/cronjobs/cvs-cron
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/cronjobs/cvs-cron

Modified Files:
        usergroup.php 
Added Files:
        default_page.php 
Log Message:
adding default project page template

--- NEW FILE: default_page.php ---
<?php

$domain='<domain>';
$group_id='<group_id>';
$project_name='<project_name>';
$project_description='<project_description>';
$group_name='<group_name>';

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en   ">

  <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo $project_name; ?></title>
        <script language="JavaScript" type="text/javascript">
        <!--
        function help_window(helpurl) {
                HelpWin = window.open( 
helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
        }
        // -->
                </script>

<style type="text/css">
        <!--
        BODY {
                margin-top: 3;
                margin-left: 3;
                margin-right: 3;
                margin-bottom: 3;
                background: #01004e;
        }
        ol,ul,p,body,td,tr,th,form { font-family: 
verdana,arial,helvetica,sans-serif; font-size:small;
                color: #333333; }

        h1 { font-size: x-large; font-family: 
verdana,arial,helvetica,sans-serif; }
        h2 { font-size: large; font-family: verdana,arial,helvetica,sans-serif; 
}
        h3 { font-size: medium; font-family: 
verdana,arial,helvetica,sans-serif; }
        h4 { font-size: small; font-family: verdana,arial,helvetica,sans-serif; 
}
        h5 { font-size: x-small; font-family: 
verdana,arial,helvetica,sans-serif; }
        h6 { font-size: xx-small; font-family: 
verdana,arial,helvetica,sans-serif; }

        pre,tt { font-family: courier,sans-serif }

        a:link { text-decoration:none }
        a:visited { text-decoration:none }
        a:active { text-decoration:none }
        a:hover { text-decoration:underline; color:red }

        .titlebar { color: black; text-decoration: none; font-weight: bold; }
        a.tablink { color: black; text-decoration: none; font-weight: bold; 
font-size: x-small; }
        a.tablink:visited { color: black; text-decoration: none; font-weight: 
bold; font-size: x-small; }
        a.tablink:hover { text-decoration: none; color: black; font-weight: 
bold; font-size: x-small; }
        a.tabsellink { color: black; text-decoration: none; font-weight: bold; 
font-size: x-small; }
        a.tabsellink:visited { color: black; text-decoration: none; 
font-weight: bold; font-size: x-small; }
        a.tabsellink:hover { text-decoration: none; color: black; font-weight: 
bold; font-size: x-small; }
        -->
</style>

</head>

<body>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

        <tr>
                <td><a href="/"><img src="<?php echo $domain; 
?>/themes/gforge/images/logo.png" border="0" alt="" width="198" height="52" 
/></a></td>
        </tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

        <tr>
                <td>&nbsp;</td>
                <td colspan="3">



                <!-- start tabs -->

        <tr>
                <td align="left" bgcolor="#E0E0E0" width="9"><img src="<?php 
echo $domain; ?>/themes/gforge/images/tabs/topleft.png" height="9" width="9" 
alt="" /></td>
                <td bgcolor="#E0E0E0" width="30"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
                <td bgcolor="#E0E0E0"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
                <td bgcolor="#E0E0E0" width="30"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
                <td align="right" bgcolor="#E0E0E0" width="9"><img src="<?php 
echo $domain; ?>/themes/gforge/images/tabs/topright.png" height="9" width="9" 
alt="" /></td>
        </tr>

        <tr>

                <!-- Outer body row -->

                <td bgcolor="#E0E0E0"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="10" height="1" alt="" /></td>
                <td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3">

                        <!-- Inner Tabs / Shell -->

                        <table border="0" width="100%" cellspacing="0" 
cellpadding="0">
                        <tr>
                                <td align="left" bgcolor="#ffffff" 
width="9"><img src="<?php echo $domain; 
?>/themes/gforge/images/tabs/topleft-inner.png" height="9" width="9" alt="" 
/></td>
                                <td bgcolor="#ffffff"><img src="<?php echo 
$domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
                                <td align="right" bgcolor="#ffffff" 
width="9"><img src="<?php echo $domain; 
?>/themes/gforge/images/tabs/topright-inner.png" height="9" width="9" alt="" 
/></td>
                        </tr>

                        <tr>
                                <td bgcolor="#ffffff"><img src="<?php echo 
$domain; ?>/themes/gforge/images/clear.png" width="10" height="1" alt="" /></td>
                                <td valign="top" width="99%" bgcolor="white">

        <!-- whole page table -->
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr><td width="65%" valign="top">
<h2>Welcome to the <?php echo $project_name; ?> Project!</h2>
<p>
<?php echo $project_description; ?>
</p>
                <table cellspacing="0" cellpadding="1" width="100%" border="0" 
bgcolor="#d5d5d7">
                <tr><td>
                        <table cellspacing="0" cellpadding="2" width="100%" 
border="0" bgcolor="#eaecef">
                                <tr style="background-color:#d5d5d7" 
align="center">
                                        <td colspan="2"><span 
class="titlebar">Latest News</span></td>
                                </tr>
                                <tr align="left">
                                        <td colspan="2">


<?php $handle=fopen($domain.'/export/projnews.php?group_id='.$group_id,'r');
$contents = '';
while (!feof($handle)) {
        $contents .= fread($handle, 8192);
}
fclose($handle);
$contents=str_replace('href="','href="'.$domain,$contents);
echo $contents; ?>

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                </table><p>&nbsp;</p>
</td>

<td width="35%" valign="top">

                <table cellspacing="0" cellpadding="1" width="100%" border="0" 
bgcolor="#d5d5d7">
                <tr><td>
                        <table cellspacing="0" cellpadding="2" width="100%" 
border="0" bgcolor="#eaecef">
                                <tr style="background-color:#d5d5d7" 
align="center">
                                        <td colspan="2"><span 
class="titlebar">Project Summary</span></td>
                                </tr>
                                <tr align="left">
                                        <td colspan="2">

<?php $handle=fopen($domain.'/export/projhtml.php?group_id='.$group_id,'r');
$contents = '';
while (!feof($handle)) {
        $contents .= fread($handle, 8192);
}
fclose($handle);
$contents=str_replace('href="','href="'.$domain,$contents);
$contents=str_replace('src="','src="'.$domain,$contents);
echo $contents; ?>

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                </table><p>&nbsp;</p>
</td></tr></table>
                        &nbsp;<p>
                        <center>
                        <a href="http://gforgegroup.com/";><img 
src="http://gforge.org/pro/gforgebanner.jpg"; height="60" width="468" border="0" 
alt="GForge Group Professional Services" /></a><br /><br />
                        </center>
                        <!-- end main body row -->


                                </td>
                                <td width="10" bgcolor="#ffffff"><img 
src="<?php echo $domain; ?>/themes/gforge/images/clear.png" width="2" 
height="1" alt="" /></td>
                        </tr>
                        <tr>
                                <td align="left" bgcolor="#E0E0E0" 
width="9"><img src="<?php echo $domain; 
?>/themes/gforge/images/tabs/bottomleft-inner.png" height="11" width="11" 
alt="" /></td>
                                <td bgcolor="#ffffff"><img src="<?php echo 
$domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
                                <td align="right" bgcolor="#E0E0E0" 
width="9"><img src="<?php echo $domain; 
?>/themes/gforge/images/tabs/bottomright-inner.png" height="11" width="11" 
alt="" /></td>
                        </tr>
                        </table>

                <!-- end inner body row -->

                </td>
                <td width="10" bgcolor="#E0E0E0"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="2" height="1" alt="" /></td>
        </tr>
        <tr>
                <td align="left" bgcolor="#E0E0E0" width="9"><img src="<?php 
echo $domain; ?>/themes/gforge/images/tabs/bottomleft.png" height="9" width="9" 
alt="" /></td>
                <td bgcolor="#E0E0E0" colspan="3"><img src="<?php echo $domain; 
?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
                <td align="right" bgcolor="#E0E0E0" width="9"><img src="<?php 
echo $domain; ?>/themes/gforge/images/tabs/bottomright.png" height="9" 
width="9" alt="" /></td>
        </tr>
</table>

<!-- PLEASE LEAVE "Powered By GForge" on your site -->
<br />
<center>
<a href="http://gforge.org/";><img src="http://gforge.org/images/pow-gforge.png"; 
alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
</center>


</body>
</html>

Index: usergroup.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/cvs-cron/usergroup.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- usergroup.php       16 Apr 2004 17:45:52 -0000      1.10
+++ usergroup.php       19 Apr 2004 19:57:39 -0000      1.11
@@ -1,6 +1,14 @@
 #! /usr/bin/php4 -f
 <?php
+/*
+
+This file creates user / group permissions by editing 
+the /etc/passwd /etc/shadow and /etc/group files
 
+It also creates blank user home directories and 
+creates a group home directory with a template in it.
+
+*/
 require_once('squal_pre.php');
 require ('common/include/cron_utils.php');
 
@@ -202,6 +210,57 @@
        system("chown $user:".USER_DEFAULT_GROUP." /home/".$user);
 }
 
+
+//
+//     Create home dir for groups
+//
+foreach($groups as $group) {
+       if (is_dir($groupdir_prefix."/".$group)) {
+
+       } else {
+               @mkdir($groupdir_prefix."/".$group);
+               $g =& group_get_object_by_name($group);
+
+               //
+               //      Read in the template file
+               //
+               $fo=fopen('default_page.php','r');
+               $contents = '';
+               while (!feof($fo)) {
+               $contents .= fread($fo, 8192);
+               }
+               fclose($fo);
+               //
+               //      Change some defaults in the template file
+               //
+               $contents=str_replace('<domain>',$sys_default_domain,$contents);
+               
$contents=str_replace('<project_description>',$g->getDescription(),$contents);
+               
$contents=str_replace('<project_name>',$g->getPublicName(),$contents);
+               $contents=str_replace('<group_id>',$g->getID(),$contents);
+               
$contents=str_replace('<group_name>',$g->getUnixName(),$contents);
+
+               //
+               //      Write the file back out to the project home dir
+               //
+               $fw=fopen($groupdir_prefix."/".$group."/index.php",'w');
+               fwrite($fw,$contents);
+               fclose($fw);
+               
+       }
+       $resgroupadmin=db_query("SELECT u.user_name FROM users u,user_group 
ug,groups g
+               WHERE u.user_id=ug.user_id 
+               AND ug.group_id=g.group_id 
+               AND g.unix_group_name='$group'
+               AND ug.admin_flags='A'
+               AND u.status='A'");
+       if (!$resgroupadmin || db_numrows($resgroupadmin) < 1) {
+               //group has no members, so cannot create dir
+       } else {
+               $user=db_result($resgroupadmin,0,'user_name');
+               system("chown $user:$group $groupdir_prefix/$group");
+       }
+}
+
 cron_entry(16,$err);
 
 ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]