本文整理汇总了PHP中Vtiger_Viewer::setTemplateDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Viewer::setTemplateDir方法的具体用法?PHP Vtiger_Viewer::setTemplateDir怎么用?PHP Vtiger_Viewer::setTemplateDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Viewer
的用法示例。
在下文中一共展示了Vtiger_Viewer::setTemplateDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mStep3
public function mStep3(Vtiger_Request $request)
{
$system = $request->get('system');
$source_directory = $request->get('source_directory');
$username = $request->get('username');
$password = $request->get('password');
$errorText = '';
$loginStatus = false;
$migrationURL = 'Install.php?mode=execute&ajax=true&system=' . $system . '&user=' . $username;
$viewer = new Vtiger_Viewer();
$createConfig = Install_InitSchema_Model::createConfig($source_directory, $username, $password, $system);
if ($createConfig['result']) {
include 'config/config.inc.php';
$adb = new PearDatabase($dbconfig['db_type'], $dbconfig['db_hostname'], $dbconfig['db_name'], $dbconfig['db_username'], $dbconfig['db_password']);
vglobal('adb', $adb);
$query = "SELECT crypt_type, user_name FROM vtiger_users WHERE user_name=?";
$result = $adb->requirePsSingleResult($query, array($username), true);
if ($adb->num_rows($result) > 0) {
$crypt_type = $adb->query_result($result, 0, 'crypt_type');
$salt = substr($username, 0, 2);
if ($crypt_type == 'MD5') {
$salt = '$1$' . $salt . '$';
} elseif ($crypt_type == 'BLOWFISH') {
$salt = '$2$' . $salt . '$';
} elseif ($crypt_type == 'PHP5.3MD5') {
$salt = '$1$' . str_pad($salt, 9, '0');
}
$encrypted_password = crypt($password, $salt);
$query = "SELECT 1 from vtiger_users where user_name=? AND user_password=? AND status = ?";
$result = $adb->requirePsSingleResult($query, array($username, $encrypted_password, 'Active'), true);
if ($adb->num_rows($result) > 0) {
$loginStatus = true;
}
}
if (!$loginStatus) {
$errorText = 'LBL_WRONG_USERNAME_OR_PASSWORD';
file_put_contents('config/config.inc.php', '');
}
} else {
$errorText = $createConfig['text'];
}
$viewer->setTemplateDir('install/tpl/');
$viewer->assign('LANG', $request->get('lang'));
$viewer->assign('MIGRATIONURL', $migrationURL);
$viewer->assign('ERRORTEXT', $errorText);
$viewer->assign('MIGRATIONRESULT', $migrationResult);
echo $viewer->fetch('mStep3.tpl');
if ($loginStatus) {
echo $viewer->fetch('mStep3Pre.tpl');
$migrationResult = Install_InitSchema_Model::executeMigrationSchema($system, $username, $source_directory);
echo $viewer->fetch('mStep3Post.tpl');
}
}