当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::GetBySiteId方法代码示例

本文整理汇总了PHP中Site::GetBySiteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::GetBySiteId方法的具体用法?PHP Site::GetBySiteId怎么用?PHP Site::GetBySiteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Site的用法示例。


在下文中一共展示了Site::GetBySiteId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pay

 /**
  * @method POST
  */
 function pay()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         // parse request
         parse_str($this->request->data, $request);
         $site = Site::GetBySiteId($token->SiteId);
         $siteId = $site['SiteId'];
         $email = $site['PrimaryEmail'];
         $status = 'Active';
         $stripe_token = $request['token'];
         $plan = $request['plan'];
         // set API key
         Stripe::setApiKey(STRIPE_SECRET_KEY);
         // create a new customer and subscribe them to the plan
         $customer = Stripe_Customer::create(array("card" => $stripe_token, "plan" => $plan, "email" => $email));
         // get back the id and the end period for the plan
         $id = $customer->id;
         // get subscription information
         $subscription = $customer->subscriptions->data[0];
         $subscriptionId = $subscription->id;
         $stripe_status = $subscription->status;
         $stripe_plan = $subscription->plan->id;
         $stripe_planname = $subscription->plan->name;
         // subscribe to a plan
         Site::Subscribe($siteId, $status, $plan, 'stripe', $subscriptionId, $customerId);
         // return a json response
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:37,代码来源:pay.php

示例2: checkCaptcha

 /**
  * @method POST
  */
 function checkCaptcha()
 {
     // parse request
     parse_str($this->request->data, $request);
     $siteId = $request['siteId'];
     $pageUniqId = $request['pageId'];
     $recaptcha_challenge_field = $request['recaptcha_challenge_field'];
     $recaptcha_response_field = $request['recaptcha_response_field'];
     require_once '../libs/recaptchalib.php';
     $site = Site::GetBySiteId($siteId);
     $resp = recaptcha_check_answer($site['FormPrivateId'], $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field);
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'text/html';
     if ($resp->is_valid) {
         $response->body = 'OK';
     } else {
         $response->body = 'NOK';
     }
     return $response;
 }
开发者ID:bladep911,项目名称:respond,代码行数:23,代码来源:form.php

示例3: Create

 public static function Create($user, $canEdit, $canPublish, $canRemove, $canCreate)
 {
     session_start();
     $site = Site::GetBySiteId($user['SiteId']);
     $isSuperAdmin = false;
     if ($user['Email'] == SITE_ADMIN) {
         // set is superman
         $isSuperAdmin = true;
     }
     $isFirstLogin = 0;
     if ($site['LastLogin'] == null || $site['LastLogin'] == '') {
         $isFirstLogin = 1;
     }
     // determine whether user has a photo
     $hasPhotoUrl = true;
     if ($user['PhotoUrl'] == null || $user['PhotoUrl'] == '') {
         $hasPhotoUrl = false;
     }
     Site::SetLastLogin($site['SiteUniqId']);
     $directory = 'sites/' . $site['FriendlyId'] . '/';
     $_SESSION['UserId'] = $user['UserId'];
     $_SESSION['UserUniqId'] = $user['UserUniqId'];
     $_SESSION['Role'] = $user['Role'];
     $_SESSION['Language'] = $user['Language'];
     $_SESSION['IsSuperAdmin'] = $isSuperAdmin;
     $_SESSION['IsFirstLogin'] = $isFirstLogin;
     $_SESSION['Email'] = $user['Email'];
     $_SESSION['Name'] = $user['FirstName'] . ' ' . $user['LastName'];
     $_SESSION['FirstName'] = $user['FirstName'];
     $_SESSION['LastName'] = $user['LastName'];
     $_SESSION['HasPhotoUrl'] = $hasPhotoUrl;
     $_SESSION['PhotoUrl'] = $user['PhotoUrl'];
     $_SESSION['SiteId'] = $user['SiteId'];
     $_SESSION['SiteUniqId'] = $site['SiteUniqId'];
     $_SESSION['SiteFriendlyId'] = $site['FriendlyId'];
     $_SESSION['Domain'] = $site['Domain'];
     $_SESSION['Currency'] = $site['Currency'];
     $_SESSION['WeightUnit'] = $site['WeightUnit'];
     $_SESSION['Directory'] = $directory;
     $_SESSION['LogoUrl'] = $site['LogoUrl'];
     $_SESSION['sid'] = session_id();
     $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
     $_SESSION['SiteName'] = $site['Name'];
     $_SESSION['FileUrl'] = 'sites/' . $site['FriendlyId'] . '/files/';
     $_SESSION['TimeZone'] = $site['TimeZone'];
     $_SESSION['Type'] = $site['Type'];
     $_SESSION['CustomerId'] = $site['CustomerId'];
     // what can be edited and published
     if ($canEdit == 'All' || $canPublish == 'All' || $canRemove == 'All' || $canCreate == 'All') {
         $_SESSION['Access'] = 'All';
     } else {
         $_SESSION['Access'] = $canEdit . ',' . $canPublish . ',' . $canRemove . ',' . $canCreate;
     }
     $_SESSION['CanEdit'] = $canEdit;
     $_SESSION['CanPublish'] = $canPublish;
     $_SESSION['CanRemove'] = $canRemove;
     $_SESSION['CanCreate'] = $canCreate;
     if (strtoupper($site['Type']) == 'SUBSCRIPTION' && $site['CustomerId'] != NULL) {
         AuthUser::UpdateSubscription();
     } else {
         $_SESSION['Status'] = 'N/A';
         $_SESSION['Plan'] = 'N/A';
         $_SESSION['RenewalDate'] = NULL;
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:65,代码来源:AuthUser.php

示例4: post

 /**
  * @method POST
  */
 function post()
 {
     // get token
     $token = Utilities::ValidateJWTToken();
     $siteId = -1;
     parse_str($this->request->data, $request);
     // parse request
     // check if token is not null
     if ($token != NULL) {
         $siteId = $token->SiteId;
     } else {
         if (isset($request['siteId'])) {
             $siteId = $request['siteId'];
         } else {
             // return an unauthorized exception (401)
             return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
         }
     }
     // get a reference to the site
     $site = Site::GetBySiteId($siteId);
     // set directory an filename
     $dir = SITES_LOCATION . '/' . $site['FriendlyId'] . '/locales/';
     // array to store directories
     $list = array();
     if ($handle = opendir($dir)) {
         $blacklist = array('.', '..');
         while (false !== ($file = readdir($handle))) {
             if (!in_array($file, $blacklist)) {
                 array_push($list, $file);
             }
         }
         closedir($handle);
     }
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'application/json';
     $response->body = json_encode($list);
     return $response;
 }
开发者ID:bladep911,项目名称:respond,代码行数:42,代码来源:translation.php

示例5: PublishPage

 public static function PublishPage($pageId, $preview = false, $remove_draft = false)
 {
     $page = Page::GetByPageId($pageId);
     if ($page != null) {
         $site = Site::GetBySiteId($page['SiteId']);
         // test for now
         if ($site['UrlMode'] == 'static') {
             // for sites using static html pages (URL-based routing)
             Publish::PublishDynamicPage($page, $site, $preview, $remove_draft);
             // do not publish a static page for include only pages
             if ($page['IncludeOnly'] == 0) {
                 Publish::PublishStaticPage($page, $site, $preview, $remove_draft);
             }
             // inject controllers
             Publish::InjectControllers($site);
         } else {
             // publishes a dynamic version of the page (for sites using UI-ROUTER (html5, hashbang, etc)
             Publish::PublishDynamicPage($page, $site, $preview, $remove_draft);
             // inject states
             Publish::InjectStates($site);
         }
     }
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:23,代码来源:Publish.php

示例6: get

 /**
  * @method POST
  */
 function get()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         // get a reference to the site, user
         $site = Site::GetBySiteId($token->SiteId);
         parse_str($this->request->data, $request);
         // parse request
         $filename = $request['filename'];
         $folder = 'files';
         if (isset($_REQUEST['folder'])) {
             $folder = $_REQUEST['folder'];
         }
         if (FILES_ON_S3 == true) {
             // remove file on S3
             S3::RemoveFile($site, $filename, $folder);
         } else {
             // remove local file
             // remove file
             $path = SITES_LOCATION . '/' . $site['FriendlyId'] . '/' . $folder . '/' . $filename;
             if (file_exists($path)) {
                 $path = unlink($path);
             }
             // remove thumb
             $path = SITES_LOCATION . '/' . $site['FriendlyId'] . '/' . $folder . '/thumbs/' . $filename;
             if (file_exists($path)) {
                 $path = unlink($path);
             }
         }
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         // return an unauthorized exception (401)
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:nboss,项目名称:respond,代码行数:40,代码来源:file.php

示例7: get

 /**
  * @method GET
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $site = Site::GetBySiteId($authUser->SiteId);
         $directory = '../sites/' . $site['FriendlyId'] . '/js/custom/';
         //get all image files with a .less ext
         $files = glob($directory . "*.js");
         $arr = array();
         //print each file name
         foreach ($files as $file) {
             $f_arr = explode("/", $file);
             $count = count($f_arr);
             $filename = $f_arr[$count - 1];
             array_push($arr, $filename);
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($arr);
         return $response;
     } else {
         // return an unauthorized exception (401)
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:31,代码来源:script.php

示例8: PublishPage

 public static function PublishPage($pageId, $preview = false, $remove_draft = false)
 {
     $page = Page::GetByPageId($pageId);
     if ($page != null) {
         $site = Site::GetBySiteId($page['SiteId']);
         // test for now
         Publish::PublishTemplate($page, $site, $preview, $remove_draft);
         // do not publish a static page for include only pages
         if ($page['IncludeOnly'] == 0) {
             Publish::PublishStaticPage($page, $site, $preview, $remove_draft);
         }
     }
 }
开发者ID:bladep911,项目名称:respond,代码行数:13,代码来源:Publish.php

示例9: get

 /**
  * @method GET
  */
 function get($friendlyId)
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $siteId = $authUser->SiteId;
         $pageSize = 100;
         $orderBy = 'Created DESC';
         $page = 0;
         $pageTypeId = -1;
         $dir = '/';
         if ($friendlyId != 'root') {
             // get pagetype
             $pageType = PageType::GetByFriendlyId($friendlyId, $siteId);
             $pageTypeId = $pageType['PageTypeId'];
             $dir = strtolower($pageType['TypeS']) . '/';
         }
         // get site url
         $site = Site::GetBySiteId($authUser->SiteId);
         $dir = 'sites/' . $site['FriendlyId'] . '/files/';
         // get pages
         $list = Page::GetPages($siteId, $pageTypeId, $pageSize, $page, $orderBy);
         $pages = array();
         foreach ($list as $row) {
             $page = Page::GetByPageId($row['PageId']);
             $fullName = $row['FirstName'] . ' ' . $row['LastName'];
             $page['LastModifiedFullName'] = $fullName;
             $thumbUrl = '';
             if ($page['Image'] != '') {
                 if (strpos($page['Image'], 't-') !== false) {
                     $thumbUrl = $dir . $page['Image'];
                 } else {
                     $thumbUrl = $dir . 't-' . $page['Image'];
                 }
             }
             // set thumb
             $page['Thumb'] = $thumbUrl;
             $url = $page['FriendlyId'];
             if ($page['PageTypeId'] != -1) {
                 $pageType = PageType::GetByPageTypeId($page['PageTypeId']);
                 $url = strtolower($pageType['TypeS']) . '/' . $page['FriendlyId'];
             }
             // set url
             $page['Url'] = $url;
             // permissions are not applicable to this API call
             $page['CanEdit'] = '';
             $page['CanPublish'] = '';
             $page['CanRemove'] = '';
             $pages[$row['PageUniqId']] = $page;
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($pages);
         return $response;
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:64,代码来源:page.php

示例10: post

 /**
  * @method POST
  */
 function post()
 {
     parse_str($this->request->data, $request);
     $txn_type = $request['txn_type'];
     $status = $request['payer_status'];
     $siteId = $request['custom'];
     $email = $request['payer_email'];
     $payerId = $request['payer_id'];
     $item_name = $request['item_name'];
     // parse domain
     preg_match('#\\((.*?)\\)#', $item_name, $match);
     $domain = $match[1];
     // get reference to site
     $site = Site::GetBySiteId($siteId);
     // response was "VERIFIED"
     if ($status == 'verified' && $txn_type == 'subscr_signup') {
         $provider = 'PayPal';
         $status = 'Active';
         $subscriptionId = $payerId;
         $customerId = $email;
         // subscribe to a plan
         Site::Subscribe($siteId, $status, $plan, $provider, $subscriptionId, $customerId);
         // send success email to user
         $to = $site['PrimaryEmail'];
         $from = REPLY_TO;
         $fromName = REPLY_TO_NAME;
         $subject = BRAND . ': Thank your for subscribing to ' . BRAND;
         $file = APP_LOCATION . '/emails/subscribe-success.html';
         $replace = array('{{brand-logo}}' => '<img src="' . BRAND_LOGO . '" style="max-height:50px">', '{{brand}}' => BRAND, '{{reply-to}}' => REPLY_TO);
         // send
         Utilities::SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file);
         // send details email to admin
         $to = REPLY_TO;
         $from = REPLY_TO;
         $fromName = REPLY_TO_NAME;
         $subject = BRAND . ': New Subscriber';
         $file = APP_LOCATION . '/emails/subscribe-details.html';
         $replace = array('{{brand-logo}}' => '<img src="' . BRAND_LOGO . '" style="max-height:50px">', '{{brand}}' => BRAND, '{{reply-to}}' => REPLY_TO, '{{domain}}' => $domain, '{{siteid}}' => $site['SiteId'], '{{friendlyid}}' => $site['FriendlyId'], '{{provider}}' => $provider, '{{customerid}}' => $customerId);
         // send email from file
         Utilities::SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file);
     } else {
         // IPN response was "INVALID"\
     }
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'text/HTML';
     $response->body = 'Yah!!!';
     return $response;
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:51,代码来源:transaction.php

示例11: post

 /**
  * @method POST
  */
 function post()
 {
     parse_str($this->request->data, $request);
     $siteId = $request['custom'];
     // get reference to site
     $site = Site::GetBySiteId($siteId);
     $use_sandbox = false;
     // set whether to use a sandbox
     if ($site['PayPalUseSandbox'] == '1') {
         $use_sandbox = true;
     }
     $listener = new IpnListener();
     $listener->use_curl = false;
     $listener->use_sandbox = $use_sandbox;
     $listener->use_ssl = true;
     try {
         $verified = $listener->processIpn();
     } catch (Exception $e) {
         // fatal error trying to process IPN.
         exit(0);
     }
     // IPN response was "VERIFIED"
     if ($verified) {
         $processor = 'PayPal';
         if ($use_sandbox == true) {
             $processor .= ' (sandbox)';
         }
         $processorTransactionId = $request['txn_id'];
         $processorStatus = $request['payment_status'];
         $email = $request['payer_email'];
         $payerId = $request['payer_id'];
         $name = $request['first_name'] . ' ' . $request['last_name'];
         $shipping = $request['mc_handling'];
         $fee = $request['mc_fee'];
         $tax = $request['tax'];
         $total = $request['mc_gross'];
         $currency = $request['mc_currency'];
         $num_items = 1000;
         if (isset($request['num_cart_items'])) {
             $num_items = $request['num_cart_items'];
         }
         $items = array();
         // line-items (for receipt)
         $line_items = '';
         // set static URL
         $staticUrl = $site['Domain'];
         // get items
         for ($x = 1; $x <= $num_items; $x++) {
             if (isset($request['item_number' . $x])) {
                 $item_number = $request['item_number' . $x];
                 $item_name = $request['item_name' . $x];
                 $item_number = iconv("ISO-8859-1", "UTF-8", $item_number);
                 $item_name = iconv("ISO-8859-1", "UTF-8", $item_name);
                 $item_quantity = $request['quantity' . $x];
                 $item_total = $request['mc_gross_' . $x];
                 $item_price = floatval($item_total) / intval($item_quantity);
                 $item = array('ProductId' => $item_number, 'Name' => $item_name, 'Quantity' => $item_quantity, 'Price' => $item_price, 'Total' => $item_total);
                 // get product
                 $product = Product::GetByProductId($item_number);
                 // get download link
                 $download_link = '';
                 // check if there is a downloaded file for the product
                 if ($product['Download'] != '' && $product['Download'] != NULL) {
                     $download_link = '<br><a href="' . API_URL . '/transaction/download/{{transactionId}}/' . $item_number . '">Download</a>';
                 }
                 // setup currency for line items
                 $item_total = $item_total . ' ' . $currency;
                 $item_price = $item_price . ' ' . $currency;
                 // add $ for total and price
                 if ($currency == 'USD') {
                     $item_total = '$' . $item_total;
                     $item_price = '$' . $item_price;
                 }
                 $line_items .= '<tr style="border-bottom: 1px solid #f0f0f0;"><td>' . $item_name . '<br><small>' . $item_number . '</small>' . $download_link . '</td><td align="right">' . $item_price . '</td><td align="right">' . $item_quantity . '</td><td align="right">' . $item_total . '</td></tr>';
                 array_push($items, $item);
             }
         }
         $items_json = json_encode($items);
         $data_json = json_encode($_POST);
         // create receipt
         $receipt = $line_items;
         // add a transaction
         $transaction = Transaction::Add($site['SiteId'], $processor, $processorTransactionId, $processorStatus, $email, $payerId, $name, $shipping, $fee, $tax, $total, $currency, $items_json, $data_json, $receipt);
         // replace {{transactionId}} in line_items
         $line_items = str_replace('{{transactionId}}', $transaction['TransactionId'], $line_items);
         $site_logo = '';
         if ($site['LogoUrl'] != '' && $site['LogoUrl'] != NULL) {
             $site_logo = '<img src="' . $staticUrl . '/files/' . $site['LogoUrl'] . '" style="max-height:50px">';
         }
         // setup currency for line items
         $shipping = $shipping . ' ' . $currency;
         $tax = $tax . ' ' . $currency;
         $total = $total . ' ' . $currency;
         // add $ for total and price
         if ($currency == 'USD') {
             $shipping = '$' . $shipping;
             $tax = '$' . $tax;
//.........这里部分代码省略.........
开发者ID:bladep911,项目名称:respond,代码行数:101,代码来源:transaction.php

示例12: post

 /**
  * @method POST
  */
 function post()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         parse_str($this->request->data, $request);
         // parse request
         $pageTypeId = $request['pageTypeId'];
         $pageType = PageType::GetByPageTypeId($pageTypeId);
         $site = Site::GetBySiteId($pageType['SiteId']);
         // remove page type and pages from DB
         PageType::Remove($pageType['PageTypeId'], $token->SiteId);
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:nboss,项目名称:respond,代码行数:21,代码来源:pageType.php

示例13: post

 /**
  * @method POST
  */
 function post()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         // parse request
         parse_str($this->request->data, $request);
         $site = Site::GetBySiteId($token->SiteId);
         $siteId = $site['SiteId'];
         $email = $site['PrimaryEmail'];
         $status = 'Unsubscribed';
         $plan = '';
         $provider = '';
         $subscriptionId = '';
         $customerId = $site['CustomerId'];
         // set API key
         Stripe::setApiKey(STRIPE_SECRET_KEY);
         // retrieve customer
         $customer = Stripe_Customer::retrieve($site['CustomerId']);
         // unsubscribe
         $cu->subscriptions->retrieve($site['SubscriptionId'])->cancel();
         // unsubscribe to a plan
         Site::Subscribe($siteId, $status, $plan, $provider, $subscriptionId, $customerId);
         // send success email to user
         $to = $site['PrimaryEmail'];
         $from = REPLY_TO;
         $fromName = REPLY_TO_NAME;
         $subject = BRAND . ': You have successfully unsubscribed to ' . BRAND;
         $file = APP_LOCATION . '/emails/unsubscribe-success.html';
         $replace = array('{{brand-logo}}' => '<img src="' . BRAND_LOGO . '" style="max-height:50px">', '{{brand}}' => BRAND, '{{reply-to}}' => REPLY_TO);
         // send
         Utilities::SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file);
         // send details email to admin
         $to = REPLY_TO;
         $from = REPLY_TO;
         $fromName = REPLY_TO_NAME;
         $subject = BRAND . ': Unsubscribed';
         $file = APP_LOCATION . '/emails/unsubscribe-details.html';
         $replace = array('{{brand-logo}}' => '<img src="' . BRAND_LOGO . '" style="max-height:50px">', '{{brand}}' => BRAND, '{{reply-to}}' => REPLY_TO, '{{domain}}' => $domain, '{{siteid}}' => $site['SiteId'], '{{friendlyid}}' => $site['FriendlyId'], '{{provider}}' => $site['Provider'], '{{customerid}}' => $site['CustomerId']);
         // send email from file
         Utilities::SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file);
         // return a json response
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:51,代码来源:site.php

示例14: get

 /**
  * @method GET
  */
 function get()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         // get users
         $list = User::GetUsersForSite($token->SiteId, true);
         $site = Site::GetBySiteId($token->SiteId);
         $updated_list = array();
         //print each file name
         foreach ($list as $user) {
             $hasPhoto = false;
             $fullPhotoUrl = '';
             if ($user['PhotoUrl'] != '' && $user['PhotoUrl'] != '') {
                 $hasPhoto = true;
                 // set images URL
                 if (FILES_ON_S3 == true) {
                     $bucket = $site['Bucket'];
                     $imagesURL = str_replace('{{bucket}}', $bucket, S3_URL);
                     $imagesURL = str_replace('{{site}}', $site['FriendlyId'], $imagesURL);
                 } else {
                     $imagesURL = $site['Domain'];
                 }
                 $fullPhotoUrl = $imagesURL . '/files/thumbs/' . $user['PhotoUrl'];
             }
             $user['HasPhoto'] = $hasPhoto;
             $user['FullPhotoUrl'] = $fullPhotoUrl;
             array_push($updated_list, $user);
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($updated_list);
         return $response;
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:nboss,项目名称:respond,代码行数:43,代码来源:user.php

示例15: delete

 /**
  * @method DELETE
  */
 function delete($pageTypeUniqId)
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
         $site = Site::GetBySiteId($pageType['SiteId']);
         // remove pages for that pagetype in that site
         $dir = '../sites/' . $site['FriendlyId'] . '/' . $pageType['FriendlyId'];
         if (file_exists($dir)) {
             Utilities::RemoveDirectory($dir);
         }
         // remove page type and pages from DB
         PageType::Delete($pageType['PageTypeId']);
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:23,代码来源:pageType.php


注:本文中的Site::GetBySiteId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。