function planworld_plan_gettext($m) { global $xmlrpcerruser; include_once 'plan_read.php'; $err = ""; // get the param values (should add integrity checking here) $lu = $m->getParam(0); $ru = $m->getParam(1); $sn = $m->getParam(2); // $ar=$m->getParam(3); $localuser = $lu->scalarval(); $remoteuser = $ru->scalarval(); $snitch = $sn->scalarval(); list($localuser, $archives) = explode("___", $localuser); // $archives = $ar->scalarval(); // TODO:(v4.5) think about what to do with the archives variable $localuser = str_replace("@planwatch.org", '', $localuser); plan_get_owner_info($localuser); $_SERVER['USER'] = $remoteuser; $_SERVER['USERINFO_ARRAY']['snitchlevel'] = $snitch + 1; $_SERVER['REMOTENODE'] = strstr($remoteuser, '@'); if ($archives == 'archives') { $plan = plan_read_archives($localuser); } else { $plan = plan_read($localuser, $archives); } if (isset($_SERVER['PLANOWNER_INFO'])) { $plan .= "<!--planowner info set-->"; } $plan = "<!--plan styles--><style type='text/css'>{$_SERVER['PLANOWNER_INFO']['css']}</style>" . $plan; // if we generated an error, create an error return response if ($err) { return new xmlrpcresp(0, $xmlrpcerruser, $err); } else { // otherwise, we create the right response // with the state name return new xmlrpcresp(new xmlrpcval($plan, 'base64')); } }
<?php $_SERVER['AUTH_COOKIE'] = 'fingerprint_v4'; $_SERVER['FILE_ROOT'] = '/home/planwatc/public_html'; include_once '/home/planwatc/public_html/scripts/siteconfig.php'; include_once '/home/planwatc/public_html/scripts/plan_read.php'; include_once '/home/planwatc/public_html/backend/xmlrpc.inc'; include_once '/home/planwatc/public_html/scripts/standard_library/user_info_functions.php'; include_once '/home/planwatc/public_html/scripts/standard_library/plan_info_functions.php'; include_once '/home/planwatc/public_html/scripts/standard_library/file_functions.php'; /* BACKUP */ $_COOKIE[$_SERVER['AUTH_COOKIE']] = "YmFja3Vw:::d53db979c480aa3ce0d9aaba69495fc8"; user_verify_fingerprint("YmFja3Vw:::d53db979c480aa3ce0d9aaba69495fc8"); $time = time(); $backup_permissions_dir = "{$_SERVER['FILE_ROOT']}/stats/backup_permissions"; $backup_users_list = files_list($backup_permissions_dir, "*.permission"); foreach ($backup_users_list as $userfile) { $username = trim(str_replace(".permission", "", basename($userfile))); $sptime = plan_get_last_update($username); $slastview = plan_get_last_view($username); if ($sptime > $slastview || !$sptime && filemtime("{$_SERVER['USER_ROOT']}/files/{$username}.latest.backup") < $time - 3600 * 6) { $plan = plan_read($username, FALSE, FALSE, FALSE, TRUE); $file = fopen("{$_SERVER['USER_ROOT']}/files/{$username}.{$time}.backup", 'w'); fwrite($file, $plan); fclose($file); $file = fopen("{$_SERVER['USER_ROOT']}/files/{$username}.latest.backup", 'w'); fwrite($file, $plan); fclose($file); } }
function plan_read_quiet($plan) { // become cacheuser temporarily $_SERVER['USER'] = '******'; $snitchlevel = $_SERVER['USERINFO_ARRAY']['snitchlevel']; $_SERVER['USERINFO_ARRAY']['snitchlevel'] = 0; $plan_data = plan_read($plan); // put things back in order $_SERVER['USER'] = $_SERVER['USERINFO_ARRAY']['username']; $_SERVER['USERINFO_ARRAY']['snitchlevel'] = $snitchlevel; return $plan_data; }
function form_process_with_struct() { include_once 'snoop.php'; include_once 'plan_read.php'; extract($_POST); unlink("{$_SERVER['FILE_ROOT']}/stats/planlocations.dat"); unlink("{$_SERVER['FILE_ROOT']}/stats/plan_locations.dat"); unlink("{$_SERVER['FILE_ROOT']}/stats/plan_failures.dat"); foreach ($_FILES as $i => $file) { if ($file['size'] > 0) { move_uploaded_file($file['tmp_name'], "{$_SERVER['FILE_ROOT']}/resources/" . $file['name']); } } $olduserinfo = $_SERVER['USERINFO_ARRAY']; $form_definitions = unserialize(base64_decode($form_definitions)); extract($form_definitions['form_disposition']); unset($form_definitions['form_disposition']); if ($storage_format == 'file') { $keys = array_keys($form_definitions); foreach ($keys as $key) { $output_array[$key] = $_POST[$key]; } file_put_contents("{$storage_directory}/{$storage_filename}", serialize($output_array)); // CHANGING PLAN TYPE if ($olduserinfo['journaling'] != $output_array['journaling'] && isset($output_array['journaling'])) { if ($olduserinfo['journaling']) { $plan_fn = "{$_SERVER['PWUSERS_DIR']}/{$olduserinfo['username']}/plan/plan.txt"; @rename($plan_fn, $plan_fn . time()); file_put_contents($plan_fn, $oldplan); } if ($output_array['journaling']) { $plan_fn = "{$_SERVER['PWUSERS_DIR']}/{$olduserinfo['username']}/plan/plan." . time() . ".txt"; file_put_contents($plan_fn, $oldplan); } } // ADVERTISED LIST HANDLING $advlist = @file_get_contents("{$_SERVER['FILE_ROOT']}/stats/advertised.txt"); if ($output_array['privacy'] == 1 && strpos($advlist, $output_array['username']) === FALSE) { file_put_contents("{$_SERVER['FILE_ROOT']}/stats/advertised.txt", "\n" . $output_array['username'], FILE_APPEND); } if ($output_array['privacy'] != 1 && strpos($advlist, $output_array['username']) !== FALSE) { file_put_contents("{$_SERVER['FILE_ROOT']}/stats/advertised.txt", str_replace("\n{$output_array['username']}", '', $advlist)); } // private feed unlink("{$_SERVER['FILE_ROOT']}/resources/privatefeeds/{$olduserinfo['secretword']}.owner"); file_put_contents("{$_SERVER['FILE_ROOT']}/resources/privatefeeds/{$output_array['secretfeedword']}.owner", "{$output_array['planusername']}"); $oa_un = $output_array['username']; exec("rm -f {$_SERVER['FILE_ROOT']}/temp/*{$oa_un}*.cache"); $_SERVER['PLAN_LOCATION_ARRAY'] = unserialize(file_get_contents("{$_SERVER['FILE_ROOT']}/stats/plan_locations.dat")); $_SERVER['PLAN_LOCATION_ARRAY'][$oa_un] = plan_get_real_location($output_array['planusername'] . str_replace(array('RSS', '@local'), '', $output_array['plantype'])); file_put_contents("{$_SERVER['FILE_ROOT']}/stats/plan_locations.dat", serialize($_SERVER['PLAN_LOCATION_ARRAY'])); // RENAMED USER HANDLING if ($output_array['username'] && $output_array['username'] != $_SERVER['USER']) { rename($storage_directory, str_replace($_SERVER['USER'], $output_array['username'], $storage_directory)); // SNOOP STUFF if ($output_array['plantype'] == '@local') { if ($old_snoop_array != FALSE) { $new_snoop_array = snoop_find(plan_read($output_array['username'])); snoop_clean(array_unique($old_snoop_array), $olduserinfo['username']); snoop_add(array_unique($new_snoop_array), $output_array['username']); } } exec("ls {$_SERVER['PWUSERS_DIR']}/*/*list.txt", $list_list); foreach ($list_list as $list) { $list_data = file_get_contents($list); $list_data = str_replace($olduserinfo['username'], $output_array['username'], $list_data); file_put_contents($list, $list_data); } login($output_array['username'], $output_array['userpass']); } else { redirect('/'); } } }