本文整理汇总了PHP中cpg_die函数的典型用法代码示例。如果您正苦于以下问题:PHP cpg_die函数的具体用法?PHP cpg_die怎么用?PHP cpg_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpg_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($template, $vars = array(), $debug = FALSE)
{
if ($debug) {
echo '<pre>';
var_dump($vars);
echo '</pre>';
}
if (is_array($vars) && count($vars) > 0) {
$this->setVars($vars);
}
$viewPath = $this->getViewPath($template);
if (!file_exists($viewPath)) {
cpg_die(ERROR, sprintf(Lang::item('error.missing_vw_file'), $viewPath), __FILE__, __LINE__);
}
extract($this->vars);
// checking model
$authorizer = check_model::getInstance();
ob_start();
include_once $viewPath;
$fr_contents = ob_get_contents();
ob_end_clean();
if (empty($fr_title) || !$fr_title) {
$fr_title = $vars[nagavitor][0][1] . " - " . Config::item('fr_title');
}
include_once $this->getMainPath();
}
示例2: display_log_list
function display_log_list()
{
global $lang_viewlog_php;
$log_list = getloglist('logs/');
if (count($log_list) > 0) {
foreach ($log_list as $log) {
echo <<<EOT
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t\t<td class="tableb">
\t\t\t\t\t\t\t\t\t\t\t\t<img src="images/folder.gif" alt="" /> <a href= "{$_SERVER['PHP_SELF']}?log={$log['logname']}">{$log['logname']}</a>
\t\t\t\t\t\t\t\t\t\t\t\t ( <i>{$log['filesize']} KB</i> )
\t\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t</tr>
EOT;
}
echo <<<EOT
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t\t<td class="tableb" align="center">
\t\t\t\t\t\t\t\t\t\t\t\t<input class="button" type="button" value="{$lang_viewlog_php['delete_all']}" name="dall" id="dall" onclick="window.location='viewlog.php?action=dall';" />
\t\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t</tr>
EOT;
} else {
cpg_die(INFORMATION, $lang_viewlog_php['no_logs'], __FILE__, 1);
}
}
示例3: display_log_list
function display_log_list()
{
global $lang_viewlog_php, $folder_icon, $delete_all_icon, $delete_this_icon, $view_icon, $lang_date;
$log_list = getloglist('logs/');
if (count($log_list) > 0) {
foreach ($log_list as $log) {
$mtime = localised_date($log['mtime'], $lang_date['log']);
$filesize = cpg_format_bytes($log['filesize']);
echo <<<EOT
<tr>
<td class="tableb">
{$folder_icon} <a href= "viewlog.php?log={$log['logname']}">{$log['logname']}</a>
( <em>{$filesize}</em>, {$lang_viewlog_php['last_updated']}: <em>{$mtime}</em>)
</td>
</tr>
EOT;
}
echo <<<EOT
<tr>
<td class="tableb" align="center">
<button type="button" class="button" name="dall" value="{$lang_viewlog_php['delete_all']}" id="dall" onclick="window.location='viewlog.php?action=dall';">{$delete_all_icon}{$lang_viewlog_php['delete_all']}</button>
</td>
</tr>
EOT;
} else {
cpg_die(INFORMATION, $lang_viewlog_php['no_logs'], __FILE__, __LINE__);
}
}
示例4: process_post_data
function process_post_data()
{
global $HTTP_POST_VARS, $CONFIG;
global $lang_errors;
$pid = (int) $HTTP_POST_VARS['id'];
$aid = (int) $HTTP_POST_VARS['aid'];
$pwidth = (int) $HTTP_POST_VARS['pwidth'];
$pheight = (int) $HTTP_POST_VARS['pheight'];
$title = $HTTP_POST_VARS['title'];
$caption = $HTTP_POST_VARS['caption'];
$keywords = $HTTP_POST_VARS['keywords'];
$user1 = $HTTP_POST_VARS['user1'];
$user2 = $HTTP_POST_VARS['user2'];
$user3 = $HTTP_POST_VARS['user3'];
$user4 = $HTTP_POST_VARS['user4'];
$read_exif = isset($HTTP_POST_VARS['read_exif']);
$reset_vcount = isset($HTTP_POST_VARS['reset_vcount']);
$reset_votes = isset($HTTP_POST_VARS['reset_votes']);
$del_comments = isset($HTTP_POST_VARS['del_comments']) || $delete;
$query = "SELECT category, filepath, filename FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='{$pid}'";
$result = db_query($query);
if (!mysql_num_rows($result)) {
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
}
$pic = mysql_fetch_array($result);
mysql_free_result($result);
if (!(GALLERY_ADMIN_MODE || USER_ADMIN_MODE)) {
if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
cpg_die(ERROR, $lang_errors['perm_denied'] . "<br />(picture category = {$pic['category']}/ {$pid})", __FILE__, __LINE__);
}
if (!isset($user_album_set[$aid])) {
cpg_die(ERROR, $lang_errors['perm_denied'] . "<br />(target album = {$aid})", __FILE__, __LINE__);
}
}
$update = "aid = '" . $aid . "'";
if (is_movie($pic['filename'])) {
$update .= ", pwidth = " . $pwidth;
$update .= ", pheight = " . $pheight;
}
$update .= ", title = '" . addslashes($title) . "'";
$update .= ", caption = '" . addslashes($caption) . "'";
$update .= ", keywords = '" . addslashes($keywords) . "'";
$update .= ", user1 = '" . addslashes($user1) . "'";
$update .= ", user2 = '" . addslashes($user2) . "'";
$update .= ", user3 = '" . addslashes($user3) . "'";
$update .= ", user4 = '" . addslashes($user4) . "'";
if ($reset_vcount) {
$update .= ", hits = '0'";
}
if ($reset_votes) {
$update .= ", pic_rating = '0', votes = '0'";
}
if ($del_comments) {
$query = "DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}'";
$result = db_query($query);
} else {
$query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET {$update} WHERE pid='{$pid}' LIMIT 1";
$result = db_query($query);
}
}
示例5: template_uninstall
function template_uninstall()
{
global $CONFIG, $lang_errors;
$superCage = Inspekt::makeSuperCage();
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
// Delete the plugin config records
return true;
}
示例6: cpg_db_error
/**
* cpg_db_error()
*
* Error message if a query failed
*
* @param $the_error
* @return
**/
function cpg_db_error($the_error)
{
global $CONFIG, $lang_errors;
if (!$CONFIG['debug_mode']) {
cpg_die(CRITICAL_ERROR, $lang_errors['database_query'], __FILE__, __LINE__);
} else {
$the_error .= "\n\nmySQL error: " . mysql_error() . "\n";
$out = "<br />" . $lang_errors['database_query'] . ".<br /><br/>\n <form name=\"mysql\"><textarea rows=\"8\" cols=\"60\">" . htmlspecialchars($the_error) . "</textarea></form>";
die($out);
}
}
示例7: remove_picture_geodata
function remove_picture_geodata()
{
global $CONFIG, $USER_DATA, $lang_errors, $lang_editpics_php, $geodata_superCage, $lang_plugin_geodata, $aid;
//Check if the form token is valid
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
//PID picture + AID album
$pid = $geodata_superCage->post->getInt('id');
$query = "DELETE from {$CONFIG['TABLE_PREFIX']}plugin_geodata where geodata_pid='{$pid}'";
$vResult = cpg_db_query($query);
}
示例8: plugin_geoip_uninstall
function plugin_geoip_uninstall()
{
global $CONFIG;
$superCage = Inspekt::makeSuperCage();
if (!checkFormToken()) {
global $lang_errors;
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
// Delete the plugin config records
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_geoip_scope'");
return true;
}
示例9: index
function index()
{
$vars = array();
$authorizer = check_model::getInstance();
$vars['nagavitor'] = $this->forum->get_nagavitor();
$vars['cat_id'] = $this->validate->get->getInt('id');
if ($vars['cat_id']) {
if (!$authorizer->is_cat_id($vars['cat_id'])) {
cpg_die(ERROR, Lang::item('error.wrong_cat_id'), __FILE__, __LINE__);
}
}
$vars['user_posts'] = $this->forum->get_user_post_count();
$vars['last_visit'] = $this->forum->get_last_visit_time();
$cats = $this->forum->get_category($vars['cat_id'], 'cat_id, name');
$vars['categories'] = array();
foreach ($cats as $cat) {
$newcat = array();
$newcat['name'] = $cat['name'];
$newcat['id'] = $cat['cat_id'];
$boards = $this->forum->get_first_level_board($cat['cat_id'], 'board_id,name,description,last_msg_id,topics,posts,child_level');
$newcat['boards'] = array();
foreach ($boards as $board) {
$last_message = $this->forum->get_message_data($board['last_msg_id'], 'subject, poster_id, poster_time');
$newboard = array();
$newboard['icon'] = 'plugins/forum/forum/html/images/icon_board_new.gif';
$newboard['id'] = $board['board_id'];
$newboard['name'] = $board['name'];
$newboard['description'] = $board['description'];
$newboard['last_post_id'] = $board['last_msg_id'];
$newboard['last_post_title'] = $last_message['subject'];
$newboard['last_post_time'] = $last_message['poster_time'];
$newboard['last_post_author_id'] = $last_message['poster_id'];
$newboard['last_post_author_name'] = get_username($last_message['poster_id']);
$newboard['topics'] = $board['topics'];
$newboard['replies'] = $board['posts'];
$newboard['childs'] = $this->forum->get_child_board($board['board_id'], $board['child_level'], 'board_id, name');
$newcat['boards'][] = $newboard;
unset($newboard);
}
$vars['categories'][] = $newcat;
unset($newcat);
}
$recents = $this->forum->get_latest_message();
$vars['recents'] = $recents;
$vars['stats'] = $this->forum->get_statistics();
$vars['newest_members'] = $this->forum->get_latest_user();
$vars['active_members'] = $this->forum->get_active_user();
$this->view->render('home/index', $vars);
}
示例10: make_form
function make_form($form_param, $form_data)
{
global $CONFIG;
global $lang_register_php;
foreach ($form_param as $element) {
switch ($element[0]) {
case 'label':
echo <<<EOT
<tr>
<td colspan="2" class="tableh2">
<b>{$element[1]}<b>
</td>
</tr>
EOT;
break;
case 'text':
echo <<<EOT
<tr>
<td width="40%" class="tableb" height="25">
{$element[2]}
</td>
<td width="60%" class="tableb">
{$form_data[$element[1]]}
</td>
</tr>
EOT;
break;
case 'input':
$value = $form_data[$element[1]];
echo <<<EOT
<tr>
<td width="40%" class="tableb" height="25">
{$element[2]}
</td>
<td width="60%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="{$value}" class="textinput" />
</td>
</tr>
EOT;
break;
default:
cpg_die(_CRITICAL_ERROR, 'Invalid action for form creation ' . $element[0], __FILE__, __LINE__);
}
}
}
示例11: limit_page_views_main
function limit_page_views_main()
{
if (!GALLERY_ADMIN_MODE) {
global $CONFIG;
$allowed_page_views = 200;
$timeframe = 60;
// in seconds
$num_views = mysql_result(cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PREFIX']}page_views WHERE timestamp >= " . (time() - $timeframe)), 0);
if ($num_views > $allowed_page_views) {
load_template();
cpg_die(INFORMATION, "Too many page views. Please try again later.", __FILE__, __LINE__);
} else {
cpg_db_query("DELETE FROM {$CONFIG['TABLE_PREFIX']}page_views WHERE timestamp < " . (time() - $timeframe));
cpg_db_query("INSERT INTO {$CONFIG['TABLE_PREFIX']}page_views VALUES(" . time() . ")");
}
}
}
示例12: load_library
function load_library($library, $return = FALSE)
{
global $libraries;
$library = ucfirst(strtolower($library));
$library_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'libraries' . DS . $library . '.php';
if (file_exists($library_file)) {
if (!$libraries[$library]) {
include $library_file;
$libaries[$library] = TRUE;
}
$class_name = ucfirst(strtolower($library));
if ($return === TRUE) {
return new $class_name();
}
} else {
cpg_die(ERROR, sprintf(Lang::item('error.missing_li_file'), $library_file), __FILE__, __LINE__);
}
}
示例13: flv_player_uninstall
function flv_player_uninstall()
{
$superCage = Inspekt::makeSuperCage();
if (!$superCage->post->keyExists('drop')) {
return 1;
}
if (!checkFormToken()) {
global $lang_errors;
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
if ($superCage->post->getInt('drop') == 1) {
global $CONFIG;
$allowed_mov_types = str_replace('/flv', '', $CONFIG['allowed_mov_types']);
$allowed_mov_types = str_replace('flv/', '', $allowed_mov_types);
$allowed_mov_types = str_replace('flv', '', $allowed_mov_types);
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$allowed_mov_types}' WHERE name = 'allowed_mov_types'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_FILETYPES']} WHERE extension = 'flv'");
return true;
}
}
示例14: copperad_install
function copperad_install()
{
global $CONFIG, $lang_plugin_copperad, $lang_plugin_copperad_config, $thisplugin;
require 'plugins/copper_ad/include/init.inc.php';
if ($_POST['submit'] == $lang_plugin_copperad_config['button_install']) {
if (!isset($CONFIG['cpa_enable'])) {
require 'include/sql_parse.php';
$query = "INSERT INTO " . $CONFIG['TABLE_CONFIG'] . " VALUES ('cpa_enable', '1');";
cpg_db_query($query);
// Copy needed file and ADV directory ===If you can't CHMODE you gallery then comment these line 40~46 and after installation copy "banner.php.sample" and "bannermgr.php.sample" to your gallery root and remove ".sample" extention.
copy($thisplugin->fullpath . "/banner.php.sample", "banner.php") or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
copy($thisplugin->fullpath . "/bannermgr.php.sample", "bannermgr.php") or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
mkdir('adv') or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
mkdir('adv/pic') or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
mkdir('adv/flash') or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
copy($thisplugin->fullpath . "/adv/pic/copperad.jpg", "adv/pic/copperad.jpg") or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
copy($thisplugin->fullpath . "/adv/flash/copperad.swf", "adv/flash/copperad.swf") or cpg_die(ERROR, $lang_plugin_copperad_config['permission'], __FILE__, __LINE__);
// create table
$db_schema = $thisplugin->fullpath . '/schema.sql';
$sql_query = fread(fopen($db_schema, 'r'), filesize($db_schema));
$sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query);
$sql_query = remove_remarks($sql_query);
$sql_query = split_sql_file($sql_query, ';');
foreach ($sql_query as $q) {
cpg_db_query($q);
}
// Put default setting
$db_schema = $thisplugin->fullpath . '/basic.sql';
$sql_query = fread(fopen($db_schema, 'r'), filesize($db_schema));
$sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query);
$sql_query = remove_remarks($sql_query);
$sql_query = split_sql_file($sql_query, ';');
foreach ($sql_query as $q) {
cpg_db_query($q);
}
}
return true;
} else {
return 1;
}
}
示例15: remote_videos_save_value
function remote_videos_save_value($name)
{
if (!GALLERY_ADMIN_MODE) {
global $lang_errors;
cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
global $CONFIG;
$superCage = Inspekt::makeSuperCage();
if ($name == 'remote_video_vine_mode') {
$new_value = $superCage->post->getAlpha($name);
} else {
$new_value = $superCage->post->getInt($name);
}
if ($new_value >= 0) {
if (!isset($CONFIG[$name])) {
cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('{$name}', '{$new_value}')");
$CONFIG[$name] = $new_value;
} elseif ($new_value != $CONFIG[$name]) {
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$new_value}' WHERE name = '{$name}'");
$CONFIG[$name] = $new_value;
}
}
}