Location: PHPKode > scripts > OekakiPoteto > oekakipoteto/tdesign.php
<?
$decperms = fileperms(".");
$octalperms = sprintf("%o",$decperms);
$perms=(substr($octalperms,2));

if($perms != "777"){
	echo "You need to CHMOD your templates directory to 777 to create templates! Read the readme.txt file if you haven't figured out what other files you need to CHMOD.";
} else {
if($edittemplate=="edit"){
	include("templates/".$filename.".php");
	}
include('dbconn.php');
include('flagchk.php');
$result = mysql_query("SELECT usrname, usrflags FROM ".$OekakiPoteto_MemberPrefix."oekaki WHERE usrname='$OekakiU'");
@extract(mysql_fetch_array($result));
if ((!check_flag('O')) && (!check_flag('S')) && (!check_flag('A'))) {
	header('Location: error.php?error='.urlencode("You do not have the credentials to access the template designer."));
exit;
}

mysql_close($dbconn);
include('header.php');
?>
<html>
<p></p>
<br>
<table width="<?=$hWidth?>" cellpadding="<?=$hCellPadding?>" align="center">
  <tr>
    <td class="header"><?=$langop_template_edittemplate?></td>
  </tr>
  <tr> 
    <td><form name="form1" method="post" action="tdesign.php">
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="infotable">
          <tr> 
            <td><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="-1"> 
              <select name="filename" id="filename" class="multiline" style="width: 95%">
                <?	if ($handle = opendir('templates')) {
    
  		/* This is the correct way to loop over the directory. */
    		while (false !== ($file = readdir($handle))) { 
			if(substr($file,-4) == ".php"){ ?>
                <? if($file == $template) { ?>
<option value="<?=substr($file,0,-4)?>" selected><?=substr($file,0,-4)?></option>
                <? } else { ?>
                <option value="<?=substr($file,0,-4)?>"><?=substr($file,0,-4)?></option>
                <?
		}
			}
		}
		
		closedir($handle); 
   	}?>
              </select>
              </font></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td><font face="Arial, Helvetica, sans-serif"> 
              <input name="edittemplate" type="submit" class="submit" id="edittemplate" value="edit">
              </font></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td> <font color="#FFFFFF"><a href="tnew.php"><?=$langop_templated_create?></a></font></td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
</table>
</body>
<? } include('footer.php'); ?>
Return current item: OekakiPoteto