Example #1
0
 public function actionShortUrl()
 {
     $query = "SELECT id, source_url FROM " . $this->_table . " WHERE m = '' LIMIT 10";
     $result = $this->db->createCommand($query)->queryAll();
     if (empty($result)) {
         die('Het roi');
     }
     $query = "UPDATE " . $this->_table . " SET short_url = :short_url WHERE id = :id";
     $urls = array();
     foreach ($result as $item) {
         $short_url = createShortUrl($item['source_url']);
         if (!empty($short_url)) {
             $urls[] = $short_url;
             $values = array(':id' => $item['id'], ':short_url' => $short_url);
             $this->db->createCommand($query)->bindValues($values)->execute();
         }
     }
     echo "<pre>" . print_r($urls, true) . "</pre>";
     echo '<meta http-equiv="refresh" content="1">';
     die;
 }
Example #2
0
    $params["icon_img"] = $ret["data"]["task_info"]["icon_image"];
    $params["appname"] = $ret["data"]["task_info"]["app_name"];
}
if ($params["icon_img"] == "") {
    $params["icon_img"] = $plugin_path . "/static/logo.png";
}
if ($params["appname"] == "") {
    $params["appname"] = "bigapp";
}
$params["title"] = $params["appname"] . $params["title"];
$params["dateline"] = time() + 600;
//!< 每10分钟拉一次最新打包的配置
//////////////////////////////////////////////////////////////
// 二维码链接生成短地址
$downurl = rtrim($_G['siteurl'], '/') . '/plugin.php?id=bigapp:mobile&method=down';
$params["downurl"] = createShortUrl($downurl);
//////////////////////////////////////////////////////////////
$pstr = json_encode($params);
$svalue = str_replace("\\u", "#u", $pstr);
$sql = "INSERT INTO " . DB::table('common_setting') . " values ('bigapp_mobile_setting','{$svalue}') " . "ON DUPLICATE KEY UPDATE svalue=values(svalue)";
DB::query($sql);
$ret = array("error_code" => 0, "sql" => $svalue);
//echo $svalue;
echo BIGAPPJSON::encode($ret);
die(0);
// 发送http请求
function httpRequest($url, $method = 'GET', $params = null)
{
    /*{{{*/
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
Example #3
0
	/**
* Launch Name of a Sitepage.
* @param integer SPID to launch
* @param integer ID of the level to launch to.
* @param integer ID of the variation to launch. 
* @returns integer Translated ID after launch
*/
	function launchSitepageName($in, $level, $variation) {
		global $db, $c;

		$out = translateState($in, $level, false);
		$sql = "SELECT * FROM sitepage_names WHERE SPID = $in AND VARIATION_ID = $variation";
		$query = new query($db, $sql);
		$query->getrow();
		$spid = $query->field("SPID");

		if ($spid == "" && $variation != 1) {
			$sql = "SELECT * FROM sitepage_names WHERE SPID = $in AND VARIATION_ID = $variation";

			$query = new query($db, $sql);
			$query->getrow();
			$spid = $query->field("SPID");
			$variation = 1;
		}

		if ($spid != "") {
			$name = addslashes($query->field("NAME"));

			$help = addslashes($query->field("HELP"));
			$short = $query->field("DIRECT_URL");

			if ($short != "") {
				createShortUrl($out, $variation, $short);
			}
			

			if ($name != "" || $help != "") { // Aenderung wegen Menünamen in type 2 und 3			
				$sql = "DELETE FROM sitepage_names WHERE SPID = $out AND VARIATION_ID = $variation";
				$query = new query($db, $sql);
				$sql = "INSERT INTO sitepage_names (SPID, VARIATION_ID, NAME, HELP, DIRECT_URL, DELETED, VERSION) VALUES ";
				$sql .= "($out, $variation, '$name', '$help', '$short', 0, $level)";
				$query = new query($db, $sql);
				$query->free();
			}
		}
		
		if (!$c["classicurls"]) { 
			launchURLPage($out, $variation);
		}
					
		return $out;
	}