/** * Get the bookmarks file as a string * * Uses the -f or --file parameter to open and read a * a bookmarks file * * @return string Contents of the file */ function getBookmarksFile() { $filename = get_option_value('f', 'file'); if (empty($filename)) { show_help(); exit(1); } if (!file_exists($filename)) { // TRANS: Exception thrown when a file upload cannot be found. // TRANS: %s is the file that could not be found. throw new Exception(sprintf(_m('No such file "%s".'), $filename)); } if (!is_file($filename)) { // TRANS: Exception thrown when a file upload is incorrect. // TRANS: %s is the irregular file. throw new Exception(sprintf(_m('Not a regular file: "%s".'), $filename)); } if (!is_readable($filename)) { // TRANS: Exception thrown when a file upload is not readable. // TRANS: %s is the file that could not be read. throw new Exception(sprintf(_m('File "%s" not readable.'), $filename)); } // TRANS: %s is the filename that contains a backup for a user. printfv(_m('Getting backup from file "%s".') . "\n", $filename); $html = file_get_contents($filename); return $html; }
function sphinx_base() { if (have_option('base')) { return get_option_value('base'); } else { return "/usr/local/sphinx"; } }
function init($worker) { Redis::setCacheServer(get_option_value($worker->config, 'resources.cache', '127.0.0.1:6379')); Redis::setQueueServer(get_option_value($worker->config, 'resources.queue', '127.0.0.1:6379')); $worker->tarthTimerLastTime = 0; $currentTime = time(); $minBacktrackTime = $currentTime - MAX_BACKTRACK_SECONDS; //读取上次执行到的时间 $dir = get_option_value($worker->config, 'main.working_dir', '/tmp'); $worker->tarthTimerLastTimeFile = "{$dir}/timer-last-{$worker->index}"; if (file_exists($worker->tarthTimerLastTimeFile)) { $worker->tarthTimerLastTime = intval(file_get_contents($worker->tarthTimerLastTimeFile)); } if ($minBacktrackTime > $worker->tarthTimerLastTime) { $worker->tarthTimerLastTime = $minBacktrackTime; } elseif ($worker->tarthTimerLastTime > $currentTime) { $worker->tarthTimerLastTime = $currentTime; } }
function getActivityStreamDocument() { $filename = get_option_value('f', 'file'); if (empty($filename)) { show_help(); exit(1); } if (!file_exists($filename)) { throw new Exception("No such file '{$filename}'."); } if (!is_file($filename)) { throw new Exception("Not a regular file: '{$filename}'."); } if (!is_readable($filename)) { throw new Exception("File '{$filename}' not readable."); } // TRANS: Commandline script output. %s is the filename that contains a backup for a user. printfv(_("Getting backup from file '%s'.") . "\n", $filename); $xml = file_get_contents($filename); return $xml; }
/** * Get the bookmarks file as a string * * Uses the -f or --file parameter to open and read a * a bookmarks file * * @return string Contents of the file */ function getBookmarksFile() { $filename = get_option_value('f', 'file'); if (empty($filename)) { show_help(); exit(1); } if (!file_exists($filename)) { throw new Exception("No such file '{$filename}'."); } if (!is_file($filename)) { throw new Exception("Not a regular file: '{$filename}'."); } if (!is_readable($filename)) { throw new Exception("File '{$filename}' not readable."); } // TRANS: %s is the filename that contains a backup for a user. printfv(_("Getting backup from file '%s'.") . "\n", $filename); $html = file_get_contents($filename); return $html; }
function siteStreamForOwner(User $user) { // The user we auth as must be the owner of the application. $auth = twitterAuthForUser($user); if (have_option('apiroot')) { $stream = new TwitterSiteStream($auth, get_option_value('apiroot')); } else { $stream = new TwitterSiteStream($auth); } // Pull Twitter user IDs for all users we want to pull data for $userIds = array(); $flink = new Foreign_link(); $flink->service = TWITTER_SERVICE; $flink->find(); while ($flink->fetch()) { if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) { $userIds[] = $flink->foreign_id; } } $stream->followUsers($userIds); return $stream; }
function getAtomFeedDocument() { $filename = get_option_value('f', 'file'); if (empty($filename)) { show_help(); exit(1); } if (!file_exists($filename)) { throw new Exception("No such file '{$filename}'."); } if (!is_file($filename)) { throw new Exception("Not a regular file: '{$filename}'."); } if (!is_readable($filename)) { throw new Exception("File '{$filename}' not readable."); } $xml = file_get_contents($filename); $dom = DOMDocument::loadXML($xml); if ($dom->documentElement->namespaceURI != Activity::ATOM || $dom->documentElement->localName != 'feed') { throw new Exception("'{$filename}' is not an Atom feed."); } return $dom; }
* GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..')); $shortoptions = "e:"; $helptext = <<<END_OF_REGISTERBYEMAIL_HELP USAGE: registerbyemail.php Registers a new user by email address and sends a confirmation email -e email Email to register END_OF_REGISTERBYEMAIL_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; $email = get_option_value('e', 'email'); $parts = explode('@', $email); $nickname = common_nicknamize($parts[0]); $user = User::getKV('nickname', $nickname); if (!empty($user)) { $confirm = new Confirm_address(); $confirm->user_id = $user->id; $confirm->address_type = 'email'; if ($confirm->find(true)) { $url = common_local_url('confirmfirstemail', array('code' => $confirm->code)); print "{$url}\n"; } else { print "User not waiting for confirmation.\n"; } exit; }
$is_en = substr($locale, 0, 2) == 'en'; foreach ($languages as $language) { $return[] = array(isset($languages_self_list[$language]) ? $languages_self_list[$language] : $languages_list[$language] => array((isset($languages_list[$language]) ? $languages_list[$language] : $language) . ($is_en ? '' : ' - ' . $language) => $language)); } if (!in_array('en', $languages) && !in_array('en_US', $languages) && !in_array('en_GB', $languages)) { $return[] = array('English' => array(is_eng_array('English', 'language', ' - ') => 'en_US')); } return $return; } function get_option_value($option, $default) { $value = get_option($option); return empty($value) ? $default : $value; } // TODO: Array for Settings. $options = array(array('title' => __('General'), 'id' => 'general', 'type' => 'panelstart'), array('title' => __('General'), 'type' => 'subtitle'), array('name' => is_eng_array('Language'), 'desc' => is_eng_array('If you want the system auto detect users browser language to show pages please select "Detect" option.'), 'id' => 'language', 'type' => 'select', 'options' => languages_options(), 'optgroup' => true, 'std' => defined("DCRM_LANG") ? DCRM_LANG : 'Detect'), array('name' => __('Rewrite Mod'), 'desc' => sprintf(__('<b>Elegant Mod</b> - Enable all rewrite rules, the url will show like %s.<br/><b>Normal Mod</b> - Compatible earlier than v1.7 configuration, only enbale a part of rewrite rules for HotLinks.<br/><b>Disabled</b> - This will disable all rewrite rules, so HotLinks will not work.<br/>Notice: You should update your rewrite config first if you want to use Elegant Mod.'), '<code>' . htmlspecialchars(base64_decode(DCRM_REPOURL)) . 'packages/1</code>'), 'id' => 'rewrite_mod', 'type' => 'select', 'options' => array(1 => __('Disable'), 2 => __('Normal'), 3 => __('Elegant')), 'std' => get_option_value('rewrite_mod', 2)), array('title' => __('Login Information'), 'type' => 'subtitle'), array('name' => __('Username'), 'id' => 'username', 'type' => 'text', 'attributes' => array('required' => 'required', 'minlength' => 4, 'maxlength' => 20, 'data-validation-minlength-message' => __('Username length must be between 4-20 characters!'), 'data-validation-regex-regex' => '^[0-9a-zA-Z\\_]*$', 'data-validation-regex-message' => __('Username can only use numbers, letters and underline!')), 'std' => htmlspecialchars($_SESSION['username'])), array('name' => __('New Password'), 'id' => 'pass1', 'type' => 'text', 'desc' => __('If you would like to change the password type a new one. Otherwise leave this blank.')), array('name' => __('Repeat New Password'), 'id' => 'pass2', 'type' => 'text', 'desc' => __('Type your new password again.'), 'attributes' => array('data-validation-match-match' => 'pass1', 'data-validation-match-message' => __('Your password do not match.')), 'special' => 'pass-strength-result')); function show_select($variable, $false_text = '', $true_text = '') { $select_array = array($_false ? $_false : 1 => $false_text ? $false_text : __('Disabled'), $_true ? $_true : 2 => $true_text ? $true_text : __('Enabled')); foreach ($select_array as $key => $value) { echo "<option value=\"{$key}\" " . ($key == $variable ? 'selected="selected"' : '') . ">{$value}</option>\n"; } } ?> <h2><?php _e('Preferences'); ?> </h2> <br /> <form class="form-horizontal settingsform" method="POST" action="settings.php?action=set"> <fieldset>
Subscription::start($profile, $friend_profile); common_log(LOG_INFO, $this->name() . ' - Subscribed ' . "{$friend_profile->nickname} to {$profile->nickname}."); } catch (Exception $e) { common_debug($this->name() . ' - Tried and failed subscribing ' . "{$friend_profile->nickname} to {$profile->nickname} - " . $e->getMessage()); } } } } return true; } } $id = null; $debug = null; if (have_option('i')) { $id = get_option_value('i'); } else { if (have_option('--id')) { $id = get_option_value('--id'); } else { if (count($args) > 0) { $id = $args[0]; } else { $id = null; } } } if (have_option('d') || have_option('debug')) { $debug = true; } $syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug); $syncer->runOnce();
-w --password Password of remote user -y --yes do not wait for confirmation Remote user identity must be a Webfinger (nickname@example.com) or an HTTP or HTTPS URL (http://example.com/social/site/user/nickname). END_OF_MOVEUSER_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; try { $user = getUser(); $remote = get_option_value('r', 'remote'); if (empty($remote)) { show_help(); exit(1); } $password = get_option_value('w', 'password'); if (!have_option('y', 'yes')) { print "WARNING: EXPERIMENTAL FEATURE! Moving accounts will delete data from the source site.\n"; print "\n"; print "About to PERMANENTLY move user '{$user->nickname}' to {$remote}. Are you sure? [y/N] "; $response = fgets(STDIN); if (strtolower(trim($response)) != 'y') { print "Aborting.\n"; exit(0); } } $qm = QueueManager::get(); $qm->enqueue(array($user, $remote, $password), 'acctmove'); } catch (Exception $e) { print $e->getMessage() . "\n"; exit(1);
function get_setting_array($item_id = '', $default = '', $echo = false, $offset = -1) { return get_option_value($item_id, $default, $echo, true, $offset); }
-k key Key to look up; other args are ignored ENDOFHELP; require_once INSTALLDIR . '/scripts/commandline.inc'; $karg = get_option_value('k'); if (!empty($karg)) { $k = common_cache_key($karg); } else { $table = get_option_value('t'); if (empty($table)) { die("No table or key specified\n"); } $column = get_option_value('c'); if (empty($column)) { $column = 'id'; } $value = get_option_value('v'); $k = Memcached_DataObject::cacheKey($table, $column, $value); } print "Checking key '{$k}'...\n"; $c = common_memcache(); if (empty($c)) { die("Can't initialize cache object!\n"); } $obj = $c->get($k); if (empty($obj)) { print "Empty.\n"; } else { var_dump($obj); print "\n"; }
function init($worker) { Redis::setCacheServer(get_option_value($worker->config, 'resources.cache', '127.0.0.1:6379')); Redis::setQueueServer(get_option_value($worker->config, 'resources.queue', '127.0.0.1:6379')); }
$helptext = <<<END_OF_VERIFY_HELP verifycreds.php [options] Use an access token to verify credentials thru the api -o --oauth_token access token -s --token_secret access token secret END_OF_VERIFY_HELP; $token = null; $token_secret = null; require_once INSTALLDIR . '/scripts/commandline.inc'; if (have_option('o', 'oauth_token')) { $token = get_option_value('oauth_token'); } if (have_option('s', 'token_secret')) { $token_secret = get_option_value('s', 'token_secret'); } if (empty($token)) { print "Please specify an access token.\n"; exit(1); } if (empty($token_secret)) { print "Please specify an access token secret.\n"; exit(1); } $ini = parse_ini_file("oauth.ini"); $test_consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']); $endpoint = $ini['apiroot'] . '/account/verify_credentials.xml'; print "{$endpoint}\n"; $at = new OAuthToken($token, $token_secret); $parsed = parse_url($endpoint);
* @author Alvaro Ortego <*****@*****.**> * */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'n'; $longoptions = array('noticeid='); $helptext = <<<END_OF_REGISTERUSER_HELP grade.php [options] read grades associated to a notice -n --noticeid id of the notice to grade END_OF_REGISTERUSER_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; require_once INSTALLDIR . '/local/plugins/Grades/classes/Grades.php'; $noticeid = get_option_value('n', 'noticeid'); if (empty($noticeid)) { print "Must provide a notice id.\n"; exit(1); } try { $notice = Notice::staticGet('notice', $noticeid); if (empty($notice)) { throw new Exception("A notice with id '{$noticeid}' must exists."); } print 'Current grade is :' . Grades::getNoticeGrade($noticeid) . ' '; } catch (Exception $e) { print $e->getMessage() . "\n"; print $e->getTraceAsString(); exit(1); }
function add_procedures_fields($value, $column_name, $id) { switch ($column_name) { case 'cws_proc_thumb': $fa_icon = get_option_value('cws-clinico-proc-fa', $id); if (!empty($fa_icon)) { echo '<i class="fa fa-' . $fa_icon . ' fa-2x"></i>'; } break; case 'url': $url = get_option_value('cws-clinico-proc-url', $id); if (!empty($url)) { echo '<a href="' . $url . '">' . $url . '</a>'; } break; } }
* */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'g'; $longoptions = array('groupnick='); $helptext = <<<END_OF_REGISTERUSER_HELP grade.php [options] read grades associated to a notice -n --noticeid id of the notice to grade END_OF_REGISTERUSER_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; require_once INSTALLDIR . '/local/plugins/Grades/classes/Grades.php'; require_once INSTALLDIR . '/classes/Local_group.php'; $groupnick = get_option_value('g', 'groupnick'); try { if (empty($groupnick)) { $groups = Grades::getGroupsWithGrades(); foreach ($groups as $key => $storedgroupnick) { reportGroupGrades($storedgroupnick); } } else { reportGroupGrades($groupnick); } } catch (Exception $e) { print $e->getMessage() . "\n"; print $e->getTraceAsString(); exit(1); } function reportGroupGrades($groupnick)
-t --oauth_token authorized request token -s --oauth_token_secret authorized request token secret -v --oauth_verifier authorized request token verifier END_OF_ETOKENS_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; $token = $secret = $verifier = null; if (have_option('t', 'oauth_token')) { $token = get_option_value('t', 'oauth_token'); } if (have_option('s', 'oauth_token_secret')) { $secret = get_option_value('s', 'oauth_token_secret'); } if (have_option('v', 'oauth_verifier')) { $verifier = get_option_value('v', 'oauth_verifier'); } if (empty($token)) { print "Please specify the request token (--help for help).\n"; exit(1); } if (empty($secret)) { print "Please specify the request token secret (--help for help).\n"; exit(1); } if (empty($verifier)) { print "Please specify the request token verifier (--help for help).\n"; exit(1); } $rtok = new OAuthToken($token, $secret); $parsed = parse_url($endpoint);
if (Validate::email($uri)) { $oprofile = LooseOstatusProfile::updateWebfinger($uri); } else { if (Validate::uri($uri)) { $oprofile = LooseOstatusProfile::updateProfileURL($uri); } else { print "Sorry, we could not reach the address: {$uri}\n"; return false; } } return $oprofile; } $quiet = have_option('q', 'quiet'); $lop = new LooseOstatusProfile(); if (have_option('u', 'uri')) { $lop->uri = get_option_value('u', 'uri'); } else { if (!have_option('a', 'all')) { show_help(); exit(1); } } $cnt = $lop->find(); if (!empty($cnt)) { if (!$quiet) { echo "Found {$cnt} OStatus profiles:\n"; } } else { if (have_option('u', 'uri')) { if (!$quiet) { echo "Couldn't find an existing OStatus profile with that URI.\n";
print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; } } } catch (Exception $e) { if (!$quiet) { print $e->getMessage() . "\n"; } common_log(LOG_ERR, $e->getMessage(), __FILE__); exit(1); } } else { $qm = QueueManager::get(); try { // enqueue reminder for specific email address or all unconfirmed addresses if (have_option('e', 'email')) { $address = trim(get_option_value('e', 'email')); foreach ($reminders as $reminder) { // real bad voodoo here extract($reminder); $confirm = new $className(); $confirm->address = $address; $result = $confirm->find(true); if (empty($result)) { throw new Exception("No confirmation code found for {$address}."); } $qm->enqueue(array($confirm, $opts), $utransport); if (!$quiet) { print "Sent all pending {$type} reminder to {$address}.\n"; } } } else {
Pull an Atom feed and run items in it as though they were live PuSH updates. Mainly intended for testing funky feed formats. --skip=N Ignore the first N items in the feed. --count=N Only process up to N items from the feed, after skipping. END_OF_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; if (empty($args[0]) || !Validate::uri($args[0])) { print "{$helptext}"; exit(1); } $feedurl = $args[0]; $skip = have_option('skip') ? intval(get_option_value('skip')) : 0; $count = have_option('count') ? intval(get_option_value('count')) : 0; $sub = FeedSub::staticGet('topic', $feedurl); if (!$sub) { print "Feed {$feedurl} is not subscribed.\n"; exit(1); } $xml = file_get_contents($feedurl); if ($xml === false) { print "Bad fetch.\n"; exit(1); } $feed = new DOMDocument(); if (!$feed->loadXML($xml)) { print "Bad XML.\n"; exit(1); }
$from->free(); $to->free(); } function main($usercount, $noticeavg, $subsavg, $tagmax) { global $config; $config['site']['dupelimit'] = -1; $n = 1; newUser(0); // # registrations + # notices + # subs $events = $usercount + $usercount * ($noticeavg + $subsavg); for ($i = 0; $i < $events; $i++) { $e = rand(0, 1 + $noticeavg + $subsavg); if ($e == 0) { newUser($n); $n++; } else { if ($e < $noticeavg + 1) { newNotice($n, $tagmax); } else { newSub($n); } } } } $usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100; $noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100; $subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10); $tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000; $userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser'; main($usercount, $noticeavg, $subsavg, $tagmax);
if ($e > $st && $e <= $jt) { printfv("{$i} Making a new group join\n"); newJoin($n, $g); } else { printfv("No event for {$i}!"); } } } } } } } $usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100; $groupcount = have_option('g', 'groups') ? get_option_value('g', 'groups') : 20; $noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100; $subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10); $joinsavg = have_option('j', 'joins') ? get_option_value('j', 'joins') : 5; $tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000; $userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser'; $groupprefix = have_option('z', 'groupprefix') ? get_option_value('z', 'groupprefix') : 'testgroup'; $wordsfile = have_option('w', 'words') ? get_option_value('w', 'words') : '/usr/share/dict/words'; if (is_readable($wordsfile)) { $words = file($wordsfile); } else { $words = null; } try { main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax); } catch (Exception $e) { printfv("Got an exception: " . $e->getMessage()); }
$profile = $user->getProfile(); if (empty($profile)) { print "User with ID {$id} has no profile\n"; exit(1); } } } $members = array($profile); } else { if (have_option('G', 'group-id') || have_option('g', 'group')) { if (have_option('G', 'group-id')) { $gid = get_option_value('G', 'group-id'); $group = User_group::staticGet('id', $gid); } else { if (have_option('g', 'group')) { $gnick = get_option_value('g', 'group'); $group = User_group::staticGet('nickname', $gnick); } } if (empty($group)) { print "No such local group: {$gnick}\n\n"; exit(1); } $nMiembros = $group->getMemberCount(); if ($nMiembros == 0) { print "El grupo {$gnick} no tiene usuarios."; exit(1); } else { $profile = $group->getMembers(); while ($profile->fetch()) { $members[] = clone $profile;
$shortoptions = 'i:n:f:a:j'; $longoptions = array('id=', 'nickname=', 'file=', 'after=', 'json'); $helptext = <<<END_OF_EXPORTACTIVITYSTREAM_HELP exportactivitystream.php [options] Export a StatusNet user history to a file -i --id ID of user to export -n --nickname nickname of the user to export -j --json Output JSON (default Atom) -a --after Only activities after the given date END_OF_EXPORTACTIVITYSTREAM_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; try { $user = getUser(); if (have_option('a', 'after')) { $afterStr = get_option_value('a', 'after'); $after = strtotime($afterStr); $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW, $after); } else { $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW); } if (have_option('j', 'json')) { $actstr->writeJSON(STDOUT); } else { print $actstr->getString(); } } catch (Exception $e) { print $e->getMessage() . "\n"; exit(1); }
-u --update status update END_OF_VERIFY_HELP; $token = null; $token_secret = null; $update = null; require_once INSTALLDIR . '/scripts/commandline.inc'; if (have_option('t', 'oauth_token')) { $token = get_option_value('t', 'oauth_token'); } if (have_option('s', 'oauth_token_secret')) { $token_secret = get_option_value('s', 'oauth_token_secret'); } if (have_option('u', 'update')) { $update = get_option_value('u', 'update'); } if (empty($token)) { print "Please specify an access token.\n"; exit(1); } if (empty($token_secret)) { print "Please specify an access token secret.\n"; exit(1); } if (empty($update)) { print "You forgot to update your status!\n"; exit(1); } $ini = parse_ini_file("oauth.ini"); $consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
print "\n\n"; echo "== Testing local verification ==\n\n"; $magic_env = new MagicEnvelope($envxml); $activity = new Activity($magic_env->getPayload()->documentElement); $actprofile = Profile::fromUri($activity->actor->id); $ok = $magic_env->verify($actprofile); if ($ok) { print "OK\n\n"; } else { print "FAIL\n\n"; } if (have_option('--verify')) { $url = 'http://www.madebymonsieur.com/ostatus_discovery/magic_env/validate/'; echo "== Testing remote verification ==\n\n"; print "Sending for verification to {$url} ...\n"; $client = new HTTPClient(); $response = $client->post($url, array(), array('magic_env' => $envxml)); print $response->getStatus() . "\n\n"; print $response->getBody() . "\n\n"; } if (have_option('--slap')) { $url = get_option_value('--slap'); echo "== Remote salmon slap ==\n\n"; print "Sending signed Salmon slap to {$url} ...\n"; $ok = Salmon::post($url, $entry, $profile->getUser()); if ($ok) { print "OK\n\n"; } else { print "FAIL\n\n"; } }
* You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); $shortoptions = 'wt::'; $longoptions = array('welcome', 'template='); $helptext = <<<END_OF_INSTALLFOREMAIL_HELP installforemail.php [options] <email address> Create a new account and, if necessary, a new network for the given email address -w --welcome Send a welcome email -t --template= Use this email template END_OF_INSTALLFOREMAIL_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; $email = $args[0]; $sendWelcome = have_option('w', 'welcome'); if ($sendWelcome && have_option('t', 'template')) { $template = get_option_value('t', 'template'); } try { $confirm = DomainStatusNetworkPlugin::registerEmail($email); if ($sendWelcome) { EmailRegistrationPlugin::sendConfirmEmail($confirm, $template); } $confirmUrl = common_local_url('register', array('code' => $confirm->code)); print $confirmUrl . "\n"; } catch (Exception $e) { print "ERROR: " . $e->getMessage() . "\n"; }
--dry-run don't change anything END_OF_UPDATEAVATARURL_HELP; require_once INSTALLDIR . '/scripts/commandline.inc'; try { $user = null; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); $group = User_group::staticGet('id', $id); if (empty($group)) { throw new Exception("Can't find group with id '{$id}'."); } updateGroupUri($group); } else { if (have_option('n', 'nickname')) { $nickname = get_option_value('n', 'nickname'); $group = User_group::staticGet('nickname', $nickname); if (empty($group)) { throw new Exception("Can't find group with nickname '{$nickname}'"); } updateGroupUri($group); } else { if (have_option('a', 'all')) { $group = new User_group(); $group->whereAdd('uri IS NULL'); if ($group->find()) { while ($group->fetch()) { updateGroupUri($group); } } } else {