<?php require_once '../../configs/init.config.php'; require_once './classes/AddonYoutube.class.php'; $idx = Request('idx'); $IM = new iModule(); $Attachment = $IM->getModule('attachment'); if ($idx == null) { exit; } $results = new stdClass(); $youtubeInfo = $Attachment->getFileExtraInfo($idx, 'youtube'); if ($youtubeInfo != null) { $youtube = new AddonYoutube(); $data = $youtube->get('https://www.googleapis.com/youtube/v3/videos?part=status%2Csnippet%2CprocessingDetails%2Cplayer&id=' . $youtubeInfo->id); if ($data != null) { $item = $data->items[0]; $results->id = $item->id; $results->status = $item->status->uploadStatus; $Attachment->setFileExtraInfo($idx, 'youtube', $results); $results->thumbnail = $Attachment->getAttachmentUrl($idx, 'thumbnail'); if ($results->thumbnail == null) { $thumbnail = $youtube->saveThumbnail($item, $Attachment->getTempPath(true)); if ($thumbnail != null) { $file = $Attachment->db()->select($Attachment->table->attachment)->where('idx', $idx)->getOne(); $image = getimagesize($thumbnail); if ($Attachment->createThumbnail($thumbnail, $IM->getAttachmentPath() . '/' . $file->path . '.thumb', $image[0] <= $image[1] ? 200 : 0, $image[0] > $image[1] ? 200 : 0, true) == true) { $results->thumbnail = $Attachment->getAttachmentUrl($idx, 'thumbnail'); } } }
<?php require_once './configs/init.config.php'; $IM = new iModule(); if (Request('loggedIdx')) { $_SESSION['MEMBER_LOGGED'] = Encoder(json_encode(array('idx' => Request('loggedIdx'), 'time' => time(), 'ip' => $_SERVER['REMOTE_ADDR']))); } $IM->doLayout();
<?php header('Access-Control-Allow-Origin:*'); require_once '../configs/init.config.php'; $IM = new iModule(); $site = $IM->getSite(); if (isset($_SERVER['HTTP_AUTHORIZATION']) == true) { $IM->getModule('member')->loginByToken($_SERVER['HTTP_AUTHORIZATION']); } if (Request('module') != null) { $results = $IM->getModule(Request('module'))->getApi(Request('api')); if ($results !== null) { header("Content-type: text/json; charset=utf-8", true); exit(json_encode($results, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK)); } }
<?php require_once '../configs/init.config.php'; $IM = new iModule(); $site = $IM->getSite(); if (Request('module') != null) { $results = $IM->getModule(Request('module'))->doProcess(Request('action')); if ($results !== null) { header("Content-type: text/json; charset=utf-8", true); exit(json_encode($results, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK)); } }