protected function _getTabPf($user, $page = 1) { require_once ABS_PATH . '/classes/portfolio.php'; require_once ABS_PATH . '/portfolio/models/PortfolioItemIterator.php'; $tab = null; $portfolio = new portfolio(); $list = $portfolio->getList($user['uid'], $page, $this->limit); if ($list) { $total = $portfolio->CountAll($user['uid']); $pages = ceil($total / $this->limit); $tab = array('elements' => new PortfolioItemIterator($user, $list), 'pages' => $pages, 'page' => $page); } return $tab; }
public function init() { $ports = portfolio::getAll(); for ($i = count($ports) - 1; $i >= 0; $i--) { $this->add($ports[$i]); } }
function addItem() { system::setParam("page", "addPortfolioItem"); $fill = array(); $doRedirect = false; if (isset($_POST["savePost"])) { $savedItem = portfolio::addItem($_POST); if ($savedItem) { $doRedirect = true; } } if ($doRedirect) { system::redirect(system::param("urlBase") . "portfolio"); } }
public function __construct($id = null) { $link = site::getLink(); if ($id == null) { $id = portfolio::getByOrder(1, $link); } $sql = "SELECT * FROM sites WHERE id = " . $id; $results = site::db_query($sql, $link); $results = $results[0]; $this->name = $results['name']; $this->description = $results['description']; $this->image = $results['image']; $this->id = $id; $this->order = $results['order']; $this->url = $results['url']; }
public static function picture() { if (!portfolio::initialVerify(true)) { echo '<script type="text/javascript">parent.pupld.uploadError ("' . addslashes(json_encode(system::$errors)) . '")</script>'; return; } if (isset($_POST["ajaxFileUpload"]) && isset($_POST["pageDir"])) { if (isset($_POST["slug"]) && $_POST["slug"]) { $slug = preg_replace("/[^a-zа-яё0-9\\-\\_]+/i", '', $_POST["slug"]); } else { $slug = ""; } if (isset($_POST["pageDir"]) && $_POST["pageDir"]) { $pageDir = preg_replace("/[^a-z0-9]+/i", '', $_POST["pageDir"]); } else { $pageDir = ""; } $uploadedPics = blog::uploadOnePicture($slug, $pageDir); $uploadedPics["picUpld"]["itemName"] = $slug; if (!empty($uploadedPics)) { echo '<script type="text/javascript">parent.pupld.uploadFinished ("' . addslashes(json_encode($uploadedPics["picUpld"])) . '")</script>'; } } }
function ChangePortfByProf($curr_prof_id, $prof_id, $id1 = 0, $id2 = 0, $id3 = 0) { global $session; session_start(); $objResponse = new xajaxResponse(); $prof_id = intval($prof_id); $curr_prof_id = intval($curr_prof_id); $user_id = get_uid(false); // Работы. $obj_portfolio = new portfolio(); $portf_works = $obj_portfolio->GetPortfProf(get_uid(false), $prof_id); if (!$portf_works) { $portf_works = array(); } // Признак того, что работ > 30 $portf_more = count($portf_works) > 30; $html_works = ''; $js_works = 'cur_prof = ' . $prof_id . ";\n"; $js_works .= "works_ids = new Array();\n"; $js_works .= "works_names = new Array();\n"; $js_works .= "works_prevs = new Array();\n"; $js_works .= "works_picts = new Array();\n"; $js_works .= "works_links = new Array();\n"; $i = 0; foreach ($portf_works as $key => $value) { ++$i; if ($i == MAX_WORKS_IN_LIST + 1) { $html_works .= '<div id="more_works" style="font-size:11px;visibility:visible;display:none;">'; } $html_works .= '<div id="portfolio_work_' . $value['id'] . '" style="font-size:100%">'; $html_works .= '<input type="checkbox" class="checkbox" id="ps_portfolio_work_' . $value['id'] . '" name="ps_portfolio_work_' . $value['id'] . '" value="0" '; //if (in_array($value['id'], array($id1, $id2, $id3))) //{ // $html_works .= ' checked="checked" disabled="disabled"> ' . $value['name']; if ($value['id'] == $id1) { $html_works .= ' checked="checked" onclick="clear_work(1, ' . $value['id'] . ');">' . $value['name']; } else { if ($value['id'] == $id2) { $html_works .= ' checked="checked" onclick="clear_work(2, ' . $value['id'] . ');">' . $value['name']; } else { if ($value['id'] == $id3) { $html_works .= ' checked="checked" onclick="clear_work(3, ' . $value['id'] . ');">' . $value['name']; } else { $html_works .= ' onClick="add_work(' . $value['id'] . ');"> <a href="javascript:void(null);" onClick="add_work(' . $value['id'] . ');" class="blue">' . $value['name'] . '</a>'; } } } $html_works .= '</div>'; $js_works .= 'works_ids[' . $value['id'] . "] = '" . $value['id'] . "';\n"; $js_works .= 'works_names[' . $value['id'] . "] = '" . trim(addslashes($value['name'])) . "';\n"; $js_works .= 'works_prevs[' . $value['id'] . "] = '" . $value['prev_pict'] . "';\n"; $js_works .= 'works_picts[' . $value['id'] . "] = '" . $value['pict'] . "';\n"; $js_works .= 'works_links[' . $value['id'] . "] = '" . $value['link'] . "';\n"; } if ($i >= MAX_WORKS_IN_LIST + 1) { $html_works .= '</div>'; $html_works .= '<div id="show_more_works" style="font-size:100%;margin-top:12px;"><a href="javascript:void(null)" onClick="document.getElementById(\'show_more_works\').style.display=\'none\';document.getElementById(\'more_works\').style.display=\'block\';" class="blue" style="font-weight:bold;"><img src="/images/triangle_grey.gif" alt="" width="4" height="11" border="0" style="margin-right:4px;" />Остальные работы</a>'; } // Профессии $obj_profession = new professions(); $prof_names = $obj_profession->GetChangeProfNames($curr_prof_id, $prof_id); $objResponse->script($js_works); $objResponse->assign('portfolio_works', 'innerHTML', $html_works); $objResponse->assign('profession_' . $prof_id, 'innerHTML', $prof_names['new_name']); $objResponse->assign('profession_' . $curr_prof_id, 'innerHTML', '<a href="javascript:void(null);" onClick="if (ajaxFlag){ ajaxFlag=0; xajax_ChangePortfByProf(cur_prof, ' . $curr_prof_id . ', $(' . "'" . 'ps_work_1_id' . "'" . ').value, $(' . "'" . 'ps_work_2_id' . "'" . ').value, $(' . "'" . 'ps_work_3_id' . "'" . ').value);}" class="blue">' . $prof_names['old_name'] . '</a>'); $objResponse->script('ajaxFlag=1;'); return $objResponse; }
<?php if (!$_in_setup) { header('HTTP/1.0 403 Forbidden'); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/portfolio.php'; $prfs = new professions(); $profs = $prfs->GetSelProf(get_uid()); if (!$profs) { include 'portfolio_in_setup.php'; } else { $portf = new portfolio(); $prjs = $portf->GetPortf(get_uid()); ?> <script language="JavaScript1.2" type="text/javascript"> <!-- prjprof_id = new Array(); prjname = new Array(); prjlink = new Array(); prjdescr = new Array(); prjid = new Array(); prof_ids = new Array(); profnames = new Array(); <?php $i = 0; if ($prjs) { foreach ($prjs as $prj) {
/** * main routine to convert old school module data into new controller format * @global db the exponent database object * @param $iloc * @param $module * @param int $hc * @return */ private function convert($iloc, $module, $hc = 0) { if (!array_key_exists($iloc->mod, $this->params['migrate'])) { return $module; } global $db; $old_db = $this->connect(); $linked = false; $loc = null; switch ($iloc->mod) { case 'textmodule': @($module->view = 'showall'); //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "text"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'textmodule'; $linked = true; break; } $iloc->mod = 'textmodule'; $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'"); if ($textitems) { foreach ($textitems as $ti) { $text = new text(); $loc = expUnserialize($ti->location_data); $loc->mod = "text"; $text->location_data = serialize($loc); $text->body = $ti->text; $text->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'rotatormodule': $module->action = 'showRandom'; $module->view = 'showRandom'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "text"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'rotatormodule'; $linked = true; break; } $iloc->mod = 'rotatormodule'; $textitems = $old_db->selectObjects('rotator_item', "location_data='" . serialize($iloc) . "'"); if ($textitems) { foreach ($textitems as $ti) { $text = new text(); $loc = expUnserialize($ti->location_data); $loc->mod = "text"; $text->location_data = serialize($loc); $text->body = $ti->text; $text->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'snippetmodule': $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "snippet"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'snippetmodule'; $linked = true; break; } $iloc->mod = 'snippetmodule'; $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'"); if ($textitems) { foreach ($textitems as $ti) { $text = new snippet(); $loc = expUnserialize($ti->location_data); $loc->mod = "snippet"; $text->location_data = serialize($loc); $text->body = $ti->text; // if the item exists in the current db, we won't save it $te = $text->find('first', "location_data='" . $text->location_data . "'"); if (empty($te)) { $text->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } } break; case 'linklistmodule': switch ($module->view) { case 'Quick Links': @($module->view = "showall_quicklinks"); break; default: @($module->view = 'showall'); break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "links"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'linklistmodule'; $linked = true; break; } $iloc->mod = 'linklistmodule'; $links = $old_db->selectArrays('linklist_link', "location_data='" . serialize($iloc) . "'"); if ($links) { foreach ($links as $link) { $lnk = new links(); $loc = expUnserialize($link['location_data']); $loc->mod = "links"; $lnk->title = !empty($link['name']) ? $link['name'] : 'Untitled'; $lnk->body = $link['description']; $lnk->new_window = $link['opennew']; $lnk->url = !empty($link['url']) ? $link['url'] : '#'; $lnk->rank = $link['rank']; $lnk->poster = 1; $lnk->editor = 1; $lnk->location_data = serialize($loc); $lnk->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'linkmodule': // user mod, not widely distributed switch ($module->view) { case 'Summary': @($module->view = "showall_quicklinks"); break; default: @($module->view = 'showall'); break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "links"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'linkmodule'; $linked = true; break; } $iloc->mod = 'linkmodule'; $links = $old_db->selectArrays('link', "location_data='" . serialize($iloc) . "'"); $oldconfig = $old_db->selectObject('linkmodule_config', "location_data='" . serialize($iloc) . "'"); if ($links) { foreach ($links as $link) { $lnk = new links(); $loc = expUnserialize($link['location_data']); $loc->mod = "links"; $lnk->title = !empty($link['name']) ? $link['name'] : 'Untitled'; $lnk->body = $link['description']; $lnk->new_window = $link['opennew']; $lnk->url = !empty($link['url']) ? $link['url'] : '#'; $lnk->rank = $link['rank']; $lnk->poster = 1; $lnk->editor = 1; $lnk->location_data = serialize($loc); $lnk->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } if ($oldconfig->enable_rss == 1) { $config['enable_rss'] = true; $config['feed_title'] = $oldconfig->feed_title; $config['feed_desc'] = $oldconfig->feed_desc; $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newconfig = new expConfig(); $newconfig->config = $config; $newconfig->location_data = $loc; $newconfig->save(); $newrss = new expRss(); $newrss->module = $loc->mod; $newrss->src = $loc->src; $newrss->enable_rss = $oldconfig->enable_rss; $newrss->feed_title = $oldconfig->feed_title; $newrss->feed_desc = $oldconfig->feed_desc; $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newrss->save(); } } break; case 'swfmodule': $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "text"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'swfmodule'; $linked = true; break; } $iloc->mod = 'swfmodule'; $swfitems = $old_db->selectObjects('swfitem', "location_data='" . serialize($iloc) . "'"); if ($swfitems) { foreach ($swfitems as $ti) { $text = new text(); $file = new expFile($ti->swf_id); $loc = expUnserialize($ti->location_data); $loc->mod = "text"; $text->location_data = serialize($loc); $text->title = $ti->name; $swfcode = ' <p> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" height="' . $ti->height . '" width="' . $ti->width . '"> <param name="bgcolor" value="' . $ti->bgcolor . '" /> ' . ($ti->transparentbg ? "<param name=\"wmode\" value=\"transparent\" />" : "") . ' <param name="quality" value="high" /> <param name="movie" value="' . $file->path_relative . '" /> <embed bgcolor= "' . $ti->bgcolor . '" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="' . $file->path_relative . '" type="application/x-shockwave-flash" height="' . $ti->height . '" width="' . $ti->width . '"' . ($ti->transparentbg ? " wmode=\"transparent\"" : "") . '> </embed> </object> </p> '; $text->body = $swfcode; $text->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'newsmodule': if ($module->view == 'Featured News') { $only_featured = true; } switch ($module->view) { case 'Headlines': $module->view = 'showall_headlines'; break; case 'Summary': $module->view = 'showall_summary'; break; default: $module->view = 'showall'; break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "news"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'newsmodule'; $linked = true; break; } $iloc->mod = 'newsmodule'; $newsitems = $old_db->selectArrays('newsitem', "location_data='" . serialize($iloc) . "'"); $oldconfig = $old_db->selectObject('newsmodule_config', "location_data='" . serialize($iloc) . "'"); if ($newsitems) { $files_attached = false; foreach ($newsitems as $ni) { unset($ni['id']); $news = new news($ni); $loc = expUnserialize($ni['location_data']); $loc->mod = "news"; $news->location_data = serialize($loc); $news->title = !empty($ni['title']) ? $ni['title'] : gt('Untitled'); $news->body = !empty($ni['body']) ? $ni['body'] : gt('(empty)'); $news->save(); // default is to create with current time $news->created_at = $ni['posted']; $news->edited_at = $ni['edited']; $news->update(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); if (!empty($ni['file_id'])) { $file = new expFile($ni['file_id']); $news->attachitem($file, ''); $files_attached = true; } } $newconfig = new expConfig(); if ($files_attached) { // fudge a config to get attached files to appear $newconfig->config = 'a:14:{s:9:"feedmaker";s:0:"";s:11:"filedisplay";s:7:"Gallery";s:6:"ffloat";s:4:"Left";s:6:"fwidth";s:3:"120";s:7:"fmargin";s:1:"5";s:7:"piwidth";s:3:"100";s:5:"thumb";s:3:"100";s:7:"spacing";s:2:"10";s:10:"floatthumb";s:8:"No Float";s:6:"tclass";s:0:"";s:5:"limit";s:0:"";s:9:"pagelinks";s:14:"Top and Bottom";s:10:"feed_title";s:0:"";s:9:"feed_desc";s:0:"";}'; } if ($oldconfig->enable_rss == 1) { if ($newconfig->config != null) { $config = expUnserialize($newconfig->config); } $config['enable_rss'] = true; $config['feed_title'] = $oldconfig->feed_title; $config['feed_desc'] = $oldconfig->feed_desc; $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newconfig->config = $config; $newrss = new expRss(); $newrss->module = $loc->mod; $newrss->src = $loc->src; $newrss->enable_rss = $oldconfig->enable_rss; $newrss->feed_title = $oldconfig->feed_title; $newrss->feed_desc = $oldconfig->feed_desc; $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newrss->save(); } if ($only_featured) { $newconfig->config['only_featured'] = true; } if ($newconfig != null) { $newconfig->location_data = $loc; $newconfig->save(); } } break; case 'resourcesmodule': switch ($module->view) { case 'One Click Download - Descriptive': $module->view = 'showall_quick_download_with_description'; break; default: $module->view = 'showall'; break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "filedownload"; if ($db->countObjects('filedownloads', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'resourcesmodule'; $linked = true; break; } $iloc->mod = 'resourcesmodule'; $resourceitems = $old_db->selectArrays('resourceitem', "location_data='" . serialize($iloc) . "'"); $oldconfig = $old_db->selectObject('resourcesmodule_config', "location_data='" . serialize($iloc) . "'"); if ($resourceitems) { foreach ($resourceitems as $ri) { unset($ri['id']); $filedownload = new filedownload($ri); $loc = expUnserialize($ri['location_data']); $loc->mod = "filedownload"; $filedownload->title = !empty($ri['name']) ? $ri['name'] : 'Untitled'; $filedownload->body = $ri['description']; $filedownload->downloads = $ri['num_downloads']; $filedownload->location_data = serialize($loc); if (!empty($ri['file_id'])) { $filedownload->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); $file = new expFile($ri['file_id']); $filedownload->attachitem($file, 'downloadable'); // default is to create with current time $filedownload->created_at = $ri['posted']; $filedownload->edited_at = $ri['edited']; $filedownload->update(); } } if (isset($oldconfig->enable_rss)) { $dorss = $oldconfig->enable_rss; } elseif (isset($oldconfig->enable_podcasting)) { $dorss = $oldconfig->enable_podcasting; } else { $dorss = false; } if ($dorss) { $config['enable_rss'] = true; $config['feed_title'] = $oldconfig->feed_title; $config['feed_desc'] = $oldconfig->feed_desc; $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newconfig = new expConfig(); $newconfig->config = $config; $newconfig->location_data = $loc; $newconfig->save(); $newrss = new expRss(); $newrss->module = $loc->mod; $newrss->src = $loc->src; // $newrss->enable_rss = $oldconfig->enable_rss; $newrss->enable_rss = true; $newrss->feed_title = $oldconfig->feed_title; $newrss->feed_desc = $oldconfig->feed_desc; $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newrss->save(); } } break; case 'imagegallerymodule': switch ($module->view) { case 'Slideshow': $module->action = 'slideshow'; $module->view = 'showall'; break; default: $module->view = 'showall'; break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "photos"; if ($db->countObjects('photo', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'imagegallerymodule'; $linked = true; break; } $iloc->mod = 'imagegallerymodule'; $galleries = $old_db->selectArrays('imagegallery_gallery', "location_data='" . serialize($iloc) . "'"); if ($galleries) { foreach ($galleries as $gallery) { $gis = $old_db->selectArrays('imagegallery_image', "gallery_id='" . $gallery['id'] . "'"); foreach ($gis as $gi) { $photo = new photo(); $loc = expUnserialize($gallery['location_data']); $loc->mod = "photos"; $photo->title = !empty($gi['name']) ? $gi['name'] : 'Untitled'; $photo->body = $gi['description']; $photo->alt = $gi['alt']; $photo->location_data = serialize($loc); if (!empty($gi['file_id'])) { $photo->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); $file = new expFile($gi['file_id']); $photo->attachitem($file, ''); $photo->created_at = $gi['posted']; $photo->edited_at = $gi['posted']; $photo->update(array("validate" => false)); } } } } break; case 'slideshowmodule': $module->action = 'slideshow'; $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "photos"; if ($db->countObjects('photo', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'slideshowmodule'; $linked = true; break; } $iloc->mod = 'slideshowmodule'; $galleries = $old_db->selectArrays('imagegallery_gallery', "location_data='" . serialize($iloc) . "'"); if ($galleries) { foreach ($galleries as $gallery) { $gis = $old_db->selectArrays('imagegallery_image', "gallery_id='" . $gallery['id'] . "'"); foreach ($gis as $gi) { $photo = new photo(); $loc = expUnserialize($gallery['location_data']); $loc->mod = "photos"; $photo->title = !empty($gi['name']) ? $gi['name'] : 'Untitled'; $photo->body = $gi['description']; $photo->alt = $gi['alt']; $photo->location_data = serialize($loc); $te = $photo->find('first', "location_data='" . $photo->location_data . "'"); if (empty($te)) { if (!empty($gi['file_id'])) { $photo->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); $file = new expFile($gi['file_id']); $photo->attachitem($file, ''); $photo->created_at = $gi['posted']; $photo->edited_at = $gi['posted']; $photo->update(); } } } } } break; case 'headlinemodule': $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "text"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'headlinemodule'; $linked = true; break; } $iloc->mod = 'headlinemodule'; $headlines = $old_db->selectObjects('headline', "location_data='" . serialize($iloc) . "'"); if ($headlines) { foreach ($headlines as $hl) { $headline = new text(); $loc = expUnserialize($hl->location_data); $loc->mod = "text"; $headline->location_data = serialize($loc); $headline->title = $hl->headline; $headline->poster = 1; // $headline->created_at = time(); // $headline->edited_at = time(); $headline->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'weblogmodule': switch ($module->view) { case 'By Author': $module->action = 'authors'; $module->view = 'authors'; break; case 'By Tag': $module->action = 'tags'; $module->view = 'tags_list'; break; case 'Monthly': $module->action = 'dates'; $module->view = 'dates'; break; default: $module->view = 'showall'; break; } //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "blog"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'weblogmodule'; $linked = true; break; } $iloc->mod = 'weblogmodule'; $blogitems = $old_db->selectArrays('weblog_post', "location_data='" . serialize($iloc) . "'"); $oldconfig = $old_db->selectObject('weblogmodule_config', "location_data='" . serialize($iloc) . "'"); if ($blogitems) { foreach ($blogitems as $bi) { unset($bi['id']); $post = new blog($bi); $loc = expUnserialize($bi['location_data']); $loc->mod = "blog"; $post->location_data = serialize($loc); $post->title = !empty($bi['title']) ? $bi['title'] : gt('Untitled'); $post->body = !empty($bi['body']) ? $bi['body'] : gt('(empty)'); $post->save(); // default is to create with current time $post->created_at = $bi['posted']; $post->edited_at = $bi['edited']; $post->update(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); // this next section is moot since there are no attachments to blogs // if (!empty($bi['file_id'])) { // $file = new expFile($bi['file_id']); // $post->attachitem($file,'downloadable'); // } if (isset($oldconfig->enable_tags) && ($oldconfig->enable_tags = true)) { $params = null; $oldtags = expUnserialize($bi['tags']); foreach ($oldtags as $oldtag) { $tagtitle = strtolower(trim($old_db->selectValue('tags', 'name', 'id = ' . $oldtag))); $tag = new expTag($tagtitle); // $tag->title = $old_db->selectValue('tags','name','id = '.$oldtag); if (empty($tag->id)) { $tag->update(array('title' => $tagtitle)); } $params['expTag'][] = $tag->id; } $post->update($params); } $comments = $old_db->selectArrays('weblog_comment', "parent_id='" . $post->id . "'"); foreach ($comments as $comment) { unset($comment['id']); $newcomment = new expComment($comment); $newcomment->created_at = $comment['posted']; $newcomment->edited_at = $comment['edited']; $newcomment->update(); // attach the comment to the blog post it belongs to $obj->content_type = 'blog'; $obj->content_id = $post->id; $obj->expcomments_id = $newcomment->id; if (isset($this->params['subtype'])) { $obj->subtype = $this->params['subtype']; } $db->insertObject($obj, $newcomment->attachable_table); } } $newconfig = new expConfig(); $config['add_source'] = '1'; if ($oldconfig->enable_rss == 1) { $config['enable_rss'] = true; $config['feed_title'] = $oldconfig->feed_title; $config['feed_desc'] = $oldconfig->feed_desc; $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newrss = new expRss(); $newrss->module = $loc->mod; $newrss->src = $loc->src; $newrss->enable_rss = $oldconfig->enable_rss; $newrss->feed_title = $oldconfig->feed_title; $newrss->feed_desc = $oldconfig->feed_desc; $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24; $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440; $newrss->save(); } $newconfig->config = $config; $newconfig->location_data = $loc; $newconfig->save(); } break; case 'faqmodule': $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "faq"; if ($db->countObjects('faqs', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'faqmodule'; $linked = true; break; } $iloc->mod = 'faqmodule'; $faqs = $old_db->selectArrays('faq', "location_data='" . serialize($iloc) . "'"); if ($faqs) { foreach ($faqs as $fqi) { unset($fqi['id']); $faq = new faq($fqi); $loc = expUnserialize($fqi['location_data']); $loc->mod = "faq"; $faq->location_data = serialize($loc); $faq->question = !empty($fqi['question']) ? $fqi['question'] : 'Untitled?'; $faq->answer = $fqi['answer']; $faq->rank = $fqi['rank']; $faq->include_in_faq = 1; $faq->submitter_name = 'Unknown'; $faq->submitter_email = '*****@*****.**'; $faq->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'listingmodule': $module->view = 'showall'; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "portfolio"; if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'listingmodule'; $linked = true; break; } $iloc->mod = 'listingmodule'; $listingitems = $old_db->selectArrays('listing', "location_data='" . serialize($iloc) . "'"); if ($listingitems) { $files_attached = false; foreach ($listingitems as $li) { unset($li['id']); $listing = new portfolio($li); $listing->title = !empty($li['name']) ? $li['name'] : 'Untitled?'; $loc = expUnserialize($li['location_data']); $loc->mod = "portfolio"; $listing->location_data = serialize($loc); $listing->featured = true; $listing->poster = 1; $listing->body = "<p>" . $li['summary'] . "</p>" . $li['body']; $listing->save(); // default is to create with current time $listing->created_at = time(); $listing->edited_at = time(); $listing->update(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); if (!empty($li['file_id'])) { $file = new expFile($li['file_id']); $listing->attachitem($file, ''); $files_attached = true; } } if ($files_attached) { // fudge a config to get attached files to appear $config = new expConfig(); $config->location_data = $loc; $config->config = 'a:11:{s:11:"filedisplay";s:7:"Gallery";s:6:"ffloat";s:4:"Left";s:6:"fwidth";s:3:"120";s:7:"fmargin";s:1:"5";s:7:"piwidth";s:3:"100";s:5:"thumb";s:3:"100";s:7:"spacing";s:2:"10";s:10:"floatthumb";s:8:"No Float";s:6:"tclass";s:0:"";s:5:"limit";s:0:"";s:9:"pagelinks";s:14:"Top and Bottom";}'; $config->save(); } } break; case 'contactmodule': // convert to an old school form $module->view == "Default"; //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "formmodule"; if ($db->countObjects('formbuilder_form', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'contactmodule'; $linked = true; break; } $iloc->mod = 'contactmodule'; $contactform = $old_db->selectObject('contactmodule_config', "location_data='" . serialize($iloc) . "'"); if ($contactform) { $loc = expUnserialize($contactform->location_data); $loc->mod = 'formmodule'; $contactform->location_data = serialize($loc); // $replyto_address = $contactform->replyto_address; unset($contactform->replyto_address); // $from_address = $contactform->from_address; unset($contactform->from_address); // $from_name = $contactform->from_name; unset($contactform->from_name); unset($contactform->use_captcha); $contactform->name = 'Send us an e-mail'; $contactform->description = ''; $contactform->response = $contactform->final_message; unset($contactform->final_message); $contactform->table_name = ''; $contactform->is_email = true; $contactform->is_saved = false; $contactform->submitbtn = 'Send Message'; $contactform->resetbtn = 'Reset'; unset($contactform->id); $contactform->id = $db->insertObject($contactform, 'formbuilder_form'); $addresses = $old_db->selectObjects('contact_contact', "location_data='" . serialize($iloc) . "'"); foreach ($addresses as $address) { unset($address->addressbook_contact_id); unset($address->contact_info); unset($address->location_data); $address->form_id = $contactform->id; $db->insertObject($address, 'formbuilder_address'); } $report = null; $report->name = $contactform->subject; $report->location_data = $contactform->location_data; $report->form_id = $contactform->id; $db->insertObject($report, 'formbuilder_report'); // now add the controls to the form $control = null; $control->name = 'name'; $control->caption = 'Your Name'; $control->form_id = $contactform->id; $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:9:"Your Name";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:4:"name";}'; $control->rank = 0; $control->is_readonly = 0; $control->is_static = 0; $db->insertObject($control, 'formbuilder_control'); $control->name = 'email'; $control->caption = 'Your Email'; $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:18:"Your Email Address";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:5:"email";}'; $control->rank = 1; $db->insertObject($control, 'formbuilder_control'); $control->name = 'subject'; $control->caption = 'Subject'; $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:7:"Subject";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:7:"subject";}'; $control->rank = 2; $db->insertObject($control, 'formbuilder_control'); $control->name = 'message'; $control->caption = 'Message'; $control->data = 'O:17:"texteditorcontrol":12:{s:4:"cols";i:60;s:4:"rows";i:8;s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:0;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:8:"maxchars";i:0;s:10:"identifier";s:7:"message";s:7:"caption";s:7:"Message";}'; $control->rank = 3; $db->insertObject($control, 'formbuilder_control'); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } break; case 'youtubemodule': //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "youtube"; if ($db->countObjects('youtube', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'youtubemodule'; $linked = true; break; } $iloc->mod = 'youtubemodule'; $videos = $old_db->selectArrays('youtube', "location_data='" . serialize($iloc) . "'"); if ($videos) { foreach ($videos as $vi) { unset($vi['id']); $video = new youtube($vi); $loc = expUnserialize($vi['location_data']); $loc->mod = "youtube"; $video->title = $vi['name']; if (empty($video->title)) { $video->title = 'Untitled'; } $video->location_data = serialize($loc); $yt = explode("watch?v=", $vi['url']); if (empty($yt[1])) { break; } else { $ytid = $yt[1]; } unset($video->url); $video->embed_code = '<iframe title="YouTube video player" width="' . $vi['width'] . '" height="' . $vi['height'] . '" src="http://www.youtube.com/embed/' . $ytid . '" frameborder="0" allowfullscreen></iframe>'; $video->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'mediaplayermodule': //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "flowplayer"; if ($db->countObjects('flowplayer', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'mediaplayermodule'; $linked = true; break; } $iloc->mod = 'mediaplayermodule'; $movies = $old_db->selectArrays('mediaitem', "location_data='" . serialize($iloc) . "'"); if ($movies) { foreach ($movies as $mi) { unset($mi['id']); $movie = new flowplayer($mi); $loc = expUnserialize($mi['location_data']); $loc->mod = "flowplayer"; $movie->title = $mi['name']; if (empty($movie->title)) { $movie->title = 'Untitled'; } unset($mi['bgcolor']); unset($mi['alignment']); unset($mi['loop_media']); unset($mi['auto_rewind']); unset($mi['autoplay']); unset($mi['hide_controls']); $movie->location_data = serialize($loc); $movie->poster = 1; $movie->rank = 1; if (!empty($mi['media_id'])) { $movie->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); $file = new expFile($mi['media_id']); $movie->attachitem($file, 'video'); if (!empty($mi['alt_image_id'])) { $file = new expFile($mi['alt_image_id']); $movie->attachitem($file, 'splash'); } } } } break; case 'bannermodule': //check to see if it's already pulled in (circumvent !is_original) $ploc = $iloc; $ploc->mod = "banner"; if ($db->countObjects('banner', "location_data='" . serialize($ploc) . "'")) { $iloc->mod = 'bannermodule'; $linked = true; break; } $iloc->mod = 'bannermodule'; $banners = $old_db->selectArrays('banner_ad', "location_data='" . serialize($iloc) . "'"); if ($banners) { foreach ($banners as $bi) { $oldclicks = $old_db->selectObjects('banner_click', "ad_id='" . $bi['id'] . "'"); $oldcompany = $old_db->selectObject('banner_affiliate', "id='" . $bi['affiliate_id'] . "'"); unset($bi['id']); $banner = new banner($bi); $loc = expUnserialize($bi['location_data']); $loc->mod = "banner"; $banner->title = $bi['name']; $banner->url = !empty($bi['url']) ? $bi['url'] : '#'; if (empty($banner->title)) { $banner->title = 'Untitled'; } $banner->location_data = serialize($loc); $newcompany = $db->selectObject('companies', "title='" . $oldcompany->name . "'"); if ($newcompany == null) { $newcompany = new company(); $newcompany->title = !empty($oldcompany->name) ? $oldcompany->name : 'Untitled'; $newcompany->body = $oldcompany->contact_info; $newcompany->location_data = $banner->location_data; $newcompany->save(); } $banner->companies_id = $newcompany->id; $banner->clicks = 0; foreach ($oldclicks as $click) { $banner->clicks += $click->clicks; } if (!empty($bi['file_id'])) { $file = new expFile($bi['file_id']); $banner->attachitem($file, ''); } $banner->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'addressbookmodule': // user mod, not widely distributed @($module->view = 'myaddressbook'); @($module->action = 'myaddressbook'); //check to see if it's already pulled in (circumvent !is_original) // $ploc = $iloc; // $ploc->mod = "addresses"; // if ($db->countObjects($ploc->mod, "location_data='".serialize($ploc)."'")) { // $iloc->mod = 'addressbookmodule'; // $linked = true; // break; // } // $iloc->mod = 'addressbookmodule'; $addresses = $old_db->selectArrays('addressbook_contact', "location_data='" . serialize($iloc) . "'"); if ($addresses) { foreach ($addresses as $address) { // unset($address['id']); $addr = new address(); $addr->user_id = 1; $addr->is_default = 1; $addr->is_billing = 1; $addr->is_shipping = 1; $addr->firstname = !empty($address['firstname']) ? $address['firstname'] : 'blank'; $addr->lastname = !empty($address['lastname']) ? $address['lastname'] : 'blank'; $addr->address1 = !empty($address['address1']) ? $address['address1'] : 'blank'; $addr->city = !empty($address['city']) ? $address['city'] : 'blank'; $address['state'] = !empty($address['state']) ? $address['state'] : 'CA'; $state = $db->selectObject('geo_region', 'code="' . strtoupper($address['state']) . '"'); $addr->state = $state->id; $addr->zip = !empty($address['zip']) ? $address['zip'] : '99999'; $addr->phone = !empty($address['phone']) ? $address['phone'] : '800-555-1212'; $addr->email = !empty($address['email']) ? $address['email'] : '*****@*****.**'; $addr->organization = $address['business']; $addr->phone2 = $address['cell']; $addr->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } } break; case 'feedlistmodule': @($module->view = 'showall'); $iloc->mod = 'feedlistmodule'; $feedlist = $old_db->selectObject('feedlistmodule_config', "location_data='" . serialize($iloc) . "'"); if ($feedlist->enable_rss == 1) { $loc = expUnserialize($feedlist->location_data); $loc->mod = "rssController"; $config['enable_rss'] = true; $config['feed_title'] = $feedlist->feed_title; $config['feed_desc'] = $feedlist->feed_desc; $config['rss_limit'] = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24; $config['rss_cachetime'] = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440; $newconfig = new expConfig(); $newconfig->config = $config; $newconfig->location_data = $loc; $newconfig->save(); $newrss = new expRss(); $newrss->module = $loc->mod; $newrss->src = $loc->src; $newrss->enable_rss = $feedlist->enable_rss; $newrss->feed_title = $feedlist->feed_title; $newrss->feed_desc = $feedlist->feed_desc; $newrss->rss_limit = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24; $newrss->rss_cachetime = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440; $newrss->save(); @$this->msg['migrated'][$iloc->mod]['count']++; @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]); } break; default: @$this->msg['noconverter'][$iloc->mod]++; break; } // quick check for non hard coded modules // We add a container if they're not hard coded. !$hc ? $this->add_container($iloc, $module, $linked) : ""; return $module; }
// Предложение данного пользователя по данному проекту. $user_offer = false; } // Профессии. $obj_profession = new professions(); $professions = $obj_profession->GetSelFilProf($uid); if (!$professions) { $professions = array(); // Текущая профессия. $cur_prof = 0; } else { // Текущая профессия. $cur_prof = $professions[0]['id']; } // Работы. $obj_portfolio = new portfolio(); if (!($portf_works = $obj_portfolio->GetPortfProf($uid, $cur_prof))) { $portf_works = array(); } foreach ($portf_works as &$work) { $obj_portfolio->GenerateStaticPreview($work, $_SESSION['login']); } /*if($PDA) { if(!($portf_works = $obj_portfolio->GetPortf($uid))) { $portf_works = array(); } }*/ // Признак того, что работ > MAX_WORKS_IN_LIST $portf_more = count($portf_works) > MAX_WORKS_IN_LIST; } // Диалоги по предложениям к данному проекту.
/** * Отдает HTML для Редактирование работы в портфолио * * @param object $objResponse xajaxResponse * @param string $rec_id идентификатор записи * @param string $rec_type тип записи * @return string */ function _admEditPortfolioParseForm(&$objResponse, $rec_id = '', $rec_type = '', $aParams = array()) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/portfolio.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; $portf = portfolio::GetPortfById($rec_id); $user = new users(); $sH4 = $portf['is_video'] == 't' ? 'Изменить видео' : 'Редактировать работу'; $user->GetUserByUID($portf['user_id']); ob_start(); include_once $_SERVER['DOCUMENT_ROOT'] . '/user/adm_edit_tpl/portfolio.php'; $sHtml = ob_get_contents(); ob_end_clean(); // текст $sOnReady = "if(document.getElementById('adm_edit_msg')) document.getElementById('adm_edit_msg').value = (\$('adm_edit_msg_source')? \$('adm_edit_msg_source').value : null);"; $sMenuItems = "['', 'Основное', 'Файлы']"; $objResponse->assign('h4_adm_edit', 'innerHTML', $sH4); $objResponse->assign('div_adm_edit', 'innerHTML', $sHtml); $objResponse->script($sOnReady); $objResponse->script("adm_edit_content.userLogin = '******';"); $objResponse->script("\$('div_adm_reason').setStyle('display', 'none');"); $objResponse->script("adm_edit_content.editMenuItems = {$sMenuItems};"); $objResponse->script('adm_edit_content.edit();'); $objResponse->script('xajax_getAdmEditReasons(' . admin_log::ACT_ID_EDIT_PORTFOLIO . ');'); }
public function slideshow() { expHistory::set('viewable', $this->params); $where = $this->aggregateWhereClause(); $where .= !empty($this->config['only_featured']) ? "AND featured=1" : ""; $order = 'rank'; $s = new portfolio(); $slides = $s->find('all', $where, $order); assign_to_template(array('slides' => $slides)); }
case "portf_del_all": if (sizeof($_SESSION['w_select'][$_POST['w_delete_prof']])) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; $portf = new portfolio(); foreach ($_SESSION['w_select'][$_POST['w_delete_prof']] as $wkey => $wvalue) { $prj_id = (int) trim($wkey); if ($prj_id) { $error .= $portf->DelPortf($uid, $prj_id); } } } break; case "portf_move_all": if (sizeof($_SESSION['w_select'][$_POST['w_move_prof_from']])) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; $portf = new portfolio(); $prof_id = (int) trim($_POST['w_move_prof_to']); $count_add = count($_SESSION['w_select'][$_POST['w_move_prof_from']]); if ($prof_id > 0 || $prof_id == professions::CLIENTS_PROF_ID || $prof_id == professions::BEST_PROF_ID && portfolio::CountAll($uid, $prof_id, true) + $count_add <= portfolio::MAX_BEST_WORKS) { foreach ($_SESSION['w_select'][$_POST['w_move_prof_from']] as $wkey => $wvalue) { $prj_id = (int) trim($wkey); if ($prj_id) { $error .= $portf->ChangeProjectProf($uid, $prof_id, $prj_id); } } } } break; case "diz_ch": $stddiz = $_POST['stddiz']; $frl = new freelancer();
<?php include "../html/trader-functions.php"; require_once "../ChartDirector/lib/phpchartdir.php"; global $db_hostname, $db_database, $db_user, $db_password; redirect_login_pf(); $username = $_SESSION['username']; $uid = $_SESSION['uid']; // make sure they're logged in" if (isset($username)) { $c = new XYChart(640, 480); $portfolio = new portfolio($_SESSION['pfid']); $pf_id = $portfolio->getID(); $pf_name = $portfolio->getName(); $pf_working_date = $portfolio->getWorkingDate(); $pf_exch = $portfolio->getExch()->getID(); $symb = $_GET['symb']; $symb_name = get_symb_name($symb, $pf_exch); $endDate = chartTime2(strtotime($pf_working_date)); if (isset($_SESSION['chart_period'])) { $chart_period = $_SESSION['chart_period']; } else { $chart_period = 180; } $durationInDays = (int) $chart_period; $startDate = $endDate - $durationInDays * 24 * 60 * 60; $first_date = $c->formatValue($startDate, "{value|yyyy-mm-dd}"); $first = true; try { $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
* * * * */ $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $user = lms_steam::get_current_user(); $portal->set_page_title(gettext("My Portfolio")); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PORTFOLIO_PATH_TEMPLATES . "index.template.html" ); // start working $portfolios = portfolio::get_my_portfolios(); if (empty($portfolios) && empty($_GET)) { if (isset($_GET["context"]) && $_GET["context"] == "init") { portfolio::init(); } $portfolio_html = new portfolio_html_welcome(); } else { if (!isset($_GET["context"])) { $portfolio_html = new portfolio_html_start(isset($_GET["path"]) ? $_GET["path"] : ""); } else { if ($_GET["context"] == "artefacts") { $portfolio_html = new portfolio_html_artefacts(isset($_GET["path"]) ? $_GET["path"] : ""); } else { if ($_GET["context"] == "manage") { $portfolio_html = new portfolio_html_manage(isset($_GET["path"]) ? $_GET["path"] : ""); } else { $portfolio_html = new portfolio_html_start(isset($_GET["path"]) ? $_GET["path"] : ""); } }
function DelPict($login, $prj_id, $pict_type) { $objResponse = new xajaxResponse(); $portf = new portfolio(); if ($portf->DelPict($login, $prj_id, $pict_type)) { $objResponse->script("aftdelpict({$pict_type})"); } return $objResponse; }
if (!$_in_setup) { header("HTTP/1.0 403 Forbidden"); exit; } unset($_SESSION['w_select']); //сбрасываем переменную сессии отмеченных работ (для удаления работ и перетаскивания их из одного раздела в другие) require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/shop.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/kwords.php"; $DB = new DB('master'); //echo "<pre>";print_r($_SESSION);die(); $prfs = new professions(); $profs = $prfs->GetSpecs($user->login); $size = sizeof($profs); $portf = new portfolio(); $prjs = $portf->GetPortf($user->uid, "NULL", true); $portf_cnt = array(); $shop_categories = shop::GetShopCategorys(false); if (!$prjs) { include "portfolio_in_setup.php"; } else { $lp_id = 0; $fp_id = 0; $fprj_id = 0; $lprj_id = 0; /** * Выбираем список профессий и считаем количество работ в каждом разделе. */ $lastprof = -1; $num_prjs = count($prjs);
<?php if (!defined('IN_STDF')) { header("HTTP/1.0 404 Not Found"); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/kwords.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/uploader/uploader.php"; $templates = array(uploader::getTemplate('uploader', 'portfolio/'), uploader::getTemplate('uploader.file', 'portfolio/'), uploader::getTemplate('uploader.popup', 'portfolio/')); $stop_words = new stop_words(hasPermissions('users')); setlocale(LC_ALL, 'ru_RU.CP1251'); $portf = new portfolio(); $prjs = $portf->GetPortf($user->uid, 'NULL', true); $prfs = new professions(); $profs = $prfs->GetAllProfessionsPortfWithoutMirrored($user->uid, "AND t.user_id IS NOT NULL"); $is_not_spec = sizeof($profs) <= 0; $first_profs = current($profs); if ($specs_add) { $specs_add_array = array(); for ($si = 0; $si < sizeof($specs_add); $si++) { $specs_add_array[$si] = professions::GetProfNameWP($specs_add[$si], ' / '); } $specs_add_string = join(", ", $specs_add_array); } else { $specs_add_string = "Нет"; } $html_keyword_js = '<a href="/freelancers/?word=$1" class="inherit">$2</a>'; $html_keyword = preg_replace('/\\$\\d/', '%s', $html_keyword_js);
/** * Блокирование/разблокирование работы в портфолио * * @param int $portfolio_id ID работы в портфолио * @param string $reason причина * @param int $reason_id ID причины, если она выбрана из списка (таблица admin_reasons, где act_id = 27) * @param string $reason_name Краткое описание причины действия (из селекта) для лога админских действий * @return object xajaxResponse */ function BlockedPortfolio($portfolio_id, $reason, $reason_id = null, $reason_name = '') { session_start(); $objResponse = new xajaxResponse(); if (hasPermissions('users')) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; $portfolio_id = intval($portfolio_id); $portfolio = portfolio::GetPrj($portfolio_id); if ($portfolio) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; $objUser = new users(); $objUser->GetUserByUID($portfolio['user_id']); // лог админских действий $sObjName = $portfolio['name']; $sObjLink = '/users/' . $objUser->login . '/viewproj.php?prjid=' . $portfolio['id']; $reason_id = $reason_id ? $reason_id : 0; $reason = str_replace('%USERNAME%', $objUser->uname . ' ' . $objUser->usurname, $reason); $reason = change_q($reason, FALSE, 0, TRUE); $user_id = $portfolio['user_id']; if ($portfolio['is_blocked'] == 't') { portfolio::UnBlocked($portfolio_id); // пишем лог админских действий admin_log::addLog(admin_log::OBJ_CODE_PROJ, admin_log::ACT_ID_PORTFOLIO_UNBLOCK, $user_id, $portfolio_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason); $objResponse->assign("portfolio-block-{$portfolio_id}", 'innerHTML', ' '); $objResponse->assign("portfolio-block-{$portfolio_id}", 'style.display', 'none'); $objResponse->assign("portfolio-button-{$portfolio_id}", 'innerHTML', '<a class="admn" href="javascript:void(0);" onclick="banned.blockedPortfolio(' . $portfolio_id . ')">Заблокировать</a>'); } else { $sBlockId = portfolio::Blocked($portfolio_id, $reason, $reason_id, $_SESSION['uid']); // пишем лог админских действий admin_log::addLog(admin_log::OBJ_CODE_PROJ, admin_log::ACT_ID_PORTFOLIO_BLOCK, $user_id, $portfolio_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason, $sBlockId); $reason = reformat($reason, 24, 0, 0, 1, 24); $html = BlockedPortfolioHTML($reason, $_SESSION['login'], "{$_SESSION['name']} {$_SESSION['surname']}"); $objResponse->assign("portfolio-block-{$portfolio_id}", 'innerHTML', $html); $objResponse->assign("portfolio-block-{$portfolio_id}", 'style.display', 'block'); $objResponse->assign("portfolio-button-{$portfolio_id}", 'innerHTML', '<a class="admn" href="javascript:void(0);" onclick="banned.unblockedPortfolio(' . $portfolio_id . ')">Разблокировать</a>'); } } else { $objResponse->alert('Несуществующее предложение'); } } return $objResponse; }
<?php include "trader-functions.php"; redirect_login_pf(); draw_trader_header('trade'); // Load the HTML_QuickForm module global $db_hostname, $db_database, $db_user, $db_password; $username = $_SESSION['username']; $uid = $_SESSION['uid']; $portfolio = new portfolio($_SESSION['pfid']); $pf_id = $portfolio->getID(); $pf_name = $portfolio->getName(); $pf_working_date = $portfolio->getWorkingDate(); $pf_exch = $portfolio->getExch()->getID(); try { $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("ERROR: Cannot connect: " . $e->getMessage()); } function draw_buy_table($pf_id, $pf_working_date, $pf_exch, $pf_nam) { global $pdo; print '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="cart" id="cart">'; print '<table border="1" cellpadding="5" cellspacing="0" align="center">'; print '<tr><td>Symb</td><td>Name</td><td>Comment</td><td>Date</td><td>Volume</td><td>Close</td><td>Value</td>'; if (isset($_SESSION['chart'])) { print '<td>Chart</td></tr>'; if (isset($_SESSION['chart_period'])) { $chart_period = $_SESSION['chart_period']; } else {
/** * Сообщение о блокировке проекта. * * @param int $portfolio_id ID работы в портфолио * @param string $reason причина * * @return @see messages::Add() */ public function SendBlockedPortfolio($portfolio_id = 0, $reason = '') { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/portfolio.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; $portfolio = portfolio::GetPrj($portfolio_id); $f_user = new users(); $f_user->GetUserByUID($portfolio['user_id']); $sName = $portfolio['name'] ? ' «' . $portfolio['name'] . '»' : ''; $link = getAbsUrl('/users/' . $f_user->login . '/viewproj.php?prjid=' . $portfolio['id']); $message = "\n{$f_user->uname} {$f_user->usurname}!\n\nМодераторы нашего ресурса нашли вашу работу{$sName} в портфолио некорректной:\n\nПричина: " . $reason . "\n\n{$link}\n\nМы призываем вас впредь не публиковать подобных проектов, иначе модераторы лишат ваш аккаунт доступа к сайту.\n\nЭто сообщение было выслано автоматически, и ответ на него не будет рассматриваться.\n\nНадеемся на понимание, Команда Free-lance.ru."; self::Add(users::GetUid($err, 'admin'), $f_user->login, $message, '', 1); }
/** * Перенос работ портфолио на боевые таблицы * * @param array $works Созданные в мастере работы * @return array */ public function transferWorks($works) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; foreach ($works as $k => $portf) { $pict = new CFile($portf['pict_id']); $new_position = $k + 1; if ($portf['pict_id'] > 0) { $sm_pict = $this->_db->val("SELECT id FROM file_wizard WHERE fname = ?", "sm_" . $pict->name); $files[] = array('id' => $portf['pict_id']); if ($sm_pict) { $files[] = array('id' => $sm_pict); } $table = 'file'; $dir = "users/" . substr($this->user->login, 0, 2) . "/" . $this->user->login . "/upload/"; list($pict, $sm_pict) = $this->transferFiles($files, $table, $dir); $pict = new CFile($pict['id']); $sm_pict = new CFile($sm_pict['id']); } $error = portfolio::AddPortf(wizard::getUserIDReg(), $portf['name'], $pict, $sm_pict, $portf['link'], $portf['descr'], $portf['prof_id'], null, null, null, null, null, $file_error, $preview_error, $new_position); if ($file_error) { $error = $file_error; } if ($preview_error) { $error = $preview_error; } if (!$error) { $delete_work[] = $portf['id']; } else { $error_work[] = $error . " - работа #{$portf['id']}"; } unset($error); } if ($error_work) { foreach ($error_work as $error) { $this->log->writeln("Error transfer portfolio content - user (" . wizard::getUserIDReg() . "|" . $this->getWizardUserID() . ") - Error: {$error}"); } } if ($delete_work) { $this->_db->query("DELETE FROM wizard_portfolio WHERE id IN (?l) AND wiz_uid = ?", $delete_work, $this->getWizardUserID()); } return $error_work; }
<?php include "trader-functions.php"; redirect_login_pf(); draw_trader_header('history'); // Load the HTML_QuickForm module global $db_hostname, $db_database, $db_user, $db_password; $username = $_SESSION['username']; $uid = $_SESSION['uid']; $portfolio = new portfolio($_SESSION['pfid']); $pf_id = $portfolio->getID(); $exch = $portfolio->getExch(); $pf_working_date = $portfolio->getWorkingDate(); $cash_in_hand = $portfolio->getCashInHand(); $this_page = $_SERVER['REQUEST_URI']; try { $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("ERROR: Cannot connect: " . $e->getMessage()); } function draw_performance_table($portfolio) { global $pdo; $pf_id = $portfolio->getID(); $pf_name = $portfolio->getName(); $pf_opening_balance = $portfolio->getOpeningBalance(); $pf_opening_date = $portfolio->getStartDate(); $pf_days_traded = $portfolio->countDaysTraded(); $pf_exchange_name = $portfolio->getExch()->getName(); $pf_exch = $portfolio->getExch()->getID();
$stamp = false; } if ($uid) { $scl->LogStat($uid, (int) get_uid(false), $_SERVER['REMOTE_ADDR'], $ref_id, (int) is_emp(), $stamp); } unset($scl); } /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// $skip_blocked = $user_obj->uid == get_uid(false) || hasPermissions('users') ? false : true; $prj_prev = (int) portfolio::GetPrjNear($user_obj->uid, $prjid, -1, $skip_blocked); $prj_next = (int) portfolio::GetPrjNear($user_obj->uid, $prjid, 1, $skip_blocked); $action = trim($_GET['action']); if ($action == 'delete') { $portf = new portfolio(); if ($prjid) { $error .= $portf->DelPortf(get_uid(false), $prjid, hasPermissions('users')); } $pattern = "#(/users/[\\w_\\d]+/)viewproj\\.php\\?prjid=[0-9]+.*#"; $locate_url = preg_replace($pattern, '$1', $_SERVER['REQUEST_URI']); header("location: {$locate_url}"); exit; } $proj = portfolio::GetPrj($prjid, $uid); $width = $height = 0; if (!$proj || $proj['is_blocked'] == 't' && $uid != get_uid(false) && !hasPermissions('users')) { $fpath = '../'; include ABS_PATH . '/404.php'; exit; } else {
/** * Провека параметров и подготовка настроек * для обновлении или добавления * * @param type $data * @return type */ public function isValid($data) { require_once ABS_PATH . '/freelancers/widgets/FreelancersPreviewWidget.php'; require_once ABS_PATH . '/classes/freelancer.php'; $this->is_valid = false; $max_pos = FreelancersPreviewWidget::MAX_ITEMS; $this->group_id = isset($data['group']) ? intval($data['group']) : 0; $this->prof_id = isset($data['prof']) ? intval($data['prof']) : 0; $hash = isset($data['hash']) ? $data['hash'] : null; //Проверка группы/раздела именно тех на странице которых был открыт попап if ($hash !== paramsHash(array($this->group_id, $this->prof_id))) { return $this->is_valid; } $value = isset($data['value']) ? $data['value'] : ''; $this->uid = isset($data['uid']) && $data['uid'] > 0 ? $data['uid'] : null; $this->pos = isset($data['pos']) && $data['pos'] > 0 && $data['pos'] <= $max_pos ? intval($data['pos']) : null; if (!$this->uid || !$this->pos || empty($value)) { return $this->is_valid; } $user = new freelancer(); $user->GetUserByUID($this->uid); if ($user->uid <= 0) { return $this->is_valid; } $pattern = implode('|', FreelancersPreviewEditorPopup::$types); $matches = array(); if (preg_match("/^({$pattern})_([0-9]+)\$/", $value, $matches)) { $this->type = self::$type_from_string[$matches[1]]; $this->src_id = $matches[2]; switch ($this->type) { case self::TYPE_PF: require_once ABS_PATH . '/classes/portfolio.php'; $portfolio = new portfolio(); $this->is_valid = (bool) $portfolio->isExistActive($this->uid, $this->src_id); break; case self::TYPE_TU: require_once ABS_PATH . '/classes/tservices/tservices.php'; $tservices = new tservices($this->uid); $this->is_valid = (bool) $tservices->isExistActive($this->src_id); break; } if ($this->is_valid) { $res = $this->getRowByUidAndPos($this->uid, $this->pos, $this->group_id, $this->prof_id); $this->id = $res ? $res['id'] : 0; //Уже есть данная позиция //то готовим данные для обновления if ($this->id > 0) { $this->data = array('src_id' => $this->src_id, 'type' => $this->type, 'is_default' => false); $this->is_default = $res['is_default'] == 't'; //Первое добавление позиции //то готовим новые данные для добавления } else { $exist_data = isset($_SESSION[self::SESS_EXIST_PREVIEW_DATA]) ? $_SESSION[self::SESS_EXIST_PREVIEW_DATA] : null; for ($idx = 1; $idx <= $max_pos; $idx++) { if ($idx == $this->pos) { $this->data[$idx] = array('src_id' => $this->src_id, 'type' => $this->type, 'user_id' => $this->uid, 'pos' => $idx, 'group_id' => $this->group_id, 'prof_id' => $this->prof_id, 'is_default' => false); } elseif (isset($exist_data['ids'][$idx - 1])) { $this->data[$idx] = array('src_id' => $exist_data['ids'][$idx - 1], 'type' => $exist_data['type'], 'user_id' => $this->uid, 'pos' => $idx, 'group_id' => $this->group_id, 'prof_id' => $this->prof_id, 'is_default' => false); } } } //Устанавливаем по возможности //текущии настройки для общего каталога / раздела /* - общий каталог поумолчанию из основного подраздела (специализации), но может и настраиваться по своему - раздел каталога поумолчанию из последнего отредактированного подраздела, но может настраиваться по своему - подраздел (специализация) настраивается по своему */ if ($this->prof_id > 0 && $this->group_id == 0 && count($this->data)) { $is_exist_setting_for_catalog = false; $is_exist_setting_for_group = false; require_once ABS_PATH . '/classes/professions.php'; $group_id = professions::GetGroupIdByProf($this->prof_id); $exist_data = $this->getExistData($group_id); $current_settings = array(); if ($exist_data) { foreach ($exist_data as $el) { //Существующие текущие настройки раздела if ($el['prof_id'] == $this->prof_id && $el['group_id'] == 0) { unset($el['id']); if ($el['pos'] == $this->pos) { $el['src_id'] = $this->src_id; $el['type'] = $this->type; } $current_settings[$el['pos']] = $el; //Существующие настройки для общего каталога } elseif ($el['prof_id'] == 0 && $el['group_id'] == 0 && $el['is_default'] == 'f') { $is_exist_setting_for_catalog = true; //Существующие настройки для группы } elseif ($el['prof_id'] == 0 && $el['group_id'] == $group_id && $el['is_default'] == 'f') { $is_exist_setting_for_group = true; } } } //Если настройки для каталога нет и эта основная //специализация то ее добавляем в общий каталог $data_extended = array(); $current_settings = $this->id > 0 ? $current_settings : $current_settings + $this->data; if (!$is_exist_setting_for_catalog) { $is_main_prof = (bool) $this->db()->val('SELECT 1 FROM freelancer WHERE uid = ?i AND spec = ?i LIMIT 1', $this->uid, $this->prof_id); if ($is_main_prof) { foreach ($current_settings as $el) { $el['prof_id'] = 0; $el['group_id'] = 0; $el['is_default'] = true; $data_extended[] = $el; } } } //Если нет настроек для группы раздела то добавляем текущии //настройки как поумолчанию для группы if (!$is_exist_setting_for_group) { foreach ($current_settings as $el) { $el['prof_id'] = 0; $el['group_id'] = $group_id; $el['is_default'] = true; $data_extended[] = $el; } } if ($data_extended) { $this->data_extra_update = $data_extended; } } } } return $this->is_valid; }
<?php if (!defined('IN_STDF')) { header("HTTP/1.0 404 Not Found"); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/kwords.php"; setlocale(LC_ALL, 'ru_RU.CP1251'); $portf = new portfolio(); $prjs = $portf->GetPortf($user->uid, 'NULL', true); $prfs = new professions(); $profs = $prfs->GetAllProfessionsPortfWithoutMirrored($user->uid, "AND t.user_id IS NOT NULL"); $is_not_spec = sizeof($profs) <= 0; $first_profs = current($profs); $html_keyword_js = '<a href="/freelancers/?word=$1" class="inherit">$2</a>'; $html_keyword = preg_replace('/\\$\\d/', '%s', $html_keyword_js); if ($user->uid == $_SESSION['uid']) { $spec_modified = professions::getLastModifiedSpec($user->uid); } ?> <?php if ((int) $user->spec == 0 && $user->uid == $_SESSION['uid']) { ?> <div class="b-fon b-fon_pad_20"> <div class="b-fon__body b-fon__body_pad_10 b-fon__body_padleft_30 b-fon__body_fontsize_13 b-fon__body_bg_ffeeeb"> <span class="b-icon b-icon_sbr_rattent b-icon_margleft_-25"></span><a class="b-layout__link" href="/users/<?php echo $user->login; ?>
/** * Включение превью везде * * @param integer $uid ИД ПОльзователя */ function OnAllPrev($uid) { global $DB; $sql = "select prof_id from portfolio where user_id=?i group by prof_id"; $res = $DB->rows($sql, $uid); if ($res) { foreach ($res as $v) { $prof_id = $v['prof_id']; portfolio::ChangeGrPrev($uid, $prof_id, $projs, 't'); } } }
<?php if (!defined('IN_STDF')) { header("HTTP/1.0 404 Not Found"); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php"; $prfs = new professions(); $uid = $user->GetUid($err); $error .= $err; $profs = $prfs->GetSelProf($uid); $portf = new portfolio(); $prjs = $portf->GetPortf($uid); ?> <script language="JavaScript1.2" type="text/javascript"> <!-- prjprof_id = new Array(); prjname = new Array(); prjlink = new Array(); prjdescr = new Array(); prjid = new Array(); prof_ids = new Array(); profnames = new Array(); <?php $i = 0; if ($prjs) { foreach ($prjs as $prj) { print "prjprof_id[{$i}] = '" . $prj['prof_id'] . "';\nprjid[{$i}] = '" . $prj['id'] . "';\nprjname[{$i}] = '" . $prj['name'] . "';\nprjlink[{$i}] = '" . $prj['link'] . "';\nprjdescr[{$i}] = '" . $prj['descr'] . "';\n\n";
function removeWork($uid, $params) { $objResponse =& new xajaxResponse(); if (!$uid) { $uid = get_uid(false); } $uid = intval($uid); $work_id = intval($params['id']); $prof_id = intval($params['prof_id']); if ($uid != get_uid(false) || !get_uid(false) || $work_id < 0) { return $objResponse; } $deleted = portfolio::DelPortf($uid, $work_id); if (!$deleted) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; $stop_words = new stop_words(hasPermissions('users')); $profession = new professions(); $portfolio = new portfolio(); $user = new users(); $user->login = $_SESSION['login']; $user->uid = $_SESSION['uid']; $user->is_pro = is_pro() ? 't' : 'f'; $is_owner = $uid == $_SESSION['uid']; $pinfo = current(portfolio::getPortfolioCategory($prof_id)); $pinfo['mainprofname'] = $pinfo['group_name']; $pinfo['profname'] = $pinfo['prof_name']; $pinfo['gr_prevs'] = $pinfo['show_preview']; $pinfo = $profession->prepareCostText($pinfo, $stop_words); $works = $portfolio->GetPortf($uid, $prof_id, true); if (!empty($works)) { $result = portfolio::prepareDataPortfolio($works, $uid, $stop_words, true); extract($result); $work[0]['id'] = 100; ob_start(); include_once $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.portfolio.works.php'; $sWorks = ob_get_contents(); ob_end_clean(); } else { $work[0]['id'] = null; $pp_noblocks[$prof_id] = array(); ob_start(); include $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.portfolio.works.php'; $sWorks = ob_get_contents(); ob_end_clean(); } if ($sWorks != '') { $objResponse->assign("prof_works_{$prof_id}", 'innerHTML', $sWorks); } $objResponse->script("\$('portfolio_work_edit').getParent().dispose()"); } else { $objResponse->call('alert', 'Ошибка, работу удалить не удалось.'); } return $objResponse; }
/** * Работы в портфолио. Утверждение/удаление записи * * @param string $stream_id идентификатор потока * @param int $user_id идентификатор модератора * @param int $from_id идентификатор пользователя * @param int $rec_id идентификатор записи * @param int $rec_type тип записи * @param int $action действие: 1 - утверждено, 2 - удалено * @param string $is_sent было ли отправлено уведомление * @param string $reason причина удаления */ function resolvePortfolio($stream_id = '', $user_id = 0, $from_id = 0, $rec_id = 0, $rec_type = 0, $action = 1, $is_sent = '', $reason = '') { $bRet = false; $sQuery = 'UPDATE moderation SET moder_num = ?i, status = ?i WHERE rec_id = ?i AND rec_type = ?i AND stream_id = ? RETURNING rec_id'; $sRecId = $GLOBALS['DB']->val($sQuery, $this->nResolveCnt, $action, $rec_id, self::MODER_PORTFOLIO, $stream_id); if ($sRecId) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/portfolio.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/admin_log.php'; $portfolio = portfolio::GetPrj($rec_id); $bRet = true; $objUser = new users(); $objUser->GetUserByUID($from_id); $sObjName = $portfolio['name']; $sObjLink = '/users/' . $objUser->login . '/viewproj.php?prjid=' . $portfolio['id']; if ($action == 1 && $portfolio['is_blocked'] == 't') { portfolio::UnBlocked($rec_id); // пишем лог админских действий admin_log::addLog(admin_log::OBJ_CODE_PROJ, admin_log::ACT_ID_PORTFOLIO_UNBLOCK, $from_id, $rec_id, $sObjName, $sObjLink, 0, '', 0, ''); } elseif ($action == 2 && $portfolio['is_blocked'] != 't') { $sReason = 'Содержит запрещенную информацию'; $sBlockId = portfolio::Blocked($rec_id, $reason, 0, $_SESSION['uid'], true); // пишем лог админских действий admin_log::addLog(admin_log::OBJ_CODE_PROJ, admin_log::ACT_ID_PORTFOLIO_BLOCK, $from_id, $rec_id, $sObjName, $sObjLink, 0, '', 0, $sReason, $sBlockId); } $GLOBALS['DB']->update('portfolio', array('moderator_status' => $user_id), 'id = ?i', $rec_id); } return $bRet; }
<?php include "trader-functions.php"; redirect_login_pf(); draw_trader_header('booty'); // Load the HTML_QuickForm module global $db_hostname, $db_database, $db_user, $db_password; $username = $_SESSION['username']; $uid = $_SESSION['uid']; $portfolio = new portfolio($_SESSION['pfid']); $pf_id = $portfolio->getID(); $exch = $portfolio->getExch(); $pf_working_date = $portfolio->getWorkingDate(); $next_trade_day = $portfolio->getExch()->nextTradeDay($pf_working_date); $cash_in_hand = $portfolio->getCashInHand(); $this_page = $_SERVER['REQUEST_URI']; try { $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("ERROR: Cannot connect: " . $e->getMessage()); } function stop_loss($portfolio) { global $pdo; $pf_auto_stop_loss = $portfolio->getAutoStopLoss(); if ($pf_auto_stop_loss) { $pf_id = $portfolio->getID(); $query = "select * from holdings where pfid = '{$pf_id}' order by symb;"; $pf_exch = $portfolio->getExch()->getID(); $pf_working_date = $portfolio->getWorkingDate();