function pages_init() { include 'wp-content/language/lang_chooser.php'; //Loads the language-file // app_register_init( table, action, apptitle, appname, number ) if (member_of('administrators')) { app_register_init('pages', 'pagelist', 'Pages', 'pages', 2); } }
function authenticate_user($args) { $path_info = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/'; $parts = explode('/', $path_info); session_start(); if (isset($_SESSION['face_userid'])) { return member_of($parts[2]); } $_SESSION['return_to'] = 'http://tweetiepic.com/shared/' . $parts[2]; $fblogin = '******'; redirect_to($fblogin); }
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); }
followgrid(); ?> </div> <?php } ?> <?php } } ?> <?php $links = array(); global $request; if (member_of('administrators')) { $links['Admin'] = $request->url_for('admin'); } $links['Logout'] = $request->url_for('openid_logout'); $links['Register'] = $request->url_for('register'); $links['Login'] = $request->url_for('email_login'); ?> <?php if (!isset($request->params['nickname'])) { ?> <p class="liother"> <a href="<?php base_url(); ?>
function _sources(&$vars) { extract($vars); if (!member_of('administrators')) { trigger_error('sorry you must be an administrator to do that', E_USER_ERROR); } $aktwitter_tw_text_options = array('0' => 'false', '1' => 'true'); $Setting =& $db->model('Setting'); $returnvars = array(); $TwitterUser =& $db->model('TwitterUser'); $TwitterUser->find_by(array('eq' => 'not like', 'oauth_key' => ''), 1); $i = 1; while ($tu = $TwitterUser->MoveNext()) { $modevar = 'n' . $i . 'mode'; $urlvar = 'n' . $i . 'url'; $entryvar = 'n' . $i . 'entry'; $nickvar = 'n' . $i . 'nick'; $i++; ${$nickvar} = $tu->screen_name; ${$modevar} = $Setting->find_by('name', 'config.env.importtwitter_' . $tu->id); if (!${$modevar}) { ${$modevar} = $Setting->base(); ${$modevar}->set_value('profile_id', get_profile_id()); ${$modevar}->set_value('person_id', get_person_id()); ${$modevar}->set_value('name', 'config.env.importtwitter_' . $tu->id); ${$modevar}->set_value('value', 0); ${$modevar}->save_changes(); ${$modevar}->set_etag(); ${$modevar} = $Setting->find(${$modevar}->id); } ${$urlvar} = $request->url_for(array('resource' => 'settings', 'id' => ${$modevar}->id, 'action' => 'put')); ${$entryvar} = ${$modevar}->FirstChild('entries'); $returnvars[] =& ${$modevar}; $returnvars[] =& ${$urlvar}; $returnvars[] =& ${$entryvar}; $returnvars[] =& ${$nickvar}; } $returnvars[] =& $collection; $returnvars[] =& $profile; $returnvars[] =& $aktwitter_tw_text_options; $listvars = array(1 => 'friends_timeline', 0 => 'disabled'); $returnvars[] =& $listvars; $returnvars[] =& $i; return vars($returnvars, get_defined_vars()); }
function get_nav_links() { global $request; $pid = get_app_id(); $links = array(); $i = get_profile($pid); $links["Public"] = base_url(true); if ($i && $i->id > 0) { $links["Personal"] = $request->url_for(array("resource" => "posts", "forid" => $i->id, "page" => 1)); if (empty($i->post_notice)) { $links["Profile"] = $request->url_for(array("resource" => $i->nickname)); } else { $links["Profile"] = $i->profile; } if (empty($i->post_notice)) { $links["@" . $i->nickname] = $request->url_for(array("resource" => $i->nickname)) . "/replies"; } else { $links["@" . $i->nickname] = $i->profile . "/replies"; } } if ($pid > 0) { if (member_of('administrators')) { $links["Admin"] = $request->url_for(array('resource' => 'admin')); } $links["Upload"] = $request->url_for(array('resource' => 'posts', 'action' => 'upload')); $links["Logout"] = $request->url_for("openid_logout"); } else { $links["Register"] = $request->url_for("register"); $links["Login"] = $request->url_for("email_login"); } return $links; }
function can_superuser($resource) { if (!isset($this->access_list['superuser'][$resource])) { return false; } foreach ($this->access_list['superuser'][$resource] as $callback) { if (function_exists($callback)) { if ($callback()) { return true; } } else { if (member_of($callback)) { return true; } } } return false; }
function current_user_can($action, $post_id = false) { if (member_of('administrators')) { return true; } global $request, $the_author; if ($action == 'publish_posts' && ($request->resource != 'posts' || $request->action != 'index')) { return false; } elseif ($action == 'publish_posts' && get_profile_id()) { return true; } $id = get_profile_id(); if (!$id) { return false; } if (isset($request->params['byid'])) { $byid = $request->params['byid']; } else { $byid = 0; } if ($byid && $id == $byid) { return true; } elseif ($id == $the_author->id) { return true; } return false; }