Esempio n. 1
0
 public function import($type)
 {
     $data = array();
     switch ($type) {
         case 'news':
             // check interval for update
             if (defined('CHECK_NEWS_TIME')) {
                 $lup = CHECK_NEWS_TIME > 1440 || CHECK_NEWS_TIME < 1 ? 3600 : CHECK_NEWS_TIME * 60;
             } else {
                 $lup = 3600;
                 // 1 hour
             }
             $last_check = \query\main::get_option('check_news');
             if ($last_check + $lup > time()) {
                 return false;
             }
             $data['last_check'] = $last_check;
             actions::set_option(array('check_news' => time()));
             break;
         default:
             return false;
             break;
     }
     try {
         $answer = $this->connect($type, $data);
         $this->parse_answer($type, $answer);
         return true;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Esempio n. 2
0
 public function install()
 {
     actions::invoke('database', array('initialize'));
     actions::invoke('database', array('import'));
     if (config::has('installer.class')) {
         $ic = config::get('installer.class');
         $c = new $ic();
         $c->install();
     }
 }
Esempio n. 3
0
 public static function dispatch()
 {
     $uri = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '/';
     $act = trim($uri, '/');
     require_once __DIR__ . '/actions.php';
     if ($act == 'execute') {
         actions::execute();
     } else {
         ob_start();
         $conf = self::getConfig();
         extract($conf);
         include __DIR__ . '/template.phtml';
         echo ob_get_clean();
     }
 }
Esempio n. 4
0
<a href="#" class="btn">Show</a>
<ul>
<li><a href="?plugin=CJApi/cj.php&amp;action=advertisers">Advertisers</a></li>
<li><a href="?plugin=CJApi/cj.php&amp;action=links">Links</a></li>
<li><a href="?plugin=CJApi/main.php&amp;action=sales">Sales</a></li>
</ul>
</div>

</div>

<span>Modify CJ.com API settings</span>

</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'slider_csrf')) {
            if (isset($_POST['key']) && isset($_POST['site-id']) && isset($_POST['exp']) && isset($_POST['ipp'])) {
                if (actions::set_option(array('cj_key' => $_POST['key'], 'cj_site-id' => $_POST['site-id'], 'cj_exp' => $_POST['exp'], 'cj_ipp' => $_POST['ipp']))) {
                    echo '<div class="a-success">Saved!</div>';
                } else {
                    echo '<div class="a-error">Error!</div>';
                }
            } else {
                if (isset($_POST['catid']) && isset($_POST['catid_old'])) {
                    //var_dump($_POST['catid']);
                    //var_dump($_POST['catid_old']);
                    foreach ($_POST['catid'] as $id => $catid) {
                        $catid = intval($catid);
                        if ($catid != 0) {
                            $catid_old = intval($_POST['catid_old'][$id]);
                            \plugin\CJApi\inc\actions::setCategoryMapping($id, $catid, $catid_old);
                        }
                    }
Esempio n. 5
0
    /** SOCIAL NETWORKS */
    case 'socialacc':
        echo '<div class="title">

<h2>' . $LANG['settings_general_title'] . '</h2>';
        if (!empty($LANG['settings_socnet_subtitle'])) {
            echo '<span>' . $LANG['settings_socnet_subtitle'] . '</span>';
        }
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['post']) && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'settings_csrf')) {
            $post = array_map(function ($w) {
                if (preg_match('/^http(s)?:\\/\\//i', $w)) {
                    return substr($w, 0, 200);
                }
            }, $_POST['post']);
            if (actions::set_option(array('social_facebook' => $post['facebook'], 'social_google' => $post['google'], 'social_twitter' => $post['twitter'], 'social_flickr' => $post['flickr'], 'social_linkedin' => $post['linkedin'], 'social_vimeo' => $post['videmo'], 'social_youtube' => $post['youtube'], 'social_myspace' => $post['myspace'], 'social_reddit' => $post['reddit'], 'social_pinterest' => $post['pinterest']))) {
                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
            } else {
                echo '<div class="a-error">' . $LANG['settings_save_error'] . '</div>';
            }
        }
        $csrf = $_SESSION['settings_csrf'] = \site\utils::str_random(10);
        echo '<form action="#" method="POST">

<div class="form-table">

<div class="row"><span>Facebook:</span><div><input type="text" name="post[facebook]" value="' . htmlspecialchars(\query\main::get_option('social_facebook')) . '" maxlength="200" /></div></div>
<div class="row"><span>Google+:</span><div><input type="text" name="post[google]" value="' . htmlspecialchars(\query\main::get_option('social_google')) . '" maxlength="200" /></div></div>
<div class="row"><span>Twitter:</span><div><input type="text" name="post[twitter]" value="' . htmlspecialchars(\query\main::get_option('social_twitter')) . '" maxlength="200" /></div></div>
<div class="row"><span>Flickr:</span><div><input type="text" name="post[flickr]" value="' . htmlspecialchars(\query\main::get_option('social_flickr')) . '" maxlength="200" /></div></div>
<div class="row"><span>Linkedin:</span><div><input type="text" name="post[linkedin]" value="' . htmlspecialchars(\query\main::get_option('social_linkedin')) . '" maxlength="200" /></div></div>
Esempio n. 6
0
        include DIR . '/' . IDIR . '/' . str_replace('\\', '/', $cn) . '.php';
    }
});
/** */
$load = new \main\load();
$LANG = $load->get_ap_language();
include 'includes/functions.php';
if ($GLOBALS['me'] && $GLOBALS['me']->is_subadmin) {
    include 'includes/template.php';
    include 'etc/connector.php';
    include 'includes/admin.php';
    include 'includes/query.php';
    include 'includes/widgets.php';
    include 'includes/importer.php';
    // this it's not mandatory, but good to clear informations in real time
    actions::cleardata(true, \query\main::get_option('delete_old_coupons'));
    if (isset($_GET['ajax']) && file_exists('ajax/' . $_GET['ajax'])) {
        include 'ajax/' . $_GET['ajax'];
        die;
    } else {
        if (isset($_GET['download']) && file_exists('etc/download/' . $_GET['download'])) {
            include 'etc/download/' . $_GET['download'];
            die;
        }
    }
    include 'html/header.php';
    include 'html/nav.php';
    include 'html/logged.php';
    new importer();
    if (!isset($_GET['action'])) {
        $_GET['action'] = '';
Esempio n. 7
0
<?php

if (!$GLOBALS['me']->is_admin) {
    die;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'slider_csrf')) {
    if (isset($_POST['sendy_brand_id']) && isset($_POST['sendy_list_id']) && isset($_POST['sendy_reply_to']) && isset($_POST['sendy_from_email']) && isset($_POST['sendy_from_name']) && isset($_POST['sendy_api_key']) && isset($_POST['sendy_url']) && isset($_POST['sendy_template_root'])) {
        //update account
        $sendy_url = substr($_POST['sendy_url'], -1) == '/' ? $_POST['sendy_url'] : $_POST['sendy_url'] . '/';
        $sendy_template_root = substr($_POST['sendy_template_root'], -1) == '/' ? $_POST['sendy_template_root'] : $_POST['sendy_template_root'] . '/';
        $sendy_query_string = isset($_POST['sendy_query_string']) ? $_POST['sendy_query_string'] : '';
        if (actions::set_option(array('sendy_query_string' => $sendy_query_string, 'sendy_brand_id' => $_POST['sendy_brand_id'], 'sendy_list_id' => $_POST['sendy_list_id'], 'sendy_reply_to' => $_POST['sendy_reply_to'], 'sendy_from_email' => $_POST['sendy_from_email'], 'sendy_from_name' => $_POST['sendy_from_name'], 'sendy_api_key' => $_POST['sendy_api_key'], 'sendy_url' => $sendy_url, 'sendy_template_root' => $sendy_template_root))) {
            echo '<div class="a-success">Saved!</div>';
        } else {
            echo '<div class="a-error">Error!</div>';
        }
    } else {
        echo '<div class="a-error">Param Error (' . isset($_POST['sendy_brand_id']) . ',' . isset($_POST['sendy_list_id']) . ',' . isset($_POST['sendy_reply_to']) . ',' . isset($_POST['sendy_from_email']) . ',' . isset($_POST['sendy_from_name']) . ',' . isset($_POST['sendy_api_key']) . ',' . isset($_POST['sendy_url']) . ')</div>';
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        echo '<div class="a-error">Signature Error</div';
    }
}
$csrf = $_SESSION['slider_csrf'] = \site\utils::str_random(10);
switch ($_GET['action']) {
    default:
        echo '
<div class="title">

<h2>Sendy settings</h2>
Esempio n. 8
0
        if (!empty($LANG['widgets_subtitle'])) {
            echo '<span>' . $LANG['widgets_subtitle'] . '</span>';
        }
        echo '</div>';
        if (isset($_GET['token']) && isset($_GET['id']) && check_csrf($_GET['token'], 'widgets_csrf')) {
            if (isset($_GET['add'])) {
                if ($widget_info = widgets::widget_from_id($_GET['id'])) {
                    if (actions::add_widget($zone_id, $_GET['id'], array('title' => $widget_info->name, 'file' => $widget_info->file, 'limit' => isset($widget_info->def_limit) ? $widget_info->def_limit : 10, 'text' => isset($widget_info->text) ? $widget_info->text : ''))) {
                        echo '<div class="a-success">' . $LANG['msg_added'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            } else {
                if (isset($_GET['delete'])) {
                    if (actions::delete_widget($zone_id, $_GET['id'])) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        }
        $token = $_SESSION['widgets_csrf'] = \site\utils::str_random(10);
        /* */
        $zone_widgets = \query\main::show_widgets($zone_id, '../');
        /* */
        echo '<div class="form-table">

<ul class="elements-list el-two">
Esempio n. 9
0
                echo '</div>';
                if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'pages_csrf')) {
                    if (isset($_POST['delete'])) {
                        if (isset($_POST['id'])) {
                            if (actions::delete_page(array_keys($_POST['id']))) {
                                echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                } else {
                    if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'pages_csrf')) {
                        if ($_GET['action'] == 'delete') {
                            if (isset($_GET['id'])) {
                                if (actions::delete_page($_GET['id'])) {
                                    echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                                } else {
                                    echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                                }
                            }
                        }
                    }
                }
                $csrf = $_SESSION['feed_csrf'] = \site\utils::str_random(10);
                echo '<div class="page-toolbar">

    <form action="#" method="GET" autocomplete="off">
    <input type="hidden" name="route" value="feed.php" />
    <input type="hidden" name="action" value="list" />
Esempio n. 10
0
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'categories_csrf')) {
            if (isset($_POST['delete'])) {
                if (isset($_POST['id'])) {
                    if (actions::delete_category(array_keys($_POST['id']))) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'categories_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_category($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['categories_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off" novalidate>

<input type="hidden" name="route" value="categories.php" />
Esempio n. 11
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'users_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_user($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'verify' || $_GET['type'] == 'unverify') {
                        if (isset($_GET['id'])) {
                            if (actions::action_user($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['users_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="users.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 12
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'pages_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_page($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_page($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['pages_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="pages.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 13
0
<?php

$json['answer'] = false;
if (isset($_POST['csrf']) && isset($_SESSION['chat_csrf']) && $_SESSION['chat_csrf'] == $_POST['csrf'] && isset($_POST['msg']) && actions::post_chat_message($_POST['msg'])) {
    $json['answer'] = true;
}
echo json_encode($json);
Esempio n. 14
0
        foreach ($sf as $val) {
            Console::write('  %-18s', $val);
            $cb++;
            if ($cb > 3 && $val != end($sf)) {
                Console::writeLn();
                $cb = 0;
            }
        }
        Console::writeLn();
        Console::writeLn();
    }
    function extensions()
    {
        $cb = 0;
        Console::writeLn(__astr("\\b{Loaded extensions:}"));
        $ext = get_loaded_extensions();
        sort($ext);
        foreach ($ext as $val) {
            Console::write('  %-18s', $val);
            $cb++;
            if ($cb > 3 && $val != end($ext)) {
                Console::writeLn();
                $cb = 0;
            }
        }
        Console::writeLn();
        Console::writeLn();
    }
}
actions::register(new InfoAction(), 'info', 'Show various pieces of information', InfoAction::$commands);
Esempio n. 15
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'reviews_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_review($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_review($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['reviews_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="reviews.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 16
0
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'banned_csrf')) {
            if (isset($_POST['delete'])) {
                if (isset($_POST['id'])) {
                    if (actions::delete_banned(array_keys($_POST['id']))) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'banned_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_banned($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['banned_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="banned.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 17
0
                        $coupons['p_' . $p_id] = str_replace(array('{_BANNER_URL_}', '{_BANNER_IMAGE_}', '{_STORE_URL_}', '{_STORE_NAME_}', '{_ITEM_URL_}', '{_ITEM_NAME_}', '{_EXPIRE_TEXT_}', '{_NOW_PRICE_}', '{_OLD_PRICE_}'), array($product_link, $p_image, $store_link, $s_name, $product_link, $p_title, 'Expires on ' . $p_expiration, $p_currency . $p_price, $p_currency . $p_old_price), $template_favsale);
                    }
                    $coupondata[$store] = $coupons;
                }
                foreach ($coupondata[$store] as $coupon_content) {
                    $strfav .= $coupon_content;
                }
            }
            if ($strfav == '') {
                $strnofav = $template_nofav;
            } else {
                $strfav = str_replace($fav_anchor, $strfav, $template_fav);
            }
        } else {
            //this user has no fav
            $strnofav = $template_nofav;
        }
        //call sendy
        $data = array('email' => $user['email'], 'name' => $user['name'], 'list' => $sendy_list_id, '_update_custom_fields' => 1, 'NOFAV' => $strnofav, 'MYFAV' => $strfav);
        // use key 'http' even if you send the request to https://...
        $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data)));
        $context = stream_context_create($options);
        $result = file_get_contents($sendy_url, false, $context);
        echo "UID(" . $user['id'] . "):" . strip_tags($result) . "<br>";
    }
    $stmt->close();
    actions::set_option(array('sendy_last_sync' => time()));
} else {
    echo 'signature error!<br>';
}
echo '<div><button class="btn" onclick="parent.location.reload();">Close</button></div>';
Esempio n. 18
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'payments_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_payment($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if (in_array($_GET['type'], array('paid', 'unpaid', 'delivered', 'undelivered'))) {
                        if (isset($_GET['id'])) {
                            if (actions::action_payment($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['payments_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="payments.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 19
0
                        $disablegroup = false;
                        $rdo = "#ENDGROUP";
                    } elseif ($ingroup && $disablegroup) {
                        $rdo = sprintf("#%-20s %s", $rd[0], join(' ', array_slice($rd, 1)));
                    } else {
                        if (preg_match('/[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*/', $rd[0])) {
                            $rdo = sprintf("#%-19s %s", $rd[0], join(' ', array_slice($rd, 1)));
                        } else {
                            $rdo = sprintf("# %s", join(' ', $rd));
                        }
                    }
                } else {
                    $rd = explode(' ', trim($row));
                    $rdo = sprintf("%-20s %s", $rd[0], join(' ', array_slice($rd, 1)));
                }
            }
            $fout[] = $rdo;
        }
        $fsout = join("\n", $fout);
        file_put_contents('/etc/hosts', $fsout);
    }
    function addgroup($group = null)
    {
        if (!$group) {
            console::fatal("You need to specify the group to add!");
            exit(1);
        }
    }
}
actions::register(new HostsAction(), 'hosts', 'Manage hosts file groups for local development', HostsAction::$actions);
Esempio n. 20
0
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'news_csrf')) {
            if (isset($_POST['delete'])) {
                if (isset($_POST['id'])) {
                    if (actions::delete_news(array_keys($_POST['id']))) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'news_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_news($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['news_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="news.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 21
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'plugins_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_plugin($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_plugin($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['plugins_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="plugins.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 22
0
if (!$GLOBALS['me']->is_admin) {
    die;
}
switch ($_GET['action']) {
    default:
        echo '<div class="title">

<h2>MyPluginDemo settings</h2>

<span>Modify MyPluginDemo settings</span>

</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'slider_csrf')) {
            if (isset($_POST['mpd_param1']) && isset($_POST['mpd_param2'])) {
                if (actions::set_option(array('mpd_param1' => $_POST['mpd_param1'], 'mpd_param2' => $_POST['mpd_param2']))) {
                    echo '<div class="a-success">Saved!</div>';
                } else {
                    echo '<div class="a-error">Error!</div>';
                }
            }
        }
        $csrf = $_SESSION['slider_csrf'] = \site\utils::str_random(10);
        echo '<form action="#" method="POST">

<div class="form-table">

<div class="row"><span>Demo Param1: <span class="info"><span>info text here</span></span></span><div><input type="text" name="mpd_param1" value="' . htmlspecialchars(\query\main::get_option('mpd_param1')) . '" style="background: #F8E0E0;" required /></div></div>
<div class="row"><span>Demo Param2: <span class="info"><span>info text here</span></span></span><div><input type="text" name="mpd_param2" value="' . htmlspecialchars(\query\main::get_option('mpd_param2')) . '" style="background: #F8E0E0;" required /></div></div>

</div>';
Esempio n. 23
0
        /*
        IMPORT COUPONS
        */
        try {
            $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'view' => !isset($_GET['import_expired']) || $_GET['import_expired'] !== 'yes' ? 'active' : '', 'date' => \site\utils::timeconvert(date('Y-m-d, H:i:s', $last_check), $feed->timezone)));
            if (!empty($coupons['Count'])) {
                for ($cp = 1; $cp <= ceil($coupons['Count'] / 10); $cp++) {
                    if ($cp != 1) {
                        $coupons = $feed->coupons(array_merge(array('page' => $cp), $options));
                    }
                    foreach ($coupons['List'] as $coupon) {
                        if (!admin_query::coupon_imported($coupon->ID) && ($store = admin_query::store_imported($coupon->Store_ID)) && actions::add_item(array('feedID' => $coupon->ID, 'store' => $store->ID, 'category' => $store->catID, 'popular' => 0, 'exclusive' => 0, 'name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'cashback' => 0, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date, 'publish' => 1, 'meta_title' => '', 'meta_desc' => ''))) {
                            $csuc++;
                        } else {
                            $cerr++;
                        }
                    }
                    usleep(500000);
                    // let's put a break after every page, 500 000 microseconds. that means a half of a second
                }
            }
            actions::set_option(array('lfeed_check' => time()));
            // update time for last feed check
        } catch (Exception $e) {
        }
    }
    // you can use $csuc, $cusuc, $cerr, $cuerr variables to create logs or something ...
    echo 'OK';
} catch (Exception $e) {
    echo $e->getMessage();
}
Esempio n. 24
0
                    console::writeLn();
                }
            }
        }
    }
    function compile()
    {
        $this->openDatabase();
        foreach ($this->db as $key => $val) {
            if (string::like('lang:*', $key)) {
                $out = '';
                $keyparts = explode(':', $key);
                $lang = $keyparts[1];
                $out = sprintf("<?php\n// Do not edit! Automatically generated by 'lepton strings'\n\n");
                $out .= sprintf("intl::registerLanguage('%s',array(\n", $lang);
                foreach ($val as $src => $str) {
                    $out .= sprintf("   '%s' => '%s'", str_replace('\'', '\\\'', $src), str_replace('\'', '\\\'', $str));
                    if ($str != end($val)) {
                        $out .= ',';
                    }
                    $out .= "\n";
                }
                $out .= sprintf("));");
                console::writeLn(__astr("\\g{Generated:} %s"), $lang);
                file_put_contents(base::appPath() . 'languages/' . $lang . '.php', $out);
            }
        }
    }
}
actions::register(new StringsAction(), 'strings', 'Manages internationalization and translation of strings', StringsAction::$commands);
Esempio n. 25
0
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'rewards_csrf')) {
            if (isset($_POST['delete'])) {
                if (isset($_POST['id'])) {
                    if (actions::delete_reward(array_keys($_POST['id']))) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'rewards_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_reward($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['rewards_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="rewards.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 26
0
        usleep(50000);
        Console::status("app/models      ");
        usleep(50000);
        Console::status("app/views       ");
        usleep(50000);
        Console::status("res             ");
        usleep(50000);
        Console::writeLn("Done            ");
        Console::write("Copying files ... ");
        Console::writeLn("39 of 39");
        Console::write("Checking configuration ... ");
        Console::writeLn("Ok");
        Console::write("Do you want a htconf too? [y/N] ");
        $w = Console::readLn();
    }
    function config()
    {
        Console::write("Reading configuration metadata ... ");
        Console::status('dbx           ');
        sleep(1);
        Console::status('dbx.db        ');
        sleep(1);
        Console::status('dbx.db.mysql  ');
        sleep(1);
        Console::writeLn('done          ');
        Console::writeLn("Parsing configuration file ... done");
        Console::writeLn("Preparing options ... done");
    }
}
actions::register(new BaseAction(), 'base', 'Base management functions', BaseAction::$commands);
Esempio n. 27
0
<?php

error_reporting(E_ALL);
if (!defined('PHP_DISCORD_DIR')) {
    define('PHP_DISCORD_DIR', dirname(__FILE__));
}
require_once PHP_DISCORD_DIR . "/library/auth.class.php";
require_once PHP_DISCORD_DIR . "/library/messages.class.php";
require_once PHP_DISCORD_DIR . "/library/actions.class.php";
$auth = new auth("*****@*****.**", "judahthebad1");
$messages = new messages("0ZFgG6Y9m9xi6SEX", $auth->token);
$actions = new actions();
$messages->send_message("UOLTT Bot Online!");
$messages->get_new_messages(1);
while (true) {
    if (sizeof($messages->message_que) > 0) {
        while ($messages->have_message()) {
            if ($messages->message['content'] == "~offline" && $messages->message['author']['username'] == "judahnator") {
                break 2;
            }
            $action = $actions->a_do($messages->message);
            if ($action) {
                // if response was given
                $messages->send_message($actions->output, $actions->mentions);
                echo $actions->output . " being sent to " . implode(",", $actions->mentions) . "\r\n";
            } else {
                // echo to console message if no action was taken
                if ($messages->message['author']['username'] != "UOLTT Bot") {
                    echo $messages->current_channel . " " . $messages->message['content'] . "\r\n";
                }
            }
Esempio n. 28
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'coupons_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_item($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_item($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['coupons_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="coupons.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 29
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'stores_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_store($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_store($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['stores_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="stores.php" />
<input type="hidden" name="action" value="list" />
Esempio n. 30
0
<?php

if (!isset($_GET['secret']) || $_GET['secret'] !== \query\main::get_option('cron_secret')) {
    die('Unauthorized');
}
include ADMINDIR . '/includes/admin.php';
actions::cleardata(isset($_GET['coupons']) && $_GET['coupons'] == 'true' ? true : false, isset($_GET['days']) && (int) $_GET['days'] > 0 ? (int) $_GET['days'] : 30);
echo 'OK';