Example #1
0
	/**
	* Returns a copy of the current URI
	*
	* @return object a LPC_URI instance representing the current URI
	*/
	public static function getCurrent()
	{
		if (empty(self::$currentInstance))
			self::$currentInstance = new LPC_URI();

		return self::$currentInstance->dupe();
	}
Example #2
0
function rbr($row,&$rowData)
{
	global $obj, $rObj;
	$td=new LPC_HTML_node('td');
	$row->a($td);
	$cid=$rowData[$obj->dataStructure['id_field']];
	if ($rObj->createLink($_GET['rd'],$cid,1)) {
		$url = LPC_URI::getCurrent()->setVar('crid', $cid)->toString();
		$td->a("[<a href='".$url."'>"._LS('scaffoldingRemoveThis')."</a>]");
	} else {
		$url = LPC_URI::getCurrent()->setVar('caid', $cid)->toString();
		$td->a("[<a href='".$url."'>"._LS('scaffoldingAddThis')."</a>]");
	}
	return true;
}
Example #3
0
	public function prepare()
	{
		$this->ownerDocument->content['head']->content['LPC list filter CSS']=new LPC_HTML_link('stylesheet','text/css',LPC_css."/LPC_list_filter.css");

		$default=addslashes($this->getCurrentValue());

		$form=new LPC_HTML_form(false,'get');
		$this->searchForm=$form;
		$this->a($form);
		foreach($_GET as $key=>$value) {
			if ($key==$this->GET_key)
				continue;
			$form->a("<input type='hidden' name='$key' value=\"".addslashes($value)."\">");
		}

		$table=new LPC_HTML_node('table');
		$table->setAttr('class','table_filter');
		$form->a($table, 'filterTable');

		$tr=new LPC_HTML_node('tr');
		$table->a($tr, 'filterTR');

		$td=new LPC_HTML_node('td');
		$td->setAttr('class','table_filter');
		$tr->a($td, 'filterTD');
		$td->a("<input type='hidden' name='".$this->listObject->getParam('p')."' value='1'>");

		$td=new LPC_HTML_node('td');
		$td->setAttr('class','table_filter');
		$tr->a($td, 'filterControls');
		$td->a(
			"<button type='submit' style='border: none; background: none; padding: 0px'>".
			$this->getIcon("search", _LS('lpcFilterIcon'))."
			</button>"
		);
		if (strlen($default))
			$td->a(
				"<a href='".LPC_URI::getCurrent()->delVar($this->GET_key)->toString()."'>".
				$this->getIcon("remove", _LS('lpcRemoveFilterIcon')).
				"</a>"
			);

		if (isset($this->helpKey)) {
			$td->a(
				"<a href='#' onClick='alert(".self::JS_translation_var.".".$this->helpKey."); return false;'>".
				$this->getIcon("info").
				"</a>"
			);
			if (!isset($this->ownerDocument->content['head']->content['JS_help_'.$this->helpKey])) {
				$js=new LPC_HTML_script();
				$this->ownerDocument->content['head']->content['JS_help_'.$this->helpKey]=$js;
				$js->a("
if (typeof ".self::JS_translation_var." == 'undefined')
	var ".self::JS_translation_var." = {};
".self::JS_translation_var.".".$this->helpKey."=\"".str_replace("\n","\\n",str_replace("\r","",addslashes(_LS($this->helpKey))))."\";
				");
			}
		}
	}
Example #4
0
	function populateHeader($keys)
	{
		$sortInfo=$this->getSortInfo();
		$sortParam=$this->getParam('s');
		$orderParam=$this->getParam('o');
		$filterBase=$this->getParam('f');

		$row=new LPC_HTML_node("tr");
		foreach($keys as $key) {
			if (in_array($key, $this->hiddenFields))
				continue;
			$cell=new LPC_HTML_node("th");
			$cell->setAttr('style', 'vertical-align: top');
			$cell->compact=true;

			$newOrder=0;
			$icon=NULL;

			if ($sortInfo['sort']==$key) {
				if ($sortInfo['order'])
					$order = "up";
				else {
					$order = "down";
					$newOrder=1;
				}
				$icon = $this->getIcon($order);
			}

			if (isset($this->labelMapping[$key]))
				$labelText=$this->labelMapping[$key];
			else
				$labelText=$key;

			if (in_array($key, $this->legalSortKeys)) {
				$label=new LPC_HTML_node("a");
				$label->setAttr('href',
					LPC_URI::getCurrent()->setVars(array(
						$sortParam => $key,
						$orderParam => $newOrder,
					))
				);
			} else
				$label=new LPC_HTML_node("span");

			$label->content=$labelText;
			$cell->a($label, 'label');

			if ($icon) {
				$cell->a(" ");
				$cell->a($icon, 'sortIcon');
			}

			if (isset($this->filters->content[$key]))
				$cell->a($this->filters->content[$key]);

			if ($this->onProcessHeaderCell($key, $cell))
				$row->a($cell);
		}

		if ($this->onProcessHeaderRow($row))
			$this->thead->a($row);
	}
Example #5
0
require LPC_include."/LPC_intl.php";
require LPC_include."/LPC_config.php";

if (LPC_GUI)
	require LPC_include."/LPC_icons.php";

if (LPC_GUI_OB)
	ob_start();

if (
	getenv("LPC_auth") &&
	isset($_SERVER['REMOTE_ADDR']) && // not for CLI
	!LPC_User::getCurrent(true) &&
	($usr=LPC_User::newUser()) && // lazy instantiation
	LPC_URI::getCurrent()->getPath() != $usr->recoverPasswordURL() &&
	LPC_URI::getCurrent()->getFullPath() != $usr->processTokenBaseURL()
)
	LPC_User::getCurrent();

function LPC_prefill(&$array, $values)
{
	$count=0;
	foreach($values as $key=>$value) {
		if (array_key_exists($key, $array))
			continue;
		$array[$key]=$value;
		$count++;
	}
	return $count;
}
Example #6
0
	public function switchSSL($enable)
	{
		$uri = new LPC_URI($this->getAttr('action'));
		$this->setAttr('action', $uri->switchSSL($enable));
	}
Example #7
0
File: common.php Project: Gutza/LPC
<?php

$u=LPC_User::getCurrent();

if (isset($_GET['langID'])) {
	$lang=new LPC_Language();
	$lang->fromKey($_GET, 'langID');
	if ($lang->id) {
		LPC_Language::setCurrent($lang);
		header("Location: ".LPC_URI::getCurrent()->delVar('langID')->toString());
		exit;
	}
}
$langSelect=new LPC_HTML_node('div');
$langSelect->setAttr('style','float: right');
$langSelect->a(_LH('scaffoldingSelectLang')." ");

$langs=new LPC_HTML_select();
$langSelect->a($langs);
$langObjs=new LPC_Language();
$langObjs=$langObjs->search(NULL,NULL,'name');
foreach($langObjs as $langObj)
	$langs->addOption($langObj->getAttr('name'),$langObj->id);
$langs->setAttr('onChange',"window.location=location.pathname+location.search+(location.search?'&':'?')+'langID='+this.options[this.selectedIndex].value;");
$langs->selected=LPC_Language::getCurrent()->id;
LPC_Page::getCurrent()->a($langSelect);

function exposeDirClasses($dir)
{
	$result=array(
		'name'=>array(),