Beispiel #1
0
function homepage($lang)
{
    global $sitename, $siteshot;
    $page_contents = build('content', $lang, 'homepage');
    $besocial = $sharebar = false;
    $ilike = true;
    $tweetit = true;
    $plusone = true;
    $linkedin = true;
    $pinit = true;
    if ($tweetit or $pinit) {
        $description = translate('description', $lang);
        if ($tweetit) {
            $tweet_text = $description ? $description : $sitename;
            $tweetit = $tweet_text ? compact('tweet_text') : true;
        }
        if ($pinit) {
            $pinit_text = $description ? $description : $sitename;
            $pinit_image = $siteshot;
            $pinit = $pinit_text && $pinit_image ? compact('pinit_text', 'pinit_image') : false;
        }
    }
    list($besocial, $sharebar) = socialize($lang, compact('ilike', 'tweetit', 'plusone', 'linkedin', 'pinit'));
    $content = view('anypage', false, compact('page_contents', 'besocial'));
    head('title', $sitename);
    $languages = 'homepage';
    $contact = true;
    $banner = build('banner', $lang, compact('languages', 'contact'));
    $languages = false;
    $contact = false;
    $footer = build('footer', $lang, compact('languages', 'contact'));
    $output = layout('standard', compact('sharebar', 'banner', 'footer', 'content'));
    return $output;
}
Beispiel #2
0
 public function __construct($authKeys = array())
 {
     $opts = array("headers" => array("User-Agent" => "twitter-wrapi"), "query" => array("stringify_ids" => "true"), 'auth' => 'oauth');
     $handler = HandlerStack::create();
     $handler->push(new Oauth1($authKeys));
     function build(&$obj, $prefix, $apiList)
     {
         $path = $prefix;
         if ($prefix !== '') {
             $path .= '/';
         }
         foreach ($apiList as $name) {
             $json = file_get_contents(__DIR__ . '/api/' . $path . $name . '.json');
             $endpoint = json_decode($json, true);
             $pre = $prefix === '' ? $name : $prefix . '.' . $name;
             foreach ($endpoint as $sub => $ep) {
                 $obj[$pre . '.' . $sub] = $ep;
             }
         }
     }
     $all = [];
     build($all, '', ['statuses', 'media', 'direct_messages', 'search', 'friendships', 'friends', 'followers', 'account', 'blocks', 'users', 'favorites', 'lists', 'saved_searches', 'geo', 'trends', 'application', 'help']);
     build($all, 'users', ['suggestions']);
     build($all, 'lists', ['members', 'subscribers']);
     parent::__construct('https://api.twitter.com/1.1/', $all, $opts, ['handler' => $handler]);
 }
Beispiel #3
0
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;
}
Beispiel #4
0
function build($directory)
{
    $menu = "";
    $pages = "";
    foreach (glob("{$directory}/*", GLOB_MARK) as $f) {
        $find = array(".html", ".md", ".php", " ");
        $replace = array("", "", "", "-");
        $spaces = array("_", "-");
        $nice_name = str_replace($find, $replace, basename($f));
        $cap_name = ucwords(strtolower(str_replace($spaces, " ", $nice_name)));
        if (substr($f, -1) === '/') {
            $content = build($f);
            $pages .= $content[1];
            $menu .= "<li>\n\t\t\t\t\t<span data-menu='submenu'><i class='fa fa-plus-circle'></i> <span>{$cap_name}</span></span>\n\t\t\t\t\t<ul>";
            $menu .= $content[0];
            $menu .= "</ul></li>";
        } else {
            if ($cap_name != "Main") {
                $pages .= "<section class='doc' data-doc='{$nice_name}'>";
                $menu .= "<li data-show='{$nice_name}'> {$cap_name}</li>";
                if (end(explode('.', basename($f))) == "md") {
                    $Parsedown = new Parsedown();
                    $pages .= $Parsedown->text(file_get_contents($f));
                } else {
                    $pages .= file_get_contents($f);
                }
                $pages .= "</section>";
            }
        }
    }
    return [$menu, $pages];
}
Beispiel #5
0
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;
}
Beispiel #6
0
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;
}
Beispiel #7
0
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;
}
 private static function init()
 {
     load_functions();
     if (!build()) {
         die('build directories error');
     }
     safe();
 }
Beispiel #9
0
function build($tree, &$seqs)
{
    if (gettype($tree) == 'array') {
        $tree[0] = build($tree[0], $seqs);
        $tree[1] = build($tree[1], $seqs);
    } else {
        $tree = strtoupper(array_shift($seqs));
    }
    return $tree;
}
Beispiel #10
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    3
 * @link       http://www.izend.org
 */
function paymentaccepted($lang, $amount, $currency, $context)
{
    head('title', translate('payment_accepted:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = true;
    $banner = build('banner', $lang, compact('contact'));
    $content = view('paymentaccepted', $lang, compact('amount', 'currency'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #11
0
function main()
{
    $arr = build();
    r(isset($arr["A"]));
    r(isset($arr["AX"]));
    r(isset($arr["B"]["A"]));
    r(isset($arr["X"]["A"]));
    r(isset($arr["B"]["X"]));
    r(isset($arr["X"]["X"]));
    r(isset($arr["X"]["X"]["X"]));
}
Beispiel #12
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    2
 * @link       http://www.izend.org
 */
function unauthorized($lang)
{
    head('title', translate('http_unauthorized:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = $account = true;
    $banner = build('banner', $lang, compact('contact', 'account'));
    $contact_page = url('contact', $lang);
    $content = view('error/unauthorized', $lang, compact('contact_page'));
    $output = layout('standard', compact('banner', 'content'));
    header('HTTP/1.1 401 Unauthorized');
    return $output;
}
Beispiel #13
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function serviceunavailable($lang, $arglist)
{
    head('title', translate('http_service_unavailable:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = false;
    $banner = build('banner', $lang, compact('contact'));
    list($closing_time, $opening_time) = $arglist;
    $content = view('error/serviceunavailable', $lang, compact('closing_time', 'opening_time'));
    $output = layout('standard', compact('banner', 'content'));
    header('HTTP/1.1 503 Service Unavailable');
    return $output;
}
Beispiel #14
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function badrequest($lang)
{
    head('title', translate('http_bad_request:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = true;
    $banner = build('banner', $lang, compact('contact'));
    $contact_page = url('contact', $lang);
    $content = view('error/badrequest', $lang, compact('contact_page'));
    $output = layout('standard', compact('banner', 'content'));
    header('HTTP/1.1 400 Bad Request');
    return $output;
}
Beispiel #15
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function internalerror($lang)
{
    head('title', translate('http_internal_error:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = true;
    $banner = build('banner', $lang, compact('contact'));
    $contact_page = url('contact', $lang);
    $content = view('error/internalerror', $lang, compact('contact_page'));
    $output = layout('standard', compact('banner', 'content'));
    header('HTTP/1.1 500 Internal Error');
    return $output;
}
Beispiel #16
0
/**
 *
 * @copyright  2012-2013 izend.org
 * @version    2
 * @link       http://www.izend.org
 */
function newslettersubscribe($lang)
{
    head('title', translate('newsletter:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $banner = build('banner', $lang);
    $subscribe = build('subscribe', $lang);
    $content = view('newslettersubscribe', $lang, compact('subscribe'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #17
0
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;
}
Beispiel #18
0
/**
 *
 * @copyright  2010-2011 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function password($lang)
{
    head('title', translate('password:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $banner = build('banner', $lang);
    $remindme = build('remindme', $lang);
    $content = view('password', $lang, compact('remindme'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #19
0
/**
 *
 * @copyright  2010-2012 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function notfound($lang)
{
    head('title', translate('http_not_found:title', $lang));
    head('robots', 'noindex, nofollow');
    $contact = true;
    $banner = build('banner', $lang, compact('contact'));
    $contact_page = url('contact', $lang);
    $content = view('error/notfound', $lang, compact('contact_page'));
    $output = layout('standard', compact('banner', 'content'));
    header('HTTP/1.1 404 Not Found');
    return $output;
}
Beispiel #20
0
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;
}
Beispiel #21
0
function bookall($lang)
{
    global $with_toolbar;
    head('title', translate('bookall:title', $lang));
    $edit = user_has_role('writer') ? url('bookedit', $_SESSION['user']['locale']) . '?' . 'clang=' . $lang : false;
    $validate = url('book', $lang);
    $banner = build('banner', $lang, $with_toolbar ? false : compact('edit', 'validate'));
    $toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'validate')) : false;
    $booklist = build('threadlist', $lang, 'book');
    $content = view('bookall', $lang, compact('booklist'));
    $output = layout('standard', compact('toolbar', 'banner', 'content'));
    return $output;
}
Beispiel #22
0
function node($lang, $arglist = false)
{
    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);
    }
    $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);
    }
    $r = node_get($lang, $node_id);
    if (!$r) {
        return run('error/notfound', $lang);
    }
    extract($r);
    /* node_number node_ignored node_name node_title node_abstract node_cloud node_image node_visits node_nocomment node_nomorecomment node_ilike node_tweet node_plusone node_linkedin node_pinit */
    $node_comment = !$node_nocomment;
    $node_morecomment = !$node_nomorecomment;
    $node_vote = !$node_novote;
    $node_morevote = !$node_nomorevote;
    head('title', $node_id);
    head('description', $node_abstract);
    head('keywords', $node_cloud);
    head('robots', 'noindex, nofollow');
    $edit = user_has_role('writer') ? url('editnode', $_SESSION['user']['locale']) . '/' . $node_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;
    $node_contents = build('nodecontent', $lang, $node_id);
    $content = view('node', $slang, compact('node_id', 'node_name', 'node_title', 'node_abstract', 'node_cloud', 'node_image', 'node_created', 'node_modified', 'node_comment', 'node_morecomment', 'node_vote', 'node_morevote', 'node_ilike', 'node_tweet', 'node_plusone', 'node_linkedin', 'node_pinit', 'node_contents'));
    $output = layout('standard', compact('toolbar', 'banner', 'content'));
    return $output;
}
Beispiel #23
0
/**
 *
 * @copyright  2010-2011 izend.org
 * @version    1
 * @link       http://www.izend.org
 */
function install($lang)
{
    head('title', translate('install:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $languages = 'install';
    $contact = true;
    $banner = build('banner', $lang, compact('languages', 'contact'));
    $configure = build('configure', $lang);
    $content = view('install', $lang, compact('configure'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #24
0
function footer($lang, $components = false)
{
    $languages = false;
    $contact_page = $newsletter_page = $user_page = $nobody_page = $account_page = $admin_page = false;
    $is_identified = user_is_identified();
    $is_admin = user_has_role('administrator');
    $nobody_page = $is_identified ? url('nobody', $lang) : false;
    if ($components) {
        foreach ($components as $v => $param) {
            switch ($v) {
                case 'languages':
                    if ($param) {
                        $languages = build('languages', $lang, $param);
                    }
                    break;
                case 'contact':
                    if ($param) {
                        $contact_page = url('contact', $lang);
                    }
                    break;
                case 'newsletter':
                    if ($param) {
                        $newsletter_page = url('newslettersubscribe', $lang);
                    }
                    break;
                case 'account':
                    if ($param) {
                        if ($is_identified) {
                            if (!$is_admin) {
                                $account_page = url('account', $lang);
                            }
                        } else {
                            $user_page = url('user', $lang);
                        }
                    }
                    break;
                case 'admin':
                    if ($param) {
                        $admin_page = $is_admin ? url('admin', $lang) : false;
                    }
                    break;
                default:
                    break;
            }
        }
    }
    $output = view('footer', $lang, compact('languages', 'contact_page', 'newsletter_page', 'user_page', 'nobody_page', 'account_page', 'admin_page'));
    return $output;
}
Beispiel #25
0
function delete($ID)
{
    $q = new mysql();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM users_containers WHERE `container_id`='{$ID}'", "artica_backup"));
    $directory = trim($ligne["directory"]);
    $ID = $ligne["container_id"];
    $ContainerFullPath = $directory . "/{$ID}.disk";
    $mountpoint = "/media/artica_containers/membersdisks/disk{$ID}";
    $unix = new unix();
    $umount = $unix->find_program("umount");
    shell_exec("{$umount} -l {$mountpoint}");
    @unlink($ContainerFullPath);
    $q->QUERY_SQL("DELETE FROM users_containers WHERE `container_id`='{$ID}'", "artica_backup");
    build();
}
Beispiel #26
0
function account($lang)
{
    if (!user_is_identified()) {
        return run('user', $lang);
    }
    head('title', translate('account:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $banner = build('banner', $lang);
    $user_id = user_profile('id');
    $useredit = build('useredit', $lang, $user_id);
    $content = view('account', $lang, compact('useredit'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #27
0
function start_service()
{
    @mkdir("/var/log/snort");
    $sock = new sockets();
    $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics")));
    if (count($snortInterfaces) == 0) {
        echo "Starting......: " . date("H:i:s") . " Snort Daemon version No interfaces to listen set...\n";
        return;
    }
    echo "Starting......: " . date("H:i:s") . " Snort Daemon building configuration...\n";
    build();
    echo "Starting......: " . date("H:i:s") . " Snort Daemon building configuration done...\n";
    while (list($eth, $ligne) = each($snortInterfaces)) {
        echo "Starting......: " . date("H:i:s") . " Snort Daemon for Interface \"{$eth}\"...\n";
        start_interface($eth);
    }
}
function confirmnewsletterunsubscribe($lang, $arglist)
{
    head('title', translate('newsletter:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $banner = build('banner', $lang);
    list($timestamp, $mail) = $arglist;
    $bad_mail = false;
    $bad_time = false;
    if (!newsletter_get_user($mail)) {
        $bad_mail = true;
    }
    if (time() - $timestamp > 3600) {
        $bad_time = true;
    }
    $subscribe_page = $unsubscribe_page = false;
    $internal_error = false;
    $contact_page = false;
    if ($bad_mail or $bad_time) {
        $unsubscribe_page = url('newsletterunsubscribe', $lang);
    } else {
        $r = newsletter_delete_user($mail);
        if (!$r) {
            $internal_error = true;
        } else {
            require_once 'serveripaddress.php';
            require_once 'emailme.php';
            global $sitename;
            $ip = server_ip_address();
            $timestamp = strftime('%Y-%m-%d %H:%M:%S', time());
            $subject = 'unsubscribe' . '@' . $sitename;
            $msg = $ip . ' ' . $timestamp . ' ' . $lang . ' ' . $mail;
            @emailme($subject, $msg);
            $subscribe_page = url('newslettersubscribe', $lang);
        }
    }
    if ($internal_error) {
        $contact_page = url('contact', $lang);
    }
    $errors = compact('bad_mail', 'bad_time', 'internal_error', 'contact_page');
    $content = view('confirmnewsletterunsubscribe', $lang, compact('mail', 'subscribe_page', 'unsubscribe_page', 'errors'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
Beispiel #29
0
function restart()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    stop(true);
    build();
    sleep(1);
    start(true);
}
Beispiel #30
0
function pagecontent($lang, $arglist = false)
{
    global $content_folder;
    if (!$content_folder) {
        header('HTTP/1.1 404 Not Found');
        return false;
    }
    $page = false;
    if (is_array($arglist)) {
        if (isset($arglist[0])) {
            $page = $arglist[0];
        }
    }
    if (!$page) {
        header('HTTP/1.1 404 Not Found');
        return false;
    }
    $folder_id = $page_id = false;
    foreach (is_array($content_folder) ? $content_folder : array($content_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) {
        header('HTTP/1.1 404 Not Found');
        return false;
    }
    $r = thread_get_node($lang, $folder_id, $page_id);
    if (!$r) {
        return run('error/notfound', $lang);
    }
    extract($r);
    /* node_number node_ignored node_name node_title node_abstract node_cloud node_nocomment node_nomorecomment node_novote node_nomorevote node_ilike node_tweet node_plusone node_linkedin */
    if ($node_ignored) {
        header('HTTP/1.1 404 Not Found');
        return false;
    }
    $content = build('nodecontent', $lang, $page_id);
    return $content;
}