/**
  * Constructor
  * 
  * initializes {@link $title}
  * @param string $title the title of the page, normally something is added before this title
  * @param boolean $cachable whether the page disables browser caching with Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 and Pragma: no-cache headers (default: false)
  * @param boolean $robots whether the page allows robots (meta tag) (default: false)
  * @deprecated $delegate PageDelegate can only be set by config.php $CLASS_POSING_ARRAY
  */
 function Page($title, $cachable = FALSE, $robots = FALSE)
 {
     $this->preHeaderSections = array();
     $this->postHeaderSections = array();
     $this->bodyAttributes = array();
     $this->showFooter = TRUE;
     $this->delegate = Page::newPage('PageDelegate', $title, $cachable, $robots);
 }
Example #2
0
 *  Lists address book entries. This is the main page that is displazed as default after login.
 *
 */
chdir('..');
require_once 'lib/init.php';
require_once 'PageList.class.php';
require_once 'StringHelper.class.php';
require_once 'HTMLBeautifier.class.php';
require_once 'ErrorHandler.class.php';
// Is someone logged in? Terminate if not
$rightsManager = RightsManager::getSingleton();
// Allowed to view list
if (!$rightsManager->currentUserIsAllowedTo('view-list')) {
    $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
if (!isset($_GET['group']) || $_GET['group'] == 'hidden' && !$_SESSION['user']->isAtLeast('admin')) {
    $_GET['group'] = '';
}
if (!isset($_GET['begin'])) {
    $_GET['begin'] = '';
}
if (!isset($_GET['page'])) {
    $_GET['page'] = 0;
}
if (!isset($_GET['expand'])) {
    $_GET['expand'] = 0;
}
$page = Page::newPage('PageList', StringHelper::cleanGPC($_GET['group']), $_GET['expand'], StringHelper::cleanGPC($_GET['begin']), intval(StringHelper::cleanGPC($_GET['page'])));
//echo HTMLBeautifier::beautify($page->create());
echo $page->create();
exit;
<?php

// jEdit :folding=indent: :collapseFolds=1: :noTabs=true:
/**
* Shows a feature/rank list where 'feature' is any property label for example 
* from Additional Information, but you could sort by date too. Then sorts by value.
* This thingy can be popped in instead of the contact/changedlist.php
*
* NO SECURITY! ALWAYS will display a name and the feature. 
* The links to contacts cannot be followed if not logged in.
*/
chdir('..');
require_once 'lib/init.php';
require_once 'PageFeatureList.class.php';
// currently this will look for properties with the label 'ELO'
$page = Page::newPage('PageFeatureList', 'ELO', false, 100);
// descending, limit 100
echo $page->create();
exit;
<?php

// jEdit :folding=indent: :collapseFolds=1: :noTabs=true:
/**
* Script to deliver a contact as div for ajax scripts. Uses class PageContact to generate all content.
*
*  GET:    id=123 ... id to be displayed
*
*  Output: div WITHOUT header and footer
*
* @author Thomas Katzlberger
* @package default
*/
chdir('..');
require_once 'lib/init.php';
require_once "PageContact.class.php";
if (!isset($_GET['id'])) {
    $errorHandler->standardError('PARAMETER_MISSING', basename($_SERVER['SCRIPT_NAME']));
    exit(0);
}
// SECURITY
$contact = Contact::newContact(intval($_GET['id']));
$rightsManager = RightsManager::getSingleton();
if (!$rightsManager->currentUserIsAllowedTo('view', $contact)) {
    $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
$p = Page::newPage('PageContact', $contact, isset($_GET['noxslt']));
// checks view permissions
echo $p->innerCreate();
 *  contact/searchlist.php
 *  Lists address book entries from a query in the same format as the main list.
 *  Has a mailing-list function.
 *
 *************************************************************/
chdir('..');
require_once 'lib/init.php';
require_once 'PageSearchList.class.php';
require_once 'StringHelper.class.php';
require_once 'HTMLBeautifier.class.php';
require_once 'ErrorHandler.class.php';
// Is someone logged in? Terminate if not
if (!isset($_SESSION['user']) || !$_SESSION['user']->isAtLeast('guest')) {
    $errorHandler->standardError('NOT_LOGGED_IN', basename($_SERVER['SCRIPT_NAME']));
}
if (!isset($_GET['group']) || $_GET['group'] == 'hidden' && !$_SESSION['user']->isAtLeast('admin')) {
    $_GET['group'] = '';
}
if (!isset($_GET['search'])) {
    $_GET['search'] = '';
}
if (!isset($_GET['type'])) {
    $_GET['type'] = '';
}
if (!isset($_GET['expand'])) {
    $_GET['expand'] = 0;
}
// contact/searchlist.php?search=string&type=[name|www|chat|...]
$page = Page::newPage('PageSearchList', StringHelper::cleanGPC($_GET['search']), StringHelper::cleanGPC($_GET['type']), StringHelper::cleanGPC($_GET['expand']));
echo $page->create();
exit;
<?php

// jEdit :folding=indent: :collapseFolds=1: :noTabs=true:
/**
* Shows the import interface. Curretly no security (only after post).
*/
chdir('../../');
// goto main directory
require_once 'lib/init.php';
require_once 'plugins/Import/PageImport.class.php';
$page = Page::newPage('PageImport');
echo $page->create();
exit;
 /**
  * create the table containing the contacts
  *
  * @uses Contact
  * @return string html-content
  * @uses TableGenerator
  */
 function createTable()
 {
     // create big table
     $contacts = $this->contactList->getContacts();
     $mailtohref = '';
     // email link
     $data = array();
     $htmlId = 0;
     foreach ($contacts as $c) {
         if ($this->expand) {
             $p = Page::newPage('PageContact', $c);
             $data[] = array('cont' => $p->innerCreate(), 'css_class' => 'list-expanded-card', 'group_n' => $groupNormalizer->normalize(mb_substr($c->contact['lastname'], 0, 1)));
             continue;
         }
         // fetch first email ...
         $mails = $c->getValueGroup('email');
         $e = EmailHelper::sendEmailHref($c->rawEmail($mails[0]));
         $mailtohref .= $e . ',';
         $r = $c->generateListRowArray();
         //$r[] = "<input type='checkbox' checked=1 name='$e' id='cx$htmlId' onchange='generateMailto();'/>";
         $data[] = $r;
         $htmlId++;
     }
     $tGen = new TableGenerator('contact-list');
     $cont = '<table class="contact-list">';
     //$cont .= '<caption>' . $this->contactList->getGroupCaption() . '</caption>';
     if (count($data) > 0) {
         if ($this->expand) {
             $cont .= $tGen->generateBody($data, array('cont'), 'css_class', $this->isSorted ? 'group_n' : null);
         } else {
             $cont .= $tGen->generateBody($data, range(0, count($data[0]) - 3), 'css_class', $this->isSorted ? 'group_n' : null);
         }
     } else {
         $cont .= '<tr class="noentry"><td>No Entries.</td></tr>';
     }
     $cont .= '</table>';
     //$this->nav->addEntry('mailtoSelected','mail to selected',"mailto:$mailtohref");
     return $cont;
 }
<?php

// jEdit :folding=indent: :collapseFolds=1: :noTabs=true:
/**
* Shows the expanded recently changed list
*/
chdir('..');
require_once 'lib/init.php';
require_once 'PageChangedList.class.php';
// Is someone logged in?
if (!isset($_SESSION['user']) || !$_SESSION['user']->isAtLeast('guest')) {
    $errorHandler->standardError('NOT_LOGGED_IN', basename($_SERVER['SCRIPT_NAME']));
}
$page = Page::newPage('PageChangedList', true);
echo $page->create();
exit;
        }
        if (!empty($contact->contact['whoModified'])) {
            if ($_SESSION['user']->isAtLeast('user')) {
                $sender = $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $_SESSION['user']->contact['id'];
            } else {
                $sender = 'guest login';
            }
            $who = new User(intval($contact->contact['whoModified']));
            $who->sendEMail('Incorrect Entry', "A user ({$sender}) reported this contact as incorrect.\nPlease carefully verify the following contact:\n" . $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $contact->contact['id']);
        } else {
            $errorHandler->warning('No user has ever edited the contact. Please contact an administrator for help.');
        }
        $page = Page::newPage('PageContact', intval($_GET['id']), isset($_GET['noxslt']));
        break;
    default:
        // view contact
        if (isset($_GET['id'])) {
            $contact = Contact::newContact(intval($_GET['id']));
            $rightsManager = RightsManager::getSingleton();
            if (!$rightsManager->currentUserIsAllowedTo('view', $contact)) {
                $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
            }
            $page = Page::newPage('PageContact', intval($_GET['id']), $enableXSLTProcessing);
        } else {
            $errorHandler->error('invArg', 'No id is given');
        }
        // fatal error - will exit
        break;
}
echo $page->create();
exit;
 /**
  * create the table containing the contacts
  *
  * @uses Contact
  * @return string html-content
  * @global GroupNormalizer used to modify the contact names, in order to get them correctly grouped
  * @uses TableGenerator
  */
 function createTable()
 {
     global $groupNormalizer;
     // create big table
     $contacts = $this->contactList->getContacts();
     $data = array();
     foreach ($contacts as $c) {
         if ($this->expand) {
             $p = Page::newPage('PageContact', $c);
             $data[] = array('cont' => $p->innerCreate(), 'css_class' => 'list-expanded-card', 'group_n' => $groupNormalizer->normalize(mb_substr($c->contact['lastname'], 0, 1)));
             continue;
         }
         $data[] = $c->generateListRowArray();
     }
     $tGen = new TableGenerator('contact-list');
     $cont = '<table class="contact-list">';
     $cont .= '<caption>' . $this->contactList->getGroupCaption() . '</caption>';
     if (count($data) > 0) {
         if ($this->expand) {
             $cont .= $tGen->generateBody($data, array('cont'), 'css_class', 'group_n');
         } else {
             $cont .= $tGen->generateBody($data, range(0, count($data[0]) - 3), 'css_class', 'group_n');
         }
     } else {
         $cont .= '<tr class="noentry"><td>No Entries.</td></tr>';
     }
     $cont .= '</table>';
     return HTMLHelper::createNestedDivBoxModel('contact-list', $cont);
 }
Example #11
0
        header("Location: " . $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $_SESSION['user']->contact['id']);
        exit;
    }
    // Remove single quotes which come from $db->escape
    $goTo = mb_substr($db->escape(StringHelper::cleanGPC($_POST['goTo'])), 1, -1);
    // Search the database
    $cList = new ContactList('SELECT *
        FROM ' . TABLE_CONTACT . ' AS contact
        WHERE 
        (
            CONCAT(firstname,\' \', lastname) LIKE \'%' . $goTo . '%\' OR
            CONCAT(firstname,\' \', middlename,\' \', lastname) LIKE \'%' . $goTo . '%\' OR
            nickname LIKE \'%' . $goTo . '%\' OR
            CONCAT(lastname,\', \',firstname) LIKE \'%' . $goTo . '%\'
        )
        AND (hidden = 0 OR ' . $db->escape($_SESSION['user']->isAtLeast('admin')) . ')
        ORDER BY lastname ASC, firstname ASC');
    // if theres only one contact, show it
    if (count($cList->getContacts()) == 1) {
        // redirect to the page to have a valid URL in the window
        $conts = $cList->getContacts();
        header("Location: " . $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $conts[0]->contact['id']);
        //$page = Page::newPage('PageContact',$conts[0],isset($_GET['noxslt']));
        //echo $page->create();
        exit;
    }
    // else: show the page with a list of the contacts
    $page = Page::newPage('PageSearchResult', $cList);
    echo $page->create();
}
exit;
        $_POST['URLtoMugshot'] = isset($_FILES['contact']['tmp_name']['pictureData']['file']) ? $_FILES['contact']['tmp_name']['pictureData']['file'] : null;
        // pic upload error!!
        if (!empty($_FILES['contact']['name']['pictureData']['file']) && empty($_FILES['contact']['tmp_name']['pictureData']['file'])) {
            $errorHandler->warning('File upload failed! Error code (6 means tmp directory not writeable): ' . $_FILES['contact']['error']['pictureData']['file'], basename($_SERVER['SCRIPT_NAME']));
        }
        $save = $contact->saveContactFromArray($_POST);
        break;
    case 'contact':
        if ($_POST['duplicateContact'] == 1) {
            unset($contact->contact['id']);
            foreach ($_POST['address'] as &$x) {
                unset($x['refid']);
            }
        }
        $_POST['URLtoMugshot'] = isset($_FILES['contact']['tmp_name']['pictureData']['file']) ? $_FILES['contact']['tmp_name']['pictureData']['file'] : null;
        // pic upload error!!
        if (!empty($_FILES['contact']['name']['pictureData']['file']) && empty($_FILES['contact']['tmp_name']['pictureData']['file'])) {
            $errorHandler->warning('File upload failed! Error code (6 means tmp directory not writeable): ' . $_FILES['contact']['error']['pictureData']['file'], basename($_SERVER['SCRIPT_NAME']));
        }
        $save = $contact->saveContactFromArray($_POST);
        break;
}
if ($save) {
    $errorHandler->success('Successfully saved: ' . $contact->generateFullName('text'));
    $p = Page::newPage('PageContact', $contact->contact['id'], isset($_GET['noxslt']));
    echo $p->create();
} else {
    $errorHandler->success('Failed to save: ' . $contact->generateFullName('text'));
    $p = Page::newPage('PageContactEdit', $contact->contact['id'], isset($_GET['noxslt']));
    echo $p->create();
}
    static function Constructor()
    {
        URLm::define("folderView", "?directory=%{(urlencode)dir}%");
        URLm::define("fileView", "?directory=%{(urlencode)filePath}%&PageID=file");
        URLm::define("proc", "?directory=%{(urlencode)dir}%&proc=%{procName}%");
        URLm::define("procVar", "?directory=%{(urlencode)dir}%&proc=%{procName}%&var=%{variable}%");
        URLm::define("procFile", "?directory=%{(urlencode)dir}%&proc=%{procName}%&PageID=file");
        URLm::define("procFileVar", "?directory=%{(urlencode)dir}%&proc=%{procName}%&PageID=file&var=%{variable}%");
        URLm::define("upload", "?PageID=upload&directory=%{(urlencode)dir}%");
        URLm::define("imgCache", "?__VM__=%{(urlencode)file}%");
        URLm::define("fileEditor", "?PageID=FileEditor&directory=%{(urlencode)file}%");
        Html::addObject("div", "Title", array("class" => "title"), "%{Title}%");
        Html::addObject("div", "List", array("class" => "list"), "%{Content}%");
        Html::addObject("div", "ListSubmit", array("class" => "listSubmit"), "%{Content}%");
        Html::addObject("div", "NoFavMsg", array("class" => "list", "style" => "text-align: center;"), '<h2>Boş</h2>');
        Html::addObject("div", "DirListSC", array("class" => "list", "style" => "padding: 4px;"), '
			<table style="width: 100%; padding: 0; margin: 0;">
				<td style="width: 50%; padding: 2px;">
					<a href="%eval{return URLm::url("folderView", array("dir" => "%{dir}%"));}%">
						%{dirname}%
					</a>
				</td>
				<td style="width: 50%; background: #444; padding: 3px; border-radius: 5px;">
					<input type="text" value="%{dir}%" style="border: 0px; background: 0px; padding: 0px; margin: 0px; width: 100%; color: #fff; padding: 5px;" />
					<!-- <span style="color: #fff;">%eval{$string = "%{dir}%"; if(strlen($string) >= 12) $string = substr($string, 0, 10)."..."; return $string;}%</span> -->
				</td>
			</table>
			');
        Html::addObject("div", "DirList", array("class" => "list", "onMouseOver" => "writeExtras('%{dirname}%', {inner: '%eval{ return (count(scandir('%{(addSlashes)dir}%')) - 2);}% içerik bulunuyor, CHMOD %eval{ return substr(sprintf('%o', fileperms('%{(addSlashes)dir}%')), -4);}% olarak tanımlandı'})", "onMouseOut" => "eraseExtras('%{dirname}%')"), '
			%{extras}%<a href="%eval{return URLm::url("folderView", array("dir" => "%{(addSlashes)dir}%"));}%" onClick="eraseExtras(\'%{dirname}%\')">%{dirname}%</a>
			<div id="extras%{dirname}%"></div>
		');
        Html::addObject("div", "FileList", array("class" => "list", "onMouseOver" => "writeExtras('%{filename}%', {inner: '%eval{ return date(\"Y-m-d H:i\", filectime('%{(addSlashes)filePath}%'));}% tarihinde oluşturuldu, CHMOD %eval{ return substr(sprintf('%o', fileperms('%{(addSlashes)filePath}%')), -4);}% olarak tanımlandı'})", "onMouseOut" => "eraseExtras('%{filename}%')"), '
			%{extras}%
			<a href="%eval{return URLm::url("fileView", array("filePath" => "%{filePath}%"));}%" onClick="eraseExtras(\'%{filename}%\')">%{filename}%</a>
			<small>%{size}%</small>
			<div id="extras%{filename}%"></div>
		');
        Html::addObject("div", "FileListImg", array("class" => "list"), '<table style="width: 100%;">
				<td style="width: 25%; text-align: center;">
					<img src="%{img}%" style="max-width: 110px;" />
				</td>
				<td>
					%{extras}%
					<a href="%eval{return URLm::url("fileView", array("filePath" => "%{filePath}%"));}%">%{filename}%</a> <small>%{size}%</small>
					<br />
					%{resolution}%
				</td>
			</table>
			');
        Html::addObject("div", "FileListMusic", array("class" => "list"), '<table style="width: 100%;">
				<td style="width: 5%; text-align: center; vertical-align: middle;">
					%{extras}%
				</td>
				<td style="text-align: center;">
					<a href="%eval{return URLm::url("fileView", array("filePath" => "%{filePath}%"));}%"><big>%{filename}%</big></a> <small>%{size}%</small>
					<br />
					<audio  style="width: 80%;" controls>
						<source src="%{source}%" />
						Tarayıcınız bu özelleği desteklemiyor
					</audio>
				</td>
			</table>
			');
        Html::addObject("div", "FileInfo", array("class" => "list"), '
			<table style="width: 100%;">
				<td style="width: 50%;">
					<span style="color: #000; font-weight: bold;">%{info}%</span>
				</td>
				<td  style="width: 50%;">
					<span style="color: #000;">%{value}%</span>
				</td>
			</table>
			');
        Html::addObject("div", "Success", array("class" => "green"));
        Html::addObject("div", "Error", array("class" => "red"));
        Html::addObject("div", "Info", array("class" => "brown"));
        Html::cloneObject("FileInfo", "DirInfo");
        Html::editObject("DirInfo", array("style" => ""), ARG);
        Page::newPage("Top", '
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<head>

		<title>%{Title}%</title>
		<link rel="stylesheet" href="%{CSSFile}%" />
		<script language="javascript" src="' . Settings::get("FunctionsFile") . '"></script>
		%{HeadExtras}%
	</head>
	<body>
		%{BodyTop}%
		%{Body}%
		%{BodyBottom}%
			');
        Page::newPage("Shortcuts", '
		<div class="header">
			<table style="width: 100%;">
				<td>
					<a href="index.php">
						<span style="font-size: 20px; font-weight: bold;">
							%{SiteName}%
						</span>
					</a>
				</td>
				<td style="text-align: right;" id="scLinks">
					%{ShortcutsLinks}%
				</td>
			</table>
		</div>
		<div style="margin-left: 5%; margin-right: 5%;">
			<table style="width: 100%; padding: 3px; vertical-align: top;">
				<td style="left: 0; right: 72%; vertical-align: top; position: fixed; overflow: auto; top: 50px; bottom:40px; margin-left: 30px;">
					%{Contents}%
				</td>
				<td style="left: 28%; vertical-align: top; position: fixed; overflow: auto; top: 50px; bottom: 40px; right: 0; margin: 30px; margin-top: 0px; margin-bottom: 0px;">
		');
        Page::newPage("Bottom", '
					%{Extras}%
				</td>
			</table>
			<div class="foot">
				<table style="width: 100%;">
					<td style="text-align: left;">	
						%{DirNavigation}%
					</td>
					<td style="text-align: right;">
						veli.tasali@gmail.com • Veli TASALI Web Applications Programming
					</td>
				</table>
			</div>
		</div>
	</body>
</html>
		');
        Page::newPage("editor", '
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<head>
		<title>%{Title}%</title>
		<link rel="stylesheet" href="%{CSSFile}%" />
		%{HeadExtras}%
		<script type="text/javascript">
			var isUsed = false;
			
			function sendEditForm()
			{
				if (isUsed == true)
				{
					alert("Zaten kaydettiniz veya kaydediyorsunuz. Lütfen yeniden düzenlemek için yenileyin.");
					return false;
				}
				else
					isUsed = true;
				
				document.forms.editForm.fileContents.value = encodeURI(document.forms.editForm.fileContents.value);
				document.forms.editForm.submit();
			}
		</script>
	</head>
	<body>
		<div style="position: fixed; left: 0; right: 0; top: 0; bottom: 0;">
			<div class="title" style="margin: 0; padding: 10px; border-radius: 0; text-align: left; border: 0px;">
				<table style="width: 100%;">
					<td>
						<big>%eval{return basename("%{File}%");}% - Düzenle</big>
					</td>
					<td style="text-align: right;">
						<a onClick="javascript:alert(\'Dosyaları kaydederken slaşlar (/,\\\\) ve benzeri karakterler sorun çıkarabilmektedir. Bizde bunun sorunu gidermek için form gönderilmeden önce metin alanının değerini URL Şifreleme yöntemi ile değiştirtmekteyiz (encodeURI (Javascript)).  Bu nedenle form gönderilirken karakterlerin değişmesi çok doğaldır.\');">Dikkat!</a>
						 &nbsp; &nbsp; 
						<a onClick="javascript:window.close();">Kapat</a>
						 &nbsp; &nbsp; 
						<button onClick="sendEditForm()">Kaydet</div>
					</td>
				</table>
			</div>
			<form style="width: 100%; height: 100%; text-align: center;" name="editForm" method="post" action="%eval{return URLm::url("fileEditor", array("file" => "%{File}%"));}%">
				<textarea style="margin: 0; padding: 0px; border: 0px; width: 100%; height: 90%;" name="fileContents">%eval{return file_get_contents("%{File}%");}%</textarea>
			</form>
		</div>
	</body>
</html>
		');
    }