function execute( $par ) {

		global $wgOut, $wgUser, $wgRequest;

		$wgOut->setPageTitle( wfMsg( 'ow_importtsv_title1' ) );
		if ( !$wgUser->isAllowed( 'importtsv' ) ) {
			$wgOut->addHTML( wfMsg( 'ow_importtsv_not_allowed' ) );
			return false;
		}
		
		$dbr = wfGetDB( DB_MASTER );
		$dc = wdGetDataSetcontext();
		$wgOut->setPageTitle( wfMsg( 'ow_importtsv_importing' ) );
		setlocale( LC_ALL, 'en_US.UTF-8' );
		if ( $wgRequest->getFileName( 'tsvfile' ) ) {
			
			// *****************
			//    process tsv
			// *****************

			require_once( 'WikiDataAPI.php' );
			require_once( 'Transaction.php' );
			
			$testRun = $wgRequest->getCheck( 'testrun' );
			
			// lets do some tests first. Is this even a tsv file? 
			// It is _very_ important that the file is utf-8 encoded.
			// also, this is a good time to determine the max line length for the 
			// fgetcsv function.
			$file = fopen( $wgRequest->getFileTempname( 'tsvfile' ), 'r' );
			$myLine = "";
			$maxLineLength = 0;
			while ( $myLine = fgets( $file ) ) {
				if ( !preg_match( '/./u', $myLine ) ) {
					$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
					$wgOut->addHTML( wfMsg( 'ow_importtsv_not_utf8' ) );
					return false;
				}
				$maxLineLength = max( $maxLineLength, strlen( $myLine ) + 2 );
			}
			
			// start from the beginning again. Check if the column names are valid
			rewind( $file );
			$columns = fgetcsv( $file, $maxLineLength, "\t" );
			// somehow testing for $columns[0] fails sometimes. Byte Order Mark?
			if ( !$columns || count( $columns ) <= 2 || $columns[1] != "defining expression" ) {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
				$wgOut->addHTML( wfMsg( 'ow_importtsv_not_tsv' ) );
				return false;
			}
			for ( $i = 2; $i < count( $columns ); $i++ ) {
				$columnName = $columns[$i];
				$baseName = substr( $columnName, 0, strrpos( $columnName, '_' ) );
				if ( $baseName == "definition" || $baseName == "translations" ) {
					$langCode = substr( $columnName, strrpos( $columnName, '_' ) + 1 );
					if ( !getLanguageIdForIso639_3( $langCode ) ) {
						$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
						$wgOut->addHTML( wfMsg( 'ow_impexptsv_unknown_lang', $langCode ) );
						return false;
					}
				}
				else { // column name does not start with definition or translations. 
						$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
						$wgOut->addHTML( wfMsg( 'ow_importtsv_bad_columns', $columnName ) );
						return false;
				}
				
			}
			
		
			//
			// All tests passed. lets get started
			//

			if ( $testRun ) {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_test_run_title' ) );
			}
			else {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_importing' ) );
			}
			
			startNewTransaction( $wgUser->getID(), wfGetIP(), "Bulk import via Special:ImportTSV", $dc );	# this string shouldn't be localized because it will be stored in the db

			$row = "";
			$line = 1; // actually 2, 1 was the header, but increased at the start of while
			$definitions = 0; // definitions added
			$translations = 0; // translations added

			while ( $row = fgetcsv( $file, $maxLineLength, "\t" ) ) {
				$line++;
				
				$dmid = $row[0];
				$exp = $row[1];
				
				// find the defined meaning record
				$qry = "SELECT dm.meaning_text_tcid, exp.spelling ";
				$qry .= "FROM {$dc}_defined_meaning dm INNER JOIN {$dc}_expression exp ON dm.expression_id=exp.expression_id ";
				$qry .= "WHERE dm.defined_meaning_id=$dmid ";
				$qry .= "AND " . getLatestTransactionRestriction( 'dm' );
				$qry .= "AND " . getLatestTransactionRestriction( 'exp' );
				
				$dmResult = $dbr->query( $qry );
				$dmRecord = null;
				// perfomr some tests
				if ( $dmRecord = $dbr->fetchRow( $dmResult ) ) {
					if ( $dmRecord['spelling'] != $exp ) {
						$wgOut->addHTML( "Skipped line $line: defined meaning id $dmid does not match defining expression. Should be '{$dmRecord['spelling']}', found '$exp'.<br />" );
						continue;
					}
				}
				else {
					$wgOut->addHTML( "Skipped line $line: unknown defined meaning id $dmid. The id may have been altered in the imported file, or the defined meaning or defining expression was removed from the database.<br />" );
					continue;
				}
				
				
				// all is well. Get the translated content id
				$tcid = $dmRecord['meaning_text_tcid'];
				
				
				for ( $columnIndex = 2; $columnIndex < count( $columns ); $columnIndex++ ) {
					
					// Google docs removes empty columns at the end of a row,
					// so if column index is higher than the length of the row, we can break
					// and move on to the next defined meaning.
					if ( columnIndex >= count( $row ) ) {
						break;
					}
					
					$columnValue = $row[$columnIndex];
					if ( !$columnValue ) {
						continue;
					}
				
					$columnName = $columns[$columnIndex];
					$langCode = substr( $columnName, strrpos( $columnName, '_' ) + 1 );
					$langId = getLanguageIdForIso639_3( $langCode );
					if ( strpos( $columnName, 'definition' ) === 0 ) {
						if ( !translatedTextExists( $tcid, $langId ) ) {
							if ( $testRun ) {
								$wgOut->addHTML( "Would add definition for $exp ($dmid) in $langCode: $columnValue.<br />" );
							} else {
								addTranslatedText( $tcid, $langId, $columnValue );
								$wgOut->addHTML( "Added definition for $exp ($dmid) in $langCode: $columnValue.<br />" );
								$definitions++;
							}
						}
					}
					if ( strpos( $columnName, 'translation' ) === 0 ) {
						$spellings = explode( '|', $columnValue );
						foreach ( $spellings as $spelling ) {
							$spelling = trim( $spelling );
							$expression = findExpression( $spelling, $langId );
							if ( !$expression ) { // expression does not exist
								if ( $testRun ) {
									$wgOut->addHTML( "Would add translation for $exp ($dmid) in $langCode: $spelling. Would also add new page.<br />" );
								}
								else {
									$expression = createExpression( $spelling, $langId );
									$expression->bindToDefinedMeaning( $dmid, 1 );

									// not nescesary to check page exists, createPage does that.
									$title = getPageTitle( $spelling );
									createPage( 16, $title );

									$wgOut->addHTML( "Added translation for $exp ($dmid) in $langCode: $spelling. Also added new page.<br />" );
									$translations++;
								}
							}
							else { // expression exists, but may not be bound to this defined meaning.
								if ( !$expression->isBoundToDefinedMeaning( $dmid ) ) {
									if ( $testRun ) {
										$wgOut->addHTML( "Would add translation for $exp ($dmid) in $langCode: $spelling.<br />" );
									}
									else {
										$expression->bindToDefinedMeaning( $dmid, 1 );
										$wgOut->addHTML( "Added translation for $exp ($dmid) in $langCode: $spelling.<br />" );
										$translations++;
									}
								}
							}
						}
					}
				}
			}
			
			if ( $definitions == 0 && $translations == 0 ) {
				$wgOut->addHTML( "<br />" );
				if ( $testRun ) {
					$wgOut->addHTML( wfMsg( 'ow_importtsv_nothing_added_test' ) );
				}
				else {
					$wgOut->addHTML( wfMsg( 'ow_importtsv_nothing_added' ) );
				}
				$wgOut->addHTML( "<br />" );
			}
			else {
				$wgOut->addHTML( "<br />" . wfMsgExt( 'ow_importtsv_results', 'parsemag', $definitions, $translations ) . "<br />" );
			}
				
		}
		else {
			// render the page
			$wgOut->setPageTitle( wfMsg( 'ow_importtsv_title2' ) );
			$wgOut->addHTML( wfMsg( 'ow_importtsv_header' ) );
			
			$wgOut->addHTML( getOptionPanelForFileUpload(
				array(
					wfMsg( 'ow_importtsv_file' ) => getFileField( 'tsvfile' ),
					wfMsg( 'ow_importtsv_test_run' ) => getCheckBox( 'testrun', true )
				)
			) );
		}

	}
Ejemplo n.º 2
0
?>
">
<input type="hidden" name="code" value="<?php 
echo $_REQUEST['code'];
?>
">
<input type="hidden" name="act" value="<?php 
echo $actImage;
?>
">
<input type="hidden" name="lang" value="<?php 
echo $_lang_A;
?>
">
<?php 
$pageindex = createPage(countRecord($tableImageId, $whereComment), './?act=' . $actImage . '&codeParent=' . $_REQUEST['codeParent'] . '&idComment=' . $_REQUEST['idComment'] . '&code_frame=' . $_REQUEST['code_frame'] . '&code_module=' . $_REQUEST['code_module'] . '&code=' . $_REQUEST['code'] . '&page=', $MAXPAGE, $page, '10', $_lang_A);
//phan trang
if ($_GET['code'] == 1) {
    $errMsg = ASUCCESSFULLY;
}
//kiem  tra cap nhat thanh cong hay chua
?>


<table cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<?php 
echo $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >Page :' . $pageindex . '</td>' : '';
?>
		<td height="30" align="right" valign="middle" class="smallfont">
		
Ejemplo n.º 3
0
        }
        $errMsg = "Đã xóa " . $cnt . " đơn hàng.<br><br>";
        $errMsg .= $cntNotDel > 0 ? 'Không thể xóa ' . $cntNotDel . ' đơn hàng, vì vẫn còn sản phẩm tồn tại trong chi tiết đơn hàng !' : $cntNotDel;
    } else {
        $errMsg = 'Hãy chọn trước khi xóa !';
    }
}
?>
<form method="POST" name="frmForm" action="./">
<input type="hidden" name="act" value="order">
<input type=hidden name="page" value="<?php 
echo $page;
?>
">
<?php 
$pageindex = createPage(countRecord("tbl_order", "1=1"), './?act=order"."&page=', $MAXPAGE, $page);
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr><td height="30" class="smallfont">Trang : <?php 
echo $pageindex;
?>
</td></tr>
</table>

<table border="1" cellpadding="2" bordercolor="#C9C9C9" width="100%">
	<tr>
		<th width="20" class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></th>
		<th width="20" class="title"></th>
		<th width="80" class="title">Chi tiết</th>
		<th width="20" class="title">ID</th>
$parentWhereConfig = '';
$errMsg = '';
$totalItems = countRecord($tableUser, $parentWhereConfig);
//FILE xoa mau tin
if (!$_SESSION['level'] < 2 and $_REQUEST['id'] != '4') {
    include 'delete.php';
}
//Update Order
include 'updateOrder.php';
//Update Show
include 'updateShow.php';
if ($_GET['code'] == 1) {
    $errMsg = 'Successfully updated.';
}
//kiem  tra cap nhat thanh cong hay chua
$pageindex = createPage(countRecord($tableUser, $parentWhereConfig), './?act=' . $actUser . '&codeParent=' . $_REQUEST['codeParent'] . '&name=' . $_REQUEST['name'] . '&ma=' . $_REQUEST['ma'] . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$pageindexHtml = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >Page :' . $pageindex . '</td>' : '';
if ($errMsg != '') {
    $errMsgHtml = '<p align=center class="err">' . $errMsg . '<br></p>';
}
$sql = "select *,DATE_FORMAT(date_added,'%d/%m/%Y %h:%i') as dateAdd,DATE_FORMAT(last_modified,'%d/%m/%Y %h:%i') as dateModify from {$tableUser}";
$result = @mysql_query($sql, $conn);
$i = 0;
while ($row = @mysql_fetch_array($result)) {
    $color = $i++ % 2 ? '#d5d5d5' : '#e5e5e5';
    if ($row['status'] == 0) {
        $showNotshow = " <a href=\"./?act=" . $actUser . "&action=notshow&codeParent=" . $_REQUEST['codeParent'] . "&id=" . $row['id'] . "&page=" . $_REQUEST['page'] . "&lang=" . $_lang_A . "\"><img border=\"0\" src=\"images/show.gif\" alt=\"" . TSHOW . "\" height=\"20\"/></a>";
    } else {
        $showNotshow = "<a href=\"./?act=" . $actUser . "&action=show&codeParent=" . $_REQUEST['codeParent'] . "&id=" . $row['id'] . "&page=" . $_REQUEST['page'] . "&lang=" . $_lang_A . "\"><img border=\"0\" src=\"images/notshow.gif\" alt=\"" . TNOTSHOW . "\" height=\"20\"/></a>";
    }
<?php

session_start();
// // Display any php errors (for development purposes)
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once __DIR__ . '/../../config.php';
// Include API Calls
require_once 'wizardAPI.php';
require_once 'simple_html_dom.php';
$homePage = getPageFromCourse($courseID, "home");
if (isset($homePage->created_at)) {
    if ($homePage->created_at !== '') {
        echo 'Already Exists';
        exit;
    }
}
if ($_POST['createPage'] == true) {
    $frontPageTitle = 'Home';
    $frontPageBody = '';
    $frontPageParams = 'wiki_page[title]=' . $frontPageTitle . '&wiki_page[body]=' . urlencode($frontPageBody) . '&wiki_page[published]=true&wiki_page[front_page]=true';
    $newPage = createPage($courseID, $frontPageParams);
    $responseData = json_decode($newPage, true);
    $page_url = $responseData['url'];
    echo '<i class="fa fa-check"></i> Page Created';
}
Ejemplo n.º 6
0
} else {
    $parentWhereConfig1 = $whereStatus;
}
$parentWhereConfig = $parentWhereConfig1;
$parentWhereConfigDEA = "id=" . $codeParent . " and {$whereStatus}";
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
//DINH SO PHAN TRANG=======================================================[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/*--------KIEM TRA THUOC TINH---------------------*/
//$defaulType					=	getRecord($tableCategoryConfigId," id=".$_REQUEST['codeParent']." and ".$whereStatus);
$totalItems = countRecord($tableCityId, $parentWhereConfig);
$pageindex = createPage(countRecord($tableCityId, $parentWhereConfig), './?act=' . $actCity . '&module_city=' . $_REQUEST['module_city'] . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
//TIEU DE CUA COT=====================================================================[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
     $session->redirectUrl = $page->path . "add/";
 } elseif (!$input->post->submit) {
     $content = renderPage('ip_registration');
 } else {
     //  Register Service
     $user = wire('user')->name;
     $parent = $pages->get($page->id);
     $operator = wire('user')->id;
     if ($pages->get("template=staticip, title={$input->post->mac}") instanceof Nullpage) {
         // Creat IP
         do {
             $ip = long2ip(rand(ip2long("{$pages->get('template=site-setting')->start_ip}"), ip2long("{$pages->get('template=site-setting')->end_ip}")));
         } while (!$pages->get("template=staticip, static_ip={$ip}") instanceof NullPage);
         // Add new if not exist
         $mac = strtoupper($input->post->mac);
         $s = createPage('staticip', $parent, $mac);
         $s->subtitle = $input->post->title;
         $s->operator = $operator;
         $s->static_ip = $ip;
         $s->save();
     } else {
         // Update if exit
         $operator = wire('user')->id;
         $s = $pages->get("title={$input->post->mac}");
         $s->operator = $operator;
         $s->key = $input->post->key;
         $s->of(false);
         $s->save();
         $s->of(true);
     }
     $content = "<h2>Node Hinzugefügt:</h2>\n                    <p>\n                    Titel: {$s->subtitle}<br>\n                    MAC : {$s->title}<br>\n                    IP : {$s->static_ip}<br>\n                    Betreiber: {$users->get($s->operator)->name}\n                    </p>";
    $parentWhereConfig1 = "name like '%" . $_GET['name'] . "%' and {$whereStatus}";
}
$parentWhereConfig = $parentWhereConfig1;
$parentWhereConfigDEA = "id=" . $codeParent . " and {$whereStatus}";
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
//DINH SO PHAN TRANG=======================================================[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/*--------KIEM TRA THUOC TINH---------------------*/
//$defaulType					=	getRecord($tableCategoryConfigId," id=".$_REQUEST['codeParent']." and ".$whereStatus);
$MAXPAGE = 20;
$totalItems = countRecord($tableMemberId, $parentWhereConfig);
$pageindex = createPage(countRecord($tableMemberId, $parentWhereConfig), './?act=' . $actVoucher . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
//TIEU DE CUA COT=====================================================================[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
Ejemplo n.º 9
0
 function ODP()
 {
     global $title, $subtitle, $odpfile, $document, $ids, $docs, $files, $names, $output_pages, $output_manifest, $tempdir, $msg, $lang, $template;
     $title = $this->title;
     $subtitle = $this->subtitle;
     $ids = $this->ids;
     $docs = $this->docs;
     $files = $this->files;
     $odpfile = "QSOS_" . $docs[0]->getkey("qsosappfamily") . ".odp";
     $names = $this->names;
     $lang = $this->lang;
     $msg = $this->msg;
     $template = $this->template;
     function drawTabTitle($text)
     {
         global $output_pages;
         $frame = $output_pages->createElement('draw:frame');
         $frame->setAttribute("draw:style-name", "Onglet");
         $frame->setAttribute("draw:text-style-name", "P7");
         $frame->setAttribute("draw:layer", "layout");
         $frame->setAttribute("svg:width", "2.665cm");
         $frame->setAttribute("svg:height", "0.742cm");
         $frame->setAttribute("draw:transform", "rotate (1.5707963267949) translate (0.279cm 4.983cm)");
         $textbox = $output_pages->createElement('draw:text-box');
         $p = $output_pages->createElement('text:p');
         $span = $output_pages->createElement('text:span', $text);
         $span->setAttribute("text:style-name", "T7");
         $p->appendChild($span);
         $textbox->appendChild($p);
         $frame->appendChild($textbox);
         return $frame;
     }
     function drawPresentationTextbox($presentation_style, $p_style, $span_style, $width, $height, $x, $y, $class, $text)
     {
         global $output_pages;
         $frame = $output_pages->createElement('draw:frame');
         $frame->setAttribute("presentation:style-name", $presentation_style);
         $frame->setAttribute("draw:layer", "layout");
         $frame->setAttribute("svg:width", $width);
         $frame->setAttribute("svg:height", $height);
         $frame->setAttribute("svg:x", $x);
         $frame->setAttribute("svg:y", $y);
         $frame->setAttribute("presentation:class", $class);
         $frame->setAttribute("presentation:user-transformed", "true");
         $textbox = $output_pages->createElement('draw:text-box');
         $p = $output_pages->createElement('text:p');
         if ($p_style) {
             $p->setAttribute("text:style-name", $p_style);
         }
         $span = $output_pages->createElement('text:span', $text);
         if ($span_style) {
             $span->setAttribute("text:style-name", $span_style);
         }
         $p->appendChild($span);
         $textbox->appendChild($p);
         $frame->appendChild($textbox);
         return $frame;
     }
     function drawPageTitle($text)
     {
         return drawPresentationTextbox("pr4", "P6", "", "20cm", "1.5cm", "1.4cm", "2.25cm", "title", $text);
     }
     function drawAgendaList($frame_style, $frame_text_style, $L1_text_style, $L1_span_style, $L2_text_style, $L2_span_style, $width, $height, $x, $y, $text)
     {
         global $output_pages;
         $frame = $output_pages->createElement('draw:frame');
         $frame->setAttribute("draw:style-name", $frame_style);
         $frame->setAttribute("draw:text-style-name", $frame_text_style);
         $frame->setAttribute("draw:layer", "layout");
         $frame->setAttribute("svg:width", $width);
         $frame->setAttribute("svg:height", $height);
         $frame->setAttribute("svg:x", $x);
         $frame->setAttribute("svg:y", $y);
         $textbox = $output_pages->createElement('draw:text-box');
         $L1 = $output_pages->createElement('text:list');
         $L1->setAttribute("text:style-name", $L1_text_style);
         $item = $output_pages->createElement('text:list-item');
         $p = $output_pages->createElement('text:p');
         $span = $output_pages->createElement('text:span', $text[0]);
         $span->setAttribute("text:style-name", $L1_span_style);
         $p->appendChild($span);
         $item->appendChild($p);
         $L1->appendChild($item);
         $textbox->appendChild($L1);
         $L2 = $output_pages->createElement('text:list');
         if ($L2_text_style != "") {
             $L2->setAttribute("text:style-name", $L2_text_style);
         }
         $subitem = $output_pages->createElement('text:list-item');
         $sublist = $output_pages->createElement('text:list');
         for ($i = 1; $i < count($text); $i++) {
             $item = $output_pages->createElement('text:list-item');
             $p = $output_pages->createElement('text:p');
             $span = $output_pages->createElement('text:span', $text[$i]);
             $span->setAttribute("text:style-name", $L2_span_style);
             $p->appendChild($span);
             $item->appendChild($p);
             $sublist->appendChild($item);
         }
         $subitem->appendChild($sublist);
         $L2->appendChild($subitem);
         $textbox->appendChild($L2);
         $frame->appendChild($textbox);
         return $frame;
     }
     function createFirstPage($title, $subtitle)
     {
         global $output_pages, $odpfile;
         $page = $output_pages->createElement('draw:page');
         $page->setAttribute("draw:name", "page1");
         $page->setAttribute("draw:style-name", "dp1");
         $page->setAttribute("draw:master-page-name", "SLL_5f_MOD_5f_Pre_5f_Modele_5f_de_5f_presentation");
         $page->setAttribute("presentation:presentation-page-layout-name", "AL1T0");
         $page->setAttribute("presentation:use-footer-name", "ftr1");
         $page->setAttribute("presentation:use-date-time-name", "dtd1");
         $forms = $output_pages->createElement('office:forms');
         $forms->setAttribute("form:automatic-focus", "false");
         $forms->setAttribute("form:apply-design-mode", "false");
         $page->appendChild($forms);
         //Title
         $page->appendChild(drawPresentationTextbox("pr1", "", "", "27.763cm", "1.4cm", "-0.263cm", "10cm", "title", $title));
         //Subtitle
         //$page->appendChild(drawPresentationTextbox("pr2", "P1", "T1", "27cm", "1.4cm", "0.5cm", "11.5cm", "subtitle", $subtitle));
         return $page;
     }
     function createAgendaPage($name)
     {
         global $output_pages, $names, $lang, $msg, $template;
         include "export/{$template}/settings-odp-{$lang}.php";
         $page = $output_pages->createElement('draw:page');
         $page->setAttribute("draw:name", $name);
         $page->setAttribute("draw:style-name", "dp1");
         $page->setAttribute("draw:master-page-name", "Sommaire");
         $page->setAttribute("presentation:presentation-page-layout-name", "AL2T1");
         $page->setAttribute("presentation:use-footer-name", "ftr1");
         $page->setAttribute("presentation:use-date-time-name", "dtd1");
         $forms = $output_pages->createElement('office:forms');
         $forms->setAttribute("form:automatic-focus", "false");
         $forms->setAttribute("form:apply-design-mode", "false");
         $page->appendChild($forms);
         //Title
         $page->appendChild(drawPresentationTextbox("pr4", "P6", "", "20cm", "1.5cm", "1.4cm", "2.25cm", "title", $tpl_msg['odp_agenda_title']));
         //Tab title
         $page->appendChild(drawTabTitle($tpl_msg['odp_agenda_title']));
         //First line
         $line = $output_pages->createElement('draw:line');
         $line->setAttribute("draw:style-name", "gr3");
         $line->setAttribute("draw:text-style-name", "P4");
         $line->setAttribute("draw:layer", "layout");
         $line->setAttribute("svg:x1", "4.227cm");
         $line->setAttribute("svg:y1", "5.518cm");
         $line->setAttribute("svg:x2", "4.227cm");
         $line->setAttribute("svg:y2", "19.109cm");
         $p = $output_pages->createElement('text:p');
         $line->appendChild($p);
         $page->appendChild($line);
         //Second line
         $line = $output_pages->createElement('draw:line');
         $line->setAttribute("draw:style-name", "gr3");
         $line->setAttribute("draw:text-style-name", "P4");
         $line->setAttribute("draw:layer", "layout");
         $line->setAttribute("svg:x1", "15.727cm");
         $line->setAttribute("svg:y1", "5.518cm");
         $line->setAttribute("svg:x2", "15.727cm");
         $line->setAttribute("svg:y2", "19.109cm");
         $p = $output_pages->createElement('text:p');
         $line->appendChild($p);
         $page->appendChild($line);
         //Content
         $page->appendChild(drawAgendaList("gr4", "P5", "L2", "T3", "L2", "T4", "10cm", "4.5cm", "3.5cm", "5cm", $tpl_msg['odp_agenda_introduction']));
         $text = $tpl_msg['odp_agenda_solutions'];
         foreach ($names as $name) {
             array_push($text, $name);
         }
         $page->appendChild(drawAgendaList("gr5", "P5", "L4", "T5", "L4", "T4", "10cm", "4.5cm", "3.5cm", "11.7cm", $text));
         $page->appendChild(drawAgendaList("gr6", "P5", "L5", "T8", "L5", "T4", "12cm", "4.5cm", "15cm", "5cm", $tpl_msg['odp_agenda_synthesis']));
         if ($tpl_msg['odp_agenda_reco']) {
             $page->appendChild(drawAgendaList("grV", "P5", "LV", "TV", "LV", "T4", "12cm", "4.5cm", "15cm", "11.7cm", $tpl_msg['odp_agenda_reco']));
         }
         return $page;
     }
     function getList($element, $style)
     {
         global $output_pages;
         $list = $output_pages->createElement('text:list');
         $list->setAttribute("text:style-name", $style);
         $item = $output_pages->createElement('text:list-item');
         if (is_array($element)) {
             foreach ($element as $subelement) {
                 $item->appendChild(getList($subelement, $style));
             }
         } else {
             $text = $output_pages->createElement('text:p', $element);
             $item->appendChild($text);
         }
         $list->appendChild($item);
         return $list;
     }
     function createPage($name, $type, $title, $tab_title, $contents, $image = null)
     {
         global $output_pages, $tempdir;
         $page = $output_pages->createElement('draw:page');
         $page->setAttribute("draw:name", $name);
         $page->setAttribute("draw:style-name", "dp1");
         $page->setAttribute("draw:master-page-name", $type);
         $page->setAttribute("presentation:presentation-page-layout-name", "AL2T1");
         $page->setAttribute("presentation:use-footer-name", "ftr1");
         $page->setAttribute("presentation:use-date-time-name", "dtd1");
         //Title
         $page->appendChild(drawPageTitle($title));
         //Tab title
         $page->appendChild(drawTabTitle($tab_title));
         //Image positioning
         if ($image) {
             //Default dimensions and positioning for SVG images
             $x = 0.15;
             $y = 2.5;
             $width = 26.457;
             $height = 15.874;
             if (substr($image, -3) == "png") {
                 $ratio = 0.023291;
                 //(ratio px <=> cm)
                 //Get image dimensions
                 $size = getimagesize($tempdir . "/" . $image);
                 $width = $size[0] * $ratio;
                 $height = $size[1] * $ratio;
                 $y = 3.5;
                 $x = (28 - $size[0] * $ratio) / 2;
                 //28cm is page width (minus left border) in ODP template, so we center image
                 //If image height is not very big, put somme space around it
                 if ($height <= 7) {
                     $y += (7 - $height) / 2;
                     $Yoffset = 7 + 3.5;
                 } else {
                     $Yoffset = $y + $height;
                 }
                 //If image height is too big, position image on the right side
                 if ($height >= 13) {
                     $Yoffset = 5.2;
                     $x = 28 - $width;
                     $Xoffset = $x;
                     $y = 4 + (16 - $height) / 2;
                     //20cm is the approx useable height in ODP template, so we center image
                 } else {
                     $Xoffset = 25;
                 }
             }
             $frame = $output_pages->createElement('draw:frame');
             $frame->setAttribute("draw:style-name", "gr15");
             $frame->setAttribute("draw:text-style-name", "P4");
             $frame->setAttribute("draw:layer", "layout");
             $frame->setAttribute("svg:width", $width . "cm");
             $frame->setAttribute("svg:height", $height . "cm");
             $frame->setAttribute("svg:x", $x . "cm");
             $frame->setAttribute("svg:y", $y . "cm");
             $svg = $output_pages->createElement('draw:image');
             $svg->setAttribute("xlink:href", "Pictures/{$image}");
             $svg->setAttribute("xlink:type", "simple");
             $svg->setAttribute("xlink:show", "embed");
             $svg->setAttribute("xlink:actuate", "onLoad");
             $frame->appendChild($svg);
             $page->appendChild($frame);
         }
         $frame = $output_pages->createElement('draw:frame');
         $frame->setAttribute("presentation:style-name", "pr6");
         $frame->setAttribute("draw:layer", "layout");
         $frame->setAttribute("svg:x", "1.5cm");
         $frame->setAttribute("presentation:class", "outline");
         $frame->setAttribute("presentation:user-transformed", "true");
         //Text outline positioning depending on image positioning
         if ($image) {
             if (substr($image, -3) == "png") {
                 $yc = $Yoffset + 0.4;
                 $heightc = 19 - $yc;
                 //20cm is the approx useable height in ODP template
                 $widthc = $Xoffset;
             } else {
                 $yc = 13;
                 $heightc = 7;
                 $widthc = 25;
             }
         } else {
             $yc = 5;
             $heightc = 15;
             $widthc = 25;
         }
         $frame->setAttribute("svg:width", $widthc . "cm");
         $frame->setAttribute("svg:height", $heightc . "cm");
         $frame->setAttribute("svg:y", $yc . "cm");
         $textbox = $output_pages->createElement('draw:text-box');
         if ($contents) {
             foreach ($contents as $element) {
                 $textbox->appendChild(getList($element, "L6"));
             }
         }
         $frame->appendChild($textbox);
         $page->appendChild($frame);
         return $page;
     }
     function createManifest()
     {
         global $output_manifest, $docs, $lang, $template;
         include "export/{$template}/settings-odp-{$lang}.php";
         $manifest = $output_manifest->createElement('manifest:manifest');
         $manifest->setAttribute("xmlns:manifest", "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");
         $manifest->setAttribute("manifest:version", "1.2");
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "application/vnd.oasis.opendocument.presentation");
         $file->setAttribute("manifest:version", "1.2");
         $file->setAttribute("manifest:full-path", "/");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "image/png");
         $file->setAttribute("manifest:full-path", "Thumbnails/thumbnail.png");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "text/xml");
         $file->setAttribute("manifest:full-path", "settings.xml");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "text/xml");
         $file->setAttribute("manifest:full-path", "content.xml");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "text/xml");
         $file->setAttribute("manifest:full-path", "meta.xml");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "text/xml");
         $file->setAttribute("manifest:full-path", "styles.xml");
         $manifest->appendChild($file);
         foreach ($tpl_images as $image) {
             $tmp_array = array_reverse(explode(".", $image));
             $ext = $tmp_array[0];
             if ($ext == "jpg") {
                 $mime = "image/jpeg";
             } else {
                 $mime = "image/{$ext}";
             }
             if ($ext == "wmf") {
                 $mime = "";
             }
             $file = $output_manifest->createElement('manifest:file-entry');
             $file->setAttribute("manifest:media-type", "{$mime}");
             $file->setAttribute("manifest:full-path", "Pictures/{$image}");
             $manifest->appendChild($file);
         }
         foreach ($docs[0]->getTree() as $section) {
             $name = $section->name;
             $image = $name . ".svg";
             $file = $output_manifest->createElement('manifest:file-entry');
             $file->setAttribute("manifest:media-type", "image/svg+xml");
             $file->setAttribute("manifest:full-path", "Pictures/{$image}");
             $manifest->appendChild($file);
             $image = "tpl-{$name}.png";
             $file = $output_manifest->createElement('manifest:file-entry');
             $file->setAttribute("manifest:media-type", "image/png");
             $file->setAttribute("manifest:full-path", "Pictures/{$image}");
             $manifest->appendChild($file);
             for ($i = 0; $i < count($docs); $i++) {
                 $image = "{$i}-{$name}.png";
                 $file = $output_manifest->createElement('manifest:file-entry');
                 $file->setAttribute("manifest:media-type", "image/png");
                 $file->setAttribute("manifest:full-path", "Pictures/{$image}");
                 $manifest->appendChild($file);
             }
         }
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "image/svg+xml");
         $file->setAttribute("manifest:full-path", "Pictures/quadrant.svg");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "");
         $file->setAttribute("manifest:full-path", "Configurations2/accelerator/current.xml");
         $manifest->appendChild($file);
         $file = $output_manifest->createElement('manifest:file-entry');
         $file->setAttribute("manifest:media-type", "application/vnd.sun.xml.ui.configuration");
         $file->setAttribute("manifest:full-path", "Configurations2/");
         $manifest->appendChild($file);
         return $manifest;
     }
     //Finalize Document (on disk)
     $tempdir = $this->temp . uniqid();
     mkdir($tempdir, 0755);
     //$output->save("$tempdir/content.xml");
     copy("export/{$template}/template_odp.zip", "odf/{$odpfile}");
     include "export/{$template}/settings-odp-{$lang}.php";
     include 'libs/pclzip.lib.php';
     $oofile = new PclZip("odf/{$odpfile}");
     //Predefined XML elements
     $f = fopen("export/{$template}/odp.xml", "r");
     $input = fread($f, filesize("export/{$template}/odp.xml"));
     fclose($f);
     //New Pages
     $output_pages = new DOMDocument('1.0', 'UTF-8');
     //Footer
     $presentation_title = $this->docs[0]->getkey("qsosappfamily");
     if ($subtitle) {
         $presentation_title = $subtitle . " - " . $presentation_title;
     }
     $footer = $output_pages->createElement('presentation:footer-decl', $presentation_title);
     $footer->setAttribute("presentation:name", "ftr1");
     $output_pages->appendChild($footer);
     //First page
     $output_pages->appendChild(createFirstPage($presentation_title, $title));
     //Agenda - First topic
     $output_pages->appendChild(createAgendaPage("Agenda-Template"));
     //Context
     if ($tpl_msg['odp_context_title']) {
         $output_pages->appendChild(createPage("Context", "Green", $tpl_msg['odp_context_title'], $tpl_msg['odp_context_tabtitle'], $tpl_msg['odp_context_content']));
     }
     //Perimeter
     $text = array();
     foreach ($names as $name) {
         array_push($text, $name);
     }
     $output_pages->appendChild(createPage("Perimeter", "Green", $tpl_msg['odp_perimeter_title'], $tpl_msg['odp_perimeter_tabtitle'], array($tpl_msg['odp_perimeter_1stphrase'], $text)));
     foreach ($docs[0]->getTree() as $section) {
         $name = $section->name;
         $title = $section->title;
         $this->exportTemplateSection($docs[0], $name, $tempdir . "/tpl-" . $name);
         $image = "tpl-{$name}.png";
         $v_list = $oofile->add("{$tempdir}/{$image}", PCLZIP_OPT_ADD_PATH, "Pictures", PCLZIP_OPT_REMOVE_PATH, $tempdir);
         if ($v_list == 0) {
             die("Error 02: ODP generation " . $oofile->errorInfo(true));
         }
         $output_pages->appendChild(createPage("Template-{$name}", "Green", $tpl_msg['odp_template_title'], $tpl_msg['odp_template_tabtitle'], $docs[0]->getTreeDesc($section->name), $image));
     }
     for ($i = 0; $i < count($ids); $i++) {
         //Agenda
         $output_pages->appendChild(createAgendaPage("Agenda-Solution-{$i}"));
         //Project description
         $contents = array($docs[$i]->getkey("desc"), $docs[$i]->getkey("licensedesc"), $docs[$i]->getkey("url"), "TODO", $tpl_msg['odp_project_todo']);
         $output_pages->appendChild(createPage($names[$i] . "-Project", "Blue", $names[$i] . $tpl_msg['odp_project_title'], $tpl_msg['odp_project_tabtitle'], $contents));
         foreach ($docs[$i]->getTree() as $section) {
             $name = $section->name;
             $title = $section->title;
             $score = $section->score;
             $this->exportSection($docs[$i], $name, $tempdir . "/" . $i . "-" . $name);
             $image = "{$i}-{$name}.png";
             $v_list = $oofile->add("{$tempdir}/{$image}", PCLZIP_OPT_ADD_PATH, "Pictures", PCLZIP_OPT_REMOVE_PATH, $tempdir);
             if ($v_list == 0) {
                 die("Error 02: ODP generation " . $oofile->errorInfo(true));
             }
             $output_pages->appendChild(createPage($names[$i] . "-{$name}", "Blue", "{$names[$i]}", $tpl_msg['odp_project_tabtitle'], $tpl_msg['odp_solution_todo'], $image));
         }
     }
     //Agenda - Third topic
     $output_pages->appendChild(createAgendaPage("Agenda-Synthesis"));
     foreach ($docs[0]->getTree() as $section) {
         $name = $section->name;
         $title = $section->title;
         $image = $name . ".svg";
         $this->setCriteria($name);
         $this->saveRadar("{$tempdir}/{$image}");
         $v_list = $oofile->add("{$tempdir}/{$image}", PCLZIP_OPT_ADD_PATH, "Pictures", PCLZIP_OPT_REMOVE_PATH, $tempdir);
         if ($v_list == 0) {
             die("Error 02: ODP generation " . $oofile->errorInfo(true));
         }
         $output_pages->appendChild(createPage("Synthesis-{$name}", "Purple", $tpl_msg['odp_synthesis_title'], $tpl_msg['odp_synthesis_tabtitle'], $tpl_msg['odp_synthesis_todo'], $image));
     }
     $image = "quadrant.svg";
     $this->saveQuadrant("{$tempdir}/{$image}");
     $v_list = $oofile->add("{$tempdir}/{$image}", PCLZIP_OPT_ADD_PATH, "Pictures", PCLZIP_OPT_REMOVE_PATH, $tempdir);
     if ($v_list == 0) {
         die("Error 02: ODP generation " . $oofile->errorInfo(true));
     }
     $output_pages->appendChild(createPage("Conclusion", "Purple", $tpl_msg['odp_conclusion_title'], $tpl_msg['odp_conclusion_tabtitle'], $tpl_msg['odp_conclusion_todo'], $image));
     //Recommendations
     if ($tpl_msg['odp_agenda_reco']) {
         $output_pages->appendChild(createPage("Reco", "Blue Purple", $tpl_msg['odp_reco_title'], $tpl_msg['odp_reco_tabtitle'], $tpl_msg['odp_reco_content']));
     }
     //License note
     if ($tpl_msg['odp_license_title']) {
         $output_pages->appendChild(createPage("Licence", "Licence", $tpl_msg['odp_license_title'], $tpl_msg['odp_license_tabtitle'], $tpl_msg['odp_license_content']));
     }
     //Credits
     if ($tpl_msg['odp_credits_title']) {
         $list = array();
         $i = 0;
         foreach ($this->ids as $id) {
             $authors = "";
             foreach ($docs[$i]->getauthors() as $author) {
                 if ($author->name != "") {
                     $authors .= $author->name . ",";
                 }
             }
             if ($authors != "") {
                 $authors = " (" . rtrim($authors, ",") . ")";
             }
             $tmp_array = array_reverse(explode("/", $files[$i]));
             array_push($list, $names[$i] . " : " . $tmp_array[0] . $authors);
             $i++;
         }
         $output_pages->appendChild(createPage("Credits", "Licence", $tpl_msg['odp_credits_title'], $tpl_msg['odp_credits_tabtitle'], array($tpl_msg['odp_credits_header'], $list, $tpl_msg['odp_credits_footer'])));
     }
     //hack to remove XML declaration
     foreach ($output_pages->childNodes as $node) {
         $fragment .= $output_pages->saveXML($node) . "\n";
     }
     $content = $input . "\n" . $fragment . "<presentation:settings presentation:mouse-visible=\"false\"/></office:presentation></office:body></office:document-content>";
     $file_content = fopen("{$tempdir}/content.xml", 'w');
     fwrite($file_content, $content);
     fclose($file_content);
     $v_list = $oofile->add("{$tempdir}/content.xml", PCLZIP_OPT_REMOVE_PATH, $tempdir);
     if ($v_list == 0) {
         die("Error 03: ODP generation " . $oofile->errorInfo(true));
     }
     //Manifest generation
     $output_manifest = new DOMDocument('1.0', 'UTF-8');
     $output_manifest->appendChild(createManifest());
     $output_manifest->save("{$tempdir}/manifest.xml");
     $v_list = $oofile->add("{$tempdir}/manifest.xml", PCLZIP_OPT_ADD_PATH, "META-INF", PCLZIP_OPT_REMOVE_PATH, $tempdir);
     if ($v_list == 0) {
         die("Error 04: ODP generation " . $oofile->errorInfo(true));
     }
     //Return ODP file to the browser
     header("Location: odf/{$odpfile}");
     exit;
 }
        $day = getDayFromBooklineDate($date);
        if ($choice_date == null) {
            $pdf = createPage($pdf, $d, $sprache, $gastro_id, $date, $cellWidth, $cellHigh);
        } else {
            if ($choice_date == $day . "/" . $month . "/" . $year) {
                $pdf = createPage($pdf, $d, $sprache, $gastro_id, $date, $cellWidth, $cellHigh);
            }
        }
    }
    $pdf->Cell($pageWidth, $cellHigh, getUebersetzungGastro("offen", $sprache, $gastro_id), 1, 1);
    $res = getReservationsOfVermieter($gastro_id, STATUS_RESERVIERT);
    while ($d = $res->FetchNextObject()) {
        $reservierungs_id = $d->RESERVIERUNG_ID;
        $date = getDatumVonOfReservierung($reservierungs_id);
        $year = getYearFromBooklineDate($date);
        $month = getMonthFromBooklineDate($date);
        $day = getDayFromBooklineDate($date);
        if ($choice_date == null) {
            $pdf = createPage($pdf, $d, $sprache, $gastro_id, $date, $cellWidth, $cellHigh);
        } else {
            if ($choice_date == $day . "/" . $month . "/" . $year) {
                $pdf = createPage($pdf, $d, $sprache, $gastro_id, $date, $cellWidth, $cellHigh);
            }
        }
    }
    $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 180, $pdf->GetY());
    $pdf->Output();
}
?>

            $size[] = $y;
            $size[] = $x;
        } else {
            $size = $dimension;
        }
        //create the pdf with constructor:
        $pdf = new FPDF($pageOrientation, $measureUnit, $size);
        if ($showName || $showTime) {
            //get the confirmed booking
            $res = getReservationsOfVermieter($gastro_id, STATUS_BELEGT);
            while ($d = $res->FetchNextObject()) {
                $reservierungs_id = $d->RESERVIERUNG_ID;
                $gast_id = $d->GAST_ID;
                $gast = getMieterVorname($gast_id) . " " . getNachnameOfMieter($gast_id);
                $date = getDatumVonOfReservierung($reservierungs_id);
                $year = getYearFromBooklineDate($date);
                $month = getMonthFromBooklineDate($date);
                $day = getDayFromBooklineDate($date);
                if ($choice_date == null) {
                    createPage($pdf, $root . $temp_url, getUebersetzungGastro("Zeit", $sprache, $gastro_id) . ": " . $year . "-" . $month . "-" . $day . " " . getHourFromBooklineDate($date) . ":" . getMinuteFromBooklineDate($date) . " " . getUebersetzungGastro("bis", $sprache, $gastro_id) . " ", getUebersetzungGastro("Name", $sprache, $gastro_id) . ": " . $gast, $headingText, $fontText, $fontTextStyle, $fontTextSize, $fontHeading, $fontHeadingStyle, $fontHeadingSize, $root, $x, $y);
                } else {
                    if ($choice_date == $day . "/" . $month . "/" . $year) {
                        createPage($pdf, $root . $temp_url, getUebersetzungGastro("Zeit", $sprache, $gastro_id) . ": " . $year . "-" . $month . "-" . $day . " " . getHourFromBooklineDate($date) . ":" . getMinuteFromBooklineDate($date) . " " . getUebersetzungGastro("bis", $sprache, $gastro_id) . " ", getUebersetzungGastro("Name", $sprache, $gastro_id) . ": " . $gast, $headingText, $fontText, $fontTextStyle, $fontTextSize, $fontHeading, $fontHeadingStyle, $fontHeadingSize, $root, $x, $y);
                    }
                }
            }
        }
        $pdf->Output();
    }
    //end if tableCardId exists
}
    $parentWhereConfig1 = "name like '%" . $_REQUEST['name'] . "%' and parent<>0 and {$whereStatus}";
}
$parentWhereConfig = $whereComment;
//$parentWhereConfig1.$parentWhereConfigDefault;
$parentWhereConfigDEA = "id=" . $codeParent . " and parent<>0 and {$whereStatus}";
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
//DINH SO PHAN TRANG=======================================================[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/*--------KIEM TRA THUOC TINH---------------------*/
//$defaulType					=	getRecord($tableCategoryConfigId," id=".$_REQUEST['codeParent']." and ".$whereStatus);
$totalItems = countRecord($tableAdvertisementId, $parentWhereConfig);
$pageindex = createPage(countRecord($tableAdvertisementId, $parentWhereConfig), './?act=' . $actAdvertisement . '&adv_module=' . $_REQUEST['adv_module'] . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
//TIEU DE CUA COT=====================================================================[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
Ejemplo n.º 13
0
} elseif ($_REQUEST['name'] != '') {
    $parentWhereConfig1 = "name like '%" . $_REQUEST['name'] . "%' and {$whereStatus}";
}
$parentWhereConfig = $parentWhereConfig1;
$parentWhereConfigDEA = "id=" . $codeParent . " and {$whereStatus}";
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
//DINH SO PHAN TRANG=======================================================[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/*--------KIEM TRA THUOC TINH---------------------*/
//$defaulType					=	getRecord($tableCategoryConfigId," id=".$_REQUEST['codeParent']." and ".$whereStatus);
$totalItems = countRecord($tableMemberId, $parentWhereConfig);
$pageindex = createPage(countRecord($tableMemberId, $parentWhereConfig), './?act=' . $actMember . '&mem_module=' . $_REQUEST['mem_module'] . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
//TIEU DE CUA COT=====================================================================[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
Ejemplo n.º 14
0
function viewPage($page, $dir){
if (file_exists($dir.$page)){
    echo "<div id='main'>
      <ul class='tabs'>
        <li class='selected'>
          <a href='./index.php?page={$page}'>View</a>
        </li>
        <li class=''>
          <a href='./index.php?page={$page}&amp;edit=true'>Edit</a>
        </li>
        <li class=''>
          <a href='./index.php?page={$page}&amp;delete=true'>Delete</a>
        </li>
      </ul>
      <div class='content'>";

    echo "<h1>$page</h1>";
    $f = fopen($dir.$page,'r');
    $t = date("M j g:i a", filemtime($dir.$path));
    $p = fread($f, 25000);
    $d = replaceWiki($p,$t);
    echo nl2br($d);
   } else { 
	createPage($page);
   }
}
?>
">
<input type="hidden" name="codeParent" value="<?php 
echo $_REQUEST['codeParent'];
?>
">
<input type="hidden" name="act" value="<?php 
echo $actCategoryConfig;
?>
">
<input type="hidden" name="lang" value="<?php 
echo $_lang_A;
?>
">
<?php 
$pageindex = createPage(countRecord($tableCategoryConfigId, $parentWhereConfig), './?act=' . $actCategoryConfig . '&codeParent=' . $_REQUEST['codeParent'] . '&page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
if ($_GET['code'] == 1) {
    $errMsg = ASUCCESSFULLY;
}
//kiem  tra cap nhat thanh cong hay chua
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr>
		
		<td height="30" align="right" valign="middle" class="smallfont">
			<table width="100%"  border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
  <td colspan="5" align="right" valign="middle" class="smallfont" style="padding-right:5px;">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
    }
}
$ProductShowHome = 'ok';
include 'updateShowhome.php';
$sqlcount = "select count(id) as numcount from tbl_voucher where type=1";
$querycount = @mysql_query($sqlcount, $conn);
$rowcount = @mysql_fetch_assoc($querycount);
$count_rows = $rowcount['numcount'];
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
$totalItems = $count_rows;
$pageindex = createPage($totalItems, './?act=voucherpublic&page=', $MAXPAGE, $page, '30');
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" width=\"50\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" width=\"50\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
}
$processFrameShowHtmlTr = "\n\t<tr>\n\t  " . $trDetele_1title . "\n\t   " . $trEdit_1title . "\n\t  " . $trDetele_2title . "\t\n\t\t<th width=\"17\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(1) . "\">" . TID . "</a></th>\n        <th width=\"100\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(5) . "\">Tên thành viên</a></th>\n        <th width=\"100\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(5) . "\">Email</a></th>\n\t    <th width=\"100\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(5) . "\">Mã khuyến mãi</a></th>\n\t  <th width=\"120\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(4) . "\">Phần trăm giảm giá</a></th>\n      <th width=\"50\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(8) . "\">Tình trạng</a></th>\t\n\t  <th width=\"72\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(34) . "\">" . TDATEESTABLISHED . "</a></th>\n\t  <th width=\"73\" align=\"center\" valign=\"middle\" class=\"title\"><a class=\"title\" href=\"" . getLinkSort(35) . "\">Ngày hết hạn</a></th>\n    </tr>\n";
if ($secondaryTemplateCount != "") {
    $pageBody = getPageBody($courseID, 'secondary-template');
    // Find and replace module prefix
    $replacePrefix = get_string_between($pageBody, 'class="kl_mod_text">', '</span>');
    // var_dump($replacePrefix);
    $explodedPrefix = explode(" ", $moduleTitlePrefix);
    $prefixText = $explodedPrefix[0];
    for ($i = 1; $i <= $secondaryTemplateCount; $i++) {
        $pageTitle = $moduleTitlePrefix . " Secondary Page " . $i;
        $pageBody = str_replace('class="kl_mod_text">' . $replacePrefix . '</span>', 'class="kl_mod_text">' . $prefixText . ' </span>', $pageBody);
        // Find and replace module number
        $replaceNumber = get_string_between($pageBody, 'class="kl_mod_num">', '</span>');
        // var_dump($replaceNumber);
        $pageBody = str_replace('class="kl_mod_num">' . $replaceNumber . '</span>', 'class="kl_mod_num">' . $moduleNumber . '.' . $i . '</span>', $pageBody);
        $pageParams = 'wiki_page[title]=' . $pageTitle . '&wiki_page[body]=' . urlencode($pageBody);
        $newPage = createPage($courseID, $pageParams);
        $responseData = json_decode($newPage, true);
        $page_url = $responseData['url'];
        $itemParams = 'module_item[title]=' . urlencode($pageTitle) . '&module_item[type]=Page&module_item[page_url]=' . $page_url;
        $modulePage = createModuleItem($courseID, $newModuleID, $itemParams);
    }
}
// Add Assignments
$assignmentCount = $moduleSections[5];
for ($i = 1; $i <= $assignmentCount; $i++) {
    $assignmentParams = 'assignment[name]=' . $moduleTitlePrefix . ' Assignment ' . $i . '&assignment[position]=1&assignment[submission_types][]=none';
    $assignmentID = createGenericAssignment($courseID, $assignmentParams);
    $itemParams = 'module_item[title]=' . urlencode($moduleTitlePrefix . ' Assignment ' . $i) . '&module_item[type]=Assignment&module_item[content_id]=' . $assignmentID;
    $moduleAssignment = createModuleItem($courseID, $newModuleID, $itemParams);
}
// Add Discussions
Ejemplo n.º 18
0
function getData($code, $connection)
{
    if (!isTokenUser()) {
        $code = 4;
    }
    switch ($code) {
        //////////////////////CASE -1/////////////////////////////////////
        //Si entra aqui es porque ningun dato de S_POST coincide con una acción valida. Ya que el $dataCode por defecto es -1
        case -1:
            $response = array("error" => 1030, "description" => "Error no se ejecuto ninguna acción, verifica los parametros de entrada.");
            break;
            //////////////////////CASE 0/////////////////////////////////////
            //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        //////////////////////CASE 0/////////////////////////////////////
        //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        case 0:
            if ($connection) {
                $id_pregunta = $_POST["id_pregunta"];
                $dataOptions = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_OPCIONES . " where id_pregunta = " . $id_pregunta);
                $data;
                /*
                 * obtenemos los datos de la base de datos en un array asociativo.
                 */
                while ($fila = $dataOptions->fetch_assoc()) {
                    $data[] = $fila;
                }
                //dado que los valores de la base de datos vienen en codificacion utf-8, hay que transformar aquellas columnas con campos de texto.
                $dataResponse = codificationArray($data, "m_option");
                //para la variable m_option de la tabla n_opciones se codifica en utf-8
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 1/////////////////////////////////////
            //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        //////////////////////CASE 1/////////////////////////////////////
        //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        case 1:
            if (!isTokenTest()) {
                createTokenTest(getTokenUser());
            } else {
                if (isTokenTest() && isset($_POST["isFirstSelectedTest"]) && $_POST["isFirstSelectedTest"] == "true") {
                    //$response = array("error" => 1200, "Error token desincronizado");
                    $response = array("error" => 1200, "desError" => "Test desincronizado", "page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
                    break;
                }
            }
            //sincronizamos el avanze de paginas
            if (!isPage()) {
                createPage(intval($_POST["pagination"]));
            } else {
                if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"] && getPage() < intval($_POST["pagination"])) {
                    createPage(intval(getPage()) + 1);
                } else {
                    if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"]) {
                        createPage(intval(getPage()));
                    } else {
                        createPage(intval(getPage()) + 1);
                    }
                }
            }
            if (!isCategory()) {
                //si no esta sincroniada la categoria se sincroniza
                createCategory(intval($_POST["id"]));
            }
            if ($connection) {
                $pagination = getPage();
                //numero de pagina.
                $id = $_POST["id"];
                //id categoria: 1- ingles, 2- aleman...
                $result = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id . " LIMIT " . $pagination . ",1");
                $countLengthData = $connection->query("SELECT count(id) as count FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id);
                $data = array();
                while ($fila = $result->fetch_assoc()) {
                    $data[] = $fila;
                }
                $dataResponse = codificationArray($data, "question");
                //para la variable question de la tabla n_preguntas se codifica en utf-8
                $dataLength = $countLengthData->fetch_assoc();
                $dataResponse[1] = $dataLength;
                //numero de preguntas para la categoria actual
                if (!isCountQuestion()) {
                    createCountQuestion($dataLength);
                }
                $dataResponse[2] = getTokenTest();
                $dataResponse[3] = getTokenUser();
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 2/////////////////////////////////////
            // Actualizamos el progresso del cliente.
        //////////////////////CASE 2/////////////////////////////////////
        // Actualizamos el progresso del cliente.
        case 2:
            if (isPage()) {
                $canContinue = false;
                if (isset($_POST["pageUpdate"]) && $_POST["pageUpdate"]) {
                    if (intval(getPage()) == intval($_POST["pageUpdate"])) {
                        $canContinue = true;
                    } else {
                        $canContinue = false;
                    }
                } else {
                    $canContinue = true;
                }
                if ($canContinue === true) {
                    if (isset($_SESSION["u_email"])) {
                        $emailClient = $_SESSION["u_email"];
                        $id_question = $_POST["id_question"];
                        $id_option = $_POST["id_option"];
                        if ($connection) {
                            if (!isset($_SESSION["id_cliente"])) {
                                $resultQueryClientes = $connection->query("select id from " . TABLE_PREFIX . TABLE_CLIENTES . " WHERE email = '{$emailClient}'");
                                $responseQueryClientes = $resultQueryClientes->fetch_assoc();
                                $_SESSION["id_cliente"] = $responseQueryClientes["id"];
                            }
                            $query = "SELECT count(o.id) as count\n\t\t\t\t\t\t\t\t\t\t  FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " p inner join " . TABLE_PREFIX . TABLE_OPCIONES . " o\n\t\t\t\t\t\t\t\t\t\t  on o.id_pregunta = p.id\n\t\t\t\t\t\t\t\t\t\t  where {$id_option}. = (select id_opcion from " . TABLE_PREFIX . TABLE_RESPUESTA . " where id_pregunta = {$id_question})";
                            $resultCountCorrect = $connection->query($query);
                            $countCorrectOption = $resultCountCorrect->fetch_assoc();
                            $codeTemp = getTokenTest();
                            $id_client = $_SESSION["id_cliente"];
                            $id_category = getCategory();
                            $date_update = date("Y-m-d H:i:s");
                            $insert = $connection->query("INSERT INTO " . TABLE_PREFIX . TABLE_HISTORY_TEST . " (id_client,id_option,id_question,id_title,code_validation,m_date) VALUES({$id_client},{$id_option},{$id_question},{$id_category},'{$codeTemp}','{$date_update}')");
                            //obtenemos el numero de preguntas de esta categoria.
                            $countQuestionResult = $connection->query("SELECT count(id) as count FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id_category);
                            $countQuestionTemp = $countQuestionResult->fetch_assoc();
                            $countQuestion = $countQuestionTemp["count"];
                            if (intval($countCorrectOption["count"] > 0)) {
                                //si es mayor que cero significa que es la que tenemos marcada como buena en la base de datos.
                                if (!isset($_SESSION["correctCount"])) {
                                    //si el correctCount no está creado aún lo creamos con valor a 1 porque yá tenemos una respuesta correcta.
                                    $_SESSION["correctCount"] = 1;
                                } else {
                                    //si ya estaba activo, solo incrementamos su valor en 1.
                                    $_SESSION["correctCount"] = intval($_SESSION["correctCount"]) + 1;
                                }
                                $dataUpdate = array("check" => $_SESSION['correctCount']);
                            } else {
                                $dataUpdate = array("check" => -1);
                                //editamos el mensaje de respuesta.
                            }
                        } else {
                            $dataUpdate = array("error" => 1020, "description" => "Error conexión no establecida");
                        }
                    } else {
                        $dataUpdate = array("error" => 1050, "description" => "Error de session, la sessión ha expirado.");
                    }
                } else {
                    $dataUpdate = array("error" => 1200, "desError" => "Test desincronizado", "page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
                }
                $response = $dataUpdate;
                break;
            } else {
                $response = array("error" => 1050, "description" => "Error de session, la sessión ha expirado.");
                break;
            }
        case 3:
            //aqui el cliente a finalizado el test y mostramos el detalle de los resultados.
            $id_client = $_SESSION["id_cliente"];
            $date_update = date("Y-m-d H:i:s");
            $id_category = getCategory();
            $puntuacion = $_SESSION["correctCount"];
            $token_test = getTokenTest();
            $result = $connection->query("INSERT INTO " . TABLE_PREFIX . TABLE_HISTORY . " (id_client,id_title,code_validation,m_date,points) VALUES ({$id_client},{$id_category},'{$token_test}','{$date_update}',{$puntuacion})");
            if ($result) {
                $response = array("check" => "register inserted.", "data" => array("num_question" => getCountQuestion(), "correctCount" => getCorrectCount()));
            } else {
                $response = array("error" => $connection->error);
            }
            $dataEndTest = isEndTest($id_category, $token_test, $connection);
            if ($dataEndTest) {
                $_SESSION["end_test"] = true;
                sendResult($_SESSION["u_email"], "Resultado del Test en GRUPOIOE", showResume($dataEndTest, $connection));
            }
            break;
        case 4:
            //aqui no existe el token de usuario, la sesion posiblemente haya expirado.
            $response = array("error" => 1100, "description" => "Error token expirado");
            break;
        case 5:
            //aqui devolvemos si hay un test activo o no.
            $response = array("isTestActive" => isTokenTest());
            break;
        case 6:
            //aqui estamos devolviendo los datos desde la cache de la sesion.
            if (isTestFinished()) {
                $response = array("cache" => "get data from cache.", "data" => array("num_question" => getCountQuestion(), "correctCount" => getCorrectCount()));
            } else {
                $response = array("page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
            }
            break;
            //////////////////////DEFAULT/////////////////////////////////////
            //cualquier accion no contemplada entrara aqui.
        //////////////////////DEFAULT/////////////////////////////////////
        //cualquier accion no contemplada entrara aqui.
        default:
            $response = array("error" => 1040, "description" => "Error de PHP, error inesperado");
            break;
    }
    $connection->close();
    echo json_encode($response);
}
Ejemplo n.º 19
0
        <li class=''>
          <a href='./index.php?page={$page}&amp;edit=true'>Edit</a>
        </li>
        <li class=''>
          <a href='./index.php?page={$page}&amp;delete=true'>Delete</a>
        </li>
      </ul>
      <div class='content'>";

    echo "<h1>$page</h1>";
    $f = fopen($path,'r');
    $t = date("M j g:i a", filemtime($path));
    $p = fread($f, 25000);
    $d = replaceWiki($p,$t);
    echo nl2br($d);
	} else { createPage($page); }
   }
}

function replaceWiki($str,$t){
   $htmlstr = $str;
   $regexs = array(
      "/'{3}(.*?)'{3}/" => "<b>$1</b>",
      "/'{2}(.*?)'{2}/" => "<i>$1</i>",
      "/={2}(.*?)={2}/" => "<h2>$1</h2>",
      "/\[{2}(.*?)[|](.*?)\]{2}/" => "<a href= './index.php?page=$1'>$2</a>",
      "/\[{2}(.*?)\]{2}/" => "<a href= './index.php?page=$1'>$1</a>",
      "/\[(http.*?)[|](.*?)\]/" => "<a href= '$1'>$2</a>",
      "/\[(http.*?)\]/" => "<a href= '$1'>$1</a>",

   );
Ejemplo n.º 20
0
    $render .= '<h2>File Gallery Search Indexing</h2>';
    $render .= '<em>More info <a href="https://doc.tiki.org/Search+within+files">here</a></em>
	';
    renderTable($file_handlers);
    $render .= '<h2>PHP Info</h2>';
    if (isset($_REQUEST['phpinfo']) && $_REQUEST['phpinfo'] == 'y') {
        ob_start();
        phpinfo();
        $info = ob_get_contents();
        ob_end_clean();
        $info = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $info);
        $render .= $info;
    } else {
        $render .= '<a href="' . $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'] . '&phpinfo=y">Append phpinfo();</a>';
    }
    createPage('Tiki Server Compatibility', $render);
} elseif ($nagios) {
    //  0	OK
    //  1	WARNING
    //  2	CRITICAL
    //  3	UNKNOWN
    $monitoring_info = array('state' => 0, 'message' => '');
    function update_overall_status($check_group, $check_group_name)
    {
        global $monitoring_info;
        $state = 0;
        $message = '';
        foreach ($check_group as $property => $values) {
            if ($values['ack'] != true) {
                switch ($values['fitness']) {
                    case 'ugly':
Ejemplo n.º 21
0
	function createPage() {
		$expressionNameSpaceId = MWNamespace::getCanonicalIndex('expression');
		wfDebug( "NS ID: $expressionNameSpaceId \n" );
		return createPage( $expressionNameSpaceId, getPageTitle( $this->spelling ) );
	}
Ejemplo n.º 22
0
require 'authCheck.php';
if (!isset($USER->id)) {
    return;
}
require 'queries/pageQueries.php';
$PAGE->id = 'pageCreate';
$fields = array('name', 'desc', 'title');
$inputs = array();
//check POST object for variables from front end
foreach ($fields as $postKey) {
    if (isset($_POST[$postKey]) && !empty($_POST[$postKey])) {
        $inputs[$postKey] = $_POST[$postKey];
    } else {
        return errorHandler("missing {$postKey}", 503);
    }
}
//print debug statement
if ($SERVERDEBUG) {
    echo "\r\n inputs:";
    echo json_encode($inputs);
}
//setup for query
$stmt = createPage($DB, $inputs['name'], $inputs['desc'], $inputs['title']);
if (!$stmt) {
    return;
}
// createNewList already send error.
if (!$stmt->execute()) {
    return errorHandler("failed to create this user {$stmt->errno}: {$stmt->error}");
}
echo '{"id":"' . $stmt->insert_id . '"}';
Ejemplo n.º 23
0
if ($page != '') {
    $p = $page;
}
$where = '1=1';
if ($_REQUEST['cat'] != '') {
    $where = 'parent=' . $_REQUEST['cat'];
}
?>
<form method="POST" action="./" name="frmForm" enctype="multipart/form-data">
<input type="hidden" name="page" value="<?php 
echo $page;
?>
">
<input type="hidden" name="act" value="config">
<?php 
$pageindex = createPage(countRecord("tbl_config", $where), './?act=config&page=', $MAXPAGE, $page);
?>

<?php 
if ($_REQUEST['code'] == 1) {
    $errMsg = 'Cập nhật thành công.';
}
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr><td height="30" class="smallfont">Trang : <?php 
echo $pageindex;
?>
</td></tr>
</table>
Ejemplo n.º 24
0
if ($page != '') {
    $p = $page;
}
$where = '1=1';
?>
<form method="POST" action="./" name="frmForm" enctype="multipart/form-data">
<input type=hidden name="page" value="<?php 
echo $page;
?>
">
<input type="hidden" name="act" value="<?php 
echo $actConfig;
?>
">
<?php 
$pageindex = createPage(countRecord($tableConfig, $where), "./?act=" . $actConfig . "&cat=" . $_REQUEST['cat'] . "&page=", $MAXPAGE, $page);
?>

<?php 
if ($_REQUEST['code'] == 1) {
    $errMsg = 'Cập nhật thành công.';
}
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr><td height="30" class="smallfont">Trang : <?php 
echo $pageindex;
?>
</td></tr>
</table>
Ejemplo n.º 25
0
}
$urlAll = "activation=" . $_REQUEST['activation'] . "&delivery=" . $_REQUEST['delivery'] . "&ldate=" . $_REQUEST['ldate'] . "&";
$urlAll1 = "activation=" . $_REQUEST['activation'] . "&activation=" . $_REQUEST['activation'] . "&ldate=" . $_REQUEST['ldate'] . "&";
$parentWhereConfig = $parentWhereConfig1 . $whereActivation . $whereDelivery . $whereLdate;
$parentWhereConfigDEA = "id=" . $codeParent . " and {$whereStatus}";
$totalDetele = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultDetele);
$totalEdit = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultEdit);
$totalAddnew = 1;
//countRecord($tableCategoryConfigId,$parentWhereConfigDEA.$parentWhereConfigDefaultAddnew);
//DINH SO PHAN TRANG=======================================================[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/*--------KIEM TRA THUOC TINH---------------------*/
//$defaulType					=	getRecord($tableCategoryConfigId," id=".$_REQUEST['codeParent']." and ".$whereStatus);
$totalItems = countRecord($tableOrdersId, $parentWhereConfig);
$pageindex = createPage(countRecord($tableOrdersId, $parentWhereConfig), './?act=' . $actOrders . '&' . $urlAll . 'page=', $MAXPAGE, $page, '30', $_lang_A);
//phan trang
$showPageIndex = $totalItems > $MAXPAGE ? '<td height="30" class="smallfont" align="left" valign="middle" >' . TPAGE . ' :' . $pageindex . '</td>' : '';
//TIEU DE CUA COT=====================================================================[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
if ($totalDetele > 0) {
    $trDetele_1title = "<th width=\"20\" class=\"title\"><input type=\"checkbox\" name=\"chkall\" onClick=\"chkallClick(this);\"></th>";
    $trDetele_2title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trDetele_1bottom = "<td></td>";
    $trDeteleAllbottom = "<input type=\"submit\" value=\"" . TDELETESELECTSD . "\" name=\"btnDel\" onClick=\"return confirm('" . AAREYOUDELETE . "');\" class=\"button\">";
}
//SAC DINH THANH VIEN NAY CO CHO XOA KO==============
//SAC DINH THANH VIEN NAY CO CHO SUA KO==============
if ($totalEdit > 0) {
    $trEdit_1title = "<th  align=\"center\" valign=\"middle\" class=\"title\">&nbsp;</th>";
    $trEdit_1bottom = "<td></td>";
Ejemplo n.º 26
0
<?php

// Simple script to create a module from scratch.
// Also creates a default view page.
require_once 'scriptComponents.php';
if ($argc != 3 and $argc != 2) {
    die("Usage: createModule.php <moduleName> <defaultViewName>\n\nCreates a directory named <moduleName>, the <moduleName>.php file, and sets up the first view.\n");
}
$modName = $argv[1];
$pageName = isset($argv[2]) ? $argv[2] : NULL;
createModule($modName, $pageName);
$ok = chdir($modName);
if ($ok && $pageName) {
    createPage($pageName);
}
Ejemplo n.º 27
0
$where = '1=1';
if ($_REQUEST['cat'] != '') {
    $where = 'parent=' . $_REQUEST['cat'];
}
?>
<form method="POST" action="./" name="frmForm" enctype="multipart/form-data">
<input type="hidden" name="page" value="<?php 
echo $page;
?>
">
<input type="hidden" name="act" value="<?php 
echo $actConfig;
?>
">
<?php 
$pageindex = createPage(countRecord($tableConfig, $where), './?act=' . $actConfig . '&cat=' . $_REQUEST['cat'] . '&page=', $MAXPAGE, $page);
?>

<?php 
if ($_REQUEST['code'] == 1) {
    $errMsg = 'Cập nhật thành công.';
}
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<td height="30" class="smallfont">Trang : <?php 
echo $pageindex;
?>
</td>
		<td align="right" class="smallfont">
Ejemplo n.º 28
0
if ($page != '') {
    $p = $page;
}
$where = '1=1';
if ($_REQUEST['cat'] != '') {
    $where = 'parent=' . $_REQUEST['cat'];
}
?>
<form method="POST" action="./" name="frmForm" enctype="multipart/form-data">
<input type="hidden" name="page" value="<?php 
echo $page;
?>
">
<input type="hidden" name="act" value="member">
<?php 
$pageindex = createPage(countRecord("tbl_member", $where), './?act=member&page=', $MAXPAGE, $page);
?>

<?php 
if ($_REQUEST['code'] == 1) {
    $errMsg = 'Cập nhật thành công.';
}
?>

<table cellspacing="0" cellpadding="0" width="100%">
	<tr><td height="30" class="smallfont">Trang : <?php 
echo $pageindex;
?>
</td></tr>
</table>
Ejemplo n.º 29
0
} else {
    // Installer knows db details but no login details were received for this script.
    // Thus, display a form.
    $title = 'Tiki Installer Security Precaution';
    $content = '
							<p style="margin-top: 24px;">You are attempting to run the Tiki Installer. For your protection, this installer can be used only by a site administrator.</p>
							<p>To verify that you are a site administrator, enter your <strong><em>database</em></strong> credentials (database username and password) here.</p>
							<p>If you have forgotten your database credentials, find the directory where you have unpacked your Tiki and have a look inside the <strong><code>db</code></strong> folder into the <strong><code>local.php</code></strong> file.</p>
							<form method="post" action="tiki-install.php">
								<input type="hidden" name="enterinstall" value="1">
								<p><label for="dbuser" class="sr-only">Database username</label> <input type="text" id="dbuser" name="dbuser" placeholder="Database username"/></p>
								<p><label for="dbpass" class="sr-only">Database password</label> <input type="password" id="dbpass" name="dbpass" placeholder="Database password"/></p>
								<p><input type="submit" class="btn btn-primary btn-sm" value=" Validate and Continue " /></p>
							</form>
							<p>&nbsp;</p>';
    createPage($title, $content);
}
/**
 * creates the HTML page to be displayed.
 * 
 * Tiki may not have been installed when we reach here, so we can't use our templating system yet. 
 * 
 * @param string $title   page Title
 * @param mixed  $content page Content
 */
function createPage($title, $content)
{
    echo <<<END
<!DOCTYPE html 
\tPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Ejemplo n.º 30
0
            $newUser->setEmailChecker();
            $mailer->sendEmailVerify($newUser);
            if ($mailer->sendEmailVerify($newUser)) {
                $message = new Alert('info', true);
                $message->addText('Welcome <strong>' . $firstName . '</strong>! Before you log in, please confirm your email by clicking the link you received.');
                $message->messageToSession();
                $userManager->save($newUser);
                header('Location: index.php');
                exit;
            } else {
                $message = new Alert('warning', true);
                $message->addText('Sorry <strong>' . $firstName . '</strong> we had a little problem! Please try again.');
                $message->messageToSession();
            }
        } else {
            //User exist already ( email already used)
            $message->addText('Email address already registered.');
        }
    }
    //-------All fields are NOT correct OR user already registered --------
    // From here, there was a problem with one of the field or user already registered
    // We show the form again, prefill in with error message
    //Save message to transmit it to page
    $message->messageToSession();
    //Save correct fields to transmit to page
    $_SESSION['correctFields'] = $correctFields;
    createPage("register");
} else {
    //Visitor is on home page
    createPage("register");
}