Example #1
0
function end_script_combat($name = 0)
{
    global $_SERVER;
    show_debug($name);
    mysql_close();
    if (function_exists("save_debug")) {
        save_debug();
    }
}
Example #2
0
	</table>
	</td>
	<td valign="bottom">    
		<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
			<tr> 
				<td>&nbsp;</td>
			</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr> 
				<td background="' . $img . '/img/bot-back.gif">
				<div style="width:100%" align="center"><img src="' . $img . '/img/bot-mid.gif" width="352" height="70"></div>
				</td>
			</tr>
		</table>
	</td>
</tr>
</table>
<center>';
include "../lib/banners.php";
echo '
</center>
</body>

</html>';
if ($_SERVER['REMOTE_ADDR'] == debug_ip) {
    show_debug();
}
if (function_exists("save_debug")) {
    save_debug();
}
Example #3
0
function check_snom_firmware($agent, $phone_type)
{
    global $debug, $mac;
    global $debug;
    $debug[] = array(level => 'v', status => 'info', file => __FILE__ . ":" . __LINE__, log => " {$agent}, {$mac}, {$phone_type}");
    switch ($phone_type) {
        case "snom300":
            if (stristr($agent, "8.7.5.13") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snom320":
        case "snom360":
        case "snom370":
            if (stristr($agent, "8.7.3.25") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snom720":
            if (stristr($agent, "8.7.5.13") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snom760":
            if (stristr($agent, "8.7.5.13") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snom820":
            if (stristr($agent, "8.7.3.25") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snom870":
            if (stristr($agent, "8.7.3.25") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
        case "snomMP":
            if (stristr($agent, "8.7.3.25") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/firmware.php?mac=" . $mac;
                echo "<html lang=\"en\">\n";
                echo "<pre>\n";
                echo "update_policy\$: auto_update\n";
                echo "pnp_config\$: off\n";
                echo "firmware_status: " . $firmware_status . "\n";
                echo "</pre>\n";
                echo "</html>\n";
                show_debug();
                exit;
            }
            break;
            // checkaddphone for needed firmwareupdate
        // checkaddphone for needed firmwareupdate
        case "snomm9":
            if (stristr($agent, "9.6.2-a") == false) {
                $firmware_status = "http://" . $_SERVER['HTTP_HOST'] . "/prov/snom/firmware/m9-9.6.2-a.bin";
                echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
                echo "<firmware-settings>\n";
                echo "<firmware>" . $firmware_status . "</firmware>\n";
                echo "</firmware-settings>\n";
                show_debug();
                exit;
            }
            break;
    }
    return $phone_type;
}
Example #4
0
    }
    echo '[<a href="../act.php">Выйти&nbsp;из&nbsp;города</a>]';
    echo '</td>
		</tr>
		</table>';
    if (!isset($_GET['option'])) {
        $option = 0;
    } else {
        $option = (int) $_GET['option'];
    }
    $check = myquery("SELECT * FROM game_gorod_set_option WHERE gorod_id={$town} AND option_id={$option}");
    if (mysql_num_rows($check) > 0) {
        list($file) = mysql_fetch_array(myquery("SELECT link FROM game_gorod_option WHERE id={$option}"));
        /* Variables to use:
        			$town - town id;
        			$clan - owner clan;
        			$rustown
        			.......
        		 */
        include '../inc/gorod/' . $file;
    }
    echo '
		</td>
	</tr>
	</table>';
    echo '</body></html>';
}
show_debug($char['name']);
if (function_exists("save_debug")) {
    save_debug();
}
 /**
  * Retrieve a post.
  *
  * @uses get_post()
  * @param int $id Post ID
  * @param string $context The context; 'view' (default) or 'edit'.
  * @return array Post entity
  */
 public function get_post($id, $context = 'view', $is_featured_image = false)
 {
     $id = (int) $id;
     $post = get_post($id, ARRAY_A);
     show_debug($post, __FILE__, __LINE__);
     if (empty($id) || empty($post['ID'])) {
         json_error(BigAppErr::$post['code'], "get post faild!", $id);
     }
     $checked_permission = 'read';
     $checked_post = $post;
     if ('inherit' === $post['post_status'] && $post['post_parent'] > 0) {
         $_temp_post = get_post($post['post_parent'], ARRAY_A);
         show_debug($_temp_post, __FILE__, __LINE__);
         if ($post['post_type'] != 'attachment') {
             //fix for 特色图关联的文章被删的情况
             $checked_post = $_temp_post;
             if ('revision' === $post['post_type']) {
                 $checked_permission = 'edit';
             }
         }
     }
     if (!json_check_post_permission($checked_post, $checked_permission)) {
         json_error(BigAppErr::$post['code'], BigAppErr::$post['msg'], "cant read this post.", $id);
     }
     $response = new WP_JSON_Response();
     $data = $this->prepare_post($post, $context);
     if ($data == false) {
         json_error(BigAppErr::$post['code'], "prepare post faild.", $id);
     }
     $favorite_model = new WP_JSON_Favorite($this->server);
     $data['is_favorited'] = $favorite_model->check_favorited($id);
     //true/false    是否收藏标示
     $post_views = new WP_JSON_PostViews($this->server);
     $post_views->process_postviews($id);
     //记录浏览量
     if ($is_featured_image == true) {
         $response->set_data(array($data));
         //如果是特征图,返回数据,为了兼容多图模式
     } else {
         $response->set_data($data);
         //非特征图修改为非数组格式,用于前端缓存及兼容.
     }
     return $response;
 }
function verify_form_token()
{
    $form_id = $_REQUEST['scms_form_id'];
    $token = $_REQUEST['scms_form_token'];
    if (isset($_SESSION['scms_form_tokens'][$form_id]) && $_SESSION['scms_form_tokens'][$form_id] == $token) {
        return true;
    }
    new Log(array('type' => 'ERROR', 'message' => 'Form tokens do not match! form ID: ' . $form_id));
    exit;
}
###################################
# Error reporting is always "7"
error_reporting(7);
ini_set('display_errors', 0);
// hide all errors from screen
if ($debug && show_debug()) {
    ini_set('display_errors', 1);
    # exception: dont show errors during full installation procedure
    if ($is_installation_script) {
        ini_set('display_errors', 0);
    }
}
/**
* saurusErrorHandler
*
* parses php-errors and saves them into DataBase, if parameter save_error_log=1 in config table
*
* @package CMS
*
* @param - all params are set by defaults
*/
 function print_msg()
 {
     if (show_debug()) {
         print $this->get_msg();
     }
 }
Example #8
0
function get_dbhost($hosts)
{
    global $testsleep;
    while ($host == false) {
        foreach (explode(" ", $hosts) as $testhost) {
            $host = check_couchdb($testhost);
            if ($host) {
                break;
            }
        }
        if ($host) {
            continue;
        }
        show_debug("No connect to cluster-db sleep now for next tray in (s):" . $testsleep);
        sleep($testsleep);
    }
    return $host;
}
    /**
     * 推广页区的管理页面
     */
    public static function display_bigapp_admin_extend_page()
    {
        $js_data = BigAppAdminModel::get_extend_conf();
        $page_data['plugin_path'] = get_plugin_site_base() . '/admin';
        $page_data['imgUrl'] = get_bloginfo('siteurl') . "/?yz_app=1&api_route=admin_api&action=upload_img&key=" . urlencode('mobile_app_image_s');
        show_debug($page_data, __FILE__, __LINE__);
        echo_output(loadTemplate('admin_extend.tpl', $js_data, $page_data));
        ?>
		<?php 
    }
Example #10
0
    function PrintFooter()
    {
        global $MyTimer, $numsql, $time_myquery;
        if (!$this->guest) {
            if ($this->char['clan_id'] == 1) {
                $exec_time = $MyTimer->GetTime(5);
                echo '<div class="debug">Время вып.скрипта: <span class="style2">' . $exec_time . '</span> сек   |   Количество запросов: <span class="style2">' . $numsql . '</span>   |   Время запросов: <span class="style2">' . $time_myquery . '</span> сек (' . round($time_myquery * 100 / $exec_time, 2) . '%)</div>';
            }
        }
        if ($_SERVER['REMOTE_ADDR'] == debug_ip) {
            show_debug();
        }
        ?>
		</body>
		</html>
		<?php 
    }
Example #11
0
 /**
  * Initialize session driver object
  *
  * @return	void
  */
 protected function initialize()
 {
     // Set all the session preferences, which can either be set
     // manually via the $params array or via the config file
     $prefs = array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key');
     $this->_standardize_newlines = (bool) config_item('standardize_newlines');
     foreach ($prefs as $key) {
         $this->{$key} = isset($this->_parent->params[$key]) ? $this->_parent->params[$key] : $this->CI->config->item($key);
     }
     if (empty($this->encryption_key)) {
         show_debug('In order to use the Cookie Session driver you are required to set an encryption key in your config file.');
     }
     // Do we need encryption? If so, load the encryption class
     if ($this->sess_encrypt_cookie === TRUE) {
         $this->CI->load->library('encryption');
     }
     // Check for database
     if ($this->sess_use_database === TRUE && $this->sess_table_name !== '') {
         // Load database driver
         $this->CI->load->database();
         // Register shutdown function
         register_shutdown_function(array($this, '_update_db'));
     }
     // Set the "now" time. Can either be GMT or server time, based on the config prefs.
     // We use this to set the "last activity" time
     $this->now = $this->_get_time();
     // Set the session length. If the session expiration is
     // set to zero we'll set the expiration two years from now.
     if ($this->sess_expiration === 0) {
         $this->sess_expiration = 60 * 60 * 24 * 365 * 2;
     }
     // Set the cookie name
     $this->sess_cookie_name = $this->cookie_prefix . $this->sess_cookie_name;
     // Run the Session routine. If a session doesn't exist we'll
     // create a new one. If it does, we'll update it.
     if (!$this->_sess_read()) {
         $this->_sess_create();
     } else {
         $this->_sess_update();
     }
     // Delete expired sessions if necessary
     $this->_sess_gc();
 }
Example #12
0
/**
 * Check if we have permission to interact with the post object.
 *
 * @param WP_Post $post Post object.
 * @param string $capability Permission to check.
 * @return boolean Can we interact with it?
 */
function json_check_post_permission($post, $capability = 'read')
{
    $permission = false;
    $post_type = get_post_type_object($post['post_type']);
    switch ($capability) {
        case 'read':
            if (!$post_type->show_in_json) {
                show_debug("post_type not show_in_json:post_id:" . $post['ID'] . " post_type:" . $post['post_type'], __FILE__, __LINE__);
                return false;
            }
            if ('publish' === $post['post_status'] || current_user_can($post_type->cap->read_post, $post['ID'])) {
                $permission = true;
            }
            // Can we read the parent if we're inheriting?
            if ('inherit' === $post['post_status'] && $post['post_parent'] > 0) {
                $parent = get_post($post['post_parent'], ARRAY_A);
                show_debug($parent, __FILE__, __LINE__);
                if (json_check_post_permission($parent, 'read')) {
                    $permission = true;
                }
            }
            // If we don't have a parent, but the status is set to inherit, assume
            // it's published (as per get_post_status())
            if ('inherit' === $post['post_status']) {
                $permission = true;
            }
            show_debug("post_permisson:" . $permission . " post_id:" . $post['ID'] . " post_type:" . $post['post_type'] . " post_status:" . $post['post_status'], __FILE__, __LINE__);
            break;
        case 'edit':
            if (current_user_can($post_type->cap->edit_post, $post['ID'])) {
                $permission = true;
            }
            break;
        case 'create':
            if (current_user_can($post_type->cap->create_posts) || current_user_can($post_type->cap->edit_posts)) {
                $permission = true;
            }
            break;
        case 'delete':
            if (current_user_can($post_type->cap->delete_post, $post['ID'])) {
                $permission = true;
            }
            break;
        default:
            if (current_user_can($post_type->cap->{$capability})) {
                $permission = true;
            }
    }
    return apply_filters("json_check_post_{$capability}_permission", $permission, $post);
}
Example #13
0
function debug_screen()
{
    global $debug_log_array, $debug_warning_array, $debug_notice_array, $debug_unknow_array, $debug_sql_array, $debug_sql_error, $_path, $Account_Data, $Stats_Data, $installing, $active_debug;
    if ($installing || verif_access("Admin", true) && $active_debug) {
        $html = "";
        $corrig_path = str_replace("/", '\\', $_path);
        if (!empty($debug_log_array)) {
            $content = "";
            $content .= "<table border='1'>";
            if (isset($debug_log_array)) {
                foreach ($debug_log_array as $x => $req) {
                    foreach ($req['trace'] as $n => $t) {
                        if ($n != 0 && $t['function'] !== 'debug_log') {
                            $content .= "<tr>";
                            if ($n == 1) {
                                $content .= "<th rowspan='" . (count($req['trace']) - 1) . "'>{$x}</th><td rowspan='" . (count($req['trace']) - 1) . "' >" . $req['message'] . "</td>";
                            }
                            $content .= "<td>" . (isset($t['file']) ? str_replace($corrig_path, "", $t['file']) : "") . "</td>\n\t\t\t\t\t\t\t\t<td>" . (isset($t['line']) ? $t['line'] : '') . "</td>\n\t\t\t\t\t\t\t\t<td>" . $t['function'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . print_r($t['args'], 1) . "</td>";
                            $content .= "</tr>";
                        }
                    }
                }
            }
            $content .= "</table>";
            $html .= show_debug("log", "Log", $content);
        }
        if (!empty($Account_Data) && verif_connect(true)) {
            $content = "";
            $content .= debug_array($Stats_Data);
            $content .= debug_array($Account_Data);
            $html .= show_debug("perso", "Avatar", $content);
        }
        if (!empty($_SESSION)) {
            $html .= show_debug("session", "Session", debug_array($_SESSION));
        }
        if (!empty($debug_sql_array)) {
            $content = "";
            $content .= "<table border='1'>";
            foreach ($debug_sql_array as $x => $req) {
                $content .= "<tr><th>{$x}</th><td>{$req}</td>";
                if (isset($debug_sql_error[$x])) {
                    $content .= "<td>" . $debug_sql_error[$x][0] . "</td>";
                    $content .= "<td>" . $debug_sql_error[$x][1] . "</td>";
                    $content .= "<td>" . $debug_sql_error[$x][2] . "</td>";
                }
                $content .= "</tr>";
            }
            $content .= "</table>";
            $html .= show_debug("sql", "Requetes", $content);
        }
        if (!empty($_SERVER)) {
            $content = "";
            $content .= "<table border='1'>";
            $content .= debug_array($_SERVER);
            $content .= "</table>";
            $html .= show_debug("server", "Serveur", $content);
        }
        if (!empty($debug_warning_array)) {
            $content = "";
            $content .= "<table border='1'>";
            foreach ($debug_warning_array as $x => $req) {
                $content .= "<tr>";
                $content .= "<th>{$x}</th><td>" . $req['code'] . "</td><td>" . $req['message'] . "</td>";
                $content .= "<td>" . str_replace($corrig_path, "", $req['file']) . "</td>\n\t\t\t\t\t<td>" . $req['line'] . "</td>";
                if (isset($req['trace'])) {
                    $content .= "<td><table>";
                    foreach ($req['trace'] as $n => $t) {
                        if ($n != 0 && $t['function'] !== 'debug_log') {
                            $content .= "<tr>";
                            $content .= "<td>" . (isset($t['file']) ? str_replace($corrig_path, "", $t['file']) : "") . "</td>\n\t\t\t\t\t\t\t\t<td>" . (isset($t['line']) ? $t['line'] : '') . "</td>\n\t\t\t\t\t\t\t\t<td>" . $t['function'] . "</td>\n\t\t\t\t\t\t\t\t<td>" . print_r($t['args'], 1) . "</td>";
                            $content .= "</tr>";
                        }
                    }
                    $content .= "</table></td>";
                }
                $content .= "</tr>";
            }
            $content .= "</table>";
            $html .= show_debug("warning", "Alertes", $content, 2);
        }
        if (!empty($debug_notice_array)) {
            $content = "";
            $content .= "<table border='1'>";
            foreach ($debug_notice_array as $x => $req) {
                $content .= "<tr>";
                $content .= "<th>{$x}</th>";
                $content .= "<td>" . $req['code'] . "</td>";
                $content .= "<td>" . $req['message'] . "</td>";
                $content .= "<td>" . str_replace($corrig_path, "", $req['file']) . "</td>";
                $content .= "<td>" . $req['line'] . "</td>";
                $content .= "</tr>";
            }
            $content .= "</table>";
            $html .= show_debug("notice", "Avertissement", $content, 2);
        }
        if (!empty($debug_unknow_array)) {
            $content = "";
            $content .= "<table border='1'>";
            foreach ($debug_unknow_array as $x => $req) {
                $content .= "<tr>";
                $content .= "<th>{$x}</th><td>" . $req['code'] . "</td><td>" . $req['message'] . "</td>";
                $content .= "<td>" . str_replace($corrig_path, "", $req['file']) . "</td>\n\t\t\t\t\t<td>" . $req['line'] . "</td>";
                $content .= "</tr>";
            }
            $content .= "</table>";
            $html .= show_debug("unknow", "Inconnu", $content, 2);
        }
        if (!empty($_FILES)) {
            $content = "";
            $content .= "<table border='1'>";
            foreach ($_FILES as $x => $req) {
                $content .= "<tr><th>{$x}</th><td>{$req}</td></tr>";
            }
            $content .= "</table>";
            $html .= show_debug("file", "Fichier", $content, 2);
        }
        if (!empty($_POST) || !empty($_GET)) {
            $content = "";
            if (!empty($_POST)) {
                $content .= "<table border='1'>";
                foreach ($_POST as $x => $req) {
                    $content .= "<tr><th>{$x}</th><td>{$req}</td></tr>";
                }
                $content .= "</table>";
            }
            if (!empty($_GET)) {
                $content .= "<table border='1'>";
                foreach ($_GET as $x => $req) {
                    $content .= "<tr><th>{$x}</th><td>{$req}</td></tr>";
                }
                $content .= "</table>";
            }
            $html .= show_debug("request", "Formulaire", $content, 2);
        }
        /**        	$content = "";
        			$content .= "<table border='1'>";
        			$content .= debug_array(get_defined_functions());
        			$content .= "</table>";
        			
        			$html .= show_debug("function","Fonctions",$content);
        
                    $content = "";
        			$content .= "<table border='1'>";
        			$content .= debug_array(get_defined_constants(true));
        			$content .= "</table>";
        			
        			$html .= show_debug("constants","Constantes",$content,2);
        			
        			$content = "";
        			$content .= "<table border='1'>";
        			$content .= debug_array(get_defined_vars());
        			$content .= "</table>";
        			
        			$html .= show_debug("vars","Variables",$content);
        **/
        return $html;
    }
}
 /**
  * 获取某个人已经发表过的评论.包括评论内容,评论时间,评论文章id/title/url
  * 默认的是每页10个.
  * @param filter= array(pre_page,page)
  * return  
  */
 public function my_comments($filter = array(), $page = 10)
 {
     $struct = array();
     $number = 10;
     //每页的评论数目
     if (isset($filter['pre_page'])) {
         $number = intval($filter['pre_page']);
     }
     $offset = 0;
     //偏移量
     if (isset($filter['page']) && $filter['page'] > 0) {
         $offset = (intval($filter['page']) - 1) * $number;
     } else {
         $offset = $page > 0 ? ($page - 1) * $number : 0;
     }
     $user_id = get_current_user_id();
     show_debug("my_comments:user_id" . $user_id, __FILE__, __LINE__);
     if ($user_id == 0) {
         //not login return empty
     } else {
         $arg['orderby'] = 'comment_date';
         $arg['order'] = 'desc';
         $arg['number'] = $number;
         $arg['offset'] = $offset;
         $arg['user_id'] = $user_id;
         $comments = get_comments($arg);
         $post_ids = array();
         $post_infos = array();
         foreach ($comments as $comment) {
             $post_ids[] = intval($comment->comment_post_ID);
         }
         show_debug($post_ids, __FILE__, __LINE__);
         if ($post_ids) {
             $post_model = new WP_JSON_Posts($this->server);
             $filter['_bigapp_post_ids'] = $post_ids;
             $response = $post_model->get_posts($filter);
             $lists = $response->get_data();
             foreach ($lists as $list) {
                 $post_info[$list['ID']] = $list;
             }
         }
         foreach ($comments as $comment) {
             $comment = $this->prepare_comment($comment, array('comment', 'meta'), 'collection');
             if (isset($post_info[$comment['post']])) {
                 $comment['post_info']['title'] = $post_info[$comment['post']]['title'];
                 $comment['post_info']['link'] = $post_info[$comment['post']]['link'];
             } else {
                 continue;
             }
             $struct[] = $comment;
         }
     }
     return $struct;
 }