function ajax_loadFullTree($upToLevel = 0, $collection_id = '', $media_id = '', $package_id = '', $part_id = '') { $resultText = ''; // BEGIN $basePath = DCTL_PROJECT_PATH; $collectionPath = $basePath . $collection_id; if ($collection_id == '' || $upToLevel == 1) { // ALL COLLECTIONS $resultText .= '<ul>'; getCollectionList($basePath, &$collectionList); foreach ($collectionList['path'] as $key => $fPath) { getCollectionRecord($fPath, &$collectionRecord); $selected = $collection_id == $collectionRecord['collection_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="collection ' . ($selected ? ' selected' : '') . '">' . $collectionRecord['collection_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(2, $collection_id, $media_id, $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collectionRecord['collection_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Collection...</span></li>'; $resultText .= '</ul>'; } else { // ONE COLLECTION if ($package_id == '' && $media_id == '' || $upToLevel == 2) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Collection...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PACKAGES $resultText .= '<li' . ($package_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Package</span>'; if ($package_id != '') { $resultText .= ajax_loadTree(3, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($package_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; // LOAD MEDIA $resultText .= '<li' . ($media_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Media</span>'; if ($media_id != '') { $resultText .= ajax_loadTree(3, $collection_id, $media_id, '', $part_id, $what); } else { $resultText .= '<ul' . ($media_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&media_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { if ($package_id != '') { if ($package_id == '*' || $upToLevel == 3) { // ALL PACKAGES $basePath = $collectionPath; $packagePath = $basePath . $package_id; $resultText .= '<ul>'; getPackageList($basePath, &$packageList); foreach ($packageList['path'] as $key => $fPath) { getPackageRecord($fPath, &$packageRecord); $selected = $package_id == $packageRecord['package_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="package' . ($selected ? ' selected' : '') . '">' . $packageRecord['package_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(4, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $packageRecord['package_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Package...</span></li>'; $resultText .= '</ul>'; } else { if ($part_id == '' || $upToLevel == 4) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Package...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PARTS $resultText .= '<li' . ($part_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Part</span>'; if ($part_id != '') { $resultText .= ajax_loadTree(5, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($part_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $package_id . '&part_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { // ALL PARTS $basePath = $collectionPath . $package_id . SYS_PATH_SEP; $partPath = $basePath . $part_id; $resultText .= '<ul>'; getPartList($basePath, &$partList); foreach ($partList['path'] as $key => $fPath) { getPartRecord($fPath, &$partRecord); $selected = $part_id == $partRecord['part_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="part' . ($selected ? ' selected' : '') . '">' . cleanWebString($partRecord['part_short'] . ' - ' . $partRecord['part_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Scarica" class="dnload"><span class="hidden">Scarica</span></a>'; $resultText .= '<a href="#" title="Ricarica" class="upload"><span class="hidden">Ricarica</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Part...</span></li>'; $resultText .= '</ul>'; } } } if ($media_id != '') { // ALL MEDIA $basePath = $collectionPath . DCTL_MEDIA_BIG; $mediaPath = $basePath . $media_id; $resultText .= '<ul>'; getMediaList($basePath, &$mediaList); foreach ($mediaList['path'] as $key => $fPath) { getMediaRecord($fPath, &$mediaRecord); $selected = $media_id == $mediaRecord['media_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="media' . ($selected ? ' selected' : '') . '">' . cleanWebString($mediaRecord['media_short'] . ' - ' . $mediaRecord['media_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Aggiorna" class="update"><span class="hidden">Aggiorna</span></a>'; $resultText .= '<a href="#" title="Elimina" class="delete"><span class="hidden">Elimina</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Media...</span></li>'; $resultText .= '</ul>'; } } } return $resultText; }
/** * Created by PhpStorm. * User: godlee * Date: 2015/6/3 * Time: 22:17 */ $mypath = $_SERVER['DOCUMENT_ROOT'] . '/wechat'; include_once $mypath . '/includes/magicquotes.inc.php'; include_once $mypath . '/includes/db.inc.php'; include_once $mypath . '/includes/helpers.inc.php'; include_once $mypath . '/contrller/serveManager.php'; session_start(); if (isset($_SESSION['login']) && $_SESSION['login']) { if (isset($_GET['auto_reply'])) { if (isset($_GET['reply_type'])) { $mediaList = getMediaList($_GET['reply_type'], 0); foreach ($mediaList['item'] as $row) { $allList[] = json_encode($row, JSON_UNESCAPED_UNICODE); } } if (isset($_POST['content'])) { $_POST['key_word'] = trim($_POST['key_word']); $key = $_POST['key_word'] == '' ? '.' : preg_replace('/,|,/', '\\|', $_POST['key_word']); $content = addslashes($_POST['content']); switch ($_POST['type']) { case 'news': $postjsondata = json_encode(array('media_id' => $_POST['content'])); $content = getMedia($postjsondata); $content = addslashes($content); break; }