Beispiel #1
0
 /**
  * Retrieve a folder translation object from the database
  *
  * If no $languageid is specified, the default_language set in the module's preference
  * will be used
  *
  * @param int $id id of the folder
  * @param string $languageid language of the translation to retreive
  * @return object SmartmediaFolder_text
  */
 function &get($folderid, $languageid = 'none')
 {
     if ($languageid == 'none') {
         $smartConfig =& smartmedia_getModuleConfig();
         $languageid = $smartConfig['default_language'];
     }
     $folderid = intval($folderid);
     if ($folderid > 0) {
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('folderid', $folderid));
         $criteria->add(new Criteria('languageid', $languageid));
         $sql = $this->_selectQuery($criteria);
         //echo "<br /> $sql <br />";
         if (!($result = $this->_db->query($sql))) {
             return false;
         }
         $numrows = $this->_db->getRowsNum($result);
         if ($numrows == 1) {
             $obj = new $this->classname($this->_db->fetchArray($result));
             return $obj;
         }
     }
     return false;
 }
Beispiel #2
0
function smartmedia_getHelpPath()
{
    $smartConfig =& smartmedia_getModuleConfig();
    switch ($smartConfig['helppath_select']) {
        case 'docs.xoops.org':
            return 'http://docs.xoops.org/help/ssectionh/index.htm';
            break;
        case 'inside':
            return XOOPS_URL . "/modules/smartmedia/doc/";
            break;
        case 'custom':
            return $smartConfig['helppath_custom'];
            break;
    }
}
Beispiel #3
0
 /**
  * Get count of clips for the admin index page
  *
  * @param string $languagesel specific language
  *
  * @return int count of clips
  */
 function &getClipsCountFromAdmin($languagesel)
 {
     global $xoopsConfig, $xoopsDB;
     $smartConfig =& smartmedia_getModuleConfig();
     if ($languagesel == 'all') {
         $where = "";
     } else {
         $where = "WHERE clips_text.languageid = '" . $languagesel . "'";
     }
     $sql = "SELECT COUNT(DISTINCT clips.clipid)\r\n\t\t\t\t\tFROM (\r\n\t\t\t\t\t    " . $xoopsDB->prefix('smartmedia_clips') . " AS clips\r\n    \t\t\t\t\tINNER JOIN " . $this->_db->prefix('smartmedia_clips_text') . " AS clips_text ON clips.clipid = clips_text.clipid\r\n\t\t\t\t\t\t)\r\n    \t\t\t\t\tINNER JOIN " . $this->_db->prefix('smartmedia_folders') . " AS folders ON clips.folderid=folders.folderid\r\n    \t\t\t\t\tINNER JOIN " . $this->_db->prefix('smartmedia_folders_text') . " AS folders_text ON folders.folderid = folders_text.folderid\r\n\t\t\t\t\tINNER JOIN " . $this->_db->prefix('smartmedia_folders_categories') . " AS categories\r\n\t\t\t\t\tON folders.folderid = categories.folderid\r\n\t\t\t\t    \r\n        " . $where;
     //echo "<br />$sql<br />";
     if (!($result =& $this->_db->query($sql))) {
         return 0;
     }
     list($count) = $this->_db->fetchRow($result);
     return $count;
 }
Beispiel #4
0
 /**
  * Retrieve objects from the database
  *
  * @param int $categoryid id of a category
  * @param object $criteria {@link CriteriaElement} conditions to be met
  * @param bool $category_id_as_key Should the folder ID be used as array key
  * @return array array of {@link SmartmediaFolder} objects
  */
 function &getObjects($categoryid, $criteria = null, $category_id_as_key = false)
 {
     global $xoopsConfig;
     $smartConfig =& smartmedia_getModuleConfig();
     $ret = array();
     $limit = $start = 0;
     $sql = $this->_selectJoinQuery($categoryid, $criteria);
     if (isset($criteria)) {
         $limit = $criteria->getLimit();
         $start = $criteria->getStart();
     }
     // echo "<br />$sql<br />";
     $result = $this->_db->query($sql, $limit, $start);
     // If no records from db, return empty array
     if (!$result) {
         return $ret;
     }
     // Add each returned record to the result array
     while ($myrow = $this->_db->fetchArray($result)) {
         $obj = new $this->classname($xoopsConfig['language'], $myrow);
         if (!$category_id_as_key) {
             $ret[$obj->getVar('folderid')] =& $obj;
         } else {
             $ret[$myrow['categoryid']][$obj->getVar('folderid')] =& $obj;
         }
         unset($obj);
     }
     return $ret;
 }
Beispiel #5
0
 function toArray($content = array())
 {
     $content['contentid'] = $this->contentid();
     $content['itemurl'] = $this->getItemUrl();
     $content['itemlink'] = $this->getItemLink();
     $content['parentid'] = $this->parentid();
     $content['weight'] = $this->weight();
     if ($this->getVar('image') != 'blank.png') {
         $content['image_path'] = smartmedia_getImageDir('content', false) . $this->image();
     } else {
         $content['image_path'] = false;
     }
     $smartConfig =& smartmedia_getModuleConfig();
     $content['main_image_width'] = $smartConfig['main_image_width'];
     $content['list_image_width'] = $smartConfig['list_image_width'];
     $content['adminLinks'] = $this->adminLinks();
     $content['title'] = $this->title();
     $content['clean_title'] = $content['title'];
     $content['description'] = $this->description();
     $content['meta_description'] = $this->meta_description();
     // Hightlighting searched words
     $highlight = true;
     if ($highlight && isset($_GET['keywords'])) {
         $myts =& MyTextSanitizer::getInstance();
         $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords'])));
         $h = new keyhighlighter($keywords, true, 'smartmedia_highlighter');
         $content['title'] = $h->highlight($content['title']);
         $content['description'] = $h->highlight($content['description']);
     }
     return $content;
 }
Beispiel #6
0
    define("SMARTMEDIA_URL", XOOPS_URL . '/modules/' . SMARTMEDIA_DIRNAME . '/');
}
if (!defined("SMARTMEDIA_ROOT_PATH")) {
    define("SMARTMEDIA_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTMEDIA_DIRNAME . '/');
}
if (!defined("SMARTMEDIA_IMAGES_URL")) {
    define("SMARTMEDIA_IMAGES_URL", SMARTMEDIA_URL . "images/");
}
include_once SMARTMEDIA_ROOT_PATH . "include/functions.php";
// Creating the SmartModule object
$smartModule =& smartmedia_getModuleInfo();
$myts = MyTextSanitizer::getInstance();
$smartmedia_moduleName = $myts->displayTarea($smartModule->getVar('name'));
$is_smartmedia_admin = smartmedia_userIsAdmin();
// Creating the SmartModule config Object
$smartConfig =& smartmedia_getModuleConfig();
include_once SMARTMEDIA_ROOT_PATH . "class/permission.php";
include_once SMARTMEDIA_ROOT_PATH . "class/category.php";
include_once SMARTMEDIA_ROOT_PATH . "class/category_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/folder.php";
include_once SMARTMEDIA_ROOT_PATH . "class/folder_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/clip.php";
include_once SMARTMEDIA_ROOT_PATH . "class/clip_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/tabs.php";
include_once SMARTMEDIA_ROOT_PATH . "class/format.php";
include_once SMARTMEDIA_ROOT_PATH . "class/keyhighlighter.class.php";
// Creating the permission handler object
$smartmedia_permission_handler =& xoops_getmodulehandler('permission', SMARTMEDIA_DIRNAME);
// Creating the category handler object
$smartmedia_category_handler =& smartmedia_gethandler('category');
// Creating the category_text handler object