Esempio n. 1
0
function ShopItemsEdit()
{
    global $smcFunc, $context, $txt, $scripturl, $sourcedir, $item_info;
    $context['shop_edit_message'] = '';
    // We need the subs!
    require_once $sourcedir . '/shop/Shop-Subs.php';
    // If we're editing something (they've clicked the 'Edit' link)
    if (isset($_GET['do']) && $_GET['do'] == 'edit') {
        // Make sure ID is numeric
        $_GET['id'] = (int) $_GET['id'];
        // Get the item's information
        $result = $smcFunc['db_query']('', "\n\t\t\tSELECT `name`, `desc`, price, stock, image,\n\t\t\t\tmodule, info1, info2, info3, info4,\n\t\t\t\tdelete_after_use, category\n\t\t\tFROM {db_prefix}shop_items\n\t\t\tWHERE id = {int:id}", array('id' => $_GET['id']));
        $row = $smcFunc['db_fetch_assoc']($result);
        $smcFunc['db_free_result']($result);
        // Set all the information (for use in the template)
        $context['shop_edit'] = array('id' => $_GET['id'], 'name' => $row['name'], 'desc' => $row['desc'], 'price' => $row['price'], 'stock' => $row['stock'], 'image' => $row['image'], 'delete_after_use' => $row['delete_after_use'], 'category' => $row['category']);
        // Images
        $context['shop_images'] = getImageList();
        // And categories
        $context['shop_categories'] = getCatList();
        // We need to grab the extra input required by this item.
        // The actual information.
        $item_info[1] = $row['info1'];
        $item_info[2] = $row['info2'];
        $item_info[3] = $row['info3'];
        $item_info[4] = $row['info4'];
        // Include the item engine (defaults and stuff)
        include $sourcedir . '/shop/item_engine.php';
        // Include the actual item
        require $sourcedir . '/shop/items/' . $row['module'] . '.php';
        // Create an instance of the item (it's used below)
        eval('$tempItem = new item_' . $row['module'] . ';');
        // Get the actual info
        $tempItem->getItemDetails();
        // Can we edit the getAddInput() info?
        if ($tempItem->addInput_editable == true) {
            $context['shop_edit']['addInputEditable'] = true;
            $context['shop_edit']['addInput'] = $tempItem->getAddInput();
        } else {
            $context['shop_edit']['addInputEditable'] = false;
        }
    } elseif (isset($_GET['do']) && $_GET['do'] == 'del') {
        // If nothing was chosen to delete
        // TODO: Should this just return to the do=edit page, and show the error there?
        if (!isset($_POST['delete'])) {
            fatal_lang_error('shop_item_delete_error');
        }
        // Make sure all IDs are numeric
        foreach ($_POST['delete'] as $key => $value) {
            $_POST['delete'][$key] = (int) $value;
        }
        // Start with an empty array of items
        $context['shop_delete'] = array();
        // Get information on all the items selected to be deleted
        $result = $smcFunc['db_query']('', '
			SELECT id, name
			FROM {db_prefix}shop_items
			WHERE id IN ({array_int:ids})
			ORDER BY name ASC', array('ids' => $_POST['delete']));
        // Loop through all the results...
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            // ... and add them to the array
            $context['shop_delete'][] = array('id' => $row['id'], 'name' => $row['name']);
        }
        $smcFunc['db_free_result']($result);
    } else {
        // If we're saving changes to the item
        if (isset($_GET['do']) && $_GET['do'] == 'edit2') {
            // Make sure some inputs are numeric
            $_POST['id'] = (int) $_POST['id'];
            $_POST['itemprice'] = (double) $_POST['itemprice'];
            $_POST['itemstock'] = (int) $_POST['itemstock'];
            $_POST['cat'] = (int) $_POST['cat'];
            // Delete from inventory after use?
            $delete = isset($_POST['itemdelete']) ? 1 : 0;
            // Additional fields to update
            $additional = '';
            if (isset($_POST['info1'])) {
                $additional .= ', `info1` = "' . intval($_POST['info1']) . '"';
            }
            if (isset($_POST['info2'])) {
                $additional .= ', `info2` = "' . intval($_POST['info2']) . '"';
            }
            if (isset($_POST['info3'])) {
                $additional .= ', `info3` = "' . intval($_POST['info3']) . '"';
            }
            if (isset($_POST['info4'])) {
                $additional .= ', `info4` = "' . intval($_POST['info4']) . '"';
            }
            // Get the old category
            $result = $smcFunc['db_query']('', "\n\t\t\t\tSELECT category\n\t\t\t\tFROM {db_prefix}shop_items\n\t\t\t\tWHERE id = {int:id}", array('id' => $_POST['id']));
            $row = $smcFunc['db_fetch_assoc']($result);
            $smcFunc['db_free_result']($result);
            // Update the item information
            $smcFunc['db_query']('', "\n\t\t\t\tUPDATE {db_prefix}shop_items\n\t\t\t\tSET\n\t\t\t\t\t`name` = {string:name},\n\t\t\t\t\t`desc` = {string:desc},\n\t\t\t\t\t`price` = {float:price},\n\t\t\t\t\t`stock` = {int:stock},\n\t\t\t\t\t`image` = {string:image},\n\t\t\t\t\t`delete_after_use` = {int:delete},\n\t\t\t\t\t`category` = {int:cat}\n\t\t\t\t\t{raw:additional}\n\t\t\t\tWHERE id = {int:id}\n\t\t\t\tLIMIT 1", array('name' => $_POST['itemname'], 'desc' => $_POST['itemdesc'], 'price' => $_POST['itemprice'], 'stock' => $_POST['itemstock'], 'image' => $_POST['icon'], 'delete' => $delete, 'cat' => $_POST['cat'], 'additional' => $additional, 'id' => $_POST['id']));
            // Increase count for the new category
            $smcFunc['db_query']('', "\n\t\t\t\tUPDATE {db_prefix}shop_categories\n\t\t\t\tSET count = count + 1\n\t\t\t\tWHERE id = {int:cat}", array('cat' => $_POST['cat']));
            // Decrease count for the old category
            $smcFunc['db_query']('', "\n\t\t\t\tUPDATE {db_prefix}shop_categories\n\t\t\t\tSET count = count - 1\n\t\t\t\tWHERE id = {int:cat}", array('cat' => $_POST['cat']));
            // This is used in the template for the message at the top
            $context['shop_edit_message'] = $txt['shop_saved'];
        } elseif (isset($_GET['do']) && $_GET['do'] == 'del2') {
            // If nothing was chosen to delete (shouldn't happen, but meh)
            if (!isset($_POST['delete'])) {
                fatal_lang_error($txt['shop_item_delete_error']);
            }
            // Make sure all IDs are numeric
            foreach ($_POST['delete'] as $key => $value) {
                $_POST['delete'][$key] = (int) $value;
            }
            // Delete all the items
            $smcFunc['db_query']('', '
				DELETE FROM {db_prefix}shop_items
				WHERE id IN ({array_int:ids})', array('ids' => $_POST['delete']));
            // If anyone owned this item, they don't anymore :P
            $smcFunc['db_query']('', '
				DELETE FROM {db_prefix}shop_inventory
				WHERE itemid IN ({array_int:ids})', array('ids' => $_POST['delete']));
            // This is used in the template for the message at the top
            $context['shop_edit_message'] = $txt['shop_deleted'];
        } elseif (isset($_GET['do']) && $_GET['do'] == 'add_success') {
            // Check if ID is numeric
            $_GET['id'] = (int) $_GET['id'];
            // Pass the message on to the template
            $context['shop_edit_message'] = $txt['shop_added_item'] . ' ' . $_GET['id'];
        }
        // If we got here, it means that we're on the main page (or we returned to it
        // after an action such as deleting an item).
        // OK, the first bit of this is for adding items:
        // Include the 'item engine' (skeleton item, with defaults)
        require $sourcedir . '/shop/item_engine.php';
        // Open the items directory
        if ($handle = opendir($sourcedir . '/shop/items')) {
            // Loop through all files in the items directory
            while (false !== ($file = readdir($handle))) {
                // If this item is a PHP file, then...
                if (substr($file, -4) == '.php') {
                    // Get the name (file name without .php extension)
                    $name = basename($file, '.php');
                    // Load this item
                    include $sourcedir . '/shop/items/' . $file;
                    // Code to check if object exists, and if so, create new instance of object
                    // TODO: Simplify, somehow?
                    $code = '
						if (class_exists(\'item_' . $name . '\'))
						{
							$tempItem = new item_' . $name . ';
							return true;
						}
						else
							return false;';
                    // If we could create an instance of the item...
                    if (eval($code) !== FALSE) {
                        // Get the item details
                        $tempItem->getItemDetails();
                        // Add this item to the list
                        $context['shop_add'][$tempItem->name] = array('name' => $name, 'friendlyname' => $tempItem->name, 'authorName' => $tempItem->authorName, 'authorWeb' => $tempItem->authorWeb, 'authorEmail' => $tempItem->authorEmail);
                    } else {
                        // Inform the user of the sad news... Their item is DEAD!
                        $context['shop_edit_message'] .= sprintf($txt['shop_item_error'], $name);
                    }
                }
            }
            // Sort the array by key (ie. by item name)
            ksort($context['shop_add']);
        } else {
            // Inform the user of this
            fatal_lang_error('shop_cannot_open_items');
        }
        // Now, for the edit items section:
        // Start with an empty list
        $context['shop_edit'] = array();
        // Get a list of all the item
        $result = $smcFunc['db_query']('', "\n\t\t\tSELECT name, id\n\t\t\tFROM {db_prefix}shop_items\n\t\t\tORDER by name ASC", array());
        // Loop through all the items
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            // Add this item to the list
            $context['shop_edit'][] = array('id' => $row['id'], 'name' => $row['name']);
        }
        $smcFunc['db_free_result']($result);
    }
    // Set the page title
    $context['page_title'] = $txt['shop'] . ' - ' . $txt['shop_admin_items_addedit'];
    // Tell the template what we want
    $context['sub_template'] = 'items_edit';
    // Load the template
    loadTemplate('ShopAdmin');
}
Esempio n. 2
0
		case '24':
			getPersonPermissions($uuid, $user, $pass);
			addComment($uuid, $comment, $status, $user, $pass);
			version();

		case '2.3':
			searchCount("test", "t");
			searchCountWithAuth("test", "t", $user, $pass);
			resetUserPassword($email);

		case '2.2':
			reReportPerson($uuid, $personXML, $eventShortname, $xmlFormat, $user, $pass);

		case '2.1':
			getImageCountsAndTokens($user, $pass);
			getImageList($tokenStart, $tokenEnd, $user, $pass);
			getImageListBlock($tokenStart, $stride, $user, $pass);
			getNullTokenList($tokenStart, $tokenEnd, $user, $pass);

		case '2.0':
			expirePerson($uuid, '', $user, $pass);
			getPersonExpiryDate($uuid);
			setPersonExpiryDate($uuid, $expiryDate, $user, $pass);
			setPersonExpiryDateOneYear($uuid, $user, $pass);
			getUuidByMassCasualtyId($mcid, $user, $pass);
			changeMassCasualtyId($newMcid, $uuid, $user, $pass);
			hasRecordBeenRevised($uuid, $user, $pass);
			getHospitalLegalese("1");
			getHospitalLegaleseAnon("1");
			getHospitalLegaleseTimestamps("1");
Esempio n. 3
0
function ajax_loadTree($selector = 1, $collection_id = '', $package_id = '', $part_id = '', $item_id = '', $what = '')
{
    $resultText = '';
    if (DCTL_EXT_IMT) {
    } else {
        switch ($what) {
            case 'lnk':
                break;
            case 'map':
                $resultText .= '<script>';
                $resultText .= '$(\'img#img_edit\').attr(\'src\', \'\').imgAreaSelect({disable:true, hide:true});';
                $resultText .= '$(\':input[name=xml_id1]\').removeClass(\'active\').val(\'\');';
                $resultText .= '$(\':input[name=xml_id2]\').removeClass(\'active\').val(\'\');';
                $resultText .= '$(\':input[name=xml_label]\').removeClass(\'active\').val(\'\');';
                $resultText .= '$(\':input[name=xml_lnk1id]\').removeClass(\'active\').val(\'\');';
                $resultText .= '$(\'#xml_tree2\').html(\'\');';
                $resultText .= '</script>';
                break;
            default:
                $resultText .= 'ERROR: CASE UNIMPLEMENTED IN ' . __FUNCTION__;
                break;
        }
    }
    // BEGIN
    $basePath = DCTL_PROJECT_PATH;
    $collectionPath = $basePath . $collection_id . SYS_PATH_SEP;
    if ($collection_id == '') {
        /*
        // ALL COLLECTIONS
        		$resultText .= '<ul>';
        		getCollectionList($basePath, &$collectionList);
        		foreach ($collectionList['path'] as $key=>$fPath) {
        			getCollectionRecord($fPath, &$collectionRecord);
        			$resultText .= '<li>';
        			$resultText .= '<span class="text">'.cleanWebString($collectionRecord['collection_short'].' - '.$collectionRecord['collection_work'], FIELD_STRING_LENGTH).'</span>';
        			$resultText .= '<ul class="ajax">';
        			$resultText .=			'<li>{url:indexAjax.php?action=ajax_loadTree&amp;selector='.$selector.'&amp;collection_id='.$collectionRecord['collection_id'].'}</li>';
        			$resultText .= '</ul>';
        			$resultText .= '</li>';
        		};
        		$resultText .= '</ul>';
        */
    } else {
        if ($package_id == '') {
            $resultText .= '<ul class="simpleTree">';
            getCollectionRecord($collectionPath, &$collectionRecord);
            $resultText .= '<li class="root">';
            $resultText .= '<span class="text">' . $collectionRecord['collection_full'] . '</span>';
        }
        $basePath = $collectionPath;
        $packagePath = $basePath . $package_id . SYS_PATH_SEP;
        // ONE COLLECTION
        if ($package_id == '') {
            // ALL PACKAGES
            $resultText .= '<ul>';
            getPackageList($basePath, &$packageList);
            foreach ($packageList['path'] as $key => $fPath) {
                getPackageRecord($fPath, &$packageRecord);
                $resultText .= '<li>';
                $resultText .= '<span class="text">' . $packageRecord['package_full'] . '</span>';
                $resultText .= '<ul class="ajax">';
                $resultText .= '<li>{url:indexAjax.php?action=ajax_loadTree&amp;selector=' . $selector . '&amp;collection_id=' . $collection_id . '&amp;package_id=' . $packageRecord['package_id'] . '&amp;what=' . $what . '}</li>';
                $resultText .= '</ul>';
                $resultText .= '</li>';
            }
            $resultText .= '</ul>';
        } else {
            // ONE PACKAGE
            $basePath = $packagePath;
            $partPath = $basePath . $part_id . SYS_PATH_SEP;
            if ($part_id == '') {
                // ALL PARTS
                $resultText .= '<ul>';
                getPartList($basePath, &$partList);
                foreach ($partList['path'] as $key => $fPath) {
                    getPartRecord($fPath, &$partRecord);
                    $resultText .= '<li>';
                    if (DCTL_EXT_IMT && $what == 'map') {
                        $resultText .= '<span class="text"><a href="javascript:void(0);" onclick="';
                        $resultText .= 'doProgress();$.post(\'indexAjax.php\',{action:\'ajax_loadTree\', selector:\'' . $selector . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $partRecord['part_id'] . '\', what:\'' . $what . '\'},';
                        $resultText .= ' function(' . DCTL_EXT_IMT_CBP . '){ commdodoro_initializeIMT(' . DCTL_EXT_IMT_CBP . '); killProgress();});';
                        $resultText .= '">' . cleanWebString($partRecord['part_short'] . ': ' . $partRecord['part_work'], FIELD_STRING_LENGTH) . '&#160;</a></span>';
                    } else {
                        $resultText .= '<span class="text" onclick="doProgress();$(this).next().load(\'indexAjax.php\',{action:\'ajax_loadTree\', selector:\'' . $selector . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $partRecord['part_id'] . '\', what:\'' . $what . '\'},function(){
		$(\'#xml_tree' . $selector . ' .simpleTree\').get(0).setTreeNodes(this, false);
		killProgress();
			}).insertAfter(this);">' . cleanWebString($partRecord['part_short'] . ': ' . $partRecord['part_work'], FIELD_STRING_LENGTH) . '&#160;</span>';
                        $resultText .= '<img src="' . DCTL_IMAGES . 'refresh.gif" class="refresh" alt="(refresh)" onclick="doProgress();$(this).next().load(\'indexAjax.php\',{action:\'ajax_loadTree\', selector:\'' . $selector . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $partRecord['part_id'] . '\', what:\'' . $what . '\'},function(){
		$(\'#xml_tree' . $selector . ' .simpleTree\').get(0).setTreeNodes(this, false);
		killProgress();
			}).insertAfter(this);" />';
                        $resultText .= '<ul class="ajax">';
                        $resultText .= '<li>{url:indexAjax.php?action=ajax_loadTree&amp;selector=' . $selector . '&amp;collection_id=' . $collection_id . '&amp;package_id=' . $package_id . '&amp;part_id=' . $partRecord['part_id'] . '&amp;what=' . $what . '}</li>';
                        $resultText .= '</ul>';
                    }
                    $resultText .= '</li>';
                }
                $resultText .= '</ul>';
            } else {
                $basePath = $partPath;
                $itemPath = $basePath . $item_id . SYS_PATH_SEP;
                // ONE PART
                if ($item_id == '') {
                    // ALL ITEMS
                    if (DCTL_EXT_IMT && $what == 'map') {
                        $resultText .= '<?xml version="1.0" encoding="UTF-8"?>';
                        $resultText .= '<dctl_ext_init>';
                        $resultText .= '<xml>';
                        if (getItemList($basePath, &$itemList, $what) > 0) {
                            $thePath = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP . DCTL_FILE_MAPPER;
                            if (is_file($thePath)) {
                                forceUTF8($thePath);
                                $simplexml = simplexml_load_file($thePath, 'SimpleXMLElement', DCTL_XML_LOADER);
                                $namespaces = $simplexml->getDocNamespaces();
                                foreach ($namespaces as $nsk => $ns) {
                                    if ($nsk == '') {
                                        $nsk = 'tei';
                                    }
                                    $simplexml->registerXPathNamespace($nsk, $ns);
                                }
                                $simplexml = simplexml_load_string(str_ireplace('xml:id', 'id', $simplexml->asXML()), 'SimpleXMLElement');
                                foreach ($itemList['path'] as $key => $fPath) {
                                    $uri = 'xml://' . $collection_id . '/' . $package_id . '/' . $itemList['item_id'][$key];
                                    $content = $itemList['item_short'][$key];
                                    $ref = '';
                                    $target = '';
                                    $label = '';
                                    $fullItem = $uri;
                                    $fullItem = preg_replace('/(\\.\\d\\d\\d)/', '.001', $fullItem);
                                    $resultXML = $simplexml->xpath('//*[contains(@target,\'' . $fullItem . '\') and substring(substring-after(@target,\'' . $fullItem . '\'),1,1) != "."]');
                                    if (count($resultXML) > 0) {
                                        foreach ($resultXML as $n => $link) {
                                            $attrs = $link->attributes();
                                            foreach (explode(' ', $link['target']) as $k => $v) {
                                                if ($v != '') {
                                                    if ($v != $fullItem) {
                                                        $ref = $attrs['id'];
                                                        $target = $v;
                                                        $label = $attrs['n'];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    $resultText .= '<a';
                                    $resultText .= ' r="' . $ref . '"';
                                    $resultText .= ' s="' . $uri . '"';
                                    $resultText .= ' t="' . $target . '"';
                                    $resultText .= ' l="' . $label . '"';
                                    $resultText .= ' c="' . $content . '"';
                                    $resultText .= ' />';
                                }
                            } else {
                                dump('ERRORE');
                            }
                        }
                        $resultText .= '</xml>';
                        $resultText .= '<img>';
                        if (getImageList($basePath, &$imageList) > 0) {
                            $key = 0;
                            if (isset($imageList['path'][$key])) {
                                $uri = 'img://' . $imageList['image_id'][$key];
                                $url = DCTL_EXT_URL . '/indexAjax.php?&amp;action=get_file&amp;collection_id=' . $collection_id . '&amp;url=' . DCTL_MEDIA_MED . $imageList['image_id'][$key];
                                $label = $imageList['image_short'][$key];
                                $resultText .= '<a';
                                $resultText .= ' s="' . $uri . '"';
                                $resultText .= ' u="' . $url . '"';
                                $resultText .= ' l="' . $label . '"';
                                $resultText .= ' />';
                            }
                        }
                        $resultText .= '</img>';
                        $resultText .= '<cb';
                        $resultText .= ' u="' . DCTL_EXT_IMT_CB . '"';
                        $resultText .= ' p="' . DCTL_EXT_IMT_CBP . '"';
                        $resultText .= ' />';
                        $resultText .= '</dctl_ext_init>';
                        $resultText = base64_encode($resultText);
                        //base64_encode
                    } else {
                        $resultText .= '<script>';
                        switch ($what) {
                            case 'lnk':
                                break;
                            case 'map':
                                $resultText .= '$(\'#xml_tree' . ($selector + 1) . '\').load(\'indexAjax.php\', {action:\'ajax_loadImageList\', selector:\'' . ($selector + 1) . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $part_id . '\', what:\'' . $what . '\'});';
                                break;
                            default:
                                $resultText .= 'alert(\'ERROR: CASE UNIMPLEMENTED IN ...' . __FUNCTION__ . '\');';
                                break;
                        }
                        $resultText .= '</script>';
                        if (getItemList($basePath, &$itemList, $what) > 0) {
                            $resultText .= '<ul>';
                            foreach ($itemList['path'] as $key => $fPath) {
                                getItemRecord($fPath, &$itemRecord, $itemList['item_short'][$key]);
                                $resultText .= '<li>';
                                $resultText .= '<span class="text">';
                                if ($itemRecord['item_id'] != '') {
                                    $resultText .= '<a href="javascript:void(0);" onclick="';
                                    // carica XML
                                    $resultText .= '$(\'#xml_chunk\').load(\'indexAjax.php\', {action:\'ajax_loadChunk\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $part_id . '\', item_id:\'' . $itemRecord['item_short'] . '\', what:\'' . $what . '\'});';
                                    // carica ID
                                    $resultText .= '$(\':input[name=xml_id' . $selector . ']\').addClass(\'active\').attr({value:\'' . 'xml://' . $collection_id . SYS_PATH_SEP . $package_id . SYS_PATH_SEP . $itemRecord['item_short'] . '\'});';
                                    switch ($what) {
                                        case 'lnk':
                                            // carica LINK
                                            $resultText .= '$(\'#xml_lnk' . $selector . '\').load(\'indexAjax.php\', {action:\'ajax_loadLinkList\', selector:\'' . $selector . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $part_id . '\', item_id:\'' . $itemRecord['item_short'] . '\', what:\'' . $what . '\'}, function(){$(\'#xml_lnk' . $selector . ' .simpleTree\').simpleTree({activeLeaf: false}); });';
                                            $resultText .= '" title="#">';
                                            $resultText .= cleanWebString($itemRecord['item_short'] . ': ' . $itemRecord['item_work'], FIELD_STRING_LENGTH);
                                            break;
                                        case 'map':
                                            $mapped = ajax_loadLinkList($selector, $collection_id, $package_id, $part_id, $itemRecord['item_id'], $what);
                                            $mapped = preg_match('/(.*)\\?(.*)\\#(.*)\\@(.*)/', $mapped, $matches);
                                            if ($mapped) {
                                                $ref = $matches[1];
                                                $label = $matches[2];
                                            } else {
                                                $ref = '';
                                                $label = $itemRecord['item_work'];
                                            }
                                            $resultText .= '$(\':input[name=xml_label]\').removeClass(\'active\').val(\'' . str_ireplace('&apos;', "\\'", $label) . '\');';
                                            $resultText .= '$(\':input[name=xml_id2]\').removeClass(\'active\').val(\'\');';
                                            $resultText .= '$(\':input[name=xml_lnk1id]\').addClass(\'active\').attr({value:\'' . $ref . '\'});';
                                            $resultText .= '$(\'#xml_tree' . ($selector + 1) . '\').load(\'indexAjax.php\', {action:\'ajax_loadImageList\', selector:\'' . ($selector + 1) . '\', collection_id:\'' . $collection_id . '\', package_id:\'' . $package_id . '\', part_id:\'' . $part_id . '\', item_id:\'' . $itemRecord['item_short'] . '\', what:\'' . $what . '\'}';
                                            if ($mapped) {
                                                $uri = $matches[3];
                                                $img = str_ireplace('img://', $collection_id . SYS_PATH_SEP . DCTL_MEDIA_BIG, $uri);
                                                $coord = explode(',', $matches[4]);
                                                $resultText .= ', function () {';
                                                $img = ajax_loadImage($img, $dim, $what);
                                                $resultText .= ajax_loadImageMap($selector, $itemRecord['item_id'], $uri, $img, $dim, $coord, $what);
                                                $resultText .= '}';
                                            }
                                            $resultText .= ');';
                                            $resultText .= '" title="#">';
                                            if ($mapped) {
                                                $resultText .= '<span class="dctl_ok">';
                                                $resultText .= cleanWebString($itemRecord['item_short'] . ': ' . $itemRecord['item_work'], FIELD_STRING_LENGTH);
                                                $resultText .= '</span>';
                                                $resultText .= '&#160;&#160;<img src="' . DCTL_IMAGES . 'published_no.png" alt="delete" onclick="deleteLink(\'' . $matches[1] . '\',\'' . $matches[3] . '@' . $matches[4] . '\',\'' . $matches[2] . '\', \'' . $what . '\')" />';
                                            } else {
                                                $resultText .= cleanWebString($itemRecord['item_short'] . ': ' . $itemRecord['item_work'], FIELD_STRING_LENGTH);
                                            }
                                            break;
                                        default:
                                            $resultText .= 'alert(\'ERROR: CASE UNIMPLEMENTED IN ...' . __FUNCTION__ . '\');';
                                            $resultText .= '" title="#">';
                                            $resultText .= cleanWebString($itemRecord['item_short'] . ': ' . $itemRecord['item_work'], FIELD_STRING_LENGTH);
                                            break;
                                    }
                                    $resultText .= '</a>';
                                } else {
                                    $resultText .= '<em class="dctl_ko">';
                                    $resultText .= cleanWebString($itemRecord['item_short'] . ': ' . $itemRecord['item_work'], FIELD_STRING_LENGTH);
                                    $resultText .= '</em>';
                                }
                                $resultText .= '</span>';
                                $resultText .= '</li>';
                            }
                            $resultText .= '</ul>';
                        } else {
                            $resultText .= '<li><i>nessun id</i></li>';
                        }
                    }
                } else {
                    $resultText .= 'UNIMPLEMENTED';
                }
            }
        }
        if (DCTL_EXT_IMT && $what == 'map') {
            // nothing
        } else {
            $resultText .= '</li>';
            $resultText .= '</ul>';
        }
    }
    return $resultText;
}
Esempio n. 4
0
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the License.
*/
/** ensure this file is being included by a parent file */
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
$mosConfig_secret = mamboCore::get('mosConfig_secret');
require $mosConfig_absolute_path . '/mambots/editors/mostlyce/jscripts/tiny_mce/auth_check.php';
$result = externalCallCheck($mosConfig_absolute_path, $mosConfig_secret);
if (!$result) {
    die(T_('Direct Access to this location is not allowed.'));
}
$task = trim(mosGetParam($_GET, 'task', ''));
switch (strtolower($task)) {
    case 'imagelist':
        getImageList();
        break;
    case 'contentlist':
        getContentList();
        break;
    default:
        die(T_('Direct Access to this location is not allowed.'));
        break;
}
/**
*	Purpose: This function creates a list of images to be displayed as a dropdown in all image dialogs 
*	if the "external_link_image_url" option is defined in TinyMCE init.
*
*	Expected output:
*	var tinyMCEImageList = new Array(
*		// Name, URL