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
    /** 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. 3
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. 4
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. 5
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. 6
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. 7
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. 8
0
     if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'themes_csrf')) {
         if ($_GET['action'] == 'delete') {
             if (isset($_GET['id'])) {
                 if (actions::delete_theme($_GET['id'])) {
                     echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                 } else {
                     echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                 }
             }
         } else {
             if ($_GET['action'] == 'activate') {
                 if (isset($_GET['id'])) {
                     if (!template::theme_have_min(template::theme_editor_map($_GET['id']))) {
                         echo '<div class="a-error">' . $LANG['msg_invalid_theme'] . '</div>';
                     } else {
                         if (actions::set_option(array('theme' => $_GET['id']))) {
                             echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                         } else {
                             echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                         }
                     }
                 }
             }
         }
     }
 }
 $csrf = $_SESSION['themes_csrf'] = \site\utils::str_random(10);
 $themes = template::read_dirs();
 $current = \query\main::get_option('theme');
 if (count($themes > 0)) {
     echo '<div class="form-table">
Esempio n. 9
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['popshop_account']) && isset($_POST['popshop_catalog'])) {
        //update account
        if (actions::set_option(array('popshop_account' => $_POST['popshop_account'], 'popshop_catalog' => $_POST['popshop_catalog'], 'cj_ipp' => $_POST['cj_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'])) {
            foreach ($_POST['catid'] as $id => $catid) {
                $catid = intval($catid);
                if ($catid != 0) {
                    $catid_old = intval($_POST['catid_old'][$id]);
                    \plugin\Popshop\inc\actions::setMerchantTypeMapping(intval($id), $catid, $catid_old);
                }
            }
            echo '<div class="a-success">Saved!</div>';
        }
    }
}
$csrf = $_SESSION['slider_csrf'] = \site\utils::str_random(10);
switch ($_GET['action']) {
    default:
        echo '<script>
function dosync(full){
Esempio n. 10
0
 public static function delete_plugin($id)
 {
     global $db;
     if (!$GLOBALS['me']->is_admin) {
         return false;
     }
     $id = (array) $id;
     $stmt = $db->stmt_init();
     $stmt->prepare("DELETE FROM " . DB_TABLE_PREFIX . "plugins WHERE id = ?");
     foreach ($id as $ID) {
         $plugin = admin_query::plugin_infos($ID);
         // delete plugin
         $stmt->bind_param("i", $ID);
         $stmt->execute();
         // directory
         $dir = rtrim(dirname($plugin->main_file), '/');
         // delete tables
         if (isset($plugin->uninstall_preview['delete']['tables'])) {
             $tables = explode(',', $plugin->uninstall_preview['delete']['tables']);
             foreach (array_map('trim', $tables) as $table) {
                 $table = \site\plugin::replace_constant($table);
                 $db->query("DROP TABLE `{$table}`");
             }
         }
         // delete options
         if (isset($plugin->uninstall_preview['delete']['options'])) {
             $rows = explode(',', $plugin->uninstall_preview['delete']['options']);
             foreach (array_map('trim', $rows) as $row) {
                 $db->query("DELETE FROM `" . DB_TABLE_PREFIX . "options` WHERE `option_name` = '{$row}'");
             }
         }
         // delete table columns
         if (isset($plugin->uninstall_preview['delete']['columns'])) {
             $columns = explode(',', $plugin->uninstall_preview['delete']['columns']);
             foreach (array_map('trim', $columns) as $column) {
                 $coltab = explode('/', $column);
                 if (count($coltab) === 2) {
                     $table = \site\plugin::replace_constant($coltab[1]);
                     $db->query("ALTER TABLE `{$table}` DROP {$coltab[0]}");
                 }
             }
         }
         // delete head lines
         $db->query("DELETE FROM `" . DB_TABLE_PREFIX . "head` WHERE `plugin` = '{$dir}'");
         /*
         Resolve possible problems caused by uninstalling
         */
         switch ($plugin->scope) {
             case 'language':
                 if (\query\main::get_option('sitelang') == 'up_' . strtolower($plugin->name)) {
                     actions::set_option(array('sitelang' => 'english'));
                 }
                 if (\query\main::get_option('adminpanel_lang') == 'up_' . strtolower($plugin->name)) {
                     actions::set_option(array('adminpanel_lang' => 'english'));
                 }
                 break;
         }
         // delete plugin directory
         \site\files::delete_directory(DIR . '/' . UPDIR . '/' . $dir);
         // delete image, if plugins has an image
         @unlink(DIR . '/' . $plugin->image);
     }
     @$stmt->close();
     return true;
 }
Esempio n. 11
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'general-settings':
            if (isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'settings_csrf')) {
                include dirname(__DIR__) . '/' . IDIR . '/others/GMT_list.php';
                if (isset($_POST['sitename']) && isset($_POST['siteurl']) && isset($_POST['description']) && isset($_POST['ipp']) && isset($_POST['registrations']) && isset($_POST['accounts_per_ip']) && isset($_POST['delete_old_coupons']) && isset($_POST['allow_revs']) && isset($_POST['auvalid_revs']) && isset($_POST['allow_stores']) && isset($_POST['allow_coupons']) && isset($_POST['site_lang']) && isset($_POST['adminpanel_lang']) && isset($_POST['timezone']) && isset($_POST['hour_format']) && isset($_POST['email_from_name']) && isset($_POST['email_answer_to']) && isset($_POST['email_contact']) && isset($_POST['mail_meth']) && isset($_POST['smtp_host']) && isset($_POST['smtp_port']) && isset($_POST['smtp_user']) && isset($_POST['smtp_pass']) && isset($_POST['sendmail_path']) && isset($_POST['admin_theme'])) {
                    $_SESSION['js_settings'] = true;
                }
                if (actions::set_option(array('sitename' => $_POST['sitename'], 'siteurl' => rtrim($_POST['siteurl'], '/'), 'sitedescription' => $_POST['description'], 'items_per_page' => (int) $_POST['ipp'], 'registrations' => $_POST['registrations'], 'delete_old_coupons' => (int) $_POST['delete_old_coupons'], 'accounts_per_ip' => (int) $_POST['accounts_per_ip'], 'allow_reviews' => (int) $_POST['allow_revs'], 'review_validate' => (bool) $_POST['auvalid_revs'], 'allow_stores' => (bool) $_POST['allow_stores'], 'store_validate' => (bool) $_POST['auvalid_stos'], 'allow_coupons' => (bool) $_POST['allow_coupons'], 'coupon_validate' => (bool) $_POST['auvalid_cous'], 'allow_products' => (bool) $_POST['allow_products'], 'product_validate' => (bool) $_POST['auvalid_prods'], 'sitelang' => $_POST['site_lang'], 'adminpanel_lang' => $_POST['adminpanel_lang'], 'timezone' => in_array($_POST['timezone'], array_keys($gmt)) ? $_POST['timezone'] : 'America/New_York', 'hour_format' => in_array($_POST['hour_format'], array(12, 24)) ? $_POST['hour_format'] : 24, 'email_from_name' => $_POST['email_from_name'], 'email_answer_to' => $_POST['email_answer_to'], 'email_contact' => $_POST['email_contact'], 'mail_method' => $_POST['mail_meth'], 'smtp_auth' => isset($_POST['smtp_auth']) ? 1 : 0, 'smtp_host' => $_POST['smtp_host'], 'smtp_port' => $_POST['smtp_port'], 'smtp_user' => $_POST['smtp_user'], 'smtp_password' => $_POST['smtp_pass'], 'sendmail_path' => $_POST['sendmail_path'], 'admintheme' => $_POST['admin_theme'], 'mail_signature' => $_POST['mailsign']))) {
                    echo '<script type="text/javascript">
    window.location = "?route=settings.php&action=general&success=true";
    </script>';
                    die;
                } else {
                    echo '<script type="text/javascript">
    window.location = "?route=settings.php&action=general&success=false";
    </script>';
                    die;
                }
            }
            break;
    }
}
?>

<script type="text/javascript">

  window.location = "?route=settings.php&action=general&success=false";
Esempio n. 12
0
                            $merchants_import = $ret['num_imports'];
                            $merchants_more = $merchantinfo['results']['merchants']['count'] - $page_m * 100;
                            $page_m++;
                        } else {
                            $merchants_more = 0;
                        }
                    } while ($merchants_more > 0);
                }
                //3.import deals
                $ret = \plugin\Popshop\inc\actions::importDeal($dealinfo['results']['deals']['deal']);
                $dup_deals_count = $ret['num_dups'];
                $deals_import_total += $ret['num_imports'];
                $deals_more = $dealinfo['results']['deals']['count'] - $page * 100;
                echo "imported " . $merchants_import . ' new stores ' . $ret['num_imports'] . '(' . $dup_deals_count . ') new coupons<br>';
                $page++;
            } else {
                $deals_more = 0;
            }
        } while ($deals_more > 0 && $dup_deals_count < $dup_deals_count_max);
        actions::set_option(array('popshop_lastupdate' => time()));
        echo 'sync success!<br>' . $merchants_import_total . ' new stores<br>' . $deals_import_total . ' new coupons<br>';
    }
    //4.import to couponcms data
    if (isset($_GET['auto'])) {
        $visible = isset($_GET['visible']) ? intval($_GET['visible']) : 0;
        $ret_store = \plugin\Popshop\inc\actions::add_store_auto($visible);
        $ret_item = \plugin\Popshop\inc\actions::add_item_auto();
        echo 'auto-import done!<br>store:' . $ret_store['done'] . 'done, ' . $ret_store['pass'] . 'pass, ' . $ret_store['fail'] . 'fail<br>item:' . $ret_item['done'] . 'done, ' . $ret_item['pass'] . 'pass, ' . $ret_item['fail'] . 'fail<br>';
    }
}
echo '<div><button class="btn" onclick="parent.location.reload();">Close</button></div>';