static function &getInstance() { static $inst = null; $class = __CLASS__; if ($inst === null) { include_once PATH_CLASS . '/CFotobox.php'; $inst = new $class(); $inst->dbh =& $GLOBALS['dbh']; $inst->stamp = $stamp > 0 ? $stamp : FF_YM_STAMP; $this->fb =& CFotobox::getInstance(); } return $inst; }
function myMusic($user_id = false, $track_id_src = false) { $return = array(); if ($user_id !== false) { include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); if ($track_id_src === false) { $mp3s = $fb->mp3s($user_id); foreach ($mp3s as $v) { $return[] = array('M_ID' => 'N/A', 'M_SWF_SRC' => $v['M_PATH'], 'M_LENGTH' => $v['M_LENGTH'], 'M_SIZE' => $v['M_SIZE'], 'M_GENRE' => 'My Music', 'M_TEMPO' => '', 'M_NAME' => $v['M_NAME'], 'M_DESC' => ''); } } else { $return = $fb->mp3($track_id_src, $user_id); } } return $return; }
function addComment($element_id = false, $by_user_id = 0, $for_user_id = 0, $comment = false, $type = 'foto', $raw_name = null) { include_once PATH_INCLUDE . '/functions.php'; // used to sanitize() comment include_once PATH_CLASS . '/CUser.php'; // use for activity include_once PATH_CLASS . '/CUserManage.php'; // use for activity $return = false; if ($element_id !== false && $comment !== false) { $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $element_id = intval($element_id); $comment = $this->dbh->sql_safe(sanitize($comment, array('PRESERVE_ANCHORS' => true))); $typeSafe = $this->dbh->sql_safe($type); $by_user_id = intval($by_user_id); $for_user_id = intval($for_user_id); $raw_name = $this->dbh->sql_safe(sanitize($raw_name)); $sql = 'INSERT INTO comments(c_by_u_id, c_for_u_id, c_element_id, c_name, c_comment, c_type, c_time) ' . 'VALUES(' . $by_user_id . ', ' . $for_user_id . ', ' . $element_id . ', ' . $raw_name . ', ' . $comment . ', ' . $typeSafe . ', ' . NOW . ')'; $this->dbh->execute($sql); $return = $this->dbh->insert_id(); switch ($type) { case 'blog': $element_rep = $element_id; break; case 'flix': include_once PATH_CLASS . '/CFlix.php'; $f =& CFlix::getInstance(); $flixData = $f->search(array('FLIX_ID' => $element_id)); $element_rep = $flixData['US_KEY']; break; case 'foto': include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); $fotoData = $fb->fotoData($element_id); $element_rep = $fotoData['P_KEY']; break; } $forUserData = $u->find($for_user_id); $byUserData = $u->find($by_user_id); $um->addActivity($by_user_id, $return, 'newComment', $byUserData['U_USERNAME'], $forUserData['U_USERNAME'], $element_rep, $type); } return $return; }
<?php include '../../init_constants.php'; include PATH_INCLUDE . '/functions.php'; include PATH_HOMEROOT . '/init.php'; include_once PATH_DOCROOT . '/init_database.php'; include_once PATH_CLASS . '/CSession.php'; include_once PATH_DOCROOT . '/init_session.php'; include PATH_CLASS . '/CToolbox.php'; include PATH_CLASS . '/CFlixManage.php'; include PATH_CLASS . '/CFotobox.php'; $tb =& CToolbox::getInstance(); $flm =& CFlixManage::getInstance(); $fb =& CFotobox::getInstance(); $fotos = $tb->get($_USER_ID); $params = array('MODE' => 'INSERT', 'USER_ID' => $_USER_ID, 'TAGS' => 'stuff', 'NAME' => date('h:i:s', time()), 'ELEMENTS' => array(), 'SETTINGS' => array()); $params['SETTINGS'] = array(array('instanceName_str' => 'someinstance', 'depth_int' => 0, 'swfPath_str' => '/path/to/swf'), array('instanceName_str' => 'someotherinstance', 'depth_int' => 0, 'swfPath_str' => '/path/to/swf', 'maskPath_str' => '/path/to/mask')); foreach ($fotos as $k => $v) { $fotoData = $fb->fotoData($v['P_ID']); $params['ELEMENTS'][$k] = array('photoId_int' => $fotoData['P_ID'], 'photoPath_str' => $fotoData['P_ORIG_PATH'], 'thumbnailPath_str' => $fotoData['P_THUMB_PATH'], 'photoKey_str' => $fotoData['P_KEY']); if ($k % 2 == 0) { $params['ELEMENTS'][$k]['hotSpot_arr'] = array(array('note_str' => 'This is a note', 'fill_bool' => false, 'depth_int' => 1), array('note_str' => 'This is a note', 'fill_bool' => false, 'depth_int' => 1, 'draw_arr' => array(array('x_int' => 0, 'y_int' => 10), array('x_int' => 1, 'y_int' => 11), array('x_int' => 2, 'y_int' => 12)))); } } //print_r($params); echo jsonEncode($params); $flm->flashInput($params);
function _ffSrc($matches) { $return = $matches[1]; switch ($matches[1]) { case 'photo': include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); $matches[2] = trim($matches[2]); $fotoData = $fb->fotoData($matches[2]); if ($fotoData !== false) { $return = ' <a href="/handler/photo/' . $matches[2] . '/" target="_blank"><img src="' . PATH_FOTO . $fotoData['P_THUMB_PATH'] . '" width="75" height="75" vspace="3" border="0" class="border_white_2px" /></a> '; } else { $return = ' <img src="' . PATH_FOTO . '/thumbnail/nofoto.jpg" width="75" height="75" border="0" class="border_white_2px" /> '; } break; case 'slideshow': include_once PATH_CLASS . '/CFlix.php'; include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); $f =& CFlix::getInstance(); $matches[2] = trim($matches[2]); $flixData = $f->search(array('KEY' => $matches[2])); $fotoURL = $flixData['US_PHOTO']['thumbnailPath_str']; //$theme = $f->template( $flixData['A_TEMPLATE'] ); if ($fotoURL != '') { $return = '<div style="padding-top:4px; padding-bottom:4px;"><div class="flix_border" style="float:left;"><a href="/handler/slideshow/' . $matches[2] . '/" target="_blank"><img src="' . PATH_FOTO . $fotoURL . '" width="75" height="75" border="0" /></a></div><div>Title: ' . $flixData['US_NAME'] . '<br />Photos: ' . $flixData['US_FOTO_COUNT'] . '<br />Views: ' . $flixData['US_VIEWS'] . '<br clear="all" /></div></div>'; } else { $return = '<img src="' . PATH_FOTO . '/thumbnail/nofoto.jpg" width="75" height="75" border="0" />'; } break; //case 'i': //$return = '<div class="italic">' . $matches[2] . '</div>'; //break; } return $return; }
<?php $prefix = substr($action, 0, strpos($action, '.')); $viewmode = isset($args) ? $args[0] : false; $id_hash = !isset($id_hash) ? $args[1] : $id_hash; if ($prefix == 'fotobox' || $viewmode == 'fotoviewer') { $obj =& CFotobox::getInstance(); } else { $obj =& CGroup::getInstance(); } if (strlen($id_hash) == 32) { $foto_data = $obj->fotoData($id_hash); } else { $image_id = substr($id_hash, 6); $foto_data = $obj->fotoData($image_id); } if (!is_file(PATH_FOTOROOT . $foto_data['P_WEB_PATH'])) { echo '<div class="bold" align="center" style="width:100%;">Sorry, but we can not load the foto you requested.</div.'; } else { $foto_size = @getimagesize(PATH_FOTOROOT . $foto_data['P_WEB_PATH']); ?> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="center"> <?php if ($viewmode !== false) { echo 'FotoLink: http://' . FF_SERVER_NAME . '/' . $viewmode . '?' . $foto_data['P_KEY'] . '<br />'; } ?>
function applyToDynamics($command = false, $photoId = false, $userId = false) { if ($photoId !== false && $userId !== false) { include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); $dynamics = $fb->getDynamics($userId, $photoId); foreach ($dynamics as $v) { exec($exec = "{$this->_convert} {$command} {$this->_foto_root}{$v['D_SOURCE']} {$this->_foto_root}{$v['D_SOURCE']}"); } } }