require_once(__DIR__ . DIRECTORY_SEPARATOR. 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('include/config.php');
require_once('include/network.php');
*
*/
-use \Friendica\Core\Config;
-use \Friendica\Core\PConfig;
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
require_once("include/feed.php");
require_once('include/email.php');
* @todo Automatically detect if incoming data is HTML or BBCode
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once 'include/HTTPExceptions.php';
require_once 'include/bbcode.php';
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('include/security.php');
require_once('include/datetime.php');
*
*/
+use Friendica\App;
+
if (sizeof($_SERVER["argv"]) == 0)
die();
<?php
+use Friendica\App;
+
use League\HTMLToMarkdown\HtmlConverter;
require_once "include/oembed.php";
<?php
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
require_once 'include/oembed.php';
require_once 'include/event.php';
<?php /** @file */
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('boot.php');
require_once "include/bbcode.php";
require_once "include/acl_selectors.php";
-
/*
* Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
* is identical to the code in mod/message.php for 'item_extract_images' and
<?php
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
function cronjobs_run(&$argv, &$argc){
global $a;
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("boot.php");
require_once("include/text.php");
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('include/queue_fn.php');
require_once('include/html2plain.php');
* This will change in the future.
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once 'include/items.php';
require_once 'include/bb2diaspora.php';
*
* @param array $dates Array of possibly duplicated events
* @return array Cleaned events
- *
+ *
* @todo We should replace this with a separate update function if there is some time left
*/
function event_remove_duplicates($dates) {
* @file include/items.php
*/
-use \Friendica\ParseUrl;
+use Friendica\ParseUrl;
require_once 'include/bbcode.php';
require_once 'include/oembed.php';
* Adds a "lang" specification in a "postopts" element of given $arr,
* if possible and not already present.
* Expects "body" element to exist in $arr.
- *
+ *
* @todo Add a parameter to request forcing override
*/
function item_add_language_opt(&$arr) {
<?php
- // send a private message
-
-
+// send a private message
function send_message($recipient=0, $body='', $subject='', $replyto=''){
* @file include/network.php
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("include/xml.php");
require_once('include/Probe.php');
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('include/queue_fn.php');
require_once('include/html2plain.php');
logger(__function__.":".$consumer.", ". $callback);
$key = $this->gen_token();
$sec = $this->gen_token();
-
+
if ($consumer->key){
$k = $consumer->key;
} else {
$k = $consumer;
}
-
+
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d)",
dbesc($key),
dbesc($sec),
function new_access_token($token, $consumer, $verifier = null) {
logger(__function__.":".$token.", ". $consumer.", ". $verifier);
-
+
// return a new access token attached to this consumer
// for the user associated with this token if the request token
// is authorized
// should also invalidate the request token
-
+
$ret=Null;
-
+
// get user for this verifier
$uverifier = get_config("oauth", $verifier);
logger(__function__.":".$verifier.",".$uverifier);
if (is_null($verifier) || ($uverifier!==false)){
-
+
$key = $this->gen_token();
$sec = $this->gen_token();
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d, %d)",
intval(ACCESS_TOKEN_DURATION),
intval($uverifier));
if ($r)
- $ret = new OAuthToken($key,$sec);
+ $ret = new OAuthToken($key,$sec);
}
-
-
+
+
q("DELETE FROM tokens WHERE id='%s'", $token->key);
-
-
+
+
if (!is_null($ret) && $uverifier!==false){
del_config("oauth", $verifier);
/* $apps = get_pconfig($uverifier, "oauth", "apps");
$apps[] = $consumer->key;
set_pconfig($uverifier, "oauth", "apps", $apps);*/
}
-
+
return $ret;
-
+
}
}
intval($_SESSION['uid'])
);
- call_hooks('logged_in', $a->user);
+ call_hooks('logged_in', $a->user);
}
-
+
}
/*
class FKOAuth2 extends OAuth2 {
dbesc($client_secret),
dbesc($redirect_uri)
);
-
+
return $r;
}
protected function checkClientCredentials($client_id, $client_secret = NULL) {
$client_secret = $this->db_secret($client_secret);
-
+
$r = q("SELECT pw FROM clients WHERE client_id = '%s'",
dbesc($client_id));
protected function getAccessToken($oauth_token) {
$r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
dbesc($oauth_token));
-
+
if (dbm::is_result($r))
return $r[0];
return null;
}
-
+
protected function setAccessToken($oauth_token, $client_id, $expires, $scope = NULL) {
$r = q("INSERT INTO tokens (id, client_id, expires, scope) VALUES ('%s', '%s', %d, '%s')",
dbesc($oauth_token),
dbesc($client_id),
intval($expires),
dbesc($scope));
-
+
return $r;
}
protected function getAuthCode($code) {
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
-
+
if (dbm::is_result($r))
return $r[0];
return null;
}
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
- $r = q("INSERT INTO auth_codes
- (id, client_id, redirect_uri, expires, scope) VALUES
+ $r = q("INSERT INTO auth_codes
+ (id, client_id, redirect_uri, expires, scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),
dbesc($redirect_uri),
intval($expires),
dbesc($scope));
- return $r;
- }
-
+ return $r;
+ }
+
}
*/
* @file include/oembed.php
*/
-use \Friendica\ParseUrl;
-use \Friendica\Core\Config;
+use Friendica\ParseUrl;
+use Friendica\Core\Config;
function oembed_replacecb($matches){
$embedurl=$matches[1];
* @file include/plaintext.php
*/
-use \Friendica\ParseUrl;
+use Friendica\ParseUrl;
require_once("include/Photo.php");
require_once("include/bbcode.php");
<?php
/**
* @file include/plugin.php
- *
+ *
* @brief Some functions to handle addons and themes.
*/
/**
* @brief unregisters a hook.
- *
+ *
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called
/**
* @brief Parse theme comment in search of theme infos.
- *
+ *
* like
* \code
* ..* Name: My Theme
/**
* @brief Get the full path to relevant theme files by filename
- *
+ *
* This function search in the theme directory (and if not present in global theme directory)
* if there is a directory with the file extension and for a file with the given
- * filename.
- *
+ * filename.
+ *
* @param string $file Filename
* @param string $root Full root path
* @return string Path to the file or empty string if the file isn't found
<?php
+
+use Friendica\Core\Config;
+
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);
chdir($directory);
}
-use \Friendica\Core\Config;
-
require_once("boot.php");
function poller_run($argv, $argc){
<?php
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
require_once('include/items.php');
require_once('include/ostatus.php');
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("boot.php");
require_once("include/threads.php");
<?php
/**
* @file include/socgraph.php
- *
+ *
* @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
* @todo Fetch profile data from profile page for Redmatrix users
* @todo Detect if it is a forum
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('include/datetime.php');
require_once("include/Scrape.php");
$r = q("SELECT `gcontact`.*
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d
- and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
+ and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
$sql_extra limit %d, %d",
intval($zcid),
intval($uid),
require_once("include/map.php");
require_once("mod/proxy.php");
-
if(! function_exists('replace_macros')) {
/**
* This is our template processor
<?php\r
\r
-/**\r
- * import account file exported from mod/uexport\r
- * args:\r
- * $a App Friendica App Class\r
- * $file Array array from $_FILES\r
- */\r
require_once("include/Photo.php");\r
define("IMPORT_DEBUG", False);\r
\r
q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);\r
}\r
\r
+/**\r
+ * @brief Import account file exported from mod/uexport\r
+ *\r
+ * @param App $a Friendica App Class\r
+ * @param array $file array from $_FILES\r
+ */\r
function import_account(App $a, $file) {\r
logger("Start user import from " . $file['tmp_name']);\r
/*\r
}\r
}\r
\r
-\r
-\r
-\r
-\r
foreach ($account['photo'] as &$photo) {\r
$photo['uid'] = $newuid;\r
$photo['data'] = hex2bin($photo['data']);\r
*
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once('boot.php');
require_once('object/BaseObject.php');
header("Content-type: text/html; charset=utf-8");
/*
- * We use $_GET["mode"] for special page templates. So we will check if we have
+ * We use $_GET["mode"] for special page templates. So we will check if we have
* to load another page template than the default one.
* The page templates are located in /view/php/ or in the theme directory.
*/
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("mod/hostxrd.php");
require_once("mod/nodeinfo.php");
* @brief Friendica admin
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("include/enotify.php");
require_once("include/text.php");
<?php
function amcd_content(App $a) {
-//header("Content-type: text/json");
-echo <<< EOT
+ echo <<< JSON
{
"version":1,
"sessionstatus":{
}
}
}
-EOT;
-killme();
+JSON;
+ killme();
}
\ No newline at end of file
<?php
-function apps_content(App $a) {
- $privateaddons = get_config('config','private_addons');
- if ($privateaddons === "1") {
- if((! (local_user()))) {
- info( t("You must be logged in to use addons. "));
- return;};
-}
- $title = t('Applications');
+function apps_content(App $a) {
+ $privateaddons = get_config('config', 'private_addons');
+ if ($privateaddons === "1") {
+ if ((!(local_user()))) {
+ info(t("You must be logged in to use addons. "));
+ return;
+ };
+ }
- if(count($a->apps)==0)
- notice( t('No installed applications.') . EOL);
+ $title = t('Applications');
+ if (count($a->apps) == 0) {
+ notice(t('No installed applications.') . EOL);
+ }
$tpl = get_markup_template("apps.tpl");
return replace_macros($tpl, array(
'$title' => $title,
'$apps' => $a->apps,
));
-
-
-
}
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
function community_init(App $a) {
if (! local_user()) {
}
}
-
function community_content(App $a, $update = 0) {
$o = '';
require_once('include/group.php');
function contactgroup_content(App $a) {
-
-
if (! local_user()) {
killme();
}
<?php
+
/**
* Show a credits page for all the developers who helped with the project
* (only contributors to the git repositories for friendica core and the
* addons repository will be listed though ATM)
*/
-function credits_content (App $a) {
- /* fill the page with credits */
- $f = fopen('util/credits.txt','r');
- $names = fread($f, filesize('util/credits.txt'));
- $arr = explode("\n", htmlspecialchars($names));
- fclose($f);
- $tpl = get_markup_template('credits.tpl');
- return replace_macros( $tpl, array(
- '$title' => t('Credits'),
- '$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
- '$names' => $arr,
- ));
+
+function credits_content(App $a) {
+ /* fill the page with credits */
+ $f = fopen('util/credits.txt', 'r');
+ $names = fread($f, filesize('util/credits.txt'));
+ $arr = explode("\n", htmlspecialchars($names));
+ fclose($f);
+ $tpl = get_markup_template('credits.tpl');
+ return replace_macros($tpl, array(
+ '$title' => t('Credits'),
+ '$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
+ '$names' => $arr,
+ ));
}
return settings_init($a);
}
-
function delegate_content(App $a) {
if (! local_user()) {
require_once('include/auth.php');
require_once('include/dfrn.php');
-
function dfrn_poll_init(App $a) {
-
-
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
$type = ((x($_GET,'type')) ? $_GET['type'] : 'data');
$last_update = ((x($_GET,'last_update')) ? $_GET['last_update'] : '');
$a->page['aside'] .= findpeople_widget();
$a->page['aside'] .= follow_widget();
-
}
else {
unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']);
}
-
-
}
-
function directory_post(App $a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
-
-
function directory_content(App $a) {
global $db;
$a->page['aside'] .= follow_widget();
}
-
-
function dirfind_content(App $a, $prefix = "") {
$community = false;
}
profile_load($a, $nick, 0, $profiledata);
-
}
function display_fetchauthor($a, $item) {
require_once('include/bbcode.php');
require_once('include/items.php');
-
function filer_content(App $a) {
if (! local_user()) {
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
function friendica_init(App $a) {
if ($a->argv[1] == "json"){
// Just for testing purposes
$_GET["mode"] = "minimal";
}
+
function hovercard_content() {
$profileurl = (x($_REQUEST,'profileurl') ? $_REQUEST['profileurl'] : "");
$datatype = (x($_REQUEST,'datatype') ?$_REQUEST['datatype'] : "json");
<?php
-require_once "include/Photo.php";
-$install_wizard_pass=1;
+require_once "include/Photo.php";
+$install_wizard_pass = 1;
function install_init(App $a) {
<?php
function login_content(App $a) {
- if(x($_SESSION,'theme'))
+ if (x($_SESSION, 'theme')) {
unset($_SESSION['theme']);
- if(x($_SESSION,'mobile-theme'))
+ }
+ if (x($_SESSION, 'mobile-theme')) {
unset($_SESSION['mobile-theme']);
+ }
- if(local_user())
+ if (local_user()) {
goaway(z_root());
+ }
+
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
-
}
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
function maintenance_content(App $a) {
<?php
- use Friendica\Core\Config;
- function manifest_content(App $a) {
+use Friendica\Core\Config;
- $tpl = get_markup_template('manifest.tpl');
+function manifest_content(App $a) {
- header('Content-type: application/manifest+json');
+ $tpl = get_markup_template('manifest.tpl');
- $touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
- if ($touch_icon == '') {
- $touch_icon = 'images/friendica-128.png';
- }
+ header('Content-type: application/manifest+json');
- $o = replace_macros($tpl, array(
- '$baseurl' => App::get_baseurl(),
- '$touch_icon' => $touch_icon,
- '$title' => Config::get('config', 'sitename', 'Friendica'),
- ));
+ $touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
+ if ($touch_icon == '') {
+ $touch_icon = 'images/friendica-128.png';
+ }
- echo $o;
+ $o = replace_macros($tpl, array(
+ '$baseurl' => App::get_baseurl(),
+ '$touch_icon' => $touch_icon,
+ '$title' => Config::get('config', 'sitename', 'Friendica'),
+ ));
- killme();
+ echo $o;
- }
-?>
+ killme();
+}
<?php
-include_once('include/text.php');
+require_once('include/text.php');
require_once('include/socgraph.php');
require_once('include/contact_widgets.php');
require_once('mod/proxy.php');
require_once('include/bbcode.php');
require_once('include/items.php');
-
function mood_init(App $a) {
if (! local_user()) {
<?php
-function newmember_content(App $a) {
+function newmember_content(App $a) {
$o = '<h1>' . t('Welcome to Friendica') . '</h1>';
-
$o .= '<h3>' . t('New Member Checklist') . '</h3>';
-
$o .= '<div style="font-size: 120%;">';
-
$o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
-
$o .= '<h4>' . t('Getting Started') . '</h4>';
-
$o .= '<ul>';
-
$o .= '<li> ' . '<a target="newmember" href="help/guide">' . t('Friendica Walk-Through') . '</a><br />' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '</li>' . EOL;
-
$o .= '</ul>';
-
$o .= '<h4>' . t('Settings') . '</h4>';
-
$o .= '<ul>';
-
$o .= '<li>' . '<a target="newmember" href="settings">' . t('Go to Your Settings') . '</a><br />' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</li>' . EOL;
-
$o .= '<li>' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</li>' . EOL;
-
$o .= '</ul>';
-
$o .= '<h4>' . t('Profile') . '</h4>';
-
$o .= '<ul>';
-
$o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload Profile Photo') . '</a><br />' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</li>' . EOL;
-
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit Your Profile') . '</a><br />' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</li>' . EOL;
-
$o .= '<li>' . '<a target="newmember" href="profiles">' . t('Profile Keywords') . '</a><br />' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</li>' . EOL;
-
$o .= '</ul>';
-
$o .= '<h4>' . t('Connecting') . '</h4>';
-
$o .= '<ul>';
- $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+ $mail_disabled = ((function_exists('imap_open') && (!get_config('system', 'imap_disabled'))) ? 0 : 1);
- if(! $mail_disabled)
+ if (!$mail_disabled) {
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Importing Emails') . '</a><br />' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
+ }
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Go to Your Contacts Page') . '</a><br />' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
-
$o .= '<li>' . '<a target="newmember" href="directory">' . t("Go to Your Site's Directory") . '</a><br />' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
-
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Finding New People') . '</a><br />' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
-
$o .= '</ul>';
-
$o .= '<h4>' . t('Groups') . '</h4>';
-
$o .= '<ul>';
-
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Group Your Contacts') . '</a><br />' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
- if(get_config('system', 'newuser_private')) {
+ if (get_config('system', 'newuser_private')) {
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . t("Why Aren't My Posts Public?") . '</a><br />' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
}
$o .= '</ul>';
-
$o .= '<h4>' . t('Getting Help') . '</h4>';
-
$o .= '<ul>';
-
$o .= '<li>' . '<a target="newmember" href="help">' . t('Go to the Help Section') . '</a><br />' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</li>' . EOL;
-
$o .= '</ul>';
-
$o .= '</div>';
return $o;
* Documentation: http://nodeinfo.diaspora.software/schema.html
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once 'include/plugin.php';
<?php
- /* identi.ca -> friendica items permanent-url compatibility */
- function notice_init(App $a) {
- $id = $a->argv[1];
- $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
- intval($id)
- );
- if (dbm::is_result($r)){
- $nick = $r[0]['nickname'];
- $url = App::get_baseurl()."/display/$nick/$id";
- goaway($url);
- } else {
- $a->error = 404;
- notice( t('Item not found.') . EOL);
+/* identi.ca -> friendica items permanent-url compatibility */
- }
- return;
+function notice_init(App $a) {
+
+ $id = $a->argv[1];
+ $r = q("SELECT `user`.`nickname` FROM `user` LEFT JOIN `item` ON `item`.`uid` = `user`.`uid` WHERE `item`.`id` = %d", intval($id));
+ if (dbm::is_result($r)) {
+ $nick = $r[0]['nickname'];
+ $url = App::get_baseurl() . "/display/$nick/$id";
+ goaway($url);
+ } else {
+ $a->error = 404;
+ notice(t('Item not found.') . EOL);
}
+
+ return;
+}
require_once('library/openid.php');
-
function openid_content(App $a) {
$noid = get_config('system','no_openid');
<?php
- function opensearch_content(App $a) {
- $tpl = get_markup_template('opensearch.tpl');
- header("Content-type: application/opensearchdescription+xml");
+function opensearch_content(App $a) {
- $o = replace_macros($tpl, array(
- '$baseurl' => App::get_baseurl(),
- '$nodename' => $a->get_hostname(),
- ));
+ $tpl = get_markup_template('opensearch.tpl');
- echo $o;
+ header("Content-type: application/opensearchdescription+xml");
- killme();
+ $o = replace_macros($tpl, array(
+ '$baseurl' => App::get_baseurl(),
+ '$nodename' => $a->get_hostname(),
+ ));
- }
-?>
\ No newline at end of file
+ echo $o;
+
+ killme();
+}
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/
-use \Friendica\ParseUrl;
+use Friendica\ParseUrl;
require_once("include/items.php");
<?php
+
+use Friendica\Core\Config;
+
require_once 'include/Photo.php';
require_once 'include/photos.php';
require_once 'include/items.php';
require_once 'include/threads.php';
require_once 'include/Probe.php';
-use \Friendica\Core\Config;
-
function photos_init(App $a) {
if ($a->argc > 1) {
<?php
-require_once("include/datetime.php");
+require_once('include/datetime.php');
require_once('include/bbcode.php');
require_once('include/ForumManager.php');
require_once('include/group.php');
-<?php /** @file */
+<?php
/**
- *
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
* other web request. You must be logged in and connected to a profile.
* private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
*
*/
-
+ * @file mod/poke.php
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function pretheme_init(App $a) {
- if($_REQUEST['theme']) {
+ if ($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
$info = get_theme_info($theme);
- if($info) {
+ if ($info) {
// unfortunately there will be no translation for this string
$desc = $info['description'];
$version = $info['version'];
$credits = $info['credits'];
- }
- else {
+ } else {
$desc = '';
$version = '';
$credits = '';
}
echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits));
}
+
killme();
}
function probe_content(App $a) {
if (!local_user()) {
- http_status_exit(403,
- array("title" => t("Public access denied."),
- "description" => t("Only logged in users are permitted to perform a probing.")));
+ http_status_exit(403, array("title" => t("Public access denied."),
+ "description" => t("Only logged in users are permitted to perform a probing.")));
killme();
}
$o .= '<h3>Probe Diagnostic</h3>';
$o .= '<form action="probe" method="get">';
- $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
+ $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
- if(x($_GET,'addr')) {
-
+ if (x($_GET, 'addr')) {
$addr = trim($_GET['addr']);
$res = probe_url($addr);
$o .= '<pre>';
- $o .= str_replace("\n",'<br />',print_r($res,true));
+ $o .= str_replace("\n", '<br />', print_r($res, true));
$o .= '</pre>';
}
+
return $o;
}
require_once('include/contact_widgets.php');
require_once('include/redir.php');
-
function profile_init(App $a) {
if(! x($a->page,'aside'))
}
profile_load($a,$a->user['nickname']);
-
}
-
function profile_photo_post(App $a) {
if (! local_user()) {
echo json_encode((object) $results);
killme();
}
-
require_once('include/crypto.php');
require_once('include/diaspora.php');
-
function receive_post(App $a) {
-
$enabled = intval(get_config('system','diaspora_enabled'));
if(! $enabled) {
logger('mod-diaspora: disabled');
<?php
+
/**
* @file mod/robots_text.php
* @brief Module which returns the default robots.txt
*/
function robots_txt_init(App $a)
{
-
$allDisalloweds = array(
'/settings/',
'/admin/',
);
header('Content-Type: text/plain');
- echo 'User-agent: *'.PHP_EOL;
+ echo 'User-agent: *' . PHP_EOL;
foreach ($allDisalloweds as $disallowed) {
- echo 'Disallow: '.$disallowed.PHP_EOL;
+ echo 'Disallow: ' . $disallowed . PHP_EOL;
}
killme();
}
<?php
-
-function rsd_xml_content(App $a) {
+function rsd_xml_content(App $a)
+{
header ("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
- <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
- <service>
- <engineName>Friendica</engineName>
- <engineLink>http://friendica.com/</engineLink>
- <apis>
- <api name="Twitter" preferred="true" apiLink="'.App::get_baseurl().'/api/" blogID="">
- <settings>
- <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
- <setting name="OAuth">false</setting>
- </settings>
- </api>
- </apis>
- </service>
- </rsd>
- ';
-die();
+<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
+ <service>
+ <engineName>Friendica</engineName>
+ <engineLink>http://friendica.com/</engineLink>
+ <apis>
+ <api name="Twitter" preferred="true" apiLink="'.App::get_baseurl().'/api/" blogID="">
+ <settings>
+ <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
+ <setting name="OAuth">false</setting>
+ </settings>
+ </api>
+ </apis>
+ </service>
+</rsd>';
+
+ killme();
}
\ No newline at end of file
require_once("include/Smilies.php");
function smilies_content(App $a) {
- if ($a->argv[1]==="json"){
+ if ($a->argv[1] === "json") {
$tmp = Smilies::get_list();
$results = array();
- for($i = 0; $i < count($tmp['texts']); $i++) {
+ for ($i = 0; $i < count($tmp['texts']); $i++) {
$results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
}
json_return_and_die($results);
- }
- else {
- return Smilies::replace('',true);
+ } else {
+ return Smilies::replace('', true);
}
}
<?php
+
/**
* @file mod/statistics_json.php
*/
function statistics_json_init(App $a) {
- if (!get_config("system", "nodeinfo")) {
- http_status_exit(404);
- killme();
- }
+ if (!get_config("system", "nodeinfo")) {
+ http_status_exit(404);
+ killme();
+ }
$statistics = array(
- "name" => $a->config["sitename"],
- "network" => FRIENDICA_PLATFORM,
- "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
- "registrations_open" => ($a->config['register_policy'] != 0),
- "total_users" => get_config('nodeinfo','total_users'),
- "active_users_halfyear" => get_config('nodeinfo','active_users_halfyear'),
- "active_users_monthly" => get_config('nodeinfo','active_users_monthly'),
- "local_posts" => get_config('nodeinfo','local_posts')
- );
+ "name" => $a->config["sitename"],
+ "network" => FRIENDICA_PLATFORM,
+ "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
+ "registrations_open" => ($a->config['register_policy'] != 0),
+ "total_users" => get_config('nodeinfo', 'total_users'),
+ "active_users_halfyear" => get_config('nodeinfo', 'active_users_halfyear'),
+ "active_users_monthly" => get_config('nodeinfo', 'active_users_monthly'),
+ "local_posts" => get_config('nodeinfo', 'local_posts')
+ );
$statistics["services"] = array();
$statistics["services"]["appnet"] = plugin_enabled("appnet");
$statistics["wordpress"] = $statistics["services"]["wordpress"];
header("Content-Type: application/json");
- echo json_encode($statistics, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
- logger("statistics_init: printed ".print_r($statistics, true), LOGGER_DATA);
+ echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
+ logger("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
killme();
}
require_once('include/bbcode.php');
require_once('include/items.php');
-
function subthread_content(App $a) {
if(! local_user() && ! remote_user()) {
require_once('include/bbcode.php');
require_once('include/items.php');
-
function tagger_content(App $a) {
if(! local_user() && ! remote_user()) {
<?php
function uexport_init(App $a) {
- if (! local_user()) {
+ if (!local_user()) {
killme();
}
if ($a->argc > 1) {
header("Content-type: application/json");
- header('Content-Disposition: attachment; filename="'.$a->user['nickname'].'.'.$a->argv[1].'"');
- switch($a->argv[1]) {
+ header('Content-Disposition: attachment; filename="' . $a->user['nickname'] . '.' . $a->argv[1] . '"');
+ switch ($a->argv[1]) {
case "backup":
uexport_all($a);
killme();
$result = array();
$r = q($query);
if (dbm::is_result($r)) {
- foreach($r as $rr){
+ foreach ($r as $rr) {
$p = array();
- foreach($rr as $k => $v) {
+ foreach ($rr as $k => $v) {
$p[$k] = $v;
}
$result[] = $p;
$result = array();
$r = q($query);
if (dbm::is_result($r)) {
- foreach($r as $rr) {
- foreach($rr as $k => $v) {
+ foreach ($r as $rr) {
+ foreach ($rr as $k => $v) {
$result[$k] = $v;
}
}
return $result;
}
-
-function uexport_account($a){
+function uexport_account($a) {
$user = _uexport_row(
- sprintf( "SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()) )
+ sprintf("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()))
);
$contact = _uexport_multirow(
- sprintf( "SELECT * FROM `contact` WHERE `uid` = %d ",intval(local_user()) )
+ sprintf("SELECT * FROM `contact` WHERE `uid` = %d ", intval(local_user()))
);
- $profile =_uexport_multirow(
- sprintf( "SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()) )
+ $profile = _uexport_multirow(
+ sprintf("SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()))
);
$photo = _uexport_multirow(
- sprintf( "SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()) )
+ sprintf("SELECT * FROM `photo` WHERE uid = %d AND profile = 1", intval(local_user()))
);
foreach ($photo as &$p) {
$p['data'] = bin2hex($p['data']);
}
$pconfig = _uexport_multirow(
- sprintf( "SELECT * FROM `pconfig` WHERE uid = %d",intval(local_user()) )
+ sprintf("SELECT * FROM `pconfig` WHERE uid = %d", intval(local_user()))
);
$group = _uexport_multirow(
- sprintf( "SELECT * FROM `group` WHERE uid = %d",intval(local_user()) )
+ sprintf("SELECT * FROM `group` WHERE uid = %d", intval(local_user()))
);
$group_member = _uexport_multirow(
- sprintf( "SELECT * FROM `group_member` WHERE uid = %d",intval(local_user()) )
+ sprintf("SELECT * FROM `group_member` WHERE uid = %d", intval(local_user()))
);
$output = array(
intval($x),
intval(500)
);
- /*if (dbm::is_result($r)) {
- foreach($r as $rr)
- foreach($rr as $k => $v)
- $item[][$k] = $v;
- }*/
+ /* if (dbm::is_result($r)) {
+ foreach($r as $rr)
+ foreach($rr as $k => $v)
+ $item[][$k] = $v;
+ } */
$output = array('item' => $r);
- echo json_encode($output)."\n";
+ echo json_encode($output) . "\n";
}
}
<?php\r
+\r
/**\r
* View for user import\r
- * @TODO This file has DOS line endings!\r
*/\r
\r
require_once("include/uimport.php");\r
\r
function uimport_post(App $a) {\r
- switch($a->config['register_policy']) {\r
- case REGISTER_OPEN:\r
- $blocked = 0;\r
- $verified = 1;\r
- break;\r
+ switch ($a->config['register_policy']) {\r
+ case REGISTER_OPEN:\r
+ $blocked = 0;\r
+ $verified = 1;\r
+ break;\r
\r
- case REGISTER_APPROVE:\r
- $blocked = 1;\r
- $verified = 0;\r
- break;\r
+ case REGISTER_APPROVE:\r
+ $blocked = 1;\r
+ $verified = 0;\r
+ break;\r
\r
- default:\r
- case REGISTER_CLOSED:\r
- if ((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {\r
- notice( t('Permission denied.') . EOL );\r
- return;\r
- }\r
- $blocked = 1;\r
- $verified = 0;\r
- break;\r
+ default:\r
+ case REGISTER_CLOSED:\r
+ if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {\r
+ notice(t('Permission denied.') . EOL);\r
+ return;\r
+ }\r
+ $blocked = 1;\r
+ $verified = 0;\r
+ break;\r
}\r
\r
- if (x($_FILES,'accountfile')){\r
+ if (x($_FILES, 'accountfile')) {\r
/// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE\r
import_account($a, $_FILES['accountfile']);\r
return;\r
\r
function uimport_content(App $a) {\r
\r
- if ((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
+ if ((!local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
notice("Permission denied." . EOL);\r
return;\r
}\r
\r
- $max_dailies = intval(get_config('system','max_daily_registrations'));\r
+ $max_dailies = intval(get_config('system', 'max_daily_registrations'));\r
if ($max_dailies) {\r
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");\r
if ($r && $r[0]['total'] >= $max_dailies) {\r
logger('max daily registrations exceeded.');\r
- notice( t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);\r
+ notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);\r
return;\r
}\r
}\r
\r
\r
- if (x($_SESSION,'theme')) {\r
+ if (x($_SESSION, 'theme')) {\r
unset($_SESSION['theme']);\r
}\r
- if (x($_SESSION,'mobile-theme')) {\r
+ if (x($_SESSION, 'mobile-theme')) {\r
unset($_SESSION['mobile-theme']);\r
}\r
\r
return replace_macros($tpl, array(\r
'$regbutt' => t('Import'),\r
'$import' => array(\r
- 'title' => t("Move account"),\r
- 'intro' => t("You can import an account from another Friendica server."),\r
- 'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),\r
- 'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),\r
- 'field' => array('accountfile', t('Account file'),'<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),\r
+ 'title' => t("Move account"),\r
+ 'intro' => t("You can import an account from another Friendica server."),\r
+ 'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),\r
+ 'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),\r
+ 'field' => array('accountfile', t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),\r
),\r
));\r
}\r
require_once('include/security.php');
require_once('include/redir.php');
-
function videos_init(App $a) {
if($a->argc > 1)
/**
* @file mod/wall_upload.php
* @brief Module for uploading a picture to the profile wall
- *
+ *
* By default the picture will be stored in the photo album with the name Wall Photos.
* You can specify a different album by adding an optional query string "album="
* to the url
*/
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once 'include/Photo.php';
-
function wall_upload_post(App $a, $desktopmode = true) {
logger("wall upload: starting new upload", LOGGER_DEBUG);
* @package util
*/
-/*
+/*
* require boot.php
*/
require_once("boot.php");
<?php
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
require_once("boot.php");
<?php
- /**
- * Read strings.php file and create messages.po
- *
- * php utils/php2po.php <path/to/strings.php>
- *
- * Output to <path/to/messages.po>
- */
-
- DEFINE("NORM_REGEXP", "|[\\\]|");
-
-
- if(! class_exists('App')) {
- class TmpA {
- public $strings = Array();
- }
- $a = new TmpA();
- }
+/**
+ * Read strings.php file and create messages.po
+ *
+ * php utils/php2po.php <path/to/strings.php>
+ *
+ * Output to <path/to/messages.po>
+ */
- if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
- print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
- print "Options:\n";
- print "p\tNumber of plural forms. Default: 2\n";
- print "\n";
- return;
- }
- $phpfile = $argv[1];
- $pofile = dirname($phpfile)."/messages.po";
+DEFINE("NORM_REGEXP", "|[\\\]|");
- if (!file_exists($phpfile)){
- print "Unable to find '$phpfile'\n";
- return;
+if(! class_exists('App')) {
+ class TmpA {
+ public $strings = Array();
}
+ $a = new TmpA();
+}
- // utility functions
- function startsWith($haystack, $needle) {
- // search backwards starting from haystack length characters from the end
- return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
- }
+if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
+ print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
+ print "Options:\n";
+ print "p\tNumber of plural forms. Default: 2\n";
+ print "\n";
+ return;
+}
+
+$phpfile = $argv[1];
+$pofile = dirname($phpfile)."/messages.po";
+
+if (!file_exists($phpfile)){
+ print "Unable to find '$phpfile'\n";
+ return;
+}
+// utility functions
+function startsWith($haystack, $needle) {
+ // search backwards starting from haystack length characters from the end
+ return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
+}
- // start !
- include_once($phpfile);
-
- $out = '';
- $out .= "# FRIENDICA Distributed Social Network\n";
- $out .= "# Copyright (C) 2010, 2011, 2012, 2013 the Friendica Project\n";
- $out .= "# This file is distributed under the same license as the Friendica package.\n";
- $out .= "# \n";
- $out .= 'msgid ""' ."\n";
- $out .= 'msgstr ""' ."\n";
- $out .= '"Project-Id-Version: friendica\n"' ."\n";
- $out .= '"Report-Msgid-Bugs-To: \n"' ."\n";
- $out .= '"POT-Creation-Date: '. date("Y-m-d H:i:sO").'\n"' ."\n";
- $out .= '"MIME-Version: 1.0\n"' ."\n";
- $out .= '"Content-Type: text/plain; charset=UTF-8\n"' ."\n";
- $out .= '"Content-Transfer-Encoding: 8bit\n"' ."\n";
-
- // search for plural info
- $lang = "";
- $lang_logic = "";
- $lang_pnum = 2;
-
- $_idx = array_search('-p', $argv);
- if ($_idx !== false) {
- $lang_pnum = $argv[$_idx+1];
+
+// start !
+include_once($phpfile);
+
+$out = '';
+$out .= "# FRIENDICA Distributed Social Network\n";
+$out .= "# Copyright (C) 2010, 2011, 2012, 2013 the Friendica Project\n";
+$out .= "# This file is distributed under the same license as the Friendica package.\n";
+$out .= "# \n";
+$out .= 'msgid ""' ."\n";
+$out .= 'msgstr ""' ."\n";
+$out .= '"Project-Id-Version: friendica\n"' ."\n";
+$out .= '"Report-Msgid-Bugs-To: \n"' ."\n";
+$out .= '"POT-Creation-Date: '. date("Y-m-d H:i:sO").'\n"' ."\n";
+$out .= '"MIME-Version: 1.0\n"' ."\n";
+$out .= '"Content-Type: text/plain; charset=UTF-8\n"' ."\n";
+$out .= '"Content-Transfer-Encoding: 8bit\n"' ."\n";
+
+// search for plural info
+$lang = "";
+$lang_logic = "";
+$lang_pnum = 2;
+
+$_idx = array_search('-p', $argv);
+if ($_idx !== false) {
+ $lang_pnum = $argv[$_idx+1];
+}
+
+$infile = file($phpfile);
+foreach($infile as $l) {
+ $l = trim($l);
+ if (startsWith($l, 'function string_plural_select_')) {
+ $lang = str_replace( 'function string_plural_select_' , '', str_replace( '($n){','', $l) );
}
-
- $infile = file($phpfile);
- foreach($infile as $l) {
- $l = trim($l);
- if (startsWith($l, 'function string_plural_select_')) {
- $lang = str_replace( 'function string_plural_select_' , '', str_replace( '($n){','', $l) );
- }
- if (startsWith($l, 'return')) {
- $lang_logic = str_replace( '$', '', trim( str_replace( 'return ' , '', $l) , ';') );
- break;
- }
+ if (startsWith($l, 'return')) {
+ $lang_logic = str_replace( '$', '', trim( str_replace( 'return ' , '', $l) , ';') );
+ break;
}
-
- echo "Language: $lang\n";
- echo "Plural forms: $lang_pnum\n";
- echo "Plural logic: $lang_logic;\n";
-
- $out .= sprintf('"Language: %s\n"', $lang) ."\n";
- $out .= sprintf('"Plural-Forms: nplurals=%s; plural=%s;\n"', $lang_pnum, $lang_logic) ."\n";
- $out .= "\n";
+}
- print "\nLoading base message.po...";
-
- // load base messages.po and extract msgids
- $base_msgids = array();
- $norm_base_msgids = array();
- $base_f = file("util/messages.po") or die("No base messages.po\n");
- $_f = 0; $_mid = ""; $_mids = array();
- foreach( $base_f as $l) {
- $l = trim($l);
- //~ print $l."\n";
-
- if (startsWith($l, 'msgstr')) {
- if ($_mid != '""') {
- $base_msgids[$_mid] = $_mids;
- $norm_base_msgids[preg_replace(NORM_REGEXP, "", $_mid)] = $_mid;
- //~ print "\t\t\t".$_mid. print_r($base_msgids[$_mid], true);
- }
-
- $_f = 0;
- $_mid = "";
- $_mids = array();
-
- }
-
- if (startsWith($l, '"') && $_f==2) {
- $_mids[count($_mids)-1] .= "\n".$l;
- //~ print "\t\t+mids: ".print_t($_mids, true);
- }
- if (startsWith($l, 'msgid_plural ')) {
- $_f = 2;
- $_mids[] = str_replace('msgid_plural ', '' , $l);
- //~ print "\t\t mids: ".print_r($_mids, true);
- }
-
- if (startsWith($l, '"') && $_f==1) {
- $_mid .= "\n".$l;
- $_mids[count($_mids)-1] .= "\n".$l;
- //~ print "\t+mid: $_mid \n";
- }
- if (startsWith($l, 'msgid ')) {
- $_f = 1;
- $_mid = str_replace('msgid ', '' , $l);
- $_mids = array($_mid);
- //~ print "\t mid: $_mid \n";
+echo "Language: $lang\n";
+echo "Plural forms: $lang_pnum\n";
+echo "Plural logic: $lang_logic;\n";
+
+$out .= sprintf('"Language: %s\n"', $lang) ."\n";
+$out .= sprintf('"Plural-Forms: nplurals=%s; plural=%s;\n"', $lang_pnum, $lang_logic) ."\n";
+$out .= "\n";
+
+print "\nLoading base message.po...";
+
+// load base messages.po and extract msgids
+$base_msgids = array();
+$norm_base_msgids = array();
+$base_f = file("util/messages.po") or die("No base messages.po\n");
+$_f = 0; $_mid = ""; $_mids = array();
+foreach( $base_f as $l) {
+ $l = trim($l);
+ //~ print $l."\n";
+
+ if (startsWith($l, 'msgstr')) {
+ if ($_mid != '""') {
+ $base_msgids[$_mid] = $_mids;
+ $norm_base_msgids[preg_replace(NORM_REGEXP, "", $_mid)] = $_mid;
+ //~ print "\t\t\t".$_mid. print_r($base_msgids[$_mid], true);
}
- //~ print "\t\t\t\t$_f\n\n";
+
+ $_f = 0;
+ $_mid = "";
+ $_mids = array();
+
}
-
- print " done\n";
- print "Creating '$pofile'...";
- // create msgid and msgstr
-
- /**
- * Get a string and retun a message.po ready text
- * - replace " with \"
- * - replace tab char with \t
- * - manage multiline strings
- */
- function massage_string($str) {
- $str = str_replace('\\','\\\\',$str);
- $str = str_replace('"','\"',$str);
- $str = str_replace("\t",'\t',$str);
- $str = str_replace("\n",'\n"'."\n".'"',$str);
- if (strpos($str, "\n")!==false && $str[0]!=='"') $str = '"'."\n".$str;
- $str = preg_replace("|\n([^\"])|", "\n\"$1", $str);
- return sprintf('"%s"', $str);
+
+ if (startsWith($l, '"') && $_f==2) {
+ $_mids[count($_mids)-1] .= "\n".$l;
+ //~ print "\t\t+mids: ".print_t($_mids, true);
}
-
- function find_original_msgid($str) {
- global $norm_base_msgids;
- $norm_str = preg_replace(NORM_REGEXP, "", $str);
- if (array_key_exists($norm_str, $norm_base_msgids)) {
- return $norm_base_msgids[$norm_str];
- }
- return $str;
+ if (startsWith($l, 'msgid_plural ')) {
+ $_f = 2;
+ $_mids[] = str_replace('msgid_plural ', '' , $l);
+ //~ print "\t\t mids: ".print_r($_mids, true);
}
-
- $warnings = "";
- foreach($a->strings as $key=>$str) {
- $msgid = massage_string($key);
-
- if (preg_match("|%[sd0-9](\$[sn])*|", $msgid)) {
- $out .= "#, php-format\n";
- }
- $msgid = find_original_msgid($msgid);
- $out .= 'msgid '. $msgid . "\n";
-
- if (is_array($str)) {
- if (array_key_exists($msgid, $base_msgids) && isset($base_msgids[$msgid][1])) {
- $out .= 'msgid_plural '. $base_msgids[$msgid][1] . "\n";
- } else {
- $out .= 'msgid_plural '. $msgid . "\n";
- $warnings .= "[W] No source plural form for msgid:\n". str_replace("\n","\n\t", $msgid) . "\n\n";
- }
- foreach ( $str as $n => $msgstr) {
- $out .= 'msgstr['.$n.'] '. massage_string($msgstr) . "\n";
- }
- } else {
- $out .= 'msgstr '. massage_string($str) . "\n";
- }
-
- $out .= "\n";
-
+
+ if (startsWith($l, '"') && $_f==1) {
+ $_mid .= "\n".$l;
+ $_mids[count($_mids)-1] .= "\n".$l;
+ //~ print "\t+mid: $_mid \n";
}
+ if (startsWith($l, 'msgid ')) {
+ $_f = 1;
+ $_mid = str_replace('msgid ', '' , $l);
+ $_mids = array($_mid);
+ //~ print "\t mid: $_mid \n";
+ }
+ //~ print "\t\t\t\t$_f\n\n";
+}
+
+print " done\n";
+print "Creating '$pofile'...";
+// create msgid and msgstr
+
+/**
+ * Get a string and retun a message.po ready text
+ * - replace " with \"
+ * - replace tab char with \t
+ * - manage multiline strings
+ */
+function massage_string($str) {
+ $str = str_replace('\\','\\\\',$str);
+ $str = str_replace('"','\"',$str);
+ $str = str_replace("\t",'\t',$str);
+ $str = str_replace("\n",'\n"'."\n".'"',$str);
+ if (strpos($str, "\n")!==false && $str[0]!=='"') $str = '"'."\n".$str;
+ $str = preg_replace("|\n([^\"])|", "\n\"$1", $str);
+ return sprintf('"%s"', $str);
+}
+
+function find_original_msgid($str) {
+ global $norm_base_msgids;
+ $norm_str = preg_replace(NORM_REGEXP, "", $str);
+ if (array_key_exists($norm_str, $norm_base_msgids)) {
+ return $norm_base_msgids[$norm_str];
+ }
+ return $str;
+}
+
+$warnings = "";
+foreach($a->strings as $key=>$str) {
+ $msgid = massage_string($key);
- file_put_contents($pofile, $out);
-
- print " done\n";
-
- if ($warnings=="") {
- print "No warnings.\n";
+ if (preg_match("|%[sd0-9](\$[sn])*|", $msgid)) {
+ $out .= "#, php-format\n";
+ }
+ $msgid = find_original_msgid($msgid);
+ $out .= 'msgid '. $msgid . "\n";
+
+ if (is_array($str)) {
+ if (array_key_exists($msgid, $base_msgids) && isset($base_msgids[$msgid][1])) {
+ $out .= 'msgid_plural '. $base_msgids[$msgid][1] . "\n";
+ } else {
+ $out .= 'msgid_plural '. $msgid . "\n";
+ $warnings .= "[W] No source plural form for msgid:\n". str_replace("\n","\n\t", $msgid) . "\n\n";
+ }
+ foreach ( $str as $n => $msgstr) {
+ $out .= 'msgstr['.$n.'] '. massage_string($msgstr) . "\n";
+ }
} else {
- print $warnings;
+ $out .= 'msgstr '. massage_string($str) . "\n";
}
-
+
+ $out .= "\n";
+
+}
+
+file_put_contents($pofile, $out);
+
+print " done\n";
+
+if ($warnings=="") {
+ print "No warnings.\n";
+} else {
+ print $warnings;
+}
<?php
- // Tired of chasing typos and finding them after a commit.
- // Run this from cmdline in basedir and quickly see if we've
- // got any parse errors in our application files.
+// Tired of chasing typos and finding them after a commit.
+// Run this from cmdline in basedir and quickly see if we've
+// got any parse errors in our application files.
- error_reporting(E_ERROR | E_WARNING | E_PARSE );
- ini_set('display_errors', '1');
- ini_set('log_errors','0');
+error_reporting(E_ERROR | E_WARNING | E_PARSE );
+ini_set('display_errors', '1');
+ini_set('log_errors','0');
- include 'boot.php';
+include 'boot.php';
- $a = new App();
+$a = new App();
- if(x($a->config,'php_path'))
- $phpath = $a->config['php_path'];
- else
- $phpath = 'php';
+if(x($a->config,'php_path'))
+ $phpath = $a->config['php_path'];
+else
+ $phpath = 'php';
- echo "Directory: mod\n";
- $files = glob('mod/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+echo "Directory: mod\n";
+$files = glob('mod/*.php');
+foreach($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
- echo "Directory: include\n";
- $files = glob('include/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+echo "Directory: include\n";
+$files = glob('include/*.php');
+foreach($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
- echo "Directory: object\n";
- $files = glob('object/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+echo "Directory: object\n";
+$files = glob('object/*.php');
+foreach($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
- echo "Directory: addon\n";
- $dirs = glob('addon/*');
+echo "Directory: addon\n";
+$dirs = glob('addon/*');
- foreach($dirs as $dir) {
- $addon = basename($dir);
- $files = glob($dir . '/' . $addon . '.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+foreach($dirs as $dir) {
+ $addon = basename($dir);
+ $files = glob($dir . '/' . $addon . '.php');
+ foreach($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
}
+}
- echo "String files\n";
+echo "String files\n";
- echo 'util/strings.php' . "\n";
- passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
+echo 'util/strings.php' . "\n";
+passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
- $files = glob('view/lang/*/strings.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+$files = glob('view/lang/*/strings.php');
+foreach($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
<?php
+
/**
* Theme settings
*/
<script>var frio="<?php echo "view/theme/frio"; ?>";</script>
<?php $baseurl = App::get_baseurl(); ?>
<?php $frio = "view/theme/frio"; ?>
- <?php
+ <?php
// Because we use minimal for modals the header and the included js stuff should be only loaded
// if the page is an standard page (so we don't have it twice for modals)
- //
+ //
/// @todo Think about to move js stuff in the footer
if(!$minimal) {
if(x($page,'htmlhead')) echo $page['htmlhead'];
/**
* @file view/theme/frio/php/frio_boot.php
*
- * @brief This file contains functions for page contstruction
+ * @brief This file contains functions for page construction
*
*/
<?php
+
/**
* Theme settings
*/
$cssFile = null;
$ssl_state = null;
$baseurl = App::get_baseurl($ssl_state);
-$a->page['htmlhead'] .= <<< EOT
+ $a->page['htmlhead'] .= <<< EOT
<script>
function insertFormatting(BBcode, id) {
</script>
EOT;
- /** custom css **/
+ /** custom css **/
if (!is_null($cssFile)) {
$a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
}
-_js_in_foot();
-
+ _js_in_foot();
}
if (! function_exists('_js_in_foot')) {