상속: extends Aro
예제 #1
0
 public static function Create($p_sessionId, &$p_objectId, $p_objectTypeId = null, $p_userId = null, $p_updateStats = false)
 {
     if (empty($p_sessionId)) {
         throw new SessionIdNotSet();
     }
     $session = new Session($p_sessionId);
     if (!$session->exists()) {
         $sessionParams = array('start_time' => strftime("%Y-%m-%d %T"));
         if (!empty($p_userId)) {
             $sessionParams['user_id'] = $p_userId;
         }
         $session->create($sessionParams);
     }
     $sessionUserId = $session->getUserId();
     if (!empty($p_userId) && !empty($sessionUserId) && $sessionUserId != $p_userId) {
         throw new InvalidUserId();
     }
     $requestObject = new RequestObject($p_objectId);
     if (!$requestObject->exists()) {
         if (empty($p_objectTypeId)) {
             throw new ObjectTypeIdNotSet();
         }
         $requestObject->create(array('object_type_id' => $p_objectTypeId));
         $p_objectId = $requestObject->getObjectId();
     } elseif (empty($p_objectId)) {
         throw new ObjectIdNotSet();
     }
     if ($p_updateStats) {
         self::UpdateStats($p_sessionId, $p_objectId);
     }
 }
예제 #2
0
 function __construct()
 {
     global $Core;
     $Request = new RequestObject();
     $this->com = $Request->get('com');
     if (empty($this->com)) {
         $this->com = 'skin';
         $Request->com = 'skin';
     }
     if (!in_array($this->com, $this->valid_coms)) {
         Core::SBRedirect(SKINNER_URL . "&com=skin");
     }
     $Controller = MVC::getController($Request);
     $Controller->execute();
     $Controller->display();
 }
예제 #3
0
    <span class="ui-icon"></span>
    <a href="#" tabindex="-1"><?php 
echo $translator->trans('Info', array(), 'articles');
?>
</a></h3>
  </div>
  <div class="padded clearfix">
    <dl class="inline-list">
      <dt><?php 
echo $translator->trans('Reads');
?>
</dt>
      <dd>
        <?php 
if ($articleObj->isPublished()) {
    $requestObject = new RequestObject($articleObj->getProperty('object_id'));
    echo $requestObject->exists() ? $requestObject->getRequestCount() : '0';
} else {
    echo $translator->trans('N/A');
}
?>
      </dd>
      <dt><?php 
echo $translator->trans('Type');
?>
</dt>
      <dd><?php 
print htmlspecialchars($articleType->getDisplayName());
?>
</dd>
      <dt><?php 
예제 #4
0
 public function getReads() {
     if (!$this->exists()) {
         return null;
     }
     if (empty($this->m_data['object_id'])) {
         return 0;
     }
     $requestObject = new RequestObject($this->m_data['object_id']);
     return $requestObject->getRequestCount();
 }
예제 #5
0
/**
 * Campsite Map function plugin
 *
 * Type:     function
 * Name:     count
 * Purpose:  Triggers a statistics counting request
 *
 * @param array
 *     $p_params List of parameters from template
 * @param object
 *     $p_smarty Smarty template object
 *
 * @return
 *     string The html content
 */
function smarty_function_count($p_params, &$p_smarty)
{
    global $Campsite;
    $campsite = $p_smarty->getTemplateVars('gimme');
    $content = '';
    $art_number = 0;
    $art_language_num = 0;
    $art_language_code = '';
    if (isset($p_params['article']) && is_numeric($p_params['article'])) {
        $art_number = $p_params['article'];
    }
    if (isset($p_params['language'])) {
        $langs = array();
        if (is_numeric($p_params['language'])) {
            $langs = \Language::GetLanguages($p_params['language']);
        } else {
            $langs = \Language::GetLanguages(null, $p_params['language']);
        }
        if (!isset($langs[0])) {
            return '';
            // 'no lang'
        }
        $art_language_obj = $langs[0];
        $art_language_num = $art_language_obj->getLanguageId();
        $art_language_code = $art_language_obj->getCode();
    }
    $count_automatically = true;
    if (isset($p_params['dont_count_automatically'])) {
        $count_automatically = false;
    }
    if (!$art_number || !$art_language_num) {
        $meta_article = $campsite->article;
        if ($meta_article->defined) {
            if (!$art_number) {
                $art_number = $meta_article->number;
            }
            if (!$art_language_num) {
                $art_language_meta = $meta_article->language;
                $art_language_num = $art_language_meta->number;
                $art_language_code = $art_language_meta->code;
            }
        }
    }
    if (!$art_language_num) {
        $art_language_meta = $campsite->language;
        $art_language_num = $art_language_meta->number;
        $art_language_code = $art_language_meta->code;
    }
    if (!$art_number || !$art_language_num) {
        return '';
        // 'no art_num or lang'
    }
    $article = new \Article($art_language_num, $art_number);
    if (!$article->exists()) {
        return '';
        // 'no art'
    }
    try {
        $requestObjectId = $article->getProperty('object_id');
        $updateArticle = empty($requestObjectId);
        $objectType = new \ObjectType('article');
        $object_type_id = $objectType->getObjectTypeId();
        if ($updateArticle) {
            $requestObject = new \RequestObject($requestObjectId);
            if (!$requestObject->exists()) {
                $requestObject->create(array('object_type_id' => $objectType->getObjectTypeId()));
                $requestObjectId = $requestObject->getObjectId();
            }
            $article->setProperty('object_id', $requestObjectId);
        }
        // statistics shall be only gathered if the site admin set it on (and not for editor previews)
        if (!$campsite->preview) {
            $stat_web_url = $Campsite['WEBSITE_URL'];
            if ('/' != $stat_web_url[strlen($stat_web_url) - 1]) {
                $stat_web_url .= '/';
            }
            $article_number = $article->getProperty('Number');
            $name_spec = '_' . $article_number . '_' . $art_language_code;
            $content .= \Statistics::JavaScriptTrigger(array('count_automatically' => $count_automatically, 'name_spec' => $name_spec, 'object_type_id' => $object_type_id, 'request_object_id' => $requestObjectId));
        }
    } catch (\Exception $ex) {
        return '';
    }
    return $content;
}
예제 #6
0
 /**
  * Set reads
  * @return int
  */
 public function getReads()
 {
     $requestObject = new \RequestObject($this->objectId);
     return $requestObject->getRequestCount();
 }
예제 #7
0
 /**
  * Returns the content of the given subtitles of the article body field.
  *
  * @param array $p_subtitles
  * @return string
  */
 private function getContent(array $p_subtitles = array())
 {
     global $Campsite;
     $printAll = count($p_subtitles) == 0;
     $content = '';
     foreach ($this->m_subtitles as $index => $subtitle) {
         if (!$printAll && array_search($index, $p_subtitles) === false) {
             continue;
         }
         $content .= $index > 0 ? $subtitle->formatted_name : '';
         $content .= $subtitle->content;
     }
     if ($this->m_articleTypeField->isContent()) {
         $objectType = new ObjectType('article');
         $requestObjectId = $this->m_parent_article->getProperty('object_id');
         $updateArticle = empty($requestObjectId);
         try {
             if ($updateArticle) {
                 $requestObject = new RequestObject($requestObjectId);
                 if (!$requestObject->exists()) {
                     $requestObject->create(array('object_type_id' => $objectType->getObjectTypeId()));
                     $requestObjectId = $requestObject->getObjectId();
                 }
                 $this->m_parent_article->setProperty('object_id', $requestObjectId);
             }
             // statistics shall be only gathered if the site admin set it on (and not for editor previews)
             $context = CampTemplate::singleton()->context();
             if (SystemPref::CollectStatisticsAuto() && !$context->preview) {
                 $stat_web_url = $Campsite['WEBSITE_URL'];
                 if ('/' != $stat_web_url[strlen($stat_web_url) - 1]) {
                     $stat_web_url .= '/';
                 }
                 $article_number = $this->m_parent_article->getProperty('Number');
                 $language_obj = new MetaLanguage($this->m_parent_article->getProperty('IdLanguage'));
                 $language_code = $language_obj->Code;
                 $name_spec = '_' . $article_number . '_' . $language_code;
                 $object_type_id = $objectType->getObjectTypeId();
                 $content .= Statistics::JavaScriptTrigger(array('name_spec' => $name_spec, 'object_type_id' => $object_type_id, 'request_object_id' => $requestObjectId));
             }
         } catch (Exception $ex) {
             $content .= "<p><strong><font color=\"red\">INTERNAL ERROR! " . $ex->getMessage() . "</font></strong></p>\n";
             // do something
         }
     }
     return $content;
 }
예제 #8
0
<?php

/**
* @version      RC 1.1 2008-12-12 19:47:43 $
* @package      SkyBlueCanvas
* @copyright    Copyright (C) 2005 - 2008 Scott Edwin Lewis. All rights reserved.
* @license      GNU/GPL, see COPYING.txt
* SkyBlueCanvas is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYING.txt for copyright notices and details.
*/
defined('SKYBLUE') or die(basename(__FILE__));
$Request = new RequestObject();
$Filter = new Filter();
$com = $Request->get('com', 'skin');
?>
<style type="text/css">
    @import "managers/skinner/styles.css";
</style>
<script type="text/javascript">
function hide_mgr_message() {
    $("#mgr-message").fadeOut("slow");
};
$(function() {
    setTimeout('hide_mgr_message()', 5000);
});
$(function() {
    $("#install_button").bind("click", function(e) {
        if ($("#upload_file").val() == "") {
예제 #9
0
 private function setupResponseNew($agent, $msgId, $m)
 {
     $dom = $m->dom;
     $dataObject = null;
     $db = Zend_Registry::get('my_db');
     $requesterId = RequestObject::getRequesterId($msgId);
     $agentModeId = RequestObject::getRequesterAgentMode($msgId);
     try {
         $sifObjectDataNode = $dom->getElementsByTagName('SIF_ObjectData')->item(0);
         $children = isset($sifObjectDataNode->childNodes) ? $sifObjectDataNode->childNodes : '';
         if (is_object($children)) {
             $objectName = isset($children->item(0)->nodeName) ? $children->item(0)->nodeName : null;
         } else {
             $objectName = null;
             ZitLog::writeToErrorLog('[SIF_ObjectData Error]', 'No SIF_ObjectData found from agent = ' . $agent->sourceId, $this->xmlStr);
             GeneralError::systemError($this->xmlStr);
         }
         $dataObject = new DataObject($objectName);
     } catch (Exception $e) {
         ZitLog::writeToErrorLog('[Error processing message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']);
         GeneralError::systemError($this->xmlStr);
     }
     $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
     $responseXml = $dom->saveXML($sifMessageNode);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml);
     $responseXml = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $responseXml);
     $responseXml = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $responseXml);
     #        $data = array(
     #                DBConvertor::convertCase('request_msg_id')      => $msgId,
     #                DBConvertor::convertCase('response_data')       => $responseXml,
     #                DBConvertor::convertCase('next_packet_num')     => '2',
     #                DBConvertor::convertCase('status_id')           => '1',
     #                DBConvertor::convertCase('agent_id_requester')  => intval($requesterId),
     #                DBConvertor::convertCase('agent_id_responder')  => $agent->agentId,
     #                DBConvertor::convertCase('agent_mode_id')       => intval($agentModeId),
     #                DBConvertor::convertCase('zone_id')         	=> $_SESSION["ZONE_ID"],
     #                DBConvertor::convertCase('context_id')     	 	=> $_SESSION["CONTEXT_ID"]
     #        );
     #        $db->insert(DBConvertor::convertCase('response'), $data);
     /*          Removing the filterUtility as it should be reworked.	
     			$filterUtility = new FilterUtility();
                 $filterUtility->FilterCommonElements($dataObject->objectId, $dom, intval($requesterId));
     */
     try {
         $this->xslt = null;
         $permissions = new AgentPermissions($db);
         $where = "object_id = " . $dataObject->objectId . " and agent_id = " . $requesterId . " and zone_id = " . $_SESSION['ZONE_ID'] . " and context_id = " . $_SESSION['CONTEXT_ID'];
         $result = $permissions->fetchAll($where);
         switch (DB_TYPE) {
             case 'mysql':
                 $this->xslt = isset($result[0]->xslt) ? $result[0]->xslt : null;
                 break;
             case 'oci8':
                 $this->xslt = isset($result[0]->XSLT) ? $result[0]->XSLT : null;
                 break;
         }
         if ($this->xslt != null) {
             $xsltpro = new XSLTProcessor();
             $XSL = new DOMDocument();
             $XSL->loadXML($this->xslt);
             $xsltpro->importStylesheet($XSL);
             $XML = new DOMDocument();
             $XML->loadXML($responseXml);
             $responseXml = $xsltpro->transformToXML($XML);
         }
         $responseXml = str_replace('<?xml version="1.0"?>' . "\n", '', $responseXml);
     } catch (Zend_Exception $e) {
         ZitLog::writeToErrorLog('[Error filtering message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']);
         GeneralError::systemError($this->xmlStr);
     }
     $messagequeue = new MessageQueues($db);
     $data = null;
     $data = array(DBConvertor::convertCase('msg_id') => $this->originalMsgId, DBConvertor::convertCase('ref_msg_id') => $msgId, DBConvertor::convertCase('msg_type') => 2, DBConvertor::convertCase('status_id') => '1', DBConvertor::convertCase('version') => $_SESSION['ZONE_VERSION'], DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => $agent->agentId, DBConvertor::convertCase('agt_id_out') => intval($requesterId), DBConvertor::convertCase('data') => $responseXml, DBConvertor::convertCase('next_packet_num') => 2, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
     $messagequeue->insert($data);
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
 }
예제 #10
0
<?php

/**
* @version      RC 1.1 2008-12-12 19:47:43 $
* @package      SkyBlueCanvas
* @copyright    Copyright (C) 2005 - 2008 Scott Edwin Lewis. All rights reserved.
* @license      GNU/GPL, see COPYING.txt
* SkyBlueCanvas is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYING.txt for copyright notices and details.
*/
defined('SKYBLUE') or die(basename(__FILE__));
$Request = new RequestObject();
$Filter = new Filter();
$com = $Request->get('com', 'manager');
?>
<style type="text/css">
    @import "managers/installer/styles.css";
</style>
<script type="text/javascript">
function hide_mgr_message() {
    $("#mgr-message").fadeOut("slow");
};
$(function() {
    setTimeout('hide_mgr_message()', 5000);
});
$(function() {
    $("#install_button").bind("click", function(e) {
        if ($("#upload_file").val() == "") {
예제 #11
0
<div class="ui-widget-content small-block block-shadow">
  <div class="collapsible">
    <h3 class="head ui-accordion-header ui-helper-reset ui-state-default ui-widget">
    <span class="ui-icon"></span>
    <a href="#" tabindex="-1"><?php putGS('Info'); ?></a></h3>
  </div>
  <div class="padded clearfix">
    <dl class="inline-list">
      <dt><?php putGS('Reads'); ?></dt>
      <dd>
        <?php
        if ($articleObj->isPublished()) {
            $requestObject = new RequestObject($articleObj->getProperty('object_id'));
            if ($requestObject->exists()) {
                echo $requestObject->getRequestCount();
            } else {
                echo '0';
            }
        } else {
            putGS('N/A');
        }
        ?>
      </dd>
      <dt><?php putGS('Type'); ?></dt>
      <dd><?php print htmlspecialchars($articleType->getDisplayName()); ?></dd>
      <dt><?php putGS('Number'); ?></dt>
      <dd><?php p($articleObj->getArticleNumber()); ?></dd>
      <dt><?php putGS('Created by'); ?></dt>
      <dd><?php p(htmlspecialchars($articleCreator->getRealName())); ?></dd>
    </dl>
  </div>
예제 #12
0
 /**
  * @return integer
  */
 public function incrementRequestCount($p_count = 1)
 {
     global $g_ado_db;
     $p_count = 0 + $p_count;
     $sql = 'UPDATE ' . $this->m_dbTableName . ' ' . "SET request_count = LAST_INSERT_ID(request_count + {$p_count}) " . "WHERE object_id = " . $g_ado_db->escape($this->m_data['object_id']) . "  AND date = " . $g_ado_db->escape($this->m_data['date']) . "  AND hour = " . $g_ado_db->escape($this->m_data['hour']);
     $success = $g_ado_db->Execute($sql);
     if ($success === false) {
         return false;
     }
     $this->m_data['request_count'] = $g_ado_db->GetOne("SELECT LAST_INSERT_ID()");
     // Write the object to cache
     $this->writeCache();
     $requestObject = new RequestObject($this->m_data['object_id']);
     $requestObject->updateRequestCount();
     return $this->m_data['request_count'];
 }
예제 #13
0
<?php

/*this is the section that will be run when any request comes to the server
it will read the request send the proper page info
if there no request it will just send the home page */
include "crt_functions.php";
function class_autoloader($class)
{
    include 'class/' . $class . '.php';
}
spl_autoload_register('class_autoloader');
date_default_timezone_set("America/Denver");
/* this will create and request object that will hold 
info used in the rest of the site */
$request_obj = new RequestObject();
$jwt_signature = new JwtSignature($request_obj->enc_key);
$request_obj->checkCookie($jwt_signature);
//fallowing will list navigation bar links displayed depends on loged and valid
if ($request_obj->valid_user) {
    $nav_display = 'style="display:inline"';
} else {
    $nav_display = 'style="display:none"';
}
if (isset($_REQUEST['request'])) {
    $request_obj->read_url($_REQUEST['request']);
    $request_obj->checkSyncToken();
    //print_r($request_obj);
    switch ($request_obj->end_point) {
        case "home":
            $main_pannel = "htmlfrag/home.php";
            break;
 public function testIsRequestValid()
 {
     $data = ['usuario' => '123123', 'senha' => '123123', 'codAdministrativo' => '123123', 'contrato' => 'teste'];
     $requestObject = new RequestObject($data);
     $this->assertEquals($requestObject->getArrayCopy(), $data);
 }