Exemple #1
0
function apiProcess()
{
    if (!($match = Uri::match('^api\\/(\\w+)\\/(\\w+)'))) {
        $result = json_encode(array('error' => 'yes', 'message' => 'Api not valid'));
        echo $result;
        die;
    }
    $method = strtolower($match[1]);
    $action = strtolower($match[2]);
    $result = array('error' => 'no', 'message' => '');
    switch ($method) {
        case 'image':
            Model::load('api/image');
            try {
                $result['data'] = loadApi($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'user':
            try {
                $result['data'] = Users::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'category':
            try {
                $result['data'] = Categories::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'plugin':
            try {
                $foldername = $action;
                $result['data'] = PluginsApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'payment':
            try {
                $foldername = $action;
                $result['data'] = PaymentApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'theme':
            try {
                $foldername = $action;
                $result['data'] = ThemeApi::get($foldername);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'cronjob':
            if (!($match = Uri::match('run\\.php$'))) {
                // throw new Exception("Error Processing Request");
                $result = array('error' => 'yes', 'message' => "Error Processing Request");
            }
            Cronjobs::run();
            break;
        case 'pluginstore':
            try {
                $result['data'] = PluginStoreApi::api($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
        case 'system':
            Model::load('api/system.php');
            try {
                $result['data'] = loadApi($action);
            } catch (Exception $e) {
                $result = array('error' => 'yes', 'message' => $e->getMessage());
            }
            break;
    }
    echo json_encode($result);
}
#!/usr/local/bin/php -q
<?php 
/****************************************************************************
 * For license information see doc/license.txt
 *
 * Unicode Reminder メモ
 *
 * refresh the search-index of all modified descriptions
 *
 * This is run as separate cronjob because it takes much time, may not
 * fit into the runcron frequency and should run at some time in the night.
 ****************************************************************************/
// needs absolute rootpath because called as cronjob
$opt['rootpath'] = __DIR__ . '/../../';
require __DIR__ . '/../../lib2/cli.inc.php';
require __DIR__ . '/../../lib2/search/ftsearch.inc.php';
if (!Cronjobs::enabled()) {
    exit;
}
$process_sync = new ProcessSync('fill_searchindex');
if ($process_sync->Enter()) {
    ftsearch_refresh();
    $process_sync->Leave();
}
Exemple #3
0
        $fields['commentsToStylist'] = '';
        $fields['termsAndConditionsChecked'] = '';
        $fields['promotionalCode'] = '';
        $fields['giftCardNumber'] = '';
        $fields['jacketTypeChoices'] = '';
        $fields['whereDoYouWhereYourJacketChoices'] = '';
        $fields['underwearStyleChoices'] = '';
        $fields['styleDislikeDescription'] = '';
        //fill all fields with something not null
        foreach ($fields as &$value) {
            if (empty($value)) {
                $value = '';
            }
        }
        //send it
        $ws_res = $ws->sendForm($fields);
        // if it does not say sagepay or its empty its wrong
        $patt = '/\\<title\\>Sage\\sPay/';
        preg_match($patt, $ws_res, $match);
        if (empty($match[0]) || empty($ws_res)) {
            $this->log_it("Something went wrong on the webservices.");
        } else {
            $this->log_it("Just sent {$profile->email}");
        }
        //mark it as sent in db
        //querying instead of using bespoke update method because that will update the modified field
        $this->wpdb->query("UPDATE {$this->table} SET salesforce = 1, ws_sent_date = now() WHERE profile_id = {$profile->profile_id}");
    }
}
$cron = new Cronjobs();
$cron->createSalesforceAccounts();
function uninstall_autoupdate()
{
    Dir::remove(CACHES_PATH . 'dbcache/plugin/autoupdate');
    Cronjobs::delete(PLUGINS_PATH . 'autoupdate/index.php', 'detect_update_system');
}
function uninstall_fastindex()
{
    Dir::remove(CACHES_PATH . 'dbcache/system/fastindex');
    Dir::remove(CACHES_PATH . 'fastindex');
    Cronjobs::delete(PLUGINS_PATH . 'fastindex/index.php', 'fastindex_ping');
}