本文整理汇总了PHP中check类的典型用法代码示例。如果您正苦于以下问题:PHP check类的具体用法?PHP check怎么用?PHP check使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了check类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$user = $dbh->staff($_SESSION['user']);
if (!$user['password']) {
main::errors("Wrong username!?");
} else {
if (crypto::passhash($postvar['old'], $user['salt']) == $user['password']) {
if ($postvar['new'] != $postvar['confirm']) {
main::errors("Your passwords don't match!");
} else {
$salt = crypto::salt();
$newpass = crypto::passhash($postvar['new'], $salt);
$update_staff = array("password" => $newpass, "salt" => $salt);
$dbh->update("staff", $update_staff, array("id", "=", $_SESSION['user']));
main::errors("Password changed!");
}
} else {
main::errors("Your old password was wrong!");
}
}
}
}
echo style::replaceVar("tpl/admin/change-admin-password.tpl");
}
示例2: saveInfo
function saveInfo($arrData, $intModify = 0, $isAlert = true, $isLastID = false)
{
global $arrGWeb;
$arr = array();
$arr = check::SqlInjection($this->saveTableFieldG($arrData));
if ($intModify == 0) {
if ($this->insertInfo($arr)) {
if ($isAlert) {
check::Alert("恭喜你,订阅成功!系统将返回到首页", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
} else {
return true;
}
} else {
if ($isAlert) {
check::Alert("订阅失败", -1);
} else {
return false;
}
}
} else {
if ($this->updateInfo($arr)) {
if ($isAlert) {
check::Alert("退订成功!系统将返回到首页", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
} else {
return true;
}
} else {
if ($isAlert) {
check::Alert("退订失败", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
} else {
return false;
}
}
}
}
示例3: smarty_modifier_api
/**
* Smarty truncate modifier plugin
*
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param integer
* @param string
* @param boolean
* @param boolean
* @return string
*/
function smarty_modifier_api($array, $class, $fun, $args = '', $debug = false)
{
if (empty($class) || empty($fun)) {
return $array;
}
$result = check::getAPI($class, $fun, $args, $debug);
return $result;
}
示例4: smarty_modifier_imgurl
/**
* Smarty truncate modifier plugin
*
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param integer
* @param string
* @param boolean
* @param boolean
* @return string
*/
function smarty_modifier_imgurl($string, $module = '')
{
global $arrGWeb;
if (empty($module)) {
$module = $arrGWeb['module_id'];
}
return check::getImgUrl($module);
}
示例5: smarty_modifier_age
/**
* Smarty truncate modifier plugin
*
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param integer
* @param string
* @param boolean
* @param boolean
* @return string
*/
function smarty_modifier_age($date, $blday = true)
{
if ($date == '0000-00-00') {
return '0';
} else {
return check::birthday2age($date, $blday);
}
}
示例6: long_long_equal
function long_long_equal($a, $b, $message)
{
if (!($a === $b)) {
if (!((double) $a === $b)) {
return check::fail($message . ": '{$a}'!=='{$b}'");
}
}
return TRUE;
}
示例7: __tostring
function __tostring()
{
$input1 = "";
if ($this->number == 0) {
$input1 .= "<script>alert('查不到');history.back();</script>";
} else {
foreach ($this->info as $value) {
$sql = "select * from t_wz";
$f = new check($sql);
$input1 .= "<div class='post' id='post-001'>";
$input1 .= "<h1>" . $value['title'] . "</h1>";
$input1 .= "<small>" . $value['sj'] . "|</small> <a>分类:" . $value['kind'] . "</a>";
$input1 .= "<div id='rensheng'><img src='../img/" . $value['id'] . ".jpg'></div>";
$input1 .= "<div id='comments'><a href='blog_main.php?action=article2&id=" . $value['id'] . "'>readermore</a> <a>|</a><a>comments(" . $f->check1($value['id']) . ")</a></div>";
$input1 .= " </div>";
}
}
return $input1;
}
示例8: smarty_modifier_ip_replace
/**
* Smarty truncate modifier plugin
*
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param integer
* @param string
* @param boolean
* @param boolean
* @return string
*/
function smarty_modifier_ip_replace($ip, $start = 4, $ellipsis = '*')
{
if (check::FormatIP($ip)) {
$start = $start - 1;
$arrIP = explode('.', $ip);
foreach ($arrIP as $k => $v) {
if ($k >= $start) {
$arrIP[$k] = $ellipsis;
}
}
$ip = implode('.', $arrIP);
return $ip;
}
}
示例9: uploadInfoImage
/**
* 上传文件
* @author 肖飞
* @param array $arrFile 图片文件信息数组$_FILES
* @param int $PR 自动压缩的比例
* @param int $intID 内容ID,标示新增还是修改
* @return unknown
*/
function uploadInfoImage($arrFile, $PR = 0, $intID = 0)
{
if ($arrFile['name']) {
if (!in_array(strtolower($arrFile['type']), array('image/jpg', 'image/jpeg', 'image/gif', 'image/pjpeg', 'image/png', 'image/x-png', 'application/x-shockwave-flash'))) {
check::AlertExit('文件类型不符合要求(' . $arrFile['type'] . ')', -1);
}
}
if ($intID == 0) {
$intID = $this->getMaxID();
}
$strDir = ceil($intID / 1000);
$strMakeDir = $this->arrGPic['FileSavePath'] . $strDir;
if (!is_dir($this->arrGPic['FileSavePath'])) {
@mkdir($this->arrGPic['FileSavePath']);
@chmod($this->arrGPic['FileSavePath'], 0777);
}
if (!is_dir($strMakeDir)) {
@mkdir($strMakeDir);
@chmod($strMakeDir, 0777);
}
$FileExt = strrchr($arrFile['name'], ".");
//取得上传文件扩展名
$strPhoto = $strDir . "/" . $intID . "_" . time() . $FileExt;
//存入数据库的图片访问路径
$strPicName = $strMakeDir . "/" . $intID . "_" . time() . $FileExt;
//新图片路径及名称
if ($arrFile['type'] != 'application/x-shockwave-flash' && $arrFile['size'] > $this->arrGPic['FileMaxSize']) {
if ($PR != 0) {
move_uploaded_file($arrFile['tmp_name'], $strPicName);
$objGDImage = new GDImage();
if ($objGDImage->makePRThumb($strPicName, $PR)) {
return $strPhoto;
} else {
check::AlertExit($strPicName . "文件上传错误!", -1);
}
} else {
check::AlertExit("文件大小不符合要求!", -1);
}
} else {
if (move_uploaded_file($arrFile['tmp_name'], $strPicName)) {
return $strPhoto;
} else {
check::AlertExit($strPicName . "文件上传错误!", -1);
}
}
}
示例10: import
public function import()
{
global $dbh, $postvar, $getvar, $instance;
if (!$_POST) {
$servers_query = $dbh->select("servers", array("type", "=", "zpanel"), 0, 0, 1);
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$zpanel_array['DROPDOWN'] = main::dropdown("server", $values);
echo style::replaceVar("tpl/admin/import/zpanel.tpl", $zpanel_array);
} elseif ($_POST) {
$postvar['server'] = $postvar['server'];
//Hack to make sure we post the 'server' field as it doesn't post if it's empty.
check::empty_fields();
if (main::errors()) {
echo "<ERRORS>";
} else {
$n = 0;
include INC . "/servers/zpanel.php";
$zpanel = new zpanel($postvar['server']);
$zpanel_accounts = $zpanel->listaccs($postvar['server']);
foreach ($zpanel_accounts as $zpanel_data) {
$packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
$users_data = $dbh->select("users", array("user", "=", $zpanel_data['user']));
if (!$packages_data['id']) {
$packages_insert = array("name" => $zpanel_data['package'], "backend" => $zpanel_data['package'], "description" => "Imported from ZPanel: " . $zpanel_data['package'], "type" => "free", "server" => $postvar['server'], "admin" => "1");
$dbh->insert("packages", $packages_insert);
}
$new_packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
if (!$users_data['id']) {
$salt = crypto::salt();
$newpass = crypto::passhash(rand(), $salt);
$users_insert = array("user" => $zpanel_data['user'], "zpanel_uid" => $zpanel_data['user'], "email" => $zpanel_data['user'], "password" => $zpanel_data['user'], "salt" => $zpanel_data['user'], "signup" => $zpanel_data['user'], "status" => $zpanel_data['user'], "domain" => $zpanel_data['user'], "pid" => $zpanel_data['user']);
$dbh->insert("users", $users_insert);
$dbh->insert("users_bak", $users_insert);
$n++;
}
}
echo $n . " Accounts have been imported";
}
}
}
示例11: saveInfo
/**
* 保存信息内容
* @author 肖飞
* @param int $arrData 信息信息数组
* @return void
*/
function saveInfo($arrData, $intModify = 0, $isAlert = true)
{
$arr = array();
$arr = check::SqlInjection($this->saveTableFieldG($arrData));
if ($intModify == 0) {
if (!empty($_SESSION['user_id'])) {
$arr['user_id'] = intval($_SESSION['user_id']);
}
if ($this->insertInfo($arr)) {
if ($isAlert) {
check::Alert("预约成功,我们会尽快通知您,祝您生活愉快", -1);
}
check::AlertExit("", $arrGWeb['WEB_ROOT_pre'] . "/xingfu_apply/");
} else {
check::Alert("发布失败", -1);
}
} else {
if ($this->updateInfo($arr)) {
check::Alert("修改成功!");
} else {
check::Alert("修改失败");
}
}
}
示例12: doInfoAction
/**
* 执行信息操作
* @author 肖飞
* @param string $strAction 执行命令
* @param array $arrData 选中的操作数据id数组
* @param array $arrFile 需要删除的文件
* @return boolen
*/
public function doInfoAction($strAction = null, $arrData = null, $arrFile = array('photo'))
{
switch ($strAction) {
case 'del':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'd')) {
check::AlertExit('对不起,您没有删除权限', -1);
}
$this->deleteInfo($val, $arrFile);
}
break;
case 'delpic':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'd')) {
check::AlertExit('对不起,您没有删除权限', -1);
}
$this->deleteInfoPic($val, $arrFile);
}
break;
case 'moveup':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->moveupInfo($val);
}
break;
case 'check':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->passInfo($val, 1);
}
break;
case 'uncheck':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->passInfo($val, 0);
}
break;
case 'settop':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->topInfo($val, 1);
}
break;
case 'unsettop':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->topInfo($val, 0);
}
break;
case 'setrecommend':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->recommendInfo($val, 1);
}
break;
case 'unsetrecommend':
foreach ($arrData as $key => $val) {
if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
check::AlertExit('对不起,您没有执行权限', -1);
}
$this->recommendInfo($val, 0);
}
break;
}
return true;
}
示例13: array_values
}
if (is_array($_POST['photo'])) {
$_POST['thumbnail'] = $_POST['photo'][0]['photo'];
} else {
$_POST['thumbnail'] = $_POST['photo'];
}
$_POST['photo'] = array_values($_POST['photo']);
$_POST['video'] = array_values($_POST['video']);
#自动拆字生成tag
if (empty($_POST['tag'])) {
$objSP = new SplitWord();
$_POST['tag'] = $objSP->SplitRMM($_POST['title'], false);
}
$_POST = array_merge($arrInfo, $_POST);
$objWebInit->saveInfo($_POST, 1);
$objWebInit->updateCache($_POST['id'], $_POST['type_id'], $arrMOutput);
check::WindowLocation('index.php', 'page=' . $_GET['page']);
}
if (!is_array($arrMType) || empty($arrMType)) {
$arrMType = $objWebInit->getTypeList();
$arrMType = $objWebInit->formatTypeList(0, $arrMType);
}
// 输出到模板
$arrMOutput["template_file"] = "admin.html";
$arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath'];
$arrMOutput["smarty_assign"]['FileListPicSize'] = $objWebInit->arrGPic['FileListPicSize'];
$arrMOutput["smarty_assign"]['arrData'] = $arrInfo;
$arrMOutput["smarty_assign"]['arrMType'] = $arrMType;
$arrMOutput["smarty_assign"]['action_type'] = "save";
$arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['admin_main_dir'] . 'submit.htm';
$objWebInit->output($arrMOutput);
示例14: A
require "tests.php";
require "exception_order.php";
check::functions(array(a_foo, a_bar, a_foobar, a_barfoo));
check::classes(array(A, E1, E2, E3, exception_order, ET_i, ET_d));
check::globals(array(efoovar, foovar, cfoovar, a_sfoovar, a_foovar, a_efoovar));
$a = new A();
try {
$a->foo();
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
$a->bar();
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E2 exception thrown', '');
}
try {
$a->foobar();
} catch (Exception $e) {
check::equal($e->getMessage(), 'postcatch unknown', '');
}
try {
$a->barfoo(1);
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
$a->barfoo(2);
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E2 * exception thrown', '');
}
示例15: smarty_modifier_age
/**
* Smarty truncate modifier plugin
*
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param integer
* @param string
* @param boolean
* @param boolean
* @return string
*/
function smarty_modifier_age($date, $blday = false)
{
return check::birthday2age($date, $blday);
}