function index(&$vars) { extract($vars); $theme = environment('theme'); $atomfeed = $request->feed_url(); return vars(array(&$Category, &$profile, &$atomfeed, &$collection, &$theme), get_defined_vars()); }
function broadcast_email_notice(&$model, &$rec) { if (!isset($rec->title)) { return; } global $request, $db; $i = owner_of($rec); $sent_to = array(); $Subscription = $db->model('Subscription'); $Subscription->has_one('subscriber:identity'); $where = array('subscriptions.subscribed' => $i->id); $Subscription->set_param('find_by', $where); $Subscription->find(); while ($sub = $Subscription->MoveNext()) { $sid = $sub->FirstChild('identities'); if (!in_array($sid->id, $sent_to) && $sub->email) { $html = false; // this is the body of the e-mail if ($html == false) $text = $rec->title; $subject = $i->nickname . " posted a notice"; send_email($sid->email_value, $subject, $text, environment('email_from'), environment('email_name'), $html); $sent_to[] = $sid->id; } } }
function View() { $this->named_vars = array(); $this->header_sent = false; global $db; global $request; $env =& environment(); if (isset($request->resource)) { $this->collection = new Collection($request->resource); } else { $this->collection = new Collection(null); } $this->named_vars['db'] =& $db; $this->named_vars['request'] =& $request; $this->named_vars['collection'] =& $this->collection; $this->named_vars['response'] =& $this; if (get_profile_id()) { $this->named_vars['profile'] =& get_profile(); } else { $this->named_vars['profile'] = false; } if (isset($request->resource) && $request->resource != 'introspection') { $this->named_vars['resource'] =& $db->get_table($request->resource); } else { $this->named_vars['resource'] = false; } $this->named_vars['prefix'] = $db->prefix; $this->controller = $request->controller; load_apps(); $controller_path = controller_path(); // check for a controller file in controllers/[resource].php if (isset($request->resource)) { $cont = $controller_path . $request->resource . ".php"; if (file_exists($cont)) { $this->controller = $request->resource . ".php"; } elseif (isset($request->templates_resource[$request->resource]) && file_exists($controller_path . $request->templates_resource[$request->resource] . ".php")) { $this->controller = $request->templates_resource[$request->resource] . ".php"; } else { if (isset($GLOBALS['PATH']['apps'])) { foreach ($GLOBALS['PATH']['apps'] as $k => $v) { if (file_exists($v['controller_path'] . $request->resource . ".php")) { $this->controller = $request->resource . ".php"; $controller_path = $v['controller_path']; } } } } } if (is_file($controller_path . $this->controller)) { require_once $controller_path . $this->controller; } else { trigger_error('Sorry, the controller was not found at ' . $controller_path . $this->controller, E_USER_ERROR); } if (!isset($env['content_types'])) { trigger_error('Sorry, the content_types array was not found in the configuration file', E_USER_ERROR); } $this->negotiator = HTTP_Negotiate::choose($env['content_types']); }
protected function defineEnvironment($strenv) { if (($env = environment($strenv)) === null) { $message = __METHOD__ . "() {$strenv} is not valid environment. " . "Use development, test or production."; throw new Sabel_Sakle_Exception($message); } elseif (!defined("ENVIRONMENT")) { define("ENVIRONMENT", $env); } }
function Cookie() { global $prefix; if (environment('cookielife')) { $this->expiration = environment('cookielife'); } $this->cookiename = $prefix . $this->cookiename; if (array_key_exists($this->cookiename, $_COOKIE)) { $buffer = $this->_unpackage($_COOKIE[$this->cookiename]); } else { return false; } }
function post(&$vars) { extract($vars); if (!get_profile_id()) { trigger_error('Sorry, the setting could not be saved', E_USER_ERROR); } $request->set_param(array('setting', 'profile_id'), get_profile_id()); if (strpos($request->params['setting']['name'], 'password') !== false) { $request->set_param(array('setting', 'value'), md5_encrypt($request->params['setting']['value'], $db->dbname)); } $settingname = $request->params['setting']['name']; $set = split('\\.', $settingname); if (is_array($set) && $set[0] == 'config') { if (!member_of('administrators')) { trigger_error('Sorry, you must be an administrator to do that', E_USER_ERROR); } $s = $Setting->find_by('name', $settingname); if ($s) { $db->delete_record($s); } } if ($settingname == 'app') { $do_install = false; $app = $settingname; $sources = environment('remote_sources'); $remote_list = array(); foreach ($sources as $name => $url) { $p = get_profile(); $url = "http://" . $url . "&p=" . urlencode($p->profile_url) . "&a=" . urlencode($app); $curl = curl_init($url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); if ($result) { if (trim($result) == 'install') { $do_install = true; } continue; } curl_close($curl); } if (!$do_install) { trigger_error('Sorry, you are not authorized to install ' . $app, E_USER_ERROR); } } $resource->insert_from_post($request); header_status('201 Created'); redirect_to($request->resource); }
function broadcast_sms_notice(&$model, &$rec) { $smskey = environment('zeepAccessKey'); if (empty($smskey)) { return; } if (!isset($rec->title)) { return; } global $request, $db; $i = owner_of($rec); $notice_content = substr($rec->title, 0, 100); $sent_to = array(); $Subscription = $db->model('Subscription'); $Subscription->has_one('subscriber:identity'); $where = array('subscriptions.subscribed' => $i->id); $Subscription->set_param('find_by', $where); $Subscription->find(); while ($sub = $Subscription->MoveNext()) { $sid = $sub->FirstChild('identities'); if (!in_array($sid->id, $sent_to) && $sub->sms) { $sent_to[] = $sid->id; $apiurl = environment('zeepUrl'); $secret = environment('zeepSecretKey'); $apikey = environment('zeepAccessKey'); $http_date = gmdate(DATE_RFC822); $parameters = "user_id=" . $sid->id . "&body=" . urlencode($notice_content); $canonical_string = $apikey . $http_date . $parameters; $b64_mac = base64_encode(hash_hmac("sha1", $canonical_string, $secret, TRUE)); $authentication = "Zeep {$apikey}:{$b64_mac}"; $header = array("Authorization: " . $authentication, "Date: " . $http_date, "Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strval(strlen($parameters))); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiurl); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); $response = curl_exec($ch); //echo $response; exit; curl_close($ch); } } }
function broadcast_notifixious_notice(&$model, &$rec) { $notifixkey = ''; $login = '******'; $pass = ''; $notifixurl = 'notifixio.us'; if (!isset($rec->title)) { return; } if (!get_profile_id()) { return; } $installed = environment('installed'); if (!in_array('notifixious', $installed)) { return; } if (!class_exists('Services_JSON')) { lib_include('json'); } $url = "http://" . $notifixurl . "/sources/find.json"; $params = "url=" . urlencode(get_bloginfo('rss2_url')); $results = notifixious_http_request($url . "?" . $params, "GET"); $jsonobj = json_decode($results[1]); $source_id = $jsonobj->sources->source->permalink; if ($source_id != "") { update_option('notifixiousSourceId', '' . $source_id . '', '', 'no'); update_option('notifixiousRegistered', '1', '', 'no'); update_option('notifixiousClaimed', '0', '', 'yes'); } else { update_option('notifixiousSourceId', '0', '', 'no'); update_option('notifixiousRegistered', '0', '', 'no'); } $post = get_post($rec); $title = urlencode($post->post_title); $text = urlencode($post->post_content); $link = urlencode($post->guid); $url = "http://" . urlencode($login) . ":" . urlencode($pass) . "@" . $notifixurl . "/sources/" . $source_id . "/events.json?" . "event[title]=" . $title . "&event[text]=" . $text . "&event[link]=" . $link; echo $url; exit; //http://:@?event[title]=&event[text]=&event[link]= $arr = notifixious_http_request($url, "POST"); print_r($arr); exit; }
function send_to_twitter(&$model, &$rec) { if (!get_profile_id()) { return; } // if the Record does not have a title or uri, bail out if (!isset($rec->title) || !isset($rec->uri)) { return; } if (get_option('twitter_status') != 'enabled') { return; } global $db, $prefix; $sql = "SELECT oauth_key,oauth_secret FROM " . $prefix . "twitter_users WHERE profile_id = " . get_profile_id(); $result = $db->get_result($sql); if ($db->num_rows($result) == 1) { // http://abrah.am lib_include('twitteroauth'); $key = $db->result_value($result, 0, 'oauth_key'); $secret = $db->result_value($result, 0, 'oauth_secret'); $consumer_key = environment('twitterKey'); $consumer_secret = environment('twitterSecret'); $to = new TwitterOAuth($consumer_key, $consumer_secret, $key, $secret); $notice_content = substr($rec->title, 0, 140); $content = $to->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $notice_content), 'POST'); } else { wp_plugin_include('twitter-tools'); // set a flag on aktt global $aktt; $aktt->tweet_from_sidebar = false; // truncate the tweet at 140 chars $notice_content = substr($rec->title, 0, 140); // activate Twitter Tools $_GET['activate'] = true; // trip the init() function aktt_init(); // make a new tweet object $tweet = new aktt_tweet(); // set the tweetbody $tweet->tw_text = stripslashes($notice_content); // send the tweet to Twitter $aktt->do_tweet($tweet); } }
function getSplitEventsUrl() { $env = environment(); switch ($env) { case 'development': return getenv('SPLITIO_EVENTS_DEV_URL'); break; case 'loadtesting': return getenv('SPLITIO_EVENTS_LOADTESTING_URL'); break; case 'testing': return getenv('SPLITIO_EVENTS_TESTING_URL'); break; case 'staging': return getenv('SPLITIO_EVENTS_STAGE_URL'); break; case 'production': default: return SPLITIO_EVENTS_URL; } }
followgrid(); ?> </div> <?php } ?> <?php } ?> <?php } ?> <?php if (signed_in() && environment('categories') && !isset($request->params['byid']) && !in_array('settings', $request->activeroute->patterns)) { ?> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) { echo prologue_widget_recent_comments_avatar(array('before_widget' => ' <li id="recent-comments" class="widget widget_recent_comments"> ', 'after_widget' => '', 'before_title' => '<h2>', 'after_title' => '</h2>')); $before = "<h2>" . $txt['recent_projects'] . "</h2>\n"; $after = "\n"; $num_to_show = 35; echo prologue_recent_projects($num_to_show, $before, $after); } // if dynamic_sidebar ?> <?php if (!in_array('settings', $request->activeroute->patterns)) {
function pre_update(&$rec, $modified_field, $datatype) { trigger_before('pre_update', $rec, $this); if (isset($this->models[$rec->table]->field_attrs[$modified_field]['required'])) { if (!(strlen($rec->attributes[$modified_field]) > 0)) { trigger_error("Sorry, you must provide a value for {$modified_field}", E_USER_ERROR); } } if (isset($this->models[$rec->table]->field_attrs[$modified_field]['unique'])) { $result = $this->get_result("select " . $modified_field . " from " . $this->prefix . $rec->table . " where " . $modified_field . " = '" . $rec->attributes[$modified_field] . "' and " . $rec->primary_key . " != '" . $rec->attributes[$rec->primary_key] . "'"); if ($this->num_rows($result) > 0) { trigger_error("Sorry, that {$modified_field} has already been taken.", E_USER_ERROR); } } if ($datatype == 'blob' && strlen($rec->attributes[$modified_field]) > 0) { if (environment('max_upload_mb')) { $max = 1048576 * environment('max_upload_mb'); $size = filesize($rec->attributes[$modified_field]); if ($size > $max) { trigger_error('Sorry but that file is too big, the limit is ' . environment('max_upload_mb') . ' megabytes', E_USER_ERROR); } } global $request; $coll = environment('collection_cache'); if (isset($coll[$request->resource]) && $coll[$request->resource]['location'] == 'aws') { $this->file_upload = array($modified_field, $rec->attributes[$modified_field]); $this->aws_delfile($rec, $rec->id); $this->aws_putfile($rec, $rec->id); $rec->set_value($modified_field, ''); } elseif (isset($coll[$request->resource]) && $coll[$request->resource]['location'] == 'uploads') { update_uploadsfile($this->prefix . $rec->table, $rec->id, $rec->attributes[$modified_field]); $rec->set_value($modified_field, ''); } else { unlink_cachefile($this->prefix . $rec->table, $rec->id, $coll); $oid_result = $this->get_result("select " . $modified_field . " from " . $this->prefix . $rec->table . " where " . $rec->primary_key . " = '" . $rec->attributes[$rec->primary_key] . "'"); if ($this->num_rows($oid_result) > 0) { $prev_oid = $this->fetch_array($oid_result); if (isset($prev_oid[0]) && $prev_oid[0] > 0) { $result = $this->large_object_delete($prev_oid); } } $oid = $this->large_object_create($this->prefix . $rec->table, $rec->attributes[$modified_field]); if ($oid > 0) { $rec->attributes[$modified_field] = $oid; } } } }
function run() { global $config; $apps = environment('apps'); $GLOBALS['PATH']['app_plugins'] = array(); $GLOBALS['PATH']['apps'] = array(); foreach ($apps as $app) { $GLOBALS['PATH']['app_plugins'][] = app_path() . $app . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR; $GLOBALS['PATH']['apps'][$app] = array('layout_path' => app_path() . $app . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR, 'model_path' => app_path() . $app . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR, 'controller_path' => app_path() . $app . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR); } // if ( is_dir( $app . $env['view_folder'] ) ) // $request->set_template_path( $app . $env['view_folder'].DIRECTORY_SEPARATOR ); // else // $request->set_template_path( $env['view_folder'].DIRECTORY_SEPARATOR ); // if ( is_dir( $app . $env['layout_folder'] ) ) // $request->set_layout_path( $app . $env['layout_folder'].DIRECTORY_SEPARATOR ); // else // $request->set_layout_path( $env['layout_folder'].DIRECTORY_SEPARATOR ); }
function send_email_notice(&$model, &$rec) { global $db; global $request; if (!(get_profile_id() && $request->resource == 'groups')) { return; } // get data modesl for 3 tables $Entry =& $db->get_table('entries'); $Group =& $db->get_table('groups'); $Person =& $db->get_table('people'); // load the first 20 records from the groups table $Group->find(); // keep a list of people we have notified $sent_to = array(); // get the name of the table from the data model reference we received $notify_table = $model->table; // get the primary key value of the record reference we received $notify_id = $rec->id; // if the table that was modified is a metadata table (comments, reviews) // notify about the "target" table being modified if (array_key_exists('target_id', $model->field_array)) { $e = $Entry->find($rec->attributes['target_id']); if ($e) { $notify_table = $e->resource; $notify_id = $e->record_id; } } // get the data model we are notifying about $datamodel =& $db->get_table($notify_table); // get the profile data for the current user $profile = owner_of($rec); // loop over each group while ($g = $Group->MoveNext()) { if (in_array($g->name, array('administrators', 'everyone', 'members'))) { continue; } // if the GROUP has READ or CREATE then do notify its members if ($rec->id && (in_array($g->name, $datamodel->access_list['read']['id']) || in_array($g->name, $datamodel->access_list['create'][$notify_table]))) { // loop over each member in the group while ($m = $g->NextChild('memberships')) { // get a person activerecord object for the member's person_id $p = $Person->find($m->person_id); if ($p) { $action = $request->action; $notify = "notify_" . $action; // get an identities activerecord object for the person's first identity // this is an example of traversing the result dataset without re-querying $i = $p->FirstChild('identities'); // if we haven't already sent this person a message if (isset($m->{$notify}) && $m->{$notify} && is_email($i->email_value) && !in_array($i->email_value, $sent_to)) { // a token may be set to allow the notify-ee to "EXPRESS" register as a new site user // it fills in some of the "new user" form info such as e-mail address for them if (isset($i->token) && strlen($i->token) > 0) { $addr = $request->url_for(array('resource' => $notify_table, 'id' => $notify_id, 'ident' => $i->token)); } else { $addr = $request->url_for(array('resource' => $notify_table, 'id' => $notify_id)); } // this is the HTML content of the e-mail $html = ' <!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.0 Transitional//EN\\"> <html> <body> <br /> <b><u><i>Click on this link:</i></u></b><br /> <br /> <font color="red"><a href="' . $addr . '">' . $addr . '</a></font> </body> </html>'; // oh wait, we are not going to send the HTML it is just wasting space for now // comment this out to try the HTML yourself $html = false; // this is the body of the e-mail if ($html == false) $text = 'Content was updated at the following location:' . "\r\n\r\n" . $addr . "\r\n\r\n"; // change the e-mail subject line depending on what action took place if ($action == 'post') { $actionmessage = " created a new "; } elseif ($action == 'put') { $actionmessage = " updated a "; } elseif ($action == 'delete') { $actionmessage = " deleted a "; } // set the e-mail subject to the current user's first name // classify() converts a table name "nerds" to "Nerd" // the converse is tableize() $subject = $profile->given_name . $actionmessage . classify($request->resource); // this sends e-mail using the xpertmailer package // the environment() function reads a value from the config.yml file send_email($i->email_value, $subject, $text, environment('email_from'), environment('email_name'), $html); // add a new entry to the list of successful (more like woeful) recipients $sent_to[] = $i->email_value; } } } } } }
function omb_dev_alert($text) { global $request; if (!isset_admin_email() || $request->domain != 'openmicroblogger.com') { return; } send_email(environment('email_from'), "admin alert for " . $request->base, $text, environment('email_from'), environment('email_name'), false); }
function index(&$vars) { extract($vars); $blocks = environment('blocks'); return vars(array(&$blocks, &$profile, &$collection), get_defined_vars()); }
if (isset($env['max_upload_mb'])) { $db->max_upload_megabytes($env['max_upload_mb']); } if (INTRANET) { $env['authentication'] = 'password'; } //if (UPLOADS) // $env['collection_cache']['posts']['location'] = UPLOADS; //if (UPLOADS) // $env['collection_cache']['identities']['location'] = UPLOADS; // PHP5 only set server timezone if (function_exists(timezone_abbreviations_list) && environment('timezone')) { if (setting('timezone')) { set_tz_by_offset(setting('timezone')); } else { set_tz_by_offset(environment('timezone')); } } /** * load virtual API methods */ global $api_methods, $api_method_perms; $api_methods = array(); $api_method_perms = array(); $Method =& $db->model('Method'); $Method->find_by(array('eq' => 'like', 'function' => 'api_%')); while ($m = $Method->MoveNext()) { $api_method_perms[$m->function] = array('table' => $m->resource, 'perm' => $m->permission); $api_methods[$m->function] = $m->code; $request->connect($m->route, array('action' => $m->function)); if ($m->omb) {
function do_shorten() { add_include_path(library_path() . 'urlshort/upload'); require_once 'includes/config.php'; // settings require_once 'includes/gen.php'; // url generation and location $perma = parse_url($_SERVER['REQUEST_URI']); $_PERMA = explode("/", $perma['path']); @array_shift($_PERMA); $shorturl = new shorturl(); $msg = ''; $strurl = ''; global $db, $request; $Url =& $db->model('Url'); global $pretty_url_base; $urlbase = $pretty_url_base; global $prefix; if (!empty($prefix)) { $sql = "SELECT urlbase FROM shorteners WHERE nickname LIKE '" . $db->escape_string($request->username) . "'"; $sql .= " AND password LIKE '" . $db->escape_string($request->password) . "'"; $result = $db->get_result($sql); $url_base = $db->result_value($result, 0, "urlbase"); if ($db->num_rows($result) == 1) { $urlbase = 'http://' . $url_base; } else { trigger_error('sorry the username and password were incorrect', E_USER_ERROR); } } else { $parts = split('\\.', $urlbase); if (count($parts) > 2) { $urlbase = 'http://' . $parts[1] . '.' . $parts[2]; } } if (REWRITE) { $urlbase = $urlbase . dirname($_SERVER['PHP_SELF']); } else { $urlbase = 'http://' . $request->domain . $_SERVER['PHP_SELF']; } if (isset($request->url)) { $longurl = trim(mysql_escape_string($request->url)); $plain = trim(mysql_escape_string($request->plain)); $protocol_ok = false; if (count($allowed_protocols)) { foreach ($allowed_protocols as $ap) { if (strtolower(substr($longurl, 0, strlen($ap))) == strtolower($ap)) { $protocol_ok = true; break; } } } else { $protocol_ok = true; } $protocol_ok = true; $plaincheck = check_plain($plain); // url Required The destination URL to be shortened. // custom Optional A custom URL that is preferred to an auto-generated URL. // searchtags Optional A search string value to attach to a tr.im URL. // privacycode Optional A string value that must be appended after the URL. // newtrim Optional If present with any value, it will force the creation of a new tr.im URL. // sandbox Optional If present with any value a test data set will be returned, and no URL created. This is intended for testing so that you do not consume API calls or insert pointless data while in development. // api_key Optional An application API key assigned to your application. // username Optional A tr.im username that you would like to attach the URL to. // password Optional The password for the tr.im username referenced above. // if the id has been sent to this script if (isset($request->custom) && strlen(trim($request->custom))) { $shorten = trim(mysql_escape_string($request->custom)); $string = "{$shorten}"; list($string1, $string2) = explode("{$install_path}", $string); $shortid = $string1 . $string2; $q2 = 'SELECT url FROM `urls` WHERE `id` LIKE CONVERT(_utf8 \'' . $shortid . '\' USING latin1)'; $result2 = mysql_query($q2); while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) { printf($row["url"]); exit; } if (mysql_num_rows($result2) == $result2) { $longurl = mysql_result($result2, 1); } else { header('HTTP/1.1 500 Internal Server Error'); exit; } } $make_new_url = true; $q2 = 'SELECT id FROM ' . URL_TABLE . ' WHERE (url="' . $longurl . '")'; $result2 = mysql_query($q2); if (mysql_num_rows($result2)) { $make_new_url = false; } if (isset($request->searchtags)) { $longurl .= $request->searchtags; } if (isset($request->privacycode)) { $longurl .= $request->privacycode; } if (isset($request->newtrim)) { $make_new_url = true; } if ($protocol_ok && $plaincheck) { if (isset($request->sandbox)) { $trimresponse = array('trimpath' => 'w92s', 'reference' => 'lsTZf8vHaslrrmskREhbRArpHh125c', 'trimmed' => '10/08/2009', 'destination' => "http://www.google.com/", 'trim_path' => 'w92S', 'domain' => 'google.com', 'url' => 'http://tr.im/w92S', 'visits' => 0, 'status' => array('result' => 'OK', 'code' => '200', 'message' => 'tr.im URL Added.'), 'date_time' => '2009/08/10 05:46:13 -0400'); $time_of = time(); $responsetype = $request->client_wants; $trimpath = $trimresponse['trimpath']; $reference = $trimresponse['reference']; $trimmed = $trimresponse['trimmed']; $destination = $trimresponse['destination']; $trim_path = $trimresponse['trim_path']; $domain = $trimresponse['domain']; $strurl = $trimresponse['url']; $visits = 0; $status_result = 'OK'; $status_code = '200'; $date_time = $trimresponse['date_time']; } else { $shorturl->add_url($longurl, $plain); if (REWRITE) { $strurl = $urlbase . '' . $shorturl->get_id($longurl); } else { $strurl = $urlbase . '?id=' . $shorturl->get_id($longurl); } $time_of = time() - 3 * 60 * 60; $responsetype = $request->client_wants; $id = $shorturl->get_id($longurl); $trimpath = $id; $reference = get_code(); $trimmed = date("d/m/Y", $time_of); $destination = $longurl; $trim_path = $id; $url_parts = @parse_url($longurl); $domain = $url_parts["host"]; $visits = 0; $status_result = 'OK'; $status_code = '200'; $date_time = date("Y/m/d H:i:s O", $time_of); $l = $Url->find_by(array('id' => $id)); if ($make_new_url) { $l->set_value('text', $plain); $l->set_value('title', $plain); $l->set_value('trimurl', $strurl); $l->set_value('created', date("Y-m-d H:i:s", $time_of)); $l->set_value('date', date("Y-m-d H:i:s", $time_of)); $l->set_value('trimpath', $trimpath); $l->set_value('trimref', $reference); $l->set_value('trimmed', $trimmed); $l->set_value('trimvisits', $visits); $l->set_value('trimtime', $date_time); $l->save_changes(); } else { $reference = $l->reference; $trimpath = $l->trimpath; $reference = $l->trimref; $trimmed = $l->trimmed; $trimpath = $l->trimpath; $trim_path = $l->trimpath; $visits = $l->trimvisits; $date_time = $l->trimtime; $l->set_value('trimvisits', $l->trimvisits + 1); $l->save_changes(); } } $arr = array('destination', 'url', 'trimmed'); if ($responsetype == 'json') { foreach ($arr as $var) { ${$var} = str_replace('/', '\\/', ${$var}); } } if (substr($longurl, -strlen($domain)) == $domain) { $destination .= '\\/'; } $callback1 = ''; $callback2 = ''; if (isset($request->callback)) { $callback1 = $request->callback . '('; $callback2 = ')'; } if ($responsetype == 'json') { header('Content-Type: application/json'); header("Content-Disposition: inline"); } if ($responsetype == 'xml') { echo '<?xml version="1.0" encoding="UTF-8"?> <trim> <status result="OK" code="200" message="tr.im URL Added."/> <url>' . $strurl . '</url> <reference>' . $reference . '</reference> <trimpath>' . $trimpath . '</trimpath> </trim>'; } if ($responsetype == 'json') { echo $callback1 . '{"trimpath": "' . $trimpath . '", "reference": "' . $reference . '", "trimmed": "' . $trimmed . '", "destination": "' . $destination . '", "trim_path": "' . $trim_path . '", "domain": "' . $domain . '", "url": "' . $strurl . '", "visits": ' . $visits . ', "status": {"result": "' . $status_result . '", "code": "' . $status_code . '", "message": "tr.im URL Added."}, "date_time": "' . $date_time . '"}' . $callback2; } } $redircode = '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <META HTTP-EQUIV="Refresh" CONTENT="0;URL=' . stripslashes($destination) . '"> <meta name="robots" content="noindex"/> <link rel="canonical" href="' . stripslashes($destination) . '"/> </head> <body> </body> </html>'; $make_s3 = false; if ($url_base && $make_s3) { $redirfile = tempnam("/tmp", $url_base . '/' . $trimpath); $handle = fopen($redirfile, "w"); fwrite($handle, $redircode); fclose($handle); lib_include('S3'); $s3 = new S3(environment('awsAccessKey'), environment('awsSecretKey')); if ($s3) { $s3->getBucket($url_base); $s3->putObjectFile($redirfile, $url_base, $trimpath, 'public-read'); } } } exit; }
function openid_continue(&$vars) { extract($vars); $valid = false; if (class_exists('MySQL') && environment('openid_version') > 1 && !isset($_SESSION['openid_degrade'])) { global $openid; wp_plugin_include(array('wp-openid')); $logic = new WordPressOpenID_Logic(null); $logic->activate_plugin(); $consumer = WordPressOpenID_Logic::getConsumer(); $openid->response = $consumer->complete($_SESSION['oid_return_to']); switch ($openid->response->status) { case Auth_OpenID_CANCEL: trigger_error('The OpenID assertion was cancelled.', E_USER_ERROR); break; case Auth_OpenID_FAILURE: // if we fail OpenID v2 here, we retry once with OpenID v1 $_SESSION['openid_degrade'] = true; $request->set_param('return_url', $request->url_for('openid_continue') . '/'); $request->set_param('protected_url', $request->base); $request->set_param('openid_url', $_SESSION['openid_url']); authenticate_with_openid(); break; case Auth_OpenID_SUCCESS: $_SESSION['openid_complete'] = true; $valid = true; break; } } if (!$valid) { include $GLOBALS['PATH']['library'] . 'openid.php'; $openid = new SimpleOpenID(); $openid->SetIdentity($_SESSION['openid_url']); $openid->SetApprovedURL($request->url_for('openid_continue') . '/'); $openid->SetTrustRoot($request->base); $server_url = $_SESSION['openid_server_url']; $openid->SetOpenIDServer($server_url); $valid = $openid->ValidateWithServer(); } if ($valid) { $_SESSION['openid_complete'] = true; } else { trigger_error("Sorry, the openid server {$server_url} did not validate your identity.", E_USER_ERROR); } complete_openid_authentication($request); if (!empty($_SESSION['requested_url'])) { redirect_to($_SESSION['requested_url']); } else { redirect_to($request->base); } }
function app_installer_json(&$vars) { extract($vars); if (!class_exists('Services_JSON')) { lib_include('json'); } $json = new Services_JSON(); $apps_list = array(); if (isset($GLOBALS['PATH']['apps'])) { foreach ($GLOBALS['PATH']['apps'] as $k => $v) { if ($k != 'omb') { $apps_list[$k] = $k; } } } // apps_list = physical apps on this host $sources = environment('remote_sources'); $remote_list = array(); // remote_list = all not-installed apps on remote sources foreach ($sources as $name => $url) { $url = "http://" . $url . "&p=" . urlencode($request->uri); $curl = curl_init($url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = false; $result = curl_exec($curl); if ($result) { $data = mb_unserialize($result); foreach ($data as $appname => $appdata) { $remote_list[$appname] = $appname; } } curl_close($curl); } $i = $Identity->find(get_app_id()); while ($s = $i->NextChild('settings')) { if ($s->name == 'app' && in_array($s->value, $apps_list)) { $apps_list = drop_array_element($apps_list, $s->value); } } $i = $Identity->find(get_app_id()); while ($s = $i->NextChild('settings')) { if ($s->name == 'app' && in_array($s->value, $remote_list)) { $remote_list = drop_array_element($remote_list, $s->value); } } $all_apps = array_merge($apps_list, $remote_list); header("Content-Type: application/javascript"); print $json->encode($all_apps); exit; }
function handle_posted_file($filename = "", $att, $profile) { global $db, $request, $response; $response->set_var('profile', $profile); load_apps(); if (isset($_FILES['media']['tmp_name'])) { $table = 'uploads'; } else { $table = 'posts'; } $modelvar = classify($table); $_FILES = array(strtolower($modelvar) => array('name' => array('attachment' => $filename), 'tmp_name' => array('attachment' => $att))); $Post =& $db->model('Post'); $Upload =& $db->model('Upload'); $field = 'attachment'; $request->set_param('resource', $table); $request->set_param(array(strtolower(classify($table)), $field), $att); trigger_before('insert_from_post', ${$modelvar}, $request); $content_type = 'text/html'; $rec = ${$modelvar}->base(); $content_type = type_of($filename); $rec->set_value('profile_id', get_profile_id()); $rec->set_value('parent_id', 0); if (isset($request->params['message'])) { $rec->set_value('title', $request->params['message']); } else { $rec->set_value('title', ''); } if ($table == 'uploads') { $rec->set_value('tmp_name', 'new'); } $upload_types = environment('upload_types'); if (!$upload_types) { $upload_types = array('jpg', 'jpeg', 'png', 'gif'); } $ext = extension_for(type_of($filename)); if (!in_array($ext, $upload_types)) { trigger_error('Sorry, this site only allows the following file types: ' . implode(',', $upload_types), E_USER_ERROR); } $rec->set_value($field, $att); $rec->save_changes(); $tmp = $att; if (is_jpg($tmp)) { $thumbsize = environment('max_pixels'); $Thumbnail =& $db->model('Thumbnail'); $t = $Thumbnail->base(); $newthumb = tempnam("/tmp", "new" . $rec->id . ".jpg"); resize_jpeg($tmp, $newthumb, $thumbsize); $t->set_value('target_id', $atomentry->id); $t->save_changes(); update_uploadsfile('thumbnails', $t->id, $newthumb); $t->set_etag(); } $atomentry = ${$modelvar}->set_metadata($rec, $content_type, $table, 'id'); ${$modelvar}->set_categories($rec, $request, $atomentry); $url = $request->url_for(array('resource' => $table, 'id' => $rec->id)); // $title = substr($rec->title,0,140); // $over = ((strlen($title) + strlen($url) + 1) - 140); // if ($over > 0) // $rec->set_value('title',substr($title,0,-$over)." ".$url); // else // $rec->set_value('title',$title." ".$url); // $rec->save_changes(); trigger_after('insert_from_post', ${$modelvar}, $rec); return true; }
<li id="nav_profile"> <a href="<?php echo $request->url_for(array("resource" => $profile->nickname)); ?> " title="<?php echo $txt['header_profile']; ?> "><?php echo $txt['header_profile']; ?> </a> </li> <?php if (environment('findpeople')) { ?> <li id="nav_find"> <a href="<?php echo ''; ?> " title="<?php echo $txt['header_find_people']; ?> "><?php echo $txt['header_find_people']; ?> </a> </li> <?php }
function delete_from_post(&$req) { trigger_before('delete_from_post', $this, $req); global $db; if ($this->has_metadata && !isset($req->params['entry']['etag'])) { trigger_error("Sorry, the etag was not submitted with the database entry", E_USER_ERROR); } $fields = $this->fields_from_request($req); if ($this->has_metadata) { $atomentry = $db->models['entries']->find_by('etag', $req->params['entry']['etag']); $recid = $atomentry->attributes['record_id']; } else { $recid = $req->id; } $rec = $this->find($recid); if ($this->has_metadata) { $Person =& $db->model('Person'); $Group =& $db->model('Group'); $p = $Person->find(get_person_id()); if (!($p->id == $atomentry->attributes['person_id']) && !$this->can_superuser($req->resource)) { trigger_error("Sorry, your id does not match the owner of the database entry", E_USER_ERROR); } } $coll = environment('collection_cache'); if ($this->has_metadata && isset($coll[$req->resource]) && $coll[$req->resource]['location'] == 'aws') { $ext = extension_for($atomentry->content_type); $pkname = $rec->primary_key; global $prefix; $aws_file = $prefix . $rec->table . $rec->{$pkname} . "." . $ext; lib_include('S3'); $s3 = new S3(environment('awsAccessKey'), environment('awsSecretKey')); if (!$s3) { trigger_error('Sorry, there was a problem connecting to Amazon Web Services', E_USER_ERROR); } if ($s3->getBucket(environment('awsBucket')) && $s3->getObject(environment('awsBucket'), urlencode($aws_file))) { $result = $s3->deleteObject(environment('awsBucket'), urlencode($aws_file)); if (!$result) { trigger_error('Sorry, there was a problem deleting the file from Amazon Web Services', E_USER_ERROR); } } } $result = $db->delete_record($rec); trigger_after('delete_from_post', $this, $req); }
$follow[$tu[1]] = array($optname, $options); } } } foreach ($follow as $tuid => $options) { // http://abrah.am lib_include('twitteroauth'); global $db; $TwitterUser =& $db->model('TwitterUser'); $tu = $TwitterUser->find($tuid); if ($tu) { $latest = false; $key = $tu->oauth_key; $secret = $tu->oauth_secret; $consumer_key = environment('twitterKey'); $consumer_secret = environment('twitterSecret'); $to = new TwitterOAuth($consumer_key, $consumer_secret, $tu->oauth_key, $tu->oauth_secret); $timelineurl = 'https://twitter.com/statuses/friends_timeline.atom'; if ($options[1]['last_id']) { $timelineurl .= '?since_id=' . $options[1]['last_id'] . '&count=200'; admin_alert('starting from ' . $options[1]['last_id'] . ' for ' . $tu->screen_name); } $data = $to->OAuthRequest($timelineurl, array(), 'GET'); $xmlarray = array(); $xmlarray = xml2array($data, $get_attributes = 1, $priority = 'value'); if (count($xmlarray)) { $sincespl = split(":", $xmlarray['feed']['entry'][0]['id']['value']); $sincespl2 = split("/", $sincespl[3]); if (isset($sincespl2[5]) && $sincespl2[5] > 0) { $latest = $sincespl2[5]; if (isset($xmlarray['feed']['entry'])) {
?> " /> </div> <span class="progress" id="ajaxActivity"><img src="<?php bloginfo('template_directory'); ?> /i/indicator.gif" alt="Loading..." /></span> </div> </form> <div class="clear"></div> <?php if (environment('uploads')) { ?> <?php if (environment('use_uploadify')) { ?> <form action="<?php bloginfo('url'); ?> "> <div id="fileUpload">You have a problem with your javascript</div> </form> <?php } else { ?> <p>Add: <a href="<?php url_for(array('resource' => 'posts', 'action' => 'upload')); ?> ">File</a></p>
function pre_update(&$rec, $modified_field, $datatype) { trigger_before('pre_update', $rec, $this); global $request; $req =& $request; if (isset($this->models[$rec->table]->field_attrs[$modified_field]['required'])) { if (!(strlen($rec->attributes[$modified_field]) > 0)) { trigger_error("{$modified_field} is a required field", E_USER_ERROR); } } if (isset($this->models[$rec->table]->field_attrs[$modified_field]['unique'])) { $result = $this->get_result("select " . $modified_field . " from " . $this->prefix . $rec->table . " where " . $modified_field . " = '" . $rec->attributes[$modified_field] . "' and " . $rec->primary_key . " != '" . $rec->attributes[$rec->primary_key] . "'"); if ($this->num_rows($result) > 0) { trigger_error("Sorry but that {$modified_field} has already been taken.", E_USER_ERROR); } } if ($datatype == 'bool') { if (in_array($rec->attributes[$modified_field], $this->true_values, true)) { $rec->attributes[$modified_field] = "1"; } else { $rec->attributes[$modified_field] = "false"; } } if ($datatype == 'blob' && !empty($req->params[strtolower(classify($rec->table))][$modified_field])) { if (strlen($rec->attributes[$modified_field]) > 0) { if (environment('max_upload_mb')) { $max = 1048576 * environment('max_upload_mb'); $size = filesize($rec->attributes[$modified_field]); if ($size > $max) { trigger_error('Sorry but that file is too big, the limit is ' . environment('max_upload_mb') . ' megabytes', E_USER_ERROR); } } $coll = environment('collection_cache'); if (isset($coll[$request->resource]) && $coll[$request->resource]['location'] == 'aws') { $this->file_upload = array($modified_field, $rec->attributes[$modified_field]); $this->aws_delfile($rec, $rec->id); $this->aws_putfile($rec, $rec->id); $rec->set_value($modified_field, ''); } elseif (isset($coll[$request->resource]) && $coll[$request->resource]['location'] == 'uploads') { update_uploadsfile($this->prefix . $rec->table, $rec->id, $rec->attributes[$modified_field]); $rec->set_value($modified_field, ''); } else { unlink_cachefile($this->prefix . $rec->table, $rec->id, $coll); $data =& $this->large_object_create($this->prefix . $rec->table, $rec->attributes[$modified_field]); $rec->attributes[$modified_field] =& $data; } } } }
preg_match('/>(.*?)<\\/td>$/', $rows[5], $aqi_data); if ($debug) { print $aqi_data[1] . " "; } $entity['quality'] = $aqi_data[1]; preg_match('/>(.*?)<\\/td>$/', $rows[6], $aqi_data); if ($debug) { print $aqi_data[1] . "\n\n"; } $entity['pollutants'] = $aqi_data[1]; array_push($result, $entity); } return $result; } function environment($city, $openweathermap = false) { if (preg_match('/shi$/', $py = pinyin::encode($city))) { $py = substr($py, 0, strlen($py) - 3); } if ($openweathermap) { $citys = json_decode(file_get_contents('citys.json'), true); $weather = json_decode(file_get_contents('http://api.openweathermap.org/data/2.5/weather?id=' . $citys[$py] . '&units=metric&lang=zh_cn&APPID=' . APPID), true); $AQI = aqi($city); $weather['AQI'] = $AQI; return $weather; } else { return aqi($city); } } print_r(environment('北京市'));
function send_ping(&$model, &$rec) { if (!PING) { return; } global $db; global $request; $req =& $request; $Entry =& $db->get_table('entries'); $notify_table = $model->table; $recid = $rec->id; if (!empty($db->prefix)) { $chan = $db->prefix; } else { $chan = "chan"; } if (REALTIME_HOST) { $o = owner_of($rec); $payload = array(); if (environment('threaded') && isset($rec->parent_id) && $rec->parent_id > 0) { // push a P2 comment $par = $db->get_record('posts', $rec->parent_id); $tweet = render_comment($rec, $o, $par); $payload['html'] = $tweet; if ($rec->parent_id > 0) { $payload['in_reply_to'] = "#commentcontent-" . $rec->parent_id; } else { $payload['in_reply_to'] = "#content-" . $rec->parent_id; } } else { // push a P2 tweet $o = owner_of($rec); $tweet = '<hr />' . "\n"; $tweet .= '<h4>' . "\n"; $tweet .= '<span class="meta"> <span class="actions"> <a href="' . $request->url_for(array('resource' => $notify_table, 'id' => $recid)) . '" class="thepermalink">Permalink</a> | <a href="' . $request->url_for(array('resource' => $notify_table, 'id' => $recid)) . '" class="post-reply-link" rel="' . $recid . '">Reply</a> <br />' . "\n"; $tweet .= '</span> <br />' . "\n"; $tweet .= '<img alt="" src="' . $o->avatar . '" class="avatar avatar-48" height="48" width="48" /> <a class="nick" href="' . $o->profile . '" title="Posts by ' . $o->nickname . '">' . $o->nickname . '</a> ' . laconica_time($rec->created) . ' | <a href="">0</a> </span>' . "\n"; $tweet .= '</h4>' . "\n"; $tweet .= '<div class="postcontent" id="content-<?php echo $recid; ">' . "\n"; $tweet .= '<p>' . "\n"; $tweet .= render_notice($rec->title, $rec, $o); $tweet .= '</p>' . "\n"; $tweet .= '</div>' . "\n"; $tweet .= '<!-- // postcontent -->' . "\n"; $tweet .= '<div class="bottom_of_entry">' . "\n"; $tweet .= ' ' . "\n"; $tweet .= '</div>' . "\n"; $tweet .= '<div class="commentlist">' . "\n"; $tweet .= '</div>' . "\n"; $oldstyle = false; if ($oldstyle) { $tweet = ''; $tweet .= '<li id="prologue-' . $rec->id . '" class="user_id_' . $o->id . '">'; $tweet .= '<img alt=\'\' src=\'' . $o->avatar . '\' class=\'avatar avatar-48\' height=\'48\' width=\'48\' />'; $tweet .= '<h4>'; $tweet .= '<a href="' . $o->profile . '" title="Posts by ' . $o->nickname . '">' . $o->nickname . '</a> <span class="meta">' . date("g:i A", strtotime($rec->created)) . '<em>on</em> ' . date(get_settings('date_format'), strtotime($rec->created)) . ' |'; $tweet .= ' <span class="actions">'; $tweet .= ' <a href="' . $request->url_for(array('resource' => $notify_table, 'action' => 'entry.html', 'id' => $recid)) . '" class="thepermalink">Permalink</a>'; $tweet .= ' </span>'; $tweet .= ' <br />'; $tweet .= ' </span>'; $tweet .= ' </h4>'; $tweet .= ' <div class="postcontent" id="content-' . $rec->id . '"><p>' . render_notice($rec->title, $rec, $o) . '</p></div>'; $tweet .= ' <div class="bottom_of_entry"> </div>'; $tweet .= ' <ul class="commentlist">'; // $tweet .= ' <ul id="comments" class="commentlist">'; $tweet .= ' </ul>'; $tweet .= '</li>'; } $payload['html'] = $tweet; $payload['in_reply_to'] = 0; } if (!class_exists('Services_JSON')) { lib_include('json'); } $json = new Services_JSON(); $load = $json->encode($payload); $curl = curl_init("http://" . REALTIME_HOST . ":" . REALTIME_PORT); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 1); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'ADDMESSAGE ' . $chan . ' ' . addslashes($load)); $output = curl_exec($curl); } if (!get_profile_id()) { return; } if (array_key_exists('target_id', $model->field_array)) { $e = $Entry->find($rec->attributes['target_id']); if ($e) { $notify_table = $e->resource; $recid = $e->record_id; } } $url = environment('ping_server'); if (empty($url)) { return; } $url .= "=" . $request->url_for(array('resource' => $notify_table, 'action' => 'entry.html', 'id' => $recid)); $curl = curl_init($url); $method = "GET"; curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HTTPGET, $method == "GET"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); }
function setup() { preg_match("/^(https?:\\/\\/)([^\\/]+)\\/?[^\\?]+?[\\??]([-%\\w\\/\\.]+)?/i", $this->uri, $this->values); if (!$this->values) { preg_match("/^(https?:\\/\\/)([^\\/]+)\\/?(([^\\?]+))?/i", $this->uri, $this->values); } $pos = strpos($this->uri, "?"); if ($pos > 0) { $this->base = substr($this->uri, 0, $pos); } else { $this->base = $this->uri; } if (isset($this->values[3])) { $this->params = explode('/', $this->values[3]); } $qp = strpos($this->uri, "?"); $end = 0 - (strlen($this->uri) - $qp); $lenbase = strlen($this->values[1]) + strlen($this->values[2]); if ($qp === false) { $this->path = substr($this->uri, $lenbase); } else { $this->path = substr($this->uri, $lenbase, $end); } if (!(strpos($this->params[count($this->params) - 1], ".") === false)) { $actionsplit = split("\\.", $this->params[count($this->params) - 1]); $this->client_wants = $actionsplit[1]; } $expiry = 60 * 60 * 24 * $this->cookiedays; if (environment('cookielife')) { $expiry = environment('cookielife'); } session_set_cookie_params($expiry, $this->path); // XXX subdomain upgrade if (strpos($this->base, "twitter\\/")) { $this->path = $this->path . $this->prefix; } if (!($this->values[2] == 'localhost')) { $this->domain = $this->values[2]; } $paramstr = substr($this->uri, $qp + 1); $urlsplit = split("http%3A//", $paramstr); if (count($urlsplit) > 1) { $paramstr = $urlsplit[0]; } if (isset($this->client_wants) && $qp > $lenbase) { $ext = $this->client_wants; if (!(strpos($paramstr, "." . $ext) === false)) { $paramsplit = split("\\." . $ext, $paramstr); } if (isset($paramsplit) && count($paramsplit) == 2) { $paramstr = $paramsplit[0] . "." . $ext . str_replace('/', '%2F', str_replace(':', '%3A', $paramsplit[1])); } } if ($qp > $lenbase) { $this->params = explode('/', $paramstr); } else { $this->params = array(''); } }
function dynamic_sidebar() { global $request; global $sidebar_done; if (isset($request->params['nickname'])) { if ($request->action == 'index' && $request->byid == get_profile_id()) { render_partial('apps'); } echo '<script type="text/javascript" src="' . $request->url_for(array('resource' => 'pages', 'action' => 'block.js')) . '"></script>'; $sidebar_done = true; return true; } if (!$sidebar_done && get_profile_id() && $request->resource == 'identities' && in_array($request->action, array('edit', 'entry'))) { if ($request->id == get_profile_id()) { render_partial('admin'); } $sidebar_done = true; return true; } $blocks = environment('blocks'); if (environment('categories') && !empty($blocks) && !$sidebar_done && $request->resource == 'posts') { foreach ($blocks as $b) { // if it's the prologue theme, don't show PAGES in sidebar if (!($b == 'pages' && is_microblog_theme())) { //$renderpartial = true; if (isset($renderpartial)) { // this would be better/faster, but not working yet echo '<script type="text/javascript">'; render_partial(array('resource' => $b, 'action' => 'block.js')); echo '</script>'; } else { // doing a call back to the server for each block. not cool XXX echo '<script type="text/javascript" src="' . $request->url_for(array('resource' => $b, 'action' => 'block.js')) . '"></script>'; } } } $sidebar_done = true; } if (environment('theme') == 'prologue-theme') { echo '<a href="http://openmicroblogger.org"><img src="http://openmicroblogger.org/omb.gif" style="border:none;" alt="openmicroblogger.org" /></a>' . "\n"; } return true; }