本文整理汇总了PHP中isStandardTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP isStandardTemplate函数的具体用法?PHP isStandardTemplate怎么用?PHP isStandardTemplate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isStandardTemplate函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_upgrade_all
function db_upgrade_all($oldversion)
{
/// This function does anything necessary to upgrade
/// older versions to match current functionality
global $modifyoutput, $dbprefix, $usertemplaterootdir, $standardtemplaterootdir, $clang;
echo str_pad($clang->gT('The LimeSurvey database is being upgraded') . ' (' . date('Y-m-d H:i:s') . ')', 14096) . "." . $clang->gT('Please be patient...') . "<br /><br />\n";
if ($oldversion < 143) {
// Move all user templates to the new user template directory
echo sprintf($clang->gT("Moving user templates to new location at %s..."), $usertemplaterootdir) . "<br />";
$myDirectory = opendir($standardtemplaterootdir);
$aFailedTemplates = array();
// get each entry
while ($entryName = readdir($myDirectory)) {
if (!in_array($entryName, array('.', '..', '.svn')) && is_dir($standardtemplaterootdir . DIRECTORY_SEPARATOR . $entryName) && !isStandardTemplate($entryName)) {
if (!rename($standardtemplaterootdir . DIRECTORY_SEPARATOR . $entryName, $usertemplaterootdir . DIRECTORY_SEPARATOR . $entryName)) {
$aFailedTemplates[] = $entryName;
}
}
}
if (count($aFailedTemplates) > 0) {
echo "The following templates at {$standardtemplaterootdir} could not be moved to the new location at {$usertemplaterootdir}:<br /><ul>";
foreach ($aFailedTemplates as $sFailedTemplate) {
echo "<li>{$sFailedTemplate}</li>";
}
echo "</ul>Please move these templates manually after the upgrade has finished.<br />";
}
// close directory
closedir($myDirectory);
}
}
示例2: gettemplatelist
function gettemplatelist($usertemplaterootdir, $standardtemplates, $standardtemplaterootdir)
{
#global $usertemplatierootdir, $standardtemplates,$standardtemplaterootdir;
if (!$usertemplaterootdir) {
die("gettemplatelist() no template directory");
}
if ($handle = opendir($standardtemplaterootdir)) {
while (false !== ($file = readdir($handle))) {
if (!is_file("{$standardtemplaterootdir}/{$file}") && $file != "." && $file != ".." && $file != ".svn" && isStandardTemplate($file)) {
$list_of_files[$file] = $standardtemplaterootdir . DIRECTORY_SEPARATOR . $file;
}
}
closedir($handle);
}
if ($handle = opendir($usertemplaterootdir)) {
while (false !== ($file = readdir($handle))) {
if (!is_file("{$usertemplaterootdir}/{$file}") && $file != "." && $file != ".." && $file != ".svn") {
$list_of_files[$file] = $usertemplaterootdir . DIRECTORY_SEPARATOR . $file;
}
}
closedir($handle);
}
if (!empty($list_of_files)) {
ksort($list_of_files);
}
return $list_of_files;
}
示例3: templaterename
/**
* Function responsible to rename a template(folder).
*
* @access public
* @return void
*/
public function templaterename()
{
if (!Permission::model()->hasGlobalPermission('templates', 'update')) {
die('No permission');
}
if (returnGlobal('action') == "templaterename" && returnGlobal('newname') && returnGlobal('copydir')) {
$clang = Yii::app()->lang;
$sOldName = sanitize_dirname(returnGlobal('copydir'));
$sNewName = sanitize_dirname(returnGlobal('newname'));
$sNewDirectoryPath = Yii::app()->getConfig('usertemplaterootdir') . "/" . $sNewName;
$sOldDirectoryPath = Yii::app()->getConfig('usertemplaterootdir') . "/" . returnGlobal('copydir');
if (isStandardTemplate(returnGlobal('newname'))) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $sNewName) . " " . $clang->gT("This name is reserved for standard template.", "js"));
} elseif (file_exists($sNewDirectoryPath)) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $sNewName) . " " . $clang->gT("A template with that name already exists.", "js"));
} elseif (rename($sOldDirectoryPath, $sNewDirectoryPath) == false) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $sNewName) . " " . $clang->gT("Maybe you don't have permission.", "js"));
} else {
Survey::model()->updateAll(array('template' => $sNewName), "template = :oldname", array(':oldname' => $sOldName));
if (getGlobalSetting('defaulttemplate') == $sOldName) {
setGlobalSetting('defaulttemplate', $sNewName);
}
$this->index("startpage.pstpl", "welcome", $sNewName);
}
}
}
示例4: upgradeTables143
//.........这里部分代码省略.........
$iSaveSQID = $aQIDReplacements[$row['qid'] . '_' . $row['code']];
} else {
$iSaveSQID = $aInsert['qid'];
}
if (($row['type'] == 'M' || $row['type'] == 'P') && $row['default_value'] == 'Y') {
modifyDatabase("", "INSERT INTO {{defaultvalues}} (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0," . dbQuoteAll($row['language']) . ",'','Y')");
echo $modifyoutput;
flush();
@ob_flush();
}
}
// Sanitize data
if (Yii::app()->db->driverName == 'pgsql') {
modifyDatabase("", "delete from {{answers}} USING {{questions}} WHERE {{answers}}.qid={{questions}}.qid AND {{questions}}.type in ('1','F','H','M','P','W','Z')");
echo $modifyoutput;
flush();
@ob_flush();
} else {
modifyDatabase("", "delete {{answers}} from {{answers}} LEFT join {{questions}} ON {{answers}}.qid={{questions}}.qid where {{questions}}.type in ('1','F','H','M','P','W','Z')");
echo $modifyoutput;
flush();
@ob_flush();
}
// Convert labels to answers
$answerquery = "select qid ,type ,lid ,lid1, language from {{questions}} where parent_qid=0 and type in ('1','F','H','M','P','W','Z')";
$answerresult = Yii::app()->getDb()->createCommand($answerquery)->queryAll();
foreach ($answerresult as $row) {
$labelquery = "Select * from {{labels}} where lid={$row['lid']} and language=" . dbQuoteAll($row['language']);
$labelresult = Yii::app()->getDb()->createCommand($labelquery)->queryAll();
foreach ($labelresult as $lrow) {
modifyDatabase("", "INSERT INTO {{answers}} (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']}," . dbQuoteAll($lrow['code']) . "," . dbQuoteAll($lrow['title']) . ",{$lrow['sortorder']}," . dbQuoteAll($lrow['language']) . ",{$lrow['assessment_value']})");
echo $modifyoutput;
flush();
@ob_flush();
//$labelids[]
}
if ($row['type'] == '1') {
$labelquery = "Select * from {{labels}} where lid={$row['lid1']} and language=" . dbQuoteAll($row['language']);
$labelresult = Yii::app()->getDb()->createCommand($labelquery)->queryAll();
foreach ($labelresult as $lrow) {
modifyDatabase("", "INSERT INTO {{answers}} (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']}," . dbQuoteAll($lrow['code']) . "," . dbQuoteAll($lrow['title']) . ",{$lrow['sortorder']}," . dbQuoteAll($lrow['language']) . ",1,{$lrow['assessment_value']})");
echo $modifyoutput;
flush();
@ob_flush();
}
}
}
// Convert labels to subquestions
$answerquery = "select * from {{questions}} where parent_qid=0 and type in (';',':')";
$answerresult = Yii::app()->getDb()->createCommand($answerquery)->queryAll();
foreach ($answerresult as $row) {
$labelquery = "Select * from {{labels}} where lid={$row['lid']} and language=" . dbQuoteAll($row['language']);
$labelresult = Yii::app()->getDb()->createCommand($labelquery)->queryAll();
foreach ($labelresult as $lrow) {
$aInsert = array();
if (isset($aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'])) {
$aInsert['qid'] = $aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'];
}
$aInsert['sid'] = $row['sid'];
$aInsert['gid'] = $row['gid'];
$aInsert['parent_qid'] = $row['qid'];
$aInsert['type'] = $row['type'];
$aInsert['title'] = $lrow['code'];
$aInsert['question'] = $lrow['title'];
$aInsert['question_order'] = $lrow['sortorder'];
$aInsert['language'] = $lrow['language'];
$aInsert['scale_id'] = 1;
$iLastInsertID = Question::model()->insertRecords($aInsert);
if (isset($aInsert['qid'])) {
$aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'] = $iLastInsertID;
}
}
}
$updatequery = "update {{questions}} set type='!' where type='W'";
modifyDatabase("", $updatequery);
echo $modifyoutput;
flush();
@ob_flush();
$updatequery = "update {{questions}} set type='L' where type='Z'";
modifyDatabase("", $updatequery);
echo $modifyoutput;
flush();
@ob_flush();
// Now move all non-standard templates to the /upload dir
$usertemplaterootdir = Yii::app()->getConfig("usertemplaterootdir");
$standardtemplaterootdir = Yii::app()->getConfig('standardtemplaterootdir');
if (!$usertemplaterootdir) {
die("getTemplateList() no template directory");
}
if ($handle = opendir($standardtemplaterootdir)) {
while (false !== ($file = readdir($handle))) {
if (!is_file("{$standardtemplaterootdir}/{$file}") && $file != "." && $file != ".." && $file != ".svn" && !isStandardTemplate($file)) {
if (!rename($standardtemplaterootdir . DIRECTORY_SEPARATOR . $file, $usertemplaterootdir . DIRECTORY_SEPARATOR . $file)) {
echo "There was a problem moving directory '" . $standardtemplaterootdir . DIRECTORY_SEPARATOR . $file . "' to '" . $usertemplaterootdir . DIRECTORY_SEPARATOR . $file . "' due to missing permissions. Please do this manually.<br />";
}
}
}
closedir($handle);
}
}
示例5: upgrade_tables143
//.........这里部分代码省略.........
flush();
ob_flush();
}
}
}
modify_database("", "delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')");
echo $modifyoutput;
flush();
ob_flush();
// Convert labels to answers
$answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')";
$answerresult = db_execute_assoc($answerquery);
if (!$answerresult) {
return "Database Error";
} else {
while ($row = $answerresult->FetchRow()) {
$labelquery = "Select * from {$dbprefix}labels where lid={$row['lid']} and language=" . db_quoteall($row['language']);
$labelresult = db_execute_assoc($labelquery);
while ($lrow = $labelresult->FetchRow()) {
modify_database("", "INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']}," . db_quoteall($lrow['code']) . "," . db_quoteall($lrow['title']) . ",{$lrow['sortorder']}," . db_quoteall($lrow['language']) . ",{$lrow['assessment_value']})");
echo $modifyoutput;
flush();
ob_flush();
//$labelids[]
}
if ($row['type'] == '1') {
$labelquery = "Select * from {$dbprefix}labels where lid={$row['lid1']} and language=" . db_quoteall($row['language']);
$labelresult = db_execute_assoc($labelquery);
while ($lrow = $labelresult->FetchRow()) {
modify_database("", "INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']}," . db_quoteall($lrow['code']) . "," . db_quoteall($lrow['title']) . ",{$lrow['sortorder']}," . db_quoteall($lrow['language']) . ",1,{$lrow['assessment_value']})");
echo $modifyoutput;
flush();
ob_flush();
}
}
}
}
// Convert labels to subquestions
$answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')";
$answerresult = db_execute_assoc($answerquery);
if (!$answerresult) {
return "Database Error";
} else {
while ($row = $answerresult->FetchRow()) {
$labelquery = "Select * from {$dbprefix}labels where lid={$row['lid']} and language=" . db_quoteall($row['language']);
$labelresult = db_execute_assoc($labelquery);
while ($lrow = $labelresult->FetchRow()) {
$insertarray = array();
if (isset($aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'])) {
$insertarray['qid'] = $aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'];
db_switchIDInsert('questions', true);
}
$insertarray['sid'] = $row['sid'];
$insertarray['gid'] = $row['gid'];
$insertarray['type'] = $row['type'];
$insertarray['parent_qid'] = $row['qid'];
$insertarray['title'] = $lrow['code'];
$insertarray['question'] = $lrow['title'];
$insertarray['question_order'] = $lrow['sortorder'];
$insertarray['language'] = $lrow['language'];
$insertarray['scale_id'] = 1;
$tablename = "{$dbprefix}questions";
$query = $connect->GetInsertSQL($tablename, $insertarray);
modify_database("", $query);
echo $modifyoutput;
flush();
ob_flush();
if (isset($insertarray['qid'])) {
$aQIDReplacements[$row['qid'] . '_' . $lrow['code'] . '_1'] = $connect->Insert_ID("{$dbprefix}questions", "qid");
db_switchIDInsert('questions', false);
}
}
}
}
$updatequery = "update {$dbprefix}questions set type='!' where type='W'";
modify_database("", $updatequery);
echo $modifyoutput;
flush();
ob_flush();
$updatequery = "update {$dbprefix}questions set type='L' where type='Z'";
modify_database("", $updatequery);
echo $modifyoutput;
flush();
ob_flush();
// Now move all non-standard templates to the /upload dir
global $usertemplaterootdir, $standardtemplates, $standardtemplaterootdir;
if (!$usertemplaterootdir) {
die("gettemplatelist() no template directory");
}
if ($handle = opendir($standardtemplaterootdir)) {
while (false !== ($file = readdir($handle))) {
if (!is_file("{$standardtemplaterootdir}/{$file}") && $file != "." && $file != ".." && $file != ".svn" && !isStandardTemplate($file)) {
if (!rename($standardtemplaterootdir . DIRECTORY_SEPARATOR . $file, $usertemplaterootdir . DIRECTORY_SEPARATOR . $file)) {
echo "There was a problem moving directory '" . $standardtemplaterootdir . DIRECTORY_SEPARATOR . $file . "' to '" . $usertemplaterootdir . DIRECTORY_SEPARATOR . $file . "' due to missing permissions. Please do this manually.<br />";
}
}
}
closedir($handle);
}
}
示例6: getTemplateURL
/**
* This function returns the complete URL path to a given template name
*
* @param mixed $sTemplateName
*/
function getTemplateURL($sTemplateName)
{
if (isStandardTemplate($sTemplateName)) {
return Yii::app()->getConfig("standardtemplaterooturl") . '/' . $sTemplateName;
} else {
if (file_exists(Yii::app()->getConfig("usertemplaterootdir") . '/' . $sTemplateName)) {
return Yii::app()->getConfig("usertemplaterooturl") . '/' . $sTemplateName;
} elseif (file_exists(Yii::app()->getConfig("usertemplaterootdir") . '/' . Yii::app()->getConfig('defaulttemplate'))) {
return Yii::app()->getConfig("usertemplaterooturl") . '/' . Yii::app()->getConfig('defaulttemplate');
} elseif (file_exists(Yii::app()->getConfig("standardtemplaterootdir") . '/' . Yii::app()->getConfig('defaulttemplate'))) {
return Yii::app()->getConfig("standardtemplaterooturl") . '/' . Yii::app()->getConfig('defaulttemplate');
} else {
return Yii::app()->getConfig("standardtemplaterooturl") . '/default';
}
}
}
示例7: templaterename
/**
* Function responsible to rename a template(folder).
*
* @access public
* @return void
*/
public function templaterename()
{
if (returnGlobal('action') == "templaterename" && returnGlobal('newname') && returnGlobal('copydir')) {
$clang = Yii::app()->lang;
$newname = sanitize_paranoid_string(returnGlobal('newname'));
$newdirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . $newname;
$olddirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . returnGlobal('copydir');
if (isStandardTemplate(returnGlobal('newname'))) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("This name is reserved for standard template.", "js"));
} elseif (rename($olddirname, $newdirname) == false) {
$this->getController()->error(sprintf($clang->gT("Directory could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("Maybe you don't have permission.", "js"));
} else {
$templatename = $newname;
$this->index("startpage.pstpl", "welcome", $templatename);
}
}
}
示例8: is_template_editable
/**
* This function checks if a certain template may be by modified, copied, deleted according to the settings in config.php
* @param mixed $templatename
*/
function is_template_editable($templatename)
{
if (isStandardTemplate($templatename) && Yii::app()->getConfig("standard_templates_readonly") == true) {
return false;
} else {
return true;
}
}
示例9: sGetTemplateURL
/**
* This function returns the complete URL path to a given template name
*
* @param mixed $sTemplateName
*/
function sGetTemplateURL($sTemplateName)
{
global $standardtemplaterooturl, $standardtemplaterootdir, $usertemplaterooturl, $usertemplaterootdir, $defaulttemplate;
if (isStandardTemplate($sTemplateName)) {
return $standardtemplaterooturl . '/' . $sTemplateName;
} else {
if (file_exists($usertemplaterootdir . '/' . $sTemplateName)) {
return $usertemplaterooturl . '/' . $sTemplateName;
} elseif (file_exists($usertemplaterootdir . '/' . $defaulttemplate)) {
return $usertemplaterooturl . '/' . $defaulttemplate;
} elseif (file_exists($standardtemplaterootdir . '/' . $defaulttemplate)) {
return $standardtemplaterooturl . '/' . $defaulttemplate;
} else {
return $standardtemplaterooturl . '/default';
}
}
}
示例10: is_template_editable
/**
* This function checks if a certain template may be by modified, copied, deleted according to the settings in config.php
* @param mixed $templatename
*/
function is_template_editable($templatename)
{
global $standard_templates_readonly, $debug, $defaulttemplate;
if ($debug > 1) {
return true;
} elseif (isStandardTemplate($templatename) && $standard_templates_readonly == true) {
return false;
} else {
return true;
}
}
示例11: templaterename
/**
* Function responsible to rename a template(folder).
*
* @access public
* @return void
*/
public function templaterename()
{
if (returnGlobal('action') == "templaterename" && returnGlobal('newname') && returnGlobal('copydir')) {
$clang = Yii::app()->lang;
$oldname = sanitize_paranoid_string(returnGlobal('copydir'));
$newname = sanitize_paranoid_string(returnGlobal('newname'));
$newdirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . $newname;
$olddirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . returnGlobal('copydir');
if (isStandardTemplate(returnGlobal('newname'))) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("This name is reserved for standard template.", "js"));
} elseif (file_exists($newdirname)) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("A template with that name already exists.", "js"));
} elseif (rename($olddirname, $newdirname) == false) {
$this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("Maybe you don't have permission.", "js"));
} else {
Survey::model()->updateAll(array('template' => $newname), "template = '{$oldname}'");
$this->index("startpage.pstpl", "welcome", $newname);
}
}
}