function display($template, $cache_id, $cache_time = 0, $assigns = array())
{
    global $template_objects, $microtime;
    $template_object = $template_objects[$template][$cache_id] ? $template_objects[$template][$cache_id] : createTemplate($template, $cache_id);
    if ($template_object->isCached()) {
        $template_object->assign('microtime', $microtime);
        $template_object->assign('cached', true);
    } else {
        foreach ($GLOBALS as $key => $value) {
            if ($key !== 'smarty' && $key !== 'GLOBALS' && !startsWith($key, '_') && !startsWith($key, 'CNF_') && !startsWith($key, 'HTTP_')) {
                $template_object->assign($key, $value);
            }
        }
    }
    foreach ($assigns as $key => $value) {
        $template_object->assign($key, $value);
    }
    $template_object->setCacheLifetime($cache_time);
    $template_object->display();
}
예제 #2
0
*/
/*$str='<?xml version="1.0" encoding="utf-8"?> <IBABY><Response><Status><Code>200</Code>
</Status><UserTerminalList><UserTerminal><TerminalId>398339</TerminalId><NickName>398339</NickName><Gender>1</Gender><PhoneId>00030012161926005</PhoneId><Icon>icon1.jpg</Icon><Mobile></Mobile><IsOwner>1</IsOwner><SoftVersion>C88N-G-I-01</SoftVersion><PublicName><![CDATA[]]>
</PublicName></UserTerminal></UserTerminalList></Response></IBABY>';
$xmlObj = simplexml_load_string($str);
// echo $xmlObj;
print_r($xmlObj->Response->UserTerminalList->UserTerminal->TerminalId);*/
// echo $xmlObj->Response->Status->Code;
// echo $xmlObj->Response->UserTerminalList->UserTerminal->TerminalId;
// echo date('Y-m-d',time());
/*
echo strpos('../../../../../../../../windows/win.ini','../'); 
if (strpos('../../../../../../../../windows/win.ini','../')!==false) {
    echo 'qq11';
}*/
$data = createTemplate('ok7q-s8TymddxP1qnbSoqAa0xWMw', 'Xnp4rfmm-ZQcJ7Ed-TH1kq38sNDzPFYgNUfmwbSYv1I', '亲爱的用户,您的服务状态发生变更', '帮我买包米', '开始执行', '请耐心等待');
// echo $data;
/**
 *返回协议模式的模板消息
 *@param touser 欲发送给目标openid
 *@param template_id 模板id
 *@param url 可空,用户点击消息显示的url
 *@return json
 */
function createTemplate($touser, $template_id, $first, $Good, $contentType, $remark, $url = '')
{
    $data = ['touser' => $touser, 'template_id' => $template_id, 'url' => $url, 'topcolor' => '#FF0000', 'data' => ['first' => $first, 'Good' => $Good, 'contentType' => $contentType, 'remark' => $remark]];
    return json_encode($data);
}
// UID Timestamp  Nonce
// echo md5('290D3A2B-FE05-47CF-A382-C8CBC316CD2C14423004824259264611kcurimnfgmkfmfl');
            }
        }
        $zip->close();
    } else {
        abort('Could not open temporary file.');
    }
} elseif (!is_null($issue_id) && !is_null($group_id)) {
    $group = Utils::getGroup($group_id);
    if (is_null($group)) {
        abort('Group not found.');
    }
    $issue = Utils::getIssue($issue_id);
    if (is_null($issue)) {
        abort('Issue not found.');
    }
    list($filename, $tmpfile) = createTemplate($group, $issue, false, $format);
} else {
    abort('No group and no issue.');
}
if (substr($filename, -3) == 'xls') {
    $mime_type = 'application/vnd.ms-excel';
} else {
    $mime_type = 'application/zip';
}
header('Content-Type: ' . $mime_type);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($tmpfile));
readfile($tmpfile);
    if (isset($_GET["phase"]) && is_numeric($_GET["phase"])) {
        $phase = $_GET["phase"];
    } else {
        $phase = 0;
    }
}
$sid = getSid();
$dataSource_dir = "upload_raw_data/{$sid}/";
$dataSource_dirPath = mnmpath . $dataSource_dir;
//  my_base_url . $dataSource_dir
$excelFileMode = $_SESSION["excelFileMode_{$sid}"];
$ext = $_SESSION["fileExt_{$sid}"];
switch ($phase) {
    case 0:
        // When submit btn in step1 is clicked, the function executes.
        createTemplate($sid, $dataSource_dir, $dataSource_dirPath, $excelFileMode, $ext);
        break;
    case 1:
        // when jump to step 3, this function is called.
        addSheetsSettings($sid, $dataSource_dirPath);
        match_schema($sid);
        break;
    case 2:
        break;
    case 3:
        // Step 2 - get sheet name.
        printSheet($sid, $dataSource_dir, $dataSource_dirPath);
        break;
    case 4:
        break;
    case 5:
예제 #5
0
<?php

include_once '../common.php';
include_once '../libraries/unit.php';
$template = json_decode(file_get_contents("php://input"), true);
if (isset($template)) {
    if (isset($template['deleted']) && $template['deleted']) {
        deleteTemplate($template['id']);
    } else {
        createTemplate($template);
    }
}
fetchTemplates();
function createTemplate($template)
{
    createLayer($template, TEMPLATE_ID());
}
function deleteTemplate($id)
{
    deleteLayer(intval($id));
}
function fetchTemplates()
{
    echo '{"result":' . json_encode(getLayers(TEMPLATE_ID())) . '}';
}
function TEMPLATE_ID()
{
    return -1;
}
예제 #6
0
/*   Autor: Ajiraj   *****/
$ROOT = '';
/*   change below lines to reflect in the joomla admin area  **/
$AUTHOR = 'AjiRaj';
$DESC = 'Module Generated with module-skelton generator';
$DATE = date('d M y');
/*  No need to edit below this  **/
if (isset($_POST['mod_name']) && $_POST['mod_name'] != '') {
    $moduleName_original = $_POST['mod_name'];
    $moduleName = str_replace(" ", "_", $moduleName_original);
    $ROOT = './output/mod_' . $moduleName;
    createFloders($moduleName);
    createEntryPoint($moduleName);
    createXml($moduleName, $moduleName_original);
    createHelper($moduleName);
    createTemplate($moduleName);
    header('Location:complete.php');
} else {
    header('Location:index.php');
}
/**********************   Functions   **************************/
function createFloders($moduleName, $moduleName_original)
{
    global $ROOT;
    $structures = array($ROOT, $ROOT . '/tmpl', $ROOT . '/assets');
    foreach ($structures as $structure) {
        if (!mkdir($structure, 0777, true)) {
            die('Failed to create folders...' . $structure);
        } else {
            $myfile = fopen($structure . "/index.html", "w") or die("Unable to open file!");
            $txt = '<html><body bgcolor="#FFFFFF"></body></html>';
예제 #7
0
$path = getcwd();
$matches = array();
preg_match('~/([^/]+)$~', $path, $matches);
$namespace = isset($matches[1]) ? $matches[1] : '';
$presenterTemplate = "<?php\n\nnamespace Admin\\{$namespace};\n\nuse Admin\\BasePresenter;\n\n/**\n * Presenter s \n *\n * @author Svaťa\n */\nclass {$presenterName}Presenter extends BasePresenter {\n\n}\n";
function createTemplate($presenterName, $name)
{
    $template = '';
    $template .= "{block #content}\n";
    if ($name == 'list') {
        $template .= "\t<div class='widget-box'>\n\t\t<div class='widget-title'>\n\t\t\t<span class='icon'>\n\t\t\t\t<i class='fa fa-'></i>\n\t\t\t</span>\n\t\t\t<h5>{include #titleNavigation}</h5>\n\t\t</div>\n\t\t<div class='widget-content'>\n\t\t\t<h5><a n:href='add'>{_''}</a></h5>\n\t\t</div>\n\t</div>\n\t{control grid}";
    } elseif ($name == 'edit') {
        $template .= "\t{control formEdit}";
    } elseif ($name == 'add') {
        $template .= "\t{control formAdd}";
    }
    $template .= "\n{/block}";
    return $template;
}
$dirMod = 0775;
if (!is_dir('presenters')) {
    mkdir('presenters', $dirMod);
}
if (!is_dir("templates/{$presenterName}")) {
    mkdir("templates/{$presenterName}", $dirMod, true);
}
file_put_contents("presenters/{$presenterName}Presenter.php", $presenterTemplate);
$templates = array('add', 'edit', 'list');
foreach ($templates as $template) {
    file_put_contents("templates/{$presenterName}/{$template}.latte", createTemplate($presenterName, $template));
}
예제 #8
0
			loadMemeText();
		};
		img.src = document.querySelector('#imageSelector').value;
	}
	function loadMemeText(){
		//top text
		context.font = topText.size + "pt Impact";
		var textWidth = context.measureText(topText.text).width; // width of text before being written to canvas
		if (textWidth >= canvas.width-50 && topText.size >= 30) { //text too big must be minimised
			topText.shrink();
		} else if (textWidth <= canvas.width/2 && topText.size <= 50) {
			topText.dilate();
		}
		context.fillText(topText.text, canvas.width/2, topText.size+20);
		context.strokeText(topText.text, canvas.width/2, topText.size+20);

		//bottom text
		context.font = bottomText.size + "pt Impact";
		textWidth = context.measureText(bottomText.text).width;
		if (textWidth >= canvas.width-50 && bottomText.size >= 30) { //text too big must be minimised
			bottomText.shrink();
		} else if (textWidth <= canvas.width/2 && bottomText.size <= 50) {
			bottomText.dilate();
		}
		context.fillText(bottomText.text, canvas.width/2, canvas.height-20);
		context.strokeText(bottomText.text, canvas.width/2, canvas.height-20);
	}
</script>
<?php 
createTemplate(array(), 'footer');