function flushItemsByPlugin($pluginName)
 {
     global $databases;
     $xmls = new XMLStruct();
     $manifest = @file_get_contents(ROOT . "/plugins/{$pluginName}/index.xml");
     if ($manifest && $xmls->open($manifest)) {
         if ($xmls->doesExist('/plugin/binding/listener')) {
             //event listener가 있는 경우
             foreach ($xmls->selectNodes('/plugin/binding/listener') as $listener) {
                 if (!empty($listener['.attributes']['event']) && !empty($listener['.value'])) {
                     // Event가 있는 경우
                     if (strpos(strtolower($listener['.attributes']['event']), 'view') !== false) {
                         CacheControl::flushCategory();
                     }
                 }
             }
             unset($listener);
         }
         if ($xmls->doesExist('/plugin/binding/tag')) {
             foreach ($xmls->selectNodes('/plugin/binding/tag') as $tag) {
                 if (!empty($tag['.attributes']['name']) && !empty($tag['.attributes']['handler'])) {
                     CacheControl::flushCategory();
                     CacheControl::flushTag();
                 }
             }
             unset($tag);
         }
         //			if ($xmls->doesExist('/plugin/binding/sidebar')) {
         //			TODO:	사이드바 캐시때 처리하도록 하지요.
         //			}
         if ($xmls->doesExist('/plugin/binding/formatter[lang()]')) {
             CacheControl::flushCategory();
         }
     }
 }
示例#2
0
		function receive($xml = null) {
			if (empty($xml)) {
				if (empty($_SERVER['CONTENT_TYPE']) || empty($GLOBALS['HTTP_RAW_POST_DATA']) || ($_SERVER['CONTENT_TYPE'] != 'text/xml'))
					return false;
				$xmls = new XMLStruct();
				if ($xmls->open($GLOBALS['HTTP_RAW_POST_DATA']) == false) {
					return false;
				}
			} else {
				$xmls = new XMLStruct();
				if ($xmls->open($xml) == false) {
					return false;
				}
			}
			if ($xmls->error) {
				return false;
			}
			if (!isset($xmls->struct['methodCall'][0]['methodName'][0]['.value'])) {
				return false;
			}
			$this->methodName = $xmls->struct['methodCall'][0]['methodName'][0]['.value'];
			$params = $xmls->selectNodes('/methodCall/params/param');
			$this->params = array();
			for ($i = 0; $i < count($params); $i++) {
				if (!isset($params[$i]['value']))
					return false;
				array_push($this->params, $this->_decodeValue($params[$i]['value'][0]));
				
			}
			
			if (isset($this->_registry[$this->methodName])) {
				$result = call_user_func_array($this->_registry[$this->methodName], $this->params);
				if (is_a($result, 'XMLRPCFault'))
					$this->sendFault($result->code, $result->string);
				else
					$this->sendResponse($result);
			} else {
				$this->sendFault(1, 'Method was not found');
			}
			return true;
		}
示例#3
0
文件: skin.php 项目: ni5am/Textcube
function selectSkin($blogid, $skinName)
{
    $context = Model_Context::getInstance();
    importlib('blogskin');
    $blogid = getBlogId();
    if (empty($skinName)) {
        return _t('실패했습니다.');
    }
    if (strncmp($skinName, 'customize/', 10) == 0) {
        if (strcmp($skinName, "customize/{$blogid}") != 0) {
            return _t('실패 했습니다');
        }
    } else {
        $skinName = Path::getBaseName($skinName);
        if ($skinName === '.' || $skinName === '..') {
            return _t('실패 했습니다');
        }
    }
    if (file_exists(getSkinPath($skinName) . "/index.xml")) {
        $xml = file_get_contents(getSkinPath($skinName) . "/index.xml");
        $xmls = new XMLStruct();
        if (!$xmls->open($xml, $context->getProperty('service.encoding'))) {
            return _t('실패했습니다.');
        }
        $assignments = array('skin' => $skinName);
        $value = $xmls->getValue('/skin/default/recentEntries');
        if (!empty($value) || is_numeric($value)) {
            $assignments['entriesOnRecent'] = $value;
        }
        $value = $xmls->getValue('/skin/default/recentComments');
        if (!empty($value) || is_numeric($value)) {
            $assignments['commentsOnRecent'] = $value;
        }
        $value = $xmls->getValue('/skin/default/itemsOnGuestbook');
        if (!empty($value) || is_numeric($value)) {
            $assignments['commentsOnGuestbook'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tagsInCloud');
        if (!empty($value) || is_numeric($value)) {
            $assignments['tagsOnTagbox'] = $value;
        }
        $value = $xmls->getValue('/skin/default/sortInCloud');
        if (!empty($value) || is_numeric($value)) {
            $assignments['tagboxAlign'] = $value;
        }
        $value = $xmls->getValue('/skin/default/recentTrackbacks');
        if (!empty($value) || is_numeric($value)) {
            $assignments['trackbacksOnRecent'] = $value;
        }
        $value = $xmls->getValue('/skin/default/expandComment');
        if (isset($value)) {
            $assignments['expandComment'] = $value ? '1' : '0';
        }
        $value = $xmls->getValue('/skin/default/expandTrackback');
        if (isset($value)) {
            $assignments['expandTrackback'] = $value ? '1' : '0';
        }
        $value = $xmls->getValue('/skin/default/lengthOfRecentNotice');
        if (!empty($value) || is_numeric($value)) {
            $assignments['recentNoticeLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/lengthOfRecentPage');
        if (!empty($value) || is_numeric($value)) {
            $assignments['recentPageLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/lengthOfRecentEntry');
        if (!empty($value) || is_numeric($value)) {
            $assignments['recentEntryLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/lengthOfRecentComment');
        if (!empty($value) || is_numeric($value)) {
            $assignments['recentCommentLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/lengthOfRecentTrackback');
        if (!empty($value) || is_numeric($value)) {
            $assignments['recentTrackbackLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/lengthOfLink');
        if (!empty($value) || is_numeric($value)) {
            $assignments['linkLength'] = $value;
        }
        $value = $xmls->getValue('/skin/default/contentWidth');
        if (!empty($value) || is_numeric($value)) {
            $assignments['contentWidth'] = $value;
        }
        $value = $xmls->getValue('/skin/default/showListOnCategory');
        if (isset($value)) {
            $assignments['showListOnCategory'] = $value;
        }
        $value = $xmls->getValue('/skin/default/showListOnArchive');
        if (isset($value)) {
            $assignments['showListOnArchive'] = $value;
        }
        $value = $xmls->getValue('/skin/default/showListOnTag');
        if (isset($value)) {
            $assignments['showListOnTag'] = $value;
        }
        $value = $xmls->getValue('/skin/default/showListOnSearch');
        if (isset($value)) {
            $assignments['showListOnSearch'] = $value;
        }
        $value = $xmls->getValue('/skin/default/showListOnAuthor');
        if (isset($value)) {
            $assignments['showListOnAuthor'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/color');
        if (isset($value)) {
            $assignments['colorOnTree'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/bgColor');
        if (isset($value)) {
            $assignments['bgcolorOnTree'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/activeColor');
        if (isset($value)) {
            $assignments['activecolorOnTree'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/activeBgColor');
        if (isset($value)) {
            $assignments['activebgcolorOnTree'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/labelLength');
        if (!empty($value) || is_numeric($value)) {
            $assignments['labelLengthOnTree'] = $value;
        }
        $value = $xmls->getValue('/skin/default/tree/showValue');
        if (isset($value)) {
            $assignments['showValueOnTree'] = $value ? '1' : '0';
        }
        foreach ($assignments as $name => $value) {
            Setting::setSkinSetting($name, $value, $blogid);
        }
        if ($xmls->doesExist('/skin/support')) {
            foreach ($xmls->selectNodes('/skin/support') as $support) {
                if (!empty($support['.attributes']['mobile']) && $support['.attributes']['mobile'] == "yes") {
                    /// Main skin supports mobile, too.
                    Setting::setBlogSetting('useiPhoneUI', 0, true);
                } else {
                    Setting::setBlogSetting('useiPhoneUI', 1, true);
                }
            }
        } else {
            Setting::setBlogSetting('useiPhoneUI', 1, true);
        }
        // none/single/multiple
        $value = $xmls->getValue('/skin/default/commentMessage/none');
        if (is_null($value)) {
            Setting::setBlogSetting('noneCommentMessage', NULL, true);
        } else {
            Setting::setBlogSetting('noneCommentMessage', $value, true);
        }
        $value = $xmls->getValue('/skin/default/commentMessage/single');
        if (is_null($value)) {
            Setting::setBlogSetting('singleCommentMessage', NULL, true);
        } else {
            Setting::setBlogSetting('singleCommentMessage', $value, true);
        }
        $value = $xmls->getValue('/skin/default/trackbackMessage/none');
        if (is_null($value)) {
            Setting::setBlogSetting('noneTrackbackMessage', NULL, true);
        } else {
            Setting::setBlogSetting('noneTrackbackMessage', $value, true);
        }
        $value = $xmls->getValue('/skin/default/trackbackMessage/single');
        if (is_null($value)) {
            Setting::setBlogSetting('singleTrackbackMessage', NULL, true);
        } else {
            Setting::setBlogSetting('singleTrackbackMessage', $value, true);
        }
    } else {
        Setting::setBlogSetting('noneCommentMessage', NULL, true);
        Setting::setBlogSetting('singleCommentMessage', NULL, true);
        Setting::setBlogSetting('noneTrackbackMessage', NULL, true);
        Setting::setBlogSetting('singleTrackbackMessage', NULL, true);
        Setting::setSkinSetting('skin', $skinName, $blogid);
    }
    Setting::removeBlogSetting("sidebarOrder", true);
    CacheControl::flushAll();
    CacheControl::flushSkin();
    Path::removeFiles(getSkinPath('customize/' . getBlogId()) . "/");
    Setting::getSkinSettings($blogid, true);
    // refresh skin cache
    return true;
}
示例#4
0
 if (!is_null($requiredMaxVersion)) {
     if (version_compare($currentTextcubeVersion, $requiredMaxVersion) > 0) {
         $disablePlugin = true;
     }
 }
 if (!is_null($requiredTextcubeVersion)) {
     if (version_compare($currentTextcubeVersion, $requiredTextcubeVersion) < 0) {
         $disablePlugin = true;
     }
 }
 if ($disablePlugin == false) {
     if ($xmls->doesExist('/plugin/version')) {
         $version = $xmls->getValue('/plugin/version');
     }
     if ($xmls->doesExist('/plugin/storage')) {
         foreach ($xmls->selectNodes('/plugin/storage/table') as $table) {
             $storageMappings = array();
             $storageKeymappings = array();
             if (empty($table['name'][0]['.value'])) {
                 continue;
             }
             $tableName = htmlspecialchars($table['name'][0]['.value']);
             if (!empty($table['fields'][0]['field'])) {
                 foreach ($table['fields'][0]['field'] as $field) {
                     if (!isset($field['name'])) {
                         continue;
                     }
                     // Error? maybe loading fail, so skipping is needed.
                     $fieldName = $field['name'][0]['.value'];
                     if (!isset($field['attribute'])) {
                         continue;
示例#5
0
				echo '<script type="text/javascript">alert("'._f('%1는 잘못된 형식의 파일입니다.', $_FILES['importFile']['name']).'");</script>';
				$_FILES = null;
				exit;
			}

			$opmlCacheDir = ROOT . '/cache/opml';
			$tmpFilename = md5($_SERVER['REMOTE_ADDR'].time()).'.xml';
			if (!is_dir($opmlCacheDir)) func::mkpath($opmlCacheDir);
			if (!is_writable($opmlCacheDir) || !move_uploaded_file($_FILES['importFile']['tmp_name'], $opmlCacheDir.'/'.$tmpFilename)) {
				echo '<script type="text/javascript">alert("'._t('파일 가져오기에 실패했습니다.\n날개가 설치된 폴더와 cache 폴더에 쓰기 권한이 있는지 확인해주세요.').'");</script>';
				exit;
			}

			$xmls = new XMLStruct();
			$xmls->openFile($opmlCacheDir.'/'.$tmpFilename, true);
			$xmlURLs = func::multiarray_values($xmls->selectNodes("/opml/body/outline"), 'xmlUrl');

			if (count($xmlURLs)==0) {
				echo '<script type="text/javascript">alert("'._t('바른 형식의 OPML 파일이 아닙니다.').'");</script>';
				exit;
			}

			echo '<script type="text/javascript">"'._t('피드를 추가하고 있습니다').'";</script>';
			flush();
			$_feeder = new Feed;
			foreach($xmlURLs as $xmlURL) {		
				if (empty($xmlURL)) continue; 
				$_feeder->add($xmlURL);			
			}

			@unlink($opmlCacheDir.'/'.$tmpFilename);
		function createPluginTable($pluginName) {		
			requireComponent('LZ.PHP.XMLStruct');
			$xmls = new XMLStruct;
			if (!$xmls->openFile(ROOT . '/plugins/'. $pluginName .'/index.xml'))
				return '';

			if ($xmls->doesExist('/plugin/storage')) {

				foreach ($xmls->selectNodes('/plugin/storage/table') as $table) {
					$storageMappings = array();
					$storageKeymappings = array();					 
					if(empty($table['name'][0]['.value'])) continue;
					$tableName = htmlspecialchars($table['name'][0]['.value']);
					if (!empty($table['fields'][0]['field'])) {
						foreach($table['fields'][0]['field'] as $field) 
						{
							if (!isset($field['name']))
								continue; // Error? maybe loading fail, so skipping is needed.
							$fieldName = $field['name'][0]['.value'];
						
							if (!isset($field['attribute']))
								continue; // Error? maybe loading fail, so skipping is needed.
							$fieldAttribute = $field['attribute'][0]['.value'];
						
							$fieldLength = isset($field['length']) ? $field['length'][0]['.value'] : -1;
							$fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1;
							$fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null;
							$fieldAutoIncrement = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] : 0;
						
							array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault, 'autoincrement' => $fieldAutoIncrement));
						}
					}
					if (!empty($table['key'][0]['.value'])) {
						foreach($table['key'] as $key) {
							array_push($storageKeymappings, $key['.value']);
						}
					}
					
					plugin::treatPluginTable($pluginName, $tableName,$storageMappings,$storageKeymappings, $version);
					
					unset($tableName);
					unset($storageMappings);
					unset($storageKeymappings);
				}
			}

		}