16 public $layout =
false;
24 public function actionAdd($url, $title, $page_id, $additional, $key, $back_to_referer)
28 'title'=> $_GET[
'title'],
29 'page_id'=> $_GET[
'page_id'],
30 'additional' => $_GET[
'additional'],
31 'back_to_referer' => (
boolean) $_GET[
'back_to_referer'],
34 if($this->module->sign(serialize($data)) !== $key) {
35 throw new CHttpException(400,
'Invalid key');
39 $rememberedPage->collection_id = Yii::app()->getModule(
'remember')->getUserCollectionId();
41 $rememberedPage->url = $url;
42 $rememberedPage->title = $title;
43 $rememberedPage->page_id = $page_id;
44 $rememberedPage->additional = unserialize($additional);
46 if(!$rememberedPage->save()){
48 throw new CHttpException(400,
'Internal error');
50 $this->redirect($back_to_referer ===
'true' ? Yii::app()->request->getUrlReferrer() : $url);
58 public function actionShareByMail()
61 if(isset($_POST[
'ShareMailForm'])){
62 $mailForm->attributes = $_POST[
'ShareMailForm'];
65 if($mailForm->validate()) {
68 $mail->SetFrom($this->module->shareByMailEmail);
69 $mail->AddAddress($mailForm->email);
70 $mail->Subject = $this->module->shareByMailSubject;
72 $subject = $this->module->shareByMailSubject;
74 $mailurl = $mailForm->links;
75 if ( strstr($mailurl,$this->module->allowedURL) ) {
76 $mail->AddStringAttachment($this->actionLoadPdf(array($mailurl)), $this->module->pdfname);
79 $msg = $this->renderPartial(
'/mail_templates/share_by_email', array(
'links'=>$mailurl,
'description' => $mailForm->description),
true);
80 $mail->MsgHTML(utf8_decode($msg));
84 echo CActiveForm::validate($mailForm);
93 public function actionDownloadPdf()
96 $mailurls_ = explode(
' ',Yii::app()->request->getParam(
"links",
""));
97 foreach($mailurls_ as $mailurls__){
98 if (trim($mailurls__) !=
"" && strstr($mailurls__,$this->module->allowedURL) && !in_array(trim($mailurls__), $mailurls)){
99 $mailurls[] = trim($mailurls__);
102 if (
sizeof($mailurls) > 0){
103 header(
"Content-Type: application/pdf");
104 header(
"Content-disposition: attachment; filename=".$this->module->pdfname);
105 header(
"Pragma: no-cache");
106 echo $this->actionLoadPdf($mailurls);
114 public function actionLoadPdf($mailurls)
116 $filename = $this->module->tmpFolder.md5(date(DATE_RFC822).join(
"",$mailurls)).
".pdf";
117 $statement =
"wkhtmltopdf-amd64 -n --zoom 1 --page-width 1280px --footer-center \[page\] -T 14mm -B 14mm -L 14mm -R 14mm --disable-external-links --disable-internal-links ".join(
" ",$mailurls).
" ".$filename;#--disable-smart-shrinking
119 $out = file_get_contents($filename);
131 $id = Yii::app()->request->getQuery(
'id',
'');
132 $isAjax = Yii::app()->request->isAjaxRequest;
133 $collectionId = Yii::app()->getModule(
'remember')->getUserCollectionId();
135 $ids = explode(
",",$id);
136 foreach($ids as $id){
139 if($rememberedPage && $rememberedPage->collection_id == $collectionId){
140 $rememberedPage->delete();
142 throw new CHttpException(400);
146 if(isset($_SERVER[
'HTTP_REFERER'])){
147 $this->redirect($_SERVER[
'HTTP_REFERER']);
150 echo json_encode(array(
'status'=>
'success'));