示例#1
0
文件: common.php 项目: Gutza/LPC
function exposeDirClasses($dir)
{
	$result=array(
		'name'=>array(),
		'formal'=>array(),
	);
	$d = dir($dir);
	while (false !== ($entry = $d->read())) {
		$fname=$dir."/".$entry;
		$class=substr($entry,0,-4);

		// First skip filesystem entries and known auxiliary classes
		if (!validClassFile($fname) || !validClassName($class))
			continue;

		// Second, skip abstract classes
		$cr=new ReflectionClass($class);
		if ($cr->isAbstract())
			continue;

		// Next, skip classes you don't have the right to
		if (!validateClassRights($class))
			continue;

		// Finally, skip internationalization children
		$instance=new $class();
		if (isset($instance->user_fields['i18n_parent']))
			continue;

		// Record everything else for display
		$result['name'][]=$class;
		$result['formal'][]=getFormalName($class);
	}
	$d->close();
	return $result;
}
示例#2
0
文件: objectMany.php 项目: Gutza/LPC
$p=LPC_Page::getCurrent();
$p->title=_LS('scaffoldingTitle');
$p->st();

/*
$p->head->a(new LPC_HTML_script(LPC_js."/jquery.js"));
$p->head->a(new LPC_HTML_script(LPC_js."/LPC_scaffolding.js"));
*/

if (empty($_GET['c'])) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedClass')));
	return;
}

$class=$_GET['c'];
if (!validClassName($class) || !validateClassRights($class)) {
	$p->a(new LPC_HTML_error(_LH('genericErrorRights')));
	return;
}

$rObj=new $_GET['rc']($_GET['rid']);
if (isset($_GET['caid'])) {
	$rObj->createLink($_GET['rd'],$_GET['caid']);
	header("Location: ".LPC_URI::getCurrent()->delVar('caid')->toString());
	exit;
}
if (isset($_GET['crid'])) {
	$rObj->dropLink($_GET['rd'],$_GET['crid']);
	header("Location: ".LPC_URI::getCurrent()->delVar('crid')->toString());
	exit;
}
示例#3
0
文件: dropLink.php 项目: Gutza/LPC
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedDependency')));
	return;
}
$rd=$_GET['rd'];

if (empty($_GET['rc'])) {
	$p->a(new LPC_HTML_error(__LH('scaffoldingErrorNeedClass')));
	return;
}
$rclass=$_GET['rc'];

if (empty($_GET['rid'])) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedID')));
	return;
}
$rid=$_GET['rid'];

if (
	!validClassName($rclass) ||
	!($robj=new $rclass($rid)) ||
	!$robj->hasScaffoldingRight('D') // there should be a separate right for adding/dropping links
) {
	$p->a(new LPC_HTML_error(_LH('genericErrorRights')));
	return;
}

$obj->dropLink($rd, $robj);
header("Location: ".$_GET['rt']);
exit;

示例#4
0
elseif (isset($_GET['c']))
	$class=$_GET['c'];
else {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedClass')));
	return;
}

$id=0;
if (isset($_GET['id']))
	$id=$_GET['id'];
if (!$id) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedId')));
	return;
}
if (
	!validClassName($class) ||
	!($obj=new $class($id)) ||
	!$obj->hasScaffoldingRight('F')
) {
	$p->a(new LPC_HTML_error(_LH('genericErrorRights')));
	return;
}
if (!isset($_GET['file'])) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedFile')));
	return;
}
$fileKey=$_GET['file'];
if (!$obj->isValidFile($fileKey)) {
	$p->a(new LPC_HTML_error(_LH('scaffoldingErrorNeedValidFile',$fileKey)));
	return;
}