switch ($action) { default: case 'index': $parameters = array(); $cloud = new Cloud(getConfigs()); $data = $cloud->index($parameters); break; case 'store': $time = time(); $cloud = new Cloud(getConfigs()); $parameters = array('name' => 'Sample ' . $time, 'description' => 'sample description maximum 500 character', 'enabled_domain_view' => 'example1.com,example2.com', 'enabled_domain_upload' => 'example1.net,example15.org'); $data = $cloud->store($parameters); break; case 'show': $parameters = array('id' => 'YourCloudId'); $cloud = new Cloud(getConfigs()); $data = $cloud->show($parameters); break; case 'update': $time = time(); $cloud = new Cloud(getConfigs()); $parameters = array('id' => 'YourCloudId', 'name' => 'Update Sample ' . $time, 'description' => 'sample description maximum 500 character', 'enabled_domain_view' => 'updated.example1.com,updated.example2.com', 'enabled_domain_upload' => 'updated.example1.net,updated.example15.org'); $data = $cloud->update($parameters); break; case 'delete': $parameters = array('id' => 'YourCloudId'); $cloud = new Cloud(getConfigs()); $data = $cloud->delete($parameters); break; } return $data;
<?php include '../src/ApiInterface.php'; include '../src/API.php'; include '../src/ShardImageAbstract.php'; include '../src/AccountInterface.php'; include '../src/Account.php'; include '../src/ResultInterface.php'; include '../src/Result.php'; if (file_exists('config.php')) { include 'config.php'; } use shardimage\shardimagephp\Account; $action = empty($_GET['action']) ? 'query' : $_GET['action']; $data = ''; switch ($action) { default: case 'query': $statistic = new Account(getConfigs()); $parameters = ['type' => 1, 'query_type' => 1, 'start_time' => date('Y-m-d', strtotime('-350days')), 'stop_time' => date('Y-m-d', strtotime('-1day'))]; $data = $statistic->query($parameters); break; } return $data;
<?php include '../src/ApiInterface.php'; include '../src/API.php'; include '../src/ShardImageAbstract.php'; include '../src/UrlInterface.php'; include '../src/Url.php'; include '../src/ResultInterface.php'; include '../src/Result.php'; if (file_exists('config.php')) { include 'config.php'; } use shardimage\shardimagephp\Url; $action = empty($_GET['action']) ? 'index' : $_GET['action']; $data = ''; switch ($action) { default: case 'index': $url = new Url(getConfigs()); $parameters = array('filename' => 'test.jpg', 'cloud_id' => 'YourCloudId', 'sign_url' => true, 'secret_key' => '83ff9f4e0d16d61727cbdf47d769fb707b652217', 'transformations' => array(array('resize' => array('width' => 1024, 'height' => 768)), array('widen' => 1024), array('heighten' => 768), array('fit' => 768), array('crop' => array('width' => 500, 'height' => 150, 'positionX' => 0, 'positionY' => 0)), array('rotate' => array('angle' => 70, 'color' => '111')))); $data = $url->create($parameters); break; case 'encrypt': $url = new Url(getConfigs()); $rules = 'widen:500_invert_grayscale'; $data = $url->encrypt($rules); break; } return $data;
<?php include '../src/ApiInterface.php'; include '../src/API.php'; include '../src/ShardImageAbstract.php'; include '../src/StatisticInterface.php'; include '../src/Statistic.php'; include '../src/ResultInterface.php'; include '../src/Result.php'; if (file_exists('config.php')) { include 'config.php'; } use shardimage\shardimagephp\Statistic; $action = empty($_GET['action']) ? 'query' : $_GET['action']; $data = ''; switch ($action) { default: case 'query': $statistic = new Statistic(getConfigs()); $parameters = ['cloud_id' => 1, 'type' => 1, 'query_type' => 1, 'start_time' => date('Y-m-d', strtotime('-350days')), 'stop_time' => date('Y-m-d', strtotime('-1day'))]; $data = $statistic->query($parameters); break; } return $data;
// ); $data = $image->upload($parameters); break; case 'show': $parameters = array('id' => 'YourImageId'); $image = new Image(getConfigs()); $data = $image->show($parameters); break; case 'delete': $parameters = array('id' => 'YourImageId'); $image = new Image(getConfigs()); $data = $image->delete($parameters); break; case 'batch-delete': $parameters = array('ids' => array('YourImageIds')); $image = new Image(getConfigs()); $data = $image->batchDelete($parameters); break; case 'delayed-delete': $parameters = array('ids' => array('YourImageIds')); $image = new Image(getConfigs()); $data = $image->delayedDelete($parameters); break; case 'restricted': $time = time(); $restricted = new Image(getConfigs()); $parameters = array('cloud_id' => 'YourCloudId', 'url' => 'http://youtu.be/nfWlot6h_JM?list=RDnfWlot6h_JM'); $data = $restricted->restricted($parameters); break; } return $data;
/** * 解析url成pathinfo形式,并获取参数 * http://www.herosphp.my/admin/member-login-index.html?id=12 */ public function parseURL() { $appConfigs = getConfigs(); //获取app配置 self::$urlMappingRules = $appConfigs['url_mapping_rules']; //优先处理短链接映射 $this->requestUri = self::url2source($this->requestUri); $_SERVER['REQUEST_URI'] = $this->requestUri; $defaultUrl = $appConfigs['default_url']; $urlInfo = parse_url($this->requestUri); if ($urlInfo['path'] && $urlInfo['path'] != '/') { $filename = str_replace(EXT_URI, '', $urlInfo['path']); $filename = rtrim($filename, "/"); $pathInfo = explode('/', $filename); array_shift($pathInfo); if ($pathInfo[0]) { $this->setModule($pathInfo[0]); } if ($pathInfo[1]) { $this->setAction($pathInfo[1]); } if ($pathInfo[2]) { $this->setMethod($pathInfo[2]); } //提取pathinfo参数 if (count($pathInfo) > 3) { if (isset($pathInfo[3])) { $params = explode('-', $pathInfo[3]); for ($i = 0; $i < count($params); $i++) { if ($i % 2 == 0) { if (trim($params[$i]) == '') { continue; } $_GET[$params[$i]] = $params[$i + 1]; } } } } //提取query参数 if (isset($urlInfo['query'])) { $params = explode('&', $urlInfo['query']); foreach ($params as $values) { $__p = explode('=', $values); if (trim($__p[0]) == '') { continue; } $_GET[$__p[0]] = $__p[1]; } } } //如果没有任何参数,则访问默认页面。如http://www.herosphp.my这种格式 if (!$this->module) { $this->setModule($defaultUrl['module']); } if (!$this->action) { $this->setAction($defaultUrl['action']); } if (!$this->method) { $this->setMethod($defaultUrl['method']); } $this->setParameters($_GET + $_POST); //die(); }
function guru_cronjobs() { $jnow = JFactory::getDate(); $date_today = $jnow->toSql(); $date_today_int = strtotime($date_today); $db = JFactory::getDBO(); $sql = "select last_check_date from #__guru_config where id=1"; $db->setQuery($sql); $db->query(); $last_check_date = $db->loadResult(); $int_last_check = strtotime($last_check_date); $day_last_check = date('d', $int_last_check); $day_today = date('d'); if ($day_today != $day_last_check) { $sql = "select * from #__guru_buy_courses"; $db->setQuery($sql); $db->query(); $all_courses = $db->loadAssocList(); $all_plans = getPlanExpiration(); if (isset($all_courses) && count($all_courses) > 0) { $guru_configs = getConfigs(); foreach ($all_courses as $course_key => $course_value) { $date_today_int = strtotime($date_today); $course_id = $course_value["course_id"]; $plan_id = intval($course_value["plan_id"]); $emails_for_course = getCourseEmails($course_id); //----------------------New Lesson Email------------------------------------ if (isset($emails_for_course) && count($emails_for_course) > 0) { foreach ($emails_for_course as $email_key => $email_value) { if ($email_value["term"] == "12") { $sql = "select DATE_FORMAT(p.start_release, '%Y-%m-%d') as start_release, p.course_type, p.lesson_release, p.lessons_show from #__guru_program p WHERE p.id=" . intval($course_id); $db->setQuery($sql); $db->query(); $coursetype_details = $db->loadAssocList(); if ($coursetype_details[0]["course_type"] == 1) { $start_relase_date = strtotime($coursetype_details[0]["start_release"]); $buy_date = strtotime($course_value["buy_date"]); $buy_date = date("Y-m-d", $buy_date); $buy_date = strtotime($buy_date); $next_release_date = $buy_date; $jnow = JFactory::getDate(); $my_today_date = $jnow->toSql(); $my_today_date = strtotime($my_today_date); $my_today_date = date("Y-m-d", $my_today_date); $my_today_date = strtotime($my_today_date); $release_count = 1; while ($next_release_date < $my_today_date) { if ($coursetype_details[0]["lesson_release"] == 1) { $next_release_date = strtotime('+1 day', $next_release_date); } elseif ($coursetype_details[0]["lesson_release"] == 2) { $next_release_date = strtotime('+1 week', $next_release_date); } elseif ($coursetype_details[0]["lesson_release"] == 3) { $next_release_date = strtotime('+1 month', $next_release_date); } else { break; } $release_count++; } $last_check_date = strtotime($last_check_date); if ($next_release_date > $last_check_date) { submitEmail2($email_value, $course_id, $course_value, @$order_expiration, $all_plans[$plan_id]["name"], $guru_configs, $release_count); } } } } //---------------------------------------------------------- if (isset($emails_for_course) && count($emails_for_course) > 0 && $course_value["email_send"] == 0) { if ($all_plans[$plan_id]["term"] != "0") { $order_expiration = strtotime($course_value["expired_date"]); $order_expiration_string = date("Y-m-d", $order_expiration); $order_expiration = strtotime($order_expiration_string); $date_totay_string = date("Y-m-d", $date_today_int); $date_today_int = strtotime($date_totay_string); foreach ($emails_for_course as $email_key => $email_value) { $alert_date = ""; if ($email_value["term"] == "0" && $date_today_int >= $order_expiration) { $order_expiration = date("Y-m-d H:i:s", $order_expiration); submitEmail($email_value, $course_id, $course_value, $order_expiration, $all_plans[$plan_id]["name"], $guru_configs); } elseif ($email_value["term"] != "0" && ($email_value["term"] >= 1 && $email_value["term"] <= 5)) { $alert_date = strtotime(getRealTerm($email_value["term"]) . " days", $order_expiration); } elseif ($email_value["term"] != "0" && ($email_value["term"] >= 6 && $email_value["term"] <= 10)) { $alert_date = strtotime(getRealTerm($email_value["term"]) . " days", $order_expiration); } if (trim($alert_date) != "") { $alert_date_string = date("Y-m-d H:i:s", $alert_date); $alert_date = strtotime($alert_date_string); } if (isset($alert_date) && trim($alert_date) != "" && $date_today_int >= $alert_date) { $order_expiration = date("Y-m-d H:i:s", $order_expiration); submitEmail($email_value, $course_id, $course_value, $order_expiration, $all_plans[$plan_id]["name"], $guru_configs); } } } $sql = "update #__guru_buy_courses set email_send = 1 where userid=" . intval($course_value["userid"]) . " and course_id = " . intval($course_id); $db->setQuery($sql); $db->query(); } //if sometime expire this course } //if we have emails for send } //foreach order //set today date to not check emails on this day $sql = "update #__guru_config set last_check_date='" . $date_today . "'"; $db->setQuery($sql); $db->query(); } //if we have courses } //if today not search }