function run($action = null, $command = null, $data = null) { if (is_null($action) && is_null($command) && is_null($data)) { if (run('input', 'get', 'action') == 'api') { return run('api', 'handle'); } else { return run('web', 'serve'); } } $function = "\\" . $action . "\\" . $command; if (!function_exists($function)) { if (is_file('../app/' . $action . '.php')) { require '../app/' . $action . '.php'; } else { \app\log('Undefined action ' . $action); die('Undefined action ' . $action); } } if (function_exists($function)) { if (!is_array($data)) { $data = array($data); } return call_user_func_array($function, $data); } else { \app\log('Undefined command ' . $function); die('Undefined command ' . $function); } }
public function testRun() { $result = run(2, function ($q, $r) { return disjPlus(eq($q, 2), eq($q, 3), eq($q, 4)); }); $this->assertEquals('(2 . (3))', sprintf('%s', $result)); }
function friend_pagesetup() { // register links -- global $profile_id; global $PAGE; global $CFG; $page_owner = $profile_id; if (isloggedin()) { if (defined("context") && context == "network" && $page_owner == $_SESSION['userid']) { $PAGE->menu[] = array('name' => 'network', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" class=\"selected\" >" . gettext("Your Network") . '</a></li>'); } else { $PAGE->menu[] = array('name' => 'network', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" >" . gettext("Your Network") . '</a></li>'); } } if (defined("context") && context == "network") { if (run("users:type:get", $page_owner) == "person") { $friends_username = run("users:id_to_name", $page_owner); $PAGE->menu_sub[] = array('name' => 'friend', 'html' => a_hrefg("{$CFG->wwwroot}{$friends_username}/friends/", gettext("Friends"))); $PAGE->menu_sub[] = array('name' => 'friend:of', 'html' => a_hrefg("{$CFG->wwwroot}_friends/friendsof.php?owner={$page_owner}", gettext("Friend of"))); $PAGE->menu_sub[] = array('name' => 'friend:requests', 'html' => a_hrefg("{$CFG->wwwroot}_friends/requests.php?owner={$page_owner}", gettext("Friendship requests"))); if ($CFG->foaf_enabled) { $PAGE->menu_sub[] = array('name' => 'friend:foaf', 'html' => a_hrefg("{$CFG->wwwroot}{$friends_username}/foaf/", gettext("FOAF"))); } if (isloggedin()) { $PAGE->menu_sub[] = array('name' => 'friend:accesscontrols', 'html' => a_hrefg("{$CFG->wwwroot}_groups/", gettext("Access controls"))); if ($CFG->publicinvite == true) { $PAGE->menu_sub[] = array('name' => 'friend:invite', 'html' => a_hrefg("{$CFG->wwwroot}_invite/", gettext("Invite a friend"))); } $PAGE->menu_sub[] = array('name' => 'friend:help', 'html' => a_hrefg("{$CFG->wwwroot}help/network_help.php", gettext("Page help"))); } } } }
function ownedusers_pagesetup() { // register links -- global $profile_id; global $PAGE; global $CFG; global $USER; $page_owner = $profile_id; if ($CFG->owned_users) { if (defined("context") && context == "network") { if (run("users:type:get", $page_owner) == "person") { $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . '_ownedusers/owned.php?owner=' . $page_owner . '">' . gettext("Owned " . $CFG->owned_users_caption) . '</a>'); } } if (defined("context") && context == "weblog") { if (run("users:type:get", $page_owner) == "person") { if ($result = get_records_select('users', "owner = ? AND user_type = ?", array($page_owner, 'person'))) { $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . $USER->username . '/weblog/ownedusers/' . '">' . gettext($CFG->owned_users_caption . "' blogs") . '</a>'); } } } if (defined("context") && context == "profile" && logged_on && !run("users:flags:get", array("admin", $USER->ident))) { if ($result = get_records_select('users', "ident = ? and owner = ? AND user_type = ?", array($page_owner, $USER->ident, 'person'))) { $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $page_owner . '">' . gettext("Edit this profile") . '</a>'); if (run("permissions:check", "profile")) { $PAGE->menu_sub[] = array('name' => 'owneduser:pic', 'html' => a_hrefg("{$CFG->wwwroot}_icons/?context=profile&profile_id={$page_owner}", gettext("Change site picture"))); $PAGE->menu_sub[] = array('name' => 'profile:help', 'html' => '<a href="' . $CFG->wwwroot . 'help/profile_help.php">' . gettext("Page help") . '</a>'); } } } } }
function community_pagesetup() { // register links -- global $profile_id; global $PAGE; global $CFG; $page_owner = $profile_id; $usertype = run("users:type:get", $page_owner); if ($usertype == "community") { if (defined("context") && context == "profile") { if (run("permissions:check", "profile")) { $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $page_owner . '">' . gettext("Edit this profile") . '</a>'); $PAGE->menu_sub[] = array('name' => 'community:pic', 'html' => a_hrefg("{$CFG->wwwroot}_icons/?context=profile&profile_id={$page_owner}", gettext("Community site picture"))); $PAGE->menu_sub[] = array('name' => 'community:edit', 'html' => a_hrefg("{$CFG->wwwroot}_userdetails/?context=profile&profile_id={$page_owner}", gettext("Edit community details"))); } } if (defined("context") && (context == "profile" || context == "network")) { $PAGE->menu_sub[] = array('name' => 'community:requests', 'html' => a_hrefg("{$CFG->wwwroot}_communities/requests.php?profile_id={$page_owner}", gettext("View membership requests"))); } /*$PAGE->menu_sub[] = array( 'name' => 'community:members', 'html' => a_hrefg("{$CFG->wwwroot}_communities/members.php?owner=$page_owner" , gettext("Community Members")));*/ } else { if ($usertype == "person") { if (defined("context") && context == "network") { $PAGE->menu_sub[] = array('name' => 'community', 'html' => a_hrefg("{$CFG->wwwroot}_communities/?owner={$page_owner}", gettext("Communities"))); $PAGE->menu_sub[] = array('name' => 'community:owned', 'html' => a_hrefg("{$CFG->wwwroot}_communities/owned.php?owner={$page_owner}", gettext("Owned Communities"))); } } } }
function run(&$vector, $esquerda, $direita, &$quick_trocas = 0) { $esq = $esquerda; $dir = $direita; $pivot = $vector[intval(($esq + $dir) / 2)]; $troca = 0; while ($esq <= $dir) { while ($vector[$esq] < $pivot) { $esq++; } while ($vector[$dir] > $pivot) { $dir--; } if ($esq <= $dir) { $troca = $vector[$esq]; $vector[$esq] = $vector[$dir]; $vector[$dir] = $troca; $esq++; $dir--; ++$quick_trocas; } } if ($dir > $esquerda) { run($vector, $esquerda, $dir, $quick_trocas); } if ($esq < $direita) { run($vector, $esq, $direita, $quick_trocas); } return $quick_trocas; }
function check() { $EnablePhileSight = GET_INFO_DAEMON("EnablePhileSight"); if ($EnablePhileSight == null) { $EnablePhileSight = 0; } if ($EnablePhileSight == 0) { writelogs("feature disabled, aborting...", __FUNCTION__, __FILE__, __LINE__); die; } if (system_is_overloaded()) { writelogs("System overloaded, aborting this feature for the moment", __FUNCTION__, __FILE__, __LINE__); die; } @mkdir("/opt/artica/philesight"); $unix = new unix(); $min = $unix->file_time_min("/opt/artica/philesight/database.db"); $sock = new sockets(); $rr = $sock->GET_INFO("PhileSizeRefreshEach"); if ($rr == null) { $rr = 120; } if ($rr == "disable") { die; } writelogs("/opt/artica/philesight/database.db = {$min} minutes, {$rr} minutes to run", __FUNCTION__, __FILE__, __LINE__); if ($min >= $rr) { run(); } }
function adminuser($lang, $arglist = false) { if (!user_has_role('administrator')) { return run('error/unauthorized', $lang); } $user_id = false; if (is_array($arglist)) { if (isset($arglist[0])) { $user_id = $arglist[0]; } } if (!$user_id) { return run('error/notfound', $lang); } $user_id = user_id($user_id); if (!$user_id) { return run('error/notfound', $lang); } $useredit = build('useredit', $lang, $user_id); if ($useredit === false) { return redirect('admin', $lang); } head('title', translate('admin:title', $lang)); head('description', false); head('keywords', false); head('robots', 'noindex, nofollow'); $admin = true; $banner = build('banner', $lang, compact('admin')); $content = view('adminuser', $lang, compact('useredit')); $output = layout('standard', compact('banner', 'content')); return $output; }
function threadall($lang) { global $system_languages, $with_toolbar; if (!user_has_role('writer')) { return run('error/unauthorized', $lang); } $slang = false; if (isset($_GET['slang'])) { $slang = $_GET['slang']; } else { $slang = $lang; } if (!in_array($slang, $system_languages)) { return run('error/notfound', $lang); } $site_title = translate('title', $lang); $site_abstract = translate('description', $lang); $site_cloud = translate('keywords', $lang); head('title', translate('threadall:title', $slang)); head('description', false); head('keywords', false); head('robots', 'noindex, nofollow'); $edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '?' . 'clang=' . $lang : false; $banner = build('banner', $lang, $with_toolbar ? false : compact('edit')); $scroll = true; $toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false; $threadlist = build('threadlist', $lang, false, false, $slang); $content = view('threadall', $slang, compact('site_title', 'site_abstract', 'site_cloud', 'threadlist')); $output = layout('viewing', compact('toolbar', 'banner', 'content')); return $output; }
function captcha($lang, $arglist = false) { $id = false; if (is_array($arglist)) { if (isset($arglist[0])) { $id = $arglist[0]; } } $accepted = array('login', 'register', 'remindme', 'mailme', 'subscribe', 'unsubscribe', 'comment'); if ($id and !in_array($id, $accepted)) { return run('error/badrequest', $lang); } $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $code = strrand($charset, 4); if ($id) { $_SESSION['captcha'][$id] = $code; } $img = strtag($code); header('Content-Type: image/png'); header("Content-Disposition: inline; filename=captcha.png"); header("Cache-Control: no-cache"); imagepng($img); imagedestroy($img); return false; }
function avatar($lang, $arglist = false) { $name = false; $size = 128; if (is_array($arglist)) { if (isset($arglist[0])) { $name = $arglist[0]; } else { if (isset($arglist['name'])) { $name = $arglist['name']; } } if (isset($arglist[1])) { $size = $arglist[1]; } else { if (isset($arglist['size'])) { $size = $arglist['size']; } } } if (!$name or !$size or !is_numeric($size) or $size < 16 or $size > 200) { return run('error/badrequest', $lang); } $img = identicon($name, $size); header('Content-Type: image/png'); header("Content-Disposition: inline; filename={$name}"); imagepng($img); imagedestroy($img); return false; }
function editpage($lang, $arglist = false) { global $default_folder; $folder = $page = false; if (is_array($arglist)) { if (isset($arglist[1])) { $folder = $arglist[0]; $page = $arglist[1]; } else { if (isset($arglist[0])) { $folder = $default_folder; $page = $arglist[0]; } } } if (!$folder or !$page) { return run('error/notfound', $lang); } foreach (is_array($folder) ? $folder : array($folder) as $folder) { $folder_id = thread_id($folder); if ($folder_id) { $page_id = thread_node_id($folder_id, $page, $lang); if ($page_id) { break; } } } if (!$folder_id or !$page_id) { return run('error/notfound', $lang); } require_once 'actions/folderedit.php'; return folderedit($lang, array($folder_id, $page_id)); }
function user($lang, $arglist = false) { global $login_verified, $base_url; $login = build('login', $lang); if ($login === true) { $r = !empty($arglist['r']) ? $arglist['r'] : false; if ($login_verified and array_intersect($login_verified, user_profile('role'))) { $user = $_SESSION['user']; unset($_SESSION['user']); if (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') { return run('error/unauthorized', $lang); } $_SESSION['unverified_user'] = $user; $next_page = url('sslverifyclient'); if ($r) { $next_page .= '?r=' . $r; } } else { $next_page = $r ? $r : url('home', $lang); } return reload($base_url . $next_page); } $banner = build('banner', $lang); $content = view('user', $lang, compact('login')); head('title', translate('user:title', $lang)); head('description', false); head('keywords', false); head('robots', 'noindex, nofollow'); $output = layout('standard', compact('banner', 'content')); return $output; }
function blog_pagesetup() { // register links -- global $profile_id; global $PAGE; global $CFG; $page_owner = $profile_id; // main menu if (isloggedin()) { if (defined("context") && context == "weblog" && $page_owner == $_SESSION['userid']) { $PAGE->menu[] = array('name' => 'blog', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/weblog\" class=\"selected\" >" . gettext("Your Blog") . '</a></li>'); } else { $PAGE->menu[] = array('name' => 'blog', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/weblog\" >" . gettext("Your Blog") . '</a></li>'); } } $weblog_username = run("users:id_to_name", $page_owner); // submenu if (defined("context") && context == "weblog") { if ($page_owner != -1) { $PAGE->menu_sub[] = array('name' => 'blog:rssfeed', 'html' => "<a href=\"{$CFG->wwwroot}{$weblog_username}/weblog/rss/\"><img src=\"{$CFG->wwwroot}_templates/icons/rss.png\" border=\"0\" alt=\"rss\" /></a>"); if (run("permissions:check", "weblog") && logged_on) { $PAGE->menu_sub[] = array('name' => 'blog:post', 'html' => "<a href=\"{$CFG->wwwroot}_weblog/edit.php?owner={$page_owner}\">" . gettext("Post a new entry") . '</a>'); } $PAGE->menu_sub[] = array('name' => 'blog:view', 'html' => "<a href=\"{$CFG->wwwroot}{$weblog_username}/weblog/\">" . gettext("View blog") . '</a>'); $PAGE->menu_sub[] = array('name' => 'blog:archive', 'html' => "<a href=\"{$CFG->wwwroot}{$weblog_username}/weblog/archive/\">" . gettext("Archive") . '</a>'); $PAGE->menu_sub[] = array('name' => 'blog:friends', 'html' => "<a href=\"{$CFG->wwwroot}{$weblog_username}/weblog/friends/\">" . gettext("Friends' blogs") . '</a>'); } $PAGE->menu_sub[] = array('name' => 'blog:everyone', 'html' => "<a href=\"{$CFG->wwwroot}_weblog/everyone.php\">" . gettext("View all posts") . '</a>'); if (logged_on) { $PAGE->menu_sub[] = array('name' => 'blog:help', 'html' => "<a href=\"{$CFG->wwwroot}help/blogs_help.php\">" . gettext("Page help") . '</a>'); } } }
function start_realplexor() { global $REALPLEXOR_CONF, $OUT_TMP, $OUT_TMP_FH; kill_realplexor(); $OUT_TMP = tempnam('non-existent', ''); if (pcntl_fork() == 0) { $filter = ' $| = 1; s/\\s*\\[\\w\\w\\w\\s.*?\\]\\s*//sg; s/\\s*Opened files limit.*//mg; s/\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+:\\s*//sg; s/\\d+( bytes)/<N>$1/s; s/(appending configuration from ).*/$1***/mg; s/(\\[)\\d+\\.\\d+/$1*/sg; s/(events=)\\d+/$1*/sg; s/^/# /sg; if ($del) { $_ = ""; $del--; } '; $args = ''; if ($REALPLEXOR_CONF) { $args = escapeshellarg(dirname(__FILE__) . '/fixture/' . $REALPLEXOR_CONF); } run("cd ../.. && perl dklab_realplexor.pl {$args} | tee -a {$OUT_TMP} " . "| perl -pe " . escapeshellarg($filter) . ($GLOBALS['VERBOSE'] ? "" : " | tail -n1")); exit; } expect('/listening 127.0.0.1/'); }
function threadsummary($lang, $thread) { global $system_languages, $with_toolbar; if (!user_has_role('writer')) { return run('error/unauthorized', $lang); } $slang = false; if (isset($_GET['slang'])) { $slang = $_GET['slang']; } else { $slang = $lang; } if (!in_array($slang, $system_languages)) { return run('error/notfound', $lang); } $thread_id = thread_id($thread); if (!$thread_id) { return run('error/notfound', $lang); } $r = thread_get($lang, $thread_id); if (!$r) { return run('error/notfound', $lang); } extract($r); /* thread_name thread_title thread_type thread_abstract thread_cloud thread_image thread_visits thread_nosearch thread_nocloud thread_nocomment thread_nomorecomment thread_novote thread_nomorevote thread_created thread_modified */ $thread_search = !$thread_nosearch; $thread_tag = !$thread_nocloud; $thread_comment = !$thread_nocomment; $thread_morecomment = !$thread_nomorecomment; $thread_vote = !$thread_novote; $thread_morevote = !$thread_nomorevote; $thread_contents = array(); $r = thread_get_contents($lang, $thread_id, false); if ($r) { $thread_url = url('thread', $lang) . '/' . $thread_id; foreach ($r as $c) { extract($c); /* node_id node_name node_title node_number node_ignored */ $node_url = $thread_url . '/' . $node_id . '?' . 'slang=' . $slang; $thread_contents[] = compact('node_id', 'node_title', 'node_url', 'node_ignored'); } } $headline_text = translate('threadall:title', $slang); $headline_url = url('thread', $lang) . '?' . 'slang=' . $slang; $headline = compact('headline_text', 'headline_url'); $title = view('headline', false, $headline); $sidebar = view('sidebar', false, compact('title')); head('title', $thread_title ? $thread_title : $thread_id); head('description', $thread_abstract); head('keywords', $thread_cloud); head('robots', 'noindex, nofollow'); $edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '/' . $thread_id . '?' . 'clang=' . $lang : false; $banner = build('banner', $lang, $with_toolbar ? compact('headline') : compact('headline', 'edit')); $scroll = true; $toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false; $content = view('threadsummary', $slang, compact('thread_id', 'thread_title', 'thread_abstract', 'thread_cloud', 'thread_image', 'thread_visits', 'thread_search', 'thread_tag', 'thread_comment', 'thread_morecomment', 'thread_vote', 'thread_morevote', 'thread_ilike', 'thread_tweet', 'thread_plusone', 'thread_linkedin', 'thread_pinit', 'thread_created', 'thread_modified', 'thread_contents')); $output = layout('viewing', compact('toolbar', 'banner', 'content', 'sidebar')); return $output; }
function qrcode($lang, $arglist = false) { $s = false; $size = 1; $margin = 0; $fg = $bg = false; $quality = 'M'; $token = false; $qs = array('L', 'M', 'Q', 'H'); $with_token = false; if (is_array($arglist)) { if (isset($arglist['s'])) { $s = $arglist['s']; } if (isset($arglist['fg'])) { $fg = $arglist['fg']; } if (isset($arglist['bg'])) { $bg = $arglist['bg']; } if (isset($arglist['quality'])) { $quality = $arglist['quality']; } if (isset($arglist['size'])) { $size = $arglist['size']; } if (isset($arglist['margin'])) { $margin = $arglist['margin']; } if ($with_token) { if (isset($arglist['token'])) { $token = $arglist['token']; } } } if ($with_token) { if (!isset($_SESSION['qrcode_token']) or $token != $_SESSION['qrcode_token']) { return run('error/badrequest', $lang); } unset($_SESSION['qrcode_token']); } if (!$s or !is_numeric($size) or !is_numeric($margin) or !$quality or !in_array($quality, $qs) or $fg and !validate_color($fg) or $bg and !validate_color($bg)) { return run('error/badrequest', $lang); } if ($size < 1) { $size = 1; } if ($margin < 0) { $margin = 0; } $png = qrencode($s, $size, $quality, $fg, $bg, $margin); if (!$png) { return run('error/internalerror', $lang); } header('Content-Type: image/png'); header("Content-Disposition: inline; filename=qr.png"); echo $png; return false; }
function profile_permissions_check($object) { global $page_owner; if ($object === "profile" && ($page_owner == $_SESSION['userid'] || run("users:flags:get", array("admin", $_SESSION['userid'])))) { return true; } return false; }
/** * scope. * * @param string $test * @param string|null $config * * @return int */ public static function scope($test, $config = null) { if ($config) { require $config; } require $test; return run(); }
function routes($url) { $first = array_kshift($url); foreach ($first as $key => $value) { $url[$key] = $value; } run($url); }
function protect($level, $owner = -1) { if (accesslevel($owner) < $level) { run("access_denied"); // run("display:bottomofpage"); exit; } }
function add($i) { if ($i < 1) { return $i; } else { run(); return $i + add($i - 1); } }
function add_remote($username, $repository, $pushable = false) { $url = get_repository_url($username, $repository, false); run("git remote add {$username} {$url}", true); if ($pushable) { $ssh_url = get_repository_url($username, $repository, true); run("git remote set-url --push {$username} {$ssh_url}"); } }
function checkFile($xmlFileName) { $root = realpath(__DIR__ . "/.."); $path = realpath("{$root}/logs/{$xmlFileName}"); if ($path === false || !file_exists($path)) { return "Not found {$xmlFileName}"; } return run($path); }
function paypalreturn($lang, $arglist = false) { if (!isset($_SESSION['paypal'])) { return run('error/badrequest', $lang); } $token = $_SESSION['paypal']['token']; $amt = $_SESSION['paypal']['amt']; $itemamt = $_SESSION['paypal']['itemamt']; $taxamt = $_SESSION['paypal']['taxamt']; $currencycode = $_SESSION['paypal']['currencycode']; $context = $_SESSION['paypal']['context']; unset($_SESSION['paypal']); if (!isset($arglist['token']) or $arglist['token'] != $token) { return run('error/badrequest', $lang); } $params = array('TOKEN' => $token); $r = paypal_getexpresscheckoutdetails($params); if (!$r) { return run('error/internalerror', $lang); } if ($r['TOKEN'] != $token or $r['PAYMENTREQUEST_0_AMT'] != $amt or $r['PAYMENTREQUEST_0_ITEMAMT'] != $itemamt or $r['PAYMENTREQUEST_0_TAXAMT'] != $taxamt or $r['PAYMENTREQUEST_0_CURRENCYCODE'] != $currencycode) { return run('error/internalerror', $lang); } $payerid = $r['PAYERID']; $email = $r['EMAIL']; $params = array('TOKEN' => $token, 'PAYERID' => $payerid, 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_CURRENCYCODE' => $currencycode, 'PAYMENTREQUEST_0_AMT' => $amt, 'PAYMENTREQUEST_0_ITEMAMT' => $itemamt, 'PAYMENTREQUEST_0_TAXAMT' => $taxamt); $r = paypal_doexpresscheckoutpayment($params); if (!$r) { return run('error/internalerror', $lang); } if ($r['TOKEN'] != $token or $r['PAYMENTINFO_0_AMT'] != $amt or $r['PAYMENTINFO_0_TAXAMT'] != $taxamt or $r['PAYMENTINFO_0_CURRENCYCODE'] != $currencycode) { return run('error/internalerror', $lang); } $transactionid = $r['PAYMENTINFO_0_TRANSACTIONID']; $paymentstatus = strtoupper($r['PAYMENTINFO_0_PAYMENTSTATUS']); $completed = false; switch ($paymentstatus) { case 'COMPLETED': $feeamt = $r['PAYMENTINFO_0_FEEAMT']; $completed = true; break; case 'PENDING': $pendingreason = strtoupper($r['PAYMENTINFO_0_PENDINGREASON']); break; default: break; } if (!$completed) { require_once 'actions/paymentrejected.php'; $output = paymentrejected($lang, $amt, $currencycode, $context); } else { require_once 'actions/paymentaccepted.php'; $output = paymentaccepted($lang, $amt, $currencycode, $context); } return $output; }
/** * Starts Limonade framework routing */ public static function start() { function server_error($errno, $errstr, $errfile = null, $errline = null) { $args = compact('errno', 'errstr', 'errfile', 'errline'); var_dump(error_layout()); var_dump($args); } run(); }
function register_user($nama, $pass) { $nama = escape($nama); $pass = escape($pass); //fungsi HASH //md5 akan mengconvert enkripsi isi pass menjadi string yang acak $pass = md5($pass); $query = "INSERT INTO users (username, password, status) VALUES ('{$nama}','{$pass}', 0)"; return run($query); }
function editnode($lang, $arglist = false) { global $supported_languages, $supported_contents, $with_toolbar; if (!user_has_role('writer')) { return run('error/unauthorized', $lang); } $node = false; if (is_array($arglist)) { if (isset($arglist[0])) { $node = $arglist[0]; } } if (!$node) { return run('error/notfound', $lang); } $node_id = node_id($node); if (!$node_id) { return run('error/notfound', $lang); } $clang = false; foreach ($supported_languages as $slang) { if (isset($_POST[$slang])) { $clang = $slang; break; } } if (!$clang) { if (isset($_POST['clang'])) { $clang = $_POST['clang']; } else { if (isset($_GET['clang'])) { $clang = $_GET['clang']; } else { $clang = $lang; } } if (!in_array($clang, $supported_languages)) { return run('error/notfound', $lang); } } $node_editor = build('nodeeditor', $lang, $clang, $node_id, $supported_contents); head('title', $node_id); head('description', false); head('keywords', false); head('robots', 'noindex, nofollow'); $view = url('node', $clang) . '/' . $node_id . '?' . 'slang=' . $lang; $banner = build('banner', $lang, $with_toolbar ? false : compact('view')); $scroll = true; $toolbar = $with_toolbar ? build('toolbar', $lang, compact('view', 'scroll')) : false; $content = view('editing/editnode', $lang, compact('node_editor')); $output = layout('editing', compact('toolbar', 'banner', 'content')); return $output; }
function foldersummary($lang, $folder) { global $with_toolbar; $folder_id = thread_id($folder); if (!$folder_id) { return run('error/notfound', $lang); } $r = thread_get($lang, $folder_id); if (!$r) { return run('error/notfound', $lang); } extract($r); /* thread_type thread_name thread_title thread_abstract thread_cloud */ if ($thread_type != 'folder') { return run('error/notfound', $lang); } $folder_name = $thread_name; $folder_title = $thread_title; $folder_abstract = $thread_abstract; $folder_cloud = $thread_cloud; if ($folder_title) { head('title', $folder_title); } if ($folder_abstract) { head('description', $folder_abstract); } if ($folder_cloud) { head('keywords', $folder_cloud); } $folder_contents = array(); $r = thread_get_contents($lang, $folder_id); if ($r) { $folder_url = url('folder', $lang) . '/' . $folder_name; foreach ($r as $c) { extract($c); /* node_name node_title */ if (!$node_title) { continue; } $page_title = $node_title; $page_url = $folder_url . '/' . $node_name; $folder_contents[] = compact('page_title', 'page_url'); } } $content = view('foldersummary', false, compact('folder_id', 'folder_title', 'folder_contents')); $edit = user_has_role('writer') ? url('folderedit', $_SESSION['user']['locale']) . '/' . $folder_id . '?' . 'clang=' . $lang : false; $validate = url('folder', $lang) . '/' . $folder_name; $banner = build('banner', $lang, $with_toolbar ? false : compact('edit', 'validate')); $toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'validate')) : false; $output = layout('standard', compact('toolbar', 'banner', 'content')); return $output; }
protected function loadRecipe() { require __DIR__ . '/../../recipe/common.php'; task('deploy:timeout_test', function () { $this->result = run('sleep 11 && echo $SSH_CLIENT'); }); task('deploy:ssh_test', function () { $this->result = run('echo $SSH_CLIENT'); }); task('deploy:agent_test', function () { $this->result = run('ssh -T deployer@localhost \'echo $SSH_CLIENT\''); }); }