本文整理汇总了PHP中iPHP::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::alert方法的具体用法?PHP iPHP::alert怎么用?PHP iPHP::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iPHP
的用法示例。
在下文中一共展示了iPHP::alert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_batch
function do_batch()
{
$idArray = (array) $_POST['id'];
$idArray or iPHP::alert("请选择要操作的关键词");
$ids = implode(',', $idArray);
$batch = $_POST['batch'];
switch ($batch) {
case 'dels':
iPHP::$break = false;
foreach ($idArray as $id) {
$this->do_del($id, false);
}
iPHP::$break = true;
iPHP::success('关键词全部删除完成!', 'js:1');
break;
}
}
示例2: do_save
function do_save()
{
$gid = intval($_POST['gid']);
$type = intval($_POST['type']);
$name = iS::escapeStr($_POST['name']);
$power = $_POST['power'] ? json_encode($_POST['power']) : '';
$cpower = $_POST['cpower'] ? json_encode($_POST['cpower']) : '';
$name or iPHP::alert('角色名不能为空');
$fields = array('name', 'ordernum', 'power', 'cpower', 'type');
$data = compact($fields);
if ($gid) {
iDB::update('group', $data, array('gid' => $gid));
$msg = "角色修改完成!";
} else {
iDB::insert('group', $data);
$msg = "角色添加完成!";
}
iPHP::success($msg, 'url:' . APP_URI);
}
示例3: do_saveproject
function do_saveproject()
{
$id = (int) $_POST['id'];
$name = iS::escapeStr($_POST['name']);
$urls = iS::escapeStr($_POST['urls']);
$list_url = $_POST['list_url'];
$cid = iS::escapeStr($_POST['cid']);
$rid = iS::escapeStr($_POST['rid']);
$poid = iS::escapeStr($_POST['poid']);
$poid = iS::escapeStr($_POST['poid']);
$checker = iS::escapeStr($_POST['checker']);
$self = isset($_POST['self']) ? '1' : '0';
$sleep = (int) $_POST['sleep'];
$auto = iS::escapeStr($_POST['auto']);
$psleep = (int) $_POST['psleep'];
$lastupdate = $_POST['lastupdate'] ? iPHP::str2time($_POST['lastupdate']) : '';
empty($name) && iPHP::alert('名称不能为空!');
empty($cid) && iPHP::alert('请选择绑定的栏目');
empty($rid) && iPHP::alert('请选择采集规则');
//empty($poid) && iPHP::alert('请选择发布规则');
$fields = array('name', 'urls', 'list_url', 'cid', 'rid', 'poid', 'checker', 'self', 'sleep', 'auto', 'lastupdate', 'psleep');
$data = compact($fields);
if ($id) {
iDB::update('spider_project', $data, array('id' => $id));
} else {
iDB::insert('spider_project', $data);
}
iPHP::success('完成', 'url:' . APP_URI . '&do=project');
}
示例4: permission_msg
public static function permission_msg($p = '', $ret = '')
{
if ($ret == 'alert') {
iPHP::alert('您没有相关权限!');
exit;
} elseif ($ret == 'page') {
include self::view("admincp.permission");
exit;
}
}
示例5: crawl
//.........这里部分代码省略.........
}
$contentArray[] = $_content;
$contentHash[$cmd5] = true;
$pageurl[$md5] = $purl;
spider::$allHtml[$md5] = $phtml;
}
gc_collect_cycles();
unset($check_content, $phtml);
if (spider::$dataTest) {
echo "<b>最终分页列表:</b><pre>";
print_r($pageurl);
echo "</pre><hr />";
}
} else {
foreach ((array) spider::$allHtml as $ahkey => $phtml) {
$contentArray[] = spiderContent::match($phtml, $data, $rule);
}
}
}
$content = implode('#--iCMS.PageBreak--#', $contentArray);
$html = null;
unset($html, $contentArray, $contentHash, $_content);
$content = stripslashes($content);
if (spider::$dataTest) {
print_r('<b>[' . $name . ']匹配结果:</b>' . htmlspecialchars($content));
echo "<hr />";
}
if ($data['cleanbefor']) {
$content = spiderTools::dataClean($data['cleanbefor'], $content);
}
/**
* 在数据项里调用之前采集的数据[DATA@name][DATA@name.key]
*/
if (strpos($content, '[DATA@') !== false) {
$content = spiderTools::getDATA($responses, $content);
}
if ($data['cleanhtml']) {
$content = stripslashes($content);
$content = preg_replace('/<[\\/\\!]*?[^<>]*?>/is', '', $content);
}
if ($data['format'] && $content) {
$content = autoformat($content);
}
if ($data['img_absolute'] && $content) {
// $content = stripslashes($content);
preg_match_all("/<img.*?src\\s*=[\"|'](.*?)[\"|']/is", $content, $img_match);
if ($img_match[1]) {
$_img_array = array_unique($img_match[1]);
$_img_urls = array();
foreach ((array) $_img_array as $_img_key => $_img_src) {
$_img_urls[$_img_key] = spiderTools::url_complement($rule['__url__'], $_img_src);
}
$content = str_replace($_img_array, $_img_urls, $content);
}
unset($img_match, $_img_array, $_img_urls, $_img_src);
}
if ($data['trim']) {
$content = trim($content);
}
if ($data['capture']) {
// $content = stripslashes($content);
$content = spiderTools::remote($content);
}
if ($data['download']) {
// $content = stripslashes($content);
$content = iFS::http($content);
}
if ($data['cleanafter']) {
$content = spiderTools::dataClean($data['cleanafter'], $content);
// $content = stripslashes($content);
}
if ($data['autobreakpage']) {
$content = spiderTools::autoBreakPage($content);
}
if ($data['mergepage']) {
$content = spiderTools::mergePage($content);
}
if ($data['empty'] && empty($content)) {
$emptyMsg = '[' . $name . ']规则设置了不允许为空.当前抓取结果为空!请检查,规则是否正确!';
if (spider::$dataTest) {
exit('<h1>' . $emptyMsg . '</h1>');
}
if (spider::$work) {
echo "\n{$emptyMsg}\n";
return false;
} else {
iPHP::alert($emptyMsg);
}
}
if ($data['json_decode']) {
$content = json_decode($content, true);
}
if ($data['array']) {
return (array) $content;
}
if (spider::$callback['content'] && is_callable(spider::$callback['content'])) {
$content = call_user_func_array(spider::$callback['content'], array($content));
}
return $content;
}
示例6: __action_profile_setpassword
private function __action_profile_setpassword()
{
iPHP::seccode($_POST['seccode'], true) or iPHP::alert('iCMS:seccode:error');
$oldPwd = md5($_POST['oldPwd']);
$newPwd1 = md5($_POST['newPwd1']);
$newPwd2 = md5($_POST['newPwd2']);
$newPwd1 != $newPwd2 && iPHP::alert("user:password:unequal");
$password = iDB::value("SELECT `password` FROM `#iCMS@__user` where `uid`='" . user::$userid . "' limit 1");
$oldPwd != $password && iPHP::alert("user:password:original");
iDB::query("UPDATE `#iCMS@__user` SET `password` = '{$newPwd1}' WHERE `uid` = '" . user::$userid . "';");
iPHP::alert("user:password:modified", 'js:parent.location.reload();');
}
示例7: do_del
function do_del($uid = null, $dialog = true)
{
$uid === null && ($uid = $this->uid);
$uid or iPHP::alert('请选择要删除的用户');
iDB::query("DELETE FROM `#iCMS@__user` WHERE `uid` = '{$uid}'");
iDB::query("DELETE FROM `#iCMS@__prop_map` WHERE `iid` = '{$uid}' AND `appid` = '" . iCMS_APP_USER . "' ;");
$dialog && iPHP::success('用户删除完成', 'js:parent.$("#tr' . $uid . '").remove();');
}
示例8: Article
function Article($id)
{
$app = iCMS::run('article', 'article', 'object');
$htm = $app->article($id);
$htm or iPHP::alert("文章所属栏目URL规则设置问题! 此栏目下的文章不能生成静态,请修改栏目的访问模式和URL规则");
$total = $htm[1]['page']['total'];
$title = $htm[1]['title'];
iFS::check_ext($htm[1]['iurl']->path) or iPHP::alert("文件类型不合法,禁止生成!<hr />请更改栏目->URL规则设置->内容规则");
iFS::mkdir($htm[1]['iurl']->dir);
iFS::write($htm[1]['iurl']->path, $htm[0]);
if ($total >= 2) {
for ($ap = 2; $ap <= $total; $ap++) {
$htm = $app->article($id, $ap);
$fpath = iPHP::p2num($htm[1]['iurl']->pagepath, $ap);
iFS::write($fpath, $htm[0]);
}
}
unset($app, $htm);
return $title;
}
示例9: crawl
public static function crawl($_pid = NULL, $_rid = NULL, $_url = NULL, $_title = NULL)
{
ini_get('safe_mode') or set_time_limit(0);
$sid = spider::$sid;
if ($sid) {
$sRs = iDB::row("SELECT * FROM `#iCMS@__spider_url` WHERE `id`='{$sid}' LIMIT 1;");
$title = $sRs->title;
$cid = $sRs->cid;
$pid = $sRs->pid;
$url = $sRs->url;
$rid = $sRs->rid;
} else {
$rid = spider::$rid;
$pid = spider::$pid;
$title = spider::$title;
$url = spider::$url;
$_rid === NULL or $rid = $_rid;
$_pid === NULL or $pid = $_pid;
$_title === NULL or $title = $_title;
$_url === NULL or $url = $_url;
}
if ($pid) {
$project = spider::project($pid);
$prule_list_url = $project['list_url'];
}
$ruleA = spider::rule($rid);
$rule = $ruleA['rule'];
$dataArray = $rule['data'];
if ($prule_list_url) {
$rule['list_url'] = $prule_list_url;
}
if (spider::$dataTest) {
echo "<b>抓取规则信息</b><pre>";
print_r(iS::escapeStr($ruleA));
print_r(iS::escapeStr($project));
echo "</pre><hr />";
}
spider::$curl_proxy = $rule['proxy'];
$responses = array();
$html = spiderTools::remote($url);
if (empty($html)) {
$msg = '错误:001..采集 ' . $url . '文件内容为空!请检查采集规则';
if (spider::$work == 'shell') {
echo "{$msg}\n";
return false;
} else {
iPHP::alert($msg);
}
}
// $http = spider::check_content_code($html);
//
// if($http['match']==false){
// return false;
// }
// $content = $http['content'];
spider::$allHtml = "";
$rule['__url__'] = spider::$url;
$responses['reurl'] = spider::$url;
$responses['__title__'] = $title;
foreach ((array) $dataArray as $key => $data) {
$content_html = $html;
$dname = $data['name'];
/**
* [UNSET:name]
* 注销[name]
* @var string
*/
if (strpos($dname, 'UNSET:') !== false) {
$_dname = str_replace('UNSET:', '', $dname);
unset($responses[$_dname]);
continue;
}
/**
* [DATA:name]
* 把之前[name]处理完的数据当作原始数据
* 如果之前有数据会叠加
* 用于数据多次处理
* @var string
*/
if (strpos($dname, 'DATA:') !== false) {
$_dname = str_replace('DATA:', '', $dname);
$content_html = $responses[$_dname];
unset($responses[$dname]);
}
/**
* [PRE:name]
* 把PRE:name采集到的数据 当做原始数据
* 一般用于下载内容
* @var string
*/
$pre_dname = 'PRE:' . $dname;
if (isset($responses[$pre_dname])) {
$content_html = $responses[$pre_dname];
unset($responses[$pre_dname]);
}
/**
* [EMPTY:name]
* 如果[name]之前抓取结果数据为空使用这个数据项替换
* @var string
*/
//.........这里部分代码省略.........
示例10: do_delfile
function do_delfile()
{
iACP::MP('FILE.DELETE', 'alert');
$_GET['path'] or iPHP::alert("请选择要删除的文件");
strpos($_GET['path'], '..') !== false && iPHP::alert("文件路径中带有..");
$hash = md5($_GET['path']);
$FileRootPath = iFS::fp($_GET['path'], '+iPATH');
if (iFS::del($FileRootPath)) {
$msg = 'success:#:check:#:文件删除完成!';
$_GET['ajax'] && iPHP::json(array('code' => 1, 'msg' => $msg));
} else {
$msg = 'warning:#:warning:#:找不到相关文件,文件删除失败!';
$_GET['ajax'] && iPHP::json(array('code' => 0, 'msg' => $msg));
}
iPHP::dialog($msg, 'js:parent.$("#' . $hash . '").remove();');
}
示例11: checker
public static function checker($work = null, $pid = null, $url = null, $title = null)
{
$pid === null && ($pid = spider::$pid);
$url === null && ($url = spider::$url);
$title === null && ($title = spider::$title);
$project = spider::project($pid);
$hash = md5($url);
if ($project['checker'] && empty($_GET['indexid']) || $work == "DATA@RULE") {
$title = iS::escapeStr($title);
$url = iS::escapeStr($url);
$project_checker = $project['checker'];
$work == "DATA@RULE" && ($project_checker = '1');
switch ($project_checker) {
case '1':
//按网址检查
$sql = "`url` = '{$url}'";
$label = $url . PHP_EOL;
$msg = $label . '该网址的文章已经发布过!请检查是否重复';
break;
case '2':
//按标题检查
$sql = "`title` = '{$title}'";
$label = $title . PHP_EOL;
$msg = $label . '该标题的文章已经发布过!请检查是否重复';
break;
case '3':
//网址和标题
$sql = "`url` = '{$url}' AND `title` = '{$title}'";
$label = $title . PHP_EOL . $url;
$msg = $label . '该网址和标题的文章已经发布过!请检查是否重复';
break;
}
$project['self'] && ($sql .= " AND `pid`='" . $pid . "'");
$checker = iDB::value("SELECT `id` FROM `#iCMS@__spider_url` where {$sql} AND `publish` in(1,2)");
if ($checker) {
$work === NULL && iPHP::alert($msg, 'js:parent.$("#' . $hash . '").remove();');
if ($work == 'shell') {
echo $msg . "\n";
return false;
}
if ($work == "WEB@AUTO") {
return '-1';
}
return false;
} else {
return true;
}
}
return true;
}
示例12: crawl
public static function crawl($work = NULL, $pid = NULL, $_rid = NULL, $_urls = null, $callback = null)
{
$pid === NULL && ($pid = spider::$pid);
if ($pid) {
$project = spider::project($pid);
$cid = $project['cid'];
$rid = $project['rid'];
$prule_list_url = $project['list_url'];
$lastupdate = $project['lastupdate'];
} else {
$cid = spider::$cid;
$rid = spider::$rid;
}
if (empty($rid) && $_rid !== NULL) {
$rid = $_rid;
}
if ($work == 'shell') {
$lastupdate = $project['lastupdate'];
if ($project['psleep']) {
if (time() - $lastupdate < $project['psleep']) {
echo '采集方案[' . $pid . "]:" . format_date($lastupdate) . "刚采集过了,请" . $project['psleep'] / 3600 . "小时后在继续采集\n";
return;
}
}
echo "[32m开始采集方案[" . $pid . "] 采集规则[" . $rid . "][0m\n";
}
$ruleA = spider::rule($rid);
$rule = $ruleA['rule'];
$urls = $rule['list_urls'];
$project['urls'] && ($urls = $project['urls']);
spiderUrls::$urls && ($urls = spiderUrls::$urls);
$_urls && ($urls = $_urls);
$urlsArray = explode("\n", $urls);
$urlsArray = array_filter($urlsArray);
$_urlsArray = $urlsArray;
$urlsList = array();
if ($work == 'shell') {
// echo "$urls\n";
print_r($urlsArray);
}
foreach ($_urlsArray as $_key => $_url) {
$_url = htmlspecialchars_decode($_url);
$_urlsList = array();
/**
* RULE@rid@url
* url使用[rid]规则采集并返回列表结果
*/
if (strpos($_url, 'RULE@') !== false) {
list($___s, $_rid, $_urls) = explode('@', $_url);
if (spider::$ruleTest) {
print_r('<b>使用[rid:' . $_rid . ']规则抓取列表</b>:' . $_urls);
echo "<hr />";
}
$_urlsList = spiderUrls::crawl($work, false, $_rid, $_urls, 'CALLBACK@URL');
$urlsList = array_merge($urlsList, $_urlsList);
unset($urlsArray[$_key]);
} else {
preg_match('|.*<(.*)>.*|is', $_url, $_matches);
if ($_matches) {
list($format, $begin, $num, $step, $zeroize, $reverse) = explode(',', $_matches[1]);
$url = str_replace($_matches[1], '*', trim($_matches[0]));
$_urlsList = spiderTools::mkurls($url, $format, $begin, $num, $step, $zeroize, $reverse);
unset($urlsArray[$_key]);
$urlsList = array_merge($urlsList, $_urlsList);
}
}
}
$urlsList && ($urlsArray = array_merge($urlsArray, $urlsList));
unset($_urlsArray, $_key, $_url, $_matches, $_urlsList, $urlsList);
$urlsArray = array_unique($urlsArray);
// spider::$useragent = $rule['user_agent'];
// spider::$encoding = $rule['curl']['encoding'];
// spider::$referer = $rule['curl']['referer'];
// spider::$charset = $rule['charset'];
if (empty($urlsArray)) {
if ($work == 'shell') {
echo "采集列表为空!请填写!\n";
return false;
}
iPHP::alert('采集列表为空!请填写!', 'js:parent.window.iCMS_MODAL.destroy();');
}
// if(spider::$ruleTest){
// echo "<pre>";
// print_r(iS::escapeStr($project));
// print_r(iS::escapeStr($rule));
// echo "</pre>";
// echo "<hr />";
// }
if ($rule['mode'] == "2") {
iPHP::import(iPHP_LIB . '/phpQuery.php');
spider::$ruleTest && $_GET['pq_debug'] && (phpQuery::$debug = 1);
}
$pubArray = array();
$pubCount = array();
$pubAllCount = array();
spider::$curl_proxy = $rule['proxy'];
spider::$urlslast = null;
foreach ($urlsArray as $key => $url) {
$url = trim($url);
spider::$urlslast = $url;
//.........这里部分代码省略.........
示例13: preg_replace
$content = iFS::read($config, false);
$content = preg_replace("/define\\(\\'iPHP_DB_HOST\\',\\'.*?\\'\\)/is", "define('iPHP_DB_HOST','" . iPHP_DB_HOST . "')", $content);
$content = preg_replace("/define\\(\\'iPHP_DB_USER\\',\\'.*?\\'\\)/is", "define('iPHP_DB_USER','" . iPHP_DB_USER . "')", $content);
$content = preg_replace("/define\\(\\'iPHP_DB_PASSWORD\\',\\'.*?\\'\\)/is", "define('iPHP_DB_PASSWORD','" . iPHP_DB_PASSWORD . "')", $content);
$content = preg_replace("/define\\(\\'iPHP_DB_NAME\\',\\'.*?\\'\\)/is", "define('iPHP_DB_NAME','" . iPHP_DB_NAME . "')", $content);
$content = preg_replace("/define\\(\\'iPHP_DB_PREFIX\\',\\'.*?\\'\\)/is", "define('iPHP_DB_PREFIX','" . iPHP_DB_PREFIX . "')", $content);
$content = preg_replace("/define\\(\\'iPHP_KEY\\',\\'.*?\\'\\)/is", "define('iPHP_KEY','" . random(32) . "')", $content);
$parse_url = parse_url($router_url);
$host = $parse_url['host'];
$COOKIE_DOMAIN = '.' . iPHP::domain($host);
preg_match("/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\$/", $host) && ($COOKIE_DOMAIN = '');
$content = preg_replace("/define\\(\\'iPHP_COOKIE_DOMAIN\\',\\s*\\'.*?\\'\\)/is", "define('iPHP_COOKIE_DOMAIN','{$COOKIE_DOMAIN}')", $content);
iFS::write($config, $content, false);
//开始安装 数据库
$sql_file = dirname(strtr(__FILE__, '\\', '/')) . '/iCMS.V6.sql';
is_readable($sql_file) or iPHP::alert('数据库文件不存在或者读取失败', 'js:top.callback();');
//require_once ($config);
$sql = iFS::read($sql_file);
// $sql = str_replace('#iCMS@__',$db_prefix,$sql);
//
//
run_query($sql);
//设置超级管理员
$admin_password = md5($admin_password);
iDB::query("\n\t\tUPDATE `#iCMS@__members`\n\t\tSET `username` = '{$admin_name}', `password` = '{$admin_password}'\n\t\tWHERE `uid` = '1';\n\t");
//配置程序
$result = iDB::all("SELECT * FROM `#iCMS@__config` WHERE `appid`='0'");
foreach ($result as $key => $c) {
$value = $c['value'];
strstr($c['value'], 'a:') && ($value = unserialize($c['value']));
$setting[$c['name']] = $value;
示例14: check_dir
function check_dir($dir, $appid, $url, $cid = 0)
{
$sql = "SELECT `dir` FROM `#iCMS@__category` where `dir` ='{$dir}' AND `appid`='{$appid}'";
$cid && ($sql .= " AND `cid` !='{$cid}'");
iDB::value($sql) && empty($url) && iPHP::alert('该' . $this->category_name . '静态目录已经存在!<br />请重新填写(URL规则设置->静态目录)');
}
示例15: do_query
function do_query()
{
$field = $_POST["field"];
$pattern = $_POST["pattern"];
$replacement = $_POST["replacement"];
$where = $_POST["where"];
$pattern or iPHP::alert("查找项不能为空~!");
if ($field == "body") {
$rows_affected = iDB::query("UPDATE `#iCMS@__article_data` SET `body` = REPLACE(`body`, '{$pattern}', '{$replacement}') {$where}");
} else {
if ($field == "tkd") {
$rows_affected = iDB::query("UPDATE `#iCMS@__article` SET `title` = REPLACE(`title`, '{$pattern}', '{$replacement}'),\n\t\t \t`keywords` = REPLACE(`keywords`, '{$pattern}', '{$replacement}'),\n\t\t \t`description` = REPLACE(`description`, '{$pattern}', '{$replacement}'){$where}");
} else {
$rows_affected = iDB::query("UPDATE `#iCMS@__article` SET `{$field}` = REPLACE(`{$field}`, '{$pattern}', '{$replacement}'){$where}");
}
}
iPHP::success($rows_affected . "条记录被替换<hr />操作完成!!");
}