Esempio n. 1
0
function __checkPassword($fileId, array $requestData)
{
    $passwords = __load($fileId);
    foreach ($passwords as $pw) {
        if (isset($pw['password']) && $pw['password'] === $requestData['password']) {
            return true;
        }
    }
    return false;
}
Esempio n. 2
0
function __buildHashCode($requestData)
{
    $account = isset($requestData['oldaccount']) && strlen($requestData['oldaccount']) > 0 ? $requestData['oldaccount'] : $requestData['account'];
    $items = __load('PASSWORDS');
    foreach ($items as $item) {
        if (isset($item['password']) && strpos($item['password'], $account) === 0) {
            return $item['#'];
        }
    }
    return NULL;
}
Esempio n. 3
0
/**
 * Function to handle HTTP-GET-requests.
 * @param Array, $requestData are the requested data
 */
function get(array $requestData)
{
    $accounts = __load('ACCOUNTS');
    $passwords = __load('PASSWORDS');
    foreach ($accounts as $i => $account) {
        foreach ($passwords as $password) {
            $account['account'] = preg_replace('/\\/$/', '', $account['account']);
            $accounts[$i]['account'] = $account['account'];
            if (isset($account['account']) && isset($password['password']) && strpos($password['password'], $account['account']) === 0) {
                $accounts[$i]['hasPassword'] = true;
            }
        }
    }
    return $accounts;
}
Esempio n. 4
0
function __load_in_massive($class)
{
    $TF =& get_instance();
    $TF->{$class} =& __load($class);
}
            $cmd = 'php cli/packal.php doUpdate ' . str_replace('update-', '', $q);
            $result = exec($cmd);
            if ($result == 'TRUE') {
                $plist = $workflows[str_replace('update-', '', $q)] . '/info.plist';
                $name = exec("/usr/libexec/PlistBuddy -c \"Print :name\" '{$plist}' 2> /dev/null");
                // echo $name . " has been successfully updated.";
            } else {
                $plist = $workflows[str_replace('update-', '', $q)] . '/info.plist';
                $name = exec("/usr/libexec/PlistBuddy -c \"Print :name\" '{$plist}' 2> /dev/null");
                echo "Error updating " . $name;
            }
        }
    }
}
// We haven't possibly needed these yet, so we'll load them here.
$tn = __load('terminal-notifier', 'default', 'utility');
$endpoints = json_decode(file_get_contents("{$data}/endpoints/endpoints.json"), TRUE);
if (strpos($q, 'option-set-') !== FALSE) {
    $set = str_replace('option-set-', '', $q);
    $set = explode('-', $set);
    $set[1] = (string) $set[1];
    if (count($set) > 2) {
        echo "Too many hyphens.";
        die;
    }
    if (empty($set[1])) {
        $set[1] = 'null';
    }
    // Just in case something wasn't quoted correctly.
    $set[1] = str_replace('\\ ', ' ', $set[1]);
    if ($set[0] == 'username' && $set[1] == 'null') {
Esempio n. 6
0
/**
 * Function to handle HTTP-GET-requests.
 * @param Array, $requestData are the requested data
 */
function get(array $requestData)
{
    return __load('DOMAINS');
}
Esempio n. 7
0
 function model($name)
 {
     $name = strtoupper($name);
     if ($this->model_exists($name)) {
         $obj =& __load($name, 'models', TF_PREFIX);
         if (method_exists($obj, '__init')) {
             $obj->__init();
         }
         return class_exists(TF_PREFIX . $name);
     } else {
         exit(__('Model not found', 'tfuse') . ': ' . $name);
     }
 }
Esempio n. 8
0
 */
$cfg = get_config('init_helpers');
foreach ($cfg as $helper) {
    include_once TFUSE . '/helpers/' . strtoupper($helper) . '.php';
}
/**
 * Actions and Filters
 */
include_once TFUSE . '/actions_and_filters.php';
/*
 * Now the framework has finished loading. 
 * Do some after-loading actions.
 */
$inits = collect_init(NULL, TRUE);
foreach ($inits as $class) {
    $tmp =& __load($class);
    $tmp->__init();
}
unset($inits, $class, $tmp);
function _tfuse_fix_new_options_negate($options, $type)
{
    if ($type != 'admin' || !get_option(TF_THEME_PREFIX . '_tfuse_framework_options')) {
        return $options;
    }
    static $called = false;
    if ($called) {
        return $options;
    }
    $called = true;
    global $TFUSE;
    $negateOldOptions = array('disable_tfuse_seo_tab' => 'enable_tfuse_seo_tab', 'deactivate_tfuse_style' => 'activate_tfuse_style');
Esempio n. 9
0
 function __find($item)
 {
     $loadedItems = __load();
     foreach ($loadedItems as $loadedItem) {
         if (__identify($lines[$i], $item)) {
             return $item;
         }
     }
     return NULL;
 }
Esempio n. 10
0
/**
 * Function to handle HTTP-GET-requests.
 * @param Array, $requestData are the requested data
 */
function get(array $requestData)
{
    return __splitAccounts(__load('ADDRESSES'));
}
Esempio n. 11
0
/**
 * [doUpdate description]
 * @param {[type]} $bundle [description]
 * @param {[type]} $force  =             FALSE [description]
 */
function doUpdate($bundle, $force = FALSE)
{
    global $data, $cache, $manifest, $repo, $cliDir;
    if (is_array($bundle)) {
        $bundle = $bundle[0];
    }
    $dir = trim(`"{$cliDir}/packal.sh" getDir "{$bundle}"`);
    // echo $dir;
    // The force variable means to download even if the original
    // is not from Packal. Obviously, since we don't have the
    // update data, this just means to download the update no
    // matter what and to get everything.
    if (!$force) {
        if (!file_exists("{$dir}/packal/package.xml")) {
            echo "Error: No package information exists.";
            return FALSE;
        }
    }
    $xml = simplexml_load_file("{$manifest}");
    foreach ($xml as $x) {
        if ("{$x->bundle}" != "{$bundle}") {
            continue;
        }
        $xml = $x;
        break;
    }
    // Make the temporary directories.
    if (!file_exists("{$cache}/update")) {
        mkdir("{$cache}/update");
    }
    if (!file_exists("{$cache}/update/{$bundle}")) {
        mkdir("{$cache}/update/{$bundle}");
    }
    if (!file_exists("{$cache}/update/{$bundle}/tmp")) {
        mkdir("{$cache}/update/{$bundle}/tmp");
    }
    `curl -sL "{$repo}/{$bundle}/{$xml->file}" > "{$cache}/update/{$bundle}/{$xml->file}"`;
    `curl -sL "{$repo}/{$bundle}/appcast.xml" > "{$cache}/update/{$bundle}/appcast.xml"`;
    `unzip -qo "{$cache}/update/{$bundle}/{$xml->file}" -d "{$cache}/update/{$bundle}/tmp"`;
    $valid = verifySignature("{$cache}/update/{$bundle}/appcast.xml", "{$cache}/update/{$bundle}/{$xml->file}", "{$dir}/packal/{$bundle}.pub");
    if (!$valid) {
        echo "Error: Cannot verify signature for {$xml->file} from {$bundle}.";
        return FALSE;
    }
    // Why can't I just include the function, call it, and be done with it?
    // I think it might be a namespacing issue or something.
    // migratePlist( "$dir/info.plist", "$cache/update/$bundle/tmp/info.plist" );
    // It's too late to figure that out. Maybe tomorrow.
    $cmd = "php " . __DIR__ . "/includes/plist-migration.php \"{$dir}/info.plist\" \"{$cache}/update/{$bundle}/tmp/info.plist\"";
    exec("{$cmd}");
    // Backup the bundle.
    echo `"{$cliDir}/packal.sh" backup "{$bundle}"`;
    $cmd = "'" . __DIR__ . "/packal.sh' replaceFiles " . escapeshellarg($dir) . ' ' . escapeshellarg($cache . '/update/' . "{$bundle}/tmp/");
    exec("{$cmd}");
    `rm -fR "{$cache}/update/{$bundle}"`;
    $tn = __load('terminal-notifier', 'default', 'utility');
    exec("{$tn} -title 'Packal Updater' -message '{$xml->name} has been updated to version {$xml->version}'");
    echo "TRUE";
    return TRUE;
}
Esempio n. 12
0
/**
 * Function to handle HTTP-GET-requests.
 * @param Array, $requestData are the requested data
 */
function get(array $requestData)
{
    $result = __splitAccounts(__load('TESTS'));
    return __test($result);
}