当前位置: 首页>>代码示例>>PHP>>正文


PHP CASHSystem::getSystemSettings方法代码示例

本文整理汇总了PHP中CASHSystem::getSystemSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP CASHSystem::getSystemSettings方法的具体用法?PHP CASHSystem::getSystemSettings怎么用?PHP CASHSystem::getSystemSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CASHSystem的用法示例。


在下文中一共展示了CASHSystem::getSystemSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (isset($data['error'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         $connections = CASHSystem::getSystemSettings('system_connections');
         require_once CASH_PLATFORM_ROOT . '/lib/twitter/OAuth.php';
         require_once CASH_PLATFORM_ROOT . '/lib/twitter/twitteroauth.php';
         $temporary_credentials = AdminHelper::getPersistentData('twitter_temporary_credentials');
         $twitter = new TwitterOAuth($connections['com.twitter']['client_id'], $connections['com.teitter']['client_secret'], $temporary_credentials['oauth_token'], $temporary_credentials['oauth_token_secret']);
         $access_token = $twitter->getAccessToken($_REQUEST['oauth_verifier']);
         if ($twitter->http_code == 200) {
             // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
             // calls would only happen in the admin. If this changes we can fuck around with it later.
             $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
             $result = $new_connection->setSettings('@' . $access_token['screen_name'] . ' (Twitter)', 'com.twitter', array('token' => $access_token));
             if ($result) {
                 AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
             } else {
                 AdminHelper::formFailure('Error. Could not save connection.', '/settings/connections/');
             }
         } else {
             AdminHelper::formFailure('Error. Problem communicating with Twitter', '/settings/connections/');
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:26,代码来源:TwitterSeed.php

示例2: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     $connections = CASHSystem::getSystemSettings('system_connections');
     if (isset($connections['com.amazon'])) {
         $s3_default_email = $connections['com.amazon']['email'];
     } else {
         $s3_default_email = false;
     }
     $success = S3Seed::connectAndAuthorize($data['key'], $data['secret'], $data['bucket'], $s3_default_email);
     if ($success) {
         // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
         // calls would only happen in the admin. If this changes we can fuck around with it later.
         $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
         $connection_name = $data['bucket'] . ' (Amazon S3)';
         if (substr($connection_name, 0, 10) == 'cashmusic.') {
             $connection_name = 'Amazon S3 (created ' . date("M j, Y") . ')';
         }
         $result = $new_connection->setSettings($connection_name, 'com.amazon', array('bucket' => $data['bucket']));
         if ($result) {
             AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
         } else {
             AdminHelper::formFailure('Error. Something just didn\'t work right.');
         }
     } else {
         //$return_markup = '<h4>Error</h4>'
         //			   . '<p>We couldn\'t connect with your S3 account. Please check the key and secret.</p>';
         AdminHelper::formFailure('We couldn\'t connect your S3 account. Please check the key and secret.');
     }
     return $return_markup;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:30,代码来源:S3Seed.php

示例3: startUp

 /**
  * Handle annoying environment issues like magic quotes, constants and 
  * auto-loaders before firing up the CASH platform and whatnot
  *
  * @return array
  */
 public static function startUp()
 {
     // remove magic quotes, never call them "magic" in front of your friends
     if (get_magic_quotes_gpc()) {
         function stripslashes_from_gpc(&$value)
         {
             $value = stripslashes($value);
         }
         $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
         array_walk_recursive($gpc, 'stripslashes_from_gpc');
         unset($gpc);
     }
     // define constants (use sparingly!)
     $root = realpath(dirname(__FILE__) . '/../..');
     define('CASH_PLATFORM_ROOT', $root);
     $cash_settings = CASHSystem::getSystemSettings();
     define('CASH_API_URL', $cash_settings['apilocation']);
     define('CASH_PUBLIC_URL', str_replace('api/', 'public/', $cash_settings['apilocation']));
     // set up auto-load
     spl_autoload_register('CASHSystem::autoloadClasses');
     // set timezone
     date_default_timezone_set($cash_settings['timezone']);
     // fire off new CASHRequest to cover any immediate-need things like GET
     // asset requests, etc...
     $cash_page_request = new CASHRequest();
     if (!empty($cash_page_request->response)) {
         $cash_page_request->sessionSet('initial_page_request', array('request' => $cash_page_request->request, 'response' => $cash_page_request->response, 'status_uid' => $cash_page_request->response['status_uid']), 'script');
     }
     unset($cash_page_request);
 }
开发者ID:nodots,项目名称:DIY,代码行数:36,代码来源:CASHSystem.php

示例4: test_setSystemSetting

 function test_setSystemSetting()
 {
     // also tests findAndReplaceInFile()
     $control = CASHSystem::getSystemSettings('timezone');
     CASHSystem::setSystemSetting('timezone', 'Not really a timezone');
     $return = CASHSystem::getSystemSettings('timezone');
     $this->assertNotEqual($control, $return);
     $this->assertEqual('Not really a timezone', $return);
 }
开发者ID:nodots,项目名称:DIY,代码行数:9,代码来源:007_CASHSystem.php

示例5: getRedirectMarkup

 public static function getRedirectMarkup($data = false)
 {
     $connections = CASHSystem::getSystemSettings('system_connections');
     if (isset($connections['com.mandrillapp'])) {
         require_once CASH_PLATFORM_ROOT . '/lib/mandrill/Mandrill.php';
         $login_url = 'http://mandrillapp.com/api-auth/?id=' . $connections['com.mandrillapp']['app_authentication_id'] . '&redirect_url=' . urlencode($connections['com.mandrillapp']['redirect_uri']);
         $return_markup = '<h4>Mandrill</h4>' . '<p>This will redirect you to a secure login on mandrillapp.com and bring you right back.</p>' . '<a href="' . $login_url . '" class="button">Connect your Mandrill account</a>';
         return $return_markup;
     } else {
         return 'Please add default mandrill app credentials.';
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:12,代码来源:MandrillSeed.php

示例6: getRedirectMarkup

 public static function getRedirectMarkup($data = false)
 {
     $connections = CASHSystem::getSystemSettings('system_connections');
     // I don't like using ADMIN_WWW_BASE_PATH below, but as this call is always called inside the
     // admin I'm just going to do it. Without the full path in the form this gets all fucky
     // and that's no bueno.
     if (isset($connections['com.paypal'])) {
         $return_markup = '<h4>Paypal</h4>' . '<p>You\'ll need a verified Business or Premier Paypal account to connect properly. ' . 'Those are free upgrades, so just double-check your address and enter it below. You ' . 'can learn more about what they entail <a href="https://cms.paypal.com/cgi-bin/?cmd=_render-content&content_ID=developer/EC_setup_permissions">here</a>.</p>' . '<form accept-charset="UTF-8" method="post" id="paypal_connection_form" action="' . ADMIN_WWW_BASE_PATH . '/settings/connections/add/com.paypal">' . '<input type="hidden" name="dosettingsadd" value="makeitso" />' . '<input type="hidden" name="permission_type" value="accelerated" />' . '<input id="connection_name_input" type="hidden" name="settings_name" value="(Paypal)" />' . '<input type="hidden" name="settings_type" value="com.paypal" />' . '<label for="merchant_email">Your Paypal email address:</label>' . '<input type="text" name="merchant_email" id="merchant_email" value="" />' . '<br />' . '<div><input class="button" type="submit" value="Add The Connection" /></div>' . '</form>' . '<script type="text/javascript">' . '$("#paypal_connection_form").submit(function() {' . '	var newvalue = $("#merchant_email").val() + " (Paypal)";' . '	$("#connection_name_input").val(newvalue);' . '});' . '</script>';
         return $return_markup;
     } else {
         return 'Please add default paypal api credentials.';
     }
 }
开发者ID:hubub,项目名称:platform,代码行数:13,代码来源:PaypalSeed.php

示例7: getPageMenuDetails

 public static function getPageMenuDetails()
 {
     $pages_array = json_decode(file_get_contents(dirname(__FILE__) . '/../components/interface/en/menu.json'), true);
     // remove non-multi links
     $platform_type = CASHSystem::getSystemSettings('instancetype');
     if ($platform_type == 'multi') {
         unset($pages_array['settings/update'], $pages_array['people/contacts']);
     }
     // make an array for return
     $return_array = array('page_title' => 'CASH Music', 'tagline' => null, 'section_menu' => '', 'link_text' => null);
     // generate submenu markup
     $current_endpoint = '';
     $previous_endpoint = '';
     $menustr = '';
     foreach ($pages_array as $page_endpoint => $page) {
         $exploded = explode('/', $page_endpoint);
         $current_endpoint = $exploded[0];
         if ($current_endpoint !== $previous_endpoint) {
             if ($previous_endpoint !== '') {
                 $menustr .= '</ul>';
                 $return_array[$previous_endpoint . '_section_menu'] = $menustr;
             }
             $menustr = '<ul>';
             $previous_endpoint = $current_endpoint;
         }
         $menulevel = substr_count($page_endpoint, '/');
         if ($menulevel == 1 && !isset($page['hide'])) {
             // only show top-level menu items
             if (!isset($page['add_class'])) {
                 $page['add_class'] = '';
             }
             $menustr .= "<li><a title=\"{$page['page_name']}\" class=\"{$page['add_class']}\" href=\"" . ADMIN_WWW_BASE_PATH . "/{$page_endpoint}/\"><span>{$page['page_name']}</span><div class=\"icon icon-{$page['menu_icon']}\"></div><!--icon--></a></li>";
         }
     }
     // find the right page title
     $endpoint = str_replace('_', '/', BASE_PAGENAME);
     $endpoint_parts = explode('/', $endpoint);
     if (isset($pages_array[$endpoint])) {
         $current_title = '';
         $current_title .= $pages_array[$endpoint]['page_name'];
         $return_array['page_title'] = $current_title;
         if (isset($pages_array[$endpoint]['tagline'])) {
             $return_array['tagline'] = $pages_array[$endpoint]['tagline'];
         }
     }
     // set link text for the main template
     $return_array['link_text'] = array('link_main_page' => $pages_array['mainpage']['page_name'], 'link_menu_assets' => $pages_array['assets']['page_name'], 'link_menu_people' => $pages_array['people']['page_name'], 'link_menu_commerce' => $pages_array['commerce']['page_name'], 'link_menu_calendar' => $pages_array['calendar']['page_name'], 'link_menu_elements' => $pages_array['elements']['page_name'], 'link_menu_help' => $pages_array['help']['page_name'], 'link_youraccount' => $pages_array['account']['page_name'], 'link_settings' => $pages_array['settings']['page_name'], 'link_settings_connections' => $pages_array['settings/connections']['page_name']);
     return $return_array;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:49,代码来源:AdminHelper.php

示例8: __construct

 public function __construct($effective_user_id = false, $primary_request = false)
 {
     $this->platform_type = CASHSystem::getSystemSettings('instancetype');
     if (!$this->platform_type) {
         $this->platform_type = 'single';
     }
     $this->stored_responses = array();
     $this->stored_data = array();
     $this->page_data = array();
     if ($effective_user_id) {
         $this->effective_user_id = $effective_user_id;
     }
     if ($primary_request) {
         $this->primary_request = $primary_request;
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:16,代码来源:AdminCore.php

示例9: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (isset($data['error'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         $connections = CASHSystem::getSystemSettings('system_connections');
         require_once CASH_PLATFORM_ROOT . '/lib/oauth2/OAuth2Client.php';
         require_once CASH_PLATFORM_ROOT . '/lib/oauth2/OAuth2Exception.php';
         require_once CASH_PLATFORM_ROOT . '/lib/mailchimp/MC_OAuth2Client.php';
         $oauth_options = array('redirect_uri' => $connections['com.mailchimp']['redirect_uri'], 'client_id' => $connections['com.mailchimp']['client_id'], 'client_secret' => $connections['com.mailchimp']['client_secret'], 'code' => $data['code']);
         $client = new MC_OAuth2Client($oauth_options);
         $session = $client->getSession();
         if ($session) {
             require_once CASH_PLATFORM_ROOT . '/lib/mailchimp/MailChimp.class.php';
             $cn = new MC_OAuth2Client($oauth_options);
             $cn->setSession($session, false);
             $odata = $cn->api('metadata', 'GET');
             $access_token = $session['access_token'];
             $api_key = $session['access_token'] . '-' . $odata['dc'];
             $api = new MailChimp($api_key);
             $lists = $api->call('lists/list');
             $return_markup = '<h4>Connect to MailChimp</h4>' . '<p>Now just choose a list and save the connection.</p>' . '<form accept-charset="UTF-8" method="post" action="">' . '<input type="hidden" name="dosettingsadd" value="makeitso" />' . '<input id="connection_name_input" type="hidden" name="settings_name" value="(MailChimp list)" />' . '<input type="hidden" name="settings_type" value="com.mailchimp" />' . '<input type="hidden" name="key" value="' . $api_key . '" />' . '<label for="list">Choose a list to connect to:</label>' . '<select id="list_select" name="list">';
             $selected = ' selected="selected"';
             $list_name = false;
             foreach ($lists['data'] as $list) {
                 if ($selected) {
                     $list_name = $list['name'];
                 }
                 $return_markup .= '<option value="' . $list['id'] . '"' . $selected . '>' . $list['name'] . '</option>';
                 $selected = false;
             }
             $return_markup .= '</select><br /><br />' . '<div><input class="button" type="submit" value="Add The Connection" /></div>' . '</form>' . '<script type="text/javascript">' . '$("#connection_name_input").val("' . $list_name . ' (MailChimp)");' . '$("#list_select").change(function() {' . '	var newvalue = this.options[this.selectedIndex].text + " (MailChimp)";' . '	$("#connection_name_input").val(newvalue);' . '});' . '</script>';
             return $return_markup;
         } else {
             return 'There was an error. (session) Please try again.';
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:38,代码来源:MailchimpSeed.php

示例10: connectDB

 /**
  * Grabs database connection properties from /settings/cashmusic.ini.php and
  * opens the appropriate connection
  *
  * @return void
  */
 protected function connectDB()
 {
     $cash_db_settings = CASHSystem::getSystemSettings();
     require_once CASH_PLATFORM_ROOT . '/classes/core/CASHDBA.php';
     $this->db = new CASHDBA($cash_db_settings['hostname'], $cash_db_settings['username'], $cash_db_settings['password'], $cash_db_settings['database'], $cash_db_settings['driver']);
 }
开发者ID:rayangc,项目名称:platform,代码行数:12,代码来源:CASHData.php

示例11: recordLoginAnalytics

 /**
  * Records the basic login data to the people analytics table
  *
  * @return boolean
  */
 protected function recordLoginAnalytics($user_id, $element_id = null, $login_method = 'internal')
 {
     $result = false;
     // check settings first as they're already loaded in the environment
     $record_type = CASHSystem::getSystemSettings('analytics');
     if ($record_type == 'off') {
         return true;
     }
     // first the big record if needed
     if ($record_type == 'full' || !$record_type) {
         $ip_and_proxy = CASHSystem::getRemoteIP();
         $result = $this->db->setData('people_analytics', array('user_id' => $user_id, 'element_id' => $element_id, 'access_time' => time(), 'client_ip' => $ip_and_proxy['ip'], 'client_proxy' => $ip_and_proxy['proxy'], 'login_method' => $login_method));
     }
     // basic logging happens for full or basic
     if ($record_type == 'full' || $record_type == 'basic') {
         $condition = array("user_id" => array("condition" => "=", "value" => $user_id));
         $current_result = $this->db->getData('people_analytics_basic', '*', $condition);
         if (is_array($current_result)) {
             $last_login = $current_result[0]['modification_date'];
             $new_total = $current_result[0]['total'] + 1;
         } else {
             $last_login = time();
             $new_total = 1;
             $condition = false;
         }
         // store the "last_login" time (as long as it's internal (web login) and > 2 min have passed)
         if ($login_method == 'internal' && $last_login < time() - 120) {
             new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'storeuserdata', 'user_id' => $user_id, 'key' => 'last_login', 'value' => $last_login));
             $result = $this->db->setData('people_analytics_basic', array('user_id' => $user_id, 'total' => $new_total), $condition);
         }
     }
     return $result;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:38,代码来源:SystemPlant.php

示例12: array

$misc_message = false;
if (isset($_POST['domisc'])) {
    CASHSystem::setSystemSetting('timezone', $_POST['timezone']);
    CASHSystem::setSystemSetting('systememail', $_POST['systememail']);
    $cash_admin->page_data['page_message'] = 'Success. All changed.';
}
$migrate_message = false;
if (isset($_POST['domigrate'])) {
    $new_settings = array('hostname' => $_POST['hostname'], 'username' => $_POST['adminuser'], 'password' => $_POST['adminpassword'], 'database' => $_POST['databasename']);
    $migrate_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'migratedb', 'todriver' => $_POST['driver'], 'tosettings' => $new_settings));
    if ($migrate_request->response['payload']) {
        $cash_admin->page_data['page_message'] = 'Success. So that happened.';
    } else {
        $cash_admin->page_data['error_message'] = 'Error. There was a problem migrating your data.';
    }
}
$platform_settings = CASHSystem::getSystemSettings();
$cash_admin->page_data['system_email'] = $platform_settings['systememail'];
$cash_admin->page_data['timezone_options'] = AdminHelper::drawTimeZones($platform_settings['timezone']);
$db_types = array('mysql' => 'MySQL', 'sqlite' => 'SQLite');
$db_type = 'unknown';
if (array_key_exists($platform_settings['driver'], $db_types)) {
    $cash_admin->page_data['db_type'] = $db_types[$platform_settings['driver']];
}
if ($cash_admin->page_data['db_type'] == 'MySQL') {
    $cash_admin->page_data['migrate_from_mysql'] = true;
} elseif ($cash_admin->page_data['db_type'] == 'SQLite') {
    $cash_admin->page_data['migrate_from_sqlite'] = true;
}
$cash_admin->page_data['platform_path'] = realpath(CASH_PLATFORM_PATH);
$cash_admin->setPageContentTemplate('settings');
开发者ID:blacktire,项目名称:DIY,代码行数:31,代码来源:settings.php

示例13: sendEmail

 public static function sendEmail($subject, $user_id, $toaddress, $message_text, $message_title, $encoded_html = false)
 {
     // pulling out just the TO email from a 'Address Name <address@name.com>' style address:
     if (strpos($toaddress, '>')) {
         preg_match('/([^<]+)\\s<(.*)>/', $toaddress, $matches);
         if (count($matches)) {
             $toaddress = $matches[2];
         }
     }
     // if the email is bullshit don't try to send to it:
     if (!filter_var($toaddress, FILTER_VALIDATE_EMAIL)) {
         return false;
     }
     // TODO: look up user settings for email if user_id is set — allow for multiple SMTP settings
     // on a per-user basis in the multi-user system
     $email_settings = CASHSystem::getDefaultEmail(true);
     if (CASHSystem::getSystemSettings('instancetype') == 'multi' && $user_id) {
         $user_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getuser', 'user_id' => $user_id));
         $user_details = $user_request->response['payload'];
         $setname = false;
         if (trim($user_details['display_name'] . '') !== '' && $user_details['display_name'] !== 'Anonymous') {
             $setname = $user_details['display_name'];
         }
         if (!$setname && $user_details['username']) {
             $setname = $user_details['username'];
         }
         if ($setname) {
             $fromaddress = $setname . ' <' . $user_details['email_address'] . '>';
         } else {
             $fromaddress = $user_details['email_address'];
         }
     } else {
         $fromaddress = $email_settings['systememail'];
     }
     // let's deal with complex versus simple email addresses. if we find '>' present we try
     // parsing for name + address from a 'Address Name <address@name.com>' style email:
     if (strpos($fromaddress, '>')) {
         preg_match('/([^<]+)\\s<(.*)>/', $fromaddress, $matches);
         if (count($matches)) {
             $from = array($matches[2] => $matches[1]);
         } else {
             $from = $fromaddress;
         }
     } else {
         $from = $fromaddress;
     }
     // handle encoding of HTML if specific HTML isn't passed in:
     if (!$encoded_html) {
         $template = @file_get_contents(CASH_PLATFORM_ROOT . '/settings/defaults/system_email.mustache');
         if (file_exists(CASH_PLATFORM_ROOT . '/lib/markdown/markdown.php')) {
             include_once CASH_PLATFORM_ROOT . '/lib/markdown/markdown.php';
         }
         $message_text = Markdown($message_text);
         $encoded_html = preg_replace('/(\\shttp:\\/\\/(\\S*))/', '<a href="\\1">\\1</a>', $message_text);
         if (!$template) {
             $encoded_html .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>' . $message_title . '</title></head><body>' . "<h1>{$message_title}</h1>\n" . "<p>" . $encoded_html . "</p>" . "</body></html>";
         } else {
             // open up some mustache in here:
             include_once CASH_PLATFORM_ROOT . '/lib/mustache/Mustache.php';
             $higgins = new Mustache();
             $mustache_vars = array('encoded_html' => $encoded_html, 'message_title' => $message_title, 'cdn_url' => defined('CDN_URL') ? CDN_URL : CASH_ADMIN_URL);
             $encoded_html = $higgins->render($template, $mustache_vars);
         }
     }
     // deal with SMTP settings later:
     $smtp = $email_settings['smtp'];
     // include swift mailer
     include_once CASH_PLATFORM_ROOT . '/lib/swift/swift_required.php';
     if ($smtp) {
         // use SMTP settings for goodtimes robust happy mailing
         $transport = Swift_SmtpTransport::newInstance($email_settings['smtpserver'], $email_settings['smtpport']);
         if ($email_settings['smtpusername']) {
             $transport->setUsername($email_settings['smtpusername']);
             $transport->setPassword($email_settings['smtppassword']);
         }
     } else {
         // aww shit. use mail() and hope it gets there
         $transport = Swift_MailTransport::newInstance();
     }
     $swift = Swift_Mailer::newInstance($transport);
     $message = new Swift_Message($subject);
     $message->setFrom($from);
     $message->setBody($encoded_html, 'text/html');
     $message->setTo($toaddress);
     $message->addPart($message_text, 'text/plain');
     $headers = $message->getHeaders();
     $headers->addTextHeader('X-MC-Track', 'opens');
     // Mandrill-specific tracking...leave in by defauly, no harm if not Mandrill
     if ($recipients = $swift->send($message, $failures)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:94,代码来源:CASHSystem.php

示例14: array

<?php

// add unique page settings:
$page_title = 'Platform Settings';
$page_tips = 'This page manages settings for all external services and APIs. Connect to third-party accounts like Twitter, S3, MailChimp, and more.';
$page_memu = array('System Settings' => array('settings/connections/' => array('Connections', 'share')));
$misc_message = false;
if (isset($_POST['domisc'])) {
    CASHSystem::setSystemSetting('timezone', $_POST['timezone']);
    CASHSystem::setSystemSetting('systememail', $_POST['systememail']);
    $misc_message = 'All changed.';
}
$migrate_message = false;
if (isset($_POST['domigrate'])) {
    $new_settings = array('hostname' => $_POST['hostname'], 'username' => $_POST['adminuser'], 'password' => $_POST['adminpassword'], 'database' => $_POST['databasename']);
    $migrate_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'migratedb', 'todriver' => $_POST['driver'], 'tosettings' => $new_settings));
    if ($migrate_request->response['payload']) {
        $migrate_message = 'Well that happened.';
    } else {
        $migrate_message = 'There was a problem migrating your data.';
    }
}
$platform_settings = $return = CASHSystem::getSystemSettings();
开发者ID:nodots,项目名称:DIY,代码行数:23,代码来源:settings.php

示例15: recordAnalytics

 /**
  * Records the basic access data to the elements analytics table
  *
  * @return boolean
  */
 protected function recordAnalytics($id, $access_method, $access_action = 'getmarkup', $location = false, $access_data = '')
 {
     // check settings first as they're already loaded in the environment
     $record_type = CASHSystem::getSystemSettings('analytics');
     if ($record_type == 'off') {
         return true;
     }
     if (!$location) {
         $location = CASHSystem::getCurrentURL();
     }
     // only count one asset + situation per session
     $recorded_elements = $this->sessionGet('recorded_elements');
     if (is_array($recorded_elements)) {
         if (in_array($id . $access_method . $location, $recorded_elements)) {
             // already recorded for this session. just return true.
             return true;
         } else {
             // didn't find a record of this asset. record it and move forward
             $recorded_elements[] = $id . $access_method . $location;
             $this->sessionSet('recorded_elements', $recorded_elements);
         }
     } else {
         $this->sessionSet('recorded_elements', array($id . $access_method . $location));
     }
     // first the big record if needed
     if ($record_type == 'full' || !$record_type) {
         $ip_and_proxy = CASHSystem::getRemoteIP();
         $result = $this->db->setData('elements_analytics', array('element_id' => $id, 'access_method' => $access_method, 'access_location' => $location, 'access_action' => $access_action, 'access_data' => json_encode($access_data), 'access_time' => time(), 'client_ip' => $ip_and_proxy['ip'], 'client_proxy' => $ip_and_proxy['proxy'], 'cash_session_id' => $this->getSessionID()));
     }
     // basic logging happens for full or basic
     if ($record_type == 'full' || $record_type == 'basic') {
         $condition = array("element_id" => array("condition" => "=", "value" => $id));
         $current_result = $this->db->getData('elements_analytics_basic', '*', $condition);
         $short_geo = false;
         if (is_array($access_data)) {
             if (isset($access_data['geo'])) {
                 $short_geo = $access_data['geo']['city'] . ', ' . $access_data['geo']['region'] . ' / ' . $access_data['geo']['countrycode'];
             }
         }
         if (is_array($current_result)) {
             $new_total = $current_result[0]['total'] + 1;
             $data = json_decode($current_result[0]['data'], true);
             if (isset($data['locations'][$location])) {
                 $data['locations'][$location] = $data['locations'][$location] + 1;
             } else {
                 $data['locations'][$location] = 1;
             }
             if (isset($data['methods'][$access_method])) {
                 $data['methods'][$access_method] = $data['methods'][$access_method] + 1;
             } else {
                 $data['methods'][$access_method] = 1;
             }
             if (isset($data['geo'][$short_geo])) {
                 $data['geo'][$short_geo] = $data['geo'][$short_geo] + 1;
             } else {
                 $data['geo'][$short_geo] = 1;
             }
         } else {
             $new_total = 1;
             $data = array('locations' => array($location => 1), 'methods' => array($access_method => 1), 'geo' => array($short_geo => 1));
             $condition = false;
         }
         $result = $this->db->setData('elements_analytics_basic', array('element_id' => $id, 'data' => json_encode($data), 'total' => $new_total), $condition);
     }
     return $result;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:71,代码来源:ElementPlant.php


注:本文中的CASHSystem::getSystemSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。