Ejemplo n.º 1
0
 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
         return;
     }
     if (!empty($this->admin_page->request['error_reporting_state'])) {
         switch ($this->admin_page->request['error_reporting_state']) {
             case 'on':
                 override_developer_status(true);
                 break;
             case 'off':
                 override_developer_status(false);
                 break;
         }
     }
     $status = is_developer();
     echo '<form method="post" action="' . htmlspecialchars(get_current_url()) . '">';
     if ($status) {
         echo '<h3>In-page error reporting is currently ON.</h3>' . "\n";
         echo '<input type="submit" value="Turn Error Reporting Off" /><input type="hidden" name="error_reporting_state" value="off" />';
     } else {
         echo '<h3>In-page error reporting is currently OFF.</h3>' . "\n";
         echo '<input type="submit" value="Turn Error Reporting On" /><input type="hidden" name="error_reporting_state" value="on" />';
     }
     echo '</form>';
     echo '<p>Note: changes made via this form only last for the duration of the current session.</p>';
 }
Ejemplo n.º 2
0
/**
 * @brief Change to another channel with current logged-in account.
 *
 * @param int $change_channel The channel_id of the channel you want to change to
 *
 * @return bool|array false or channel record of the new channel
 */
function change_channel($change_channel)
{
    $ret = false;
    if ($change_channel) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1", intval($change_channel), intval(get_account_id()), intval(PAGE_REMOVED));
        // It's not there.  Is this an administrator, and is this the sys channel?
        if (is_developer()) {
            if (!$r) {
                if (is_site_admin()) {
                    $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and ( channel_pageflags & %d) and not (channel_pageflags & %d )>0 limit 1", intval($change_channel), intval(PAGE_SYSTEM), intval(PAGE_REMOVED));
                }
            }
        }
        if ($r) {
            $hash = $r[0]['channel_hash'];
            $_SESSION['uid'] = intval($r[0]['channel_id']);
            get_app()->set_channel($r[0]);
            $_SESSION['theme'] = $r[0]['channel_theme'];
            $_SESSION['mobile_theme'] = get_pconfig(local_channel(), 'system', 'mobile_theme');
            date_default_timezone_set($r[0]['channel_timezone']);
            $ret = $r[0];
        }
        $x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
        if ($x) {
            $_SESSION['my_url'] = $x[0]['xchan_url'];
            $_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
            get_app()->set_observer($x[0]);
            get_app()->set_perms(get_all_perms(local_channel(), $hash));
        }
        if (!is_dir('store/' . $r[0]['channel_address'])) {
            @os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
        }
    }
    return $ret;
}
Ejemplo n.º 3
0
function achievements_content(&$a)
{
    // This doesn't work, so
    if (!is_developer()) {
        return;
    }
    if (argc() > 1) {
        $which = argv(1);
    } else {
        notice(t('Requested profile is not available.') . EOL);
        return;
    }
    $profile = 0;
    $profile = argv(1);
    profile_load($a, $which, $profile);
    $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
    if ($r) {
        $owner = intval($r[0]['channel_id']);
    }
    $observer = $a->get_observer();
    $ob_hash = $observer ? $observer['xchan_hash'] : '';
    $perms = get_all_perms($owner, $ob_hash);
    if (!$perms['view_profile']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $newmembertext = t('Some blurb about what to do when you\'re new here');
    //	By default, all badges are false
    $contactbadge = false;
    $profilebadge = false;
    $keywordsbadge = false;
    // Check number of contacts.  Award a badge if over 10
    // We'll figure these out on each page load instead of
    // writing them to the DB because that will mean one needs
    // to retain their achievements - eg, you can't add
    // a bunch of channels just to get your badge, and then
    // delete them all again.  If these become popular or
    // used in profiles or something, we may need to reconsider
    // and add a table for this - because this won't scale.
    $r = q("select * from abook where abook_channel = %d", intval($owner));
    if (count($r)) {
        $contacts = count($r);
    }
    // We're checking for 11 to adjust for the abook record for self
    if ($contacts >= 11) {
        $contactbadge = true;
    }
    //	Check if an about field in the profile has been created.
    $r = q("select * from profile where uid = %d and about <> ''", intval($owner));
    if ($r) {
        $profilebadge = 1;
    }
    // Check if keywords have been set
    $r = q("select * from profile where uid = %d and keywords <> ''", intval($owner));
    if ($r) {
        $keywordsbadge = 1;
    }
    return replace_macros(get_markup_template("achievements.tpl"), array('$newmembertext' => $newmembertext, '$profilebadge' => $profilebadge, '$contactbadge' => $contactbadge, '$keywordsbadge' => $keywordsbadge, '$channelsbadge' => $channelsbadge));
}
Ejemplo n.º 4
0
function dprp($v, $k = 'dprp')
{
    if (is_developer()) {
        echo '<div style="border: 1px #f00 dashed; background-color: #ccc">';
        prp($v, $k);
        echo '</div>';
    }
}
 protected function _initialize()
 {
     define('UID', is_login());
     if (!UID) {
         $this->redirect('Public/login');
     }
     $this->login_user = $login_user = session('user_auth');
     if (is_developer()) {
         $developer = array('developer' => 1);
         $this->login_user = array_merge($this->login_user, $developer);
     }
     $user_info = D('User')->getUserById($login_user['uid']);
     $this->login_user = array_merge($this->login_user, $user_info);
     // 是否是超级管理员
     define('IS_ROOT', is_administrator() || is_developer());
     if (!IS_ROOT && C('ADMIN_ALLOW_IP')) {
         // 检查IP地址访问
         if (!in_array(get_client_ip(), explode(',', C('ADMIN_ALLOW_IP')))) {
             $this->error('403:禁止访问');
         }
     }
     // 检测访问权限
     // $access =   $this->accessControl();
     // if ( $access === false ) {
     //     $this->error('403:禁止访问');
     // }elseif( $access === null ) {
     //     $dynamic = $this->checkDynamic();//检测分类栏目有关的各项动态权限
     //     if( $dynamic === null ){
     //         //检测非动态权限
     //         $rule  = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
     //         if ( !$this->checkRule($rule,array('in','1,2')) ){
     //             $this->error('未授权访问!');
     //         }
     //     }elseif( $dynamic === false ){
     //         $this->error('未授权访问!');
     //     }
     // }
     // $this->assign('__MENU__', $this->getMenus());
     //如果给了参数developer_mode=1,则为developer模式
     $developer_mode = I('get.developer_mode', '', 'intval');
     if ($developer_mode == 1) {
         session('developer_mode', true);
     }
 }
Ejemplo n.º 6
0
 function on_every_time()
 {
     $site_list = $this->get_site_list();
     $existing_file = $this->get_value('wordpress_xml');
     if (!empty($existing_file)) {
         $source_file_name = $this->get_value('xml_file_name');
         $this->set_comments('wordpress_xml', form_comment('<p>A file (' . $source_file_name . ') has been uploaded - only upload a file if you want to change the source file</p>'));
     }
     if ($site_list) {
         $this->change_element_type('reason_site', 'select_no_sort', array('options' => $site_list));
     } else {
         $this->change_element_type('reason_site', 'solidtext');
         $this->set_value('reason_site', 'There are no sites available');
     }
     $this->uid = uniqid('', true);
     $this->set_value('xml_id', $this->uid);
     $this->add_element('blog_page_name');
     $this->set_comments('blog_page_name', form_comment('Leave blank if you want the blog to be created on the home page.'));
     if (is_developer()) {
         $this->add_element('kill_all_label', 'comment', array('text' => '<h3>Developer Tools</h3><p>If "Zap site" is checked, we will expunge all the contents of the site instead of parsing/importing XML. Mainly this is for developers who are tweaking an import.</p>'));
         $this->add_element('kill_all', 'checkbox', array('display_name' => 'Zap site'));
         //$this->set_comments('kill_all', form_comment());
     }
 }
Ejemplo n.º 7
0
<?php

function is_developer()
{
    return $_SERVER["SERVER_NAME"] == "notabenoid.dev.romakhin.ru";
}
function prr($obj, $title = '')
{
    echo "\n<pre>" . ($title != '' ? "<b>{$title}</b>\n" : "") . htmlspecialchars(print_r($obj, true)) . "</pre>\n";
}
function p()
{
    return Yii::app()->params;
}
$yii = dirname(__FILE__) . '/../yii/framework/yii.php';
$config = dirname(__FILE__) . '/../protected/config/' . (is_developer() ? "dev.php" : "main.php");
if (is_developer()) {
    defined('YII_DEBUG') or define('YII_DEBUG', true);
    defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
}
require_once $yii;
Yii::createWebApplication($config)->run();
Ejemplo n.º 8
0
	/**
	 * Returns true if benchmarks_available() and benchmarks_enabled() return true;
	 * @return boolean
	 */		
	function should_benchmark()
	{
		if (!isset($this->_should_benchmark))
		{
			$benchmarks_requested = (isset($_REQUEST['reason_benchmark']) && ($_REQUEST['reason_benchmark'] == 1));
			$this->_should_benchmark = ($benchmarks_requested && is_developer() && !$this->get_requested_api());
		}
		return $this->_should_benchmark;
	}
Ejemplo n.º 9
0
/**
 * @brief Change to another channel with current logged-in account.
 *
 * @param int $change_channel The channel_id of the channel you want to change to
 *
 * @return bool|array false or channel record of the new channel
 */
function change_channel($change_channel)
{
    $ret = false;
    if ($change_channel) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and channel_removed = 0 limit 1", intval($change_channel), intval(get_account_id()));
        // It's not there.  Is this an administrator, and is this the sys channel?
        if (is_developer()) {
            if (!$r) {
                if (is_site_admin()) {
                    $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_system = 1 and channel_removed = 0 limit 1", intval($change_channel));
                }
            }
        }
        if ($r) {
            $hash = $r[0]['channel_hash'];
            $_SESSION['uid'] = intval($r[0]['channel_id']);
            App::set_channel($r[0]);
            $_SESSION['theme'] = $r[0]['channel_theme'];
            $_SESSION['mobile_theme'] = get_pconfig(local_channel(), 'system', 'mobile_theme');
            date_default_timezone_set($r[0]['channel_timezone']);
            $ret = $r[0];
        }
        $x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
        if ($x) {
            $_SESSION['my_url'] = $x[0]['xchan_url'];
            $_SESSION['my_address'] = $r[0]['channel_address'] . '@' . App::get_hostname();
            App::set_observer($x[0]);
            App::set_perms(get_all_perms(local_channel(), $hash));
        }
        if (!is_dir('store/' . $r[0]['channel_address'])) {
            @os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
        }
        $arr = ['channel_id' => $change_channel, 'chanx' => $ret];
        call_hooks('change_channel', $arr);
    }
    return $ret;
}
Ejemplo n.º 10
0
 public function get_record_by_id($id)
 {
     $this->db->where($this->primary_key, $id);
     if (is_player()) {
         $this->db->where('status', 1);
     } else {
         if (is_developer()) {
             $this->db->where('developerID', $this->session->userdata('user_data')->id);
         }
     }
     return $this->db->get($this->table_name)->result_array();
 }
Ejemplo n.º 11
0
 /**
  * Handles the transition from the end of the form to wherever or whatever the form should go/do.
  * Called by {@link run_process_phase()}.  Available hook: {@link where_to()}.
  * @param string $kludge kludge variables to handle the old finish method
  * @access public
  */
 function handle_transition($kludge)
 {
     $where_to = $this->where_to();
     if ($callback_where_tos = $this->_run_callbacks('where_to')) {
         $where_to = array_pop($callback_where_tos);
     } elseif (!$where_to) {
         $where_to = $kludge;
     }
     if ($where_to) {
         if (!$where_to or !is_string($where_to)) {
             $where_to = conditional_stripslashes($_SERVER['REQUEST_URI']);
         }
         if (function_exists('is_developer') && is_developer()) {
             $errors = carl_util_get_error_list();
             if (!empty($errors)) {
                 echo '<h3>PHP errors were encountered during the processing of this form.</h3>' . "\n";
                 echo '<p>Because you are accessing this form from an IP address listed as a developer\'s, rather than redirecting your browser to the next step (which would hide the errors) the form is pausing to let you see the errors displayed above.</p>' . "\n";
                 echo '<p><a href="' . htmlspecialchars($where_to) . '">Thanks for the info; continue on.</a></p>';
                 exit;
             }
         }
         header('Location: ' . $where_to);
         exit;
     }
 }
Ejemplo n.º 12
0
        <link rel="stylesheet" href="<?php 
echo CSS_URL;
?>
all.css" media="all" type="text/css">
        <?php 
$url = $_SERVER['REQUEST_URI'];
$pattern = '/login';
if (strlen(strstr($url, $pattern)) > 0 || strlen(strstr($url, "/register")) > 0 || strlen(strstr($url, "/forgot_password")) > 0) {
    ?>
            <link rel="stylesheet" href="<?php 
    echo CSS_URL;
    ?>
login/login.css" media="all" type="text/css">
        <?php 
} else {
    if (is_admin() || is_developer()) {
        ?>
            <link rel="stylesheet" href="<?php 
        echo CSS_URL;
        ?>
admin/admin.css" media="all" type="text/css">
            <script type="text/javascript" src="<?php 
        echo JS_URL;
        ?>
sidebar.js"></script>
        <?php 
    } else {
        ?>
            <link rel="stylesheet" href="<?php 
        echo CSS_URL;
        ?>
Ejemplo n.º 13
0
 function get_ga_data($location, $start, $end)
 {
     $provider_name = strtolower(addslashes(GA_SERVICE_PROVIDER_NAME));
     $profile_id = 'ga:' . GOOGLE_ANALYTICS_PROFILE_ID;
     if ($location == 'off_campus') {
         $filter['location'] = 'ga:networkLocation!~' . $provider_name . ';';
     } elseif ($location == 'on_campus') {
         $filter['location'] = 'ga:networkLocation=~' . $provider_name . ';';
     } else {
         $filter['location'] = '';
     }
     //get page analytics data
     try {
         $this->page_results = $this->service->data_ga->get($profile_id, $start, $end, 'ga:pageviews,ga:uniquePageViews,ga:entrances,ga:avgTimeOnPage,ga:entranceBounceRate,ga:exitRate', array('filters' => $filter['location'] . 'ga:pagePath=~^' . GA_HOST_NAME . $this->site->get_value('base_url'), 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews', 'max-results' => 500));
     } catch (Exception $ee) {
         $ee->getMessage();
     }
     // if site has events, get events google analytics data
     if ($this->has_events) {
         try {
             $this->event_results = $this->service->data_ga->get($profile_id, $start, $end, 'ga:pageviews,ga:entrances,ga:avgTimeOnPage,ga:uniquePageViews,ga:entranceBounceRate,ga:exitRate', array('filters' => $filter['location'] . 'ga:pagePath=~event_id', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews'));
         } catch (Exception $ee) {
             $ee->getMessage();
         }
     }
     // if site has faq, get faq google analytics data
     if ($this->has_faq) {
         try {
             $this->faq_results = $this->service->data_ga->get($profile_id, $start, $end, 'ga:pageviews,ga:entrances,ga:avgTimeOnPage,ga:uniquePageViews,ga:entranceBounceRate,ga:exitRate', array('filters' => $filter['location'] . 'ga:pagePath=~faq_id', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews'));
         } catch (Exception $fe) {
             $fe->getMessage();
         }
     }
     // if site has news/posts, get news/posts google analytics data
     if ($this->has_news) {
         try {
             $this->news_results = $this->service->data_ga->get($profile_id, $start, $end, 'ga:pageviews,ga:entrances,ga:avgTimeOnPage,ga:uniquePageViews,ga:entranceBounceRate,ga:exitRate', array('filters' => $filter['location'] . 'ga:pagePath=~story_id', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews'));
         } catch (Exception $ne) {
             $ne->getMessage();
         }
     }
     // if site has policies, get policy google analytics data
     if ($this->has_policies) {
         try {
             $this->policy_results = $this->service->data_ga->get($profile_id, $start, $end, 'ga:pageviews,ga:entrances,ga:avgTimeOnPage,ga:uniquePageViews,ga:entranceBounceRate,ga:exitRate', array('filters' => $filter['location'] . 'ga:pagePath=~policy_id', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews'));
         } catch (Exception $pe) {
             $pe->getMessage();
         }
     }
     if (isset($fe) || isset($ee) || isset($ne) || isset($pe)) {
         if (is_developer()) {
             if (isset($fe)) {
                 echo '<div class="analytics-error"><p>FAQ Results Error: ' . htmlspecialchars($fe) . '</p></div>';
             }
             if (isset($ee)) {
                 echo '<div class="analytics-error"><p>Event Results Error: ' . htmlspecialchars($ee) . '</p></div>';
             }
             if (isset($ne)) {
                 echo '<div class="analytics-error"><p>News Results Error: ' . htmlspecialchars($ne) . '</p></div>';
             }
             if (isset($pe)) {
                 echo '<div class="analytics-error"><p>Policy Results Error: ' . htmlspecialchars($pe) . '</p></div>';
             }
         } else {
             echo '<div class="analytics-error">Oops. There was an error getting the analytics. Please contact ' . REASON_CONTACT_INFO_FOR_ANALYTICS . ' for assistance.</div>';
         }
         return false;
     }
     return true;
 }
Ejemplo n.º 14
0
    /**
     * Internal dpr() function.
     *
     * @param $variables   array       List of mixed values to print
     * @param $is_var_dump boolean     If true, then var_dump() will be used instead of print_r()
     * @param $breakpoint  string      Breakpoint location for dprb()/dprd() functions
     * @return mixed
     */
    function _dpr(array $variables = array(), $is_var_dump = false, $breakpoint = null)
    {
        if (DPR_CHECK_DEVELOPER_IPS && is_developer() == false) {
            return pos($variables);
        }
        if (ob_get_level()) {
            while (ob_get_level()) {
                ob_end_clean();
            }
        }
        $html_mode = headers_sent();
        if ($html_mode === false) {
            header('Content-type: text/plain; charset=utf-8');
        } else {
            echo '
				<style>
				* {
					overflow: hidden; position: static;
				}

				#dprOutput {
					position: fixed;
					overflow: auto;
					top: 0;
					left: 0;
					margin: 0;
					padding: 5px;
					box-sizing: border-box;
					width: 100%;
					height: 100%;
					background-color: #FFFFFF;
					color: #000000;
					font-size: 14px;
					line-height: 125%;
					font-family: Courier New, monospace;
					z-index: 2147483647;
				}
				</style>
				<pre style="dprOutput">
			';
        }
        $called_at = debug_backtrace(false);
        $called_at = $called_at[1];
        // header
        echo str_repeat('#', 78), PHP_EOL;
        echo '#', PHP_EOL;
        if (is_null($breakpoint) == false) {
            echo '#    Breakpoint at ', PHP_EOL;
            echo '#      ', str_replace($_SERVER['DOCUMENT_ROOT'], '', $breakpoint), PHP_EOL;
            echo '#', PHP_EOL;
        }
        echo '#    Debug print at ', PHP_EOL;
        echo '#      ', str_replace($_SERVER['DOCUMENT_ROOT'], '', $called_at['file']), ':', $called_at['line'], PHP_EOL;
        echo '#', PHP_EOL;
        echo str_repeat('#', 78), PHP_EOL, PHP_EOL;
        // prints
        foreach ($variables as $index => $variable) {
            $index = is_int($index) ? "Index {$index}" : $index;
            echo "####### {$index} ", str_repeat('#', 69 - strlen($index)), PHP_EOL;
            $function = is_bool($variable) ? '__echo_bool' : (is_null($variable) ? '__echo_null' : ($is_var_dump ? 'var_dump' : 'print_r'));
            $function($variable);
            echo PHP_EOL . PHP_EOL;
        }
        if ($html_mode === true) {
            echo '</pre>';
        }
        die;
    }
Ejemplo n.º 15
0
/**
 * Require authentication via http basic auth
 *
 * Note 1: If the user already has a session-based login, or the script is otherwise behind an
 * apache-rule-based http auth, this function will return the username without forcing a second
 * login.
 *
 * Note 2: This function currently only works properly when php is running as an Apache module. If
 * Apache is running under CGI/Fast CGI, it currently simply denies access.
 *
 * @todo Add CGI/FastCGI support
 *
 * @param string $realm
 * @param string $cancel_message
 * @return string username
 *
 */
function reason_require_http_authentication($realm = FULL_ORGANIZATION_NAME, $cancel_message = '')
{
	if($username = reason_check_authentication())
		return $username;
	
	force_secure_if_available();
	
	if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW']))
	{
    	require_once(CARL_UTIL_INC.'dir_service/directory.php');
    	$dir = new directory_service();
    	if($dir->authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']))
    		return $_SERVER['PHP_AUTH_USER'];
    }
    $cgi_mode = (substr(php_sapi_name(), 0, 3) == 'cgi');
    if(!$cgi_mode)
    {
		header('WWW-Authenticate: Basic realm="'.str_replace('"',"'",$realm).'"');
	}
	http_response_code(401);
	if(empty($cancel_message))
	{
		$msg_str = 'This resource requires login.';
		$cancel_message = '<!doctype HTML><html><title>'.$msg_str.'</title></head><body><h3>'.$msg_str.'</h3>';
		if($cgi_mode && function_exists('is_developer') && is_developer())
			$cancel_message .= '<p>HTTP authentication is not currently supported when PHP is running under CGI/Fast CGI.</p>';
		$cancel_message .= '</body></html>';
	}
	echo $cancel_message;
    exit;
}
Ejemplo n.º 16
0
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_related_projects($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_related_projects($auth->auth["uname"], "P");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_related_projects($auth->auth["uname"], "R");
     $bx->box_column_finish();
     $bx->box_columns_end();
     $bx->box_body_end();
     $bx->box_end();
 }
 if (is_developer($auth->auth["uname"]) && $auth->auth["perm"] != "devel_pending" && $auth->auth["perm"] != "editor" && $auth->auth["perm"] != "admin" && $auth->auth["perm"] != "editor,admin") {
     $bx->box_begin();
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_consultants($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_consultants($auth->auth["uname"], "P");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_consultants($auth->auth["uname"], "R");
     $bx->box_column_finish();
     $bx->box_columns_end();
     $bx->box_body_end();
     $bx->box_end();
Ejemplo n.º 17
0
     }
 }
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 //    display the page
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 echo $page;
 // if we're using a cache, make sure to store the new result
 // also, record stats about misses here
 $page_gen_time = round(1000 * (get_microtime() - $s));
 if ($use_cache and !$cache_hit) {
     $cache->set_page_generation_time($page_gen_time);
     $cache->store(get_current_url(), $page);
 }
 if (is_developer() && !$requested_api) {
     $str = $page_gen_time . ' ms | ' . format_bytes_as_human_readable(memory_get_peak_usage(true)) . ' | ';
     if ($use_cache) {
         $str .= 'caching is ON: ';
         if ($cache_hit) {
             $str .= 'hit';
         } else {
             $str .= 'miss';
         }
     } else {
         $str .= 'caching is OFF: ' . implode(', ', $no_cache_reasons);
     }
     echo "\n" . '<div id="reasonDeveloper" style="background-color:#ddd;color:#555;font-size:0.75em;padding:1px 1em;">';
     echo '<p>' . $str . '</p>';
     if (isset($t) && method_exists($t, 'display_developer_section')) {
         $t->display_developer_section();
Ejemplo n.º 18
0
<?php

include_once './common.php';
checklogin();
$dos = array('home', 'apply', 'service', 'manage', 'resource');
$do = !empty($_GET['do']) && in_array($_GET['do'], $dos) ? $_GET['do'] : 'home';
getmember();
$member = $_SGLOBAL['member'];
include_once S_ROOT . './uc_client/client.php';
$member['is_admin'] = uc_check_admin($member['username']);
function is_developer($uid)
{
    global $_SGLOBAL;
    $q = $_SGLOBAL['db']->query("SELECT 1 FROM " . tname('developer') . " WHERE uid='{$uid}'");
    return (bool) $_SGLOBAL['db']->num_rows($q);
}
$uid = $member['uid'];
$member['is_developer'] = is_developer($uid);
include_once S_ROOT . "./source/dev_{$do}.php";
Ejemplo n.º 19
0
/**
 * The callback function that handles PHP errors. For more information on what
 * this error handler does and when it gets called, see
 * {@link error_handler.php the documentation for the error handler file}.
 */
function carl_util_handle_error($level, $message, $file, $line, $context)
{
    // Obey the current PHP error_reporting value. One notable effect of this
    // check is that it causes us to obey the @ error-suppression operator.
    if (($level & error_reporting()) == 0) {
        return true;
    }
    $store_error = $log_error = error_handler_config('log_errors');
    $display_error = is_developer() && error_handler_config('display_errors') && !error_handler_config('script_mode') && !isset($_REQUEST['nodebug']);
    $send_email = error_handler_config('send_emails');
    $send_page = error_handler_config('send_pages');
    if ($store_error) {
        _carl_util_store_error($level, $message, $file, $line, $context);
    }
    if ($display_error) {
        _carl_util_display_error($level, $message, $file, $line, $context);
    }
    if ($log_error) {
        _carl_util_log_error($level, $message, $file, $line, $context);
    }
    if ($send_email) {
        _carl_util_send_email($level, $message, $file, $line, $context);
    }
    if ($send_page) {
        _carl_util_send_page($level, $message, $file, $line, $context);
    }
    if (level_is_terminal($level)) {
        if (!is_developer() && !error_handler_config('script_mode')) {
            header('Location: ' . OHSHI_SCRIPT);
        } else {
            _carl_util_send_error_status();
        }
        exit;
    }
    return true;
}