Ejemplo n.º 1
0
function processSettings($calID)
{
    //get settings from calendar
    $dbSet = getSettings();
    if (!empty($dbSet)) {
        echo "<li>Calendar settings retrieved from database.</li>\n";
    }
    //convert 2.7.1 date settings to new settings
    $ds = isset($dbSet['dateSep']) ? $dbSet['dateSep'] : '.';
    //dateSep: LuxCal 2.7.1
    if (isset($dbSet['dateFormat'])) {
        switch ($dbSet['dateFormat']) {
            //dateSep: LuxCal 2.7.1 format
            case '1':
                $dbSet['dateFormat'] = 'd' . $ds . 'm' . $ds . 'y';
                break;
            case '2':
                $dbSet['dateFormat'] = 'm' . $ds . 'd' . $ds . 'y';
                break;
            case '3':
                $dbSet['dateFormat'] = 'y' . $ds . 'm' . $ds . 'd';
        }
    }
    if (empty($dbSet['MdFormat'])) {
        $dbSet['MdFormat'] = empty($dbSet['dateUSorEU']) ? 'M d' : 'd M';
    }
    //dateUSorEU: LuxCal 2.7.1
    if (empty($dbSet['MdyFormat'])) {
        $dbSet['MdyFormat'] = empty($dbSet['dateUSorEU']) ? 'M d, y' : 'd M y';
    }
    if (empty($dbSet['MyFormat'])) {
        $dbSet['MyFormat'] = empty($dbSet['dateUSorEU']) ? 'M y' : 'M y';
    }
    if (empty($dbSet['DMdFormat'])) {
        $dbSet['DMdFormat'] = empty($dbSet['dateUSorEU']) ? 'WD, M d' : 'WD d M';
    }
    if (empty($dbSet['DMdyFormat'])) {
        $dbSet['DMdyFormat'] = empty($dbSet['dateUSorEU']) ? 'WD, M d, y' : 'WD d M y';
    }
    if (empty($dbSet['timeFormat'])) {
        $dbSet['timeFormat'] = empty($dbSet['time24']) ? 'h:ma' : 'h.m';
    }
    //time24: LuxCal 2.7.1
    //check and complete settings
    checkSettings($dbSet);
    //if $dbSet['x'] empty, set to default value
    echo "<li>Calendar settings verified/completed.</li>\n";
    //save calendar settings to calendar
    $result = saveSettings($calID, $dbSet, true);
    if ($result === false) {
        exit('Error: Unable to save settings in database. Check database credentials.');
    }
    echo "<li>Calendar settings saved to database.</li>\n";
    return $result;
}
function pushToUser($user_id, $title, $message, $type, $typedata, $con)
{
    //get api key from https://code.google.com/apis/console/
    if (checkSettings($user_id, $type, $con)) {
        $regIds = getDeviceIdByUserId($user_id, $con);
        foreach ($regIds as $i => $regId) {
            $pusher = new Pusher();
            $pusher->notify($regId, $message, $title, $type, $typedata);
            pushLog($pusher->getOutputAsArray(), $con, $title, $message, $type, $typedata, $user_id, $regId);
        }
    }
}
    global $message, $pattern, $stack;
    $queryUrl = 'http://www.google.' . $CCTLD . '/search?q=' . urlencode('' . $keyword . ' "' . $operator . '"') . '&hl=' . $lng . '&start=' . $runDepth . '&pws=0' . '\\n';
    //$queryUrl= 'http://www.google.'.$CCTLD.'/search?q='.urlencode($keyword).'&hl='.$lng.'&start='.$runDepth.'&pws=0'.'\n';
    //echo $queryUrl."\n";
    echo 'Query: ' . $keyword . ' "' . $operator . '" - Start ' . $runDepth . "\n";
    $html = file_get_contents($queryUrl);
    $dom = new DOMDocument();
    @$dom->loadHTML($html);
    $x = new DOMXPath($dom);
    $i = 1;
    foreach ($x->query("//div[@id='ires']//h3//a") as $node) {
        delay();
        $url = $node->getAttribute('href');
        $url = trim($url, "/url?q=");
        $url = current(explode('&sa', $url));
        array_push($stack, $url);
        //echo $url."\n";
        $i++;
    }
}
checkSettings($exclDuplicateUrls, $stack);
function checkSettings($exclDuplicateUrls, $stack)
{
    //mark duplicates or delete duplicates > full url or domain option
    global $exclDuplicateUrls, $stack;
    if ($exclDuplicateUrls == '1') {
        print_r(array_unique($stack));
    } else {
        print_r($stack);
    }
}
Ejemplo n.º 4
0
             $resMsg[] = "<h5>Importing LuxCal calendar data successful</h5><br>";
             $resMsg[] = "From file '{$_FILES['fName']['name']}' (LuxCal V{$lcVBup})";
             $resMsg[] = "Into calendar '{$selCal}'";
             $resMsg[] = "<br>";
             $resMsg[] = "- Table events: {$count['eve']} records inserted";
             $resMsg[] = "- Table users: {$count['use']} records inserted";
             $resMsg[] = "- Table groups: {$count['gro']} records inserted";
             $resMsg[] = "- Table categories: {$count['cat']} records inserted";
             $resMsg[] = "- Table settings: {$count['set']} records inserted";
             $lcVUpg = upgradeDb();
             //upgrade db schema
             $resMsg[] = "<br>";
             $resMsg[] = "Imported database upgraded from V{$lcVUpg} to V" . substr($lcV, 0, 3);
             $dbSet = getSettings();
             //get imported settings
             checkSettings($dbSet);
             //check & complete settings
             saveSettings($dbSet);
             //save completed settings
             $resMsg[] = "<br>";
             $resMsg[] = "Imported settings verified/completed";
         } else {
             $errMsg[] = "The selected backup file could not be imported";
         }
         $stH = null;
         //release statement handle
         $dbH = null;
         //close db
 }
 //end of case
 session_unset();
Ejemplo n.º 5
0
        if (@in_array("2", $profileTypes)) {
            print "<input type=radio name=org value=2 {$orgCheck2}> " . $_lang[OrderUserPrivatePredprinimatel] . " ";
        }
        if (@in_array("3", $profileTypes)) {
            print "<input type=radio name=org value=3 {$orgCheck3}> " . $_lang[OrderUserOrg];
        }
        print "</td></tr>";
        print "<tr><td>" . $_lang[ProfileCountry] . ":</td><td>";
        printCountrySelect($country);
        echo "</td></tr>";
    }
    print "<tr><td colspan=2 align=center><BR><input class=button type=Submit value='" . $_lang[Save] . "'></td></tr></table><BR></form>";
    foot('utf-8');
}
if (!$workWithoutAuth) {
    if ($do != "profile" and $do != "tickets" and $do != "settings" and !checkSettings($_SESSION["userId"])) {
        $do = "";
        error($_lang[SettingsErrorYouCanWorkWithoutSettings] . " (" . $GLOBALerror . ")");
    } else {
        if ($do != "profile" and $do != "tickets" and $do != "settings" and !checkProfile(GetSetting("checkprofiletype"), $_SESSION["userId"])) {
            $do = "";
            $addButton = "<form action=billing.php method=post><input type=hidden name=do value=profile><input type=submit class=input value='" . $_lang["ButtonFillProfile"] . "'></form>";
            error($_lang[ProfileErrorYouCanWorkWithoutProfile], $addButton);
        } else {
            if ($do != "profile" and $do != "tickets" and $do != "settings" and !checkProfileByAdmin($_SESSION["userId"])) {
                $do = "";
                error($_lang[ProfileErrorYouCanWorkWithoutCheckedProfile]);
            }
        }
    }
}
Ejemplo n.º 6
0
/**
 * Load the Configuration Settings
 * @global database $config_db
 * @global API_Settings $api
 */
function loadSettings()
{
    global $config_db, $api;
    checkSettings();
    $api = new API_Settings();
    foreach ($config_db->query("SELECT " . "* " . "FROM " . "settings") as $row) {
        switch (strtoupper($row['Name'])) {
            case 'USEAPIKEY':
                $api->setUseAPIKey(strtoupper($row['Value']));
                break;
            case 'APIKEY_CONNECTION':
                $api->setAPIKeyConnection(strtolower($row['Value']));
                break;
            case 'APIKEY_TABLE':
                $api->setAPIKeyTable(strtolower($row['Value']));
                break;
            case 'APIKEY_FIELD':
                $api->setAPIKeyField(strtolower($row['Value']));
                break;
            case 'MAXRECORDS':
                $api->setMaxRecords($row['Name']);
                break;
        }
    }
}