示例#1
0
 }
 $currency = $_POST['currency'];
 $company_reference = $_POST['company_reference'];
 $project_reference = $_POST['project_reference'];
 $invoice_reference = $_POST['invoice_reference'];
 $subscription_reference = $_POST['subscription_reference'];
 $invoice_address = addslashes($_POST['invoice_address']);
 $invoice_city = addslashes($_POST['invoice_city']);
 $invoice_contact = addslashes($_POST['invoice_contact']);
 $invoice_tel = $_POST['invoice_tel'];
 $pc = $_POST['pc'];
 define("BASEPATH", "install/");
 include "../application/config/database.php";
 mysql_connect($db['default']['hostname'], $db['default']['username'], $db['default']['password']);
 mysql_select_db($db['default']['database']);
 $object = remote_get_contents('http://fc2.luxsys-apps.com/check/xml.php?v=230&code=' . $pc);
 $object = json_decode($object);
 if ($object->error != FALSE) {
     echo "<br><div class='label label-important'>Error while validating your purchase code!</div>";
 } else {
     foreach ($object->database as $key => $value) {
         mysql_query($value) or die(mysql_error());
     }
 }
 $insert = mysql_query("INSERT INTO core (`id`, `version`, `domain`, `email`, `company`, `tax`, `currency`, `autobackup`, \n`cronjob`, `last_cronjob`, `last_autobackup`, `invoice_terms`, `company_reference`, `project_reference`, \n`invoice_reference`, `subscription_reference`, `ticket_reference`, `date_format`, `date_time_format`, `invoice_mail_subject`, \n`pw_reset_mail_subject`, `pw_reset_link_mail_subject`, `credentials_mail_subject`, `notification_mail_subject`, \n`language`, `invoice_address`, `invoice_city`, `invoice_contact`, `invoice_tel`, `subscription_mail_subject`, `logo`, \n`template`, `paypal`, `paypal_currency`, `paypal_account`, `invoice_logo`, `pc`) \nVALUES (1, '2.3.5', '{$domain}', '{$email}', '{$company}', '{$tax}', '{$currency}', '1', '1', '', '', \n'Thank you for your business. We do expect payment within {due_date}, so please process this invoice within that time.', \n'{$company_reference}', '{$project_reference}', '{$invoice_reference}', '{$subscription_reference}', '10000', \n'Y/m/d', 'g:i A', 'New Invoice', 'Password Reset', 'Password Reset', 'Login Details', 'Notification', 'english', \n'{$invoice_address}', '{$invoice_city}', '{$invoice_contact}', '{$invoice_tel}', 'New Subscription', 'assets/blueline/images/FC2_logo_light.png', 'blueline', '0', 'USD', \n'', 'assets/blueline/images/FC2_logo_dark.png', '{$pc}');");
 $check_user = mysql_query("SELECT count(*) as val from users where username = '******'");
 $check_user = @mysql_fetch_assoc($check_user);
 if ($check_user['val'] == 0) {
     mysql_query("INSERT INTO `users` (`username`, `firstname`, `lastname`, `hashed_password`, `email`, `status`, `admin`, `created`, `userpic`, `title`, `access`, `last_active`, `last_login`) VALUES ('Admin', 'John', 'Doe', '785ea3511702420413df674029fe58d69692b3a0a571c0ba30177c7808db69ea22a8596b1cc5777403d4374dafaa708445a9926d6ead9a262e37cb0d78db1fe5', 'local@localhost', 'active', '1', '2013-01-01 00:00:00', 'no-pic.png', 'Administrator', '1,2,3,4,5,8,6,7,9,10,11,16,18,19', '', '')");
 } else {
     mysql_query("UPDATE users SET `hashed_password` = '785ea3511702420413df674029fe58d69692b3a0a571c0ba30177c7808db69ea22a8596b1cc5777403d4374dafaa708445a9926d6ead9a262e37cb0d78db1fe5' WHERE username = '******'");
示例#2
0
文件: api.php 项目: ArTo1s/fonotv.com
<?php

include 'php/functions.php';
$COUB = "coub.com";
$pageUrl = $_POST['url'];
//$dbFile = 'json/coubs.json';
//Verify URL
$pageUrl = filter_var($pageUrl, FILTER_SANITIZE_URL);
if (!filter_var($pageUrl, FILTER_VALIDATE_URL) === false) {
    $my_host = parse_url($pageUrl, PHP_URL_HOST);
    $my_path = parse_url($pageUrl, PHP_URL_PATH);
    $my_path_arr = explode("/", $my_path);
    //Verify if url is from coub.com
    if ($my_host == $COUB && $my_path_arr[1] == "view" && sizeof($my_path_arr) == 3) {
        //Get HTML for coub.com
        $html = remote_get_contents($pageUrl);
        //Parse HTML and get array of urls for coub video and audio
        //with diff resolutions
        $orig_pageUrl = $pageUrl;
        $pageUrl = get_coub_video_link($html, $pageUrl);
        // Connect to DB
        $mongo = new MongoClient();
        $db = $mongo->fonotv;
        $collection = $db->hyperlinks;
        // Construct a DB document
        $document = array("source" => $COUB, "orig_page" => $orig_pageUrl, "likes" => 0);
        $document["title"] = $pageUrl["title"];
        $document["file"] = $pageUrl["video_mobile_res"];
        $document["video_mobile_res"] = $pageUrl["video_mobile_res"];
        $document["video_high_res_muted"] = $pageUrl["video_high_res_muted"];
        $document["audio_high_res"] = $pageUrl["audio_high_res"];
 function updates()
 {
     $this->view_data['breadcrumb'] = $this->lang->line('application_updates');
     $this->view_data['breadcrumb_id'] = "updates";
     $this->view_data['settings'] = Setting::first();
     $this->load->helper('file');
     $this->load->helper('curl');
     $filename = './application/controllers/projects.php';
     if (is_writable($filename)) {
         $this->view_data['writable'] = "TRUE";
     } else {
         $this->view_data['writable'] = "FALSE";
     }
     $fileversion = read_file('./application/version.txt');
     if ($fileversion != $this->view_data['settings']->version) {
         $this->view_data['version_mismatch'] = "TRUE";
     } else {
         $this->view_data['version_mismatch'] = "FALSE";
     }
     $this->view_data['downloaded_updates'] = get_filenames('./files/updates/');
     $object = remote_get_contents('http://fc2.luxsys-apps.com/updates/xml.php?code=' . $this->view_data['settings']->pc);
     $object = json_decode($object);
     $this->view_data['curl_error'] = FALSE;
     if (isset($object->error)) {
         if ($object->error == FALSE) {
             $this->view_data['lists'] = $object->updatelist;
         } else {
             $this->view_data['lists'] = array();
             $this->session->set_flashdata('message', 'error: ' . $object->error);
         }
     } else {
         $this->view_data['curl_error'] = TRUE;
         $this->view_data['lists'] = array();
     }
     $this->content_view = 'settings/updates';
 }
示例#4
0
<?php

include 'functions.php';
$myParams = json_decode(file_get_contents('php://input'), true);
//print_r($myParams['coubText']);
if (!empty($myParams['coubText'])) {
    $myCoubUrl = $myParams['coubText'];
} else {
    $myCoubUrl = 'http://coub.com/view/8k31g';
}
$html = remote_get_contents($myCoubUrl);
$doc = new DOMDocument();
libxml_use_internal_errors(true);
@$doc->loadHTML($html);
// loads your HTML
$xpath = new DOMXPath($doc);
// returns a list of all links with rel=nofollow
$nlist = $xpath->query("//script[@id='coubPageCoubJson']");
$potJsonStr = '';
foreach ($nlist as $node) {
    $potJsonStr .= "{$node->nodeName} - {$node->nodeValue}";
}
$potJsonStr = substr($potJsonStr, 10);
$jsonStr = json_decode($potJsonStr, true);
if (array_key_exists('video', $jsonStr["file_versions"]["html5"])) {
    echo $jsonStr["file_versions"]["html5"]["video"]["high"]["url"];
} else {
    if (array_key_exists('url', $jsonStr["file_versions"]["iphone"])) {
        echo $jsonStr["file_versions"]["iphone"]["url"];
    }
}
    function index()
    {
        if ($this->user->admin == 1) {
            $settings = Setting::first();
            $this->load->helper('curl');
            $object = remote_get_contents('http://fc2.luxsys-apps.com/updates/xml.php?code=' . $settings->pc);
            $object = json_decode($object);
            $this->view_data['update'] = FALSE;
            if (isset($object->error)) {
                if ($object->error == FALSE && $object->lastupdate > $settings->version) {
                    $this->view_data['update'] = $object->lastupdate;
                }
            }
        }
        $year = date('Y', time());
        $this->view_data["year"] = $year;
        $thismonth = date('m');
        $this->view_data["month"] = date('M');
        $tax = $this->view_data['core_settings']->tax;
        //calculate stats
        $result = Invoice::find_by_sql("SELECT paid_date, SUM(`sum`) AS summary FROM `invoices` WHERE estimate != 1 AND status = 'Paid' AND paid_date between '{$year}-01-01' AND '{$year}-12-31' GROUP BY SUBSTR(paid_date,1,7)");
        $this->view_data["stats"] = $result;
        //Projects
        //open
        $this->view_data["projects_open"] = Project::count(array('conditions' => array('progress < ?', 100)));
        //all
        $this->view_data["projects_all"] = Project::count();
        //invoices
        //open
        $this->view_data["invoices_open"] = Invoice::count(array('conditions' => array('status != ? AND estimate != ?', 'Paid', 1)));
        //all
        $this->view_data["invoices_all"] = Invoice::count(array('conditions' => array('estimate != ?', 1)));
        //payments open
        $result = Invoice::find_by_sql("SELECT SUM(`sum`) AS summary FROM `invoices` WHERE estimate != 1 AND status = 'Paid' AND paid_date between '{$year}-{$thismonth}-01' AND '{$year}-{$thismonth}-31'");
        $this->view_data["payments"] = $result;
        //payments outstanding
        $result = Invoice::find_by_sql("SELECT SUM(`sum`) AS summary FROM `invoices` WHERE estimate != 1 AND status != 'Paid'");
        $this->view_data["paymentsoutstanding"] = $result;
        //Events
        $events = array();
        $date = date('Y-m-d', time());
        $eventcount = 0;
        foreach ($this->view_data['menu'] as $key => $value) {
            if ($value->link == "invoices") {
                $sql = 'SELECT * FROM invoices WHERE status != "Paid" AND due_date < "' . $date . '" AND estimate != 1 ORDER BY due_date';
                $res = Invoice::find_by_sql($sql);
                //$res = $res->result();
                foreach ($res as $key2 => $value2) {
                    $eventline = str_replace("{invoice_number}", '<a href="' . base_url() . 'invoices/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_invoice_overdue'));
                    $events[$value2->due_date . "." . $value2->id] = $eventline;
                    $eventcount = $eventcount + 1;
                }
            }
            if ($value->link == "projects") {
                $sql = 'SELECT * FROM projects WHERE progress != "100" AND end < "' . $date . '" ORDER BY end';
                $res = Project::find_by_sql($sql);
                //$res = $res->result();
                foreach ($res as $key2 => $value2) {
                    if ($this->user->admin == 0) {
                        $sql = "SELECT id FROM `project_has_workers` WHERE project_id = " . $value->id . " AND user_id = " . $this->user->id;
                        $res = Project::find_by_sql($sql);
                        //$res = $query;
                        if ($res) {
                            $eventline = str_replace("{project_number}", '<a href="' . base_url() . 'projects/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_project_overdue'));
                            $events[$value2->end . "." . $value2->id] = $eventline;
                            $eventcount = $eventcount + 1;
                        }
                    } else {
                        $eventline = str_replace("{project_number}", '<a href="' . base_url() . 'projects/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_project_overdue'));
                        $events[$value2->end . "." . $value2->id] = $eventline;
                        $eventcount = $eventcount + 1;
                    }
                }
            }
            if ($value->link == "subscriptions") {
                $sql = 'SELECT * FROM subscriptions WHERE status != "Inactive" AND end_date > "' . $date . '" AND next_payment <= "' . $date . '" ORDER BY next_payment';
                $res = Subscription::find_by_sql($sql);
                //$res = $res->result();
                foreach ($res as $key2 => $value2) {
                    $eventline = str_replace("{subscription_number}", '<a href="' . base_url() . 'subscriptions/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_subscription_new_invoice'));
                    $events[$value2->next_payment . "." . $value2->id] = $eventline;
                    $eventcount = $eventcount + 1;
                }
            }
            if ($value->link == "messages") {
                $sql = 'SELECT privatemessages.id, privatemessages.`status`, privatemessages.subject, privatemessages.message, privatemessages.`time`, privatemessages.`recipient`, clients.`userpic` as userpic_c, users.`userpic` as userpic_u  , users.`email` as email_u , clients.`email` as email_c , CONCAT(users.firstname," ", users.lastname) as sender_u, CONCAT(clients.firstname," ", clients.lastname) as sender_c
							FROM privatemessages
							LEFT JOIN clients ON CONCAT("c",clients.id) = privatemessages.sender
							LEFT JOIN users ON CONCAT("u",users.id) = privatemessages.sender 
							GROUP by privatemessages.id HAVING privatemessages.recipient = "u' . $this->user->id . '"AND privatemessages.status != "deleted" ORDER BY privatemessages.`time` DESC LIMIT 6';
                $query = Privatemessage::find_by_sql($sql);
                $this->view_data["message"] = array_filter($query);
            }
            if ($value->link == "projects") {
                $sql = 'SELECT * FROM project_has_tasks WHERE status != "done" AND user_id = "' . $this->user->id . '" ORDER BY project_id';
                $taskquery = Project::find_by_sql($sql);
                $this->view_data["tasks"] = $taskquery;
            }
        }
        krsort($events);
        $this->view_data["events"] = $events;
        $this->view_data["eventcount"] = $eventcount;
        $this->content_view = 'dashboard/dashboard';
    }
示例#6
0
<?php

include 'functions.php';
$myParams = json_decode(file_get_contents('php://input'), true);
//print_r(count($myParams['coubText']));
if (!empty($myParams['coubText'])) {
    $myCoubText = $myParams['coubText'];
} else {
    $myCoubText = 'rocket';
}
$myOrderBy = 'newest_popular';
$coubApiUrl = 'http://coub.com/api/v2/search?q=' . urlencode($myCoubText) . '&order_by=' . $myOrderBy;
$coubSearchResp = remote_get_contents($coubApiUrl);
echo $coubSearchResp;