Example #1
0
 public function __construct()
 {
     $this->_var3 = App::USER();
     $this->_var4 = App::DB();
     Modules::includeModule("catalog");
     $this->_var5 = new CatalogElement();
     $this->_var6 = array("CATALOG_ID" => 3, "CATALOG_TYPE" => "some_catalog");
 }
Example #2
0
 *  В будущем вообще необходимо исключить какую либо инициализацию в ядре.
 *  При использовании Скриптоцыда как библиотеки все должно происходить 
 *  через инициализацию в классе приложения(Application) Который можно унаследовать
 *  И там уже пределить и параметры БД и другие параметры.
 */
$APPLICATION = $APP = App::getInstance();
$APPLICATION->setTitle(Storage::get()->SITE_NAME);
$APPLICATION->setDescr($descr);
$DB = App::DB();
// $APP->DB; //App::get()->DB;
Storage::add("DB", $DB);
if (!isset($_SESSION['WEB_SERFER'])) {
    $_SESSION['WEB_SERFER'] = array("IP" => $_SERVER["REMOTE_ADDR"], "BROWSER" => $_SERVER["HTTP_USER_AGENT"], "WEB_ID" => md5(GetRandom(8) . $_SERVER["REMOTE_ADDR"]));
}
$_SESSION['WEB_SERFER']["LAST_ACTIVITY"] = time();
$USER = App::USER();
$bIsAdmin = $USER->IsAdmin();
Storage::add("USER", $USER);
// [Рудименты]
if (Storage::exists("APP_TEMPLATE")) {
    App::get()->templateName = Storage::get("APP_TEMPLATE");
}
if (!Storage::exists("SITE_NAME")) {
    Storage::add("SITE_NAME", "");
}
if (!Storage::exists("SITE_DESCRIPTION")) {
    Storage::add("SITE_DESCRIPTION", "");
}
App::get()->setTitle(Storage::get()->SITE_NAME);
App::get()->setDescr(Storage::get()->SITE_DESCRIPTION);
// [/Рудименты]
Example #3
0
 /**
  * Подключить шаблон компонента
  * @global array $CTLANG
  * @global object $USER
  * @param string $componentTemplateFileName
  * @return bool
  */
 protected function connectComponentTemplate($componentTemplateFileName = self::DEFAULT_TEMPLATE_FILENAME)
 {
     global $CTLANG;
     $APPLICATION = $APP = App::get();
     $USER = App::USER();
     if (!$this->_templatePath) {
         throw new ComponentException('Шаблон "<b>' . $this->_templateName . '</b>" компонента "<b>' . $this->_componentNamespace . ':' . $this->_componentName . '</b>" не существует', ComponentException::E_WRONG_TPL_NAME);
         return false;
     }
     if (!preg_match('#^[a-zA-Z0-9\\-\\_\\.]{1,30}$#', $componentTemplateFileName)) {
         throw new ComponentException('Неверно указано имя файла шаблона', ComponentException::E_WRONG_CMP_NAME);
         return false;
     }
     // Создаем ссылки для видимости внутри файлов компонента и шаблона
     $arParams =& $this->_arParams;
     $arResult =& $this->_arResult;
     // Подрубаем шаблон
     if (!file_exists(DOC_ROOT . $this->_templatePath . '/' . $componentTemplateFileName . '.php')) {
         throw new ComponentException('Файл <b>' . $componentTemplateFileName . '</b> шаблона "<b>' . $this->_templateName . '</b>" компонента "<b>' . $this->_componentNamespace . ':' . $this->_componentName . '</b>" не найден', ComponentException::E_WRONG_TPL_NAME);
         return false;
     }
     // Подрубаем язык шаблона
     $langFilesPath = DOC_ROOT . $this->_templatePath . '/lang/' . LANG_ID;
     if (is_dir($langFilesPath)) {
         Lang::getLangFilesLocale($langFilesPath);
     }
     include DOC_ROOT . $this->_templatePath . '/' . $componentTemplateFileName . '.php';
     /*/
     		// Если указали имя файла-шаблона, то ищем сначала файл <имя.файла-шаблона>.after.php
     		if ( file_exists(DOC_ROOT.$this->_templatePath.'/'.$componentTemplateFileName.'.after.php') ) {
     			include DOC_ROOT.$this->_templatePath . $componentTemplateFileName.'.after.php';
     		}
     		// Если имя файла шаблона стандартное, то можем подрубить файл after.php без префикса в имени
     		elseif(
     			$componentTemplateFileName == self::DEFAULT_TEMPLATE_FILENAME
     			&&
     			file_exists(DOC_ROOT.$this->_templatePath.'/after.php')
     		) {
     			include DOC_ROOT.$this->_templatePath.'/after.php';
     		}
     		//*/
     // Очищаем данные отработавшего компонента.
     $arResult = array();
     $arParams = array();
 }
<?php

namespace ScriptAcid;

require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php";
App::page(function (&$arPageParams) {
    ?>

<?php 
    App::USER()->Authorize('1');
    SetTitle('Проект "ScriptACID CMF"');
    ?>

<?php 
    App::callComponent('system:catalog.section', '_default:default', array('TYPE' => 'orion_locations', 'CATALOG_ID' => '3', 'CACHE_TIME' => '3600', 'COMPONENT_AJAX_MODE' => 'OFF', 'LIST_URL' => '', 'ELEMENT_URL' => '', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N'));
    ?>


<?php 
    App::callComponent('system:catalog.element.add', '_default:default', array('TYPE' => 'orion_locations', 'FIELDS' => array('1' => 'ID', '2' => 'NAME', '3' => 'CATALOG_SECTION_ID', '4' => 'CODE', '5' => 'PREVIEW_PICTURE', '6' => 'PREVIEW_TEXT', '7' => 'PREVIEW_TEXT_TYPE', '8' => 'DETAIL_PICTURE', '9' => 'DETAIL_TEXT'), 'CATALOG_ID' => '3', 'ID' => '{%_GET[ID]}', 'ACTION_PARAMETER' => '{%_GET[ACTION]}', 'COMPONENT_AJAX_MODE' => 'OFF', 'CACHE_TIME' => '3600', 'LIST_URL' => '/test/test_edit_component_call.php', 'ELEMENT_URL' => '/test/test_edit_component_call.php?ID=#ID#', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N'));
    ?>

<?php 
    App::callComponent('test:empty', '_default:default', array('CACHE_TIME' => '36001', 'COMPONENT_AJAX_MODE' => 'OFF', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N'));
    App::callComponent('test:empty', '_default:default', array('CACHE_TIME' => '36002', 'COMPONENT_AJAX_MODE' => 'OFF', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N'));
    ?>

<?php 
    // d(ComponentTools::getComponentListInFile('public_page'))
    ?>
Example #5
0
<?php

namespace ScriptAcid;

require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/kernel.php";
SetTitle('Проект "ScriptACID CMF"');
App::get()->makePage(function (&$arPageParams) {
    ?>
<p class="some-class">Тест работы Плугинов ScriptACID CMF</p>
<?php 
    App::USER()->Authorize("1");
    plg::addPlugins("/test/plugin_test/plugin_dir1/", true);
    plg::addPlugins("/test/plugin_test/plugin_dir2/");
    plg::addPlugins("/test/plugin_test/plugin_dir3/");
    plg::printPluginDirs();
    plg::test1('param1', 'param2');
    plg::test2('param1', 'param2', 'param3');
    plg::test3('param1', 'param2', 'param3');
});
// end of makePage
Example #6
0
<?php

namespace ScriptAcid;

require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/kernel.php";
SetTitle("Завершение сеанса пользователя");
//App::get()->makePage(function(&$arPageParams) {
?>

<?php 
if (App::USER()->IsAuthorized() and $_GET['logout'] == 'Y') {
    App::USER()->UnAuthorize();
    ShowMsg('Заходите к нам еще!');
    RedirectTo('/', 3000);
} else {
    ShowError('Вы не вошли');
}
?>

<?php 
// }); // end of makePage
Example #7
0
<?php

namespace ScriptAcid;

require_once $_SERVER['DOCUMENT_ROOT'] . '/scriptacid/core/application.php';
//App::callComponent(":menu","top",	Array("TYPE" => "top"));
try {
    if (!App::USER()->IsAdmin()) {
        throw new AppErrorException('Error: operation denied.', 0);
    }
    //$_POST['file'];
    //$_POST['replace_component_num'];
    //$_POST['component_name'];
    //$_POST['template_name'];
    //$_POST['replacement_params'];
    unset($_POST['currentCall']['obArParams']['COMPONENT_AJAX_READY']);
    //unset($_POST['replacement_params']['COMPONENT_AJAX_SEND_PAGE_POST']);
    unset($_POST['replacementCall']['obArParams']['COMPONENT_CALL_KEY']);
    //d($_POST);
    if (!@isset($_POST['currentCall']['inFileComponentNum'])) {
        throw new ComponentException('component number in file not set', ComponentException::E_CMP_EDIT_WRONG_CMP_NUM);
    }
    if (!is_file(DOC_ROOT . $_POST['currentCall']['inFile'])) {
        throw new ComponentException('wrong file name for edit', ComponentException::E_CMP_EDIT_WRONG_FILE);
    }
    $arReplacementCall = ComponentTools::makeComponentCallArray($_POST['replacementCall']['componentName'], $_POST['replacementCall']['templateName'] . ':' . $_POST['replacementCall']['templateSkin'], $_POST['replacementCall']['obArParams']);
    if ($arReplacementCall['COMPONENT_EXISTS'] == 'N') {
        throw new ComponentException('wrong component name', ComponentException::E_WRONG_CMP_NAME);
    }
    if ($arReplacementCall['TEMPLATE_EXISTS'] == 'N') {
        throw new ComponentException('wrong template name', ComponentException::E_WRONG_TPL_NAME);
Example #8
0
<?php

namespace ScriptAcid;

require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php";
SetTitle('Проект "ScriptACID CMF"');
App::get()->makePage(function (&$arPageParams) {
    ?>

<p class="some-class">Тестовая версия ScriptACID CMF</p>
<?php 
    //soem test
    //Storage::define("USER", new User);
    //d(Storage::get()->USER);
    App::USER()->Authorize("1");
    ?>
UserID = <?php 
    echo App::USER()->GetID();
    ?>

<?php 
});
// end of makePage